@artooi/ag-ui-web-component 0.41.1 → 0.41.3
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/CHANGELOG.md +57 -1
- package/README.md +4 -1
- package/dist/ag-ui-web-component.bundle.js +78 -75
- package/dist/ag-ui-web-component.bundle.js.map +4 -4
- package/dist/constants.d.ts +6 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/core/ag_ui_chat.d.ts.map +1 -1
- package/dist/index.js +1482 -1021
- package/dist/index.js.map +4 -4
- package/dist/ui/history/conversation_history.d.ts +7 -2
- package/dist/ui/history/conversation_history.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +6 -1
- package/src/core/ag_ui_chat.ts +21 -1
- package/src/ui/history/conversation_history.ts +56 -8
- package/src/version.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -1998,12 +1998,12 @@ function seriesColor(index) {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
function geometryFor(width) {
|
|
2000
2000
|
const w = Math.max(MIN_WIDTH, width);
|
|
2001
|
-
const
|
|
2001
|
+
const h2 = Math.min(MAX_HEIGHT, Math.max(MIN_HEIGHT, Math.round(w * HEIGHT_RATIO)));
|
|
2002
2002
|
return {
|
|
2003
2003
|
width: w,
|
|
2004
|
-
height:
|
|
2004
|
+
height: h2,
|
|
2005
2005
|
plotW: w - PAD.left - PAD.right,
|
|
2006
|
-
plotH:
|
|
2006
|
+
plotH: h2 - PAD.top - PAD.bottom
|
|
2007
2007
|
};
|
|
2008
2008
|
}
|
|
2009
2009
|
function el(name, attrs) {
|
|
@@ -4307,6 +4307,10 @@ var ConversationHistory = class {
|
|
|
4307
4307
|
});
|
|
4308
4308
|
this.#continuation = client;
|
|
4309
4309
|
try {
|
|
4310
|
+
this.#host.announceTurn(content);
|
|
4311
|
+
if (this.#continuation !== client) {
|
|
4312
|
+
return;
|
|
4313
|
+
}
|
|
4310
4314
|
await client.send(content);
|
|
4311
4315
|
} finally {
|
|
4312
4316
|
if (this.#continuation === client) {
|
|
@@ -4351,8 +4355,8 @@ var ConversationHistory = class {
|
|
|
4351
4355
|
* Giving them to the replay, rather than leaving the client to add them, is
|
|
4352
4356
|
* what settles each card from its result. The checkpointed call is excluded,
|
|
4353
4357
|
* because the resume path answers it from the page the reload landed on; that
|
|
4354
|
-
* exclusion is held by "
|
|
4355
|
-
*
|
|
4358
|
+
* exclusion is held by "resumes with the landed page's result, and its card says
|
|
4359
|
+
* so" in `ag_ui_chat_reload_mid_run.test.ts`.
|
|
4356
4360
|
*/
|
|
4357
4361
|
async rehydrate() {
|
|
4358
4362
|
this.#generation += 1;
|
|
@@ -4495,15 +4499,33 @@ var ConversationHistory = class {
|
|
|
4495
4499
|
}
|
|
4496
4500
|
return {};
|
|
4497
4501
|
}
|
|
4498
|
-
/**
|
|
4502
|
+
/**
|
|
4503
|
+
* Complete the checkpointed navigating tool call and continue the run.
|
|
4504
|
+
*
|
|
4505
|
+
* The call's card is settled here, from the result the continuation carries.
|
|
4506
|
+
* The restore left it open on purpose -- it is the one call a reload was
|
|
4507
|
+
* expected by -- and nothing after this answers it: the run that follows
|
|
4508
|
+
* streams no result for a call the client answered itself. Left open, it
|
|
4509
|
+
* spun through the whole continuation, and the sweep that closes a run then
|
|
4510
|
+
* found it pending and called it not finished -- on the one call known to
|
|
4511
|
+
* have finished, since the page it moved to is the page doing the asking.
|
|
4512
|
+
*
|
|
4513
|
+
* Settled from the string the stored message holds, and with no outcome,
|
|
4514
|
+
* since `addToolResult` writes none, so the card is the one a later reload
|
|
4515
|
+
* draws from that message. The card can be missing, when the stored
|
|
4516
|
+
* transcript does not hold the call -- a store that kept the checkpoint and
|
|
4517
|
+
* lost the turn that made it -- and then there is nothing to settle. That
|
|
4518
|
+
* guard is held by "resumes a checkpointed navigating tool call on mount" in
|
|
4519
|
+
* `ag_ui_chat.test.ts`, whose transcript never made the call.
|
|
4520
|
+
*/
|
|
4499
4521
|
async #resumeFrom(checkpoint) {
|
|
4500
4522
|
this.#host.conversationStore().saveCheckpoint(this.#threadId, null);
|
|
4501
4523
|
const client = this.#host.ensureClient();
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
// Called on the element, as `this.navigationResult(...)` always was.
|
|
4505
|
-
JSON.stringify(this.#host.navigationResult().call(this.#host.element, checkpoint))
|
|
4524
|
+
const landed = JSON.stringify(
|
|
4525
|
+
this.#host.navigationResult().call(this.#host.element, checkpoint)
|
|
4506
4526
|
);
|
|
4527
|
+
client.addToolResult(checkpoint.toolCallId, landed);
|
|
4528
|
+
this.#host.transcript.card(checkpoint.toolCallId)?.settle(TOOL_CALL_STATUS.DONE, landed);
|
|
4507
4529
|
await client.resume();
|
|
4508
4530
|
}
|
|
4509
4531
|
};
|
|
@@ -5516,7 +5538,7 @@ var PanelPlacement = class {
|
|
|
5516
5538
|
#probeAnchor(before, delta) {
|
|
5517
5539
|
this.#applySize({ width: before.width + delta, height: before.height + delta });
|
|
5518
5540
|
const after = this.#host.element.getBoundingClientRect();
|
|
5519
|
-
const moved = (a,
|
|
5541
|
+
const moved = (a, b) => Math.abs(a - b) >= 0.5;
|
|
5520
5542
|
return {
|
|
5521
5543
|
x: moved(after.width, before.width) ? moved(after.left, before.left) ? "right" : "left" : null,
|
|
5522
5544
|
y: moved(after.height, before.height) ? moved(after.top, before.top) ? "bottom" : "top" : null
|
|
@@ -10776,7 +10798,10 @@ var AnswerActions = class {
|
|
|
10776
10798
|
}
|
|
10777
10799
|
};
|
|
10778
10800
|
|
|
10779
|
-
// node_modules/.pnpm/dompurify@3.4.
|
|
10801
|
+
// node_modules/.pnpm/dompurify@3.4.16/node_modules/dompurify/dist/purify.es.mjs
|
|
10802
|
+
function _OverloadYield(e, d) {
|
|
10803
|
+
this.v = e, this.k = d;
|
|
10804
|
+
}
|
|
10780
10805
|
function _arrayLikeToArray(r, a) {
|
|
10781
10806
|
(null == a || a > r.length) && (a = r.length);
|
|
10782
10807
|
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
@@ -10785,18 +10810,20 @@ function _arrayLikeToArray(r, a) {
|
|
|
10785
10810
|
function _arrayWithHoles(r) {
|
|
10786
10811
|
if (Array.isArray(r)) return r;
|
|
10787
10812
|
}
|
|
10788
|
-
function _iterableToArrayLimit(r,
|
|
10813
|
+
function _iterableToArrayLimit(r, l3) {
|
|
10789
10814
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
10790
10815
|
if (null != t) {
|
|
10791
|
-
var e, n, i,
|
|
10816
|
+
var e, n, i, u, a = [], f = true, o = false;
|
|
10792
10817
|
try {
|
|
10793
|
-
if (i = (t = t.call(r)).next, 0 ===
|
|
10794
|
-
|
|
10818
|
+
if (i = (t = t.call(r)).next, 0 === l3) {
|
|
10819
|
+
if (Object(t) !== t) return;
|
|
10820
|
+
f = false;
|
|
10821
|
+
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l3); f = true) ;
|
|
10795
10822
|
} catch (r2) {
|
|
10796
10823
|
o = true, n = r2;
|
|
10797
10824
|
} finally {
|
|
10798
10825
|
try {
|
|
10799
|
-
if (!
|
|
10826
|
+
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
10800
10827
|
} finally {
|
|
10801
10828
|
if (o) throw n;
|
|
10802
10829
|
}
|
|
@@ -10817,6 +10844,53 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
10817
10844
|
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
10818
10845
|
}
|
|
10819
10846
|
}
|
|
10847
|
+
function AsyncGenerator(e) {
|
|
10848
|
+
var t, n;
|
|
10849
|
+
function resume(t2, n2) {
|
|
10850
|
+
try {
|
|
10851
|
+
var r = e[t2](n2), o = r.value, u = o instanceof _OverloadYield;
|
|
10852
|
+
Promise.resolve(u ? o.v : o).then(function(n3) {
|
|
10853
|
+
if (u) {
|
|
10854
|
+
var i = "return" === t2 && o.k ? t2 : "next";
|
|
10855
|
+
if (!o.k || n3.done) return resume(i, n3);
|
|
10856
|
+
n3 = e[i](n3).value;
|
|
10857
|
+
}
|
|
10858
|
+
settle(!!r.done, n3);
|
|
10859
|
+
}, function(e2) {
|
|
10860
|
+
resume("throw", e2);
|
|
10861
|
+
});
|
|
10862
|
+
} catch (e2) {
|
|
10863
|
+
settle(2, e2);
|
|
10864
|
+
}
|
|
10865
|
+
}
|
|
10866
|
+
function settle(e2, r) {
|
|
10867
|
+
2 === e2 ? t.reject(r) : t.resolve({
|
|
10868
|
+
value: r,
|
|
10869
|
+
done: e2
|
|
10870
|
+
}), (t = t.next) ? resume(t.key, t.arg) : n = null;
|
|
10871
|
+
}
|
|
10872
|
+
this._invoke = function(e2, r) {
|
|
10873
|
+
return new Promise(function(o, u) {
|
|
10874
|
+
var i = {
|
|
10875
|
+
key: e2,
|
|
10876
|
+
arg: r,
|
|
10877
|
+
resolve: o,
|
|
10878
|
+
reject: u,
|
|
10879
|
+
next: null
|
|
10880
|
+
};
|
|
10881
|
+
n ? n = n.next = i : (t = n = i, resume(e2, r));
|
|
10882
|
+
});
|
|
10883
|
+
}, "function" != typeof e.return && (this.return = void 0);
|
|
10884
|
+
}
|
|
10885
|
+
AsyncGenerator.prototype["function" == typeof Symbol && Symbol.asyncIterator || "@@asyncIterator"] = function() {
|
|
10886
|
+
return this;
|
|
10887
|
+
}, AsyncGenerator.prototype.next = function(e) {
|
|
10888
|
+
return this._invoke("next", e);
|
|
10889
|
+
}, AsyncGenerator.prototype.throw = function(e) {
|
|
10890
|
+
return this._invoke("throw", e);
|
|
10891
|
+
}, AsyncGenerator.prototype.return = function(e) {
|
|
10892
|
+
return this._invoke("return", e);
|
|
10893
|
+
};
|
|
10820
10894
|
var entries = Object.entries;
|
|
10821
10895
|
var setPrototypeOf = Object.setPrototypeOf;
|
|
10822
10896
|
var isFrozen = Object.isFrozen;
|
|
@@ -10828,36 +10902,26 @@ var create = Object.create;
|
|
|
10828
10902
|
var _ref = typeof Reflect !== "undefined" && Reflect;
|
|
10829
10903
|
var apply = _ref.apply;
|
|
10830
10904
|
var construct = _ref.construct;
|
|
10831
|
-
if (!freeze) {
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
}
|
|
10841
|
-
if (!
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
}
|
|
10846
|
-
return func.apply(thisArg, args);
|
|
10847
|
-
};
|
|
10848
|
-
}
|
|
10849
|
-
if (!construct) {
|
|
10850
|
-
construct = function construct2(Func) {
|
|
10851
|
-
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
10852
|
-
args[_key2 - 1] = arguments[_key2];
|
|
10853
|
-
}
|
|
10854
|
-
return new Func(...args);
|
|
10855
|
-
};
|
|
10856
|
-
}
|
|
10905
|
+
if (!freeze) freeze = function freeze2(x2) {
|
|
10906
|
+
return x2;
|
|
10907
|
+
};
|
|
10908
|
+
if (!seal) seal = function seal2(x2) {
|
|
10909
|
+
return x2;
|
|
10910
|
+
};
|
|
10911
|
+
if (!apply) apply = function apply2(func, thisArg) {
|
|
10912
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
10913
|
+
return func.apply(thisArg, args);
|
|
10914
|
+
};
|
|
10915
|
+
if (!construct) construct = function construct2(Func) {
|
|
10916
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) args[_key2 - 1] = arguments[_key2];
|
|
10917
|
+
return new Func(...args);
|
|
10918
|
+
};
|
|
10857
10919
|
var arrayForEach = unapply(Array.prototype.forEach);
|
|
10920
|
+
Array.prototype.indexOf;
|
|
10858
10921
|
var arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
10859
10922
|
var arrayPop = unapply(Array.prototype.pop);
|
|
10860
10923
|
var arrayPush = unapply(Array.prototype.push);
|
|
10924
|
+
Array.prototype.slice;
|
|
10861
10925
|
var arraySplice = unapply(Array.prototype.splice);
|
|
10862
10926
|
var arrayIsArray = Array.isArray;
|
|
10863
10927
|
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
@@ -10876,40 +10940,28 @@ var regExpTest = unapply(RegExp.prototype.test);
|
|
|
10876
10940
|
var typeErrorCreate = unconstruct(TypeError);
|
|
10877
10941
|
function unapply(func) {
|
|
10878
10942
|
return function(thisArg) {
|
|
10879
|
-
if (thisArg instanceof RegExp)
|
|
10880
|
-
|
|
10881
|
-
}
|
|
10882
|
-
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
10883
|
-
args[_key3 - 1] = arguments[_key3];
|
|
10884
|
-
}
|
|
10943
|
+
if (thisArg instanceof RegExp) thisArg.lastIndex = 0;
|
|
10944
|
+
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) args[_key3 - 1] = arguments[_key3];
|
|
10885
10945
|
return apply(func, thisArg, args);
|
|
10886
10946
|
};
|
|
10887
10947
|
}
|
|
10888
10948
|
function unconstruct(Func) {
|
|
10889
10949
|
return function() {
|
|
10890
|
-
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)
|
|
10891
|
-
args[_key4] = arguments[_key4];
|
|
10892
|
-
}
|
|
10950
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) args[_key4] = arguments[_key4];
|
|
10893
10951
|
return construct(Func, args);
|
|
10894
10952
|
};
|
|
10895
10953
|
}
|
|
10896
10954
|
function addToSet(set, array) {
|
|
10897
10955
|
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
|
10898
|
-
if (setPrototypeOf)
|
|
10899
|
-
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
}
|
|
10904
|
-
let l = array.length;
|
|
10905
|
-
while (l--) {
|
|
10906
|
-
let element = array[l];
|
|
10956
|
+
if (setPrototypeOf) setPrototypeOf(set, null);
|
|
10957
|
+
if (!arrayIsArray(array)) return set;
|
|
10958
|
+
let l3 = array.length;
|
|
10959
|
+
while (l3--) {
|
|
10960
|
+
let element = array[l3];
|
|
10907
10961
|
if (typeof element === "string") {
|
|
10908
10962
|
const lcElement = transformCaseFunc(element);
|
|
10909
10963
|
if (lcElement !== element) {
|
|
10910
|
-
if (!isFrozen(array))
|
|
10911
|
-
array[l] = lcElement;
|
|
10912
|
-
}
|
|
10964
|
+
if (!isFrozen(array)) array[l3] = lcElement;
|
|
10913
10965
|
element = lcElement;
|
|
10914
10966
|
}
|
|
10915
10967
|
}
|
|
@@ -10918,12 +10970,7 @@ function addToSet(set, array) {
|
|
|
10918
10970
|
return set;
|
|
10919
10971
|
}
|
|
10920
10972
|
function cleanArray(array) {
|
|
10921
|
-
for (let index = 0; index < array.length; index++)
|
|
10922
|
-
const isPropertyExist = objectHasOwnProperty(array, index);
|
|
10923
|
-
if (!isPropertyExist) {
|
|
10924
|
-
array[index] = null;
|
|
10925
|
-
}
|
|
10926
|
-
}
|
|
10973
|
+
for (let index = 0; index < array.length; index++) if (!objectHasOwnProperty(array, index)) array[index] = null;
|
|
10927
10974
|
return array;
|
|
10928
10975
|
}
|
|
10929
10976
|
function clone(object) {
|
|
@@ -10932,44 +10979,31 @@ function clone(object) {
|
|
|
10932
10979
|
var _ref3 = _slicedToArray(_ref2, 2);
|
|
10933
10980
|
const property = _ref3[0];
|
|
10934
10981
|
const value = _ref3[1];
|
|
10935
|
-
|
|
10936
|
-
|
|
10937
|
-
if (
|
|
10938
|
-
|
|
10939
|
-
} else if (value && typeof value === "object" && value.constructor === Object) {
|
|
10940
|
-
newObject[property] = clone(value);
|
|
10941
|
-
} else {
|
|
10942
|
-
newObject[property] = value;
|
|
10943
|
-
}
|
|
10982
|
+
if (objectHasOwnProperty(object, property)) {
|
|
10983
|
+
if (arrayIsArray(value)) newObject[property] = cleanArray(value);
|
|
10984
|
+
else if (value && typeof value === "object" && value.constructor === Object) newObject[property] = clone(value);
|
|
10985
|
+
else newObject[property] = value;
|
|
10944
10986
|
}
|
|
10945
10987
|
}
|
|
10946
10988
|
return newObject;
|
|
10947
10989
|
}
|
|
10948
10990
|
function stringifyValue(value) {
|
|
10949
10991
|
switch (typeof value) {
|
|
10950
|
-
case "string":
|
|
10992
|
+
case "string":
|
|
10951
10993
|
return value;
|
|
10952
|
-
|
|
10953
|
-
case "number": {
|
|
10994
|
+
case "number":
|
|
10954
10995
|
return numberToString(value);
|
|
10955
|
-
|
|
10956
|
-
case "boolean": {
|
|
10996
|
+
case "boolean":
|
|
10957
10997
|
return booleanToString(value);
|
|
10958
|
-
|
|
10959
|
-
case "bigint": {
|
|
10998
|
+
case "bigint":
|
|
10960
10999
|
return bigintToString ? bigintToString(value) : "0";
|
|
10961
|
-
|
|
10962
|
-
case "symbol": {
|
|
11000
|
+
case "symbol":
|
|
10963
11001
|
return symbolToString ? symbolToString(value) : "Symbol()";
|
|
10964
|
-
|
|
10965
|
-
case "undefined": {
|
|
11002
|
+
case "undefined":
|
|
10966
11003
|
return objectToString(value);
|
|
10967
|
-
}
|
|
10968
11004
|
case "function":
|
|
10969
11005
|
case "object": {
|
|
10970
|
-
if (value === null)
|
|
10971
|
-
return objectToString(value);
|
|
10972
|
-
}
|
|
11006
|
+
if (value === null) return objectToString(value);
|
|
10973
11007
|
const valueAsRecord = value;
|
|
10974
11008
|
const valueToString = lookupGetter(valueAsRecord, "toString");
|
|
10975
11009
|
if (typeof valueToString === "function") {
|
|
@@ -10978,21 +11012,16 @@ function stringifyValue(value) {
|
|
|
10978
11012
|
}
|
|
10979
11013
|
return objectToString(value);
|
|
10980
11014
|
}
|
|
10981
|
-
default:
|
|
11015
|
+
default:
|
|
10982
11016
|
return objectToString(value);
|
|
10983
|
-
}
|
|
10984
11017
|
}
|
|
10985
11018
|
}
|
|
10986
11019
|
function lookupGetter(object, prop) {
|
|
10987
11020
|
while (object !== null) {
|
|
10988
11021
|
const desc = getOwnPropertyDescriptor(object, prop);
|
|
10989
11022
|
if (desc) {
|
|
10990
|
-
if (desc.get)
|
|
10991
|
-
|
|
10992
|
-
}
|
|
10993
|
-
if (typeof desc.value === "function") {
|
|
10994
|
-
return unapply(desc.value);
|
|
10995
|
-
}
|
|
11023
|
+
if (desc.get) return unapply(desc.get);
|
|
11024
|
+
if (typeof desc.value === "function") return unapply(desc.value);
|
|
10996
11025
|
}
|
|
10997
11026
|
object = getPrototypeOf(object);
|
|
10998
11027
|
}
|
|
@@ -11009,31 +11038,662 @@ function isRegex(value) {
|
|
|
11009
11038
|
return false;
|
|
11010
11039
|
}
|
|
11011
11040
|
}
|
|
11012
|
-
var html$1 = freeze([
|
|
11013
|
-
|
|
11014
|
-
|
|
11015
|
-
|
|
11016
|
-
|
|
11017
|
-
|
|
11041
|
+
var html$1 = freeze([
|
|
11042
|
+
"a",
|
|
11043
|
+
"abbr",
|
|
11044
|
+
"acronym",
|
|
11045
|
+
"address",
|
|
11046
|
+
"area",
|
|
11047
|
+
"article",
|
|
11048
|
+
"aside",
|
|
11049
|
+
"audio",
|
|
11050
|
+
"b",
|
|
11051
|
+
"bdi",
|
|
11052
|
+
"bdo",
|
|
11053
|
+
"big",
|
|
11054
|
+
"blink",
|
|
11055
|
+
"blockquote",
|
|
11056
|
+
"body",
|
|
11057
|
+
"br",
|
|
11058
|
+
"button",
|
|
11059
|
+
"canvas",
|
|
11060
|
+
"caption",
|
|
11061
|
+
"center",
|
|
11062
|
+
"cite",
|
|
11063
|
+
"code",
|
|
11064
|
+
"col",
|
|
11065
|
+
"colgroup",
|
|
11066
|
+
"content",
|
|
11067
|
+
"data",
|
|
11068
|
+
"datalist",
|
|
11069
|
+
"dd",
|
|
11070
|
+
"decorator",
|
|
11071
|
+
"del",
|
|
11072
|
+
"details",
|
|
11073
|
+
"dfn",
|
|
11074
|
+
"dialog",
|
|
11075
|
+
"dir",
|
|
11076
|
+
"div",
|
|
11077
|
+
"dl",
|
|
11078
|
+
"dt",
|
|
11079
|
+
"element",
|
|
11080
|
+
"em",
|
|
11081
|
+
"fieldset",
|
|
11082
|
+
"figcaption",
|
|
11083
|
+
"figure",
|
|
11084
|
+
"font",
|
|
11085
|
+
"footer",
|
|
11086
|
+
"form",
|
|
11087
|
+
"h1",
|
|
11088
|
+
"h2",
|
|
11089
|
+
"h3",
|
|
11090
|
+
"h4",
|
|
11091
|
+
"h5",
|
|
11092
|
+
"h6",
|
|
11093
|
+
"head",
|
|
11094
|
+
"header",
|
|
11095
|
+
"hgroup",
|
|
11096
|
+
"hr",
|
|
11097
|
+
"html",
|
|
11098
|
+
"i",
|
|
11099
|
+
"img",
|
|
11100
|
+
"input",
|
|
11101
|
+
"ins",
|
|
11102
|
+
"kbd",
|
|
11103
|
+
"label",
|
|
11104
|
+
"legend",
|
|
11105
|
+
"li",
|
|
11106
|
+
"main",
|
|
11107
|
+
"map",
|
|
11108
|
+
"mark",
|
|
11109
|
+
"marquee",
|
|
11110
|
+
"menu",
|
|
11111
|
+
"menuitem",
|
|
11112
|
+
"meter",
|
|
11113
|
+
"nav",
|
|
11114
|
+
"nobr",
|
|
11115
|
+
"ol",
|
|
11116
|
+
"optgroup",
|
|
11117
|
+
"option",
|
|
11118
|
+
"output",
|
|
11119
|
+
"p",
|
|
11120
|
+
"picture",
|
|
11121
|
+
"pre",
|
|
11122
|
+
"progress",
|
|
11123
|
+
"q",
|
|
11124
|
+
"rp",
|
|
11125
|
+
"rt",
|
|
11126
|
+
"ruby",
|
|
11127
|
+
"s",
|
|
11128
|
+
"samp",
|
|
11129
|
+
"search",
|
|
11130
|
+
"section",
|
|
11131
|
+
"select",
|
|
11132
|
+
"shadow",
|
|
11133
|
+
"slot",
|
|
11134
|
+
"small",
|
|
11135
|
+
"source",
|
|
11136
|
+
"spacer",
|
|
11137
|
+
"span",
|
|
11138
|
+
"strike",
|
|
11139
|
+
"strong",
|
|
11140
|
+
"style",
|
|
11141
|
+
"sub",
|
|
11142
|
+
"summary",
|
|
11143
|
+
"sup",
|
|
11144
|
+
"table",
|
|
11145
|
+
"tbody",
|
|
11146
|
+
"td",
|
|
11147
|
+
"template",
|
|
11148
|
+
"textarea",
|
|
11149
|
+
"tfoot",
|
|
11150
|
+
"th",
|
|
11151
|
+
"thead",
|
|
11152
|
+
"time",
|
|
11153
|
+
"tr",
|
|
11154
|
+
"track",
|
|
11155
|
+
"tt",
|
|
11156
|
+
"u",
|
|
11157
|
+
"ul",
|
|
11158
|
+
"var",
|
|
11159
|
+
"video",
|
|
11160
|
+
"wbr"
|
|
11161
|
+
]);
|
|
11162
|
+
var svg$1 = freeze([
|
|
11163
|
+
"svg",
|
|
11164
|
+
"a",
|
|
11165
|
+
"altglyph",
|
|
11166
|
+
"altglyphdef",
|
|
11167
|
+
"altglyphitem",
|
|
11168
|
+
"animatecolor",
|
|
11169
|
+
"animatemotion",
|
|
11170
|
+
"animatetransform",
|
|
11171
|
+
"circle",
|
|
11172
|
+
"clippath",
|
|
11173
|
+
"defs",
|
|
11174
|
+
"desc",
|
|
11175
|
+
"ellipse",
|
|
11176
|
+
"enterkeyhint",
|
|
11177
|
+
"exportparts",
|
|
11178
|
+
"filter",
|
|
11179
|
+
"font",
|
|
11180
|
+
"g",
|
|
11181
|
+
"glyph",
|
|
11182
|
+
"glyphref",
|
|
11183
|
+
"hkern",
|
|
11184
|
+
"image",
|
|
11185
|
+
"inputmode",
|
|
11186
|
+
"line",
|
|
11187
|
+
"lineargradient",
|
|
11188
|
+
"marker",
|
|
11189
|
+
"mask",
|
|
11190
|
+
"metadata",
|
|
11191
|
+
"mpath",
|
|
11192
|
+
"part",
|
|
11193
|
+
"path",
|
|
11194
|
+
"pattern",
|
|
11195
|
+
"polygon",
|
|
11196
|
+
"polyline",
|
|
11197
|
+
"radialgradient",
|
|
11198
|
+
"rect",
|
|
11199
|
+
"stop",
|
|
11200
|
+
"style",
|
|
11201
|
+
"switch",
|
|
11202
|
+
"symbol",
|
|
11203
|
+
"text",
|
|
11204
|
+
"textpath",
|
|
11205
|
+
"title",
|
|
11206
|
+
"tref",
|
|
11207
|
+
"tspan",
|
|
11208
|
+
"view",
|
|
11209
|
+
"vkern"
|
|
11210
|
+
]);
|
|
11211
|
+
var svgFilters = freeze([
|
|
11212
|
+
"feBlend",
|
|
11213
|
+
"feColorMatrix",
|
|
11214
|
+
"feComponentTransfer",
|
|
11215
|
+
"feComposite",
|
|
11216
|
+
"feConvolveMatrix",
|
|
11217
|
+
"feDiffuseLighting",
|
|
11218
|
+
"feDisplacementMap",
|
|
11219
|
+
"feDistantLight",
|
|
11220
|
+
"feDropShadow",
|
|
11221
|
+
"feFlood",
|
|
11222
|
+
"feFuncA",
|
|
11223
|
+
"feFuncB",
|
|
11224
|
+
"feFuncG",
|
|
11225
|
+
"feFuncR",
|
|
11226
|
+
"feGaussianBlur",
|
|
11227
|
+
"feImage",
|
|
11228
|
+
"feMerge",
|
|
11229
|
+
"feMergeNode",
|
|
11230
|
+
"feMorphology",
|
|
11231
|
+
"feOffset",
|
|
11232
|
+
"fePointLight",
|
|
11233
|
+
"feSpecularLighting",
|
|
11234
|
+
"feSpotLight",
|
|
11235
|
+
"feTile",
|
|
11236
|
+
"feTurbulence"
|
|
11237
|
+
]);
|
|
11238
|
+
var svgDisallowed = freeze([
|
|
11239
|
+
"animate",
|
|
11240
|
+
"color-profile",
|
|
11241
|
+
"cursor",
|
|
11242
|
+
"discard",
|
|
11243
|
+
"font-face",
|
|
11244
|
+
"font-face-format",
|
|
11245
|
+
"font-face-name",
|
|
11246
|
+
"font-face-src",
|
|
11247
|
+
"font-face-uri",
|
|
11248
|
+
"foreignobject",
|
|
11249
|
+
"hatch",
|
|
11250
|
+
"hatchpath",
|
|
11251
|
+
"mesh",
|
|
11252
|
+
"meshgradient",
|
|
11253
|
+
"meshpatch",
|
|
11254
|
+
"meshrow",
|
|
11255
|
+
"missing-glyph",
|
|
11256
|
+
"script",
|
|
11257
|
+
"set",
|
|
11258
|
+
"solidcolor",
|
|
11259
|
+
"unknown",
|
|
11260
|
+
"use"
|
|
11261
|
+
]);
|
|
11262
|
+
var mathMl$1 = freeze([
|
|
11263
|
+
"math",
|
|
11264
|
+
"menclose",
|
|
11265
|
+
"merror",
|
|
11266
|
+
"mfenced",
|
|
11267
|
+
"mfrac",
|
|
11268
|
+
"mglyph",
|
|
11269
|
+
"mi",
|
|
11270
|
+
"mlabeledtr",
|
|
11271
|
+
"mmultiscripts",
|
|
11272
|
+
"mn",
|
|
11273
|
+
"mo",
|
|
11274
|
+
"mover",
|
|
11275
|
+
"mpadded",
|
|
11276
|
+
"mphantom",
|
|
11277
|
+
"mroot",
|
|
11278
|
+
"mrow",
|
|
11279
|
+
"ms",
|
|
11280
|
+
"mspace",
|
|
11281
|
+
"msqrt",
|
|
11282
|
+
"mstyle",
|
|
11283
|
+
"msub",
|
|
11284
|
+
"msup",
|
|
11285
|
+
"msubsup",
|
|
11286
|
+
"mtable",
|
|
11287
|
+
"mtd",
|
|
11288
|
+
"mtext",
|
|
11289
|
+
"mtr",
|
|
11290
|
+
"munder",
|
|
11291
|
+
"munderover",
|
|
11292
|
+
"mprescripts"
|
|
11293
|
+
]);
|
|
11294
|
+
var mathMlDisallowed = freeze([
|
|
11295
|
+
"maction",
|
|
11296
|
+
"maligngroup",
|
|
11297
|
+
"malignmark",
|
|
11298
|
+
"mlongdiv",
|
|
11299
|
+
"mscarries",
|
|
11300
|
+
"mscarry",
|
|
11301
|
+
"msgroup",
|
|
11302
|
+
"mstack",
|
|
11303
|
+
"msline",
|
|
11304
|
+
"msrow",
|
|
11305
|
+
"semantics",
|
|
11306
|
+
"annotation",
|
|
11307
|
+
"annotation-xml",
|
|
11308
|
+
"mprescripts",
|
|
11309
|
+
"none"
|
|
11310
|
+
]);
|
|
11018
11311
|
var text3 = freeze(["#text"]);
|
|
11019
|
-
var html = freeze([
|
|
11020
|
-
|
|
11021
|
-
|
|
11022
|
-
|
|
11312
|
+
var html = freeze([
|
|
11313
|
+
"accept",
|
|
11314
|
+
"action",
|
|
11315
|
+
"align",
|
|
11316
|
+
"alt",
|
|
11317
|
+
"autocapitalize",
|
|
11318
|
+
"autocomplete",
|
|
11319
|
+
"autopictureinpicture",
|
|
11320
|
+
"autoplay",
|
|
11321
|
+
"background",
|
|
11322
|
+
"bgcolor",
|
|
11323
|
+
"border",
|
|
11324
|
+
"capture",
|
|
11325
|
+
"cellpadding",
|
|
11326
|
+
"cellspacing",
|
|
11327
|
+
"checked",
|
|
11328
|
+
"cite",
|
|
11329
|
+
"class",
|
|
11330
|
+
"clear",
|
|
11331
|
+
"color",
|
|
11332
|
+
"cols",
|
|
11333
|
+
"colspan",
|
|
11334
|
+
"command",
|
|
11335
|
+
"commandfor",
|
|
11336
|
+
"controls",
|
|
11337
|
+
"controlslist",
|
|
11338
|
+
"coords",
|
|
11339
|
+
"crossorigin",
|
|
11340
|
+
"datetime",
|
|
11341
|
+
"decoding",
|
|
11342
|
+
"default",
|
|
11343
|
+
"dir",
|
|
11344
|
+
"disabled",
|
|
11345
|
+
"disablepictureinpicture",
|
|
11346
|
+
"disableremoteplayback",
|
|
11347
|
+
"download",
|
|
11348
|
+
"draggable",
|
|
11349
|
+
"enctype",
|
|
11350
|
+
"enterkeyhint",
|
|
11351
|
+
"exportparts",
|
|
11352
|
+
"face",
|
|
11353
|
+
"for",
|
|
11354
|
+
"headers",
|
|
11355
|
+
"height",
|
|
11356
|
+
"hidden",
|
|
11357
|
+
"high",
|
|
11358
|
+
"href",
|
|
11359
|
+
"hreflang",
|
|
11360
|
+
"id",
|
|
11361
|
+
"inert",
|
|
11362
|
+
"inputmode",
|
|
11363
|
+
"integrity",
|
|
11364
|
+
"ismap",
|
|
11365
|
+
"kind",
|
|
11366
|
+
"label",
|
|
11367
|
+
"lang",
|
|
11368
|
+
"list",
|
|
11369
|
+
"loading",
|
|
11370
|
+
"loop",
|
|
11371
|
+
"low",
|
|
11372
|
+
"max",
|
|
11373
|
+
"maxlength",
|
|
11374
|
+
"media",
|
|
11375
|
+
"method",
|
|
11376
|
+
"min",
|
|
11377
|
+
"minlength",
|
|
11378
|
+
"multiple",
|
|
11379
|
+
"muted",
|
|
11380
|
+
"name",
|
|
11381
|
+
"nonce",
|
|
11382
|
+
"noshade",
|
|
11383
|
+
"novalidate",
|
|
11384
|
+
"nowrap",
|
|
11385
|
+
"open",
|
|
11386
|
+
"optimum",
|
|
11387
|
+
"part",
|
|
11388
|
+
"pattern",
|
|
11389
|
+
"placeholder",
|
|
11390
|
+
"playsinline",
|
|
11391
|
+
"popover",
|
|
11392
|
+
"popovertarget",
|
|
11393
|
+
"popovertargetaction",
|
|
11394
|
+
"poster",
|
|
11395
|
+
"preload",
|
|
11396
|
+
"pubdate",
|
|
11397
|
+
"radiogroup",
|
|
11398
|
+
"readonly",
|
|
11399
|
+
"rel",
|
|
11400
|
+
"required",
|
|
11401
|
+
"rev",
|
|
11402
|
+
"reversed",
|
|
11403
|
+
"role",
|
|
11404
|
+
"rows",
|
|
11405
|
+
"rowspan",
|
|
11406
|
+
"spellcheck",
|
|
11407
|
+
"scope",
|
|
11408
|
+
"selected",
|
|
11409
|
+
"shape",
|
|
11410
|
+
"size",
|
|
11411
|
+
"sizes",
|
|
11412
|
+
"slot",
|
|
11413
|
+
"span",
|
|
11414
|
+
"srclang",
|
|
11415
|
+
"start",
|
|
11416
|
+
"src",
|
|
11417
|
+
"srcset",
|
|
11418
|
+
"step",
|
|
11419
|
+
"style",
|
|
11420
|
+
"summary",
|
|
11421
|
+
"tabindex",
|
|
11422
|
+
"title",
|
|
11423
|
+
"translate",
|
|
11424
|
+
"type",
|
|
11425
|
+
"usemap",
|
|
11426
|
+
"valign",
|
|
11427
|
+
"value",
|
|
11428
|
+
"width",
|
|
11429
|
+
"wrap",
|
|
11430
|
+
"xmlns"
|
|
11431
|
+
]);
|
|
11432
|
+
var svg = freeze([
|
|
11433
|
+
"accent-height",
|
|
11434
|
+
"accumulate",
|
|
11435
|
+
"additive",
|
|
11436
|
+
"alignment-baseline",
|
|
11437
|
+
"amplitude",
|
|
11438
|
+
"ascent",
|
|
11439
|
+
"attributename",
|
|
11440
|
+
"attributetype",
|
|
11441
|
+
"azimuth",
|
|
11442
|
+
"basefrequency",
|
|
11443
|
+
"baseline-shift",
|
|
11444
|
+
"begin",
|
|
11445
|
+
"bias",
|
|
11446
|
+
"by",
|
|
11447
|
+
"class",
|
|
11448
|
+
"clip",
|
|
11449
|
+
"clippathunits",
|
|
11450
|
+
"clip-path",
|
|
11451
|
+
"clip-rule",
|
|
11452
|
+
"color",
|
|
11453
|
+
"color-interpolation",
|
|
11454
|
+
"color-interpolation-filters",
|
|
11455
|
+
"color-profile",
|
|
11456
|
+
"color-rendering",
|
|
11457
|
+
"cx",
|
|
11458
|
+
"cy",
|
|
11459
|
+
"d",
|
|
11460
|
+
"dx",
|
|
11461
|
+
"dy",
|
|
11462
|
+
"diffuseconstant",
|
|
11463
|
+
"direction",
|
|
11464
|
+
"display",
|
|
11465
|
+
"divisor",
|
|
11466
|
+
"dominant-baseline",
|
|
11467
|
+
"dur",
|
|
11468
|
+
"edgemode",
|
|
11469
|
+
"elevation",
|
|
11470
|
+
"end",
|
|
11471
|
+
"exponent",
|
|
11472
|
+
"fill",
|
|
11473
|
+
"fill-opacity",
|
|
11474
|
+
"fill-rule",
|
|
11475
|
+
"filter",
|
|
11476
|
+
"filterunits",
|
|
11477
|
+
"flood-color",
|
|
11478
|
+
"flood-opacity",
|
|
11479
|
+
"font-family",
|
|
11480
|
+
"font-size",
|
|
11481
|
+
"font-size-adjust",
|
|
11482
|
+
"font-stretch",
|
|
11483
|
+
"font-style",
|
|
11484
|
+
"font-variant",
|
|
11485
|
+
"font-weight",
|
|
11486
|
+
"fx",
|
|
11487
|
+
"fy",
|
|
11488
|
+
"g1",
|
|
11489
|
+
"g2",
|
|
11490
|
+
"glyph-name",
|
|
11491
|
+
"glyphref",
|
|
11492
|
+
"gradientunits",
|
|
11493
|
+
"gradienttransform",
|
|
11494
|
+
"height",
|
|
11495
|
+
"href",
|
|
11496
|
+
"id",
|
|
11497
|
+
"image-rendering",
|
|
11498
|
+
"in",
|
|
11499
|
+
"in2",
|
|
11500
|
+
"intercept",
|
|
11501
|
+
"k",
|
|
11502
|
+
"k1",
|
|
11503
|
+
"k2",
|
|
11504
|
+
"k3",
|
|
11505
|
+
"k4",
|
|
11506
|
+
"kerning",
|
|
11507
|
+
"keypoints",
|
|
11508
|
+
"keysplines",
|
|
11509
|
+
"keytimes",
|
|
11510
|
+
"lang",
|
|
11511
|
+
"lengthadjust",
|
|
11512
|
+
"letter-spacing",
|
|
11513
|
+
"kernelmatrix",
|
|
11514
|
+
"kernelunitlength",
|
|
11515
|
+
"lighting-color",
|
|
11516
|
+
"local",
|
|
11517
|
+
"marker-end",
|
|
11518
|
+
"marker-mid",
|
|
11519
|
+
"marker-start",
|
|
11520
|
+
"markerheight",
|
|
11521
|
+
"markerunits",
|
|
11522
|
+
"markerwidth",
|
|
11523
|
+
"maskcontentunits",
|
|
11524
|
+
"maskunits",
|
|
11525
|
+
"max",
|
|
11526
|
+
"mask",
|
|
11527
|
+
"mask-type",
|
|
11528
|
+
"media",
|
|
11529
|
+
"method",
|
|
11530
|
+
"mode",
|
|
11531
|
+
"min",
|
|
11532
|
+
"name",
|
|
11533
|
+
"numoctaves",
|
|
11534
|
+
"offset",
|
|
11535
|
+
"operator",
|
|
11536
|
+
"opacity",
|
|
11537
|
+
"order",
|
|
11538
|
+
"orient",
|
|
11539
|
+
"orientation",
|
|
11540
|
+
"origin",
|
|
11541
|
+
"overflow",
|
|
11542
|
+
"paint-order",
|
|
11543
|
+
"path",
|
|
11544
|
+
"pathlength",
|
|
11545
|
+
"patterncontentunits",
|
|
11546
|
+
"patterntransform",
|
|
11547
|
+
"patternunits",
|
|
11548
|
+
"pointer-events",
|
|
11549
|
+
"points",
|
|
11550
|
+
"preservealpha",
|
|
11551
|
+
"preserveaspectratio",
|
|
11552
|
+
"primitiveunits",
|
|
11553
|
+
"r",
|
|
11554
|
+
"rx",
|
|
11555
|
+
"ry",
|
|
11556
|
+
"radius",
|
|
11557
|
+
"refx",
|
|
11558
|
+
"refy",
|
|
11559
|
+
"repeatcount",
|
|
11560
|
+
"repeatdur",
|
|
11561
|
+
"restart",
|
|
11562
|
+
"result",
|
|
11563
|
+
"rotate",
|
|
11564
|
+
"scale",
|
|
11565
|
+
"seed",
|
|
11566
|
+
"shape-rendering",
|
|
11567
|
+
"slope",
|
|
11568
|
+
"specularconstant",
|
|
11569
|
+
"specularexponent",
|
|
11570
|
+
"spreadmethod",
|
|
11571
|
+
"startoffset",
|
|
11572
|
+
"stddeviation",
|
|
11573
|
+
"stitchtiles",
|
|
11574
|
+
"stop-color",
|
|
11575
|
+
"stop-opacity",
|
|
11576
|
+
"stroke-dasharray",
|
|
11577
|
+
"stroke-dashoffset",
|
|
11578
|
+
"stroke-linecap",
|
|
11579
|
+
"stroke-linejoin",
|
|
11580
|
+
"stroke-miterlimit",
|
|
11581
|
+
"stroke-opacity",
|
|
11582
|
+
"stroke",
|
|
11583
|
+
"stroke-width",
|
|
11584
|
+
"style",
|
|
11585
|
+
"surfacescale",
|
|
11586
|
+
"systemlanguage",
|
|
11587
|
+
"tabindex",
|
|
11588
|
+
"tablevalues",
|
|
11589
|
+
"targetx",
|
|
11590
|
+
"targety",
|
|
11591
|
+
"transform",
|
|
11592
|
+
"transform-origin",
|
|
11593
|
+
"text-anchor",
|
|
11594
|
+
"text-decoration",
|
|
11595
|
+
"text-orientation",
|
|
11596
|
+
"text-rendering",
|
|
11597
|
+
"textlength",
|
|
11598
|
+
"type",
|
|
11599
|
+
"u1",
|
|
11600
|
+
"u2",
|
|
11601
|
+
"unicode",
|
|
11602
|
+
"values",
|
|
11603
|
+
"vector-effect",
|
|
11604
|
+
"viewbox",
|
|
11605
|
+
"visibility",
|
|
11606
|
+
"version",
|
|
11607
|
+
"vert-adv-y",
|
|
11608
|
+
"vert-origin-x",
|
|
11609
|
+
"vert-origin-y",
|
|
11610
|
+
"width",
|
|
11611
|
+
"word-spacing",
|
|
11612
|
+
"wrap",
|
|
11613
|
+
"writing-mode",
|
|
11614
|
+
"xchannelselector",
|
|
11615
|
+
"ychannelselector",
|
|
11616
|
+
"x",
|
|
11617
|
+
"x1",
|
|
11618
|
+
"x2",
|
|
11619
|
+
"xmlns",
|
|
11620
|
+
"y",
|
|
11621
|
+
"y1",
|
|
11622
|
+
"y2",
|
|
11623
|
+
"z",
|
|
11624
|
+
"zoomandpan"
|
|
11625
|
+
]);
|
|
11626
|
+
var mathMl = freeze([
|
|
11627
|
+
"accent",
|
|
11628
|
+
"accentunder",
|
|
11629
|
+
"align",
|
|
11630
|
+
"bevelled",
|
|
11631
|
+
"close",
|
|
11632
|
+
"columnalign",
|
|
11633
|
+
"columnlines",
|
|
11634
|
+
"columnspacing",
|
|
11635
|
+
"columnspan",
|
|
11636
|
+
"denomalign",
|
|
11637
|
+
"depth",
|
|
11638
|
+
"dir",
|
|
11639
|
+
"display",
|
|
11640
|
+
"displaystyle",
|
|
11641
|
+
"encoding",
|
|
11642
|
+
"fence",
|
|
11643
|
+
"frame",
|
|
11644
|
+
"height",
|
|
11645
|
+
"href",
|
|
11646
|
+
"id",
|
|
11647
|
+
"largeop",
|
|
11648
|
+
"length",
|
|
11649
|
+
"linethickness",
|
|
11650
|
+
"lquote",
|
|
11651
|
+
"lspace",
|
|
11652
|
+
"mathbackground",
|
|
11653
|
+
"mathcolor",
|
|
11654
|
+
"mathsize",
|
|
11655
|
+
"mathvariant",
|
|
11656
|
+
"maxsize",
|
|
11657
|
+
"minsize",
|
|
11658
|
+
"movablelimits",
|
|
11659
|
+
"notation",
|
|
11660
|
+
"numalign",
|
|
11661
|
+
"open",
|
|
11662
|
+
"rowalign",
|
|
11663
|
+
"rowlines",
|
|
11664
|
+
"rowspacing",
|
|
11665
|
+
"rowspan",
|
|
11666
|
+
"rspace",
|
|
11667
|
+
"rquote",
|
|
11668
|
+
"scriptlevel",
|
|
11669
|
+
"scriptminsize",
|
|
11670
|
+
"scriptsizemultiplier",
|
|
11671
|
+
"selection",
|
|
11672
|
+
"separator",
|
|
11673
|
+
"separators",
|
|
11674
|
+
"stretchy",
|
|
11675
|
+
"subscriptshift",
|
|
11676
|
+
"supscriptshift",
|
|
11677
|
+
"symmetric",
|
|
11678
|
+
"voffset",
|
|
11679
|
+
"width",
|
|
11680
|
+
"xmlns"
|
|
11681
|
+
]);
|
|
11682
|
+
var xml = freeze([
|
|
11683
|
+
"xlink:href",
|
|
11684
|
+
"xml:id",
|
|
11685
|
+
"xlink:title",
|
|
11686
|
+
"xml:space",
|
|
11687
|
+
"xmlns:xlink"
|
|
11688
|
+
]);
|
|
11023
11689
|
var MUSTACHE_EXPR = seal(/{{[\w\W]*|^[\w\W]*}}/g);
|
|
11024
11690
|
var ERB_EXPR = seal(/<%[\w\W]*|^[\w\W]*%>/g);
|
|
11025
11691
|
var TMPLIT_EXPR = seal(/\${[\w\W]*/g);
|
|
11026
11692
|
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/);
|
|
11027
11693
|
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
|
11028
|
-
var IS_ALLOWED_URI = seal(
|
|
11029
|
-
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
|
11030
|
-
// eslint-disable-line no-useless-escape
|
|
11031
|
-
);
|
|
11694
|
+
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i);
|
|
11032
11695
|
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
11033
|
-
var ATTR_WHITESPACE = seal(
|
|
11034
|
-
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
|
11035
|
-
// eslint-disable-line no-control-regex
|
|
11036
|
-
);
|
|
11696
|
+
var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g);
|
|
11037
11697
|
var DOCTYPE_NAME = seal(/^html$/i);
|
|
11038
11698
|
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
11039
11699
|
var ELEMENT_MARKUP_PROBE = seal(/<[/\w!]/g);
|
|
@@ -11046,18 +11706,24 @@ var NODE_TYPE = {
|
|
|
11046
11706
|
text: 3,
|
|
11047
11707
|
cdataSection: 4,
|
|
11048
11708
|
entityReference: 5,
|
|
11049
|
-
// Deprecated
|
|
11050
11709
|
entityNode: 6,
|
|
11051
|
-
// Deprecated
|
|
11052
11710
|
processingInstruction: 7,
|
|
11053
11711
|
comment: 8,
|
|
11054
11712
|
document: 9,
|
|
11055
11713
|
documentType: 10,
|
|
11056
11714
|
documentFragment: 11,
|
|
11057
11715
|
notation: 12
|
|
11058
|
-
// Deprecated
|
|
11059
11716
|
};
|
|
11060
|
-
var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
11717
|
+
var LITERAL_TEXT_ELEMENT_NAMES = [
|
|
11718
|
+
"style",
|
|
11719
|
+
"script",
|
|
11720
|
+
"xmp",
|
|
11721
|
+
"iframe",
|
|
11722
|
+
"noembed",
|
|
11723
|
+
"noframes",
|
|
11724
|
+
"plaintext",
|
|
11725
|
+
"noscript"
|
|
11726
|
+
];
|
|
11061
11727
|
var LITERAL_TEXT_ELEMENTS = freeze(addToSet({}, LITERAL_TEXT_ELEMENT_NAMES));
|
|
11062
11728
|
var LITERAL_TEXT_CLOSE = (function() {
|
|
11063
11729
|
const map = {};
|
|
@@ -11070,14 +11736,10 @@ var getGlobal = function getGlobal2() {
|
|
|
11070
11736
|
return typeof window === "undefined" ? null : window;
|
|
11071
11737
|
};
|
|
11072
11738
|
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
|
|
11073
|
-
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function")
|
|
11074
|
-
return null;
|
|
11075
|
-
}
|
|
11739
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") return null;
|
|
11076
11740
|
let suffix = null;
|
|
11077
11741
|
const ATTR_NAME = "data-tt-policy-suffix";
|
|
11078
|
-
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME))
|
|
11079
|
-
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
11080
|
-
}
|
|
11742
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
11081
11743
|
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
|
11082
11744
|
try {
|
|
11083
11745
|
return trustedTypes.createPolicy(policyName, {
|
|
@@ -11116,7 +11778,7 @@ var _resolveObjectOption = function _resolveObjectOption2(cfg, key, makeFallback
|
|
|
11116
11778
|
function createDOMPurify() {
|
|
11117
11779
|
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
|
11118
11780
|
const DOMPurify = (root) => createDOMPurify(root);
|
|
11119
|
-
DOMPurify.version = "3.4.
|
|
11781
|
+
DOMPurify.version = "3.4.16";
|
|
11120
11782
|
DOMPurify.removed = [];
|
|
11121
11783
|
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document || !window2.Element) {
|
|
11122
11784
|
DOMPurify.isSupported = false;
|
|
@@ -11126,8 +11788,8 @@ function createDOMPurify() {
|
|
|
11126
11788
|
const originalDocument = document2;
|
|
11127
11789
|
const currentScript = originalDocument.currentScript;
|
|
11128
11790
|
window2.DocumentFragment;
|
|
11129
|
-
const HTMLTemplateElement = window2.HTMLTemplateElement, Node2 = window2.Node, Element2 = window2.Element, NodeFilter2 = window2.NodeFilter
|
|
11130
|
-
|
|
11791
|
+
const HTMLTemplateElement = window2.HTMLTemplateElement, Node2 = window2.Node, Element2 = window2.Element, NodeFilter2 = window2.NodeFilter;
|
|
11792
|
+
window2.NamedNodeMap === void 0 && (window2.NamedNodeMap || window2.MozNamedAttrMap);
|
|
11131
11793
|
window2.HTMLFormElement;
|
|
11132
11794
|
const DOMParser = window2.DOMParser, trustedTypes = window2.trustedTypes;
|
|
11133
11795
|
const ElementPrototype = Element2.prototype;
|
|
@@ -11150,9 +11812,7 @@ function createDOMPurify() {
|
|
|
11150
11812
|
};
|
|
11151
11813
|
if (typeof HTMLTemplateElement === "function") {
|
|
11152
11814
|
const template = document2.createElement("template");
|
|
11153
|
-
if (template.content && template.content.ownerDocument)
|
|
11154
|
-
document2 = template.content.ownerDocument;
|
|
11155
|
-
}
|
|
11815
|
+
if (template.content && template.content.ownerDocument) document2 = template.content.ownerDocument;
|
|
11156
11816
|
}
|
|
11157
11817
|
let trustedTypesPolicy;
|
|
11158
11818
|
let emptyHTML = "";
|
|
@@ -11160,9 +11820,7 @@ function createDOMPurify() {
|
|
|
11160
11820
|
let defaultTrustedTypesPolicyResolved = false;
|
|
11161
11821
|
let IN_TRUSTED_TYPES_POLICY = 0;
|
|
11162
11822
|
const _assertNotInTrustedTypesPolicy = function _assertNotInTrustedTypesPolicy2() {
|
|
11163
|
-
if (IN_TRUSTED_TYPES_POLICY > 0)
|
|
11164
|
-
throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
|
|
11165
|
-
}
|
|
11823
|
+
if (IN_TRUSTED_TYPES_POLICY > 0) throw typeErrorCreate('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.');
|
|
11166
11824
|
};
|
|
11167
11825
|
const _createTrustedHTML = function _createTrustedHTML2(html2) {
|
|
11168
11826
|
_assertNotInTrustedTypesPolicy();
|
|
@@ -11196,9 +11854,20 @@ function createDOMPurify() {
|
|
|
11196
11854
|
const MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, TMPLIT_EXPR$1 = TMPLIT_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE, CUSTOM_ELEMENT$1 = CUSTOM_ELEMENT;
|
|
11197
11855
|
let IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
11198
11856
|
let ALLOWED_TAGS2 = null;
|
|
11199
|
-
const DEFAULT_ALLOWED_TAGS = addToSet({}, [
|
|
11857
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [
|
|
11858
|
+
...html$1,
|
|
11859
|
+
...svg$1,
|
|
11860
|
+
...svgFilters,
|
|
11861
|
+
...mathMl$1,
|
|
11862
|
+
...text3
|
|
11863
|
+
]);
|
|
11200
11864
|
let ALLOWED_ATTR2 = null;
|
|
11201
|
-
const DEFAULT_ALLOWED_ATTR = addToSet({}, [
|
|
11865
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [
|
|
11866
|
+
...html,
|
|
11867
|
+
...svg,
|
|
11868
|
+
...mathMl,
|
|
11869
|
+
...xml
|
|
11870
|
+
]);
|
|
11202
11871
|
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
11203
11872
|
tagNameCheck: {
|
|
11204
11873
|
writable: true,
|
|
@@ -11275,15 +11944,6 @@ function createDOMPurify() {
|
|
|
11275
11944
|
"noscript",
|
|
11276
11945
|
"plaintext",
|
|
11277
11946
|
"script",
|
|
11278
|
-
// <selectedcontent> mirrors the selected <option>'s subtree, cloned by
|
|
11279
|
-
// the UA (customizable <select>) — including any on* handlers — and the
|
|
11280
|
-
// engine re-mirrors synchronously whenever a removal changes which
|
|
11281
|
-
// option/selectedcontent is current, even inside DOMPurify's inert
|
|
11282
|
-
// DOMParser document. Hoisting its children on removal re-inserts a fresh
|
|
11283
|
-
// mirror target ahead of the walk, which the engine refills, looping
|
|
11284
|
-
// forever (DoS) and amplifying output. Dropping its content on removal
|
|
11285
|
-
// (rather than hoisting) breaks that cascade; the content is a duplicate
|
|
11286
|
-
// of the option, which is sanitized on its own. See campaign-3 F1/F6.
|
|
11287
11947
|
"selectedcontent",
|
|
11288
11948
|
"style",
|
|
11289
11949
|
"svg",
|
|
@@ -11294,21 +11954,59 @@ function createDOMPurify() {
|
|
|
11294
11954
|
"xmp"
|
|
11295
11955
|
]);
|
|
11296
11956
|
let DATA_URI_TAGS = null;
|
|
11297
|
-
const DEFAULT_DATA_URI_TAGS = addToSet({}, [
|
|
11957
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, [
|
|
11958
|
+
"audio",
|
|
11959
|
+
"video",
|
|
11960
|
+
"img",
|
|
11961
|
+
"source",
|
|
11962
|
+
"image",
|
|
11963
|
+
"track"
|
|
11964
|
+
]);
|
|
11298
11965
|
let URI_SAFE_ATTRIBUTES = null;
|
|
11299
|
-
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
|
|
11966
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, [
|
|
11967
|
+
"alt",
|
|
11968
|
+
"class",
|
|
11969
|
+
"for",
|
|
11970
|
+
"id",
|
|
11971
|
+
"label",
|
|
11972
|
+
"name",
|
|
11973
|
+
"pattern",
|
|
11974
|
+
"placeholder",
|
|
11975
|
+
"role",
|
|
11976
|
+
"summary",
|
|
11977
|
+
"title",
|
|
11978
|
+
"value",
|
|
11979
|
+
"style",
|
|
11980
|
+
"xmlns"
|
|
11981
|
+
]);
|
|
11300
11982
|
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
11301
11983
|
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
11302
11984
|
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
|
11303
11985
|
let NAMESPACE = HTML_NAMESPACE;
|
|
11304
11986
|
let IS_EMPTY_INPUT = false;
|
|
11305
11987
|
let ALLOWED_NAMESPACES = null;
|
|
11306
|
-
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
|
|
11307
|
-
|
|
11988
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [
|
|
11989
|
+
MATHML_NAMESPACE,
|
|
11990
|
+
SVG_NAMESPACE,
|
|
11991
|
+
HTML_NAMESPACE
|
|
11992
|
+
], stringToString);
|
|
11993
|
+
const DEFAULT_MATHML_TEXT_INTEGRATION_POINTS = freeze([
|
|
11994
|
+
"mi",
|
|
11995
|
+
"mo",
|
|
11996
|
+
"mn",
|
|
11997
|
+
"ms",
|
|
11998
|
+
"mtext"
|
|
11999
|
+
]);
|
|
11308
12000
|
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS);
|
|
11309
12001
|
const DEFAULT_HTML_INTEGRATION_POINTS = freeze(["annotation-xml"]);
|
|
11310
12002
|
let HTML_INTEGRATION_POINTS = addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS);
|
|
11311
|
-
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
|
|
12003
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, [
|
|
12004
|
+
"title",
|
|
12005
|
+
"style",
|
|
12006
|
+
"font",
|
|
12007
|
+
"a",
|
|
12008
|
+
"script"
|
|
12009
|
+
]);
|
|
11312
12010
|
let PARSER_MEDIA_TYPE = null;
|
|
11313
12011
|
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
|
11314
12012
|
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
|
@@ -11320,25 +12018,14 @@ function createDOMPurify() {
|
|
|
11320
12018
|
};
|
|
11321
12019
|
const _parseConfig = function _parseConfig2() {
|
|
11322
12020
|
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
11323
|
-
if (CONFIG && CONFIG === cfg)
|
|
11324
|
-
|
|
11325
|
-
}
|
|
11326
|
-
if (!cfg || typeof cfg !== "object") {
|
|
11327
|
-
cfg = {};
|
|
11328
|
-
}
|
|
12021
|
+
if (CONFIG && CONFIG === cfg) return;
|
|
12022
|
+
if (!cfg || typeof cfg !== "object") cfg = {};
|
|
11329
12023
|
cfg = clone(cfg);
|
|
11330
|
-
PARSER_MEDIA_TYPE =
|
|
11331
|
-
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
12024
|
+
PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
11332
12025
|
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
|
11333
|
-
ALLOWED_TAGS2 = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, {
|
|
11334
|
-
|
|
11335
|
-
});
|
|
11336
|
-
ALLOWED_ATTR2 = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, {
|
|
11337
|
-
transform: transformCaseFunc
|
|
11338
|
-
});
|
|
11339
|
-
ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, {
|
|
11340
|
-
transform: stringToString
|
|
11341
|
-
});
|
|
12026
|
+
ALLOWED_TAGS2 = _resolveSetOption(cfg, "ALLOWED_TAGS", DEFAULT_ALLOWED_TAGS, { transform: transformCaseFunc });
|
|
12027
|
+
ALLOWED_ATTR2 = _resolveSetOption(cfg, "ALLOWED_ATTR", DEFAULT_ALLOWED_ATTR, { transform: transformCaseFunc });
|
|
12028
|
+
ALLOWED_NAMESPACES = _resolveSetOption(cfg, "ALLOWED_NAMESPACES", DEFAULT_ALLOWED_NAMESPACES, { transform: stringToString });
|
|
11342
12029
|
URI_SAFE_ATTRIBUTES = _resolveSetOption(cfg, "ADD_URI_SAFE_ATTR", DEFAULT_URI_SAFE_ATTRIBUTES, {
|
|
11343
12030
|
transform: transformCaseFunc,
|
|
11344
12031
|
base: DEFAULT_URI_SAFE_ATTRIBUTES
|
|
@@ -11347,15 +12034,9 @@ function createDOMPurify() {
|
|
|
11347
12034
|
transform: transformCaseFunc,
|
|
11348
12035
|
base: DEFAULT_DATA_URI_TAGS
|
|
11349
12036
|
});
|
|
11350
|
-
FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, {
|
|
11351
|
-
|
|
11352
|
-
});
|
|
11353
|
-
FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), {
|
|
11354
|
-
transform: transformCaseFunc
|
|
11355
|
-
});
|
|
11356
|
-
FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), {
|
|
11357
|
-
transform: transformCaseFunc
|
|
11358
|
-
});
|
|
12037
|
+
FORBID_CONTENTS = _resolveSetOption(cfg, "FORBID_CONTENTS", DEFAULT_FORBID_CONTENTS, { transform: transformCaseFunc });
|
|
12038
|
+
FORBID_TAGS = _resolveSetOption(cfg, "FORBID_TAGS", clone({}), { transform: transformCaseFunc });
|
|
12039
|
+
FORBID_ATTR = _resolveSetOption(cfg, "FORBID_ATTR", clone({}), { transform: transformCaseFunc });
|
|
11359
12040
|
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES && typeof cfg.USE_PROFILES === "object" ? clone(cfg.USE_PROFILES) : cfg.USE_PROFILES : false;
|
|
11360
12041
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
|
11361
12042
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
|
@@ -11374,36 +12055,16 @@ function createDOMPurify() {
|
|
|
11374
12055
|
IN_PLACE = cfg.IN_PLACE || false;
|
|
11375
12056
|
IS_ALLOWED_URI$1 = isRegex(cfg.ALLOWED_URI_REGEXP) ? cfg.ALLOWED_URI_REGEXP : IS_ALLOWED_URI;
|
|
11376
12057
|
NAMESPACE = typeof cfg.NAMESPACE === "string" ? cfg.NAMESPACE : HTML_NAMESPACE;
|
|
11377
|
-
MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(
|
|
11378
|
-
|
|
11379
|
-
"MATHML_TEXT_INTEGRATION_POINTS",
|
|
11380
|
-
() => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS)
|
|
11381
|
-
// Default built-in map
|
|
11382
|
-
);
|
|
11383
|
-
HTML_INTEGRATION_POINTS = _resolveObjectOption(
|
|
11384
|
-
cfg,
|
|
11385
|
-
"HTML_INTEGRATION_POINTS",
|
|
11386
|
-
() => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS)
|
|
11387
|
-
// Default built-in map
|
|
11388
|
-
);
|
|
12058
|
+
MATHML_TEXT_INTEGRATION_POINTS = _resolveObjectOption(cfg, "MATHML_TEXT_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_MATHML_TEXT_INTEGRATION_POINTS));
|
|
12059
|
+
HTML_INTEGRATION_POINTS = _resolveObjectOption(cfg, "HTML_INTEGRATION_POINTS", () => addToSet({}, DEFAULT_HTML_INTEGRATION_POINTS));
|
|
11389
12060
|
const customElementHandling = _resolveObjectOption(cfg, "CUSTOM_ELEMENT_HANDLING", () => create(null));
|
|
11390
12061
|
CUSTOM_ELEMENT_HANDLING = create(null);
|
|
11391
|
-
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck))
|
|
11392
|
-
|
|
11393
|
-
|
|
11394
|
-
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) {
|
|
11395
|
-
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
11396
|
-
}
|
|
11397
|
-
if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") {
|
|
11398
|
-
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
|
|
11399
|
-
}
|
|
12062
|
+
if (objectHasOwnProperty(customElementHandling, "tagNameCheck") && isRegexOrFunction(customElementHandling.tagNameCheck)) CUSTOM_ELEMENT_HANDLING.tagNameCheck = customElementHandling.tagNameCheck;
|
|
12063
|
+
if (objectHasOwnProperty(customElementHandling, "attributeNameCheck") && isRegexOrFunction(customElementHandling.attributeNameCheck)) CUSTOM_ELEMENT_HANDLING.attributeNameCheck = customElementHandling.attributeNameCheck;
|
|
12064
|
+
if (objectHasOwnProperty(customElementHandling, "allowCustomizedBuiltInElements") && typeof customElementHandling.allowCustomizedBuiltInElements === "boolean") CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = customElementHandling.allowCustomizedBuiltInElements;
|
|
11400
12065
|
seal(CUSTOM_ELEMENT_HANDLING);
|
|
11401
|
-
if (SAFE_FOR_TEMPLATES)
|
|
11402
|
-
|
|
11403
|
-
}
|
|
11404
|
-
if (RETURN_DOM_FRAGMENT) {
|
|
11405
|
-
RETURN_DOM = true;
|
|
11406
|
-
}
|
|
12066
|
+
if (SAFE_FOR_TEMPLATES) ALLOW_DATA_ATTR = false;
|
|
12067
|
+
if (RETURN_DOM_FRAGMENT) RETURN_DOM = true;
|
|
11407
12068
|
if (USE_PROFILES) {
|
|
11408
12069
|
ALLOWED_TAGS2 = addToSet({}, text3);
|
|
11409
12070
|
ALLOWED_ATTR2 = create(null);
|
|
@@ -11430,48 +12091,36 @@ function createDOMPurify() {
|
|
|
11430
12091
|
EXTRA_ELEMENT_HANDLING.tagCheck = null;
|
|
11431
12092
|
EXTRA_ELEMENT_HANDLING.attributeCheck = null;
|
|
11432
12093
|
if (objectHasOwnProperty(cfg, "ADD_TAGS")) {
|
|
11433
|
-
if (typeof cfg.ADD_TAGS === "function")
|
|
11434
|
-
|
|
11435
|
-
|
|
11436
|
-
if (ALLOWED_TAGS2 === DEFAULT_ALLOWED_TAGS) {
|
|
11437
|
-
ALLOWED_TAGS2 = clone(ALLOWED_TAGS2);
|
|
11438
|
-
}
|
|
12094
|
+
if (typeof cfg.ADD_TAGS === "function") EXTRA_ELEMENT_HANDLING.tagCheck = cfg.ADD_TAGS;
|
|
12095
|
+
else if (arrayIsArray(cfg.ADD_TAGS)) {
|
|
12096
|
+
if (ALLOWED_TAGS2 === DEFAULT_ALLOWED_TAGS) ALLOWED_TAGS2 = clone(ALLOWED_TAGS2);
|
|
11439
12097
|
addToSet(ALLOWED_TAGS2, cfg.ADD_TAGS, transformCaseFunc);
|
|
11440
12098
|
}
|
|
11441
12099
|
}
|
|
11442
12100
|
if (objectHasOwnProperty(cfg, "ADD_ATTR")) {
|
|
11443
|
-
if (typeof cfg.ADD_ATTR === "function")
|
|
11444
|
-
|
|
11445
|
-
|
|
11446
|
-
if (ALLOWED_ATTR2 === DEFAULT_ALLOWED_ATTR) {
|
|
11447
|
-
ALLOWED_ATTR2 = clone(ALLOWED_ATTR2);
|
|
11448
|
-
}
|
|
12101
|
+
if (typeof cfg.ADD_ATTR === "function") EXTRA_ELEMENT_HANDLING.attributeCheck = cfg.ADD_ATTR;
|
|
12102
|
+
else if (arrayIsArray(cfg.ADD_ATTR)) {
|
|
12103
|
+
if (ALLOWED_ATTR2 === DEFAULT_ALLOWED_ATTR) ALLOWED_ATTR2 = clone(ALLOWED_ATTR2);
|
|
11449
12104
|
addToSet(ALLOWED_ATTR2, cfg.ADD_ATTR, transformCaseFunc);
|
|
11450
12105
|
}
|
|
11451
12106
|
}
|
|
11452
12107
|
if (objectHasOwnProperty(cfg, "ADD_FORBID_CONTENTS") && arrayIsArray(cfg.ADD_FORBID_CONTENTS)) {
|
|
11453
|
-
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS)
|
|
11454
|
-
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
11455
|
-
}
|
|
12108
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
11456
12109
|
addToSet(FORBID_CONTENTS, cfg.ADD_FORBID_CONTENTS, transformCaseFunc);
|
|
11457
12110
|
}
|
|
11458
|
-
if (KEEP_CONTENT)
|
|
11459
|
-
|
|
11460
|
-
|
|
11461
|
-
|
|
11462
|
-
|
|
11463
|
-
|
|
12111
|
+
if (KEEP_CONTENT) ALLOWED_TAGS2["#text"] = true;
|
|
12112
|
+
if (WHOLE_DOCUMENT) addToSet(ALLOWED_TAGS2, [
|
|
12113
|
+
"html",
|
|
12114
|
+
"head",
|
|
12115
|
+
"body"
|
|
12116
|
+
]);
|
|
11464
12117
|
if (ALLOWED_TAGS2.table) {
|
|
11465
12118
|
addToSet(ALLOWED_TAGS2, ["tbody"]);
|
|
11466
12119
|
delete FORBID_TAGS.tbody;
|
|
11467
12120
|
}
|
|
11468
12121
|
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
11469
|
-
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function")
|
|
11470
|
-
|
|
11471
|
-
}
|
|
11472
|
-
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
|
|
11473
|
-
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
11474
|
-
}
|
|
12122
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
12123
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
11475
12124
|
const previousTrustedTypesPolicy = trustedTypesPolicy;
|
|
11476
12125
|
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
11477
12126
|
try {
|
|
@@ -11484,85 +12133,55 @@ function createDOMPurify() {
|
|
|
11484
12133
|
trustedTypesPolicy = void 0;
|
|
11485
12134
|
emptyHTML = "";
|
|
11486
12135
|
} else {
|
|
11487
|
-
if (trustedTypesPolicy === void 0)
|
|
11488
|
-
|
|
11489
|
-
}
|
|
11490
|
-
if (trustedTypesPolicy && typeof emptyHTML === "string") {
|
|
11491
|
-
emptyHTML = _createTrustedHTML("");
|
|
11492
|
-
}
|
|
11493
|
-
}
|
|
11494
|
-
if (freeze) {
|
|
11495
|
-
freeze(cfg);
|
|
12136
|
+
if (trustedTypesPolicy === void 0) trustedTypesPolicy = _getDefaultTrustedTypesPolicy();
|
|
12137
|
+
if (trustedTypesPolicy && typeof emptyHTML === "string") emptyHTML = _createTrustedHTML("");
|
|
11496
12138
|
}
|
|
12139
|
+
if (freeze) freeze(cfg);
|
|
11497
12140
|
CONFIG = cfg;
|
|
11498
12141
|
};
|
|
11499
|
-
const ALL_SVG_TAGS = addToSet({}, [
|
|
12142
|
+
const ALL_SVG_TAGS = addToSet({}, [
|
|
12143
|
+
...svg$1,
|
|
12144
|
+
...svgFilters,
|
|
12145
|
+
...svgDisallowed
|
|
12146
|
+
]);
|
|
11500
12147
|
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
11501
12148
|
const _checkSvgNamespace = function _checkSvgNamespace2(tagName, parent, parentTagName) {
|
|
11502
|
-
if (parent.namespaceURI === HTML_NAMESPACE)
|
|
11503
|
-
|
|
11504
|
-
}
|
|
11505
|
-
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
11506
|
-
return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
11507
|
-
}
|
|
12149
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "svg";
|
|
12150
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
11508
12151
|
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
11509
12152
|
};
|
|
11510
12153
|
const _checkMathMlNamespace = function _checkMathMlNamespace2(tagName, parent, parentTagName) {
|
|
11511
|
-
if (parent.namespaceURI === HTML_NAMESPACE)
|
|
11512
|
-
|
|
11513
|
-
}
|
|
11514
|
-
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
11515
|
-
return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
11516
|
-
}
|
|
12154
|
+
if (parent.namespaceURI === HTML_NAMESPACE) return tagName === "math";
|
|
12155
|
+
if (parent.namespaceURI === SVG_NAMESPACE) return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
|
11517
12156
|
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
11518
12157
|
};
|
|
11519
12158
|
const _checkHtmlNamespace = function _checkHtmlNamespace2(tagName, parent, parentTagName) {
|
|
11520
|
-
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName])
|
|
11521
|
-
|
|
11522
|
-
}
|
|
11523
|
-
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
11524
|
-
return false;
|
|
11525
|
-
}
|
|
12159
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) return false;
|
|
12160
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) return false;
|
|
11526
12161
|
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
11527
12162
|
};
|
|
11528
12163
|
const _checkValidNamespace = function _checkValidNamespace2(element) {
|
|
11529
12164
|
let parent = getParentNode(element);
|
|
11530
|
-
if (!parent || !parent.tagName) {
|
|
11531
|
-
|
|
11532
|
-
|
|
11533
|
-
|
|
11534
|
-
};
|
|
11535
|
-
}
|
|
12165
|
+
if (!parent || !parent.tagName) parent = {
|
|
12166
|
+
namespaceURI: NAMESPACE,
|
|
12167
|
+
tagName: "template"
|
|
12168
|
+
};
|
|
11536
12169
|
const tagName = stringToLowerCase(element.tagName);
|
|
11537
12170
|
const parentTagName = stringToLowerCase(parent.tagName);
|
|
11538
|
-
if (!ALLOWED_NAMESPACES[element.namespaceURI])
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
if (element.namespaceURI ===
|
|
11542
|
-
|
|
11543
|
-
}
|
|
11544
|
-
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
11545
|
-
return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
11546
|
-
}
|
|
11547
|
-
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
11548
|
-
return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
11549
|
-
}
|
|
11550
|
-
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
11551
|
-
return true;
|
|
11552
|
-
}
|
|
12171
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) return false;
|
|
12172
|
+
if (element.namespaceURI === SVG_NAMESPACE) return _checkSvgNamespace(tagName, parent, parentTagName);
|
|
12173
|
+
if (element.namespaceURI === MATHML_NAMESPACE) return _checkMathMlNamespace(tagName, parent, parentTagName);
|
|
12174
|
+
if (element.namespaceURI === HTML_NAMESPACE) return _checkHtmlNamespace(tagName, parent, parentTagName);
|
|
12175
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) return true;
|
|
11553
12176
|
return false;
|
|
11554
12177
|
};
|
|
11555
12178
|
const _forceRemove = function _forceRemove2(node) {
|
|
11556
|
-
arrayPush(DOMPurify.removed, {
|
|
11557
|
-
element: node
|
|
11558
|
-
});
|
|
12179
|
+
arrayPush(DOMPurify.removed, { element: node });
|
|
11559
12180
|
try {
|
|
11560
12181
|
getParentNode(node).removeChild(node);
|
|
11561
12182
|
} catch (_2) {
|
|
11562
12183
|
remove(node);
|
|
11563
|
-
if (!getParentNode(node))
|
|
11564
|
-
throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
11565
|
-
}
|
|
12184
|
+
if (!getParentNode(node)) throw typeErrorCreate("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
|
|
11566
12185
|
}
|
|
11567
12186
|
};
|
|
11568
12187
|
const _stripAttributeNode = function _stripAttributeNode2(element, attribute, name) {
|
|
@@ -11591,34 +12210,25 @@ function createDOMPurify() {
|
|
|
11591
12210
|
});
|
|
11592
12211
|
}
|
|
11593
12212
|
const attributes = getAttributes(root);
|
|
11594
|
-
if (attributes) {
|
|
11595
|
-
|
|
11596
|
-
|
|
11597
|
-
|
|
11598
|
-
if (typeof name === "string") {
|
|
11599
|
-
_stripAttributeNode(root, attribute, name);
|
|
11600
|
-
}
|
|
11601
|
-
}
|
|
12213
|
+
if (attributes) for (let i = attributes.length - 1; i >= 0; --i) {
|
|
12214
|
+
const attribute = attributes[i];
|
|
12215
|
+
const name = attribute && attribute.name;
|
|
12216
|
+
if (typeof name === "string") _stripAttributeNode(root, attribute, name);
|
|
11602
12217
|
}
|
|
11603
12218
|
};
|
|
11604
12219
|
const _removeAttribute = function _removeAttribute2(name, element, attr) {
|
|
11605
|
-
if (!attr) {
|
|
11606
|
-
|
|
11607
|
-
|
|
11608
|
-
|
|
11609
|
-
attr = null;
|
|
11610
|
-
}
|
|
12220
|
+
if (!attr) try {
|
|
12221
|
+
attr = element.getAttributeNode(name);
|
|
12222
|
+
} catch (_2) {
|
|
12223
|
+
attr = null;
|
|
11611
12224
|
}
|
|
11612
12225
|
arrayPush(DOMPurify.removed, {
|
|
11613
12226
|
attribute: attr || null,
|
|
11614
12227
|
from: element
|
|
11615
12228
|
});
|
|
11616
12229
|
try {
|
|
11617
|
-
if (attr)
|
|
11618
|
-
|
|
11619
|
-
} else {
|
|
11620
|
-
element.removeAttribute(name);
|
|
11621
|
-
}
|
|
12230
|
+
if (attr) removeAttributeNode(element, attr);
|
|
12231
|
+
else element.removeAttribute(name);
|
|
11622
12232
|
} catch (_2) {
|
|
11623
12233
|
try {
|
|
11624
12234
|
element.removeAttribute(name);
|
|
@@ -11626,30 +12236,23 @@ function createDOMPurify() {
|
|
|
11626
12236
|
}
|
|
11627
12237
|
}
|
|
11628
12238
|
if (name === "is") {
|
|
11629
|
-
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
11630
|
-
|
|
11631
|
-
|
|
11632
|
-
|
|
11633
|
-
|
|
11634
|
-
|
|
11635
|
-
|
|
11636
|
-
element.setAttribute(name, "");
|
|
11637
|
-
} catch (_2) {
|
|
11638
|
-
}
|
|
12239
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) try {
|
|
12240
|
+
_forceRemove(element);
|
|
12241
|
+
} catch (_2) {
|
|
12242
|
+
}
|
|
12243
|
+
else try {
|
|
12244
|
+
element.setAttribute(name, "");
|
|
12245
|
+
} catch (_2) {
|
|
11639
12246
|
}
|
|
11640
12247
|
}
|
|
11641
12248
|
};
|
|
11642
12249
|
const _stripDisallowedAttributes = function _stripDisallowedAttributes2(element) {
|
|
11643
12250
|
const attributes = getAttributes(element);
|
|
11644
|
-
if (!attributes)
|
|
11645
|
-
return;
|
|
11646
|
-
}
|
|
12251
|
+
if (!attributes) return;
|
|
11647
12252
|
for (let i = attributes.length - 1; i >= 0; --i) {
|
|
11648
12253
|
const attribute = attributes[i];
|
|
11649
12254
|
const name = attribute && attribute.name;
|
|
11650
|
-
if (typeof name !== "string" || ALLOWED_ATTR2[transformCaseFunc(name)])
|
|
11651
|
-
continue;
|
|
11652
|
-
}
|
|
12255
|
+
if (typeof name !== "string" || ALLOWED_ATTR2[transformCaseFunc(name)]) continue;
|
|
11653
12256
|
_stripAttributeNode(element, attribute, name);
|
|
11654
12257
|
}
|
|
11655
12258
|
};
|
|
@@ -11657,31 +12260,18 @@ function createDOMPurify() {
|
|
|
11657
12260
|
const stack = [root];
|
|
11658
12261
|
while (stack.length > 0) {
|
|
11659
12262
|
const node = stack.pop();
|
|
11660
|
-
|
|
11661
|
-
if (nodeType === NODE_TYPE.element) {
|
|
11662
|
-
_stripDisallowedAttributes(node);
|
|
11663
|
-
}
|
|
12263
|
+
if (_readNodeType(node) === NODE_TYPE.element) _stripDisallowedAttributes(node);
|
|
11664
12264
|
const childNodes = getChildNodes(node);
|
|
11665
|
-
if (childNodes)
|
|
11666
|
-
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
11667
|
-
stack.push(childNodes[i]);
|
|
11668
|
-
}
|
|
11669
|
-
}
|
|
12265
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
11670
12266
|
}
|
|
11671
12267
|
};
|
|
11672
12268
|
const _isPatchLinkageAttribute = function _isPatchLinkageAttribute2(lcName, lcTag) {
|
|
11673
|
-
if (!SAFE_FOR_XML)
|
|
11674
|
-
|
|
11675
|
-
}
|
|
11676
|
-
if (lcName === "patchsrc") {
|
|
11677
|
-
return true;
|
|
11678
|
-
}
|
|
12269
|
+
if (!SAFE_FOR_XML) return false;
|
|
12270
|
+
if (lcName === "patchsrc") return true;
|
|
11679
12271
|
return lcName === "for" && lcTag !== "label" && lcTag !== "output";
|
|
11680
12272
|
};
|
|
11681
12273
|
const _neutralizePatchLinkage = function _neutralizePatchLinkage2(root) {
|
|
11682
|
-
if (!SAFE_FOR_XML)
|
|
11683
|
-
return;
|
|
11684
|
-
}
|
|
12274
|
+
if (!SAFE_FOR_XML) return;
|
|
11685
12275
|
const stack = [root];
|
|
11686
12276
|
while (stack.length > 0) {
|
|
11687
12277
|
const node = stack.pop();
|
|
@@ -11697,41 +12287,28 @@ function createDOMPurify() {
|
|
|
11697
12287
|
const element = node;
|
|
11698
12288
|
const lcTag = transformCaseFunc(_readNodeName(node));
|
|
11699
12289
|
try {
|
|
11700
|
-
if (element.hasAttribute && element.hasAttribute("patchsrc"))
|
|
11701
|
-
|
|
11702
|
-
}
|
|
11703
|
-
if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) {
|
|
11704
|
-
element.removeAttribute("for");
|
|
11705
|
-
}
|
|
12290
|
+
if (element.hasAttribute && element.hasAttribute("patchsrc")) element.removeAttribute("patchsrc");
|
|
12291
|
+
if (element.hasAttribute && element.hasAttribute("for") && _isPatchLinkageAttribute("for", lcTag)) element.removeAttribute("for");
|
|
11706
12292
|
} catch (_2) {
|
|
11707
12293
|
}
|
|
11708
12294
|
}
|
|
11709
12295
|
const childNodes = getChildNodes(node);
|
|
11710
|
-
if (childNodes)
|
|
11711
|
-
for (let i = childNodes.length - 1; i >= 0; --i) {
|
|
11712
|
-
stack.push(childNodes[i]);
|
|
11713
|
-
}
|
|
11714
|
-
}
|
|
12296
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push(childNodes[i]);
|
|
11715
12297
|
}
|
|
11716
12298
|
};
|
|
11717
12299
|
const _initDocument = function _initDocument2(dirty) {
|
|
11718
12300
|
let doc = null;
|
|
11719
12301
|
let leadingWhitespace = null;
|
|
11720
|
-
if (FORCE_BODY)
|
|
11721
|
-
|
|
11722
|
-
} else {
|
|
12302
|
+
if (FORCE_BODY) dirty = "<remove></remove>" + dirty;
|
|
12303
|
+
else {
|
|
11723
12304
|
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
11724
12305
|
leadingWhitespace = matches && matches[0];
|
|
11725
12306
|
}
|
|
11726
|
-
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE)
|
|
11727
|
-
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
|
11728
|
-
}
|
|
12307
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
|
11729
12308
|
const dirtyPayload = trustedTypesPolicy ? _createTrustedHTML(dirty) : dirty;
|
|
11730
|
-
if (NAMESPACE === HTML_NAMESPACE) {
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
} catch (_2) {
|
|
11734
|
-
}
|
|
12309
|
+
if (NAMESPACE === HTML_NAMESPACE) try {
|
|
12310
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
12311
|
+
} catch (_2) {
|
|
11735
12312
|
}
|
|
11736
12313
|
if (!doc || !doc.documentElement) {
|
|
11737
12314
|
doc = implementation.createDocument(NAMESPACE, "template", null);
|
|
@@ -11741,23 +12318,13 @@ function createDOMPurify() {
|
|
|
11741
12318
|
}
|
|
11742
12319
|
}
|
|
11743
12320
|
const body = doc.body || doc.documentElement;
|
|
11744
|
-
if (dirty && leadingWhitespace)
|
|
11745
|
-
|
|
11746
|
-
}
|
|
11747
|
-
if (NAMESPACE === HTML_NAMESPACE) {
|
|
11748
|
-
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
11749
|
-
}
|
|
12321
|
+
if (dirty && leadingWhitespace) body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
12322
|
+
if (NAMESPACE === HTML_NAMESPACE) return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
|
11750
12323
|
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
11751
12324
|
};
|
|
11752
12325
|
const _createNodeIterator = function _createNodeIterator2(root) {
|
|
11753
12326
|
const doc = getOwnerDocument ? getOwnerDocument(root) : root.ownerDocument;
|
|
11754
|
-
return createNodeIterator.call(
|
|
11755
|
-
doc || root,
|
|
11756
|
-
root,
|
|
11757
|
-
// eslint-disable-next-line no-bitwise
|
|
11758
|
-
NodeFilter2.SHOW_ELEMENT | NodeFilter2.SHOW_COMMENT | NodeFilter2.SHOW_TEXT | NodeFilter2.SHOW_PROCESSING_INSTRUCTION | NodeFilter2.SHOW_CDATA_SECTION,
|
|
11759
|
-
null
|
|
11760
|
-
);
|
|
12327
|
+
return createNodeIterator.call(doc || root, root, NodeFilter2.SHOW_ELEMENT | NodeFilter2.SHOW_COMMENT | NodeFilter2.SHOW_TEXT | NodeFilter2.SHOW_PROCESSING_INSTRUCTION | NodeFilter2.SHOW_CDATA_SECTION, null);
|
|
11761
12328
|
};
|
|
11762
12329
|
const _stripTemplateExpressions = function _stripTemplateExpressions2(value) {
|
|
11763
12330
|
value = stringReplace(value, MUSTACHE_EXPR$1, " ");
|
|
@@ -11769,73 +12336,25 @@ function createDOMPurify() {
|
|
|
11769
12336
|
var _node$querySelectorAl;
|
|
11770
12337
|
node.normalize();
|
|
11771
12338
|
const doc = getOwnerDocument ? getOwnerDocument(node) : node.ownerDocument;
|
|
11772
|
-
const walker = createNodeIterator.call(
|
|
11773
|
-
doc || node,
|
|
11774
|
-
node,
|
|
11775
|
-
// eslint-disable-next-line no-bitwise
|
|
11776
|
-
NodeFilter2.SHOW_TEXT | NodeFilter2.SHOW_COMMENT | NodeFilter2.SHOW_CDATA_SECTION | NodeFilter2.SHOW_PROCESSING_INSTRUCTION,
|
|
11777
|
-
null
|
|
11778
|
-
);
|
|
12339
|
+
const walker = createNodeIterator.call(doc || node, node, NodeFilter2.SHOW_TEXT | NodeFilter2.SHOW_COMMENT | NodeFilter2.SHOW_CDATA_SECTION | NodeFilter2.SHOW_PROCESSING_INSTRUCTION, null);
|
|
11779
12340
|
let currentNode = walker.nextNode();
|
|
11780
12341
|
while (currentNode) {
|
|
11781
12342
|
currentNode.data = _stripTemplateExpressions(currentNode.data);
|
|
11782
12343
|
currentNode = walker.nextNode();
|
|
11783
12344
|
}
|
|
11784
12345
|
const templates = (_node$querySelectorAl = node.querySelectorAll) === null || _node$querySelectorAl === void 0 ? void 0 : _node$querySelectorAl.call(node, "template");
|
|
11785
|
-
if (templates) {
|
|
11786
|
-
|
|
11787
|
-
|
|
11788
|
-
_scrubTemplateExpressions2(tmpl.content);
|
|
11789
|
-
}
|
|
11790
|
-
});
|
|
11791
|
-
}
|
|
12346
|
+
if (templates) arrayForEach(templates, (tmpl) => {
|
|
12347
|
+
if (_isDocumentFragment(tmpl.content)) _scrubTemplateExpressions2(tmpl.content);
|
|
12348
|
+
});
|
|
11792
12349
|
};
|
|
11793
12350
|
const _isClobbered = function _isClobbered2(element) {
|
|
11794
12351
|
const realTagName = getNodeName ? getNodeName(element) : null;
|
|
11795
|
-
if (typeof realTagName !== "string")
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
if (transformCaseFunc(realTagName) !== "form") {
|
|
11799
|
-
return false;
|
|
11800
|
-
}
|
|
11801
|
-
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || // Realm-safe NamedNodeMap detection: equality against the cached
|
|
11802
|
-
// prototype getter. Clobbered .attributes (e.g. <input name="attributes">)
|
|
11803
|
-
// makes the direct read diverge from the cached read; a clean form
|
|
11804
|
-
// (same-realm OR foreign-realm) has both reads pointing at the same
|
|
11805
|
-
// canonical NamedNodeMap.
|
|
11806
|
-
element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || // A form descendant named "removeAttributeNode" or "getAttributeNode"
|
|
11807
|
-
// shadows these Attr-node methods via [LegacyOverrideBuiltIns].
|
|
11808
|
-
// _removeAttribute() / _stripAttributeNode() reach for
|
|
11809
|
-
// element.removeAttributeNode(attr) first; when it is shadowed the call
|
|
11810
|
-
// throws and the name-based fallback element.removeAttribute(name)
|
|
11811
|
-
// ASCII-lowercases its lookup key in an HTML document, silently missing
|
|
11812
|
-
// a case-preserved event-handler attribute (e.g. an ONANIMATIONSTART
|
|
11813
|
-
// that reached the sanitizer through an XML/XHTML parse). Flag the form
|
|
11814
|
-
// so it is removed wholesale, exactly as for the other shadowed methods.
|
|
11815
|
-
typeof element.removeAttributeNode !== "function" || typeof element.getAttributeNode !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || // NodeType clobbering probe. Cached Node.prototype.nodeType getter
|
|
11816
|
-
// returns the integer 1 for any Element regardless of realm; direct
|
|
11817
|
-
// read on a clobbered form (e.g. <input name="nodeType">) returns
|
|
11818
|
-
// the named child element. Cheap addition — nodeType is read from
|
|
11819
|
-
// an internal slot, no serialization cost — and removes a residual
|
|
11820
|
-
// clobbering surface used by several mXSS / PI / comment branches
|
|
11821
|
-
// in _sanitizeElements that compare currentNode.nodeType directly.
|
|
11822
|
-
element.nodeType !== getNodeType(element) || // HTMLFormElement has [LegacyOverrideBuiltIns]: a descendant named
|
|
11823
|
-
// "childNodes" shadows the prototype getter. Direct reads of
|
|
11824
|
-
// form.childNodes from a clobbered form return the named child
|
|
11825
|
-
// instead of the real NodeList, so any walk that reads it directly
|
|
11826
|
-
// skips the form's real children. Compare the direct read to the
|
|
11827
|
-
// cached Node.prototype getter — when the form's named-property
|
|
11828
|
-
// getter intercepts the read, the two values differ and we flag
|
|
11829
|
-
// the form. This catches every clobbering child type (input,
|
|
11830
|
-
// select, etc.) regardless of whether the named child happens to
|
|
11831
|
-
// carry a numeric .length, which a typeof-based probe would miss
|
|
11832
|
-
// (e.g. HTMLSelectElement.length is a defined unsigned-long).
|
|
11833
|
-
element.childNodes !== getChildNodes(element);
|
|
12352
|
+
if (typeof realTagName !== "string") return false;
|
|
12353
|
+
if (transformCaseFunc(realTagName) !== "form") return false;
|
|
12354
|
+
return typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || element.attributes !== getAttributes(element) || typeof element.removeAttribute !== "function" || typeof element.removeAttributeNode !== "function" || typeof element.getAttributeNode !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function" || element.nodeType !== getNodeType(element) || element.childNodes !== getChildNodes(element);
|
|
11834
12355
|
};
|
|
11835
12356
|
const _isDocumentFragment = function _isDocumentFragment2(value) {
|
|
11836
|
-
if (!getNodeType || typeof value !== "object" || value === null)
|
|
11837
|
-
return false;
|
|
11838
|
-
}
|
|
12357
|
+
if (!getNodeType || typeof value !== "object" || value === null) return false;
|
|
11839
12358
|
try {
|
|
11840
12359
|
return getNodeType(value) === NODE_TYPE.documentFragment;
|
|
11841
12360
|
} catch (_2) {
|
|
@@ -11843,9 +12362,7 @@ function createDOMPurify() {
|
|
|
11843
12362
|
}
|
|
11844
12363
|
};
|
|
11845
12364
|
const _isNode = function _isNode2(value) {
|
|
11846
|
-
if (!getNodeType || typeof value !== "object" || value === null)
|
|
11847
|
-
return false;
|
|
11848
|
-
}
|
|
12365
|
+
if (!getNodeType || typeof value !== "object" || value === null) return false;
|
|
11849
12366
|
try {
|
|
11850
12367
|
return typeof getNodeType(value) === "number";
|
|
11851
12368
|
} catch (_2) {
|
|
@@ -11853,44 +12370,28 @@ function createDOMPurify() {
|
|
|
11853
12370
|
}
|
|
11854
12371
|
};
|
|
11855
12372
|
function _executeHooks(hooks2, currentNode, data) {
|
|
11856
|
-
if (hooks2.length === 0)
|
|
11857
|
-
return;
|
|
11858
|
-
}
|
|
12373
|
+
if (hooks2.length === 0) return;
|
|
11859
12374
|
arrayForEach(hooks2, (hook) => {
|
|
11860
12375
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
11861
12376
|
});
|
|
11862
12377
|
}
|
|
11863
12378
|
const _isUnsafeNode = function _isUnsafeNode2(currentNode, tagName) {
|
|
11864
|
-
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML))
|
|
11865
|
-
|
|
11866
|
-
|
|
11867
|
-
if (SAFE_FOR_XML && currentNode.
|
|
11868
|
-
return true;
|
|
11869
|
-
}
|
|
11870
|
-
if (currentNode.nodeType === NODE_TYPE.processingInstruction) {
|
|
11871
|
-
return true;
|
|
11872
|
-
}
|
|
11873
|
-
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) {
|
|
11874
|
-
return true;
|
|
11875
|
-
}
|
|
12379
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.textContent) && regExpTest(ELEMENT_MARKUP_PROBE, currentNode.innerHTML)) return true;
|
|
12380
|
+
if (SAFE_FOR_XML && currentNode.namespaceURI === HTML_NAMESPACE && LITERAL_TEXT_ELEMENTS[tagName] && (_isNode(currentNode.firstElementChild) || typeof currentNode.textContent === "string" && regExpTest(LITERAL_TEXT_CLOSE[tagName], currentNode.textContent))) return true;
|
|
12381
|
+
if (currentNode.nodeType === NODE_TYPE.processingInstruction) return true;
|
|
12382
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(COMMENT_MARKUP_PROBE, currentNode.data)) return true;
|
|
11876
12383
|
return false;
|
|
11877
12384
|
};
|
|
11878
12385
|
const _matchesNameCheck = function _matchesNameCheck2(check, name) {
|
|
11879
|
-
if (check instanceof RegExp)
|
|
11880
|
-
return regExpTest(check, name);
|
|
11881
|
-
}
|
|
12386
|
+
if (check instanceof RegExp) return regExpTest(check, name);
|
|
11882
12387
|
if (check instanceof Function) {
|
|
11883
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++)
|
|
11884
|
-
args[_key - 2] = arguments[_key];
|
|
11885
|
-
}
|
|
12388
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) args[_key - 2] = arguments[_key];
|
|
11886
12389
|
return Boolean(check(name, ...args));
|
|
11887
12390
|
}
|
|
11888
12391
|
return false;
|
|
11889
12392
|
};
|
|
11890
12393
|
const _sanitizeDisallowedNode = function _sanitizeDisallowedNode2(currentNode, tagName, root) {
|
|
11891
|
-
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
|
|
11892
|
-
return false;
|
|
11893
|
-
}
|
|
12394
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
11894
12395
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
11895
12396
|
const parentNode = getParentNode(currentNode);
|
|
11896
12397
|
const childNodes = getChildNodes(currentNode);
|
|
@@ -11906,25 +12407,17 @@ function createDOMPurify() {
|
|
|
11906
12407
|
return true;
|
|
11907
12408
|
};
|
|
11908
12409
|
const _forkSharedAllowlist = function _forkSharedAllowlist2(hookList, set, defaultSet, setConfigSet) {
|
|
11909
|
-
if (hookList.length === 0)
|
|
11910
|
-
return set;
|
|
11911
|
-
}
|
|
12410
|
+
if (hookList.length === 0) return set;
|
|
11912
12411
|
return set === defaultSet || set === setConfigSet ? clone(set) : set;
|
|
11913
12412
|
};
|
|
11914
12413
|
const _handleHookDetachedNode = function _handleHookDetachedNode2(currentNode, root) {
|
|
11915
|
-
if (currentNode === root || getParentNode(currentNode) !== null)
|
|
11916
|
-
|
|
11917
|
-
}
|
|
11918
|
-
if (IN_PLACE) {
|
|
11919
|
-
_neutralizeSubtree(currentNode);
|
|
11920
|
-
}
|
|
12414
|
+
if (currentNode === root || getParentNode(currentNode) !== null) return false;
|
|
12415
|
+
if (IN_PLACE) _neutralizeSubtree(currentNode);
|
|
11921
12416
|
return true;
|
|
11922
12417
|
};
|
|
11923
12418
|
const _sanitizeElements = function _sanitizeElements2(currentNode, root) {
|
|
11924
12419
|
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
|
11925
|
-
if (_handleHookDetachedNode(currentNode, root))
|
|
11926
|
-
return true;
|
|
11927
|
-
}
|
|
12420
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
11928
12421
|
if (_isClobbered(currentNode)) {
|
|
11929
12422
|
_forceRemove(currentNode);
|
|
11930
12423
|
return true;
|
|
@@ -11935,9 +12428,7 @@ function createDOMPurify() {
|
|
|
11935
12428
|
tagName,
|
|
11936
12429
|
allowedTags: ALLOWED_TAGS2
|
|
11937
12430
|
});
|
|
11938
|
-
if (_handleHookDetachedNode(currentNode, root))
|
|
11939
|
-
return true;
|
|
11940
|
-
}
|
|
12431
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
11941
12432
|
if (_isUnsafeNode(currentNode, tagName)) {
|
|
11942
12433
|
_forceRemove(currentNode);
|
|
11943
12434
|
return true;
|
|
@@ -11946,11 +12437,11 @@ function createDOMPurify() {
|
|
|
11946
12437
|
const removed = _sanitizeDisallowedNode(currentNode, tagName, root);
|
|
11947
12438
|
if (removed === false) {
|
|
11948
12439
|
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
12440
|
+
if (_handleHookDetachedNode(currentNode, root)) return true;
|
|
11949
12441
|
}
|
|
11950
12442
|
return removed;
|
|
11951
12443
|
}
|
|
11952
|
-
|
|
11953
|
-
if (nt2 === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
12444
|
+
if (_readNodeType(currentNode) === NODE_TYPE.element && !_checkValidNamespace(currentNode)) {
|
|
11954
12445
|
_forceRemove(currentNode);
|
|
11955
12446
|
return true;
|
|
11956
12447
|
}
|
|
@@ -11961,81 +12452,53 @@ function createDOMPurify() {
|
|
|
11961
12452
|
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
11962
12453
|
const content = _stripTemplateExpressions(currentNode.textContent);
|
|
11963
12454
|
if (currentNode.textContent !== content) {
|
|
11964
|
-
arrayPush(DOMPurify.removed, {
|
|
11965
|
-
element: currentNode.cloneNode()
|
|
11966
|
-
});
|
|
12455
|
+
arrayPush(DOMPurify.removed, { element: currentNode.cloneNode() });
|
|
11967
12456
|
currentNode.textContent = content;
|
|
11968
12457
|
}
|
|
11969
12458
|
}
|
|
11970
12459
|
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
|
11971
|
-
return
|
|
12460
|
+
return _handleHookDetachedNode(currentNode, root);
|
|
11972
12461
|
};
|
|
11973
12462
|
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
|
11974
|
-
if (FORBID_ATTR[lcName])
|
|
11975
|
-
|
|
11976
|
-
|
|
11977
|
-
if (_isPatchLinkageAttribute(lcName, lcTag)) {
|
|
11978
|
-
return false;
|
|
11979
|
-
}
|
|
11980
|
-
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
|
11981
|
-
return false;
|
|
11982
|
-
}
|
|
12463
|
+
if (FORBID_ATTR[lcName]) return false;
|
|
12464
|
+
if (_isPatchLinkageAttribute(lcName, lcTag)) return false;
|
|
12465
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) return false;
|
|
11983
12466
|
const nameIsPermitted = ALLOWED_ATTR2[lcName] || EXTRA_ELEMENT_HANDLING.attributeCheck instanceof Function && EXTRA_ELEMENT_HANDLING.attributeCheck(lcName, lcTag);
|
|
11984
|
-
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName))
|
|
11985
|
-
|
|
11986
|
-
|
|
11987
|
-
if (
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
if (!
|
|
11991
|
-
return (
|
|
11992
|
-
// Condition a) covers a basically valid custom element tag name whose
|
|
11993
|
-
// tag passes the configured tagNameCheck and whose attribute name
|
|
11994
|
-
// passes the configured attributeNameCheck ...
|
|
11995
|
-
_isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || // Condition b) covers an `is` attribute whose value passes the
|
|
11996
|
-
// configured tagNameCheck while customized built-in elements are
|
|
11997
|
-
// allowed.
|
|
11998
|
-
lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value)
|
|
11999
|
-
);
|
|
12000
|
-
}
|
|
12001
|
-
if (URI_SAFE_ATTRIBUTES[lcName]) {
|
|
12002
|
-
return true;
|
|
12003
|
-
}
|
|
12004
|
-
if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) {
|
|
12005
|
-
return true;
|
|
12006
|
-
}
|
|
12007
|
-
if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) {
|
|
12008
|
-
return true;
|
|
12009
|
-
}
|
|
12010
|
-
if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) {
|
|
12011
|
-
return true;
|
|
12012
|
-
}
|
|
12467
|
+
if (ALLOW_DATA_ATTR && regExpTest(DATA_ATTR$1, lcName)) return true;
|
|
12468
|
+
if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR$1, lcName)) return true;
|
|
12469
|
+
if (!nameIsPermitted) return _isBasicCustomElement(lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName, lcTag) || lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && _matchesNameCheck(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value);
|
|
12470
|
+
if (URI_SAFE_ATTRIBUTES[lcName]) return true;
|
|
12471
|
+
if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
12472
|
+
if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag]) return true;
|
|
12473
|
+
if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ""))) return true;
|
|
12013
12474
|
return !value;
|
|
12014
12475
|
};
|
|
12015
|
-
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
|
|
12476
|
+
const RESERVED_CUSTOM_ELEMENT_NAMES = addToSet({}, [
|
|
12477
|
+
"annotation-xml",
|
|
12478
|
+
"color-profile",
|
|
12479
|
+
"font-face",
|
|
12480
|
+
"font-face-format",
|
|
12481
|
+
"font-face-name",
|
|
12482
|
+
"font-face-src",
|
|
12483
|
+
"font-face-uri",
|
|
12484
|
+
"missing-glyph"
|
|
12485
|
+
]);
|
|
12016
12486
|
const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
|
|
12017
12487
|
return !RESERVED_CUSTOM_ELEMENT_NAMES[stringToLowerCase(tagName)] && regExpTest(CUSTOM_ELEMENT$1, tagName);
|
|
12018
12488
|
};
|
|
12019
12489
|
const _applyTrustedTypesToAttribute = function _applyTrustedTypesToAttribute2(lcTag, lcName, namespaceURI, value) {
|
|
12020
|
-
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) {
|
|
12021
|
-
|
|
12022
|
-
|
|
12023
|
-
|
|
12024
|
-
|
|
12025
|
-
case "TrustedScriptURL": {
|
|
12026
|
-
return _createTrustedScriptURL(value);
|
|
12027
|
-
}
|
|
12028
|
-
}
|
|
12490
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function" && !namespaceURI) switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
12491
|
+
case "TrustedHTML":
|
|
12492
|
+
return _createTrustedHTML(value);
|
|
12493
|
+
case "TrustedScriptURL":
|
|
12494
|
+
return _createTrustedScriptURL(value);
|
|
12029
12495
|
}
|
|
12030
12496
|
return value;
|
|
12031
12497
|
};
|
|
12032
12498
|
const _setAttributeValue = function _setAttributeValue2(currentNode, name, namespaceURI, value) {
|
|
12033
12499
|
try {
|
|
12034
|
-
if (namespaceURI)
|
|
12035
|
-
|
|
12036
|
-
} else {
|
|
12037
|
-
currentNode.setAttribute(name, value);
|
|
12038
|
-
}
|
|
12500
|
+
if (namespaceURI) currentNode.setAttributeNS(namespaceURI, name, value);
|
|
12501
|
+
else currentNode.setAttribute(name, value);
|
|
12039
12502
|
if (_isClobbered(currentNode)) {
|
|
12040
12503
|
_forceRemove(currentNode);
|
|
12041
12504
|
return false;
|
|
@@ -12046,12 +12509,11 @@ function createDOMPurify() {
|
|
|
12046
12509
|
return false;
|
|
12047
12510
|
}
|
|
12048
12511
|
};
|
|
12049
|
-
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
|
|
12512
|
+
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode, root) {
|
|
12050
12513
|
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
|
12514
|
+
if (_handleHookDetachedNode(currentNode, root)) return;
|
|
12051
12515
|
const attributes = currentNode.attributes;
|
|
12052
|
-
if (!attributes || _isClobbered(currentNode))
|
|
12053
|
-
return;
|
|
12054
|
-
}
|
|
12516
|
+
if (!attributes || _isClobbered(currentNode)) return;
|
|
12055
12517
|
ALLOWED_ATTR2 = _forkSharedAllowlist(hooks.uponSanitizeAttribute, ALLOWED_ATTR2, DEFAULT_ALLOWED_ATTR, SET_CONFIG_ALLOWED_ATTR);
|
|
12056
12518
|
const hookEvent = {
|
|
12057
12519
|
attrName: "",
|
|
@@ -12060,10 +12522,10 @@ function createDOMPurify() {
|
|
|
12060
12522
|
allowedAttributes: ALLOWED_ATTR2,
|
|
12061
12523
|
forceKeepAttr: void 0
|
|
12062
12524
|
};
|
|
12063
|
-
let
|
|
12525
|
+
let l3 = attributes.length;
|
|
12064
12526
|
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
12065
|
-
while (
|
|
12066
|
-
const attr = attributes[
|
|
12527
|
+
while (l3--) {
|
|
12528
|
+
const attr = attributes[l3];
|
|
12067
12529
|
const name = attr.name, namespaceURI = attr.namespaceURI, attrValue = attr.value;
|
|
12068
12530
|
const lcName = transformCaseFunc(name);
|
|
12069
12531
|
const initValue = attrValue;
|
|
@@ -12088,9 +12550,7 @@ function createDOMPurify() {
|
|
|
12088
12550
|
_removeAttribute(name, currentNode, attr);
|
|
12089
12551
|
continue;
|
|
12090
12552
|
}
|
|
12091
|
-
if (hookEvent.forceKeepAttr)
|
|
12092
|
-
continue;
|
|
12093
|
-
}
|
|
12553
|
+
if (hookEvent.forceKeepAttr) continue;
|
|
12094
12554
|
if (!hookEvent.keepAttr) {
|
|
12095
12555
|
_removeAttribute(name, currentNode, attr);
|
|
12096
12556
|
continue;
|
|
@@ -12099,22 +12559,18 @@ function createDOMPurify() {
|
|
|
12099
12559
|
_removeAttribute(name, currentNode, attr);
|
|
12100
12560
|
continue;
|
|
12101
12561
|
}
|
|
12102
|
-
if (SAFE_FOR_TEMPLATES)
|
|
12103
|
-
value = _stripTemplateExpressions(value);
|
|
12104
|
-
}
|
|
12562
|
+
if (SAFE_FOR_TEMPLATES) value = _stripTemplateExpressions(value);
|
|
12105
12563
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
12106
12564
|
_removeAttribute(name, currentNode, attr);
|
|
12107
12565
|
continue;
|
|
12108
12566
|
}
|
|
12109
12567
|
value = _applyTrustedTypesToAttribute(lcTag, lcName, namespaceURI, value);
|
|
12110
12568
|
if (value !== initValue) {
|
|
12111
|
-
|
|
12112
|
-
if (cleanWrite && recreatedNamedProp) {
|
|
12113
|
-
arrayPop(DOMPurify.removed);
|
|
12114
|
-
}
|
|
12569
|
+
if (_setAttributeValue(currentNode, name, namespaceURI, value) && recreatedNamedProp) arrayPop(DOMPurify.removed);
|
|
12115
12570
|
}
|
|
12116
12571
|
}
|
|
12117
12572
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
12573
|
+
_handleHookDetachedNode(currentNode, root);
|
|
12118
12574
|
};
|
|
12119
12575
|
const _sanitizeShadowDOM2 = function _sanitizeShadowDOM(fragment) {
|
|
12120
12576
|
let shadowNode = null;
|
|
@@ -12123,10 +12579,8 @@ function createDOMPurify() {
|
|
|
12123
12579
|
while (shadowNode = shadowIterator.nextNode()) {
|
|
12124
12580
|
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
|
12125
12581
|
_sanitizeElements(shadowNode, fragment);
|
|
12126
|
-
_sanitizeAttributes(shadowNode);
|
|
12127
|
-
if (_isDocumentFragment(shadowNode.content))
|
|
12128
|
-
_sanitizeShadowDOM2(shadowNode.content);
|
|
12129
|
-
}
|
|
12582
|
+
_sanitizeAttributes(shadowNode, fragment);
|
|
12583
|
+
if (_isDocumentFragment(shadowNode.content)) _sanitizeShadowDOM2(shadowNode.content);
|
|
12130
12584
|
if (_readNodeType(shadowNode) === NODE_TYPE.element) {
|
|
12131
12585
|
const innerSr = getShadowRoot(shadowNode);
|
|
12132
12586
|
if (_isDocumentFragment(innerSr)) {
|
|
@@ -12149,40 +12603,31 @@ function createDOMPurify() {
|
|
|
12149
12603
|
continue;
|
|
12150
12604
|
}
|
|
12151
12605
|
const node = item.node;
|
|
12152
|
-
const
|
|
12153
|
-
const isElement = nodeType === NODE_TYPE.element;
|
|
12606
|
+
const isElement = _readNodeType(node) === NODE_TYPE.element;
|
|
12154
12607
|
const childNodes = getChildNodes(node);
|
|
12155
|
-
if (childNodes) {
|
|
12156
|
-
|
|
12157
|
-
|
|
12158
|
-
|
|
12159
|
-
shadow: null
|
|
12160
|
-
});
|
|
12161
|
-
}
|
|
12162
|
-
}
|
|
12608
|
+
if (childNodes) for (let i = childNodes.length - 1; i >= 0; --i) stack.push({
|
|
12609
|
+
node: childNodes[i],
|
|
12610
|
+
shadow: null
|
|
12611
|
+
});
|
|
12163
12612
|
if (isElement) {
|
|
12164
12613
|
const rootName = getNodeName ? getNodeName(node) : null;
|
|
12165
12614
|
if (typeof rootName === "string" && transformCaseFunc(rootName) === "template") {
|
|
12166
12615
|
const content = node.content;
|
|
12167
|
-
if (_isDocumentFragment(content)) {
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
});
|
|
12172
|
-
}
|
|
12616
|
+
if (_isDocumentFragment(content)) stack.push({
|
|
12617
|
+
node: content,
|
|
12618
|
+
shadow: null
|
|
12619
|
+
});
|
|
12173
12620
|
}
|
|
12174
12621
|
}
|
|
12175
12622
|
if (isElement) {
|
|
12176
12623
|
const sr = getShadowRoot(node);
|
|
12177
|
-
if (_isDocumentFragment(sr)) {
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
});
|
|
12185
|
-
}
|
|
12624
|
+
if (_isDocumentFragment(sr)) stack.push({
|
|
12625
|
+
node: null,
|
|
12626
|
+
shadow: sr
|
|
12627
|
+
}, {
|
|
12628
|
+
node: sr,
|
|
12629
|
+
shadow: null
|
|
12630
|
+
});
|
|
12186
12631
|
}
|
|
12187
12632
|
}
|
|
12188
12633
|
};
|
|
@@ -12193,30 +12638,18 @@ function createDOMPurify() {
|
|
|
12193
12638
|
let currentNode = null;
|
|
12194
12639
|
let returnNode = null;
|
|
12195
12640
|
IS_EMPTY_INPUT = !dirty;
|
|
12196
|
-
if (IS_EMPTY_INPUT)
|
|
12197
|
-
dirty = "<!-->";
|
|
12198
|
-
}
|
|
12641
|
+
if (IS_EMPTY_INPUT) dirty = "<!-->";
|
|
12199
12642
|
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
|
12200
12643
|
dirty = stringifyValue(dirty);
|
|
12201
|
-
if (typeof dirty !== "string")
|
|
12202
|
-
throw typeErrorCreate("dirty is not a string, aborting");
|
|
12203
|
-
}
|
|
12204
|
-
}
|
|
12205
|
-
if (!DOMPurify.isSupported) {
|
|
12206
|
-
return dirty;
|
|
12644
|
+
if (typeof dirty !== "string") throw typeErrorCreate("dirty is not a string, aborting");
|
|
12207
12645
|
}
|
|
12646
|
+
if (!DOMPurify.isSupported) return dirty;
|
|
12208
12647
|
if (SET_CONFIG) {
|
|
12209
12648
|
ALLOWED_TAGS2 = SET_CONFIG_ALLOWED_TAGS;
|
|
12210
12649
|
ALLOWED_ATTR2 = SET_CONFIG_ALLOWED_ATTR;
|
|
12211
|
-
} else
|
|
12212
|
-
|
|
12213
|
-
|
|
12214
|
-
if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) {
|
|
12215
|
-
ALLOWED_TAGS2 = clone(ALLOWED_TAGS2);
|
|
12216
|
-
}
|
|
12217
|
-
if (hooks.uponSanitizeAttribute.length > 0) {
|
|
12218
|
-
ALLOWED_ATTR2 = clone(ALLOWED_ATTR2);
|
|
12219
|
-
}
|
|
12650
|
+
} else _parseConfig(cfg);
|
|
12651
|
+
if (hooks.uponSanitizeElement.length > 0 || hooks.uponSanitizeAttribute.length > 0) ALLOWED_TAGS2 = clone(ALLOWED_TAGS2);
|
|
12652
|
+
if (hooks.uponSanitizeAttribute.length > 0) ALLOWED_ATTR2 = clone(ALLOWED_ATTR2);
|
|
12220
12653
|
DOMPurify.removed = [];
|
|
12221
12654
|
const inPlace = IN_PLACE && typeof dirty !== "string" && _isNode(dirty);
|
|
12222
12655
|
if (inPlace) {
|
|
@@ -12242,83 +12675,57 @@ function createDOMPurify() {
|
|
|
12242
12675
|
} else if (_isNode(dirty)) {
|
|
12243
12676
|
body = _initDocument("<!---->");
|
|
12244
12677
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
12245
|
-
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY")
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
body = importedNode;
|
|
12249
|
-
} else {
|
|
12250
|
-
body.appendChild(importedNode);
|
|
12251
|
-
}
|
|
12678
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") body = importedNode;
|
|
12679
|
+
else if (importedNode.nodeName === "HTML") body = importedNode;
|
|
12680
|
+
else body.appendChild(importedNode);
|
|
12252
12681
|
_sanitizeAttachedShadowRoots(body);
|
|
12253
12682
|
} else {
|
|
12254
|
-
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
12255
|
-
dirty.indexOf("<") === -1) {
|
|
12256
|
-
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
12257
|
-
}
|
|
12683
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && dirty.indexOf("<") === -1) return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(dirty) : dirty;
|
|
12258
12684
|
body = _initDocument(dirty);
|
|
12259
|
-
if (!body)
|
|
12260
|
-
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
12261
|
-
}
|
|
12262
|
-
}
|
|
12263
|
-
if (body && FORCE_BODY) {
|
|
12264
|
-
_forceRemove(body.firstChild);
|
|
12685
|
+
if (!body) return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
|
12265
12686
|
}
|
|
12687
|
+
if (body && FORCE_BODY) _forceRemove(body.firstChild);
|
|
12266
12688
|
const walkRoot = inPlace ? dirty : body;
|
|
12267
12689
|
try {
|
|
12268
12690
|
const nodeIterator = _createNodeIterator(walkRoot);
|
|
12269
12691
|
while (currentNode = nodeIterator.nextNode()) {
|
|
12270
12692
|
_sanitizeElements(currentNode, walkRoot);
|
|
12271
|
-
_sanitizeAttributes(currentNode);
|
|
12272
|
-
if (_isDocumentFragment(currentNode.content))
|
|
12273
|
-
_sanitizeShadowDOM2(currentNode.content);
|
|
12274
|
-
}
|
|
12693
|
+
_sanitizeAttributes(currentNode, walkRoot);
|
|
12694
|
+
if (_isDocumentFragment(currentNode.content)) _sanitizeShadowDOM2(currentNode.content);
|
|
12275
12695
|
}
|
|
12276
12696
|
} catch (error) {
|
|
12277
12697
|
if (inPlace) {
|
|
12278
12698
|
_neutralizeRoot(dirty);
|
|
12279
12699
|
arrayForEach(DOMPurify.removed, (entry) => {
|
|
12280
|
-
if (entry.element)
|
|
12281
|
-
_neutralizeSubtree(entry.element);
|
|
12282
|
-
}
|
|
12700
|
+
if (entry.element) _neutralizeSubtree(entry.element);
|
|
12283
12701
|
});
|
|
12284
12702
|
}
|
|
12285
12703
|
throw error;
|
|
12286
12704
|
}
|
|
12287
12705
|
if (inPlace) {
|
|
12706
|
+
let rootWasRemoved = false;
|
|
12288
12707
|
arrayForEach(DOMPurify.removed, (entry) => {
|
|
12289
12708
|
if (entry.element) {
|
|
12709
|
+
if (entry.element === dirty) rootWasRemoved = true;
|
|
12290
12710
|
_neutralizeSubtree(entry.element);
|
|
12291
12711
|
}
|
|
12292
12712
|
});
|
|
12293
|
-
if (
|
|
12294
|
-
|
|
12295
|
-
}
|
|
12713
|
+
if (rootWasRemoved) throw typeErrorCreate("a node selected for removal could not be safely returned; refusing to sanitize in place");
|
|
12714
|
+
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(dirty);
|
|
12296
12715
|
return dirty;
|
|
12297
12716
|
}
|
|
12298
12717
|
if (RETURN_DOM) {
|
|
12299
|
-
if (SAFE_FOR_TEMPLATES)
|
|
12300
|
-
_scrubTemplateExpressions2(body);
|
|
12301
|
-
}
|
|
12718
|
+
if (SAFE_FOR_TEMPLATES) _scrubTemplateExpressions2(body);
|
|
12302
12719
|
if (RETURN_DOM_FRAGMENT) {
|
|
12303
12720
|
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
12304
|
-
while (body.firstChild)
|
|
12305
|
-
|
|
12306
|
-
|
|
12307
|
-
} else {
|
|
12308
|
-
returnNode = body;
|
|
12309
|
-
}
|
|
12310
|
-
if (ALLOWED_ATTR2.shadowroot || ALLOWED_ATTR2.shadowrootmode) {
|
|
12311
|
-
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
12312
|
-
}
|
|
12721
|
+
while (body.firstChild) returnNode.appendChild(body.firstChild);
|
|
12722
|
+
} else returnNode = body;
|
|
12723
|
+
if (ALLOWED_ATTR2.shadowroot || ALLOWED_ATTR2.shadowrootmode) returnNode = importNode.call(originalDocument, returnNode, true);
|
|
12313
12724
|
return returnNode;
|
|
12314
12725
|
}
|
|
12315
12726
|
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
12316
|
-
if (WHOLE_DOCUMENT && ALLOWED_TAGS2["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name))
|
|
12317
|
-
|
|
12318
|
-
}
|
|
12319
|
-
if (SAFE_FOR_TEMPLATES) {
|
|
12320
|
-
serializedHTML = _stripTemplateExpressions(serializedHTML);
|
|
12321
|
-
}
|
|
12727
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS2["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
|
12728
|
+
if (SAFE_FOR_TEMPLATES) serializedHTML = _stripTemplateExpressions(serializedHTML);
|
|
12322
12729
|
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? _createTrustedHTML(serializedHTML) : serializedHTML;
|
|
12323
12730
|
};
|
|
12324
12731
|
DOMPurify.setConfig = function() {
|
|
@@ -12337,26 +12744,18 @@ function createDOMPurify() {
|
|
|
12337
12744
|
emptyHTML = "";
|
|
12338
12745
|
};
|
|
12339
12746
|
DOMPurify.isValidAttribute = function(tag, attr, value) {
|
|
12340
|
-
if (!CONFIG) {
|
|
12341
|
-
_parseConfig({});
|
|
12342
|
-
}
|
|
12747
|
+
if (!CONFIG) _parseConfig({});
|
|
12343
12748
|
const lcTag = transformCaseFunc(tag);
|
|
12344
12749
|
const lcName = transformCaseFunc(attr);
|
|
12345
12750
|
return _isValidAttribute(lcTag, lcName, value);
|
|
12346
12751
|
};
|
|
12347
12752
|
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
|
12348
|
-
if (typeof hookFunction !== "function")
|
|
12349
|
-
|
|
12350
|
-
}
|
|
12351
|
-
if (!objectHasOwnProperty(hooks, entryPoint)) {
|
|
12352
|
-
return;
|
|
12353
|
-
}
|
|
12753
|
+
if (typeof hookFunction !== "function") return;
|
|
12754
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
12354
12755
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
12355
12756
|
};
|
|
12356
12757
|
DOMPurify.removeHook = function(entryPoint, hookFunction) {
|
|
12357
|
-
if (!objectHasOwnProperty(hooks, entryPoint))
|
|
12358
|
-
return void 0;
|
|
12359
|
-
}
|
|
12758
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
12360
12759
|
if (hookFunction !== void 0) {
|
|
12361
12760
|
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
12362
12761
|
return index === -1 ? void 0 : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
@@ -12364,9 +12763,7 @@ function createDOMPurify() {
|
|
|
12364
12763
|
return arrayPop(hooks[entryPoint]);
|
|
12365
12764
|
};
|
|
12366
12765
|
DOMPurify.removeHooks = function(entryPoint) {
|
|
12367
|
-
if (!objectHasOwnProperty(hooks, entryPoint))
|
|
12368
|
-
return;
|
|
12369
|
-
}
|
|
12766
|
+
if (!objectHasOwnProperty(hooks, entryPoint)) return;
|
|
12370
12767
|
hooks[entryPoint] = [];
|
|
12371
12768
|
};
|
|
12372
12769
|
DOMPurify.removeAllHooks = function() {
|
|
@@ -12374,190 +12771,203 @@ function createDOMPurify() {
|
|
|
12374
12771
|
};
|
|
12375
12772
|
return DOMPurify;
|
|
12376
12773
|
}
|
|
12377
|
-
var
|
|
12774
|
+
var purify_default = createDOMPurify();
|
|
12378
12775
|
|
|
12379
|
-
// node_modules/.pnpm/marked@18.0.
|
|
12380
|
-
function
|
|
12776
|
+
// node_modules/.pnpm/marked@18.0.14/node_modules/marked/lib/marked.esm.js
|
|
12777
|
+
function I() {
|
|
12381
12778
|
return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
|
|
12382
12779
|
}
|
|
12383
|
-
var
|
|
12384
|
-
function
|
|
12385
|
-
|
|
12780
|
+
var y = I();
|
|
12781
|
+
function W(l3) {
|
|
12782
|
+
y = l3;
|
|
12386
12783
|
}
|
|
12387
|
-
var
|
|
12388
|
-
function
|
|
12784
|
+
var A = { exec: () => null };
|
|
12785
|
+
function C(l3) {
|
|
12389
12786
|
let e = [];
|
|
12390
12787
|
return (t) => {
|
|
12391
12788
|
let n = Math.max(0, Math.min(3, t - 1)), s = e[n];
|
|
12392
|
-
return s || (s =
|
|
12789
|
+
return s || (s = l3(n), e[n] = s), s;
|
|
12393
12790
|
};
|
|
12394
12791
|
}
|
|
12395
|
-
function
|
|
12396
|
-
let t = typeof
|
|
12792
|
+
function h(l3, e = "") {
|
|
12793
|
+
let t = typeof l3 == "string" ? l3 : l3.source, n = { replace: (s, r) => {
|
|
12397
12794
|
let o = typeof r == "string" ? r : r.source;
|
|
12398
|
-
return o = o.replace(
|
|
12795
|
+
return o = o.replace(x.caret, "$1"), t = t.replace(s, o), n;
|
|
12399
12796
|
}, getRegex: () => new RegExp(t, e) };
|
|
12400
12797
|
return n;
|
|
12401
12798
|
}
|
|
12402
|
-
var
|
|
12799
|
+
var _e = ((l3 = "") => {
|
|
12403
12800
|
try {
|
|
12404
|
-
return !!new RegExp("(?<=1)(?<!1)" +
|
|
12801
|
+
return !!new RegExp("(?<=1)(?<!1)" + l3);
|
|
12405
12802
|
} catch {
|
|
12406
12803
|
return false;
|
|
12407
12804
|
}
|
|
12408
12805
|
})();
|
|
12409
|
-
var
|
|
12410
|
-
var
|
|
12411
|
-
var
|
|
12412
|
-
var
|
|
12413
|
-
var
|
|
12414
|
-
var
|
|
12415
|
-
var
|
|
12416
|
-
var
|
|
12417
|
-
var
|
|
12418
|
-
var
|
|
12419
|
-
var
|
|
12420
|
-
var
|
|
12421
|
-
var
|
|
12422
|
-
var
|
|
12423
|
-
var
|
|
12424
|
-
var
|
|
12425
|
-
var
|
|
12426
|
-
var
|
|
12427
|
-
var
|
|
12428
|
-
var
|
|
12429
|
-
var
|
|
12430
|
-
var
|
|
12431
|
-
var
|
|
12432
|
-
var
|
|
12433
|
-
var
|
|
12434
|
-
var
|
|
12435
|
-
]`).replace("lheading",
|
|
12436
|
-
var
|
|
12437
|
-
var
|
|
12438
|
-
var
|
|
12439
|
-
var
|
|
12440
|
-
var
|
|
12441
|
-
var
|
|
12442
|
-
var
|
|
12443
|
-
var
|
|
12444
|
-
var
|
|
12445
|
-
var
|
|
12446
|
-
var
|
|
12447
|
-
var
|
|
12448
|
-
var
|
|
12449
|
-
var
|
|
12450
|
-
var
|
|
12451
|
-
var
|
|
12452
|
-
var
|
|
12453
|
-
var
|
|
12454
|
-
var
|
|
12455
|
-
var
|
|
12456
|
-
var
|
|
12457
|
-
var
|
|
12458
|
-
var
|
|
12459
|
-
var
|
|
12460
|
-
var
|
|
12461
|
-
var
|
|
12462
|
-
var
|
|
12463
|
-
var
|
|
12464
|
-
var
|
|
12465
|
-
var
|
|
12466
|
-
var
|
|
12467
|
-
var
|
|
12468
|
-
var
|
|
12469
|
-
var
|
|
12470
|
-
var
|
|
12471
|
-
var
|
|
12472
|
-
var
|
|
12473
|
-
var
|
|
12474
|
-
var
|
|
12475
|
-
var
|
|
12476
|
-
var
|
|
12477
|
-
var
|
|
12478
|
-
var
|
|
12479
|
-
var
|
|
12480
|
-
var
|
|
12481
|
-
var
|
|
12482
|
-
var
|
|
12483
|
-
var
|
|
12484
|
-
|
|
12806
|
+
var x = { codeRemoveIndent: /^(?: {0,3}\t| {1,4})/gm, outputLinkReplace: /\\([\[\]])/g, indentCodeCompensation: /^(\s+)(?:```)/, beginningSpace: /^\s+/, endingHash: /#$/, startingSpaceChar: /^ /, endingSpaceChar: / $/, endingSpaceTabChar: /[ \t]$/, nonSpaceChar: /[^ ]/, newLineCharGlobal: /\n/g, tabCharGlobal: /\t/g, leadingSpaceTab: /^[ \t]+/, multipleSpaceGlobal: /\s+/g, blankLine: /^[ \t]*$/, doubleBlankLine: /\n[ \t]*\n[ \t]*$/, blockquoteStart: /^ {0,3}>/, blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g, blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm, listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g, listIsTask: /^\[[ xX]\] +\S/, listReplaceTask: /^\[[ xX]\] +/, listTaskCheckbox: /\[[ xX]\]/, anyLine: /\n.*\n/, hrefBrackets: /^<(.*)>$/, tableDelimiter: /[:|]/, tableAlignChars: /^\||\| *$/g, tableRowBlankLine: /\n[ \t]*$/, tableAlignRight: /^ *-+: *$/, tableAlignCenter: /^ *:-+: *$/, tableAlignLeft: /^ *:-+ *$/, startATag: /^<a /i, endATag: /^<\/a>/i, startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i, endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i, startAngleBracket: /^</, endAngleBracket: />$/, pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/, unicodeAlphaNumeric: /[\p{L}\p{N}]/u, numericCharacterReference: /&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g, escapeTest: /[&<>"']/, escapeReplace: /[&<>"']/g, escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/, escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g, caret: /(^|[^\[])\^/g, percentDecode: /%25/g, findPipe: /\|/g, splitPipe: / \|/, slashPipe: /\\\|/g, carriageReturn: /\r\n|\r/g, spaceLine: /^ +$/gm, notSpaceStart: /^\S*/, endingNewline: /\n$/, listItemRegex: (l3) => new RegExp(`^( {0,3}${l3})((?:[ ][^\\n]*)?(?:\\n|$))`), nextBulletRegex: C((l3) => new RegExp(`^ {0,${l3}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)), hrRegex: C((l3) => new RegExp(`^ {0,${l3}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)), fencesBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}(?:\`\`\`|~~~)`)), headingBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}#`)), htmlBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}(?:</?(?:${N})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`, "i")), blockquoteBeginRegex: C((l3) => new RegExp(`^ {0,${l3}}>`)) };
|
|
12807
|
+
var $e = /^(?:[ \t]*(?:\n|$))+/;
|
|
12808
|
+
var Le = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/;
|
|
12809
|
+
var ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
|
12810
|
+
var G = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
|
12811
|
+
var Ae = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
|
12812
|
+
var J = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
|
|
12813
|
+
var ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
|
|
12814
|
+
var he = h(ce).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
|
|
12815
|
+
var Ee = h(ce).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
|
|
12816
|
+
var V = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
|
|
12817
|
+
var Me = /^[^\n]+/;
|
|
12818
|
+
var Y = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
|
|
12819
|
+
var Ie = h(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Y).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
|
12820
|
+
var Ce = h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, J).getRegex();
|
|
12821
|
+
var N = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
|
|
12822
|
+
var ee = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
|
12823
|
+
var Be = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ee).replace("tag", N).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
|
12824
|
+
var de = (l3) => h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", l3).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
|
|
12825
|
+
var De = de(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
|
|
12826
|
+
var qe = de(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
|
|
12827
|
+
var ve = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", qe).getRegex();
|
|
12828
|
+
var te = { blockquote: ve, code: Le, def: Ie, fences: ze, heading: Ae, hr: G, html: Be, lheading: he, list: Ce, newline: $e, paragraph: De, table: A, text: Me };
|
|
12829
|
+
var le = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
|
|
12830
|
+
var Ze = { ...te, lheading: Ee, table: le, paragraph: h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", le).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex() };
|
|
12831
|
+
var He = { ...te, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ee).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: A, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(V).replace("hr", G).replace("heading", ` *#{1,6} *[^
|
|
12832
|
+
]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
|
|
12833
|
+
var Ge = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
|
12834
|
+
var Ne = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
|
12835
|
+
var ke = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
|
|
12836
|
+
var Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
|
12837
|
+
var $ = /[\p{P}\p{S}]/u;
|
|
12838
|
+
var B = /[\s\p{P}\p{S}]/u;
|
|
12839
|
+
var Q = /[^\s\p{P}\p{S}]/u;
|
|
12840
|
+
var je = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, B).getRegex();
|
|
12841
|
+
var Fe = /[\p{Pi}\p{Ps}"']/u;
|
|
12842
|
+
var ge = /(?!~)[\p{P}\p{S}]/u;
|
|
12843
|
+
var Ue = /(?!~)[\s\p{P}\p{S}]/u;
|
|
12844
|
+
var Ke = /(?:[^\s\p{P}\p{S}]|~)/u;
|
|
12845
|
+
var We = h(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", _e ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
|
|
12846
|
+
var fe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
|
|
12847
|
+
var Xe = h(fe, "u").replace(/punct/g, $).getRegex();
|
|
12848
|
+
var Je = h(fe, "u").replace(/punct/g, ge).getRegex();
|
|
12849
|
+
var Ve = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
|
|
12850
|
+
var Ye = h(Ve, "u").replace(/openQuote/g, Fe).replace(/punct/g, $).getRegex();
|
|
12851
|
+
var me = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
|
|
12852
|
+
var et = h(me, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
12853
|
+
var tt = h(me, "gu").replace(/notPunctSpace/g, Ke).replace(/punctSpace/g, Ue).replace(/punct/g, ge).getRegex();
|
|
12854
|
+
var nt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
|
|
12855
|
+
var rt = h(nt, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
12856
|
+
var st = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
12857
|
+
var it = "^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)";
|
|
12858
|
+
var ot = h(it, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
12859
|
+
var at = h(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, $).getRegex();
|
|
12860
|
+
var lt = "^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)";
|
|
12861
|
+
var ut = h(lt, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
|
|
12862
|
+
var pt = h(/\\(punct)/, "gu").replace(/punct/g, $).getRegex();
|
|
12863
|
+
var ct = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
|
|
12864
|
+
var ht = h(ee).replace("(?:-->|$)", "-->").getRegex();
|
|
12865
|
+
var dt = h("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ht).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
|
12866
|
+
var xe = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
|
|
12867
|
+
var U = h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", xe).getRegex();
|
|
12868
|
+
var kt = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", U).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
|
12869
|
+
var gt = h(/^!?\[(label)\]\[(ref)\]/).replace("label", U).replace("ref", Y).getRegex();
|
|
12870
|
+
var ft = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Y).getRegex();
|
|
12871
|
+
var ue = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
|
|
12872
|
+
var mt = h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", xe).getRegex();
|
|
12873
|
+
var xt = h("reflink|nolink(?!\\()", "g").replace("reflink", h(/^!?\[(label)\]\[(ref)\]/).replace("label", mt).replace("ref", ue).getRegex()).replace("nolink", h(/^!?\[(ref)\](?:\[\])?/).replace("ref", ue).getRegex()).getRegex();
|
|
12874
|
+
var pe = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
|
|
12875
|
+
var bt = /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/;
|
|
12876
|
+
var Rt = h(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, bt).getRegex();
|
|
12877
|
+
var ne = { _backpedal: A, anyPunctuation: pt, autolink: ct, blockSkip: We, br: ke, code: Ne, del: A, delLDelim: A, delRDelim: A, emStrongLDelim: Xe, emStrongRDelimAst: et, emStrongRDelimUnd: st, escape: Ge, link: kt, nolink: ft, punctuation: je, reflink: gt, reflinkSearch: xt, tag: dt, text: Qe, url: A };
|
|
12878
|
+
var Tt = { ...ne, emStrongLDelim: Ye, emStrongRDelimAst: rt, emStrongRDelimUnd: ot, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", U).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", U).getRegex() };
|
|
12879
|
+
var X = { ...ne, emStrongRDelimAst: tt, emStrongLDelim: Je, delLDelim: at, delRDelim: ut, url: h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Rt).replace("protocol", pe).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: h(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", pe).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex() };
|
|
12880
|
+
var Ot = { ...X, br: h(ke).replace("{2,}", "*").getRegex(), text: h(X.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
|
|
12881
|
+
var j = { normal: te, gfm: Ze, pedantic: He };
|
|
12882
|
+
var D = { normal: ne, gfm: X, breaks: Ot, pedantic: Tt };
|
|
12883
|
+
var wt = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
12884
|
+
var be = (l3) => wt[l3];
|
|
12885
|
+
function O(l3, e) {
|
|
12485
12886
|
if (e) {
|
|
12486
|
-
if (
|
|
12487
|
-
} else if (
|
|
12488
|
-
return
|
|
12887
|
+
if (x.escapeTest.test(l3)) return l3.replace(x.escapeReplace, be);
|
|
12888
|
+
} else if (x.escapeTestNoEncode.test(l3)) return l3.replace(x.escapeReplaceNoEncode, be);
|
|
12889
|
+
return l3;
|
|
12890
|
+
}
|
|
12891
|
+
function Re(l3) {
|
|
12892
|
+
return l3.replace(x.numericCharacterReference, (e, t, n) => {
|
|
12893
|
+
let s = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
|
|
12894
|
+
return s === 0 || s > 1114111 || s >= 55296 && s <= 57343 ? "\uFFFD" : String.fromCodePoint(s);
|
|
12895
|
+
});
|
|
12489
12896
|
}
|
|
12490
|
-
function
|
|
12897
|
+
function re(l3) {
|
|
12491
12898
|
try {
|
|
12492
|
-
|
|
12899
|
+
l3 = encodeURI(l3).replace(x.percentDecode, "%");
|
|
12493
12900
|
} catch {
|
|
12494
12901
|
return null;
|
|
12495
12902
|
}
|
|
12496
|
-
return
|
|
12903
|
+
return l3;
|
|
12497
12904
|
}
|
|
12498
|
-
function
|
|
12499
|
-
let t =
|
|
12500
|
-
let
|
|
12501
|
-
for (; --a >= 0 && i[a] === "\\"; )
|
|
12502
|
-
return
|
|
12503
|
-
}), n = t.split(
|
|
12905
|
+
function se(l3, e) {
|
|
12906
|
+
let t = l3.replace(x.findPipe, (r, o, i) => {
|
|
12907
|
+
let u = false, a = o;
|
|
12908
|
+
for (; --a >= 0 && i[a] === "\\"; ) u = !u;
|
|
12909
|
+
return u ? "|" : " |";
|
|
12910
|
+
}), n = t.split(x.splitPipe), s = 0;
|
|
12504
12911
|
if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), e) if (n.length > e) n.splice(e);
|
|
12505
12912
|
else for (; n.length < e; ) n.push("");
|
|
12506
|
-
for (; s < n.length; s++) n[s] = n[s].trim().replace(
|
|
12913
|
+
for (; s < n.length; s++) n[s] = n[s].trim().replace(x.slashPipe, "|");
|
|
12507
12914
|
return n;
|
|
12508
12915
|
}
|
|
12509
|
-
function
|
|
12510
|
-
let n =
|
|
12916
|
+
function L(l3, e, t) {
|
|
12917
|
+
let n = l3.length;
|
|
12511
12918
|
if (n === 0) return "";
|
|
12512
12919
|
let s = 0;
|
|
12513
12920
|
for (; s < n; ) {
|
|
12514
|
-
let r =
|
|
12921
|
+
let r = l3.charAt(n - s - 1);
|
|
12515
12922
|
if (r === e && !t) s++;
|
|
12516
12923
|
else if (r !== e && t) s++;
|
|
12517
12924
|
else break;
|
|
12518
12925
|
}
|
|
12519
|
-
return
|
|
12926
|
+
return l3.slice(0, n - s);
|
|
12520
12927
|
}
|
|
12521
|
-
function
|
|
12522
|
-
let e =
|
|
12928
|
+
function ie(l3) {
|
|
12929
|
+
let e = l3.split(`
|
|
12523
12930
|
`), t = e.length - 1;
|
|
12524
|
-
for (; t >= 0 &&
|
|
12525
|
-
return e.length - t <= 2 ?
|
|
12931
|
+
for (; t >= 0 && x.blankLine.test(e[t]); ) t--;
|
|
12932
|
+
return e.length - t <= 2 ? l3 : e.slice(0, t + 1).join(`
|
|
12526
12933
|
`);
|
|
12527
12934
|
}
|
|
12528
|
-
function
|
|
12529
|
-
|
|
12935
|
+
function q(l3) {
|
|
12936
|
+
return l3.trim().toLowerCase().toUpperCase().toLowerCase();
|
|
12937
|
+
}
|
|
12938
|
+
function Te(l3, e) {
|
|
12939
|
+
if (l3.indexOf(e[1]) === -1) return -1;
|
|
12530
12940
|
let t = 0;
|
|
12531
|
-
for (let n = 0; n <
|
|
12532
|
-
else if (
|
|
12533
|
-
else if (
|
|
12941
|
+
for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
|
|
12942
|
+
else if (l3[n] === e[0]) t++;
|
|
12943
|
+
else if (l3[n] === e[1] && (t--, t < 0)) return n;
|
|
12534
12944
|
return t > 0 ? -2 : -1;
|
|
12535
12945
|
}
|
|
12536
|
-
function
|
|
12946
|
+
function oe(l3, e = 0) {
|
|
12537
12947
|
let t = e, n = "";
|
|
12538
|
-
for (let s of
|
|
12948
|
+
for (let s of l3) if (s === " ") {
|
|
12539
12949
|
let r = 4 - t % 4;
|
|
12540
12950
|
n += " ".repeat(r), t += r;
|
|
12541
12951
|
} else n += s, t++;
|
|
12542
12952
|
return n;
|
|
12543
12953
|
}
|
|
12544
|
-
function
|
|
12545
|
-
let r = e.href, o = e.title || null, i =
|
|
12954
|
+
function Oe(l3, e, t, n, s) {
|
|
12955
|
+
let r = e.href, o = e.title || null, i = l3[1].replace(s.other.outputLinkReplace, "$1"), u = l3[0].charAt(0) === "!";
|
|
12546
12956
|
n.state.inLink = true;
|
|
12547
12957
|
let a = n.state.linkEmitted, p = n.state.inRawBlock;
|
|
12548
12958
|
n.state.linkEmitted = false;
|
|
12549
|
-
let c = n.inlineTokens(i),
|
|
12550
|
-
if (n.state.linkEmitted = a, n.state.inLink = false, !
|
|
12551
|
-
if (
|
|
12959
|
+
let c = n.inlineTokens(i), d = n.state.linkEmitted;
|
|
12960
|
+
if (n.state.linkEmitted = a, n.state.inLink = false, !u) {
|
|
12961
|
+
if (d) {
|
|
12552
12962
|
n.state.inRawBlock = p;
|
|
12553
12963
|
return;
|
|
12554
12964
|
}
|
|
12555
12965
|
n.state.linkEmitted = true;
|
|
12556
12966
|
}
|
|
12557
|
-
return { type:
|
|
12967
|
+
return { type: u ? "image" : "link", raw: t, href: r, title: o, text: i, tokens: c };
|
|
12558
12968
|
}
|
|
12559
|
-
function
|
|
12560
|
-
let n =
|
|
12969
|
+
function yt(l3, e, t) {
|
|
12970
|
+
let n = l3.match(t.other.indentCodeCompensation);
|
|
12561
12971
|
if (n === null) return e;
|
|
12562
12972
|
let s = n[1];
|
|
12563
12973
|
return e.split(`
|
|
@@ -12569,12 +12979,35 @@ function dt(u3, e, t) {
|
|
|
12569
12979
|
}).join(`
|
|
12570
12980
|
`);
|
|
12571
12981
|
}
|
|
12572
|
-
|
|
12982
|
+
function we(l3, e, t, n) {
|
|
12983
|
+
if (!e.includes("<")) return false;
|
|
12984
|
+
for (let s = 0; s < e.length; s++) {
|
|
12985
|
+
if (e[s] === "\\") {
|
|
12986
|
+
s++;
|
|
12987
|
+
continue;
|
|
12988
|
+
}
|
|
12989
|
+
if (e[s] === "`") {
|
|
12990
|
+
let i = n.inline.code.exec(e.slice(s));
|
|
12991
|
+
if (i) {
|
|
12992
|
+
s += i[0].length - 1;
|
|
12993
|
+
continue;
|
|
12994
|
+
}
|
|
12995
|
+
}
|
|
12996
|
+
if (e[s] !== "<") continue;
|
|
12997
|
+
let r = l3.slice(t + s), o = n.inline.tag.exec(r) || n.inline.autolink.exec(r);
|
|
12998
|
+
if (o) {
|
|
12999
|
+
if (o[0].length > e.length - s) return true;
|
|
13000
|
+
s += o[0].length - 1;
|
|
13001
|
+
}
|
|
13002
|
+
}
|
|
13003
|
+
return false;
|
|
13004
|
+
}
|
|
13005
|
+
var P = class {
|
|
12573
13006
|
options;
|
|
12574
13007
|
rules;
|
|
12575
13008
|
lexer;
|
|
12576
13009
|
constructor(e) {
|
|
12577
|
-
this.options = e ||
|
|
13010
|
+
this.options = e || y;
|
|
12578
13011
|
}
|
|
12579
13012
|
space(e) {
|
|
12580
13013
|
let t = this.rules.block.newline.exec(e);
|
|
@@ -12583,14 +13016,14 @@ var y = class {
|
|
|
12583
13016
|
code(e) {
|
|
12584
13017
|
let t = this.rules.block.code.exec(e);
|
|
12585
13018
|
if (t) {
|
|
12586
|
-
let n = this.options.pedantic ? t[0] :
|
|
13019
|
+
let n = this.options.pedantic ? t[0] : ie(t[0]), s = n.replace(this.rules.other.codeRemoveIndent, "");
|
|
12587
13020
|
return { type: "code", raw: n, codeBlockStyle: "indented", text: s };
|
|
12588
13021
|
}
|
|
12589
13022
|
}
|
|
12590
13023
|
fences(e) {
|
|
12591
13024
|
let t = this.rules.block.fences.exec(e);
|
|
12592
13025
|
if (t) {
|
|
12593
|
-
let n = t[0], s =
|
|
13026
|
+
let n = t[0], s = yt(n, t[3] || "", this.rules);
|
|
12594
13027
|
return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
|
|
12595
13028
|
}
|
|
12596
13029
|
}
|
|
@@ -12599,52 +13032,56 @@ var y = class {
|
|
|
12599
13032
|
if (t) {
|
|
12600
13033
|
let n = t[2].trim();
|
|
12601
13034
|
if (this.rules.other.endingHash.test(n)) {
|
|
12602
|
-
let s =
|
|
13035
|
+
let s = L(n, "#");
|
|
12603
13036
|
(this.options.pedantic || !s || this.rules.other.endingSpaceTabChar.test(s)) && (n = s.trim());
|
|
12604
13037
|
}
|
|
12605
|
-
return { type: "heading", raw:
|
|
13038
|
+
return { type: "heading", raw: L(t[0], `
|
|
12606
13039
|
`), depth: t[1].length, text: n, tokens: this.lexer.inline(n) };
|
|
12607
13040
|
}
|
|
12608
13041
|
}
|
|
12609
13042
|
hr(e) {
|
|
12610
13043
|
let t = this.rules.block.hr.exec(e);
|
|
12611
|
-
if (t) return { type: "hr", raw:
|
|
13044
|
+
if (t) return { type: "hr", raw: L(t[0], `
|
|
12612
13045
|
`) };
|
|
12613
13046
|
}
|
|
12614
13047
|
blockquote(e) {
|
|
12615
13048
|
let t = this.rules.block.blockquote.exec(e);
|
|
12616
13049
|
if (t) {
|
|
12617
|
-
let n =
|
|
13050
|
+
let n = L(t[0], `
|
|
12618
13051
|
`).split(`
|
|
12619
13052
|
`), s = "", r = "", o = [];
|
|
12620
13053
|
for (; n.length > 0; ) {
|
|
12621
|
-
let i = false,
|
|
12622
|
-
for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a]))
|
|
12623
|
-
else if (!i)
|
|
13054
|
+
let i = false, u = [], a;
|
|
13055
|
+
for (a = 0; a < n.length; a++) if (this.rules.other.blockquoteStart.test(n[a])) u.push(n[a]), i = true;
|
|
13056
|
+
else if (!i) u.push(n[a]);
|
|
12624
13057
|
else break;
|
|
12625
13058
|
n = n.slice(a);
|
|
12626
|
-
let p =
|
|
13059
|
+
let p = u.join(`
|
|
12627
13060
|
`), c = p.replace(this.rules.other.blockquoteSetextReplace, `
|
|
12628
13061
|
$1`).replace(this.rules.other.blockquoteSetextReplace2, "");
|
|
12629
13062
|
s = s ? `${s}
|
|
12630
13063
|
${p}` : p, r = r ? `${r}
|
|
12631
13064
|
${c}` : c;
|
|
12632
|
-
let
|
|
12633
|
-
if (this.lexer.state.top = true, this.lexer.blockTokens(c, o, true), this.lexer.state.top =
|
|
12634
|
-
let
|
|
12635
|
-
if (
|
|
12636
|
-
if (
|
|
12637
|
-
let
|
|
12638
|
-
`), w =
|
|
12639
|
-
` + g.replace(this.rules.other.blockquoteSetextReplace2, ""),
|
|
12640
|
-
o[o.length - 1] =
|
|
12641
|
-
|
|
13065
|
+
let d = this.lexer.state.top;
|
|
13066
|
+
if (this.lexer.state.top = true, this.lexer.blockTokens(c, o, true), this.lexer.state.top = d, n.length === 0) break;
|
|
13067
|
+
let m = o.at(-1);
|
|
13068
|
+
if (m?.type === "code") break;
|
|
13069
|
+
if (m?.type === "blockquote") {
|
|
13070
|
+
let b = m, g = n.join(`
|
|
13071
|
+
`), w = b.raw + `
|
|
13072
|
+
` + g.replace(this.rules.other.blockquoteSetextReplace2, ""), f = this.blockquote(w);
|
|
13073
|
+
o[o.length - 1] = f;
|
|
13074
|
+
let M = w.substring(f.raw.length).replace(/^\n/, ""), v = M ? M.split(`
|
|
13075
|
+
`).length : 0, Z = v ? n.slice(0, -v) : n;
|
|
13076
|
+
Z.length > 0 && (s = `${s}
|
|
13077
|
+
${Z.join(`
|
|
13078
|
+
`)}`), r = r.substring(0, r.length - b.text.length) + f.text;
|
|
12642
13079
|
break;
|
|
12643
|
-
} else if (
|
|
12644
|
-
let
|
|
13080
|
+
} else if (m?.type === "list") {
|
|
13081
|
+
let b = m, g = b.raw + `
|
|
12645
13082
|
` + n.join(`
|
|
12646
13083
|
`), w = this.list(g);
|
|
12647
|
-
o[o.length - 1] = w, s = s.substring(0, s.length -
|
|
13084
|
+
o[o.length - 1] = w, s = s.substring(0, s.length - m.raw.length) + w.raw, r = r.substring(0, r.length - b.raw.length) + w.raw, n = g.substring(o.at(-1).raw.length).split(`
|
|
12648
13085
|
`);
|
|
12649
13086
|
continue;
|
|
12650
13087
|
}
|
|
@@ -12662,49 +13099,49 @@ ${g}`, r = r.substring(0, r.length - O.text.length) + z.text;
|
|
|
12662
13099
|
let a = false, p = "", c = "";
|
|
12663
13100
|
if (!(t = o.exec(e)) || this.rules.block.hr.test(e)) break;
|
|
12664
13101
|
p = t[0], e = e.substring(p.length);
|
|
12665
|
-
let
|
|
12666
|
-
`, 1)[0], t[1].length
|
|
12667
|
-
`, 1)[0],
|
|
12668
|
-
if (this.options.pedantic ? (
|
|
12669
|
-
`, e = e.substring(
|
|
12670
|
-
let
|
|
13102
|
+
let d = t[2].split(`
|
|
13103
|
+
`, 1)[0], m = t[1].length, b = this.options.pedantic ? oe(d, m) : d.replace(this.rules.other.leadingSpaceTab, (M) => oe(M, m)), g = e.split(`
|
|
13104
|
+
`, 1)[0], w = !b.trim(), f = 0;
|
|
13105
|
+
if (this.options.pedantic ? (f = 2, c = b.trimStart()) : w ? f = m + 1 : (f = b.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = b.slice(f), f += m), w && this.rules.other.blankLine.test(g) && (p += g + `
|
|
13106
|
+
`, e = e.substring(g.length + 1), a = true), !a) {
|
|
13107
|
+
let M = this.rules.other.nextBulletRegex(f), v = this.rules.other.hrRegex(f), Z = this.rules.other.fencesBeginRegex(f), ae = this.rules.other.headingBeginRegex(f), ye = this.rules.other.htmlBeginRegex(f), Pe = this.rules.other.blockquoteBeginRegex(f);
|
|
12671
13108
|
for (; e; ) {
|
|
12672
|
-
let
|
|
12673
|
-
`, 1)[0],
|
|
12674
|
-
if (
|
|
12675
|
-
if (
|
|
12676
|
-
` +
|
|
13109
|
+
let K = e.split(`
|
|
13110
|
+
`, 1)[0], H;
|
|
13111
|
+
if (g = K, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), H = g) : H = g.replace(this.rules.other.leadingSpaceTab, (Se) => Se.replace(this.rules.other.tabCharGlobal, " ")), Z.test(g) || ae.test(g) || ye.test(g) || Pe.test(g) || M.test(g) || v.test(g)) break;
|
|
13112
|
+
if (H.search(this.rules.other.nonSpaceChar) >= f || !g.trim()) c += `
|
|
13113
|
+
` + H.slice(f);
|
|
12677
13114
|
else {
|
|
12678
|
-
if (
|
|
13115
|
+
if (w || b.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Z.test(b) || ae.test(b) || v.test(b)) break;
|
|
12679
13116
|
c += `
|
|
12680
|
-
` +
|
|
13117
|
+
` + g;
|
|
12681
13118
|
}
|
|
12682
|
-
|
|
12683
|
-
`, e = e.substring(
|
|
13119
|
+
w = !g.trim(), p += K + `
|
|
13120
|
+
`, e = e.substring(K.length + 1), b = H.slice(f);
|
|
12684
13121
|
}
|
|
12685
13122
|
}
|
|
12686
13123
|
r.loose || (i ? r.loose = true : this.rules.other.doubleBlankLine.test(p) && (i = true)), r.items.push({ type: "list_item", raw: p, task: !!this.options.gfm && this.rules.other.listIsTask.test(c), loose: false, text: c, tokens: [] }), r.raw += p;
|
|
12687
13124
|
}
|
|
12688
|
-
let
|
|
12689
|
-
if (
|
|
13125
|
+
let u = r.items.at(-1);
|
|
13126
|
+
if (u) u.raw = u.raw.trimEnd(), u.text = u.text.trimEnd();
|
|
12690
13127
|
else return;
|
|
12691
13128
|
r.raw = r.raw.trimEnd();
|
|
12692
13129
|
for (let a of r.items) if (this.lexer.state.top = false, a.tokens = this.lexer.blockTokens(a.text, []), !r.loose) {
|
|
12693
|
-
let p = a.tokens.filter((
|
|
13130
|
+
let p = a.tokens.filter((d) => d.type === "space"), c = p.length > 0 && p.some((d) => this.rules.other.anyLine.test(d.raw));
|
|
12694
13131
|
r.loose = c;
|
|
12695
13132
|
}
|
|
12696
13133
|
for (let a of r.items) {
|
|
12697
13134
|
let p = a.tokens[0];
|
|
12698
13135
|
if (a.task && (p?.type === "text" || p?.type === "paragraph")) {
|
|
12699
13136
|
a.text = a.text.replace(this.rules.other.listReplaceTask, ""), p.raw = p.raw.replace(this.rules.other.listReplaceTask, ""), p.text = p.text.replace(this.rules.other.listReplaceTask, "");
|
|
12700
|
-
for (let
|
|
12701
|
-
this.lexer.inlineQueue[
|
|
13137
|
+
for (let d = this.lexer.inlineQueue.length - 1; d >= 0; d--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[d].src)) {
|
|
13138
|
+
this.lexer.inlineQueue[d].src = this.lexer.inlineQueue[d].src.replace(this.rules.other.listReplaceTask, "");
|
|
12702
13139
|
break;
|
|
12703
13140
|
}
|
|
12704
13141
|
let c = this.rules.other.listTaskCheckbox.exec(a.raw);
|
|
12705
13142
|
if (c) {
|
|
12706
|
-
let
|
|
12707
|
-
a.checked =
|
|
13143
|
+
let d = { type: "checkbox", raw: c[0] + " ", checked: c[0] !== "[ ]" };
|
|
13144
|
+
a.checked = d.checked, r.loose ? a.tokens[0] && ["paragraph", "text"].includes(a.tokens[0].type) && "tokens" in a.tokens[0] && a.tokens[0].tokens ? (a.tokens[0].raw = d.raw + a.tokens[0].raw, a.tokens[0].text = d.raw + a.tokens[0].text, a.tokens[0].tokens.unshift(d)) : a.tokens.unshift({ type: "paragraph", raw: d.raw, text: d.raw, tokens: [d] }) : a.tokens.unshift(d);
|
|
12708
13145
|
}
|
|
12709
13146
|
} else a.task && (a.task = false);
|
|
12710
13147
|
}
|
|
@@ -12718,28 +13155,28 @@ ${g}`, r = r.substring(0, r.length - O.text.length) + z.text;
|
|
|
12718
13155
|
html(e) {
|
|
12719
13156
|
let t = this.rules.block.html.exec(e);
|
|
12720
13157
|
if (t) {
|
|
12721
|
-
let n =
|
|
13158
|
+
let n = ie(t[0]);
|
|
12722
13159
|
return { type: "html", block: true, raw: n, pre: t[1] === "pre" || t[1] === "script" || t[1] === "style", text: n };
|
|
12723
13160
|
}
|
|
12724
13161
|
}
|
|
12725
13162
|
def(e) {
|
|
12726
13163
|
let t = this.rules.block.def.exec(e);
|
|
12727
13164
|
if (t) {
|
|
12728
|
-
let n = t[1]
|
|
12729
|
-
return { type: "def", tag: n, raw:
|
|
13165
|
+
let n = q(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
|
|
13166
|
+
return { type: "def", tag: n, raw: L(t[0], `
|
|
12730
13167
|
`), href: s, title: r };
|
|
12731
13168
|
}
|
|
12732
13169
|
}
|
|
12733
13170
|
table(e) {
|
|
12734
13171
|
let t = this.rules.block.table.exec(e);
|
|
12735
13172
|
if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
|
|
12736
|
-
let n =
|
|
12737
|
-
`) : [], o = { type: "table", raw:
|
|
13173
|
+
let n = se(t[1]), s = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), r = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split(`
|
|
13174
|
+
`) : [], o = { type: "table", raw: L(t[0], `
|
|
12738
13175
|
`), header: [], align: [], rows: [] };
|
|
12739
13176
|
if (n.length === s.length) {
|
|
12740
13177
|
for (let i of s) this.rules.other.tableAlignRight.test(i) ? o.align.push("right") : this.rules.other.tableAlignCenter.test(i) ? o.align.push("center") : this.rules.other.tableAlignLeft.test(i) ? o.align.push("left") : o.align.push(null);
|
|
12741
13178
|
for (let i = 0; i < n.length; i++) o.header.push({ text: n[i], tokens: this.lexer.inline(n[i]), header: true, align: o.align[i] });
|
|
12742
|
-
for (let i of r) o.rows.push(
|
|
13179
|
+
for (let i of r) o.rows.push(se(i, o.header.length).map((u, a) => ({ text: u, tokens: this.lexer.inline(u), header: false, align: o.align[a] })));
|
|
12743
13180
|
return o;
|
|
12744
13181
|
}
|
|
12745
13182
|
}
|
|
@@ -12747,7 +13184,7 @@ ${g}`, r = r.substring(0, r.length - O.text.length) + z.text;
|
|
|
12747
13184
|
let t = this.rules.block.lheading.exec(e);
|
|
12748
13185
|
if (t) {
|
|
12749
13186
|
let n = t[1].trim();
|
|
12750
|
-
return { type: "heading", raw:
|
|
13187
|
+
return { type: "heading", raw: L(t[0], `
|
|
12751
13188
|
`), depth: t[2].charAt(0) === "=" ? 1 : 2, text: n, tokens: this.lexer.inline(n) };
|
|
12752
13189
|
}
|
|
12753
13190
|
}
|
|
@@ -12774,61 +13211,65 @@ ${g}`, r = r.substring(0, r.length - O.text.length) + z.text;
|
|
|
12774
13211
|
link(e) {
|
|
12775
13212
|
let t = this.rules.inline.link.exec(e);
|
|
12776
13213
|
if (t) {
|
|
12777
|
-
let n = t[
|
|
12778
|
-
if (!this.options.pedantic && this.rules
|
|
12779
|
-
|
|
12780
|
-
|
|
12781
|
-
if (
|
|
13214
|
+
let n = t[0].charAt(0) === "!" ? 2 : 1;
|
|
13215
|
+
if (!this.options.pedantic && we(e, t[1], n, this.rules)) return;
|
|
13216
|
+
let s = t[2].trim();
|
|
13217
|
+
if (!this.options.pedantic && this.rules.other.startAngleBracket.test(s)) {
|
|
13218
|
+
if (!this.rules.other.endAngleBracket.test(s)) return;
|
|
13219
|
+
let i = L(s.slice(0, -1), "\\");
|
|
13220
|
+
if ((s.length - i.length) % 2 === 0) return;
|
|
12782
13221
|
} else {
|
|
12783
|
-
let
|
|
12784
|
-
if (
|
|
12785
|
-
if (
|
|
12786
|
-
let
|
|
12787
|
-
t[2] = t[2].substring(0,
|
|
13222
|
+
let i = Te(t[2], "()");
|
|
13223
|
+
if (i === -2) return;
|
|
13224
|
+
if (i > -1) {
|
|
13225
|
+
let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
|
|
13226
|
+
t[2] = t[2].substring(0, i), t[0] = t[0].substring(0, a).trim(), t[3] = "";
|
|
12788
13227
|
}
|
|
12789
13228
|
}
|
|
12790
|
-
let
|
|
13229
|
+
let r = t[2], o = "";
|
|
12791
13230
|
if (this.options.pedantic) {
|
|
12792
|
-
let
|
|
12793
|
-
|
|
12794
|
-
} else
|
|
12795
|
-
return
|
|
13231
|
+
let i = this.rules.other.pedanticHrefTitle.exec(r);
|
|
13232
|
+
i && (r = i[1], o = i[3]);
|
|
13233
|
+
} else o = t[3] ? t[3].slice(1, -1) : "";
|
|
13234
|
+
return r = r.trim(), this.rules.other.startAngleBracket.test(r) && (this.options.pedantic && !this.rules.other.endAngleBracket.test(s) ? r = r.slice(1) : r = r.slice(1, -1)), Oe(t, { href: r && r.replace(this.rules.inline.anyPunctuation, "$1"), title: o && o.replace(this.rules.inline.anyPunctuation, "$1") }, t[0], this.lexer, this.rules);
|
|
12796
13235
|
}
|
|
12797
13236
|
}
|
|
12798
13237
|
reflink(e, t) {
|
|
12799
13238
|
let n;
|
|
12800
13239
|
if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
|
|
12801
|
-
let s =
|
|
12802
|
-
if (!
|
|
12803
|
-
|
|
12804
|
-
|
|
13240
|
+
let s = n[0].charAt(0) === "!" ? 2 : 1;
|
|
13241
|
+
if (!this.options.pedantic && we(e, n[1], s, this.rules)) return;
|
|
13242
|
+
let r = (n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " "), o = t[q(r)];
|
|
13243
|
+
if (!o) {
|
|
13244
|
+
let i = n[0].charAt(0);
|
|
13245
|
+
return { type: "text", raw: i, text: i };
|
|
12805
13246
|
}
|
|
12806
|
-
return
|
|
13247
|
+
return Oe(n, o, n[0], this.lexer, this.rules);
|
|
12807
13248
|
}
|
|
12808
13249
|
}
|
|
12809
13250
|
emStrong(e, t, n = "") {
|
|
12810
13251
|
let s = this.rules.inline.emStrongLDelim.exec(e);
|
|
12811
13252
|
if (!s || !s[1] && !s[2] && !s[3] && !s[4] || s[4] && n.match(this.rules.other.unicodeAlphaNumeric)) return;
|
|
12812
13253
|
if (!(s[1] || s[3] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
12813
|
-
let o = [...s[0]].length - 1, i,
|
|
12814
|
-
for (
|
|
13254
|
+
let o = [...s[0]].length - 1, i, u, a = o, p = 0, c = s[0][0], d = n === c, m = c === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
|
13255
|
+
for (m.lastIndex = 0, t = t.slice(-1 * e.length + o); (s = m.exec(t)) !== null; ) {
|
|
12815
13256
|
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i) continue;
|
|
12816
|
-
if (
|
|
12817
|
-
a +=
|
|
13257
|
+
if (u = [...i].length, s[3] || s[4]) {
|
|
13258
|
+
a += u;
|
|
12818
13259
|
continue;
|
|
12819
13260
|
} else if (s[5] || s[6]) {
|
|
12820
|
-
if (o % 3 && !((o +
|
|
12821
|
-
p +=
|
|
13261
|
+
if (o % 3 && !((o + u) % 3)) {
|
|
13262
|
+
p += u;
|
|
12822
13263
|
continue;
|
|
12823
13264
|
}
|
|
12824
|
-
if (
|
|
13265
|
+
if (d) break;
|
|
12825
13266
|
}
|
|
12826
|
-
if (a -=
|
|
12827
|
-
|
|
12828
|
-
let
|
|
12829
|
-
if (Math.min(o,
|
|
12830
|
-
let
|
|
12831
|
-
return { type: "em", raw: g, text:
|
|
13267
|
+
if (a -= u, a > 0) continue;
|
|
13268
|
+
u = Math.min(u, u + a + p);
|
|
13269
|
+
let b = [...s[0]][0].length, g = e.slice(0, o + s.index + b + u);
|
|
13270
|
+
if (Math.min(o, u) % 2) {
|
|
13271
|
+
let f = g.slice(1, -1);
|
|
13272
|
+
return { type: "em", raw: g, text: f, tokens: this.lexer.inlineTokens(f) };
|
|
12832
13273
|
}
|
|
12833
13274
|
let w = g.slice(2, -2);
|
|
12834
13275
|
return { type: "strong", raw: g, text: w, tokens: this.lexer.inlineTokens(w) };
|
|
@@ -12850,17 +13291,17 @@ ${g}`, r = r.substring(0, r.length - O.text.length) + z.text;
|
|
|
12850
13291
|
let s = this.rules.inline.delLDelim.exec(e);
|
|
12851
13292
|
if (!s) return;
|
|
12852
13293
|
if (!(s[1] || "") || !n || this.rules.inline.punctuation.exec(n)) {
|
|
12853
|
-
let o = [...s[0]].length - 1, i,
|
|
13294
|
+
let o = [...s[0]].length - 1, i, u, a = o, p = this.rules.inline.delRDelim;
|
|
12854
13295
|
for (p.lastIndex = 0, t = t.slice(-1 * e.length + o); (s = p.exec(t)) !== null; ) {
|
|
12855
|
-
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (
|
|
13296
|
+
if (i = s[1] || s[2] || s[3] || s[4] || s[5] || s[6], !i || (u = [...i].length, u !== o)) continue;
|
|
12856
13297
|
if (s[3] || s[4]) {
|
|
12857
|
-
a +=
|
|
13298
|
+
a += u;
|
|
12858
13299
|
continue;
|
|
12859
13300
|
}
|
|
12860
|
-
if (a -=
|
|
12861
|
-
|
|
12862
|
-
let c = [...s[0]][0].length,
|
|
12863
|
-
return { type: "del", raw:
|
|
13301
|
+
if (a -= u, a > 0) continue;
|
|
13302
|
+
u = Math.min(u, u + a);
|
|
13303
|
+
let c = [...s[0]][0].length, d = e.slice(0, o + s.index + c + u), m = d.slice(o, -o);
|
|
13304
|
+
return { type: "del", raw: d, text: m, tokens: this.lexer.inlineTokens(m) };
|
|
12864
13305
|
}
|
|
12865
13306
|
}
|
|
12866
13307
|
}
|
|
@@ -12890,32 +13331,32 @@ ${g}`, r = r.substring(0, r.length - O.text.length) + z.text;
|
|
|
12890
13331
|
let t = this.rules.inline.text.exec(e);
|
|
12891
13332
|
if (t) {
|
|
12892
13333
|
let n = this.lexer.state.inRawBlock;
|
|
12893
|
-
return { type: "text", raw: t[0], text: t[0], escaped: n };
|
|
13334
|
+
return { type: "text", raw: t[0], text: n ? t[0] : Re(t[0]), escaped: n };
|
|
12894
13335
|
}
|
|
12895
13336
|
}
|
|
12896
13337
|
};
|
|
12897
|
-
var
|
|
13338
|
+
var R = class l {
|
|
12898
13339
|
tokens;
|
|
12899
13340
|
options;
|
|
12900
13341
|
state;
|
|
12901
13342
|
inlineQueue;
|
|
12902
13343
|
tokenizer;
|
|
12903
13344
|
constructor(e) {
|
|
12904
|
-
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e ||
|
|
12905
|
-
let t = { other:
|
|
12906
|
-
this.options.pedantic ? (t.block =
|
|
13345
|
+
this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || y, this.options.tokenizer = this.options.tokenizer || new P(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, top: true };
|
|
13346
|
+
let t = { other: x, block: j.normal, inline: D.normal };
|
|
13347
|
+
this.options.pedantic ? (t.block = j.pedantic, t.inline = D.pedantic) : this.options.gfm && (t.block = j.gfm, this.options.breaks ? t.inline = D.breaks : t.inline = D.gfm), this.tokenizer.rules = t;
|
|
12907
13348
|
}
|
|
12908
13349
|
static get rules() {
|
|
12909
|
-
return { block:
|
|
13350
|
+
return { block: j, inline: D };
|
|
12910
13351
|
}
|
|
12911
13352
|
static lex(e, t) {
|
|
12912
|
-
return new
|
|
13353
|
+
return new l(t).lex(e);
|
|
12913
13354
|
}
|
|
12914
13355
|
static lexInline(e, t) {
|
|
12915
|
-
return new
|
|
13356
|
+
return new l(t).inlineTokens(e);
|
|
12916
13357
|
}
|
|
12917
13358
|
lex(e) {
|
|
12918
|
-
e = e.replace(
|
|
13359
|
+
e = e.replace(x.carriageReturn, `
|
|
12919
13360
|
`), this.blockTokens(e, this.tokens);
|
|
12920
13361
|
for (let t = 0; t < this.inlineQueue.length; t++) {
|
|
12921
13362
|
let n = this.inlineQueue[t];
|
|
@@ -12924,7 +13365,7 @@ var x = class u {
|
|
|
12924
13365
|
return this.inlineQueue = [], this.tokens;
|
|
12925
13366
|
}
|
|
12926
13367
|
blockTokens(e, t = [], n = false) {
|
|
12927
|
-
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(
|
|
13368
|
+
this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(x.tabCharGlobal, " ").replace(x.spaceLine, ""));
|
|
12928
13369
|
let s = 1 / 0;
|
|
12929
13370
|
for (; e; ) {
|
|
12930
13371
|
if (e.length < s) s = e.length;
|
|
@@ -12993,9 +13434,9 @@ var x = class u {
|
|
|
12993
13434
|
}
|
|
12994
13435
|
let o = e;
|
|
12995
13436
|
if (this.options.extensions?.startBlock) {
|
|
12996
|
-
let i = 1 / 0,
|
|
13437
|
+
let i = 1 / 0, u = e.slice(1), a;
|
|
12997
13438
|
this.options.extensions.startBlock.forEach((p) => {
|
|
12998
|
-
a = p.call({ lexer: this },
|
|
13439
|
+
a = p.call({ lexer: this }, u), typeof a == "number" && a >= 0 && (i = Math.min(i, a));
|
|
12999
13440
|
}), i < 1 / 0 && i >= 0 && (o = e.substring(0, i + 1));
|
|
13000
13441
|
}
|
|
13001
13442
|
if (this.state.top && (r = this.tokenizer.paragraph(o))) {
|
|
@@ -13031,7 +13472,7 @@ var x = class u {
|
|
|
13031
13472
|
for (let n of e.matchAll(this.tokenizer.rules.inline.blockSkip)) if (t.test(n[0]) && e.charAt(n.index - 1) !== "!") return true;
|
|
13032
13473
|
for (let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)) {
|
|
13033
13474
|
let s = n[0], r = s.lastIndexOf("[");
|
|
13034
|
-
if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, s.slice(r + 1, -1))) && !(r > 1 && this.linkInText(s.slice(1, r - 1)))) return true;
|
|
13475
|
+
if (!(s.charAt(0) === "!" || !Object.hasOwn(this.tokens.links, q(s.slice(r + 1, -1)))) && !(r > 1 && this.linkInText(s.slice(1, r - 1)))) return true;
|
|
13035
13476
|
}
|
|
13036
13477
|
return false;
|
|
13037
13478
|
}
|
|
@@ -13039,18 +13480,18 @@ var x = class u {
|
|
|
13039
13480
|
this.tokenizer.lexer = this;
|
|
13040
13481
|
let n = e;
|
|
13041
13482
|
if (this.tokens.links && e.includes("[")) {
|
|
13042
|
-
let i = this.tokenizer.rules.inline.reflinkSearch,
|
|
13483
|
+
let i = this.tokenizer.rules.inline.reflinkSearch, u = (a) => {
|
|
13043
13484
|
let p = a.lastIndexOf("[");
|
|
13044
|
-
if (!Object.hasOwn(this.tokens.links, a.slice(p + 1, -1))) return a;
|
|
13485
|
+
if (!Object.hasOwn(this.tokens.links, q(a.slice(p + 1, -1)))) return a;
|
|
13045
13486
|
if (p > 1 && a.charAt(0) !== "!") {
|
|
13046
13487
|
let c = a.slice(1, p - 1);
|
|
13047
|
-
if (this.linkInText(c)) return "[" + c.replace(i,
|
|
13488
|
+
if (this.linkInText(c)) return "[" + c.replace(i, u) + "][" + "a".repeat(a.length - p - 2) + "]";
|
|
13048
13489
|
}
|
|
13049
13490
|
return "[" + "a".repeat(a.length - 2) + "]";
|
|
13050
13491
|
};
|
|
13051
|
-
n = n.replace(i,
|
|
13492
|
+
n = n.replace(i, u);
|
|
13052
13493
|
}
|
|
13053
|
-
n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (i) => "+".repeat(i.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (i,
|
|
13494
|
+
n = n.replace(this.tokenizer.rules.inline.anyPunctuation, (i) => "+".repeat(i.length)), n = n.replace(this.tokenizer.rules.inline.blockSkip, (i, u, a) => {
|
|
13054
13495
|
let p = a ? a.length : 0;
|
|
13055
13496
|
return i.slice(0, p) + "[" + "a".repeat(i.length - p - 2) + "]";
|
|
13056
13497
|
}), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
|
|
@@ -13106,14 +13547,14 @@ var x = class u {
|
|
|
13106
13547
|
e = e.substring(i.raw.length), t.push(i);
|
|
13107
13548
|
continue;
|
|
13108
13549
|
}
|
|
13109
|
-
let
|
|
13550
|
+
let u = e;
|
|
13110
13551
|
if (this.options.extensions?.startInline) {
|
|
13111
13552
|
let a = 1 / 0, p = e.slice(1), c;
|
|
13112
|
-
this.options.extensions.startInline.forEach((
|
|
13113
|
-
c =
|
|
13114
|
-
}), a < 1 / 0 && a >= 0 && (
|
|
13553
|
+
this.options.extensions.startInline.forEach((d) => {
|
|
13554
|
+
c = d.call({ lexer: this }, p), typeof c == "number" && c >= 0 && (a = Math.min(a, c));
|
|
13555
|
+
}), a < 1 / 0 && a >= 0 && (u = e.substring(0, a + 1));
|
|
13115
13556
|
}
|
|
13116
|
-
if (i = this.tokenizer.inlineText(
|
|
13557
|
+
if (i = this.tokenizer.inlineText(u)) {
|
|
13117
13558
|
e = e.substring(i.raw.length), i.raw.slice(-1) !== "_" && (r = i.raw.slice(-1)), s = true;
|
|
13118
13559
|
let a = t.at(-1);
|
|
13119
13560
|
a?.type === "text" ? (a.raw += i.raw, a.text += i.text) : t.push(i);
|
|
@@ -13132,20 +13573,20 @@ var x = class u {
|
|
|
13132
13573
|
else throw new Error(t);
|
|
13133
13574
|
}
|
|
13134
13575
|
};
|
|
13135
|
-
var
|
|
13576
|
+
var S = class {
|
|
13136
13577
|
options;
|
|
13137
13578
|
parser;
|
|
13138
13579
|
constructor(e) {
|
|
13139
|
-
this.options = e ||
|
|
13580
|
+
this.options = e || y;
|
|
13140
13581
|
}
|
|
13141
13582
|
space(e) {
|
|
13142
13583
|
return "";
|
|
13143
13584
|
}
|
|
13144
13585
|
code({ text: e, lang: t, escaped: n }) {
|
|
13145
|
-
let s = (t || "").match(
|
|
13586
|
+
let s = (t || "").match(x.notSpaceStart)?.[0], r = e ? e.replace(x.endingNewline, "") + `
|
|
13146
13587
|
` : "";
|
|
13147
|
-
return s ? '<pre><code class="language-' +
|
|
13148
|
-
` : "<pre><code>" + (n ? r :
|
|
13588
|
+
return s ? '<pre><code class="language-' + O(s) + '">' + (n ? r : O(r, true)) + `</code></pre>
|
|
13589
|
+
` : "<pre><code>" + (n ? r : O(r, true)) + `</code></pre>
|
|
13149
13590
|
`;
|
|
13150
13591
|
}
|
|
13151
13592
|
blockquote({ tokens: e }) {
|
|
@@ -13170,8 +13611,8 @@ ${this.parser.parse(e)}</blockquote>
|
|
|
13170
13611
|
list(e) {
|
|
13171
13612
|
let t = e.ordered, n = e.start, s = "";
|
|
13172
13613
|
for (let i = 0; i < e.items.length; i++) {
|
|
13173
|
-
let
|
|
13174
|
-
s += this.listitem(
|
|
13614
|
+
let u = e.items[i];
|
|
13615
|
+
s += this.listitem(u);
|
|
13175
13616
|
}
|
|
13176
13617
|
let r = t ? "ol" : "ul", o = t && n !== 1 ? ' start="' + n + '"' : "";
|
|
13177
13618
|
return "<" + r + o + `>
|
|
@@ -13223,7 +13664,7 @@ ${e}</tr>
|
|
|
13223
13664
|
return `<em>${this.parser.parseInline(e)}</em>`;
|
|
13224
13665
|
}
|
|
13225
13666
|
codespan({ text: e }) {
|
|
13226
|
-
return `<code>${
|
|
13667
|
+
return `<code>${O(e, true)}</code>`;
|
|
13227
13668
|
}
|
|
13228
13669
|
br(e) {
|
|
13229
13670
|
return "<br>";
|
|
@@ -13232,25 +13673,25 @@ ${e}</tr>
|
|
|
13232
13673
|
return `<del>${this.parser.parseInline(e)}</del>`;
|
|
13233
13674
|
}
|
|
13234
13675
|
link({ href: e, title: t, text: n, tokens: s, autolink: r }) {
|
|
13235
|
-
let o = r ?
|
|
13676
|
+
let o = r ? O(n, true) : this.parser.parseInline(s), i = re(e);
|
|
13236
13677
|
if (i === null) return o;
|
|
13237
|
-
e =
|
|
13238
|
-
let
|
|
13239
|
-
return t && (
|
|
13678
|
+
e = O(i, r);
|
|
13679
|
+
let u = '<a href="' + e + '"';
|
|
13680
|
+
return t && (u += ' title="' + O(t) + '"'), u += ">" + o + "</a>", u;
|
|
13240
13681
|
}
|
|
13241
13682
|
image({ href: e, title: t, text: n, tokens: s }) {
|
|
13242
13683
|
s && (n = this.parser.parseInline(s, this.parser.textRenderer));
|
|
13243
|
-
let r =
|
|
13244
|
-
if (r === null) return
|
|
13684
|
+
let r = re(e);
|
|
13685
|
+
if (r === null) return O(n);
|
|
13245
13686
|
e = r;
|
|
13246
|
-
let o = `<img src="${
|
|
13247
|
-
return t && (o += ` title="${
|
|
13687
|
+
let o = `<img src="${O(e)}" alt="${O(n)}"`;
|
|
13688
|
+
return t && (o += ` title="${O(t)}"`), o += ">", o;
|
|
13248
13689
|
}
|
|
13249
13690
|
text(e) {
|
|
13250
|
-
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text :
|
|
13691
|
+
return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : O(e.text);
|
|
13251
13692
|
}
|
|
13252
13693
|
};
|
|
13253
|
-
var
|
|
13694
|
+
var z = class {
|
|
13254
13695
|
strong({ text: e }) {
|
|
13255
13696
|
return e;
|
|
13256
13697
|
}
|
|
@@ -13282,18 +13723,18 @@ var L = class {
|
|
|
13282
13723
|
return e;
|
|
13283
13724
|
}
|
|
13284
13725
|
};
|
|
13285
|
-
var
|
|
13726
|
+
var T = class l2 {
|
|
13286
13727
|
options;
|
|
13287
13728
|
renderer;
|
|
13288
13729
|
textRenderer;
|
|
13289
13730
|
constructor(e) {
|
|
13290
|
-
this.options = e ||
|
|
13731
|
+
this.options = e || y, this.options.renderer = this.options.renderer || new S(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new z();
|
|
13291
13732
|
}
|
|
13292
13733
|
static parse(e, t) {
|
|
13293
|
-
return new
|
|
13734
|
+
return new l2(t).parse(e);
|
|
13294
13735
|
}
|
|
13295
13736
|
static parseInline(e, t) {
|
|
13296
|
-
return new
|
|
13737
|
+
return new l2(t).parseInline(e);
|
|
13297
13738
|
}
|
|
13298
13739
|
parse(e) {
|
|
13299
13740
|
this.renderer.parser = this;
|
|
@@ -13434,11 +13875,11 @@ var b = class u2 {
|
|
|
13434
13875
|
return n;
|
|
13435
13876
|
}
|
|
13436
13877
|
};
|
|
13437
|
-
var
|
|
13878
|
+
var _ = class {
|
|
13438
13879
|
options;
|
|
13439
13880
|
block;
|
|
13440
13881
|
constructor(e) {
|
|
13441
|
-
this.options = e ||
|
|
13882
|
+
this.options = e || y;
|
|
13442
13883
|
}
|
|
13443
13884
|
static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
|
|
13444
13885
|
static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
|
|
@@ -13455,23 +13896,23 @@ var S = class {
|
|
|
13455
13896
|
return e;
|
|
13456
13897
|
}
|
|
13457
13898
|
provideLexer(e = this.block) {
|
|
13458
|
-
return e ?
|
|
13899
|
+
return e ? R.lex : R.lexInline;
|
|
13459
13900
|
}
|
|
13460
13901
|
provideParser(e = this.block) {
|
|
13461
|
-
return e ?
|
|
13902
|
+
return e ? T.parse : T.parseInline;
|
|
13462
13903
|
}
|
|
13463
13904
|
};
|
|
13464
|
-
var
|
|
13465
|
-
defaults =
|
|
13905
|
+
var F = class {
|
|
13906
|
+
defaults = I();
|
|
13466
13907
|
options = this.setOptions;
|
|
13467
13908
|
parse = this.parseMarkdown(true);
|
|
13468
13909
|
parseInline = this.parseMarkdown(false);
|
|
13469
|
-
Parser =
|
|
13470
|
-
Renderer =
|
|
13471
|
-
TextRenderer =
|
|
13472
|
-
Lexer =
|
|
13473
|
-
Tokenizer =
|
|
13474
|
-
Hooks =
|
|
13910
|
+
Parser = T;
|
|
13911
|
+
Renderer = S;
|
|
13912
|
+
TextRenderer = z;
|
|
13913
|
+
Lexer = R;
|
|
13914
|
+
Tokenizer = P;
|
|
13915
|
+
Hooks = _;
|
|
13475
13916
|
constructor(...e) {
|
|
13476
13917
|
this.use(...e);
|
|
13477
13918
|
}
|
|
@@ -13508,8 +13949,8 @@ var Z = class {
|
|
|
13508
13949
|
if ("renderer" in r) {
|
|
13509
13950
|
let o = t.renderers[r.name];
|
|
13510
13951
|
o ? t.renderers[r.name] = function(...i) {
|
|
13511
|
-
let
|
|
13512
|
-
return
|
|
13952
|
+
let u = r.renderer.apply(this, i);
|
|
13953
|
+
return u === false && (u = o.apply(this, i)), u;
|
|
13513
13954
|
} : t.renderers[r.name] = r.renderer;
|
|
13514
13955
|
}
|
|
13515
13956
|
if ("tokenizer" in r) {
|
|
@@ -13519,50 +13960,50 @@ var Z = class {
|
|
|
13519
13960
|
}
|
|
13520
13961
|
"childTokens" in r && r.childTokens && (t.childTokens[r.name] = r.childTokens);
|
|
13521
13962
|
}), s.extensions = t), n.renderer) {
|
|
13522
|
-
let r = this.defaults.renderer || new
|
|
13963
|
+
let r = this.defaults.renderer || new S(this.defaults);
|
|
13523
13964
|
for (let o in n.renderer) {
|
|
13524
13965
|
if (!(o in r)) throw new Error(`renderer '${o}' does not exist`);
|
|
13525
13966
|
if (["options", "parser"].includes(o)) continue;
|
|
13526
|
-
let i = o,
|
|
13967
|
+
let i = o, u = n.renderer[i], a = r[i];
|
|
13527
13968
|
r[i] = (...p) => {
|
|
13528
|
-
let c =
|
|
13969
|
+
let c = u.apply(r, p);
|
|
13529
13970
|
return c === false && (c = a.apply(r, p)), c || "";
|
|
13530
13971
|
};
|
|
13531
13972
|
}
|
|
13532
13973
|
s.renderer = r;
|
|
13533
13974
|
}
|
|
13534
13975
|
if (n.tokenizer) {
|
|
13535
|
-
let r = this.defaults.tokenizer || new
|
|
13976
|
+
let r = this.defaults.tokenizer || new P(this.defaults);
|
|
13536
13977
|
for (let o in n.tokenizer) {
|
|
13537
13978
|
if (!(o in r)) throw new Error(`tokenizer '${o}' does not exist`);
|
|
13538
13979
|
if (["options", "rules", "lexer"].includes(o)) continue;
|
|
13539
|
-
let i = o,
|
|
13980
|
+
let i = o, u = n.tokenizer[i], a = r[i];
|
|
13540
13981
|
r[i] = (...p) => {
|
|
13541
|
-
let c =
|
|
13982
|
+
let c = u.apply(r, p);
|
|
13542
13983
|
return c === false && (c = a.apply(r, p)), c;
|
|
13543
13984
|
};
|
|
13544
13985
|
}
|
|
13545
13986
|
s.tokenizer = r;
|
|
13546
13987
|
}
|
|
13547
13988
|
if (n.hooks) {
|
|
13548
|
-
let r = this.defaults.hooks || new
|
|
13989
|
+
let r = this.defaults.hooks || new _();
|
|
13549
13990
|
for (let o in n.hooks) {
|
|
13550
13991
|
if (!(o in r)) throw new Error(`hook '${o}' does not exist`);
|
|
13551
13992
|
if (["options", "block"].includes(o)) continue;
|
|
13552
|
-
let i = o,
|
|
13553
|
-
|
|
13554
|
-
if (this.defaults.async &&
|
|
13555
|
-
let
|
|
13556
|
-
return a.call(r,
|
|
13993
|
+
let i = o, u = n.hooks[i], a = r[i];
|
|
13994
|
+
_.passThroughHooks.has(o) ? r[i] = (p) => {
|
|
13995
|
+
if (this.defaults.async && _.passThroughHooksRespectAsync.has(o)) return (async () => {
|
|
13996
|
+
let d = await u.call(r, p);
|
|
13997
|
+
return a.call(r, d);
|
|
13557
13998
|
})();
|
|
13558
|
-
let c =
|
|
13999
|
+
let c = u.call(r, p);
|
|
13559
14000
|
return a.call(r, c);
|
|
13560
14001
|
} : r[i] = (...p) => {
|
|
13561
14002
|
if (this.defaults.async) return (async () => {
|
|
13562
|
-
let
|
|
13563
|
-
return
|
|
14003
|
+
let d = await u.apply(r, p);
|
|
14004
|
+
return d === false && (d = await a.apply(r, p)), d;
|
|
13564
14005
|
})();
|
|
13565
|
-
let c =
|
|
14006
|
+
let c = u.apply(r, p);
|
|
13566
14007
|
return c === false && (c = a.apply(r, p)), c;
|
|
13567
14008
|
};
|
|
13568
14009
|
}
|
|
@@ -13571,8 +14012,8 @@ var Z = class {
|
|
|
13571
14012
|
if (n.walkTokens) {
|
|
13572
14013
|
let r = this.defaults.walkTokens, o = n.walkTokens;
|
|
13573
14014
|
s.walkTokens = function(i) {
|
|
13574
|
-
let
|
|
13575
|
-
return
|
|
14015
|
+
let u = [];
|
|
14016
|
+
return u.push(o.call(this, i)), r && (u = u.concat(r.call(this, i))), u;
|
|
13576
14017
|
};
|
|
13577
14018
|
}
|
|
13578
14019
|
this.defaults = { ...this.defaults, ...s };
|
|
@@ -13582,10 +14023,10 @@ var Z = class {
|
|
|
13582
14023
|
return this.defaults = { ...this.defaults, ...e }, this;
|
|
13583
14024
|
}
|
|
13584
14025
|
lexer(e, t) {
|
|
13585
|
-
return
|
|
14026
|
+
return R.lex(e, t ?? this.defaults);
|
|
13586
14027
|
}
|
|
13587
14028
|
parser(e, t) {
|
|
13588
|
-
return
|
|
14029
|
+
return T.parse(e, t ?? this.defaults);
|
|
13589
14030
|
}
|
|
13590
14031
|
parseMarkdown(e) {
|
|
13591
14032
|
return (n, s) => {
|
|
@@ -13594,19 +14035,19 @@ var Z = class {
|
|
|
13594
14035
|
if (typeof n > "u" || n === null) return i(new Error("marked(): input parameter is undefined or null"));
|
|
13595
14036
|
if (typeof n != "string") return i(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(n) + ", string expected"));
|
|
13596
14037
|
if (o.hooks && (o.hooks.options = o, o.hooks.block = e), o.async) return (async () => {
|
|
13597
|
-
let
|
|
14038
|
+
let u = o.hooks ? await o.hooks.preprocess(n) : n, p = await (o.hooks ? await o.hooks.provideLexer(e) : e ? R.lex : R.lexInline)(u, o), c = o.hooks ? await o.hooks.processAllTokens(p) : p;
|
|
13598
14039
|
o.walkTokens && await Promise.all(this.walkTokens(c, o.walkTokens));
|
|
13599
|
-
let
|
|
13600
|
-
return o.hooks ? await o.hooks.postprocess(
|
|
14040
|
+
let m = await (o.hooks ? await o.hooks.provideParser(e) : e ? T.parse : T.parseInline)(c, o);
|
|
14041
|
+
return o.hooks ? await o.hooks.postprocess(m) : m;
|
|
13601
14042
|
})().catch(i);
|
|
13602
14043
|
try {
|
|
13603
14044
|
o.hooks && (n = o.hooks.preprocess(n));
|
|
13604
|
-
let a = (o.hooks ? o.hooks.provideLexer(e) : e ?
|
|
14045
|
+
let a = (o.hooks ? o.hooks.provideLexer(e) : e ? R.lex : R.lexInline)(n, o);
|
|
13605
14046
|
o.hooks && (a = o.hooks.processAllTokens(a)), o.walkTokens && this.walkTokens(a, o.walkTokens);
|
|
13606
|
-
let c = (o.hooks ? o.hooks.provideParser(e) : e ?
|
|
14047
|
+
let c = (o.hooks ? o.hooks.provideParser(e) : e ? T.parse : T.parseInline)(a, o);
|
|
13607
14048
|
return o.hooks && (c = o.hooks.postprocess(c)), c;
|
|
13608
|
-
} catch (
|
|
13609
|
-
return i(
|
|
14049
|
+
} catch (u) {
|
|
14050
|
+
return i(u);
|
|
13610
14051
|
}
|
|
13611
14052
|
};
|
|
13612
14053
|
}
|
|
@@ -13614,7 +14055,7 @@ var Z = class {
|
|
|
13614
14055
|
return (n) => {
|
|
13615
14056
|
if (n.message += `
|
|
13616
14057
|
Please report this to https://github.com/markedjs/marked.`, e) {
|
|
13617
|
-
let s = "<p>An error occurred:</p><pre>" +
|
|
14058
|
+
let s = "<p>An error occurred:</p><pre>" + O(n.message + "", true) + "</pre>";
|
|
13618
14059
|
return t ? Promise.resolve(s) : s;
|
|
13619
14060
|
}
|
|
13620
14061
|
if (t) return Promise.reject(n);
|
|
@@ -13622,41 +14063,41 @@ Please report this to https://github.com/markedjs/marked.`, e) {
|
|
|
13622
14063
|
};
|
|
13623
14064
|
}
|
|
13624
14065
|
};
|
|
13625
|
-
var
|
|
13626
|
-
function
|
|
13627
|
-
return
|
|
14066
|
+
var E = new F();
|
|
14067
|
+
function k(l3, e) {
|
|
14068
|
+
return E.parse(l3, e);
|
|
13628
14069
|
}
|
|
13629
|
-
|
|
13630
|
-
return
|
|
14070
|
+
k.options = k.setOptions = function(l3) {
|
|
14071
|
+
return E.setOptions(l3), k.defaults = E.defaults, W(k.defaults), k;
|
|
13631
14072
|
};
|
|
13632
|
-
|
|
13633
|
-
|
|
13634
|
-
function
|
|
13635
|
-
return
|
|
13636
|
-
}
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
return
|
|
14073
|
+
k.getDefaults = I;
|
|
14074
|
+
k.defaults = y;
|
|
14075
|
+
function Pt(...l3) {
|
|
14076
|
+
return E.use(...l3), k.defaults = E.defaults, W(k.defaults), k;
|
|
14077
|
+
}
|
|
14078
|
+
k.use = Pt;
|
|
14079
|
+
k.walkTokens = function(l3, e) {
|
|
14080
|
+
return E.walkTokens(l3, e);
|
|
13640
14081
|
};
|
|
13641
|
-
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13650
|
-
|
|
13651
|
-
var
|
|
13652
|
-
var
|
|
13653
|
-
var
|
|
13654
|
-
var
|
|
13655
|
-
var
|
|
13656
|
-
var
|
|
14082
|
+
k.parseInline = E.parseInline;
|
|
14083
|
+
k.Parser = T;
|
|
14084
|
+
k.parser = T.parse;
|
|
14085
|
+
k.Renderer = S;
|
|
14086
|
+
k.TextRenderer = z;
|
|
14087
|
+
k.Lexer = R;
|
|
14088
|
+
k.lexer = R.lex;
|
|
14089
|
+
k.Tokenizer = P;
|
|
14090
|
+
k.Hooks = _;
|
|
14091
|
+
k.parse = k;
|
|
14092
|
+
var gn = k.options;
|
|
14093
|
+
var fn = k.setOptions;
|
|
14094
|
+
var mn = k.walkTokens;
|
|
14095
|
+
var xn = k.parseInline;
|
|
14096
|
+
var Rn = T.parse;
|
|
14097
|
+
var Tn = R.lex;
|
|
13657
14098
|
|
|
13658
14099
|
// src/ui/transcript/render_markdown.ts
|
|
13659
|
-
var parser = new
|
|
14100
|
+
var parser = new F({ gfm: true, breaks: true });
|
|
13660
14101
|
var ALLOWED_TAGS = [
|
|
13661
14102
|
"a",
|
|
13662
14103
|
"p",
|
|
@@ -13725,7 +14166,7 @@ function harden(node) {
|
|
|
13725
14166
|
var purifier = null;
|
|
13726
14167
|
function sanitizer() {
|
|
13727
14168
|
if (purifier === null) {
|
|
13728
|
-
purifier =
|
|
14169
|
+
purifier = purify_default();
|
|
13729
14170
|
purifier.addHook("afterSanitizeAttributes", harden);
|
|
13730
14171
|
}
|
|
13731
14172
|
return purifier;
|
|
@@ -14900,13 +15341,13 @@ var AgUiClient = class {
|
|
|
14900
15341
|
}
|
|
14901
15342
|
}
|
|
14902
15343
|
#buildSubscriber(pending, runState) {
|
|
14903
|
-
const
|
|
15344
|
+
const h2 = this.#handlers;
|
|
14904
15345
|
const closed = this.#closedMessageIds;
|
|
14905
15346
|
const cancelled = () => this.#cancelled;
|
|
14906
15347
|
const pendingDeltas = /* @__PURE__ */ new Set();
|
|
14907
15348
|
return {
|
|
14908
15349
|
onRunInitialized() {
|
|
14909
|
-
|
|
15350
|
+
h2.onRunStart();
|
|
14910
15351
|
},
|
|
14911
15352
|
onTextMessageStartEvent({ event }) {
|
|
14912
15353
|
if (closed.has(event.messageId)) {
|
|
@@ -14916,11 +15357,11 @@ var AgUiClient = class {
|
|
|
14916
15357
|
}
|
|
14917
15358
|
},
|
|
14918
15359
|
onTextMessageContentEvent({ textMessageBuffer }) {
|
|
14919
|
-
|
|
15360
|
+
h2.onTextDelta(textMessageBuffer);
|
|
14920
15361
|
},
|
|
14921
15362
|
onTextMessageEndEvent({ event, textMessageBuffer }) {
|
|
14922
15363
|
closed.add(event.messageId);
|
|
14923
|
-
|
|
15364
|
+
h2.onTextEnd(textMessageBuffer);
|
|
14924
15365
|
},
|
|
14925
15366
|
onToolCallEndEvent({ event, toolCallName, toolCallArgs }) {
|
|
14926
15367
|
const call = {
|
|
@@ -14929,21 +15370,21 @@ var AgUiClient = class {
|
|
|
14929
15370
|
args: toolCallArgs
|
|
14930
15371
|
};
|
|
14931
15372
|
pending.push(call);
|
|
14932
|
-
|
|
15373
|
+
h2.onToolCall(call);
|
|
14933
15374
|
},
|
|
14934
15375
|
onToolCallResultEvent({ event }) {
|
|
14935
15376
|
const outcome = event.metadata?.["outcome"];
|
|
14936
|
-
|
|
15377
|
+
h2.onToolResult(event.toolCallId, contentToText2(event.content), outcome);
|
|
14937
15378
|
},
|
|
14938
15379
|
onActivitySnapshotEvent({ event, messages }) {
|
|
14939
15380
|
const known = messages.some(
|
|
14940
15381
|
(message) => message.id === event.messageId && message.role === "activity"
|
|
14941
15382
|
);
|
|
14942
15383
|
if (known) {
|
|
14943
|
-
|
|
15384
|
+
h2.onActivityChanged(event.messageId, event.activityType, event.content);
|
|
14944
15385
|
return;
|
|
14945
15386
|
}
|
|
14946
|
-
|
|
15387
|
+
h2.onActivity(event.activityType, event.content, event.messageId);
|
|
14947
15388
|
},
|
|
14948
15389
|
// Deliberately does *not* read the message here. `@ag-ui/client`
|
|
14949
15390
|
// dispatches this subscriber **before** applying the patch, so the
|
|
@@ -14958,7 +15399,7 @@ var AgUiClient = class {
|
|
|
14958
15399
|
// first moment the result exists. Only the ids marked above are looked at,
|
|
14959
15400
|
// so an ordinary text delta does not walk the transcript.
|
|
14960
15401
|
onCustomEvent({ event }) {
|
|
14961
|
-
|
|
15402
|
+
h2.onCustomEvent(event.name, event.value);
|
|
14962
15403
|
},
|
|
14963
15404
|
// The delegation lifecycle. Forwarded rather than interpreted here, for
|
|
14964
15405
|
// the reason every other subscriber in this block is thin: this file
|
|
@@ -14968,16 +15409,16 @@ var AgUiClient = class {
|
|
|
14968
15409
|
// `parentToolCallId` is optional on the wire and normalised to `null` so
|
|
14969
15410
|
// the handler has one absent-value to check rather than two.
|
|
14970
15411
|
onSubagentStartedEvent({ event }) {
|
|
14971
|
-
|
|
15412
|
+
h2.onSubAgentStarted(event.subagentRunId, event.name, event.parentToolCallId ?? null);
|
|
14972
15413
|
},
|
|
14973
15414
|
onSubagentFinishedEvent({ event }) {
|
|
14974
|
-
|
|
15415
|
+
h2.onSubAgentFinished(event.subagentRunId);
|
|
14975
15416
|
},
|
|
14976
15417
|
onSubagentErrorEvent({ event }) {
|
|
14977
|
-
|
|
15418
|
+
h2.onSubAgentError(event.subagentRunId, event.message);
|
|
14978
15419
|
},
|
|
14979
15420
|
onMessagesSnapshotEvent({ event }) {
|
|
14980
|
-
|
|
15421
|
+
h2.onMessagesSnapshot(event.messages);
|
|
14981
15422
|
},
|
|
14982
15423
|
onMessagesChanged({ messages }) {
|
|
14983
15424
|
if (pendingDeltas.size === 0) {
|
|
@@ -14986,7 +15427,7 @@ var AgUiClient = class {
|
|
|
14986
15427
|
for (const id of pendingDeltas) {
|
|
14987
15428
|
const message = messages.find((entry) => entry.id === id);
|
|
14988
15429
|
if (message !== void 0 && message.role === "activity") {
|
|
14989
|
-
|
|
15430
|
+
h2.onActivityChanged(id, message.activityType, message.content);
|
|
14990
15431
|
}
|
|
14991
15432
|
}
|
|
14992
15433
|
pendingDeltas.clear();
|
|
@@ -14997,10 +15438,10 @@ var AgUiClient = class {
|
|
|
14997
15438
|
// family emits THINKING_*: pydantic-ai has sent REASONING_* at every
|
|
14998
15439
|
// protocol version django-ag-ui admits.
|
|
14999
15440
|
onReasoningStartEvent() {
|
|
15000
|
-
|
|
15441
|
+
h2.onReasoningStart();
|
|
15001
15442
|
},
|
|
15002
15443
|
onReasoningMessageContentEvent({ reasoningMessageBuffer }) {
|
|
15003
|
-
|
|
15444
|
+
h2.onReasoningDelta(reasoningMessageBuffer);
|
|
15004
15445
|
},
|
|
15005
15446
|
// The delta callback reports the buffer as it stood *before* the announced
|
|
15006
15447
|
// delta was appended, so on its own it always trails the stream by one and
|
|
@@ -15010,10 +15451,10 @@ var AgUiClient = class {
|
|
|
15010
15451
|
// REASONING_MESSAGE_END rather than REASONING_END, because only the former
|
|
15011
15452
|
// carries a buffer.
|
|
15012
15453
|
onReasoningMessageEndEvent({ reasoningMessageBuffer }) {
|
|
15013
|
-
|
|
15454
|
+
h2.onReasoningDelta(reasoningMessageBuffer);
|
|
15014
15455
|
},
|
|
15015
15456
|
onReasoningEndEvent() {
|
|
15016
|
-
|
|
15457
|
+
h2.onReasoningEnd();
|
|
15017
15458
|
},
|
|
15018
15459
|
onRunFinishedEvent(params) {
|
|
15019
15460
|
runState.terminal = true;
|
|
@@ -15027,11 +15468,11 @@ var AgUiClient = class {
|
|
|
15027
15468
|
if (cancelled()) {
|
|
15028
15469
|
return;
|
|
15029
15470
|
}
|
|
15030
|
-
|
|
15471
|
+
h2.onError(event.message);
|
|
15031
15472
|
},
|
|
15032
15473
|
onRunFinalized() {
|
|
15033
15474
|
runState.terminal = true;
|
|
15034
|
-
|
|
15475
|
+
h2.onRunEnd();
|
|
15035
15476
|
}
|
|
15036
15477
|
};
|
|
15037
15478
|
}
|
|
@@ -15175,7 +15616,7 @@ var SessionStorageStore = class _SessionStorageStore {
|
|
|
15175
15616
|
}
|
|
15176
15617
|
}
|
|
15177
15618
|
listThreads() {
|
|
15178
|
-
const metas = this.#readThreads().sort((a,
|
|
15619
|
+
const metas = this.#readThreads().sort((a, b) => b.updatedAt - a.updatedAt).map(({ threadId, title, updatedAt, preview }) => ({ threadId, title, updatedAt, preview }));
|
|
15179
15620
|
return Promise.resolve(metas);
|
|
15180
15621
|
}
|
|
15181
15622
|
setActiveThread(threadId) {
|
|
@@ -16625,6 +17066,9 @@ var AgUiChat = class extends HTMLElement {
|
|
|
16625
17066
|
headersFor: (url) => this.#headersFor(url),
|
|
16626
17067
|
requestCredentials: () => this.#requestCredentials(),
|
|
16627
17068
|
appendMessage: (role, content) => this.appendMessage(role, content),
|
|
17069
|
+
// A continuation sends only what the composer holds. The tray is not
|
|
17070
|
+
// read, so nothing rides along to be drawn or announced.
|
|
17071
|
+
announceTurn: (content) => this.#announceTurn(content, []),
|
|
16628
17072
|
autoGrow: () => autoGrow(this.#input),
|
|
16629
17073
|
continuationEnded: () => this.#flushQueued(),
|
|
16630
17074
|
client: () => this.#client,
|
|
@@ -17927,6 +18371,23 @@ var AgUiChat = class extends HTMLElement {
|
|
|
17927
18371
|
if (this.#transcript.isEmpty()) {
|
|
17928
18372
|
this.setAttribute("data-composer-settling", "");
|
|
17929
18373
|
}
|
|
18374
|
+
this.#announceTurn(content, attachments);
|
|
18375
|
+
await this.#client_send(content, attachments);
|
|
18376
|
+
}
|
|
18377
|
+
/**
|
|
18378
|
+
* Put a turn the user sent on screen, and tell the host it was sent.
|
|
18379
|
+
*
|
|
18380
|
+
* The half of a send that does not depend on where it goes, so both senders
|
|
18381
|
+
* take it from here: {@link sendMessage}, and a checkpoint continuation, which
|
|
18382
|
+
* posts to the resume or fork endpoint on a client of its own. The
|
|
18383
|
+
* continuation used to call that client directly, so the turn went out and
|
|
18384
|
+
* its answer streamed in under no question -- while the save it made held the
|
|
18385
|
+
* turn, and a reload showed what the live transcript never had.
|
|
18386
|
+
*
|
|
18387
|
+
* Arming the composer's travel stays with {@link sendMessage}: continuing a
|
|
18388
|
+
* run is a change of context, and docks at once.
|
|
18389
|
+
*/
|
|
18390
|
+
#announceTurn(content, attachments) {
|
|
17930
18391
|
const bubble = this.appendMessage(MESSAGE_ROLE.USER, content);
|
|
17931
18392
|
if (attachments.length > 0) {
|
|
17932
18393
|
bubble.appendChild(renderAttachmentChips(attachments));
|
|
@@ -17938,7 +18399,6 @@ var AgUiChat = class extends HTMLElement {
|
|
|
17938
18399
|
composed: true
|
|
17939
18400
|
})
|
|
17940
18401
|
);
|
|
17941
|
-
await this.#client_send(content, attachments);
|
|
17942
18402
|
}
|
|
17943
18403
|
/**
|
|
17944
18404
|
* Queue a file for upload into the attachment tray, exactly as the file
|
|
@@ -18203,7 +18663,7 @@ function setControlValue(el2, value) {
|
|
|
18203
18663
|
}
|
|
18204
18664
|
|
|
18205
18665
|
// src/version.ts
|
|
18206
|
-
var VERSION = "0.41.
|
|
18666
|
+
var VERSION = "0.41.3";
|
|
18207
18667
|
export {
|
|
18208
18668
|
ATTACHMENT_EVENT,
|
|
18209
18669
|
AgUiChat,
|
|
@@ -18301,6 +18761,7 @@ export {
|
|
|
18301
18761
|
/*! Bundled license information:
|
|
18302
18762
|
|
|
18303
18763
|
dompurify/dist/purify.es.mjs:
|
|
18304
|
-
(*! @license DOMPurify 3.4.
|
|
18764
|
+
(*! @license DOMPurify 3.4.16 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.16/LICENSE *)
|
|
18765
|
+
(*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE *)
|
|
18305
18766
|
*/
|
|
18306
18767
|
//# sourceMappingURL=index.js.map
|