plutonium 0.15.23 → 0.15.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/plutonium.css +1 -1
- data/app/assets/plutonium.js +3524 -261
- data/app/assets/plutonium.js.map +4 -4
- data/app/assets/plutonium.min.js +65 -6
- data/app/assets/plutonium.min.js.map +4 -4
- data/lib/plutonium/ui/display/base.rb +2 -2
- data/lib/plutonium/ui/display/component/{association_field.rb → association.rb} +1 -1
- data/lib/plutonium/ui/display/component/markdown.rb +52 -0
- data/lib/plutonium/ui/form/base.rb +2 -2
- data/lib/plutonium/ui/form/components/{easymde_input.rb → easymde.rb} +1 -1
- data/lib/plutonium/ui/form/components/{flatpickr_input.rb → flatpickr.rb} +1 -1
- data/lib/plutonium/version.rb +1 -1
- data/package-lock.json +18 -8
- data/package.json +2 -1
- data/src/css/easymde.css +105 -28
- data/src/css/slim_select.css +6 -0
- data/src/js/controllers/easymde_controller.js +39 -1
- data/src/js/controllers/flatpickr_controller.js +6 -0
- data/src/js/controllers/slim_select_controller.js +6 -0
- data/tailwind.options.js +35 -33
- metadata +6 -6
- data/lib/plutonium/ui/display/component/markdown_field.rb +0 -33
data/app/assets/plutonium.js
CHANGED
@@ -46,17 +46,17 @@
|
|
46
46
|
var now = function() {
|
47
47
|
return root.Date.now();
|
48
48
|
};
|
49
|
-
function debounce4(func, wait,
|
49
|
+
function debounce4(func, wait, options2) {
|
50
50
|
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
51
51
|
if (typeof func != "function") {
|
52
52
|
throw new TypeError(FUNC_ERROR_TEXT);
|
53
53
|
}
|
54
54
|
wait = toNumber(wait) || 0;
|
55
|
-
if (isObject(
|
56
|
-
leading = !!
|
57
|
-
maxing = "maxWait" in
|
58
|
-
maxWait = maxing ? nativeMax(toNumber(
|
59
|
-
trailing = "trailing" in
|
55
|
+
if (isObject(options2)) {
|
56
|
+
leading = !!options2.leading;
|
57
|
+
maxing = "maxWait" in options2;
|
58
|
+
maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
|
59
|
+
trailing = "trailing" in options2 ? !!options2.trailing : trailing;
|
60
60
|
}
|
61
61
|
function invokeFunc(time) {
|
62
62
|
var args = lastArgs, thisArg = lastThis;
|
@@ -342,7 +342,7 @@
|
|
342
342
|
}
|
343
343
|
}
|
344
344
|
function parseEventOptions(eventOptions) {
|
345
|
-
return eventOptions.split(":").reduce((
|
345
|
+
return eventOptions.split(":").reduce((options2, token) => Object.assign(options2, { [token.replace(/^!/, "")]: !/^!/.test(token) }), {});
|
346
346
|
}
|
347
347
|
function stringifyEventTarget(eventTarget) {
|
348
348
|
if (eventTarget == window) {
|
@@ -3078,15 +3078,15 @@
|
|
3078
3078
|
var Accordion = (
|
3079
3079
|
/** @class */
|
3080
3080
|
function() {
|
3081
|
-
function Accordion2(accordionEl, items,
|
3081
|
+
function Accordion2(accordionEl, items, options2, instanceOptions) {
|
3082
3082
|
if (accordionEl === void 0) {
|
3083
3083
|
accordionEl = null;
|
3084
3084
|
}
|
3085
3085
|
if (items === void 0) {
|
3086
3086
|
items = [];
|
3087
3087
|
}
|
3088
|
-
if (
|
3089
|
-
|
3088
|
+
if (options2 === void 0) {
|
3089
|
+
options2 = Default;
|
3090
3090
|
}
|
3091
3091
|
if (instanceOptions === void 0) {
|
3092
3092
|
instanceOptions = DefaultInstanceOptions;
|
@@ -3094,7 +3094,7 @@
|
|
3094
3094
|
this._instanceId = instanceOptions.id ? instanceOptions.id : accordionEl.id;
|
3095
3095
|
this._accordionEl = accordionEl;
|
3096
3096
|
this._items = items;
|
3097
|
-
this._options = __assign(__assign({}, Default),
|
3097
|
+
this._options = __assign(__assign({}, Default), options2);
|
3098
3098
|
this._initialized = false;
|
3099
3099
|
this.init();
|
3100
3100
|
instances_default.addInstance("Accordion", this, this._instanceId, instanceOptions.override);
|
@@ -3257,15 +3257,15 @@
|
|
3257
3257
|
var Collapse = (
|
3258
3258
|
/** @class */
|
3259
3259
|
function() {
|
3260
|
-
function Collapse2(targetEl, triggerEl,
|
3260
|
+
function Collapse2(targetEl, triggerEl, options2, instanceOptions) {
|
3261
3261
|
if (targetEl === void 0) {
|
3262
3262
|
targetEl = null;
|
3263
3263
|
}
|
3264
3264
|
if (triggerEl === void 0) {
|
3265
3265
|
triggerEl = null;
|
3266
3266
|
}
|
3267
|
-
if (
|
3268
|
-
|
3267
|
+
if (options2 === void 0) {
|
3268
|
+
options2 = Default2;
|
3269
3269
|
}
|
3270
3270
|
if (instanceOptions === void 0) {
|
3271
3271
|
instanceOptions = DefaultInstanceOptions2;
|
@@ -3273,7 +3273,7 @@
|
|
3273
3273
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
3274
3274
|
this._targetEl = targetEl;
|
3275
3275
|
this._triggerEl = triggerEl;
|
3276
|
-
this._options = __assign2(__assign2({}, Default2),
|
3276
|
+
this._options = __assign2(__assign2({}, Default2), options2);
|
3277
3277
|
this._visible = false;
|
3278
3278
|
this._initialized = false;
|
3279
3279
|
this.init();
|
@@ -3401,15 +3401,15 @@
|
|
3401
3401
|
var Carousel = (
|
3402
3402
|
/** @class */
|
3403
3403
|
function() {
|
3404
|
-
function Carousel2(carouselEl, items,
|
3404
|
+
function Carousel2(carouselEl, items, options2, instanceOptions) {
|
3405
3405
|
if (carouselEl === void 0) {
|
3406
3406
|
carouselEl = null;
|
3407
3407
|
}
|
3408
3408
|
if (items === void 0) {
|
3409
3409
|
items = [];
|
3410
3410
|
}
|
3411
|
-
if (
|
3412
|
-
|
3411
|
+
if (options2 === void 0) {
|
3412
|
+
options2 = Default3;
|
3413
3413
|
}
|
3414
3414
|
if (instanceOptions === void 0) {
|
3415
3415
|
instanceOptions = DefaultInstanceOptions3;
|
@@ -3417,7 +3417,7 @@
|
|
3417
3417
|
this._instanceId = instanceOptions.id ? instanceOptions.id : carouselEl.id;
|
3418
3418
|
this._carouselEl = carouselEl;
|
3419
3419
|
this._items = items;
|
3420
|
-
this._options = __assign3(__assign3(__assign3({}, Default3),
|
3420
|
+
this._options = __assign3(__assign3(__assign3({}, Default3), options2), { indicators: __assign3(__assign3({}, Default3.indicators), options2.indicators) });
|
3421
3421
|
this._activeItem = this.getItem(this._options.defaultPosition);
|
3422
3422
|
this._indicators = this._options.indicators.items;
|
3423
3423
|
this._intervalDuration = this._options.interval;
|
@@ -3638,15 +3638,15 @@
|
|
3638
3638
|
var Dismiss = (
|
3639
3639
|
/** @class */
|
3640
3640
|
function() {
|
3641
|
-
function Dismiss2(targetEl, triggerEl,
|
3641
|
+
function Dismiss2(targetEl, triggerEl, options2, instanceOptions) {
|
3642
3642
|
if (targetEl === void 0) {
|
3643
3643
|
targetEl = null;
|
3644
3644
|
}
|
3645
3645
|
if (triggerEl === void 0) {
|
3646
3646
|
triggerEl = null;
|
3647
3647
|
}
|
3648
|
-
if (
|
3649
|
-
|
3648
|
+
if (options2 === void 0) {
|
3649
|
+
options2 = Default4;
|
3650
3650
|
}
|
3651
3651
|
if (instanceOptions === void 0) {
|
3652
3652
|
instanceOptions = DefaultInstanceOptions4;
|
@@ -3654,7 +3654,7 @@
|
|
3654
3654
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
3655
3655
|
this._targetEl = targetEl;
|
3656
3656
|
this._triggerEl = triggerEl;
|
3657
|
-
this._options = __assign4(__assign4({}, Default4),
|
3657
|
+
this._options = __assign4(__assign4({}, Default4), options2);
|
3658
3658
|
this._initialized = false;
|
3659
3659
|
this.init();
|
3660
3660
|
instances_default.addInstance("Dismiss", this, this._instanceId, instanceOptions.override);
|
@@ -4063,7 +4063,7 @@
|
|
4063
4063
|
};
|
4064
4064
|
function arrow(_ref) {
|
4065
4065
|
var _state$modifiersData$;
|
4066
|
-
var state = _ref.state, name = _ref.name,
|
4066
|
+
var state = _ref.state, name = _ref.name, options2 = _ref.options;
|
4067
4067
|
var arrowElement = state.elements.arrow;
|
4068
4068
|
var popperOffsets2 = state.modifiersData.popperOffsets;
|
4069
4069
|
var basePlacement = getBasePlacement(state.placement);
|
@@ -4073,7 +4073,7 @@
|
|
4073
4073
|
if (!arrowElement || !popperOffsets2) {
|
4074
4074
|
return;
|
4075
4075
|
}
|
4076
|
-
var paddingObject = toPaddingObject(
|
4076
|
+
var paddingObject = toPaddingObject(options2.padding, state);
|
4077
4077
|
var arrowRect = getLayoutRect(arrowElement);
|
4078
4078
|
var minProp = axis === "y" ? top : left;
|
4079
4079
|
var maxProp = axis === "y" ? bottom : right;
|
@@ -4090,8 +4090,8 @@
|
|
4090
4090
|
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
|
4091
4091
|
}
|
4092
4092
|
function effect2(_ref2) {
|
4093
|
-
var state = _ref2.state,
|
4094
|
-
var _options$element =
|
4093
|
+
var state = _ref2.state, options2 = _ref2.options;
|
4094
|
+
var _options$element = options2.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
|
4095
4095
|
if (arrowElement == null) {
|
4096
4096
|
return;
|
4097
4097
|
}
|
@@ -4204,8 +4204,8 @@
|
|
4204
4204
|
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
4205
4205
|
}
|
4206
4206
|
function computeStyles(_ref5) {
|
4207
|
-
var state = _ref5.state,
|
4208
|
-
var _options$gpuAccelerat =
|
4207
|
+
var state = _ref5.state, options2 = _ref5.options;
|
4208
|
+
var _options$gpuAccelerat = options2.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options2.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options2.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
4209
4209
|
var commonStyles = {
|
4210
4210
|
placement: getBasePlacement(state.placement),
|
4211
4211
|
variation: getVariation(state.placement),
|
@@ -4247,8 +4247,8 @@
|
|
4247
4247
|
passive: true
|
4248
4248
|
};
|
4249
4249
|
function effect3(_ref) {
|
4250
|
-
var state = _ref.state, instance = _ref.instance,
|
4251
|
-
var _options$scroll =
|
4250
|
+
var state = _ref.state, instance = _ref.instance, options2 = _ref.options;
|
4251
|
+
var _options$scroll = options2.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options2.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
4252
4252
|
var window2 = getWindow(state.elements.popper);
|
4253
4253
|
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
4254
4254
|
if (scroll) {
|
@@ -4323,10 +4323,10 @@
|
|
4323
4323
|
// node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js
|
4324
4324
|
function getViewportRect(element, strategy) {
|
4325
4325
|
var win = getWindow(element);
|
4326
|
-
var
|
4326
|
+
var html3 = getDocumentElement(element);
|
4327
4327
|
var visualViewport = win.visualViewport;
|
4328
|
-
var width =
|
4329
|
-
var height =
|
4328
|
+
var width = html3.clientWidth;
|
4329
|
+
var height = html3.clientHeight;
|
4330
4330
|
var x = 0;
|
4331
4331
|
var y = 0;
|
4332
4332
|
if (visualViewport) {
|
@@ -4349,15 +4349,15 @@
|
|
4349
4349
|
// node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js
|
4350
4350
|
function getDocumentRect(element) {
|
4351
4351
|
var _element$ownerDocumen;
|
4352
|
-
var
|
4352
|
+
var html3 = getDocumentElement(element);
|
4353
4353
|
var winScroll = getWindowScroll(element);
|
4354
4354
|
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
4355
|
-
var width = max(
|
4356
|
-
var height = max(
|
4355
|
+
var width = max(html3.scrollWidth, html3.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
4356
|
+
var height = max(html3.scrollHeight, html3.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
4357
4357
|
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
4358
4358
|
var y = -winScroll.scrollTop;
|
4359
|
-
if (getComputedStyle(body ||
|
4360
|
-
x += max(
|
4359
|
+
if (getComputedStyle(body || html3).direction === "rtl") {
|
4360
|
+
x += max(html3.clientWidth, body ? body.clientWidth : 0) - width;
|
4361
4361
|
}
|
4362
4362
|
return {
|
4363
4363
|
width,
|
@@ -4385,16 +4385,16 @@
|
|
4385
4385
|
}
|
4386
4386
|
|
4387
4387
|
// node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js
|
4388
|
-
function listScrollParents(element,
|
4388
|
+
function listScrollParents(element, list2) {
|
4389
4389
|
var _element$ownerDocumen;
|
4390
|
-
if (
|
4391
|
-
|
4390
|
+
if (list2 === void 0) {
|
4391
|
+
list2 = [];
|
4392
4392
|
}
|
4393
4393
|
var scrollParent = getScrollParent(element);
|
4394
4394
|
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
4395
4395
|
var win = getWindow(scrollParent);
|
4396
4396
|
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
4397
|
-
var updatedList =
|
4397
|
+
var updatedList = list2.concat(target);
|
4398
4398
|
return isBody ? updatedList : (
|
4399
4399
|
// $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
4400
4400
|
updatedList.concat(listScrollParents(getParentNode(target)))
|
@@ -4513,11 +4513,11 @@
|
|
4513
4513
|
}
|
4514
4514
|
|
4515
4515
|
// node_modules/@popperjs/core/lib/utils/detectOverflow.js
|
4516
|
-
function detectOverflow(state,
|
4517
|
-
if (
|
4518
|
-
|
4516
|
+
function detectOverflow(state, options2) {
|
4517
|
+
if (options2 === void 0) {
|
4518
|
+
options2 = {};
|
4519
4519
|
}
|
4520
|
-
var _options =
|
4520
|
+
var _options = options2, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$strategy = _options.strategy, strategy = _options$strategy === void 0 ? state.strategy : _options$strategy, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
|
4521
4521
|
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
4522
4522
|
var altContext = elementContext === popper ? reference : popper;
|
4523
4523
|
var popperRect = state.rects.popper;
|
@@ -4551,11 +4551,11 @@
|
|
4551
4551
|
}
|
4552
4552
|
|
4553
4553
|
// node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js
|
4554
|
-
function computeAutoPlacement(state,
|
4555
|
-
if (
|
4556
|
-
|
4554
|
+
function computeAutoPlacement(state, options2) {
|
4555
|
+
if (options2 === void 0) {
|
4556
|
+
options2 = {};
|
4557
4557
|
}
|
4558
|
-
var _options =
|
4558
|
+
var _options = options2, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
4559
4559
|
var variation = getVariation(placement);
|
4560
4560
|
var placements2 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
|
4561
4561
|
return getVariation(placement2) === variation;
|
@@ -4589,11 +4589,11 @@
|
|
4589
4589
|
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
4590
4590
|
}
|
4591
4591
|
function flip(_ref) {
|
4592
|
-
var state = _ref.state,
|
4592
|
+
var state = _ref.state, options2 = _ref.options, name = _ref.name;
|
4593
4593
|
if (state.modifiersData[name]._skip) {
|
4594
4594
|
return;
|
4595
4595
|
}
|
4596
|
-
var _options$mainAxis =
|
4596
|
+
var _options$mainAxis = options2.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options2.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options2.fallbackPlacements, padding = options2.padding, boundary = options2.boundary, rootBoundary = options2.rootBoundary, altBoundary = options2.altBoundary, _options$flipVariatio = options2.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options2.allowedAutoPlacements;
|
4597
4597
|
var preferredPlacement = state.options.placement;
|
4598
4598
|
var basePlacement = getBasePlacement(preferredPlacement);
|
4599
4599
|
var isBasePlacement = basePlacement === preferredPlacement;
|
@@ -4758,8 +4758,8 @@
|
|
4758
4758
|
};
|
4759
4759
|
}
|
4760
4760
|
function offset(_ref2) {
|
4761
|
-
var state = _ref2.state,
|
4762
|
-
var _options$offset =
|
4761
|
+
var state = _ref2.state, options2 = _ref2.options, name = _ref2.name;
|
4762
|
+
var _options$offset = options2.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
4763
4763
|
var data = placements.reduce(function(acc, placement) {
|
4764
4764
|
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
4765
4765
|
return acc;
|
@@ -4804,8 +4804,8 @@
|
|
4804
4804
|
|
4805
4805
|
// node_modules/@popperjs/core/lib/modifiers/preventOverflow.js
|
4806
4806
|
function preventOverflow(_ref) {
|
4807
|
-
var state = _ref.state,
|
4808
|
-
var _options$mainAxis =
|
4807
|
+
var state = _ref.state, options2 = _ref.options, name = _ref.name;
|
4808
|
+
var _options$mainAxis = options2.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options2.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options2.boundary, rootBoundary = options2.rootBoundary, altBoundary = options2.altBoundary, padding = options2.padding, _options$tether = options2.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options2.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
4809
4809
|
var overflow = detectOverflow(state, {
|
4810
4810
|
boundary,
|
4811
4811
|
rootBoundary,
|
@@ -5043,9 +5043,9 @@
|
|
5043
5043
|
generatorOptions = {};
|
5044
5044
|
}
|
5045
5045
|
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
5046
|
-
return function createPopper2(reference2, popper2,
|
5047
|
-
if (
|
5048
|
-
|
5046
|
+
return function createPopper2(reference2, popper2, options2) {
|
5047
|
+
if (options2 === void 0) {
|
5048
|
+
options2 = defaultOptions2;
|
5049
5049
|
}
|
5050
5050
|
var state = {
|
5051
5051
|
placement: "bottom",
|
@@ -5063,10 +5063,10 @@
|
|
5063
5063
|
var isDestroyed = false;
|
5064
5064
|
var instance = {
|
5065
5065
|
state,
|
5066
|
-
setOptions: function
|
5067
|
-
var
|
5066
|
+
setOptions: function setOptions2(setOptionsAction) {
|
5067
|
+
var options3 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
|
5068
5068
|
cleanupModifierEffects();
|
5069
|
-
state.options = Object.assign({}, defaultOptions2, state.options,
|
5069
|
+
state.options = Object.assign({}, defaultOptions2, state.options, options3);
|
5070
5070
|
state.scrollParents = {
|
5071
5071
|
reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
|
5072
5072
|
popper: listScrollParents(popper2)
|
@@ -5133,20 +5133,20 @@
|
|
5133
5133
|
if (!areValidElements(reference2, popper2)) {
|
5134
5134
|
return instance;
|
5135
5135
|
}
|
5136
|
-
instance.setOptions(
|
5137
|
-
if (!isDestroyed &&
|
5138
|
-
|
5136
|
+
instance.setOptions(options2).then(function(state2) {
|
5137
|
+
if (!isDestroyed && options2.onFirstUpdate) {
|
5138
|
+
options2.onFirstUpdate(state2);
|
5139
5139
|
}
|
5140
5140
|
});
|
5141
5141
|
function runModifierEffects() {
|
5142
5142
|
state.orderedModifiers.forEach(function(_ref) {
|
5143
|
-
var name = _ref.name, _ref$options = _ref.options,
|
5143
|
+
var name = _ref.name, _ref$options = _ref.options, options3 = _ref$options === void 0 ? {} : _ref$options, effect4 = _ref.effect;
|
5144
5144
|
if (typeof effect4 === "function") {
|
5145
5145
|
var cleanupFn = effect4({
|
5146
5146
|
state,
|
5147
5147
|
name,
|
5148
5148
|
instance,
|
5149
|
-
options:
|
5149
|
+
options: options3
|
5150
5150
|
});
|
5151
5151
|
var noopFn = function noopFn2() {
|
5152
5152
|
};
|
@@ -5215,15 +5215,15 @@
|
|
5215
5215
|
var Dropdown = (
|
5216
5216
|
/** @class */
|
5217
5217
|
function() {
|
5218
|
-
function Dropdown2(targetElement, triggerElement,
|
5218
|
+
function Dropdown2(targetElement, triggerElement, options2, instanceOptions) {
|
5219
5219
|
if (targetElement === void 0) {
|
5220
5220
|
targetElement = null;
|
5221
5221
|
}
|
5222
5222
|
if (triggerElement === void 0) {
|
5223
5223
|
triggerElement = null;
|
5224
5224
|
}
|
5225
|
-
if (
|
5226
|
-
|
5225
|
+
if (options2 === void 0) {
|
5226
|
+
options2 = Default5;
|
5227
5227
|
}
|
5228
5228
|
if (instanceOptions === void 0) {
|
5229
5229
|
instanceOptions = DefaultInstanceOptions5;
|
@@ -5231,7 +5231,7 @@
|
|
5231
5231
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetElement.id;
|
5232
5232
|
this._targetEl = targetElement;
|
5233
5233
|
this._triggerEl = triggerElement;
|
5234
|
-
this._options = __assign5(__assign5({}, Default5),
|
5234
|
+
this._options = __assign5(__assign5({}, Default5), options2);
|
5235
5235
|
this._popperInstance = null;
|
5236
5236
|
this._visible = false;
|
5237
5237
|
this._initialized = false;
|
@@ -5395,8 +5395,8 @@
|
|
5395
5395
|
Dropdown2.prototype.show = function() {
|
5396
5396
|
this._targetEl.classList.remove("hidden");
|
5397
5397
|
this._targetEl.classList.add("block");
|
5398
|
-
this._popperInstance.setOptions(function(
|
5399
|
-
return __assign5(__assign5({},
|
5398
|
+
this._popperInstance.setOptions(function(options2) {
|
5399
|
+
return __assign5(__assign5({}, options2), { modifiers: __spreadArray(__spreadArray([], options2.modifiers, true), [
|
5400
5400
|
{ name: "eventListeners", enabled: true }
|
5401
5401
|
], false) });
|
5402
5402
|
});
|
@@ -5408,8 +5408,8 @@
|
|
5408
5408
|
Dropdown2.prototype.hide = function() {
|
5409
5409
|
this._targetEl.classList.remove("block");
|
5410
5410
|
this._targetEl.classList.add("hidden");
|
5411
|
-
this._popperInstance.setOptions(function(
|
5412
|
-
return __assign5(__assign5({},
|
5411
|
+
this._popperInstance.setOptions(function(options2) {
|
5412
|
+
return __assign5(__assign5({}, options2), { modifiers: __spreadArray(__spreadArray([], options2.modifiers, true), [
|
5413
5413
|
{ name: "eventListeners", enabled: false }
|
5414
5414
|
], false) });
|
5415
5415
|
});
|
@@ -5491,12 +5491,12 @@
|
|
5491
5491
|
var Modal = (
|
5492
5492
|
/** @class */
|
5493
5493
|
function() {
|
5494
|
-
function Modal2(targetEl,
|
5494
|
+
function Modal2(targetEl, options2, instanceOptions) {
|
5495
5495
|
if (targetEl === void 0) {
|
5496
5496
|
targetEl = null;
|
5497
5497
|
}
|
5498
|
-
if (
|
5499
|
-
|
5498
|
+
if (options2 === void 0) {
|
5499
|
+
options2 = Default6;
|
5500
5500
|
}
|
5501
5501
|
if (instanceOptions === void 0) {
|
5502
5502
|
instanceOptions = DefaultInstanceOptions6;
|
@@ -5504,7 +5504,7 @@
|
|
5504
5504
|
this._eventListenerInstances = [];
|
5505
5505
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
5506
5506
|
this._targetEl = targetEl;
|
5507
|
-
this._options = __assign6(__assign6({}, Default6),
|
5507
|
+
this._options = __assign6(__assign6({}, Default6), options2);
|
5508
5508
|
this._isHidden = true;
|
5509
5509
|
this._backdropEl = null;
|
5510
5510
|
this._initialized = false;
|
@@ -5782,12 +5782,12 @@
|
|
5782
5782
|
var Drawer = (
|
5783
5783
|
/** @class */
|
5784
5784
|
function() {
|
5785
|
-
function Drawer2(targetEl,
|
5785
|
+
function Drawer2(targetEl, options2, instanceOptions) {
|
5786
5786
|
if (targetEl === void 0) {
|
5787
5787
|
targetEl = null;
|
5788
5788
|
}
|
5789
|
-
if (
|
5790
|
-
|
5789
|
+
if (options2 === void 0) {
|
5790
|
+
options2 = Default7;
|
5791
5791
|
}
|
5792
5792
|
if (instanceOptions === void 0) {
|
5793
5793
|
instanceOptions = DefaultInstanceOptions7;
|
@@ -5795,7 +5795,7 @@
|
|
5795
5795
|
this._eventListenerInstances = [];
|
5796
5796
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
5797
5797
|
this._targetEl = targetEl;
|
5798
|
-
this._options = __assign7(__assign7({}, Default7),
|
5798
|
+
this._options = __assign7(__assign7({}, Default7), options2);
|
5799
5799
|
this._visible = false;
|
5800
5800
|
this._initialized = false;
|
5801
5801
|
this.init();
|
@@ -6100,15 +6100,15 @@
|
|
6100
6100
|
var Tabs = (
|
6101
6101
|
/** @class */
|
6102
6102
|
function() {
|
6103
|
-
function Tabs2(tabsEl, items,
|
6103
|
+
function Tabs2(tabsEl, items, options2, instanceOptions) {
|
6104
6104
|
if (tabsEl === void 0) {
|
6105
6105
|
tabsEl = null;
|
6106
6106
|
}
|
6107
6107
|
if (items === void 0) {
|
6108
6108
|
items = [];
|
6109
6109
|
}
|
6110
|
-
if (
|
6111
|
-
|
6110
|
+
if (options2 === void 0) {
|
6111
|
+
options2 = Default8;
|
6112
6112
|
}
|
6113
6113
|
if (instanceOptions === void 0) {
|
6114
6114
|
instanceOptions = DefaultInstanceOptions8;
|
@@ -6116,8 +6116,8 @@
|
|
6116
6116
|
this._instanceId = instanceOptions.id ? instanceOptions.id : tabsEl.id;
|
6117
6117
|
this._tabsEl = tabsEl;
|
6118
6118
|
this._items = items;
|
6119
|
-
this._activeTab =
|
6120
|
-
this._options = __assign8(__assign8({}, Default8),
|
6119
|
+
this._activeTab = options2 ? this.getTab(options2.defaultTabId) : null;
|
6120
|
+
this._options = __assign8(__assign8({}, Default8), options2);
|
6121
6121
|
this._initialized = false;
|
6122
6122
|
this.init();
|
6123
6123
|
instances_default.addInstance("Tabs", this, this._tabsEl.id, true);
|
@@ -6265,15 +6265,15 @@
|
|
6265
6265
|
var Tooltip = (
|
6266
6266
|
/** @class */
|
6267
6267
|
function() {
|
6268
|
-
function Tooltip2(targetEl, triggerEl,
|
6268
|
+
function Tooltip2(targetEl, triggerEl, options2, instanceOptions) {
|
6269
6269
|
if (targetEl === void 0) {
|
6270
6270
|
targetEl = null;
|
6271
6271
|
}
|
6272
6272
|
if (triggerEl === void 0) {
|
6273
6273
|
triggerEl = null;
|
6274
6274
|
}
|
6275
|
-
if (
|
6276
|
-
|
6275
|
+
if (options2 === void 0) {
|
6276
|
+
options2 = Default9;
|
6277
6277
|
}
|
6278
6278
|
if (instanceOptions === void 0) {
|
6279
6279
|
instanceOptions = DefaultInstanceOptions9;
|
@@ -6281,7 +6281,7 @@
|
|
6281
6281
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
6282
6282
|
this._targetEl = targetEl;
|
6283
6283
|
this._triggerEl = triggerEl;
|
6284
|
-
this._options = __assign9(__assign9({}, Default9),
|
6284
|
+
this._options = __assign9(__assign9({}, Default9), options2);
|
6285
6285
|
this._popperInstance = null;
|
6286
6286
|
this._visible = false;
|
6287
6287
|
this._initialized = false;
|
@@ -6414,8 +6414,8 @@
|
|
6414
6414
|
Tooltip2.prototype.show = function() {
|
6415
6415
|
this._targetEl.classList.remove("opacity-0", "invisible");
|
6416
6416
|
this._targetEl.classList.add("opacity-100", "visible");
|
6417
|
-
this._popperInstance.setOptions(function(
|
6418
|
-
return __assign9(__assign9({},
|
6417
|
+
this._popperInstance.setOptions(function(options2) {
|
6418
|
+
return __assign9(__assign9({}, options2), { modifiers: __spreadArray2(__spreadArray2([], options2.modifiers, true), [
|
6419
6419
|
{ name: "eventListeners", enabled: true }
|
6420
6420
|
], false) });
|
6421
6421
|
});
|
@@ -6428,8 +6428,8 @@
|
|
6428
6428
|
Tooltip2.prototype.hide = function() {
|
6429
6429
|
this._targetEl.classList.remove("opacity-100", "visible");
|
6430
6430
|
this._targetEl.classList.add("opacity-0", "invisible");
|
6431
|
-
this._popperInstance.setOptions(function(
|
6432
|
-
return __assign9(__assign9({},
|
6431
|
+
this._popperInstance.setOptions(function(options2) {
|
6432
|
+
return __assign9(__assign9({}, options2), { modifiers: __spreadArray2(__spreadArray2([], options2.modifiers, true), [
|
6433
6433
|
{ name: "eventListeners", enabled: false }
|
6434
6434
|
], false) });
|
6435
6435
|
});
|
@@ -6513,15 +6513,15 @@
|
|
6513
6513
|
var Popover = (
|
6514
6514
|
/** @class */
|
6515
6515
|
function() {
|
6516
|
-
function Popover2(targetEl, triggerEl,
|
6516
|
+
function Popover2(targetEl, triggerEl, options2, instanceOptions) {
|
6517
6517
|
if (targetEl === void 0) {
|
6518
6518
|
targetEl = null;
|
6519
6519
|
}
|
6520
6520
|
if (triggerEl === void 0) {
|
6521
6521
|
triggerEl = null;
|
6522
6522
|
}
|
6523
|
-
if (
|
6524
|
-
|
6523
|
+
if (options2 === void 0) {
|
6524
|
+
options2 = Default10;
|
6525
6525
|
}
|
6526
6526
|
if (instanceOptions === void 0) {
|
6527
6527
|
instanceOptions = DefaultInstanceOptions10;
|
@@ -6529,7 +6529,7 @@
|
|
6529
6529
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
6530
6530
|
this._targetEl = targetEl;
|
6531
6531
|
this._triggerEl = triggerEl;
|
6532
|
-
this._options = __assign10(__assign10({}, Default10),
|
6532
|
+
this._options = __assign10(__assign10({}, Default10), options2);
|
6533
6533
|
this._popperInstance = null;
|
6534
6534
|
this._visible = false;
|
6535
6535
|
this._initialized = false;
|
@@ -6671,8 +6671,8 @@
|
|
6671
6671
|
Popover2.prototype.show = function() {
|
6672
6672
|
this._targetEl.classList.remove("opacity-0", "invisible");
|
6673
6673
|
this._targetEl.classList.add("opacity-100", "visible");
|
6674
|
-
this._popperInstance.setOptions(function(
|
6675
|
-
return __assign10(__assign10({},
|
6674
|
+
this._popperInstance.setOptions(function(options2) {
|
6675
|
+
return __assign10(__assign10({}, options2), { modifiers: __spreadArray3(__spreadArray3([], options2.modifiers, true), [
|
6676
6676
|
{ name: "eventListeners", enabled: true }
|
6677
6677
|
], false) });
|
6678
6678
|
});
|
@@ -6685,8 +6685,8 @@
|
|
6685
6685
|
Popover2.prototype.hide = function() {
|
6686
6686
|
this._targetEl.classList.remove("opacity-100", "visible");
|
6687
6687
|
this._targetEl.classList.add("opacity-0", "invisible");
|
6688
|
-
this._popperInstance.setOptions(function(
|
6689
|
-
return __assign10(__assign10({},
|
6688
|
+
this._popperInstance.setOptions(function(options2) {
|
6689
|
+
return __assign10(__assign10({}, options2), { modifiers: __spreadArray3(__spreadArray3([], options2.modifiers, true), [
|
6690
6690
|
{ name: "eventListeners", enabled: false }
|
6691
6691
|
], false) });
|
6692
6692
|
});
|
@@ -6759,7 +6759,7 @@
|
|
6759
6759
|
var Dial = (
|
6760
6760
|
/** @class */
|
6761
6761
|
function() {
|
6762
|
-
function Dial2(parentEl, triggerEl, targetEl,
|
6762
|
+
function Dial2(parentEl, triggerEl, targetEl, options2, instanceOptions) {
|
6763
6763
|
if (parentEl === void 0) {
|
6764
6764
|
parentEl = null;
|
6765
6765
|
}
|
@@ -6769,8 +6769,8 @@
|
|
6769
6769
|
if (targetEl === void 0) {
|
6770
6770
|
targetEl = null;
|
6771
6771
|
}
|
6772
|
-
if (
|
6773
|
-
|
6772
|
+
if (options2 === void 0) {
|
6773
|
+
options2 = Default11;
|
6774
6774
|
}
|
6775
6775
|
if (instanceOptions === void 0) {
|
6776
6776
|
instanceOptions = DefaultInstanceOptions11;
|
@@ -6779,7 +6779,7 @@
|
|
6779
6779
|
this._parentEl = parentEl;
|
6780
6780
|
this._triggerEl = triggerEl;
|
6781
6781
|
this._targetEl = targetEl;
|
6782
|
-
this._options = __assign11(__assign11({}, Default11),
|
6782
|
+
this._options = __assign11(__assign11({}, Default11), options2);
|
6783
6783
|
this._visible = false;
|
6784
6784
|
this._initialized = false;
|
6785
6785
|
this.init();
|
@@ -6945,7 +6945,7 @@
|
|
6945
6945
|
var InputCounter = (
|
6946
6946
|
/** @class */
|
6947
6947
|
function() {
|
6948
|
-
function InputCounter2(targetEl, incrementEl, decrementEl,
|
6948
|
+
function InputCounter2(targetEl, incrementEl, decrementEl, options2, instanceOptions) {
|
6949
6949
|
if (targetEl === void 0) {
|
6950
6950
|
targetEl = null;
|
6951
6951
|
}
|
@@ -6955,8 +6955,8 @@
|
|
6955
6955
|
if (decrementEl === void 0) {
|
6956
6956
|
decrementEl = null;
|
6957
6957
|
}
|
6958
|
-
if (
|
6959
|
-
|
6958
|
+
if (options2 === void 0) {
|
6959
|
+
options2 = Default12;
|
6960
6960
|
}
|
6961
6961
|
if (instanceOptions === void 0) {
|
6962
6962
|
instanceOptions = DefaultInstanceOptions12;
|
@@ -6965,7 +6965,7 @@
|
|
6965
6965
|
this._targetEl = targetEl;
|
6966
6966
|
this._incrementEl = incrementEl;
|
6967
6967
|
this._decrementEl = decrementEl;
|
6968
|
-
this._options = __assign12(__assign12({}, Default12),
|
6968
|
+
this._options = __assign12(__assign12({}, Default12), options2);
|
6969
6969
|
this._initialized = false;
|
6970
6970
|
this.init();
|
6971
6971
|
instances_default.addInstance("InputCounter", this, this._instanceId, instanceOptions.override);
|
@@ -7098,15 +7098,15 @@
|
|
7098
7098
|
var CopyClipboard = (
|
7099
7099
|
/** @class */
|
7100
7100
|
function() {
|
7101
|
-
function CopyClipboard2(triggerEl, targetEl,
|
7101
|
+
function CopyClipboard2(triggerEl, targetEl, options2, instanceOptions) {
|
7102
7102
|
if (triggerEl === void 0) {
|
7103
7103
|
triggerEl = null;
|
7104
7104
|
}
|
7105
7105
|
if (targetEl === void 0) {
|
7106
7106
|
targetEl = null;
|
7107
7107
|
}
|
7108
|
-
if (
|
7109
|
-
|
7108
|
+
if (options2 === void 0) {
|
7109
|
+
options2 = Default13;
|
7110
7110
|
}
|
7111
7111
|
if (instanceOptions === void 0) {
|
7112
7112
|
instanceOptions = DefaultInstanceOptions13;
|
@@ -7114,7 +7114,7 @@
|
|
7114
7114
|
this._instanceId = instanceOptions.id ? instanceOptions.id : targetEl.id;
|
7115
7115
|
this._triggerEl = triggerEl;
|
7116
7116
|
this._targetEl = targetEl;
|
7117
|
-
this._options = __assign13(__assign13({}, Default13),
|
7117
|
+
this._options = __assign13(__assign13({}, Default13), options2);
|
7118
7118
|
this._initialized = false;
|
7119
7119
|
this.init();
|
7120
7120
|
instances_default.addInstance("CopyClipboard", this, this._instanceId, instanceOptions.override);
|
@@ -7171,9 +7171,9 @@
|
|
7171
7171
|
this._options.onCopy(this);
|
7172
7172
|
return textToCopy;
|
7173
7173
|
};
|
7174
|
-
CopyClipboard2.prototype.decodeHTML = function(
|
7174
|
+
CopyClipboard2.prototype.decodeHTML = function(html3) {
|
7175
7175
|
var textarea = document.createElement("textarea");
|
7176
|
-
textarea.innerHTML =
|
7176
|
+
textarea.innerHTML = html3;
|
7177
7177
|
return textarea.textContent;
|
7178
7178
|
};
|
7179
7179
|
CopyClipboard2.prototype.updateOnCopyCallback = function(callback) {
|
@@ -7432,16 +7432,3266 @@
|
|
7432
7432
|
}
|
7433
7433
|
};
|
7434
7434
|
|
7435
|
+
// node_modules/dompurify/dist/purify.es.mjs
|
7436
|
+
var {
|
7437
|
+
entries,
|
7438
|
+
setPrototypeOf,
|
7439
|
+
isFrozen,
|
7440
|
+
getPrototypeOf,
|
7441
|
+
getOwnPropertyDescriptor
|
7442
|
+
} = Object;
|
7443
|
+
var {
|
7444
|
+
freeze,
|
7445
|
+
seal,
|
7446
|
+
create
|
7447
|
+
} = Object;
|
7448
|
+
var {
|
7449
|
+
apply,
|
7450
|
+
construct
|
7451
|
+
} = typeof Reflect !== "undefined" && Reflect;
|
7452
|
+
if (!freeze) {
|
7453
|
+
freeze = function freeze2(x) {
|
7454
|
+
return x;
|
7455
|
+
};
|
7456
|
+
}
|
7457
|
+
if (!seal) {
|
7458
|
+
seal = function seal2(x) {
|
7459
|
+
return x;
|
7460
|
+
};
|
7461
|
+
}
|
7462
|
+
if (!apply) {
|
7463
|
+
apply = function apply2(fun, thisValue, args) {
|
7464
|
+
return fun.apply(thisValue, args);
|
7465
|
+
};
|
7466
|
+
}
|
7467
|
+
if (!construct) {
|
7468
|
+
construct = function construct2(Func, args) {
|
7469
|
+
return new Func(...args);
|
7470
|
+
};
|
7471
|
+
}
|
7472
|
+
var arrayForEach = unapply(Array.prototype.forEach);
|
7473
|
+
var arrayPop = unapply(Array.prototype.pop);
|
7474
|
+
var arrayPush = unapply(Array.prototype.push);
|
7475
|
+
var stringToLowerCase = unapply(String.prototype.toLowerCase);
|
7476
|
+
var stringToString = unapply(String.prototype.toString);
|
7477
|
+
var stringMatch = unapply(String.prototype.match);
|
7478
|
+
var stringReplace = unapply(String.prototype.replace);
|
7479
|
+
var stringIndexOf = unapply(String.prototype.indexOf);
|
7480
|
+
var stringTrim = unapply(String.prototype.trim);
|
7481
|
+
var objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
7482
|
+
var regExpTest = unapply(RegExp.prototype.test);
|
7483
|
+
var typeErrorCreate = unconstruct(TypeError);
|
7484
|
+
function unapply(func) {
|
7485
|
+
return function(thisArg) {
|
7486
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
7487
|
+
args[_key - 1] = arguments[_key];
|
7488
|
+
}
|
7489
|
+
return apply(func, thisArg, args);
|
7490
|
+
};
|
7491
|
+
}
|
7492
|
+
function unconstruct(func) {
|
7493
|
+
return function() {
|
7494
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
7495
|
+
args[_key2] = arguments[_key2];
|
7496
|
+
}
|
7497
|
+
return construct(func, args);
|
7498
|
+
};
|
7499
|
+
}
|
7500
|
+
function addToSet(set, array) {
|
7501
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : stringToLowerCase;
|
7502
|
+
if (setPrototypeOf) {
|
7503
|
+
setPrototypeOf(set, null);
|
7504
|
+
}
|
7505
|
+
let l = array.length;
|
7506
|
+
while (l--) {
|
7507
|
+
let element = array[l];
|
7508
|
+
if (typeof element === "string") {
|
7509
|
+
const lcElement = transformCaseFunc(element);
|
7510
|
+
if (lcElement !== element) {
|
7511
|
+
if (!isFrozen(array)) {
|
7512
|
+
array[l] = lcElement;
|
7513
|
+
}
|
7514
|
+
element = lcElement;
|
7515
|
+
}
|
7516
|
+
}
|
7517
|
+
set[element] = true;
|
7518
|
+
}
|
7519
|
+
return set;
|
7520
|
+
}
|
7521
|
+
function cleanArray(array) {
|
7522
|
+
for (let index = 0; index < array.length; index++) {
|
7523
|
+
const isPropertyExist = objectHasOwnProperty(array, index);
|
7524
|
+
if (!isPropertyExist) {
|
7525
|
+
array[index] = null;
|
7526
|
+
}
|
7527
|
+
}
|
7528
|
+
return array;
|
7529
|
+
}
|
7530
|
+
function clone(object) {
|
7531
|
+
const newObject = create(null);
|
7532
|
+
for (const [property, value] of entries(object)) {
|
7533
|
+
const isPropertyExist = objectHasOwnProperty(object, property);
|
7534
|
+
if (isPropertyExist) {
|
7535
|
+
if (Array.isArray(value)) {
|
7536
|
+
newObject[property] = cleanArray(value);
|
7537
|
+
} else if (value && typeof value === "object" && value.constructor === Object) {
|
7538
|
+
newObject[property] = clone(value);
|
7539
|
+
} else {
|
7540
|
+
newObject[property] = value;
|
7541
|
+
}
|
7542
|
+
}
|
7543
|
+
}
|
7544
|
+
return newObject;
|
7545
|
+
}
|
7546
|
+
function lookupGetter(object, prop) {
|
7547
|
+
while (object !== null) {
|
7548
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
7549
|
+
if (desc) {
|
7550
|
+
if (desc.get) {
|
7551
|
+
return unapply(desc.get);
|
7552
|
+
}
|
7553
|
+
if (typeof desc.value === "function") {
|
7554
|
+
return unapply(desc.value);
|
7555
|
+
}
|
7556
|
+
}
|
7557
|
+
object = getPrototypeOf(object);
|
7558
|
+
}
|
7559
|
+
function fallbackValue() {
|
7560
|
+
return null;
|
7561
|
+
}
|
7562
|
+
return fallbackValue;
|
7563
|
+
}
|
7564
|
+
var html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]);
|
7565
|
+
var svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]);
|
7566
|
+
var svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feDropShadow", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]);
|
7567
|
+
var svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]);
|
7568
|
+
var mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "mprescripts"]);
|
7569
|
+
var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]);
|
7570
|
+
var text = freeze(["#text"]);
|
7571
|
+
var html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "popover", "popovertarget", "popovertargetaction", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "wrap", "xmlns", "slot"]);
|
7572
|
+
var svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "amplitude", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "exponent", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "intercept", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "slope", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "tablevalues", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]);
|
7573
|
+
var mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]);
|
7574
|
+
var xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]);
|
7575
|
+
var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm);
|
7576
|
+
var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
7577
|
+
var TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
|
7578
|
+
var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/);
|
7579
|
+
var ARIA_ATTR = seal(/^aria-[\-\w]+$/);
|
7580
|
+
var IS_ALLOWED_URI = seal(
|
7581
|
+
/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i
|
7582
|
+
// eslint-disable-line no-useless-escape
|
7583
|
+
);
|
7584
|
+
var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
7585
|
+
var ATTR_WHITESPACE = seal(
|
7586
|
+
/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g
|
7587
|
+
// eslint-disable-line no-control-regex
|
7588
|
+
);
|
7589
|
+
var DOCTYPE_NAME = seal(/^html$/i);
|
7590
|
+
var CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
7591
|
+
var EXPRESSIONS = /* @__PURE__ */ Object.freeze({
|
7592
|
+
__proto__: null,
|
7593
|
+
ARIA_ATTR,
|
7594
|
+
ATTR_WHITESPACE,
|
7595
|
+
CUSTOM_ELEMENT,
|
7596
|
+
DATA_ATTR,
|
7597
|
+
DOCTYPE_NAME,
|
7598
|
+
ERB_EXPR,
|
7599
|
+
IS_ALLOWED_URI,
|
7600
|
+
IS_SCRIPT_OR_DATA,
|
7601
|
+
MUSTACHE_EXPR,
|
7602
|
+
TMPLIT_EXPR
|
7603
|
+
});
|
7604
|
+
var NODE_TYPE = {
|
7605
|
+
element: 1,
|
7606
|
+
attribute: 2,
|
7607
|
+
text: 3,
|
7608
|
+
cdataSection: 4,
|
7609
|
+
entityReference: 5,
|
7610
|
+
// Deprecated
|
7611
|
+
entityNode: 6,
|
7612
|
+
// Deprecated
|
7613
|
+
progressingInstruction: 7,
|
7614
|
+
comment: 8,
|
7615
|
+
document: 9,
|
7616
|
+
documentType: 10,
|
7617
|
+
documentFragment: 11,
|
7618
|
+
notation: 12
|
7619
|
+
// Deprecated
|
7620
|
+
};
|
7621
|
+
var getGlobal = function getGlobal2() {
|
7622
|
+
return typeof window === "undefined" ? null : window;
|
7623
|
+
};
|
7624
|
+
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, purifyHostElement) {
|
7625
|
+
if (typeof trustedTypes !== "object" || typeof trustedTypes.createPolicy !== "function") {
|
7626
|
+
return null;
|
7627
|
+
}
|
7628
|
+
let suffix = null;
|
7629
|
+
const ATTR_NAME = "data-tt-policy-suffix";
|
7630
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
7631
|
+
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
7632
|
+
}
|
7633
|
+
const policyName = "dompurify" + (suffix ? "#" + suffix : "");
|
7634
|
+
try {
|
7635
|
+
return trustedTypes.createPolicy(policyName, {
|
7636
|
+
createHTML(html3) {
|
7637
|
+
return html3;
|
7638
|
+
},
|
7639
|
+
createScriptURL(scriptUrl) {
|
7640
|
+
return scriptUrl;
|
7641
|
+
}
|
7642
|
+
});
|
7643
|
+
} catch (_) {
|
7644
|
+
console.warn("TrustedTypes policy " + policyName + " could not be created.");
|
7645
|
+
return null;
|
7646
|
+
}
|
7647
|
+
};
|
7648
|
+
var _createHooksMap = function _createHooksMap2() {
|
7649
|
+
return {
|
7650
|
+
afterSanitizeAttributes: [],
|
7651
|
+
afterSanitizeElements: [],
|
7652
|
+
afterSanitizeShadowDOM: [],
|
7653
|
+
beforeSanitizeAttributes: [],
|
7654
|
+
beforeSanitizeElements: [],
|
7655
|
+
beforeSanitizeShadowDOM: [],
|
7656
|
+
uponSanitizeAttribute: [],
|
7657
|
+
uponSanitizeElement: [],
|
7658
|
+
uponSanitizeShadowNode: []
|
7659
|
+
};
|
7660
|
+
};
|
7661
|
+
function createDOMPurify() {
|
7662
|
+
let window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal();
|
7663
|
+
const DOMPurify = (root) => createDOMPurify(root);
|
7664
|
+
DOMPurify.version = "3.2.2";
|
7665
|
+
DOMPurify.removed = [];
|
7666
|
+
if (!window2 || !window2.document || window2.document.nodeType !== NODE_TYPE.document) {
|
7667
|
+
DOMPurify.isSupported = false;
|
7668
|
+
return DOMPurify;
|
7669
|
+
}
|
7670
|
+
let {
|
7671
|
+
document: document2
|
7672
|
+
} = window2;
|
7673
|
+
const originalDocument = document2;
|
7674
|
+
const currentScript = originalDocument.currentScript;
|
7675
|
+
const {
|
7676
|
+
DocumentFragment,
|
7677
|
+
HTMLTemplateElement: HTMLTemplateElement2,
|
7678
|
+
Node: Node2,
|
7679
|
+
Element: Element2,
|
7680
|
+
NodeFilter,
|
7681
|
+
NamedNodeMap = window2.NamedNodeMap || window2.MozNamedAttrMap,
|
7682
|
+
HTMLFormElement: HTMLFormElement2,
|
7683
|
+
DOMParser: DOMParser2,
|
7684
|
+
trustedTypes
|
7685
|
+
} = window2;
|
7686
|
+
const ElementPrototype = Element2.prototype;
|
7687
|
+
const cloneNode = lookupGetter(ElementPrototype, "cloneNode");
|
7688
|
+
const remove = lookupGetter(ElementPrototype, "remove");
|
7689
|
+
const getNextSibling = lookupGetter(ElementPrototype, "nextSibling");
|
7690
|
+
const getChildNodes = lookupGetter(ElementPrototype, "childNodes");
|
7691
|
+
const getParentNode2 = lookupGetter(ElementPrototype, "parentNode");
|
7692
|
+
if (typeof HTMLTemplateElement2 === "function") {
|
7693
|
+
const template = document2.createElement("template");
|
7694
|
+
if (template.content && template.content.ownerDocument) {
|
7695
|
+
document2 = template.content.ownerDocument;
|
7696
|
+
}
|
7697
|
+
}
|
7698
|
+
let trustedTypesPolicy;
|
7699
|
+
let emptyHTML = "";
|
7700
|
+
const {
|
7701
|
+
implementation,
|
7702
|
+
createNodeIterator,
|
7703
|
+
createDocumentFragment: createDocumentFragment2,
|
7704
|
+
getElementsByTagName
|
7705
|
+
} = document2;
|
7706
|
+
const {
|
7707
|
+
importNode
|
7708
|
+
} = originalDocument;
|
7709
|
+
let hooks = _createHooksMap();
|
7710
|
+
DOMPurify.isSupported = typeof entries === "function" && typeof getParentNode2 === "function" && implementation && implementation.createHTMLDocument !== void 0;
|
7711
|
+
const {
|
7712
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR2,
|
7713
|
+
ERB_EXPR: ERB_EXPR2,
|
7714
|
+
TMPLIT_EXPR: TMPLIT_EXPR2,
|
7715
|
+
DATA_ATTR: DATA_ATTR2,
|
7716
|
+
ARIA_ATTR: ARIA_ATTR2,
|
7717
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA2,
|
7718
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE2,
|
7719
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT2
|
7720
|
+
} = EXPRESSIONS;
|
7721
|
+
let {
|
7722
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
7723
|
+
} = EXPRESSIONS;
|
7724
|
+
let ALLOWED_TAGS = null;
|
7725
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
7726
|
+
let ALLOWED_ATTR = null;
|
7727
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
7728
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
7729
|
+
tagNameCheck: {
|
7730
|
+
writable: true,
|
7731
|
+
configurable: false,
|
7732
|
+
enumerable: true,
|
7733
|
+
value: null
|
7734
|
+
},
|
7735
|
+
attributeNameCheck: {
|
7736
|
+
writable: true,
|
7737
|
+
configurable: false,
|
7738
|
+
enumerable: true,
|
7739
|
+
value: null
|
7740
|
+
},
|
7741
|
+
allowCustomizedBuiltInElements: {
|
7742
|
+
writable: true,
|
7743
|
+
configurable: false,
|
7744
|
+
enumerable: true,
|
7745
|
+
value: false
|
7746
|
+
}
|
7747
|
+
}));
|
7748
|
+
let FORBID_TAGS = null;
|
7749
|
+
let FORBID_ATTR = null;
|
7750
|
+
let ALLOW_ARIA_ATTR = true;
|
7751
|
+
let ALLOW_DATA_ATTR = true;
|
7752
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
7753
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
7754
|
+
let SAFE_FOR_TEMPLATES = false;
|
7755
|
+
let SAFE_FOR_XML = true;
|
7756
|
+
let WHOLE_DOCUMENT = false;
|
7757
|
+
let SET_CONFIG = false;
|
7758
|
+
let FORCE_BODY = false;
|
7759
|
+
let RETURN_DOM = false;
|
7760
|
+
let RETURN_DOM_FRAGMENT = false;
|
7761
|
+
let RETURN_TRUSTED_TYPE = false;
|
7762
|
+
let SANITIZE_DOM = true;
|
7763
|
+
let SANITIZE_NAMED_PROPS = false;
|
7764
|
+
const SANITIZE_NAMED_PROPS_PREFIX = "user-content-";
|
7765
|
+
let KEEP_CONTENT = true;
|
7766
|
+
let IN_PLACE = false;
|
7767
|
+
let USE_PROFILES = {};
|
7768
|
+
let FORBID_CONTENTS = null;
|
7769
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]);
|
7770
|
+
let DATA_URI_TAGS = null;
|
7771
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]);
|
7772
|
+
let URI_SAFE_ATTRIBUTES = null;
|
7773
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]);
|
7774
|
+
const MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
7775
|
+
const SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
7776
|
+
const HTML_NAMESPACE = "http://www.w3.org/1999/xhtml";
|
7777
|
+
let NAMESPACE = HTML_NAMESPACE;
|
7778
|
+
let IS_EMPTY_INPUT = false;
|
7779
|
+
let ALLOWED_NAMESPACES = null;
|
7780
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
7781
|
+
let MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]);
|
7782
|
+
let HTML_INTEGRATION_POINTS = addToSet({}, ["annotation-xml"]);
|
7783
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]);
|
7784
|
+
let PARSER_MEDIA_TYPE = null;
|
7785
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"];
|
7786
|
+
const DEFAULT_PARSER_MEDIA_TYPE = "text/html";
|
7787
|
+
let transformCaseFunc = null;
|
7788
|
+
let CONFIG = null;
|
7789
|
+
const formElement = document2.createElement("form");
|
7790
|
+
const isRegexOrFunction = function isRegexOrFunction2(testValue) {
|
7791
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
7792
|
+
};
|
7793
|
+
const _parseConfig = function _parseConfig2() {
|
7794
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
7795
|
+
if (CONFIG && CONFIG === cfg) {
|
7796
|
+
return;
|
7797
|
+
}
|
7798
|
+
if (!cfg || typeof cfg !== "object") {
|
7799
|
+
cfg = {};
|
7800
|
+
}
|
7801
|
+
cfg = clone(cfg);
|
7802
|
+
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
7803
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
7804
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? stringToString : stringToLowerCase;
|
7805
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, "ALLOWED_TAGS") ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
7806
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, "ALLOWED_ATTR") ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
7807
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, "ALLOWED_NAMESPACES") ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
7808
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, "ADD_URI_SAFE_ATTR") ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
7809
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, "ADD_DATA_URI_TAGS") ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
7810
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, "FORBID_CONTENTS") ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
7811
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, "FORBID_TAGS") ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
7812
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, "FORBID_ATTR") ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
7813
|
+
USE_PROFILES = objectHasOwnProperty(cfg, "USE_PROFILES") ? cfg.USE_PROFILES : false;
|
7814
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false;
|
7815
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false;
|
7816
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false;
|
7817
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false;
|
7818
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false;
|
7819
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false;
|
7820
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false;
|
7821
|
+
RETURN_DOM = cfg.RETURN_DOM || false;
|
7822
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false;
|
7823
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false;
|
7824
|
+
FORCE_BODY = cfg.FORCE_BODY || false;
|
7825
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false;
|
7826
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false;
|
7827
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false;
|
7828
|
+
IN_PLACE = cfg.IN_PLACE || false;
|
7829
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
7830
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
7831
|
+
MATHML_TEXT_INTEGRATION_POINTS = cfg.MATHML_TEXT_INTEGRATION_POINTS || MATHML_TEXT_INTEGRATION_POINTS;
|
7832
|
+
HTML_INTEGRATION_POINTS = cfg.HTML_INTEGRATION_POINTS || HTML_INTEGRATION_POINTS;
|
7833
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
7834
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
7835
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
7836
|
+
}
|
7837
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
7838
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
7839
|
+
}
|
7840
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") {
|
7841
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
7842
|
+
}
|
7843
|
+
if (SAFE_FOR_TEMPLATES) {
|
7844
|
+
ALLOW_DATA_ATTR = false;
|
7845
|
+
}
|
7846
|
+
if (RETURN_DOM_FRAGMENT) {
|
7847
|
+
RETURN_DOM = true;
|
7848
|
+
}
|
7849
|
+
if (USE_PROFILES) {
|
7850
|
+
ALLOWED_TAGS = addToSet({}, text);
|
7851
|
+
ALLOWED_ATTR = [];
|
7852
|
+
if (USE_PROFILES.html === true) {
|
7853
|
+
addToSet(ALLOWED_TAGS, html$1);
|
7854
|
+
addToSet(ALLOWED_ATTR, html);
|
7855
|
+
}
|
7856
|
+
if (USE_PROFILES.svg === true) {
|
7857
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
7858
|
+
addToSet(ALLOWED_ATTR, svg);
|
7859
|
+
addToSet(ALLOWED_ATTR, xml);
|
7860
|
+
}
|
7861
|
+
if (USE_PROFILES.svgFilters === true) {
|
7862
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
7863
|
+
addToSet(ALLOWED_ATTR, svg);
|
7864
|
+
addToSet(ALLOWED_ATTR, xml);
|
7865
|
+
}
|
7866
|
+
if (USE_PROFILES.mathMl === true) {
|
7867
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
7868
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
7869
|
+
addToSet(ALLOWED_ATTR, xml);
|
7870
|
+
}
|
7871
|
+
}
|
7872
|
+
if (cfg.ADD_TAGS) {
|
7873
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
7874
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
7875
|
+
}
|
7876
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
7877
|
+
}
|
7878
|
+
if (cfg.ADD_ATTR) {
|
7879
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
7880
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
7881
|
+
}
|
7882
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
7883
|
+
}
|
7884
|
+
if (cfg.ADD_URI_SAFE_ATTR) {
|
7885
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
7886
|
+
}
|
7887
|
+
if (cfg.FORBID_CONTENTS) {
|
7888
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
7889
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
7890
|
+
}
|
7891
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
7892
|
+
}
|
7893
|
+
if (KEEP_CONTENT) {
|
7894
|
+
ALLOWED_TAGS["#text"] = true;
|
7895
|
+
}
|
7896
|
+
if (WHOLE_DOCUMENT) {
|
7897
|
+
addToSet(ALLOWED_TAGS, ["html", "head", "body"]);
|
7898
|
+
}
|
7899
|
+
if (ALLOWED_TAGS.table) {
|
7900
|
+
addToSet(ALLOWED_TAGS, ["tbody"]);
|
7901
|
+
delete FORBID_TAGS.tbody;
|
7902
|
+
}
|
7903
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
7904
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== "function") {
|
7905
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
7906
|
+
}
|
7907
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== "function") {
|
7908
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
7909
|
+
}
|
7910
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
7911
|
+
emptyHTML = trustedTypesPolicy.createHTML("");
|
7912
|
+
} else {
|
7913
|
+
if (trustedTypesPolicy === void 0) {
|
7914
|
+
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
7915
|
+
}
|
7916
|
+
if (trustedTypesPolicy !== null && typeof emptyHTML === "string") {
|
7917
|
+
emptyHTML = trustedTypesPolicy.createHTML("");
|
7918
|
+
}
|
7919
|
+
}
|
7920
|
+
if (freeze) {
|
7921
|
+
freeze(cfg);
|
7922
|
+
}
|
7923
|
+
CONFIG = cfg;
|
7924
|
+
};
|
7925
|
+
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
7926
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
7927
|
+
const _checkValidNamespace = function _checkValidNamespace2(element) {
|
7928
|
+
let parent = getParentNode2(element);
|
7929
|
+
if (!parent || !parent.tagName) {
|
7930
|
+
parent = {
|
7931
|
+
namespaceURI: NAMESPACE,
|
7932
|
+
tagName: "template"
|
7933
|
+
};
|
7934
|
+
}
|
7935
|
+
const tagName = stringToLowerCase(element.tagName);
|
7936
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
7937
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
7938
|
+
return false;
|
7939
|
+
}
|
7940
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
7941
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
7942
|
+
return tagName === "svg";
|
7943
|
+
}
|
7944
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
7945
|
+
return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
7946
|
+
}
|
7947
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
7948
|
+
}
|
7949
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
7950
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
7951
|
+
return tagName === "math";
|
7952
|
+
}
|
7953
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
7954
|
+
return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName];
|
7955
|
+
}
|
7956
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
7957
|
+
}
|
7958
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
7959
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
7960
|
+
return false;
|
7961
|
+
}
|
7962
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
7963
|
+
return false;
|
7964
|
+
}
|
7965
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
7966
|
+
}
|
7967
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
7968
|
+
return true;
|
7969
|
+
}
|
7970
|
+
return false;
|
7971
|
+
};
|
7972
|
+
const _forceRemove = function _forceRemove2(node) {
|
7973
|
+
arrayPush(DOMPurify.removed, {
|
7974
|
+
element: node
|
7975
|
+
});
|
7976
|
+
try {
|
7977
|
+
getParentNode2(node).removeChild(node);
|
7978
|
+
} catch (_) {
|
7979
|
+
remove(node);
|
7980
|
+
}
|
7981
|
+
};
|
7982
|
+
const _removeAttribute = function _removeAttribute2(name, element) {
|
7983
|
+
try {
|
7984
|
+
arrayPush(DOMPurify.removed, {
|
7985
|
+
attribute: element.getAttributeNode(name),
|
7986
|
+
from: element
|
7987
|
+
});
|
7988
|
+
} catch (_) {
|
7989
|
+
arrayPush(DOMPurify.removed, {
|
7990
|
+
attribute: null,
|
7991
|
+
from: element
|
7992
|
+
});
|
7993
|
+
}
|
7994
|
+
element.removeAttribute(name);
|
7995
|
+
if (name === "is") {
|
7996
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
7997
|
+
try {
|
7998
|
+
_forceRemove(element);
|
7999
|
+
} catch (_) {
|
8000
|
+
}
|
8001
|
+
} else {
|
8002
|
+
try {
|
8003
|
+
element.setAttribute(name, "");
|
8004
|
+
} catch (_) {
|
8005
|
+
}
|
8006
|
+
}
|
8007
|
+
}
|
8008
|
+
};
|
8009
|
+
const _initDocument = function _initDocument2(dirty) {
|
8010
|
+
let doc = null;
|
8011
|
+
let leadingWhitespace = null;
|
8012
|
+
if (FORCE_BODY) {
|
8013
|
+
dirty = "<remove></remove>" + dirty;
|
8014
|
+
} else {
|
8015
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
8016
|
+
leadingWhitespace = matches && matches[0];
|
8017
|
+
}
|
8018
|
+
if (PARSER_MEDIA_TYPE === "application/xhtml+xml" && NAMESPACE === HTML_NAMESPACE) {
|
8019
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + "</body></html>";
|
8020
|
+
}
|
8021
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
8022
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
8023
|
+
try {
|
8024
|
+
doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
8025
|
+
} catch (_) {
|
8026
|
+
}
|
8027
|
+
}
|
8028
|
+
if (!doc || !doc.documentElement) {
|
8029
|
+
doc = implementation.createDocument(NAMESPACE, "template", null);
|
8030
|
+
try {
|
8031
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
8032
|
+
} catch (_) {
|
8033
|
+
}
|
8034
|
+
}
|
8035
|
+
const body = doc.body || doc.documentElement;
|
8036
|
+
if (dirty && leadingWhitespace) {
|
8037
|
+
body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
8038
|
+
}
|
8039
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
8040
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0];
|
8041
|
+
}
|
8042
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
8043
|
+
};
|
8044
|
+
const _createNodeIterator = function _createNodeIterator2(root) {
|
8045
|
+
return createNodeIterator.call(
|
8046
|
+
root.ownerDocument || root,
|
8047
|
+
root,
|
8048
|
+
// eslint-disable-next-line no-bitwise
|
8049
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION,
|
8050
|
+
null
|
8051
|
+
);
|
8052
|
+
};
|
8053
|
+
const _isClobbered = function _isClobbered2(element) {
|
8054
|
+
return element instanceof HTMLFormElement2 && (typeof element.nodeName !== "string" || typeof element.textContent !== "string" || typeof element.removeChild !== "function" || !(element.attributes instanceof NamedNodeMap) || typeof element.removeAttribute !== "function" || typeof element.setAttribute !== "function" || typeof element.namespaceURI !== "string" || typeof element.insertBefore !== "function" || typeof element.hasChildNodes !== "function");
|
8055
|
+
};
|
8056
|
+
const _isNode = function _isNode2(value) {
|
8057
|
+
return typeof Node2 === "function" && value instanceof Node2;
|
8058
|
+
};
|
8059
|
+
function _executeHooks(hooks2, currentNode, data) {
|
8060
|
+
arrayForEach(hooks2, (hook) => {
|
8061
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
8062
|
+
});
|
8063
|
+
}
|
8064
|
+
const _sanitizeElements = function _sanitizeElements2(currentNode) {
|
8065
|
+
let content = null;
|
8066
|
+
_executeHooks(hooks.beforeSanitizeElements, currentNode, null);
|
8067
|
+
if (_isClobbered(currentNode)) {
|
8068
|
+
_forceRemove(currentNode);
|
8069
|
+
return true;
|
8070
|
+
}
|
8071
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
8072
|
+
_executeHooks(hooks.uponSanitizeElement, currentNode, {
|
8073
|
+
tagName,
|
8074
|
+
allowedTags: ALLOWED_TAGS
|
8075
|
+
});
|
8076
|
+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
8077
|
+
_forceRemove(currentNode);
|
8078
|
+
return true;
|
8079
|
+
}
|
8080
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
8081
|
+
_forceRemove(currentNode);
|
8082
|
+
return true;
|
8083
|
+
}
|
8084
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
8085
|
+
_forceRemove(currentNode);
|
8086
|
+
return true;
|
8087
|
+
}
|
8088
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
8089
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
8090
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
8091
|
+
return false;
|
8092
|
+
}
|
8093
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
8094
|
+
return false;
|
8095
|
+
}
|
8096
|
+
}
|
8097
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
8098
|
+
const parentNode = getParentNode2(currentNode) || currentNode.parentNode;
|
8099
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
8100
|
+
if (childNodes && parentNode) {
|
8101
|
+
const childCount = childNodes.length;
|
8102
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
8103
|
+
const childClone = cloneNode(childNodes[i], true);
|
8104
|
+
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
8105
|
+
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
8106
|
+
}
|
8107
|
+
}
|
8108
|
+
}
|
8109
|
+
_forceRemove(currentNode);
|
8110
|
+
return true;
|
8111
|
+
}
|
8112
|
+
if (currentNode instanceof Element2 && !_checkValidNamespace(currentNode)) {
|
8113
|
+
_forceRemove(currentNode);
|
8114
|
+
return true;
|
8115
|
+
}
|
8116
|
+
if ((tagName === "noscript" || tagName === "noembed" || tagName === "noframes") && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
8117
|
+
_forceRemove(currentNode);
|
8118
|
+
return true;
|
8119
|
+
}
|
8120
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
8121
|
+
content = currentNode.textContent;
|
8122
|
+
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
8123
|
+
content = stringReplace(content, expr, " ");
|
8124
|
+
});
|
8125
|
+
if (currentNode.textContent !== content) {
|
8126
|
+
arrayPush(DOMPurify.removed, {
|
8127
|
+
element: currentNode.cloneNode()
|
8128
|
+
});
|
8129
|
+
currentNode.textContent = content;
|
8130
|
+
}
|
8131
|
+
}
|
8132
|
+
_executeHooks(hooks.afterSanitizeElements, currentNode, null);
|
8133
|
+
return false;
|
8134
|
+
};
|
8135
|
+
const _isValidAttribute = function _isValidAttribute2(lcTag, lcName, value) {
|
8136
|
+
if (SANITIZE_DOM && (lcName === "id" || lcName === "name") && (value in document2 || value in formElement)) {
|
8137
|
+
return false;
|
8138
|
+
}
|
8139
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR2, lcName))
|
8140
|
+
;
|
8141
|
+
else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR2, lcName))
|
8142
|
+
;
|
8143
|
+
else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
8144
|
+
if (
|
8145
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
8146
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
8147
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
8148
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
8149
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
8150
|
+
lcName === "is" && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))
|
8151
|
+
)
|
8152
|
+
;
|
8153
|
+
else {
|
8154
|
+
return false;
|
8155
|
+
}
|
8156
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName])
|
8157
|
+
;
|
8158
|
+
else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE2, "")))
|
8159
|
+
;
|
8160
|
+
else if ((lcName === "src" || lcName === "xlink:href" || lcName === "href") && lcTag !== "script" && stringIndexOf(value, "data:") === 0 && DATA_URI_TAGS[lcTag])
|
8161
|
+
;
|
8162
|
+
else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA2, stringReplace(value, ATTR_WHITESPACE2, "")))
|
8163
|
+
;
|
8164
|
+
else if (value) {
|
8165
|
+
return false;
|
8166
|
+
} else
|
8167
|
+
;
|
8168
|
+
return true;
|
8169
|
+
};
|
8170
|
+
const _isBasicCustomElement = function _isBasicCustomElement2(tagName) {
|
8171
|
+
return tagName !== "annotation-xml" && stringMatch(tagName, CUSTOM_ELEMENT2);
|
8172
|
+
};
|
8173
|
+
const _sanitizeAttributes = function _sanitizeAttributes2(currentNode) {
|
8174
|
+
_executeHooks(hooks.beforeSanitizeAttributes, currentNode, null);
|
8175
|
+
const {
|
8176
|
+
attributes
|
8177
|
+
} = currentNode;
|
8178
|
+
if (!attributes) {
|
8179
|
+
return;
|
8180
|
+
}
|
8181
|
+
const hookEvent = {
|
8182
|
+
attrName: "",
|
8183
|
+
attrValue: "",
|
8184
|
+
keepAttr: true,
|
8185
|
+
allowedAttributes: ALLOWED_ATTR,
|
8186
|
+
forceKeepAttr: void 0
|
8187
|
+
};
|
8188
|
+
let l = attributes.length;
|
8189
|
+
while (l--) {
|
8190
|
+
const attr = attributes[l];
|
8191
|
+
const {
|
8192
|
+
name,
|
8193
|
+
namespaceURI,
|
8194
|
+
value: attrValue
|
8195
|
+
} = attr;
|
8196
|
+
const lcName = transformCaseFunc(name);
|
8197
|
+
let value = name === "value" ? attrValue : stringTrim(attrValue);
|
8198
|
+
hookEvent.attrName = lcName;
|
8199
|
+
hookEvent.attrValue = value;
|
8200
|
+
hookEvent.keepAttr = true;
|
8201
|
+
hookEvent.forceKeepAttr = void 0;
|
8202
|
+
_executeHooks(hooks.uponSanitizeAttribute, currentNode, hookEvent);
|
8203
|
+
value = hookEvent.attrValue;
|
8204
|
+
if (SANITIZE_NAMED_PROPS && (lcName === "id" || lcName === "name")) {
|
8205
|
+
_removeAttribute(name, currentNode);
|
8206
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
8207
|
+
}
|
8208
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
8209
|
+
_removeAttribute(name, currentNode);
|
8210
|
+
continue;
|
8211
|
+
}
|
8212
|
+
if (hookEvent.forceKeepAttr) {
|
8213
|
+
continue;
|
8214
|
+
}
|
8215
|
+
_removeAttribute(name, currentNode);
|
8216
|
+
if (!hookEvent.keepAttr) {
|
8217
|
+
continue;
|
8218
|
+
}
|
8219
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
8220
|
+
_removeAttribute(name, currentNode);
|
8221
|
+
continue;
|
8222
|
+
}
|
8223
|
+
if (SAFE_FOR_TEMPLATES) {
|
8224
|
+
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
8225
|
+
value = stringReplace(value, expr, " ");
|
8226
|
+
});
|
8227
|
+
}
|
8228
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
8229
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
8230
|
+
continue;
|
8231
|
+
}
|
8232
|
+
if (trustedTypesPolicy && typeof trustedTypes === "object" && typeof trustedTypes.getAttributeType === "function") {
|
8233
|
+
if (namespaceURI)
|
8234
|
+
;
|
8235
|
+
else {
|
8236
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
8237
|
+
case "TrustedHTML": {
|
8238
|
+
value = trustedTypesPolicy.createHTML(value);
|
8239
|
+
break;
|
8240
|
+
}
|
8241
|
+
case "TrustedScriptURL": {
|
8242
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
8243
|
+
break;
|
8244
|
+
}
|
8245
|
+
}
|
8246
|
+
}
|
8247
|
+
}
|
8248
|
+
try {
|
8249
|
+
if (namespaceURI) {
|
8250
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
8251
|
+
} else {
|
8252
|
+
currentNode.setAttribute(name, value);
|
8253
|
+
}
|
8254
|
+
if (_isClobbered(currentNode)) {
|
8255
|
+
_forceRemove(currentNode);
|
8256
|
+
} else {
|
8257
|
+
arrayPop(DOMPurify.removed);
|
8258
|
+
}
|
8259
|
+
} catch (_) {
|
8260
|
+
}
|
8261
|
+
}
|
8262
|
+
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
8263
|
+
};
|
8264
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM2(fragment) {
|
8265
|
+
let shadowNode = null;
|
8266
|
+
const shadowIterator = _createNodeIterator(fragment);
|
8267
|
+
_executeHooks(hooks.beforeSanitizeShadowDOM, fragment, null);
|
8268
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
8269
|
+
_executeHooks(hooks.uponSanitizeShadowNode, shadowNode, null);
|
8270
|
+
if (_sanitizeElements(shadowNode)) {
|
8271
|
+
continue;
|
8272
|
+
}
|
8273
|
+
if (shadowNode.content instanceof DocumentFragment) {
|
8274
|
+
_sanitizeShadowDOM2(shadowNode.content);
|
8275
|
+
}
|
8276
|
+
_sanitizeAttributes(shadowNode);
|
8277
|
+
}
|
8278
|
+
_executeHooks(hooks.afterSanitizeShadowDOM, fragment, null);
|
8279
|
+
};
|
8280
|
+
DOMPurify.sanitize = function(dirty) {
|
8281
|
+
let cfg = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
8282
|
+
let body = null;
|
8283
|
+
let importedNode = null;
|
8284
|
+
let currentNode = null;
|
8285
|
+
let returnNode = null;
|
8286
|
+
IS_EMPTY_INPUT = !dirty;
|
8287
|
+
if (IS_EMPTY_INPUT) {
|
8288
|
+
dirty = "<!-->";
|
8289
|
+
}
|
8290
|
+
if (typeof dirty !== "string" && !_isNode(dirty)) {
|
8291
|
+
if (typeof dirty.toString === "function") {
|
8292
|
+
dirty = dirty.toString();
|
8293
|
+
if (typeof dirty !== "string") {
|
8294
|
+
throw typeErrorCreate("dirty is not a string, aborting");
|
8295
|
+
}
|
8296
|
+
} else {
|
8297
|
+
throw typeErrorCreate("toString is not a function");
|
8298
|
+
}
|
8299
|
+
}
|
8300
|
+
if (!DOMPurify.isSupported) {
|
8301
|
+
return dirty;
|
8302
|
+
}
|
8303
|
+
if (!SET_CONFIG) {
|
8304
|
+
_parseConfig(cfg);
|
8305
|
+
}
|
8306
|
+
DOMPurify.removed = [];
|
8307
|
+
if (typeof dirty === "string") {
|
8308
|
+
IN_PLACE = false;
|
8309
|
+
}
|
8310
|
+
if (IN_PLACE) {
|
8311
|
+
if (dirty.nodeName) {
|
8312
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
8313
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
8314
|
+
throw typeErrorCreate("root node is forbidden and cannot be sanitized in-place");
|
8315
|
+
}
|
8316
|
+
}
|
8317
|
+
} else if (dirty instanceof Node2) {
|
8318
|
+
body = _initDocument("<!---->");
|
8319
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
8320
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === "BODY") {
|
8321
|
+
body = importedNode;
|
8322
|
+
} else if (importedNode.nodeName === "HTML") {
|
8323
|
+
body = importedNode;
|
8324
|
+
} else {
|
8325
|
+
body.appendChild(importedNode);
|
8326
|
+
}
|
8327
|
+
} else {
|
8328
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
|
8329
|
+
dirty.indexOf("<") === -1) {
|
8330
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
8331
|
+
}
|
8332
|
+
body = _initDocument(dirty);
|
8333
|
+
if (!body) {
|
8334
|
+
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : "";
|
8335
|
+
}
|
8336
|
+
}
|
8337
|
+
if (body && FORCE_BODY) {
|
8338
|
+
_forceRemove(body.firstChild);
|
8339
|
+
}
|
8340
|
+
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
8341
|
+
while (currentNode = nodeIterator.nextNode()) {
|
8342
|
+
if (_sanitizeElements(currentNode)) {
|
8343
|
+
continue;
|
8344
|
+
}
|
8345
|
+
if (currentNode.content instanceof DocumentFragment) {
|
8346
|
+
_sanitizeShadowDOM(currentNode.content);
|
8347
|
+
}
|
8348
|
+
_sanitizeAttributes(currentNode);
|
8349
|
+
}
|
8350
|
+
if (IN_PLACE) {
|
8351
|
+
return dirty;
|
8352
|
+
}
|
8353
|
+
if (RETURN_DOM) {
|
8354
|
+
if (RETURN_DOM_FRAGMENT) {
|
8355
|
+
returnNode = createDocumentFragment2.call(body.ownerDocument);
|
8356
|
+
while (body.firstChild) {
|
8357
|
+
returnNode.appendChild(body.firstChild);
|
8358
|
+
}
|
8359
|
+
} else {
|
8360
|
+
returnNode = body;
|
8361
|
+
}
|
8362
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
8363
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
8364
|
+
}
|
8365
|
+
return returnNode;
|
8366
|
+
}
|
8367
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
8368
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS["!doctype"] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
8369
|
+
serializedHTML = "<!DOCTYPE " + body.ownerDocument.doctype.name + ">\n" + serializedHTML;
|
8370
|
+
}
|
8371
|
+
if (SAFE_FOR_TEMPLATES) {
|
8372
|
+
arrayForEach([MUSTACHE_EXPR2, ERB_EXPR2, TMPLIT_EXPR2], (expr) => {
|
8373
|
+
serializedHTML = stringReplace(serializedHTML, expr, " ");
|
8374
|
+
});
|
8375
|
+
}
|
8376
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
8377
|
+
};
|
8378
|
+
DOMPurify.setConfig = function() {
|
8379
|
+
let cfg = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
8380
|
+
_parseConfig(cfg);
|
8381
|
+
SET_CONFIG = true;
|
8382
|
+
};
|
8383
|
+
DOMPurify.clearConfig = function() {
|
8384
|
+
CONFIG = null;
|
8385
|
+
SET_CONFIG = false;
|
8386
|
+
};
|
8387
|
+
DOMPurify.isValidAttribute = function(tag2, attr, value) {
|
8388
|
+
if (!CONFIG) {
|
8389
|
+
_parseConfig({});
|
8390
|
+
}
|
8391
|
+
const lcTag = transformCaseFunc(tag2);
|
8392
|
+
const lcName = transformCaseFunc(attr);
|
8393
|
+
return _isValidAttribute(lcTag, lcName, value);
|
8394
|
+
};
|
8395
|
+
DOMPurify.addHook = function(entryPoint, hookFunction) {
|
8396
|
+
if (typeof hookFunction !== "function") {
|
8397
|
+
return;
|
8398
|
+
}
|
8399
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
8400
|
+
};
|
8401
|
+
DOMPurify.removeHook = function(entryPoint) {
|
8402
|
+
return arrayPop(hooks[entryPoint]);
|
8403
|
+
};
|
8404
|
+
DOMPurify.removeHooks = function(entryPoint) {
|
8405
|
+
hooks[entryPoint] = [];
|
8406
|
+
};
|
8407
|
+
DOMPurify.removeAllHooks = function() {
|
8408
|
+
hooks = _createHooksMap();
|
8409
|
+
};
|
8410
|
+
return DOMPurify;
|
8411
|
+
}
|
8412
|
+
var purify = createDOMPurify();
|
8413
|
+
|
8414
|
+
// node_modules/marked/lib/marked.esm.js
|
8415
|
+
function _getDefaults() {
|
8416
|
+
return {
|
8417
|
+
async: false,
|
8418
|
+
breaks: false,
|
8419
|
+
extensions: null,
|
8420
|
+
gfm: true,
|
8421
|
+
hooks: null,
|
8422
|
+
pedantic: false,
|
8423
|
+
renderer: null,
|
8424
|
+
silent: false,
|
8425
|
+
tokenizer: null,
|
8426
|
+
walkTokens: null
|
8427
|
+
};
|
8428
|
+
}
|
8429
|
+
var _defaults = _getDefaults();
|
8430
|
+
function changeDefaults(newDefaults) {
|
8431
|
+
_defaults = newDefaults;
|
8432
|
+
}
|
8433
|
+
var escapeTest = /[&<>"']/;
|
8434
|
+
var escapeReplace = new RegExp(escapeTest.source, "g");
|
8435
|
+
var escapeTestNoEncode = /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/;
|
8436
|
+
var escapeReplaceNoEncode = new RegExp(escapeTestNoEncode.source, "g");
|
8437
|
+
var escapeReplacements = {
|
8438
|
+
"&": "&",
|
8439
|
+
"<": "<",
|
8440
|
+
">": ">",
|
8441
|
+
'"': """,
|
8442
|
+
"'": "'"
|
8443
|
+
};
|
8444
|
+
var getEscapeReplacement = (ch) => escapeReplacements[ch];
|
8445
|
+
function escape$1(html3, encode) {
|
8446
|
+
if (encode) {
|
8447
|
+
if (escapeTest.test(html3)) {
|
8448
|
+
return html3.replace(escapeReplace, getEscapeReplacement);
|
8449
|
+
}
|
8450
|
+
} else {
|
8451
|
+
if (escapeTestNoEncode.test(html3)) {
|
8452
|
+
return html3.replace(escapeReplaceNoEncode, getEscapeReplacement);
|
8453
|
+
}
|
8454
|
+
}
|
8455
|
+
return html3;
|
8456
|
+
}
|
8457
|
+
var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
|
8458
|
+
function unescape(html3) {
|
8459
|
+
return html3.replace(unescapeTest, (_, n) => {
|
8460
|
+
n = n.toLowerCase();
|
8461
|
+
if (n === "colon")
|
8462
|
+
return ":";
|
8463
|
+
if (n.charAt(0) === "#") {
|
8464
|
+
return n.charAt(1) === "x" ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
|
8465
|
+
}
|
8466
|
+
return "";
|
8467
|
+
});
|
8468
|
+
}
|
8469
|
+
var caret = /(^|[^\[])\^/g;
|
8470
|
+
function edit(regex, opt) {
|
8471
|
+
let source = typeof regex === "string" ? regex : regex.source;
|
8472
|
+
opt = opt || "";
|
8473
|
+
const obj = {
|
8474
|
+
replace: (name, val) => {
|
8475
|
+
let valSource = typeof val === "string" ? val : val.source;
|
8476
|
+
valSource = valSource.replace(caret, "$1");
|
8477
|
+
source = source.replace(name, valSource);
|
8478
|
+
return obj;
|
8479
|
+
},
|
8480
|
+
getRegex: () => {
|
8481
|
+
return new RegExp(source, opt);
|
8482
|
+
}
|
8483
|
+
};
|
8484
|
+
return obj;
|
8485
|
+
}
|
8486
|
+
function cleanUrl(href) {
|
8487
|
+
try {
|
8488
|
+
href = encodeURI(href).replace(/%25/g, "%");
|
8489
|
+
} catch {
|
8490
|
+
return null;
|
8491
|
+
}
|
8492
|
+
return href;
|
8493
|
+
}
|
8494
|
+
var noopTest = { exec: () => null };
|
8495
|
+
function splitCells(tableRow, count) {
|
8496
|
+
const row = tableRow.replace(/\|/g, (match, offset2, str) => {
|
8497
|
+
let escaped = false;
|
8498
|
+
let curr = offset2;
|
8499
|
+
while (--curr >= 0 && str[curr] === "\\")
|
8500
|
+
escaped = !escaped;
|
8501
|
+
if (escaped) {
|
8502
|
+
return "|";
|
8503
|
+
} else {
|
8504
|
+
return " |";
|
8505
|
+
}
|
8506
|
+
}), cells = row.split(/ \|/);
|
8507
|
+
let i = 0;
|
8508
|
+
if (!cells[0].trim()) {
|
8509
|
+
cells.shift();
|
8510
|
+
}
|
8511
|
+
if (cells.length > 0 && !cells[cells.length - 1].trim()) {
|
8512
|
+
cells.pop();
|
8513
|
+
}
|
8514
|
+
if (count) {
|
8515
|
+
if (cells.length > count) {
|
8516
|
+
cells.splice(count);
|
8517
|
+
} else {
|
8518
|
+
while (cells.length < count)
|
8519
|
+
cells.push("");
|
8520
|
+
}
|
8521
|
+
}
|
8522
|
+
for (; i < cells.length; i++) {
|
8523
|
+
cells[i] = cells[i].trim().replace(/\\\|/g, "|");
|
8524
|
+
}
|
8525
|
+
return cells;
|
8526
|
+
}
|
8527
|
+
function rtrim(str, c, invert) {
|
8528
|
+
const l = str.length;
|
8529
|
+
if (l === 0) {
|
8530
|
+
return "";
|
8531
|
+
}
|
8532
|
+
let suffLen = 0;
|
8533
|
+
while (suffLen < l) {
|
8534
|
+
const currChar = str.charAt(l - suffLen - 1);
|
8535
|
+
if (currChar === c && !invert) {
|
8536
|
+
suffLen++;
|
8537
|
+
} else if (currChar !== c && invert) {
|
8538
|
+
suffLen++;
|
8539
|
+
} else {
|
8540
|
+
break;
|
8541
|
+
}
|
8542
|
+
}
|
8543
|
+
return str.slice(0, l - suffLen);
|
8544
|
+
}
|
8545
|
+
function findClosingBracket(str, b) {
|
8546
|
+
if (str.indexOf(b[1]) === -1) {
|
8547
|
+
return -1;
|
8548
|
+
}
|
8549
|
+
let level = 0;
|
8550
|
+
for (let i = 0; i < str.length; i++) {
|
8551
|
+
if (str[i] === "\\") {
|
8552
|
+
i++;
|
8553
|
+
} else if (str[i] === b[0]) {
|
8554
|
+
level++;
|
8555
|
+
} else if (str[i] === b[1]) {
|
8556
|
+
level--;
|
8557
|
+
if (level < 0) {
|
8558
|
+
return i;
|
8559
|
+
}
|
8560
|
+
}
|
8561
|
+
}
|
8562
|
+
return -1;
|
8563
|
+
}
|
8564
|
+
function outputLink(cap, link2, raw, lexer2) {
|
8565
|
+
const href = link2.href;
|
8566
|
+
const title = link2.title ? escape$1(link2.title) : null;
|
8567
|
+
const text2 = cap[1].replace(/\\([\[\]])/g, "$1");
|
8568
|
+
if (cap[0].charAt(0) !== "!") {
|
8569
|
+
lexer2.state.inLink = true;
|
8570
|
+
const token = {
|
8571
|
+
type: "link",
|
8572
|
+
raw,
|
8573
|
+
href,
|
8574
|
+
title,
|
8575
|
+
text: text2,
|
8576
|
+
tokens: lexer2.inlineTokens(text2)
|
8577
|
+
};
|
8578
|
+
lexer2.state.inLink = false;
|
8579
|
+
return token;
|
8580
|
+
}
|
8581
|
+
return {
|
8582
|
+
type: "image",
|
8583
|
+
raw,
|
8584
|
+
href,
|
8585
|
+
title,
|
8586
|
+
text: escape$1(text2)
|
8587
|
+
};
|
8588
|
+
}
|
8589
|
+
function indentCodeCompensation(raw, text2) {
|
8590
|
+
const matchIndentToCode = raw.match(/^(\s+)(?:```)/);
|
8591
|
+
if (matchIndentToCode === null) {
|
8592
|
+
return text2;
|
8593
|
+
}
|
8594
|
+
const indentToCode = matchIndentToCode[1];
|
8595
|
+
return text2.split("\n").map((node) => {
|
8596
|
+
const matchIndentInNode = node.match(/^\s+/);
|
8597
|
+
if (matchIndentInNode === null) {
|
8598
|
+
return node;
|
8599
|
+
}
|
8600
|
+
const [indentInNode] = matchIndentInNode;
|
8601
|
+
if (indentInNode.length >= indentToCode.length) {
|
8602
|
+
return node.slice(indentToCode.length);
|
8603
|
+
}
|
8604
|
+
return node;
|
8605
|
+
}).join("\n");
|
8606
|
+
}
|
8607
|
+
var _Tokenizer = class {
|
8608
|
+
options;
|
8609
|
+
rules;
|
8610
|
+
// set by the lexer
|
8611
|
+
lexer;
|
8612
|
+
// set by the lexer
|
8613
|
+
constructor(options2) {
|
8614
|
+
this.options = options2 || _defaults;
|
8615
|
+
}
|
8616
|
+
space(src) {
|
8617
|
+
const cap = this.rules.block.newline.exec(src);
|
8618
|
+
if (cap && cap[0].length > 0) {
|
8619
|
+
return {
|
8620
|
+
type: "space",
|
8621
|
+
raw: cap[0]
|
8622
|
+
};
|
8623
|
+
}
|
8624
|
+
}
|
8625
|
+
code(src) {
|
8626
|
+
const cap = this.rules.block.code.exec(src);
|
8627
|
+
if (cap) {
|
8628
|
+
const text2 = cap[0].replace(/^ {1,4}/gm, "");
|
8629
|
+
return {
|
8630
|
+
type: "code",
|
8631
|
+
raw: cap[0],
|
8632
|
+
codeBlockStyle: "indented",
|
8633
|
+
text: !this.options.pedantic ? rtrim(text2, "\n") : text2
|
8634
|
+
};
|
8635
|
+
}
|
8636
|
+
}
|
8637
|
+
fences(src) {
|
8638
|
+
const cap = this.rules.block.fences.exec(src);
|
8639
|
+
if (cap) {
|
8640
|
+
const raw = cap[0];
|
8641
|
+
const text2 = indentCodeCompensation(raw, cap[3] || "");
|
8642
|
+
return {
|
8643
|
+
type: "code",
|
8644
|
+
raw,
|
8645
|
+
lang: cap[2] ? cap[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : cap[2],
|
8646
|
+
text: text2
|
8647
|
+
};
|
8648
|
+
}
|
8649
|
+
}
|
8650
|
+
heading(src) {
|
8651
|
+
const cap = this.rules.block.heading.exec(src);
|
8652
|
+
if (cap) {
|
8653
|
+
let text2 = cap[2].trim();
|
8654
|
+
if (/#$/.test(text2)) {
|
8655
|
+
const trimmed = rtrim(text2, "#");
|
8656
|
+
if (this.options.pedantic) {
|
8657
|
+
text2 = trimmed.trim();
|
8658
|
+
} else if (!trimmed || / $/.test(trimmed)) {
|
8659
|
+
text2 = trimmed.trim();
|
8660
|
+
}
|
8661
|
+
}
|
8662
|
+
return {
|
8663
|
+
type: "heading",
|
8664
|
+
raw: cap[0],
|
8665
|
+
depth: cap[1].length,
|
8666
|
+
text: text2,
|
8667
|
+
tokens: this.lexer.inline(text2)
|
8668
|
+
};
|
8669
|
+
}
|
8670
|
+
}
|
8671
|
+
hr(src) {
|
8672
|
+
const cap = this.rules.block.hr.exec(src);
|
8673
|
+
if (cap) {
|
8674
|
+
return {
|
8675
|
+
type: "hr",
|
8676
|
+
raw: rtrim(cap[0], "\n")
|
8677
|
+
};
|
8678
|
+
}
|
8679
|
+
}
|
8680
|
+
blockquote(src) {
|
8681
|
+
const cap = this.rules.block.blockquote.exec(src);
|
8682
|
+
if (cap) {
|
8683
|
+
let lines = rtrim(cap[0], "\n").split("\n");
|
8684
|
+
let raw = "";
|
8685
|
+
let text2 = "";
|
8686
|
+
const tokens = [];
|
8687
|
+
while (lines.length > 0) {
|
8688
|
+
let inBlockquote = false;
|
8689
|
+
const currentLines = [];
|
8690
|
+
let i;
|
8691
|
+
for (i = 0; i < lines.length; i++) {
|
8692
|
+
if (/^ {0,3}>/.test(lines[i])) {
|
8693
|
+
currentLines.push(lines[i]);
|
8694
|
+
inBlockquote = true;
|
8695
|
+
} else if (!inBlockquote) {
|
8696
|
+
currentLines.push(lines[i]);
|
8697
|
+
} else {
|
8698
|
+
break;
|
8699
|
+
}
|
8700
|
+
}
|
8701
|
+
lines = lines.slice(i);
|
8702
|
+
const currentRaw = currentLines.join("\n");
|
8703
|
+
const currentText = currentRaw.replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g, "\n $1").replace(/^ {0,3}>[ \t]?/gm, "");
|
8704
|
+
raw = raw ? `${raw}
|
8705
|
+
${currentRaw}` : currentRaw;
|
8706
|
+
text2 = text2 ? `${text2}
|
8707
|
+
${currentText}` : currentText;
|
8708
|
+
const top2 = this.lexer.state.top;
|
8709
|
+
this.lexer.state.top = true;
|
8710
|
+
this.lexer.blockTokens(currentText, tokens, true);
|
8711
|
+
this.lexer.state.top = top2;
|
8712
|
+
if (lines.length === 0) {
|
8713
|
+
break;
|
8714
|
+
}
|
8715
|
+
const lastToken = tokens[tokens.length - 1];
|
8716
|
+
if (lastToken?.type === "code") {
|
8717
|
+
break;
|
8718
|
+
} else if (lastToken?.type === "blockquote") {
|
8719
|
+
const oldToken = lastToken;
|
8720
|
+
const newText = oldToken.raw + "\n" + lines.join("\n");
|
8721
|
+
const newToken = this.blockquote(newText);
|
8722
|
+
tokens[tokens.length - 1] = newToken;
|
8723
|
+
raw = raw.substring(0, raw.length - oldToken.raw.length) + newToken.raw;
|
8724
|
+
text2 = text2.substring(0, text2.length - oldToken.text.length) + newToken.text;
|
8725
|
+
break;
|
8726
|
+
} else if (lastToken?.type === "list") {
|
8727
|
+
const oldToken = lastToken;
|
8728
|
+
const newText = oldToken.raw + "\n" + lines.join("\n");
|
8729
|
+
const newToken = this.list(newText);
|
8730
|
+
tokens[tokens.length - 1] = newToken;
|
8731
|
+
raw = raw.substring(0, raw.length - lastToken.raw.length) + newToken.raw;
|
8732
|
+
text2 = text2.substring(0, text2.length - oldToken.raw.length) + newToken.raw;
|
8733
|
+
lines = newText.substring(tokens[tokens.length - 1].raw.length).split("\n");
|
8734
|
+
continue;
|
8735
|
+
}
|
8736
|
+
}
|
8737
|
+
return {
|
8738
|
+
type: "blockquote",
|
8739
|
+
raw,
|
8740
|
+
tokens,
|
8741
|
+
text: text2
|
8742
|
+
};
|
8743
|
+
}
|
8744
|
+
}
|
8745
|
+
list(src) {
|
8746
|
+
let cap = this.rules.block.list.exec(src);
|
8747
|
+
if (cap) {
|
8748
|
+
let bull = cap[1].trim();
|
8749
|
+
const isordered = bull.length > 1;
|
8750
|
+
const list2 = {
|
8751
|
+
type: "list",
|
8752
|
+
raw: "",
|
8753
|
+
ordered: isordered,
|
8754
|
+
start: isordered ? +bull.slice(0, -1) : "",
|
8755
|
+
loose: false,
|
8756
|
+
items: []
|
8757
|
+
};
|
8758
|
+
bull = isordered ? `\\d{1,9}\\${bull.slice(-1)}` : `\\${bull}`;
|
8759
|
+
if (this.options.pedantic) {
|
8760
|
+
bull = isordered ? bull : "[*+-]";
|
8761
|
+
}
|
8762
|
+
const itemRegex = new RegExp(`^( {0,3}${bull})((?:[ ][^\\n]*)?(?:\\n|$))`);
|
8763
|
+
let endsWithBlankLine = false;
|
8764
|
+
while (src) {
|
8765
|
+
let endEarly = false;
|
8766
|
+
let raw = "";
|
8767
|
+
let itemContents = "";
|
8768
|
+
if (!(cap = itemRegex.exec(src))) {
|
8769
|
+
break;
|
8770
|
+
}
|
8771
|
+
if (this.rules.block.hr.test(src)) {
|
8772
|
+
break;
|
8773
|
+
}
|
8774
|
+
raw = cap[0];
|
8775
|
+
src = src.substring(raw.length);
|
8776
|
+
let line = cap[2].split("\n", 1)[0].replace(/^\t+/, (t) => " ".repeat(3 * t.length));
|
8777
|
+
let nextLine = src.split("\n", 1)[0];
|
8778
|
+
let blankLine = !line.trim();
|
8779
|
+
let indent = 0;
|
8780
|
+
if (this.options.pedantic) {
|
8781
|
+
indent = 2;
|
8782
|
+
itemContents = line.trimStart();
|
8783
|
+
} else if (blankLine) {
|
8784
|
+
indent = cap[1].length + 1;
|
8785
|
+
} else {
|
8786
|
+
indent = cap[2].search(/[^ ]/);
|
8787
|
+
indent = indent > 4 ? 1 : indent;
|
8788
|
+
itemContents = line.slice(indent);
|
8789
|
+
indent += cap[1].length;
|
8790
|
+
}
|
8791
|
+
if (blankLine && /^ *$/.test(nextLine)) {
|
8792
|
+
raw += nextLine + "\n";
|
8793
|
+
src = src.substring(nextLine.length + 1);
|
8794
|
+
endEarly = true;
|
8795
|
+
}
|
8796
|
+
if (!endEarly) {
|
8797
|
+
const nextBulletRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`);
|
8798
|
+
const hrRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`);
|
8799
|
+
const fencesBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}(?:\`\`\`|~~~)`);
|
8800
|
+
const headingBeginRegex = new RegExp(`^ {0,${Math.min(3, indent - 1)}}#`);
|
8801
|
+
while (src) {
|
8802
|
+
const rawLine = src.split("\n", 1)[0];
|
8803
|
+
nextLine = rawLine;
|
8804
|
+
if (this.options.pedantic) {
|
8805
|
+
nextLine = nextLine.replace(/^ {1,4}(?=( {4})*[^ ])/g, " ");
|
8806
|
+
}
|
8807
|
+
if (fencesBeginRegex.test(nextLine)) {
|
8808
|
+
break;
|
8809
|
+
}
|
8810
|
+
if (headingBeginRegex.test(nextLine)) {
|
8811
|
+
break;
|
8812
|
+
}
|
8813
|
+
if (nextBulletRegex.test(nextLine)) {
|
8814
|
+
break;
|
8815
|
+
}
|
8816
|
+
if (hrRegex.test(src)) {
|
8817
|
+
break;
|
8818
|
+
}
|
8819
|
+
if (nextLine.search(/[^ ]/) >= indent || !nextLine.trim()) {
|
8820
|
+
itemContents += "\n" + nextLine.slice(indent);
|
8821
|
+
} else {
|
8822
|
+
if (blankLine) {
|
8823
|
+
break;
|
8824
|
+
}
|
8825
|
+
if (line.search(/[^ ]/) >= 4) {
|
8826
|
+
break;
|
8827
|
+
}
|
8828
|
+
if (fencesBeginRegex.test(line)) {
|
8829
|
+
break;
|
8830
|
+
}
|
8831
|
+
if (headingBeginRegex.test(line)) {
|
8832
|
+
break;
|
8833
|
+
}
|
8834
|
+
if (hrRegex.test(line)) {
|
8835
|
+
break;
|
8836
|
+
}
|
8837
|
+
itemContents += "\n" + nextLine;
|
8838
|
+
}
|
8839
|
+
if (!blankLine && !nextLine.trim()) {
|
8840
|
+
blankLine = true;
|
8841
|
+
}
|
8842
|
+
raw += rawLine + "\n";
|
8843
|
+
src = src.substring(rawLine.length + 1);
|
8844
|
+
line = nextLine.slice(indent);
|
8845
|
+
}
|
8846
|
+
}
|
8847
|
+
if (!list2.loose) {
|
8848
|
+
if (endsWithBlankLine) {
|
8849
|
+
list2.loose = true;
|
8850
|
+
} else if (/\n *\n *$/.test(raw)) {
|
8851
|
+
endsWithBlankLine = true;
|
8852
|
+
}
|
8853
|
+
}
|
8854
|
+
let istask = null;
|
8855
|
+
let ischecked;
|
8856
|
+
if (this.options.gfm) {
|
8857
|
+
istask = /^\[[ xX]\] /.exec(itemContents);
|
8858
|
+
if (istask) {
|
8859
|
+
ischecked = istask[0] !== "[ ] ";
|
8860
|
+
itemContents = itemContents.replace(/^\[[ xX]\] +/, "");
|
8861
|
+
}
|
8862
|
+
}
|
8863
|
+
list2.items.push({
|
8864
|
+
type: "list_item",
|
8865
|
+
raw,
|
8866
|
+
task: !!istask,
|
8867
|
+
checked: ischecked,
|
8868
|
+
loose: false,
|
8869
|
+
text: itemContents,
|
8870
|
+
tokens: []
|
8871
|
+
});
|
8872
|
+
list2.raw += raw;
|
8873
|
+
}
|
8874
|
+
list2.items[list2.items.length - 1].raw = list2.items[list2.items.length - 1].raw.trimEnd();
|
8875
|
+
list2.items[list2.items.length - 1].text = list2.items[list2.items.length - 1].text.trimEnd();
|
8876
|
+
list2.raw = list2.raw.trimEnd();
|
8877
|
+
for (let i = 0; i < list2.items.length; i++) {
|
8878
|
+
this.lexer.state.top = false;
|
8879
|
+
list2.items[i].tokens = this.lexer.blockTokens(list2.items[i].text, []);
|
8880
|
+
if (!list2.loose) {
|
8881
|
+
const spacers = list2.items[i].tokens.filter((t) => t.type === "space");
|
8882
|
+
const hasMultipleLineBreaks = spacers.length > 0 && spacers.some((t) => /\n.*\n/.test(t.raw));
|
8883
|
+
list2.loose = hasMultipleLineBreaks;
|
8884
|
+
}
|
8885
|
+
}
|
8886
|
+
if (list2.loose) {
|
8887
|
+
for (let i = 0; i < list2.items.length; i++) {
|
8888
|
+
list2.items[i].loose = true;
|
8889
|
+
}
|
8890
|
+
}
|
8891
|
+
return list2;
|
8892
|
+
}
|
8893
|
+
}
|
8894
|
+
html(src) {
|
8895
|
+
const cap = this.rules.block.html.exec(src);
|
8896
|
+
if (cap) {
|
8897
|
+
const token = {
|
8898
|
+
type: "html",
|
8899
|
+
block: true,
|
8900
|
+
raw: cap[0],
|
8901
|
+
pre: cap[1] === "pre" || cap[1] === "script" || cap[1] === "style",
|
8902
|
+
text: cap[0]
|
8903
|
+
};
|
8904
|
+
return token;
|
8905
|
+
}
|
8906
|
+
}
|
8907
|
+
def(src) {
|
8908
|
+
const cap = this.rules.block.def.exec(src);
|
8909
|
+
if (cap) {
|
8910
|
+
const tag2 = cap[1].toLowerCase().replace(/\s+/g, " ");
|
8911
|
+
const href = cap[2] ? cap[2].replace(/^<(.*)>$/, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "";
|
8912
|
+
const title = cap[3] ? cap[3].substring(1, cap[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : cap[3];
|
8913
|
+
return {
|
8914
|
+
type: "def",
|
8915
|
+
tag: tag2,
|
8916
|
+
raw: cap[0],
|
8917
|
+
href,
|
8918
|
+
title
|
8919
|
+
};
|
8920
|
+
}
|
8921
|
+
}
|
8922
|
+
table(src) {
|
8923
|
+
const cap = this.rules.block.table.exec(src);
|
8924
|
+
if (!cap) {
|
8925
|
+
return;
|
8926
|
+
}
|
8927
|
+
if (!/[:|]/.test(cap[2])) {
|
8928
|
+
return;
|
8929
|
+
}
|
8930
|
+
const headers = splitCells(cap[1]);
|
8931
|
+
const aligns = cap[2].replace(/^\||\| *$/g, "").split("|");
|
8932
|
+
const rows = cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, "").split("\n") : [];
|
8933
|
+
const item = {
|
8934
|
+
type: "table",
|
8935
|
+
raw: cap[0],
|
8936
|
+
header: [],
|
8937
|
+
align: [],
|
8938
|
+
rows: []
|
8939
|
+
};
|
8940
|
+
if (headers.length !== aligns.length) {
|
8941
|
+
return;
|
8942
|
+
}
|
8943
|
+
for (const align of aligns) {
|
8944
|
+
if (/^ *-+: *$/.test(align)) {
|
8945
|
+
item.align.push("right");
|
8946
|
+
} else if (/^ *:-+: *$/.test(align)) {
|
8947
|
+
item.align.push("center");
|
8948
|
+
} else if (/^ *:-+ *$/.test(align)) {
|
8949
|
+
item.align.push("left");
|
8950
|
+
} else {
|
8951
|
+
item.align.push(null);
|
8952
|
+
}
|
8953
|
+
}
|
8954
|
+
for (let i = 0; i < headers.length; i++) {
|
8955
|
+
item.header.push({
|
8956
|
+
text: headers[i],
|
8957
|
+
tokens: this.lexer.inline(headers[i]),
|
8958
|
+
header: true,
|
8959
|
+
align: item.align[i]
|
8960
|
+
});
|
8961
|
+
}
|
8962
|
+
for (const row of rows) {
|
8963
|
+
item.rows.push(splitCells(row, item.header.length).map((cell, i) => {
|
8964
|
+
return {
|
8965
|
+
text: cell,
|
8966
|
+
tokens: this.lexer.inline(cell),
|
8967
|
+
header: false,
|
8968
|
+
align: item.align[i]
|
8969
|
+
};
|
8970
|
+
}));
|
8971
|
+
}
|
8972
|
+
return item;
|
8973
|
+
}
|
8974
|
+
lheading(src) {
|
8975
|
+
const cap = this.rules.block.lheading.exec(src);
|
8976
|
+
if (cap) {
|
8977
|
+
return {
|
8978
|
+
type: "heading",
|
8979
|
+
raw: cap[0],
|
8980
|
+
depth: cap[2].charAt(0) === "=" ? 1 : 2,
|
8981
|
+
text: cap[1],
|
8982
|
+
tokens: this.lexer.inline(cap[1])
|
8983
|
+
};
|
8984
|
+
}
|
8985
|
+
}
|
8986
|
+
paragraph(src) {
|
8987
|
+
const cap = this.rules.block.paragraph.exec(src);
|
8988
|
+
if (cap) {
|
8989
|
+
const text2 = cap[1].charAt(cap[1].length - 1) === "\n" ? cap[1].slice(0, -1) : cap[1];
|
8990
|
+
return {
|
8991
|
+
type: "paragraph",
|
8992
|
+
raw: cap[0],
|
8993
|
+
text: text2,
|
8994
|
+
tokens: this.lexer.inline(text2)
|
8995
|
+
};
|
8996
|
+
}
|
8997
|
+
}
|
8998
|
+
text(src) {
|
8999
|
+
const cap = this.rules.block.text.exec(src);
|
9000
|
+
if (cap) {
|
9001
|
+
return {
|
9002
|
+
type: "text",
|
9003
|
+
raw: cap[0],
|
9004
|
+
text: cap[0],
|
9005
|
+
tokens: this.lexer.inline(cap[0])
|
9006
|
+
};
|
9007
|
+
}
|
9008
|
+
}
|
9009
|
+
escape(src) {
|
9010
|
+
const cap = this.rules.inline.escape.exec(src);
|
9011
|
+
if (cap) {
|
9012
|
+
return {
|
9013
|
+
type: "escape",
|
9014
|
+
raw: cap[0],
|
9015
|
+
text: escape$1(cap[1])
|
9016
|
+
};
|
9017
|
+
}
|
9018
|
+
}
|
9019
|
+
tag(src) {
|
9020
|
+
const cap = this.rules.inline.tag.exec(src);
|
9021
|
+
if (cap) {
|
9022
|
+
if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
|
9023
|
+
this.lexer.state.inLink = true;
|
9024
|
+
} else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
|
9025
|
+
this.lexer.state.inLink = false;
|
9026
|
+
}
|
9027
|
+
if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
9028
|
+
this.lexer.state.inRawBlock = true;
|
9029
|
+
} else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
|
9030
|
+
this.lexer.state.inRawBlock = false;
|
9031
|
+
}
|
9032
|
+
return {
|
9033
|
+
type: "html",
|
9034
|
+
raw: cap[0],
|
9035
|
+
inLink: this.lexer.state.inLink,
|
9036
|
+
inRawBlock: this.lexer.state.inRawBlock,
|
9037
|
+
block: false,
|
9038
|
+
text: cap[0]
|
9039
|
+
};
|
9040
|
+
}
|
9041
|
+
}
|
9042
|
+
link(src) {
|
9043
|
+
const cap = this.rules.inline.link.exec(src);
|
9044
|
+
if (cap) {
|
9045
|
+
const trimmedUrl = cap[2].trim();
|
9046
|
+
if (!this.options.pedantic && /^</.test(trimmedUrl)) {
|
9047
|
+
if (!/>$/.test(trimmedUrl)) {
|
9048
|
+
return;
|
9049
|
+
}
|
9050
|
+
const rtrimSlash = rtrim(trimmedUrl.slice(0, -1), "\\");
|
9051
|
+
if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
|
9052
|
+
return;
|
9053
|
+
}
|
9054
|
+
} else {
|
9055
|
+
const lastParenIndex = findClosingBracket(cap[2], "()");
|
9056
|
+
if (lastParenIndex > -1) {
|
9057
|
+
const start3 = cap[0].indexOf("!") === 0 ? 5 : 4;
|
9058
|
+
const linkLen = start3 + cap[1].length + lastParenIndex;
|
9059
|
+
cap[2] = cap[2].substring(0, lastParenIndex);
|
9060
|
+
cap[0] = cap[0].substring(0, linkLen).trim();
|
9061
|
+
cap[3] = "";
|
9062
|
+
}
|
9063
|
+
}
|
9064
|
+
let href = cap[2];
|
9065
|
+
let title = "";
|
9066
|
+
if (this.options.pedantic) {
|
9067
|
+
const link2 = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
|
9068
|
+
if (link2) {
|
9069
|
+
href = link2[1];
|
9070
|
+
title = link2[3];
|
9071
|
+
}
|
9072
|
+
} else {
|
9073
|
+
title = cap[3] ? cap[3].slice(1, -1) : "";
|
9074
|
+
}
|
9075
|
+
href = href.trim();
|
9076
|
+
if (/^</.test(href)) {
|
9077
|
+
if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
|
9078
|
+
href = href.slice(1);
|
9079
|
+
} else {
|
9080
|
+
href = href.slice(1, -1);
|
9081
|
+
}
|
9082
|
+
}
|
9083
|
+
return outputLink(cap, {
|
9084
|
+
href: href ? href.replace(this.rules.inline.anyPunctuation, "$1") : href,
|
9085
|
+
title: title ? title.replace(this.rules.inline.anyPunctuation, "$1") : title
|
9086
|
+
}, cap[0], this.lexer);
|
9087
|
+
}
|
9088
|
+
}
|
9089
|
+
reflink(src, links) {
|
9090
|
+
let cap;
|
9091
|
+
if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
|
9092
|
+
const linkString = (cap[2] || cap[1]).replace(/\s+/g, " ");
|
9093
|
+
const link2 = links[linkString.toLowerCase()];
|
9094
|
+
if (!link2) {
|
9095
|
+
const text2 = cap[0].charAt(0);
|
9096
|
+
return {
|
9097
|
+
type: "text",
|
9098
|
+
raw: text2,
|
9099
|
+
text: text2
|
9100
|
+
};
|
9101
|
+
}
|
9102
|
+
return outputLink(cap, link2, cap[0], this.lexer);
|
9103
|
+
}
|
9104
|
+
}
|
9105
|
+
emStrong(src, maskedSrc, prevChar = "") {
|
9106
|
+
let match = this.rules.inline.emStrongLDelim.exec(src);
|
9107
|
+
if (!match)
|
9108
|
+
return;
|
9109
|
+
if (match[3] && prevChar.match(/[\p{L}\p{N}]/u))
|
9110
|
+
return;
|
9111
|
+
const nextChar = match[1] || match[2] || "";
|
9112
|
+
if (!nextChar || !prevChar || this.rules.inline.punctuation.exec(prevChar)) {
|
9113
|
+
const lLength = [...match[0]].length - 1;
|
9114
|
+
let rDelim, rLength, delimTotal = lLength, midDelimTotal = 0;
|
9115
|
+
const endReg = match[0][0] === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
|
9116
|
+
endReg.lastIndex = 0;
|
9117
|
+
maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
|
9118
|
+
while ((match = endReg.exec(maskedSrc)) != null) {
|
9119
|
+
rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
|
9120
|
+
if (!rDelim)
|
9121
|
+
continue;
|
9122
|
+
rLength = [...rDelim].length;
|
9123
|
+
if (match[3] || match[4]) {
|
9124
|
+
delimTotal += rLength;
|
9125
|
+
continue;
|
9126
|
+
} else if (match[5] || match[6]) {
|
9127
|
+
if (lLength % 3 && !((lLength + rLength) % 3)) {
|
9128
|
+
midDelimTotal += rLength;
|
9129
|
+
continue;
|
9130
|
+
}
|
9131
|
+
}
|
9132
|
+
delimTotal -= rLength;
|
9133
|
+
if (delimTotal > 0)
|
9134
|
+
continue;
|
9135
|
+
rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal);
|
9136
|
+
const lastCharLength = [...match[0]][0].length;
|
9137
|
+
const raw = src.slice(0, lLength + match.index + lastCharLength + rLength);
|
9138
|
+
if (Math.min(lLength, rLength) % 2) {
|
9139
|
+
const text3 = raw.slice(1, -1);
|
9140
|
+
return {
|
9141
|
+
type: "em",
|
9142
|
+
raw,
|
9143
|
+
text: text3,
|
9144
|
+
tokens: this.lexer.inlineTokens(text3)
|
9145
|
+
};
|
9146
|
+
}
|
9147
|
+
const text2 = raw.slice(2, -2);
|
9148
|
+
return {
|
9149
|
+
type: "strong",
|
9150
|
+
raw,
|
9151
|
+
text: text2,
|
9152
|
+
tokens: this.lexer.inlineTokens(text2)
|
9153
|
+
};
|
9154
|
+
}
|
9155
|
+
}
|
9156
|
+
}
|
9157
|
+
codespan(src) {
|
9158
|
+
const cap = this.rules.inline.code.exec(src);
|
9159
|
+
if (cap) {
|
9160
|
+
let text2 = cap[2].replace(/\n/g, " ");
|
9161
|
+
const hasNonSpaceChars = /[^ ]/.test(text2);
|
9162
|
+
const hasSpaceCharsOnBothEnds = /^ /.test(text2) && / $/.test(text2);
|
9163
|
+
if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
|
9164
|
+
text2 = text2.substring(1, text2.length - 1);
|
9165
|
+
}
|
9166
|
+
text2 = escape$1(text2, true);
|
9167
|
+
return {
|
9168
|
+
type: "codespan",
|
9169
|
+
raw: cap[0],
|
9170
|
+
text: text2
|
9171
|
+
};
|
9172
|
+
}
|
9173
|
+
}
|
9174
|
+
br(src) {
|
9175
|
+
const cap = this.rules.inline.br.exec(src);
|
9176
|
+
if (cap) {
|
9177
|
+
return {
|
9178
|
+
type: "br",
|
9179
|
+
raw: cap[0]
|
9180
|
+
};
|
9181
|
+
}
|
9182
|
+
}
|
9183
|
+
del(src) {
|
9184
|
+
const cap = this.rules.inline.del.exec(src);
|
9185
|
+
if (cap) {
|
9186
|
+
return {
|
9187
|
+
type: "del",
|
9188
|
+
raw: cap[0],
|
9189
|
+
text: cap[2],
|
9190
|
+
tokens: this.lexer.inlineTokens(cap[2])
|
9191
|
+
};
|
9192
|
+
}
|
9193
|
+
}
|
9194
|
+
autolink(src) {
|
9195
|
+
const cap = this.rules.inline.autolink.exec(src);
|
9196
|
+
if (cap) {
|
9197
|
+
let text2, href;
|
9198
|
+
if (cap[2] === "@") {
|
9199
|
+
text2 = escape$1(cap[1]);
|
9200
|
+
href = "mailto:" + text2;
|
9201
|
+
} else {
|
9202
|
+
text2 = escape$1(cap[1]);
|
9203
|
+
href = text2;
|
9204
|
+
}
|
9205
|
+
return {
|
9206
|
+
type: "link",
|
9207
|
+
raw: cap[0],
|
9208
|
+
text: text2,
|
9209
|
+
href,
|
9210
|
+
tokens: [
|
9211
|
+
{
|
9212
|
+
type: "text",
|
9213
|
+
raw: text2,
|
9214
|
+
text: text2
|
9215
|
+
}
|
9216
|
+
]
|
9217
|
+
};
|
9218
|
+
}
|
9219
|
+
}
|
9220
|
+
url(src) {
|
9221
|
+
let cap;
|
9222
|
+
if (cap = this.rules.inline.url.exec(src)) {
|
9223
|
+
let text2, href;
|
9224
|
+
if (cap[2] === "@") {
|
9225
|
+
text2 = escape$1(cap[0]);
|
9226
|
+
href = "mailto:" + text2;
|
9227
|
+
} else {
|
9228
|
+
let prevCapZero;
|
9229
|
+
do {
|
9230
|
+
prevCapZero = cap[0];
|
9231
|
+
cap[0] = this.rules.inline._backpedal.exec(cap[0])?.[0] ?? "";
|
9232
|
+
} while (prevCapZero !== cap[0]);
|
9233
|
+
text2 = escape$1(cap[0]);
|
9234
|
+
if (cap[1] === "www.") {
|
9235
|
+
href = "http://" + cap[0];
|
9236
|
+
} else {
|
9237
|
+
href = cap[0];
|
9238
|
+
}
|
9239
|
+
}
|
9240
|
+
return {
|
9241
|
+
type: "link",
|
9242
|
+
raw: cap[0],
|
9243
|
+
text: text2,
|
9244
|
+
href,
|
9245
|
+
tokens: [
|
9246
|
+
{
|
9247
|
+
type: "text",
|
9248
|
+
raw: text2,
|
9249
|
+
text: text2
|
9250
|
+
}
|
9251
|
+
]
|
9252
|
+
};
|
9253
|
+
}
|
9254
|
+
}
|
9255
|
+
inlineText(src) {
|
9256
|
+
const cap = this.rules.inline.text.exec(src);
|
9257
|
+
if (cap) {
|
9258
|
+
let text2;
|
9259
|
+
if (this.lexer.state.inRawBlock) {
|
9260
|
+
text2 = cap[0];
|
9261
|
+
} else {
|
9262
|
+
text2 = escape$1(cap[0]);
|
9263
|
+
}
|
9264
|
+
return {
|
9265
|
+
type: "text",
|
9266
|
+
raw: cap[0],
|
9267
|
+
text: text2
|
9268
|
+
};
|
9269
|
+
}
|
9270
|
+
}
|
9271
|
+
};
|
9272
|
+
var newline = /^(?: *(?:\n|$))+/;
|
9273
|
+
var blockCode = /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/;
|
9274
|
+
var fences = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/;
|
9275
|
+
var hr = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
|
9276
|
+
var heading = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
|
9277
|
+
var bullet = /(?:[*+-]|\d{1,9}[.)])/;
|
9278
|
+
var lheading = edit(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g, bullet).replace(/blockCode/g, / {4}/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}/).replace(/html/g, / {0,3}<[^\n>]+>\n/).getRegex();
|
9279
|
+
var _paragraph = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/;
|
9280
|
+
var blockText = /^[^\n]+/;
|
9281
|
+
var _blockLabel = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
|
9282
|
+
var def = edit(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace("label", _blockLabel).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex();
|
9283
|
+
var list = edit(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g, bullet).getRegex();
|
9284
|
+
var _tag = "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";
|
9285
|
+
var _comment = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
|
9286
|
+
var html2 = edit("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))", "i").replace("comment", _comment).replace("tag", _tag).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
|
9287
|
+
var paragraph = edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
9288
|
+
var blockquote = edit(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", paragraph).getRegex();
|
9289
|
+
var blockNormal = {
|
9290
|
+
blockquote,
|
9291
|
+
code: blockCode,
|
9292
|
+
def,
|
9293
|
+
fences,
|
9294
|
+
heading,
|
9295
|
+
hr,
|
9296
|
+
html: html2,
|
9297
|
+
lheading,
|
9298
|
+
list,
|
9299
|
+
newline,
|
9300
|
+
paragraph,
|
9301
|
+
table: noopTest,
|
9302
|
+
text: blockText
|
9303
|
+
};
|
9304
|
+
var gfmTable = edit("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", " {4}[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex();
|
9305
|
+
var blockGfm = {
|
9306
|
+
...blockNormal,
|
9307
|
+
table: gfmTable,
|
9308
|
+
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", gfmTable).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)]) ").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", _tag).getRegex()
|
9309
|
+
};
|
9310
|
+
var blockPedantic = {
|
9311
|
+
...blockNormal,
|
9312
|
+
html: edit(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", _comment).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(),
|
9313
|
+
def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
|
9314
|
+
heading: /^(#{1,6})(.*)(?:\n+|$)/,
|
9315
|
+
fences: noopTest,
|
9316
|
+
// fences not supported
|
9317
|
+
lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
|
9318
|
+
paragraph: edit(_paragraph).replace("hr", hr).replace("heading", " *#{1,6} *[^\n]").replace("lheading", lheading).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
|
9319
|
+
};
|
9320
|
+
var escape = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
|
9321
|
+
var inlineCode = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
|
9322
|
+
var br = /^( {2,}|\\)\n(?!\s*$)/;
|
9323
|
+
var inlineText = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
|
9324
|
+
var _punctuation = "\\p{P}\\p{S}";
|
9325
|
+
var punctuation = edit(/^((?![*_])[\spunctuation])/, "u").replace(/punctuation/g, _punctuation).getRegex();
|
9326
|
+
var blockSkip = /\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g;
|
9327
|
+
var emStrongLDelim = edit(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/, "u").replace(/punct/g, _punctuation).getRegex();
|
9328
|
+
var emStrongRDelimAst = edit("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])", "gu").replace(/punct/g, _punctuation).getRegex();
|
9329
|
+
var emStrongRDelimUnd = edit("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])", "gu").replace(/punct/g, _punctuation).getRegex();
|
9330
|
+
var anyPunctuation = edit(/\\([punct])/, "gu").replace(/punct/g, _punctuation).getRegex();
|
9331
|
+
var autolink = edit(/^<(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();
|
9332
|
+
var _inlineComment = edit(_comment).replace("(?:-->|$)", "-->").getRegex();
|
9333
|
+
var tag = edit("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", _inlineComment).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
|
9334
|
+
var _inlineLabel = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
|
9335
|
+
var link = edit(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label", _inlineLabel).replace("href", /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
|
9336
|
+
var reflink = edit(/^!?\[(label)\]\[(ref)\]/).replace("label", _inlineLabel).replace("ref", _blockLabel).getRegex();
|
9337
|
+
var nolink = edit(/^!?\[(ref)\](?:\[\])?/).replace("ref", _blockLabel).getRegex();
|
9338
|
+
var reflinkSearch = edit("reflink|nolink(?!\\()", "g").replace("reflink", reflink).replace("nolink", nolink).getRegex();
|
9339
|
+
var inlineNormal = {
|
9340
|
+
_backpedal: noopTest,
|
9341
|
+
// only used for GFM url
|
9342
|
+
anyPunctuation,
|
9343
|
+
autolink,
|
9344
|
+
blockSkip,
|
9345
|
+
br,
|
9346
|
+
code: inlineCode,
|
9347
|
+
del: noopTest,
|
9348
|
+
emStrongLDelim,
|
9349
|
+
emStrongRDelimAst,
|
9350
|
+
emStrongRDelimUnd,
|
9351
|
+
escape,
|
9352
|
+
link,
|
9353
|
+
nolink,
|
9354
|
+
punctuation,
|
9355
|
+
reflink,
|
9356
|
+
reflinkSearch,
|
9357
|
+
tag,
|
9358
|
+
text: inlineText,
|
9359
|
+
url: noopTest
|
9360
|
+
};
|
9361
|
+
var inlinePedantic = {
|
9362
|
+
...inlineNormal,
|
9363
|
+
link: edit(/^!?\[(label)\]\((.*?)\)/).replace("label", _inlineLabel).getRegex(),
|
9364
|
+
reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", _inlineLabel).getRegex()
|
9365
|
+
};
|
9366
|
+
var inlineGfm = {
|
9367
|
+
...inlineNormal,
|
9368
|
+
escape: edit(escape).replace("])", "~|])").getRegex(),
|
9369
|
+
url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, "i").replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
|
9370
|
+
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
9371
|
+
del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
|
9372
|
+
text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
|
9373
|
+
};
|
9374
|
+
var inlineBreaks = {
|
9375
|
+
...inlineGfm,
|
9376
|
+
br: edit(br).replace("{2,}", "*").getRegex(),
|
9377
|
+
text: edit(inlineGfm.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
|
9378
|
+
};
|
9379
|
+
var block = {
|
9380
|
+
normal: blockNormal,
|
9381
|
+
gfm: blockGfm,
|
9382
|
+
pedantic: blockPedantic
|
9383
|
+
};
|
9384
|
+
var inline = {
|
9385
|
+
normal: inlineNormal,
|
9386
|
+
gfm: inlineGfm,
|
9387
|
+
breaks: inlineBreaks,
|
9388
|
+
pedantic: inlinePedantic
|
9389
|
+
};
|
9390
|
+
var _Lexer = class __Lexer {
|
9391
|
+
tokens;
|
9392
|
+
options;
|
9393
|
+
state;
|
9394
|
+
tokenizer;
|
9395
|
+
inlineQueue;
|
9396
|
+
constructor(options2) {
|
9397
|
+
this.tokens = [];
|
9398
|
+
this.tokens.links = /* @__PURE__ */ Object.create(null);
|
9399
|
+
this.options = options2 || _defaults;
|
9400
|
+
this.options.tokenizer = this.options.tokenizer || new _Tokenizer();
|
9401
|
+
this.tokenizer = this.options.tokenizer;
|
9402
|
+
this.tokenizer.options = this.options;
|
9403
|
+
this.tokenizer.lexer = this;
|
9404
|
+
this.inlineQueue = [];
|
9405
|
+
this.state = {
|
9406
|
+
inLink: false,
|
9407
|
+
inRawBlock: false,
|
9408
|
+
top: true
|
9409
|
+
};
|
9410
|
+
const rules = {
|
9411
|
+
block: block.normal,
|
9412
|
+
inline: inline.normal
|
9413
|
+
};
|
9414
|
+
if (this.options.pedantic) {
|
9415
|
+
rules.block = block.pedantic;
|
9416
|
+
rules.inline = inline.pedantic;
|
9417
|
+
} else if (this.options.gfm) {
|
9418
|
+
rules.block = block.gfm;
|
9419
|
+
if (this.options.breaks) {
|
9420
|
+
rules.inline = inline.breaks;
|
9421
|
+
} else {
|
9422
|
+
rules.inline = inline.gfm;
|
9423
|
+
}
|
9424
|
+
}
|
9425
|
+
this.tokenizer.rules = rules;
|
9426
|
+
}
|
9427
|
+
/**
|
9428
|
+
* Expose Rules
|
9429
|
+
*/
|
9430
|
+
static get rules() {
|
9431
|
+
return {
|
9432
|
+
block,
|
9433
|
+
inline
|
9434
|
+
};
|
9435
|
+
}
|
9436
|
+
/**
|
9437
|
+
* Static Lex Method
|
9438
|
+
*/
|
9439
|
+
static lex(src, options2) {
|
9440
|
+
const lexer2 = new __Lexer(options2);
|
9441
|
+
return lexer2.lex(src);
|
9442
|
+
}
|
9443
|
+
/**
|
9444
|
+
* Static Lex Inline Method
|
9445
|
+
*/
|
9446
|
+
static lexInline(src, options2) {
|
9447
|
+
const lexer2 = new __Lexer(options2);
|
9448
|
+
return lexer2.inlineTokens(src);
|
9449
|
+
}
|
9450
|
+
/**
|
9451
|
+
* Preprocessing
|
9452
|
+
*/
|
9453
|
+
lex(src) {
|
9454
|
+
src = src.replace(/\r\n|\r/g, "\n");
|
9455
|
+
this.blockTokens(src, this.tokens);
|
9456
|
+
for (let i = 0; i < this.inlineQueue.length; i++) {
|
9457
|
+
const next = this.inlineQueue[i];
|
9458
|
+
this.inlineTokens(next.src, next.tokens);
|
9459
|
+
}
|
9460
|
+
this.inlineQueue = [];
|
9461
|
+
return this.tokens;
|
9462
|
+
}
|
9463
|
+
blockTokens(src, tokens = [], lastParagraphClipped = false) {
|
9464
|
+
if (this.options.pedantic) {
|
9465
|
+
src = src.replace(/\t/g, " ").replace(/^ +$/gm, "");
|
9466
|
+
} else {
|
9467
|
+
src = src.replace(/^( *)(\t+)/gm, (_, leading, tabs) => {
|
9468
|
+
return leading + " ".repeat(tabs.length);
|
9469
|
+
});
|
9470
|
+
}
|
9471
|
+
let token;
|
9472
|
+
let lastToken;
|
9473
|
+
let cutSrc;
|
9474
|
+
while (src) {
|
9475
|
+
if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some((extTokenizer) => {
|
9476
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
9477
|
+
src = src.substring(token.raw.length);
|
9478
|
+
tokens.push(token);
|
9479
|
+
return true;
|
9480
|
+
}
|
9481
|
+
return false;
|
9482
|
+
})) {
|
9483
|
+
continue;
|
9484
|
+
}
|
9485
|
+
if (token = this.tokenizer.space(src)) {
|
9486
|
+
src = src.substring(token.raw.length);
|
9487
|
+
if (token.raw.length === 1 && tokens.length > 0) {
|
9488
|
+
tokens[tokens.length - 1].raw += "\n";
|
9489
|
+
} else {
|
9490
|
+
tokens.push(token);
|
9491
|
+
}
|
9492
|
+
continue;
|
9493
|
+
}
|
9494
|
+
if (token = this.tokenizer.code(src)) {
|
9495
|
+
src = src.substring(token.raw.length);
|
9496
|
+
lastToken = tokens[tokens.length - 1];
|
9497
|
+
if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
|
9498
|
+
lastToken.raw += "\n" + token.raw;
|
9499
|
+
lastToken.text += "\n" + token.text;
|
9500
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
9501
|
+
} else {
|
9502
|
+
tokens.push(token);
|
9503
|
+
}
|
9504
|
+
continue;
|
9505
|
+
}
|
9506
|
+
if (token = this.tokenizer.fences(src)) {
|
9507
|
+
src = src.substring(token.raw.length);
|
9508
|
+
tokens.push(token);
|
9509
|
+
continue;
|
9510
|
+
}
|
9511
|
+
if (token = this.tokenizer.heading(src)) {
|
9512
|
+
src = src.substring(token.raw.length);
|
9513
|
+
tokens.push(token);
|
9514
|
+
continue;
|
9515
|
+
}
|
9516
|
+
if (token = this.tokenizer.hr(src)) {
|
9517
|
+
src = src.substring(token.raw.length);
|
9518
|
+
tokens.push(token);
|
9519
|
+
continue;
|
9520
|
+
}
|
9521
|
+
if (token = this.tokenizer.blockquote(src)) {
|
9522
|
+
src = src.substring(token.raw.length);
|
9523
|
+
tokens.push(token);
|
9524
|
+
continue;
|
9525
|
+
}
|
9526
|
+
if (token = this.tokenizer.list(src)) {
|
9527
|
+
src = src.substring(token.raw.length);
|
9528
|
+
tokens.push(token);
|
9529
|
+
continue;
|
9530
|
+
}
|
9531
|
+
if (token = this.tokenizer.html(src)) {
|
9532
|
+
src = src.substring(token.raw.length);
|
9533
|
+
tokens.push(token);
|
9534
|
+
continue;
|
9535
|
+
}
|
9536
|
+
if (token = this.tokenizer.def(src)) {
|
9537
|
+
src = src.substring(token.raw.length);
|
9538
|
+
lastToken = tokens[tokens.length - 1];
|
9539
|
+
if (lastToken && (lastToken.type === "paragraph" || lastToken.type === "text")) {
|
9540
|
+
lastToken.raw += "\n" + token.raw;
|
9541
|
+
lastToken.text += "\n" + token.raw;
|
9542
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
9543
|
+
} else if (!this.tokens.links[token.tag]) {
|
9544
|
+
this.tokens.links[token.tag] = {
|
9545
|
+
href: token.href,
|
9546
|
+
title: token.title
|
9547
|
+
};
|
9548
|
+
}
|
9549
|
+
continue;
|
9550
|
+
}
|
9551
|
+
if (token = this.tokenizer.table(src)) {
|
9552
|
+
src = src.substring(token.raw.length);
|
9553
|
+
tokens.push(token);
|
9554
|
+
continue;
|
9555
|
+
}
|
9556
|
+
if (token = this.tokenizer.lheading(src)) {
|
9557
|
+
src = src.substring(token.raw.length);
|
9558
|
+
tokens.push(token);
|
9559
|
+
continue;
|
9560
|
+
}
|
9561
|
+
cutSrc = src;
|
9562
|
+
if (this.options.extensions && this.options.extensions.startBlock) {
|
9563
|
+
let startIndex = Infinity;
|
9564
|
+
const tempSrc = src.slice(1);
|
9565
|
+
let tempStart;
|
9566
|
+
this.options.extensions.startBlock.forEach((getStartIndex) => {
|
9567
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
9568
|
+
if (typeof tempStart === "number" && tempStart >= 0) {
|
9569
|
+
startIndex = Math.min(startIndex, tempStart);
|
9570
|
+
}
|
9571
|
+
});
|
9572
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
9573
|
+
cutSrc = src.substring(0, startIndex + 1);
|
9574
|
+
}
|
9575
|
+
}
|
9576
|
+
if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
|
9577
|
+
lastToken = tokens[tokens.length - 1];
|
9578
|
+
if (lastParagraphClipped && lastToken?.type === "paragraph") {
|
9579
|
+
lastToken.raw += "\n" + token.raw;
|
9580
|
+
lastToken.text += "\n" + token.text;
|
9581
|
+
this.inlineQueue.pop();
|
9582
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
9583
|
+
} else {
|
9584
|
+
tokens.push(token);
|
9585
|
+
}
|
9586
|
+
lastParagraphClipped = cutSrc.length !== src.length;
|
9587
|
+
src = src.substring(token.raw.length);
|
9588
|
+
continue;
|
9589
|
+
}
|
9590
|
+
if (token = this.tokenizer.text(src)) {
|
9591
|
+
src = src.substring(token.raw.length);
|
9592
|
+
lastToken = tokens[tokens.length - 1];
|
9593
|
+
if (lastToken && lastToken.type === "text") {
|
9594
|
+
lastToken.raw += "\n" + token.raw;
|
9595
|
+
lastToken.text += "\n" + token.text;
|
9596
|
+
this.inlineQueue.pop();
|
9597
|
+
this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
|
9598
|
+
} else {
|
9599
|
+
tokens.push(token);
|
9600
|
+
}
|
9601
|
+
continue;
|
9602
|
+
}
|
9603
|
+
if (src) {
|
9604
|
+
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
9605
|
+
if (this.options.silent) {
|
9606
|
+
console.error(errMsg);
|
9607
|
+
break;
|
9608
|
+
} else {
|
9609
|
+
throw new Error(errMsg);
|
9610
|
+
}
|
9611
|
+
}
|
9612
|
+
}
|
9613
|
+
this.state.top = true;
|
9614
|
+
return tokens;
|
9615
|
+
}
|
9616
|
+
inline(src, tokens = []) {
|
9617
|
+
this.inlineQueue.push({ src, tokens });
|
9618
|
+
return tokens;
|
9619
|
+
}
|
9620
|
+
/**
|
9621
|
+
* Lexing/Compiling
|
9622
|
+
*/
|
9623
|
+
inlineTokens(src, tokens = []) {
|
9624
|
+
let token, lastToken, cutSrc;
|
9625
|
+
let maskedSrc = src;
|
9626
|
+
let match;
|
9627
|
+
let keepPrevChar, prevChar;
|
9628
|
+
if (this.tokens.links) {
|
9629
|
+
const links = Object.keys(this.tokens.links);
|
9630
|
+
if (links.length > 0) {
|
9631
|
+
while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
|
9632
|
+
if (links.includes(match[0].slice(match[0].lastIndexOf("[") + 1, -1))) {
|
9633
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
|
9634
|
+
}
|
9635
|
+
}
|
9636
|
+
}
|
9637
|
+
}
|
9638
|
+
while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
|
9639
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "[" + "a".repeat(match[0].length - 2) + "]" + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
|
9640
|
+
}
|
9641
|
+
while ((match = this.tokenizer.rules.inline.anyPunctuation.exec(maskedSrc)) != null) {
|
9642
|
+
maskedSrc = maskedSrc.slice(0, match.index) + "++" + maskedSrc.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);
|
9643
|
+
}
|
9644
|
+
while (src) {
|
9645
|
+
if (!keepPrevChar) {
|
9646
|
+
prevChar = "";
|
9647
|
+
}
|
9648
|
+
keepPrevChar = false;
|
9649
|
+
if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some((extTokenizer) => {
|
9650
|
+
if (token = extTokenizer.call({ lexer: this }, src, tokens)) {
|
9651
|
+
src = src.substring(token.raw.length);
|
9652
|
+
tokens.push(token);
|
9653
|
+
return true;
|
9654
|
+
}
|
9655
|
+
return false;
|
9656
|
+
})) {
|
9657
|
+
continue;
|
9658
|
+
}
|
9659
|
+
if (token = this.tokenizer.escape(src)) {
|
9660
|
+
src = src.substring(token.raw.length);
|
9661
|
+
tokens.push(token);
|
9662
|
+
continue;
|
9663
|
+
}
|
9664
|
+
if (token = this.tokenizer.tag(src)) {
|
9665
|
+
src = src.substring(token.raw.length);
|
9666
|
+
lastToken = tokens[tokens.length - 1];
|
9667
|
+
if (lastToken && token.type === "text" && lastToken.type === "text") {
|
9668
|
+
lastToken.raw += token.raw;
|
9669
|
+
lastToken.text += token.text;
|
9670
|
+
} else {
|
9671
|
+
tokens.push(token);
|
9672
|
+
}
|
9673
|
+
continue;
|
9674
|
+
}
|
9675
|
+
if (token = this.tokenizer.link(src)) {
|
9676
|
+
src = src.substring(token.raw.length);
|
9677
|
+
tokens.push(token);
|
9678
|
+
continue;
|
9679
|
+
}
|
9680
|
+
if (token = this.tokenizer.reflink(src, this.tokens.links)) {
|
9681
|
+
src = src.substring(token.raw.length);
|
9682
|
+
lastToken = tokens[tokens.length - 1];
|
9683
|
+
if (lastToken && token.type === "text" && lastToken.type === "text") {
|
9684
|
+
lastToken.raw += token.raw;
|
9685
|
+
lastToken.text += token.text;
|
9686
|
+
} else {
|
9687
|
+
tokens.push(token);
|
9688
|
+
}
|
9689
|
+
continue;
|
9690
|
+
}
|
9691
|
+
if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
|
9692
|
+
src = src.substring(token.raw.length);
|
9693
|
+
tokens.push(token);
|
9694
|
+
continue;
|
9695
|
+
}
|
9696
|
+
if (token = this.tokenizer.codespan(src)) {
|
9697
|
+
src = src.substring(token.raw.length);
|
9698
|
+
tokens.push(token);
|
9699
|
+
continue;
|
9700
|
+
}
|
9701
|
+
if (token = this.tokenizer.br(src)) {
|
9702
|
+
src = src.substring(token.raw.length);
|
9703
|
+
tokens.push(token);
|
9704
|
+
continue;
|
9705
|
+
}
|
9706
|
+
if (token = this.tokenizer.del(src)) {
|
9707
|
+
src = src.substring(token.raw.length);
|
9708
|
+
tokens.push(token);
|
9709
|
+
continue;
|
9710
|
+
}
|
9711
|
+
if (token = this.tokenizer.autolink(src)) {
|
9712
|
+
src = src.substring(token.raw.length);
|
9713
|
+
tokens.push(token);
|
9714
|
+
continue;
|
9715
|
+
}
|
9716
|
+
if (!this.state.inLink && (token = this.tokenizer.url(src))) {
|
9717
|
+
src = src.substring(token.raw.length);
|
9718
|
+
tokens.push(token);
|
9719
|
+
continue;
|
9720
|
+
}
|
9721
|
+
cutSrc = src;
|
9722
|
+
if (this.options.extensions && this.options.extensions.startInline) {
|
9723
|
+
let startIndex = Infinity;
|
9724
|
+
const tempSrc = src.slice(1);
|
9725
|
+
let tempStart;
|
9726
|
+
this.options.extensions.startInline.forEach((getStartIndex) => {
|
9727
|
+
tempStart = getStartIndex.call({ lexer: this }, tempSrc);
|
9728
|
+
if (typeof tempStart === "number" && tempStart >= 0) {
|
9729
|
+
startIndex = Math.min(startIndex, tempStart);
|
9730
|
+
}
|
9731
|
+
});
|
9732
|
+
if (startIndex < Infinity && startIndex >= 0) {
|
9733
|
+
cutSrc = src.substring(0, startIndex + 1);
|
9734
|
+
}
|
9735
|
+
}
|
9736
|
+
if (token = this.tokenizer.inlineText(cutSrc)) {
|
9737
|
+
src = src.substring(token.raw.length);
|
9738
|
+
if (token.raw.slice(-1) !== "_") {
|
9739
|
+
prevChar = token.raw.slice(-1);
|
9740
|
+
}
|
9741
|
+
keepPrevChar = true;
|
9742
|
+
lastToken = tokens[tokens.length - 1];
|
9743
|
+
if (lastToken && lastToken.type === "text") {
|
9744
|
+
lastToken.raw += token.raw;
|
9745
|
+
lastToken.text += token.text;
|
9746
|
+
} else {
|
9747
|
+
tokens.push(token);
|
9748
|
+
}
|
9749
|
+
continue;
|
9750
|
+
}
|
9751
|
+
if (src) {
|
9752
|
+
const errMsg = "Infinite loop on byte: " + src.charCodeAt(0);
|
9753
|
+
if (this.options.silent) {
|
9754
|
+
console.error(errMsg);
|
9755
|
+
break;
|
9756
|
+
} else {
|
9757
|
+
throw new Error(errMsg);
|
9758
|
+
}
|
9759
|
+
}
|
9760
|
+
}
|
9761
|
+
return tokens;
|
9762
|
+
}
|
9763
|
+
};
|
9764
|
+
var _Renderer = class {
|
9765
|
+
options;
|
9766
|
+
parser;
|
9767
|
+
// set by the parser
|
9768
|
+
constructor(options2) {
|
9769
|
+
this.options = options2 || _defaults;
|
9770
|
+
}
|
9771
|
+
space(token) {
|
9772
|
+
return "";
|
9773
|
+
}
|
9774
|
+
code({ text: text2, lang, escaped }) {
|
9775
|
+
const langString = (lang || "").match(/^\S*/)?.[0];
|
9776
|
+
const code = text2.replace(/\n$/, "") + "\n";
|
9777
|
+
if (!langString) {
|
9778
|
+
return "<pre><code>" + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
|
9779
|
+
}
|
9780
|
+
return '<pre><code class="language-' + escape$1(langString) + '">' + (escaped ? code : escape$1(code, true)) + "</code></pre>\n";
|
9781
|
+
}
|
9782
|
+
blockquote({ tokens }) {
|
9783
|
+
const body = this.parser.parse(tokens);
|
9784
|
+
return `<blockquote>
|
9785
|
+
${body}</blockquote>
|
9786
|
+
`;
|
9787
|
+
}
|
9788
|
+
html({ text: text2 }) {
|
9789
|
+
return text2;
|
9790
|
+
}
|
9791
|
+
heading({ tokens, depth }) {
|
9792
|
+
return `<h${depth}>${this.parser.parseInline(tokens)}</h${depth}>
|
9793
|
+
`;
|
9794
|
+
}
|
9795
|
+
hr(token) {
|
9796
|
+
return "<hr>\n";
|
9797
|
+
}
|
9798
|
+
list(token) {
|
9799
|
+
const ordered = token.ordered;
|
9800
|
+
const start3 = token.start;
|
9801
|
+
let body = "";
|
9802
|
+
for (let j = 0; j < token.items.length; j++) {
|
9803
|
+
const item = token.items[j];
|
9804
|
+
body += this.listitem(item);
|
9805
|
+
}
|
9806
|
+
const type = ordered ? "ol" : "ul";
|
9807
|
+
const startAttr = ordered && start3 !== 1 ? ' start="' + start3 + '"' : "";
|
9808
|
+
return "<" + type + startAttr + ">\n" + body + "</" + type + ">\n";
|
9809
|
+
}
|
9810
|
+
listitem(item) {
|
9811
|
+
let itemBody = "";
|
9812
|
+
if (item.task) {
|
9813
|
+
const checkbox = this.checkbox({ checked: !!item.checked });
|
9814
|
+
if (item.loose) {
|
9815
|
+
if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
|
9816
|
+
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
9817
|
+
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
9818
|
+
item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
|
9819
|
+
}
|
9820
|
+
} else {
|
9821
|
+
item.tokens.unshift({
|
9822
|
+
type: "text",
|
9823
|
+
raw: checkbox + " ",
|
9824
|
+
text: checkbox + " "
|
9825
|
+
});
|
9826
|
+
}
|
9827
|
+
} else {
|
9828
|
+
itemBody += checkbox + " ";
|
9829
|
+
}
|
9830
|
+
}
|
9831
|
+
itemBody += this.parser.parse(item.tokens, !!item.loose);
|
9832
|
+
return `<li>${itemBody}</li>
|
9833
|
+
`;
|
9834
|
+
}
|
9835
|
+
checkbox({ checked }) {
|
9836
|
+
return "<input " + (checked ? 'checked="" ' : "") + 'disabled="" type="checkbox">';
|
9837
|
+
}
|
9838
|
+
paragraph({ tokens }) {
|
9839
|
+
return `<p>${this.parser.parseInline(tokens)}</p>
|
9840
|
+
`;
|
9841
|
+
}
|
9842
|
+
table(token) {
|
9843
|
+
let header = "";
|
9844
|
+
let cell = "";
|
9845
|
+
for (let j = 0; j < token.header.length; j++) {
|
9846
|
+
cell += this.tablecell(token.header[j]);
|
9847
|
+
}
|
9848
|
+
header += this.tablerow({ text: cell });
|
9849
|
+
let body = "";
|
9850
|
+
for (let j = 0; j < token.rows.length; j++) {
|
9851
|
+
const row = token.rows[j];
|
9852
|
+
cell = "";
|
9853
|
+
for (let k = 0; k < row.length; k++) {
|
9854
|
+
cell += this.tablecell(row[k]);
|
9855
|
+
}
|
9856
|
+
body += this.tablerow({ text: cell });
|
9857
|
+
}
|
9858
|
+
if (body)
|
9859
|
+
body = `<tbody>${body}</tbody>`;
|
9860
|
+
return "<table>\n<thead>\n" + header + "</thead>\n" + body + "</table>\n";
|
9861
|
+
}
|
9862
|
+
tablerow({ text: text2 }) {
|
9863
|
+
return `<tr>
|
9864
|
+
${text2}</tr>
|
9865
|
+
`;
|
9866
|
+
}
|
9867
|
+
tablecell(token) {
|
9868
|
+
const content = this.parser.parseInline(token.tokens);
|
9869
|
+
const type = token.header ? "th" : "td";
|
9870
|
+
const tag2 = token.align ? `<${type} align="${token.align}">` : `<${type}>`;
|
9871
|
+
return tag2 + content + `</${type}>
|
9872
|
+
`;
|
9873
|
+
}
|
9874
|
+
/**
|
9875
|
+
* span level renderer
|
9876
|
+
*/
|
9877
|
+
strong({ tokens }) {
|
9878
|
+
return `<strong>${this.parser.parseInline(tokens)}</strong>`;
|
9879
|
+
}
|
9880
|
+
em({ tokens }) {
|
9881
|
+
return `<em>${this.parser.parseInline(tokens)}</em>`;
|
9882
|
+
}
|
9883
|
+
codespan({ text: text2 }) {
|
9884
|
+
return `<code>${text2}</code>`;
|
9885
|
+
}
|
9886
|
+
br(token) {
|
9887
|
+
return "<br>";
|
9888
|
+
}
|
9889
|
+
del({ tokens }) {
|
9890
|
+
return `<del>${this.parser.parseInline(tokens)}</del>`;
|
9891
|
+
}
|
9892
|
+
link({ href, title, tokens }) {
|
9893
|
+
const text2 = this.parser.parseInline(tokens);
|
9894
|
+
const cleanHref = cleanUrl(href);
|
9895
|
+
if (cleanHref === null) {
|
9896
|
+
return text2;
|
9897
|
+
}
|
9898
|
+
href = cleanHref;
|
9899
|
+
let out = '<a href="' + href + '"';
|
9900
|
+
if (title) {
|
9901
|
+
out += ' title="' + title + '"';
|
9902
|
+
}
|
9903
|
+
out += ">" + text2 + "</a>";
|
9904
|
+
return out;
|
9905
|
+
}
|
9906
|
+
image({ href, title, text: text2 }) {
|
9907
|
+
const cleanHref = cleanUrl(href);
|
9908
|
+
if (cleanHref === null) {
|
9909
|
+
return text2;
|
9910
|
+
}
|
9911
|
+
href = cleanHref;
|
9912
|
+
let out = `<img src="${href}" alt="${text2}"`;
|
9913
|
+
if (title) {
|
9914
|
+
out += ` title="${title}"`;
|
9915
|
+
}
|
9916
|
+
out += ">";
|
9917
|
+
return out;
|
9918
|
+
}
|
9919
|
+
text(token) {
|
9920
|
+
return "tokens" in token && token.tokens ? this.parser.parseInline(token.tokens) : token.text;
|
9921
|
+
}
|
9922
|
+
};
|
9923
|
+
var _TextRenderer = class {
|
9924
|
+
// no need for block level renderers
|
9925
|
+
strong({ text: text2 }) {
|
9926
|
+
return text2;
|
9927
|
+
}
|
9928
|
+
em({ text: text2 }) {
|
9929
|
+
return text2;
|
9930
|
+
}
|
9931
|
+
codespan({ text: text2 }) {
|
9932
|
+
return text2;
|
9933
|
+
}
|
9934
|
+
del({ text: text2 }) {
|
9935
|
+
return text2;
|
9936
|
+
}
|
9937
|
+
html({ text: text2 }) {
|
9938
|
+
return text2;
|
9939
|
+
}
|
9940
|
+
text({ text: text2 }) {
|
9941
|
+
return text2;
|
9942
|
+
}
|
9943
|
+
link({ text: text2 }) {
|
9944
|
+
return "" + text2;
|
9945
|
+
}
|
9946
|
+
image({ text: text2 }) {
|
9947
|
+
return "" + text2;
|
9948
|
+
}
|
9949
|
+
br() {
|
9950
|
+
return "";
|
9951
|
+
}
|
9952
|
+
};
|
9953
|
+
var _Parser = class __Parser {
|
9954
|
+
options;
|
9955
|
+
renderer;
|
9956
|
+
textRenderer;
|
9957
|
+
constructor(options2) {
|
9958
|
+
this.options = options2 || _defaults;
|
9959
|
+
this.options.renderer = this.options.renderer || new _Renderer();
|
9960
|
+
this.renderer = this.options.renderer;
|
9961
|
+
this.renderer.options = this.options;
|
9962
|
+
this.renderer.parser = this;
|
9963
|
+
this.textRenderer = new _TextRenderer();
|
9964
|
+
}
|
9965
|
+
/**
|
9966
|
+
* Static Parse Method
|
9967
|
+
*/
|
9968
|
+
static parse(tokens, options2) {
|
9969
|
+
const parser2 = new __Parser(options2);
|
9970
|
+
return parser2.parse(tokens);
|
9971
|
+
}
|
9972
|
+
/**
|
9973
|
+
* Static Parse Inline Method
|
9974
|
+
*/
|
9975
|
+
static parseInline(tokens, options2) {
|
9976
|
+
const parser2 = new __Parser(options2);
|
9977
|
+
return parser2.parseInline(tokens);
|
9978
|
+
}
|
9979
|
+
/**
|
9980
|
+
* Parse Loop
|
9981
|
+
*/
|
9982
|
+
parse(tokens, top2 = true) {
|
9983
|
+
let out = "";
|
9984
|
+
for (let i = 0; i < tokens.length; i++) {
|
9985
|
+
const anyToken = tokens[i];
|
9986
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
|
9987
|
+
const genericToken = anyToken;
|
9988
|
+
const ret = this.options.extensions.renderers[genericToken.type].call({ parser: this }, genericToken);
|
9989
|
+
if (ret !== false || !["space", "hr", "heading", "code", "table", "blockquote", "list", "html", "paragraph", "text"].includes(genericToken.type)) {
|
9990
|
+
out += ret || "";
|
9991
|
+
continue;
|
9992
|
+
}
|
9993
|
+
}
|
9994
|
+
const token = anyToken;
|
9995
|
+
switch (token.type) {
|
9996
|
+
case "space": {
|
9997
|
+
out += this.renderer.space(token);
|
9998
|
+
continue;
|
9999
|
+
}
|
10000
|
+
case "hr": {
|
10001
|
+
out += this.renderer.hr(token);
|
10002
|
+
continue;
|
10003
|
+
}
|
10004
|
+
case "heading": {
|
10005
|
+
out += this.renderer.heading(token);
|
10006
|
+
continue;
|
10007
|
+
}
|
10008
|
+
case "code": {
|
10009
|
+
out += this.renderer.code(token);
|
10010
|
+
continue;
|
10011
|
+
}
|
10012
|
+
case "table": {
|
10013
|
+
out += this.renderer.table(token);
|
10014
|
+
continue;
|
10015
|
+
}
|
10016
|
+
case "blockquote": {
|
10017
|
+
out += this.renderer.blockquote(token);
|
10018
|
+
continue;
|
10019
|
+
}
|
10020
|
+
case "list": {
|
10021
|
+
out += this.renderer.list(token);
|
10022
|
+
continue;
|
10023
|
+
}
|
10024
|
+
case "html": {
|
10025
|
+
out += this.renderer.html(token);
|
10026
|
+
continue;
|
10027
|
+
}
|
10028
|
+
case "paragraph": {
|
10029
|
+
out += this.renderer.paragraph(token);
|
10030
|
+
continue;
|
10031
|
+
}
|
10032
|
+
case "text": {
|
10033
|
+
let textToken = token;
|
10034
|
+
let body = this.renderer.text(textToken);
|
10035
|
+
while (i + 1 < tokens.length && tokens[i + 1].type === "text") {
|
10036
|
+
textToken = tokens[++i];
|
10037
|
+
body += "\n" + this.renderer.text(textToken);
|
10038
|
+
}
|
10039
|
+
if (top2) {
|
10040
|
+
out += this.renderer.paragraph({
|
10041
|
+
type: "paragraph",
|
10042
|
+
raw: body,
|
10043
|
+
text: body,
|
10044
|
+
tokens: [{ type: "text", raw: body, text: body }]
|
10045
|
+
});
|
10046
|
+
} else {
|
10047
|
+
out += body;
|
10048
|
+
}
|
10049
|
+
continue;
|
10050
|
+
}
|
10051
|
+
default: {
|
10052
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
10053
|
+
if (this.options.silent) {
|
10054
|
+
console.error(errMsg);
|
10055
|
+
return "";
|
10056
|
+
} else {
|
10057
|
+
throw new Error(errMsg);
|
10058
|
+
}
|
10059
|
+
}
|
10060
|
+
}
|
10061
|
+
}
|
10062
|
+
return out;
|
10063
|
+
}
|
10064
|
+
/**
|
10065
|
+
* Parse Inline Tokens
|
10066
|
+
*/
|
10067
|
+
parseInline(tokens, renderer) {
|
10068
|
+
renderer = renderer || this.renderer;
|
10069
|
+
let out = "";
|
10070
|
+
for (let i = 0; i < tokens.length; i++) {
|
10071
|
+
const anyToken = tokens[i];
|
10072
|
+
if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[anyToken.type]) {
|
10073
|
+
const ret = this.options.extensions.renderers[anyToken.type].call({ parser: this }, anyToken);
|
10074
|
+
if (ret !== false || !["escape", "html", "link", "image", "strong", "em", "codespan", "br", "del", "text"].includes(anyToken.type)) {
|
10075
|
+
out += ret || "";
|
10076
|
+
continue;
|
10077
|
+
}
|
10078
|
+
}
|
10079
|
+
const token = anyToken;
|
10080
|
+
switch (token.type) {
|
10081
|
+
case "escape": {
|
10082
|
+
out += renderer.text(token);
|
10083
|
+
break;
|
10084
|
+
}
|
10085
|
+
case "html": {
|
10086
|
+
out += renderer.html(token);
|
10087
|
+
break;
|
10088
|
+
}
|
10089
|
+
case "link": {
|
10090
|
+
out += renderer.link(token);
|
10091
|
+
break;
|
10092
|
+
}
|
10093
|
+
case "image": {
|
10094
|
+
out += renderer.image(token);
|
10095
|
+
break;
|
10096
|
+
}
|
10097
|
+
case "strong": {
|
10098
|
+
out += renderer.strong(token);
|
10099
|
+
break;
|
10100
|
+
}
|
10101
|
+
case "em": {
|
10102
|
+
out += renderer.em(token);
|
10103
|
+
break;
|
10104
|
+
}
|
10105
|
+
case "codespan": {
|
10106
|
+
out += renderer.codespan(token);
|
10107
|
+
break;
|
10108
|
+
}
|
10109
|
+
case "br": {
|
10110
|
+
out += renderer.br(token);
|
10111
|
+
break;
|
10112
|
+
}
|
10113
|
+
case "del": {
|
10114
|
+
out += renderer.del(token);
|
10115
|
+
break;
|
10116
|
+
}
|
10117
|
+
case "text": {
|
10118
|
+
out += renderer.text(token);
|
10119
|
+
break;
|
10120
|
+
}
|
10121
|
+
default: {
|
10122
|
+
const errMsg = 'Token with "' + token.type + '" type was not found.';
|
10123
|
+
if (this.options.silent) {
|
10124
|
+
console.error(errMsg);
|
10125
|
+
return "";
|
10126
|
+
} else {
|
10127
|
+
throw new Error(errMsg);
|
10128
|
+
}
|
10129
|
+
}
|
10130
|
+
}
|
10131
|
+
}
|
10132
|
+
return out;
|
10133
|
+
}
|
10134
|
+
};
|
10135
|
+
var _Hooks = class {
|
10136
|
+
options;
|
10137
|
+
constructor(options2) {
|
10138
|
+
this.options = options2 || _defaults;
|
10139
|
+
}
|
10140
|
+
static passThroughHooks = /* @__PURE__ */ new Set([
|
10141
|
+
"preprocess",
|
10142
|
+
"postprocess",
|
10143
|
+
"processAllTokens"
|
10144
|
+
]);
|
10145
|
+
/**
|
10146
|
+
* Process markdown before marked
|
10147
|
+
*/
|
10148
|
+
preprocess(markdown) {
|
10149
|
+
return markdown;
|
10150
|
+
}
|
10151
|
+
/**
|
10152
|
+
* Process HTML after marked is finished
|
10153
|
+
*/
|
10154
|
+
postprocess(html3) {
|
10155
|
+
return html3;
|
10156
|
+
}
|
10157
|
+
/**
|
10158
|
+
* Process all tokens before walk tokens
|
10159
|
+
*/
|
10160
|
+
processAllTokens(tokens) {
|
10161
|
+
return tokens;
|
10162
|
+
}
|
10163
|
+
};
|
10164
|
+
var Marked = class {
|
10165
|
+
defaults = _getDefaults();
|
10166
|
+
options = this.setOptions;
|
10167
|
+
parse = this.#parseMarkdown(_Lexer.lex, _Parser.parse);
|
10168
|
+
parseInline = this.#parseMarkdown(_Lexer.lexInline, _Parser.parseInline);
|
10169
|
+
Parser = _Parser;
|
10170
|
+
Renderer = _Renderer;
|
10171
|
+
TextRenderer = _TextRenderer;
|
10172
|
+
Lexer = _Lexer;
|
10173
|
+
Tokenizer = _Tokenizer;
|
10174
|
+
Hooks = _Hooks;
|
10175
|
+
constructor(...args) {
|
10176
|
+
this.use(...args);
|
10177
|
+
}
|
10178
|
+
/**
|
10179
|
+
* Run callback for every token
|
10180
|
+
*/
|
10181
|
+
walkTokens(tokens, callback) {
|
10182
|
+
let values = [];
|
10183
|
+
for (const token of tokens) {
|
10184
|
+
values = values.concat(callback.call(this, token));
|
10185
|
+
switch (token.type) {
|
10186
|
+
case "table": {
|
10187
|
+
const tableToken = token;
|
10188
|
+
for (const cell of tableToken.header) {
|
10189
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
10190
|
+
}
|
10191
|
+
for (const row of tableToken.rows) {
|
10192
|
+
for (const cell of row) {
|
10193
|
+
values = values.concat(this.walkTokens(cell.tokens, callback));
|
10194
|
+
}
|
10195
|
+
}
|
10196
|
+
break;
|
10197
|
+
}
|
10198
|
+
case "list": {
|
10199
|
+
const listToken = token;
|
10200
|
+
values = values.concat(this.walkTokens(listToken.items, callback));
|
10201
|
+
break;
|
10202
|
+
}
|
10203
|
+
default: {
|
10204
|
+
const genericToken = token;
|
10205
|
+
if (this.defaults.extensions?.childTokens?.[genericToken.type]) {
|
10206
|
+
this.defaults.extensions.childTokens[genericToken.type].forEach((childTokens) => {
|
10207
|
+
const tokens2 = genericToken[childTokens].flat(Infinity);
|
10208
|
+
values = values.concat(this.walkTokens(tokens2, callback));
|
10209
|
+
});
|
10210
|
+
} else if (genericToken.tokens) {
|
10211
|
+
values = values.concat(this.walkTokens(genericToken.tokens, callback));
|
10212
|
+
}
|
10213
|
+
}
|
10214
|
+
}
|
10215
|
+
}
|
10216
|
+
return values;
|
10217
|
+
}
|
10218
|
+
use(...args) {
|
10219
|
+
const extensions = this.defaults.extensions || { renderers: {}, childTokens: {} };
|
10220
|
+
args.forEach((pack) => {
|
10221
|
+
const opts = { ...pack };
|
10222
|
+
opts.async = this.defaults.async || opts.async || false;
|
10223
|
+
if (pack.extensions) {
|
10224
|
+
pack.extensions.forEach((ext) => {
|
10225
|
+
if (!ext.name) {
|
10226
|
+
throw new Error("extension name required");
|
10227
|
+
}
|
10228
|
+
if ("renderer" in ext) {
|
10229
|
+
const prevRenderer = extensions.renderers[ext.name];
|
10230
|
+
if (prevRenderer) {
|
10231
|
+
extensions.renderers[ext.name] = function(...args2) {
|
10232
|
+
let ret = ext.renderer.apply(this, args2);
|
10233
|
+
if (ret === false) {
|
10234
|
+
ret = prevRenderer.apply(this, args2);
|
10235
|
+
}
|
10236
|
+
return ret;
|
10237
|
+
};
|
10238
|
+
} else {
|
10239
|
+
extensions.renderers[ext.name] = ext.renderer;
|
10240
|
+
}
|
10241
|
+
}
|
10242
|
+
if ("tokenizer" in ext) {
|
10243
|
+
if (!ext.level || ext.level !== "block" && ext.level !== "inline") {
|
10244
|
+
throw new Error("extension level must be 'block' or 'inline'");
|
10245
|
+
}
|
10246
|
+
const extLevel = extensions[ext.level];
|
10247
|
+
if (extLevel) {
|
10248
|
+
extLevel.unshift(ext.tokenizer);
|
10249
|
+
} else {
|
10250
|
+
extensions[ext.level] = [ext.tokenizer];
|
10251
|
+
}
|
10252
|
+
if (ext.start) {
|
10253
|
+
if (ext.level === "block") {
|
10254
|
+
if (extensions.startBlock) {
|
10255
|
+
extensions.startBlock.push(ext.start);
|
10256
|
+
} else {
|
10257
|
+
extensions.startBlock = [ext.start];
|
10258
|
+
}
|
10259
|
+
} else if (ext.level === "inline") {
|
10260
|
+
if (extensions.startInline) {
|
10261
|
+
extensions.startInline.push(ext.start);
|
10262
|
+
} else {
|
10263
|
+
extensions.startInline = [ext.start];
|
10264
|
+
}
|
10265
|
+
}
|
10266
|
+
}
|
10267
|
+
}
|
10268
|
+
if ("childTokens" in ext && ext.childTokens) {
|
10269
|
+
extensions.childTokens[ext.name] = ext.childTokens;
|
10270
|
+
}
|
10271
|
+
});
|
10272
|
+
opts.extensions = extensions;
|
10273
|
+
}
|
10274
|
+
if (pack.renderer) {
|
10275
|
+
const renderer = this.defaults.renderer || new _Renderer(this.defaults);
|
10276
|
+
for (const prop in pack.renderer) {
|
10277
|
+
if (!(prop in renderer)) {
|
10278
|
+
throw new Error(`renderer '${prop}' does not exist`);
|
10279
|
+
}
|
10280
|
+
if (["options", "parser"].includes(prop)) {
|
10281
|
+
continue;
|
10282
|
+
}
|
10283
|
+
const rendererProp = prop;
|
10284
|
+
let rendererFunc = pack.renderer[rendererProp];
|
10285
|
+
if (!pack.useNewRenderer) {
|
10286
|
+
rendererFunc = this.#convertRendererFunction(rendererFunc, rendererProp, renderer);
|
10287
|
+
}
|
10288
|
+
const prevRenderer = renderer[rendererProp];
|
10289
|
+
renderer[rendererProp] = (...args2) => {
|
10290
|
+
let ret = rendererFunc.apply(renderer, args2);
|
10291
|
+
if (ret === false) {
|
10292
|
+
ret = prevRenderer.apply(renderer, args2);
|
10293
|
+
}
|
10294
|
+
return ret || "";
|
10295
|
+
};
|
10296
|
+
}
|
10297
|
+
opts.renderer = renderer;
|
10298
|
+
}
|
10299
|
+
if (pack.tokenizer) {
|
10300
|
+
const tokenizer = this.defaults.tokenizer || new _Tokenizer(this.defaults);
|
10301
|
+
for (const prop in pack.tokenizer) {
|
10302
|
+
if (!(prop in tokenizer)) {
|
10303
|
+
throw new Error(`tokenizer '${prop}' does not exist`);
|
10304
|
+
}
|
10305
|
+
if (["options", "rules", "lexer"].includes(prop)) {
|
10306
|
+
continue;
|
10307
|
+
}
|
10308
|
+
const tokenizerProp = prop;
|
10309
|
+
const tokenizerFunc = pack.tokenizer[tokenizerProp];
|
10310
|
+
const prevTokenizer = tokenizer[tokenizerProp];
|
10311
|
+
tokenizer[tokenizerProp] = (...args2) => {
|
10312
|
+
let ret = tokenizerFunc.apply(tokenizer, args2);
|
10313
|
+
if (ret === false) {
|
10314
|
+
ret = prevTokenizer.apply(tokenizer, args2);
|
10315
|
+
}
|
10316
|
+
return ret;
|
10317
|
+
};
|
10318
|
+
}
|
10319
|
+
opts.tokenizer = tokenizer;
|
10320
|
+
}
|
10321
|
+
if (pack.hooks) {
|
10322
|
+
const hooks = this.defaults.hooks || new _Hooks();
|
10323
|
+
for (const prop in pack.hooks) {
|
10324
|
+
if (!(prop in hooks)) {
|
10325
|
+
throw new Error(`hook '${prop}' does not exist`);
|
10326
|
+
}
|
10327
|
+
if (prop === "options") {
|
10328
|
+
continue;
|
10329
|
+
}
|
10330
|
+
const hooksProp = prop;
|
10331
|
+
const hooksFunc = pack.hooks[hooksProp];
|
10332
|
+
const prevHook = hooks[hooksProp];
|
10333
|
+
if (_Hooks.passThroughHooks.has(prop)) {
|
10334
|
+
hooks[hooksProp] = (arg) => {
|
10335
|
+
if (this.defaults.async) {
|
10336
|
+
return Promise.resolve(hooksFunc.call(hooks, arg)).then((ret2) => {
|
10337
|
+
return prevHook.call(hooks, ret2);
|
10338
|
+
});
|
10339
|
+
}
|
10340
|
+
const ret = hooksFunc.call(hooks, arg);
|
10341
|
+
return prevHook.call(hooks, ret);
|
10342
|
+
};
|
10343
|
+
} else {
|
10344
|
+
hooks[hooksProp] = (...args2) => {
|
10345
|
+
let ret = hooksFunc.apply(hooks, args2);
|
10346
|
+
if (ret === false) {
|
10347
|
+
ret = prevHook.apply(hooks, args2);
|
10348
|
+
}
|
10349
|
+
return ret;
|
10350
|
+
};
|
10351
|
+
}
|
10352
|
+
}
|
10353
|
+
opts.hooks = hooks;
|
10354
|
+
}
|
10355
|
+
if (pack.walkTokens) {
|
10356
|
+
const walkTokens2 = this.defaults.walkTokens;
|
10357
|
+
const packWalktokens = pack.walkTokens;
|
10358
|
+
opts.walkTokens = function(token) {
|
10359
|
+
let values = [];
|
10360
|
+
values.push(packWalktokens.call(this, token));
|
10361
|
+
if (walkTokens2) {
|
10362
|
+
values = values.concat(walkTokens2.call(this, token));
|
10363
|
+
}
|
10364
|
+
return values;
|
10365
|
+
};
|
10366
|
+
}
|
10367
|
+
this.defaults = { ...this.defaults, ...opts };
|
10368
|
+
});
|
10369
|
+
return this;
|
10370
|
+
}
|
10371
|
+
// TODO: Remove this in next major release
|
10372
|
+
#convertRendererFunction(func, prop, renderer) {
|
10373
|
+
switch (prop) {
|
10374
|
+
case "heading":
|
10375
|
+
return function(token) {
|
10376
|
+
if (!token.type || token.type !== prop) {
|
10377
|
+
return func.apply(this, arguments);
|
10378
|
+
}
|
10379
|
+
return func.call(this, renderer.parser.parseInline(token.tokens), token.depth, unescape(renderer.parser.parseInline(token.tokens, renderer.parser.textRenderer)));
|
10380
|
+
};
|
10381
|
+
case "code":
|
10382
|
+
return function(token) {
|
10383
|
+
if (!token.type || token.type !== prop) {
|
10384
|
+
return func.apply(this, arguments);
|
10385
|
+
}
|
10386
|
+
return func.call(this, token.text, token.lang, !!token.escaped);
|
10387
|
+
};
|
10388
|
+
case "table":
|
10389
|
+
return function(token) {
|
10390
|
+
if (!token.type || token.type !== prop) {
|
10391
|
+
return func.apply(this, arguments);
|
10392
|
+
}
|
10393
|
+
let header = "";
|
10394
|
+
let cell = "";
|
10395
|
+
for (let j = 0; j < token.header.length; j++) {
|
10396
|
+
cell += this.tablecell({
|
10397
|
+
text: token.header[j].text,
|
10398
|
+
tokens: token.header[j].tokens,
|
10399
|
+
header: true,
|
10400
|
+
align: token.align[j]
|
10401
|
+
});
|
10402
|
+
}
|
10403
|
+
header += this.tablerow({ text: cell });
|
10404
|
+
let body = "";
|
10405
|
+
for (let j = 0; j < token.rows.length; j++) {
|
10406
|
+
const row = token.rows[j];
|
10407
|
+
cell = "";
|
10408
|
+
for (let k = 0; k < row.length; k++) {
|
10409
|
+
cell += this.tablecell({
|
10410
|
+
text: row[k].text,
|
10411
|
+
tokens: row[k].tokens,
|
10412
|
+
header: false,
|
10413
|
+
align: token.align[k]
|
10414
|
+
});
|
10415
|
+
}
|
10416
|
+
body += this.tablerow({ text: cell });
|
10417
|
+
}
|
10418
|
+
return func.call(this, header, body);
|
10419
|
+
};
|
10420
|
+
case "blockquote":
|
10421
|
+
return function(token) {
|
10422
|
+
if (!token.type || token.type !== prop) {
|
10423
|
+
return func.apply(this, arguments);
|
10424
|
+
}
|
10425
|
+
const body = this.parser.parse(token.tokens);
|
10426
|
+
return func.call(this, body);
|
10427
|
+
};
|
10428
|
+
case "list":
|
10429
|
+
return function(token) {
|
10430
|
+
if (!token.type || token.type !== prop) {
|
10431
|
+
return func.apply(this, arguments);
|
10432
|
+
}
|
10433
|
+
const ordered = token.ordered;
|
10434
|
+
const start3 = token.start;
|
10435
|
+
const loose = token.loose;
|
10436
|
+
let body = "";
|
10437
|
+
for (let j = 0; j < token.items.length; j++) {
|
10438
|
+
const item = token.items[j];
|
10439
|
+
const checked = item.checked;
|
10440
|
+
const task = item.task;
|
10441
|
+
let itemBody = "";
|
10442
|
+
if (item.task) {
|
10443
|
+
const checkbox = this.checkbox({ checked: !!checked });
|
10444
|
+
if (loose) {
|
10445
|
+
if (item.tokens.length > 0 && item.tokens[0].type === "paragraph") {
|
10446
|
+
item.tokens[0].text = checkbox + " " + item.tokens[0].text;
|
10447
|
+
if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === "text") {
|
10448
|
+
item.tokens[0].tokens[0].text = checkbox + " " + item.tokens[0].tokens[0].text;
|
10449
|
+
}
|
10450
|
+
} else {
|
10451
|
+
item.tokens.unshift({
|
10452
|
+
type: "text",
|
10453
|
+
text: checkbox + " "
|
10454
|
+
});
|
10455
|
+
}
|
10456
|
+
} else {
|
10457
|
+
itemBody += checkbox + " ";
|
10458
|
+
}
|
10459
|
+
}
|
10460
|
+
itemBody += this.parser.parse(item.tokens, loose);
|
10461
|
+
body += this.listitem({
|
10462
|
+
type: "list_item",
|
10463
|
+
raw: itemBody,
|
10464
|
+
text: itemBody,
|
10465
|
+
task,
|
10466
|
+
checked: !!checked,
|
10467
|
+
loose,
|
10468
|
+
tokens: item.tokens
|
10469
|
+
});
|
10470
|
+
}
|
10471
|
+
return func.call(this, body, ordered, start3);
|
10472
|
+
};
|
10473
|
+
case "html":
|
10474
|
+
return function(token) {
|
10475
|
+
if (!token.type || token.type !== prop) {
|
10476
|
+
return func.apply(this, arguments);
|
10477
|
+
}
|
10478
|
+
return func.call(this, token.text, token.block);
|
10479
|
+
};
|
10480
|
+
case "paragraph":
|
10481
|
+
return function(token) {
|
10482
|
+
if (!token.type || token.type !== prop) {
|
10483
|
+
return func.apply(this, arguments);
|
10484
|
+
}
|
10485
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
10486
|
+
};
|
10487
|
+
case "escape":
|
10488
|
+
return function(token) {
|
10489
|
+
if (!token.type || token.type !== prop) {
|
10490
|
+
return func.apply(this, arguments);
|
10491
|
+
}
|
10492
|
+
return func.call(this, token.text);
|
10493
|
+
};
|
10494
|
+
case "link":
|
10495
|
+
return function(token) {
|
10496
|
+
if (!token.type || token.type !== prop) {
|
10497
|
+
return func.apply(this, arguments);
|
10498
|
+
}
|
10499
|
+
return func.call(this, token.href, token.title, this.parser.parseInline(token.tokens));
|
10500
|
+
};
|
10501
|
+
case "image":
|
10502
|
+
return function(token) {
|
10503
|
+
if (!token.type || token.type !== prop) {
|
10504
|
+
return func.apply(this, arguments);
|
10505
|
+
}
|
10506
|
+
return func.call(this, token.href, token.title, token.text);
|
10507
|
+
};
|
10508
|
+
case "strong":
|
10509
|
+
return function(token) {
|
10510
|
+
if (!token.type || token.type !== prop) {
|
10511
|
+
return func.apply(this, arguments);
|
10512
|
+
}
|
10513
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
10514
|
+
};
|
10515
|
+
case "em":
|
10516
|
+
return function(token) {
|
10517
|
+
if (!token.type || token.type !== prop) {
|
10518
|
+
return func.apply(this, arguments);
|
10519
|
+
}
|
10520
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
10521
|
+
};
|
10522
|
+
case "codespan":
|
10523
|
+
return function(token) {
|
10524
|
+
if (!token.type || token.type !== prop) {
|
10525
|
+
return func.apply(this, arguments);
|
10526
|
+
}
|
10527
|
+
return func.call(this, token.text);
|
10528
|
+
};
|
10529
|
+
case "del":
|
10530
|
+
return function(token) {
|
10531
|
+
if (!token.type || token.type !== prop) {
|
10532
|
+
return func.apply(this, arguments);
|
10533
|
+
}
|
10534
|
+
return func.call(this, this.parser.parseInline(token.tokens));
|
10535
|
+
};
|
10536
|
+
case "text":
|
10537
|
+
return function(token) {
|
10538
|
+
if (!token.type || token.type !== prop) {
|
10539
|
+
return func.apply(this, arguments);
|
10540
|
+
}
|
10541
|
+
return func.call(this, token.text);
|
10542
|
+
};
|
10543
|
+
}
|
10544
|
+
return func;
|
10545
|
+
}
|
10546
|
+
setOptions(opt) {
|
10547
|
+
this.defaults = { ...this.defaults, ...opt };
|
10548
|
+
return this;
|
10549
|
+
}
|
10550
|
+
lexer(src, options2) {
|
10551
|
+
return _Lexer.lex(src, options2 ?? this.defaults);
|
10552
|
+
}
|
10553
|
+
parser(tokens, options2) {
|
10554
|
+
return _Parser.parse(tokens, options2 ?? this.defaults);
|
10555
|
+
}
|
10556
|
+
#parseMarkdown(lexer2, parser2) {
|
10557
|
+
return (src, options2) => {
|
10558
|
+
const origOpt = { ...options2 };
|
10559
|
+
const opt = { ...this.defaults, ...origOpt };
|
10560
|
+
if (this.defaults.async === true && origOpt.async === false) {
|
10561
|
+
if (!opt.silent) {
|
10562
|
+
console.warn("marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.");
|
10563
|
+
}
|
10564
|
+
opt.async = true;
|
10565
|
+
}
|
10566
|
+
const throwError = this.#onError(!!opt.silent, !!opt.async);
|
10567
|
+
if (typeof src === "undefined" || src === null) {
|
10568
|
+
return throwError(new Error("marked(): input parameter is undefined or null"));
|
10569
|
+
}
|
10570
|
+
if (typeof src !== "string") {
|
10571
|
+
return throwError(new Error("marked(): input parameter is of type " + Object.prototype.toString.call(src) + ", string expected"));
|
10572
|
+
}
|
10573
|
+
if (opt.hooks) {
|
10574
|
+
opt.hooks.options = opt;
|
10575
|
+
}
|
10576
|
+
if (opt.async) {
|
10577
|
+
return Promise.resolve(opt.hooks ? opt.hooks.preprocess(src) : src).then((src2) => lexer2(src2, opt)).then((tokens) => opt.hooks ? opt.hooks.processAllTokens(tokens) : tokens).then((tokens) => opt.walkTokens ? Promise.all(this.walkTokens(tokens, opt.walkTokens)).then(() => tokens) : tokens).then((tokens) => parser2(tokens, opt)).then((html3) => opt.hooks ? opt.hooks.postprocess(html3) : html3).catch(throwError);
|
10578
|
+
}
|
10579
|
+
try {
|
10580
|
+
if (opt.hooks) {
|
10581
|
+
src = opt.hooks.preprocess(src);
|
10582
|
+
}
|
10583
|
+
let tokens = lexer2(src, opt);
|
10584
|
+
if (opt.hooks) {
|
10585
|
+
tokens = opt.hooks.processAllTokens(tokens);
|
10586
|
+
}
|
10587
|
+
if (opt.walkTokens) {
|
10588
|
+
this.walkTokens(tokens, opt.walkTokens);
|
10589
|
+
}
|
10590
|
+
let html3 = parser2(tokens, opt);
|
10591
|
+
if (opt.hooks) {
|
10592
|
+
html3 = opt.hooks.postprocess(html3);
|
10593
|
+
}
|
10594
|
+
return html3;
|
10595
|
+
} catch (e) {
|
10596
|
+
return throwError(e);
|
10597
|
+
}
|
10598
|
+
};
|
10599
|
+
}
|
10600
|
+
#onError(silent, async) {
|
10601
|
+
return (e) => {
|
10602
|
+
e.message += "\nPlease report this to https://github.com/markedjs/marked.";
|
10603
|
+
if (silent) {
|
10604
|
+
const msg = "<p>An error occurred:</p><pre>" + escape$1(e.message + "", true) + "</pre>";
|
10605
|
+
if (async) {
|
10606
|
+
return Promise.resolve(msg);
|
10607
|
+
}
|
10608
|
+
return msg;
|
10609
|
+
}
|
10610
|
+
if (async) {
|
10611
|
+
return Promise.reject(e);
|
10612
|
+
}
|
10613
|
+
throw e;
|
10614
|
+
};
|
10615
|
+
}
|
10616
|
+
};
|
10617
|
+
var markedInstance = new Marked();
|
10618
|
+
function marked(src, opt) {
|
10619
|
+
return markedInstance.parse(src, opt);
|
10620
|
+
}
|
10621
|
+
marked.options = marked.setOptions = function(options2) {
|
10622
|
+
markedInstance.setOptions(options2);
|
10623
|
+
marked.defaults = markedInstance.defaults;
|
10624
|
+
changeDefaults(marked.defaults);
|
10625
|
+
return marked;
|
10626
|
+
};
|
10627
|
+
marked.getDefaults = _getDefaults;
|
10628
|
+
marked.defaults = _defaults;
|
10629
|
+
marked.use = function(...args) {
|
10630
|
+
markedInstance.use(...args);
|
10631
|
+
marked.defaults = markedInstance.defaults;
|
10632
|
+
changeDefaults(marked.defaults);
|
10633
|
+
return marked;
|
10634
|
+
};
|
10635
|
+
marked.walkTokens = function(tokens, callback) {
|
10636
|
+
return markedInstance.walkTokens(tokens, callback);
|
10637
|
+
};
|
10638
|
+
marked.parseInline = markedInstance.parseInline;
|
10639
|
+
marked.Parser = _Parser;
|
10640
|
+
marked.parser = _Parser.parse;
|
10641
|
+
marked.Renderer = _Renderer;
|
10642
|
+
marked.TextRenderer = _TextRenderer;
|
10643
|
+
marked.Lexer = _Lexer;
|
10644
|
+
marked.lexer = _Lexer.lex;
|
10645
|
+
marked.Tokenizer = _Tokenizer;
|
10646
|
+
marked.Hooks = _Hooks;
|
10647
|
+
marked.parse = marked;
|
10648
|
+
var options = marked.options;
|
10649
|
+
var setOptions = marked.setOptions;
|
10650
|
+
var use = marked.use;
|
10651
|
+
var walkTokens = marked.walkTokens;
|
10652
|
+
var parseInline = marked.parseInline;
|
10653
|
+
var parser = _Parser.parse;
|
10654
|
+
var lexer = _Lexer.lex;
|
10655
|
+
|
7435
10656
|
// src/js/controllers/easymde_controller.js
|
7436
10657
|
var easymde_controller_default = class extends Controller {
|
7437
10658
|
connect() {
|
7438
10659
|
console.log(`easymde connected: ${this.element}`);
|
7439
|
-
self.easyMDE = new EasyMDE(
|
10660
|
+
self.easyMDE = new EasyMDE(this.#buildOptions());
|
10661
|
+
this.element.setAttribute("data-action", "turbo:morph-element->easymde#reconnect");
|
7440
10662
|
}
|
7441
10663
|
disconnect() {
|
7442
10664
|
self.easyMDE.toTextArea();
|
7443
10665
|
self.easyMDE = null;
|
7444
10666
|
}
|
10667
|
+
reconnect() {
|
10668
|
+
this.disconnect();
|
10669
|
+
this.connect();
|
10670
|
+
}
|
10671
|
+
#buildOptions() {
|
10672
|
+
let options2 = {
|
10673
|
+
element: this.element,
|
10674
|
+
promptURLs: true,
|
10675
|
+
spellChecker: false,
|
10676
|
+
// Override the default preview renderer
|
10677
|
+
previewRender: (plainText) => {
|
10678
|
+
const cleanedText = purify.sanitize(plainText, {
|
10679
|
+
ALLOWED_TAGS: ["strong", "em", "sub", "sup", "details", "summary"],
|
10680
|
+
ALLOWED_ATTR: []
|
10681
|
+
});
|
10682
|
+
const cleanedHTML = marked(cleanedText);
|
10683
|
+
return purify.sanitize(cleanedHTML, { USE_PROFILES: { html: true } });
|
10684
|
+
}
|
10685
|
+
};
|
10686
|
+
if (this.element.attributes.id.value) {
|
10687
|
+
options2.autosave = {
|
10688
|
+
enabled: true,
|
10689
|
+
uniqueId: this.element.attributes.id.value,
|
10690
|
+
delay: 1e3
|
10691
|
+
};
|
10692
|
+
}
|
10693
|
+
return options2;
|
10694
|
+
}
|
7445
10695
|
};
|
7446
10696
|
|
7447
10697
|
// src/js/controllers/slim_select_controller.js
|
@@ -7451,11 +10701,16 @@
|
|
7451
10701
|
self.slimSelect = new SlimSelect({
|
7452
10702
|
select: this.element
|
7453
10703
|
});
|
10704
|
+
this.element.setAttribute("data-action", "turbo:morph-element->slim-select#reconnect");
|
7454
10705
|
}
|
7455
10706
|
disconnect() {
|
7456
10707
|
self.slimSelect.destroy();
|
7457
10708
|
self.slimSelect = null;
|
7458
10709
|
}
|
10710
|
+
reconnect() {
|
10711
|
+
this.disconnect();
|
10712
|
+
this.connect();
|
10713
|
+
}
|
7459
10714
|
};
|
7460
10715
|
|
7461
10716
|
// src/js/controllers/flatpickr_controller.js
|
@@ -7463,20 +10718,25 @@
|
|
7463
10718
|
connect() {
|
7464
10719
|
console.log(`flatpickr connected: ${this.element}`);
|
7465
10720
|
self.picker = new flatpickr(this.element, this.#buildOptions());
|
10721
|
+
this.element.setAttribute("data-action", "turbo:morph-element->flatpickr#reconnect");
|
7466
10722
|
}
|
7467
10723
|
disconnect() {
|
7468
10724
|
self.picker.destroy();
|
7469
10725
|
self.picker = null;
|
7470
10726
|
}
|
10727
|
+
reconnect() {
|
10728
|
+
this.disconnect();
|
10729
|
+
this.connect();
|
10730
|
+
}
|
7471
10731
|
#buildOptions() {
|
7472
|
-
let
|
10732
|
+
let options2 = { altInput: true };
|
7473
10733
|
if (this.element.attributes.type.value == "datetime-local") {
|
7474
|
-
|
10734
|
+
options2.enableTime = true;
|
7475
10735
|
} else if (this.element.attributes.type.value == "time") {
|
7476
|
-
|
7477
|
-
|
10736
|
+
options2.enableTime = true;
|
10737
|
+
options2.noCalendar = true;
|
7478
10738
|
}
|
7479
|
-
return
|
10739
|
+
return options2;
|
7480
10740
|
}
|
7481
10741
|
};
|
7482
10742
|
|
@@ -7834,9 +11094,9 @@
|
|
7834
11094
|
destinationElement.setAttribute(name, value);
|
7835
11095
|
}
|
7836
11096
|
}
|
7837
|
-
function createDocumentFragment(
|
11097
|
+
function createDocumentFragment(html3) {
|
7838
11098
|
const template = document.createElement("template");
|
7839
|
-
template.innerHTML =
|
11099
|
+
template.innerHTML = html3;
|
7840
11100
|
return template.content;
|
7841
11101
|
}
|
7842
11102
|
function dispatch(eventName, { target, cancelable, detail } = {}) {
|
@@ -7869,8 +11129,8 @@
|
|
7869
11129
|
function nextMicrotask() {
|
7870
11130
|
return Promise.resolve();
|
7871
11131
|
}
|
7872
|
-
function parseHTMLDocument(
|
7873
|
-
return new DOMParser().parseFromString(
|
11132
|
+
function parseHTMLDocument(html3 = "") {
|
11133
|
+
return new DOMParser().parseFromString(html3, "text/html");
|
7874
11134
|
}
|
7875
11135
|
function unindent(strings, ...values) {
|
7876
11136
|
const lines = interpolate(strings, values).replace(/^\n/, "").split("\n");
|
@@ -7999,8 +11259,8 @@
|
|
7999
11259
|
function findLinkFromClickTarget(target) {
|
8000
11260
|
return findClosestRecursively(target, "a[href]:not([target^=_]):not([download])");
|
8001
11261
|
}
|
8002
|
-
function getLocationForLink(
|
8003
|
-
return expandURL(
|
11262
|
+
function getLocationForLink(link2) {
|
11263
|
+
return expandURL(link2.getAttribute("href") || "");
|
8004
11264
|
}
|
8005
11265
|
function debounce3(fn2, delay) {
|
8006
11266
|
let timeoutId = null;
|
@@ -8026,13 +11286,13 @@
|
|
8026
11286
|
};
|
8027
11287
|
var recentRequests = new LimitedSet(20);
|
8028
11288
|
var nativeFetch = window.fetch;
|
8029
|
-
function fetchWithTurboHeaders(url,
|
8030
|
-
const modifiedHeaders = new Headers(
|
11289
|
+
function fetchWithTurboHeaders(url, options2 = {}) {
|
11290
|
+
const modifiedHeaders = new Headers(options2.headers || {});
|
8031
11291
|
const requestUID = uuid();
|
8032
11292
|
recentRequests.add(requestUID);
|
8033
11293
|
modifiedHeaders.append("X-Turbo-Request-Id", requestUID);
|
8034
11294
|
return nativeFetch(url, {
|
8035
|
-
...
|
11295
|
+
...options2,
|
8036
11296
|
headers: modifiedHeaders
|
8037
11297
|
});
|
8038
11298
|
}
|
@@ -8225,14 +11485,14 @@
|
|
8225
11485
|
}
|
8226
11486
|
}
|
8227
11487
|
function entriesExcludingFiles(requestBody) {
|
8228
|
-
const
|
11488
|
+
const entries2 = [];
|
8229
11489
|
for (const [name, value] of requestBody) {
|
8230
11490
|
if (value instanceof File)
|
8231
11491
|
continue;
|
8232
11492
|
else
|
8233
|
-
|
11493
|
+
entries2.push([name, value]);
|
8234
11494
|
}
|
8235
|
-
return
|
11495
|
+
return entries2;
|
8236
11496
|
}
|
8237
11497
|
function mergeIntoURLSearchParams(url, requestBody) {
|
8238
11498
|
const searchParams = new URLSearchParams(entriesExcludingFiles(requestBody));
|
@@ -8258,8 +11518,8 @@
|
|
8258
11518
|
this.intersectionObserver.unobserve(this.element);
|
8259
11519
|
}
|
8260
11520
|
}
|
8261
|
-
intersect = (
|
8262
|
-
const lastEntry =
|
11521
|
+
intersect = (entries2) => {
|
11522
|
+
const lastEntry = entries2.slice(-1)[0];
|
8263
11523
|
if (lastEntry?.isIntersecting) {
|
8264
11524
|
this.delegate.elementAppearedInViewport(this.element);
|
8265
11525
|
}
|
@@ -8676,8 +11936,8 @@
|
|
8676
11936
|
this.renderer = renderer;
|
8677
11937
|
await this.prepareToRenderSnapshot(renderer);
|
8678
11938
|
const renderInterception = new Promise((resolve) => this.#resolveInterceptionPromise = resolve);
|
8679
|
-
const
|
8680
|
-
const immediateRender = this.delegate.allowsImmediateRender(snapshot,
|
11939
|
+
const options2 = { resume: this.#resolveInterceptionPromise, render: this.renderer.renderElement, renderMethod: this.renderer.renderMethod };
|
11940
|
+
const immediateRender = this.delegate.allowsImmediateRender(snapshot, options2);
|
8681
11941
|
if (!immediateRender)
|
8682
11942
|
await renderInterception;
|
8683
11943
|
await this.renderSnapshot(renderer);
|
@@ -8793,12 +12053,12 @@
|
|
8793
12053
|
clickBubbled = (event) => {
|
8794
12054
|
if (event instanceof MouseEvent && this.clickEventIsSignificant(event)) {
|
8795
12055
|
const target = event.composedPath && event.composedPath()[0] || event.target;
|
8796
|
-
const
|
8797
|
-
if (
|
8798
|
-
const location2 = getLocationForLink(
|
8799
|
-
if (this.delegate.willFollowLinkToLocation(
|
12056
|
+
const link2 = findLinkFromClickTarget(target);
|
12057
|
+
if (link2 && doesNotTargetIFrame(link2)) {
|
12058
|
+
const location2 = getLocationForLink(link2);
|
12059
|
+
if (this.delegate.willFollowLinkToLocation(link2, location2, event)) {
|
8800
12060
|
event.preventDefault();
|
8801
|
-
this.delegate.followedLinkToLocation(
|
12061
|
+
this.delegate.followedLinkToLocation(link2, location2);
|
8802
12062
|
}
|
8803
12063
|
}
|
8804
12064
|
}
|
@@ -8819,17 +12079,17 @@
|
|
8819
12079
|
this.linkInterceptor.stop();
|
8820
12080
|
}
|
8821
12081
|
// Link hover observer delegate
|
8822
|
-
canPrefetchRequestToLocation(
|
12082
|
+
canPrefetchRequestToLocation(link2, location2) {
|
8823
12083
|
return false;
|
8824
12084
|
}
|
8825
|
-
prefetchAndCacheRequestToLocation(
|
12085
|
+
prefetchAndCacheRequestToLocation(link2, location2) {
|
8826
12086
|
return;
|
8827
12087
|
}
|
8828
12088
|
// Link click observer delegate
|
8829
|
-
willFollowLinkToLocation(
|
8830
|
-
return this.delegate.willSubmitFormLinkToLocation(
|
12089
|
+
willFollowLinkToLocation(link2, location2, originalEvent) {
|
12090
|
+
return this.delegate.willSubmitFormLinkToLocation(link2, location2, originalEvent) && (link2.hasAttribute("data-turbo-method") || link2.hasAttribute("data-turbo-stream"));
|
8831
12091
|
}
|
8832
|
-
followedLinkToLocation(
|
12092
|
+
followedLinkToLocation(link2, location2) {
|
8833
12093
|
const form = document.createElement("form");
|
8834
12094
|
const type = "hidden";
|
8835
12095
|
for (const [name, value] of location2.searchParams) {
|
@@ -8839,22 +12099,22 @@
|
|
8839
12099
|
form.setAttribute("data-turbo", "true");
|
8840
12100
|
form.setAttribute("action", action.href);
|
8841
12101
|
form.setAttribute("hidden", "");
|
8842
|
-
const method =
|
12102
|
+
const method = link2.getAttribute("data-turbo-method");
|
8843
12103
|
if (method)
|
8844
12104
|
form.setAttribute("method", method);
|
8845
|
-
const turboFrame =
|
12105
|
+
const turboFrame = link2.getAttribute("data-turbo-frame");
|
8846
12106
|
if (turboFrame)
|
8847
12107
|
form.setAttribute("data-turbo-frame", turboFrame);
|
8848
|
-
const turboAction = getVisitAction(
|
12108
|
+
const turboAction = getVisitAction(link2);
|
8849
12109
|
if (turboAction)
|
8850
12110
|
form.setAttribute("data-turbo-action", turboAction);
|
8851
|
-
const turboConfirm =
|
12111
|
+
const turboConfirm = link2.getAttribute("data-turbo-confirm");
|
8852
12112
|
if (turboConfirm)
|
8853
12113
|
form.setAttribute("data-turbo-confirm", turboConfirm);
|
8854
|
-
const turboStream =
|
12114
|
+
const turboStream = link2.hasAttribute("data-turbo-stream");
|
8855
12115
|
if (turboStream)
|
8856
12116
|
form.setAttribute("data-turbo-stream", "");
|
8857
|
-
this.delegate.submittedFormLinkToLocation(
|
12117
|
+
this.delegate.submittedFormLinkToLocation(link2, location2, form);
|
8858
12118
|
document.body.appendChild(form);
|
8859
12119
|
form.addEventListener("turbo:submit-end", () => form.remove(), { once: true });
|
8860
12120
|
requestAnimationFrame(() => form.requestSubmit());
|
@@ -8891,8 +12151,8 @@
|
|
8891
12151
|
permanentElement.replaceWith(placeholder);
|
8892
12152
|
}
|
8893
12153
|
replaceCurrentPermanentElementWithClone(permanentElement) {
|
8894
|
-
const
|
8895
|
-
permanentElement.replaceWith(
|
12154
|
+
const clone2 = permanentElement.cloneNode(true);
|
12155
|
+
permanentElement.replaceWith(clone2);
|
8896
12156
|
}
|
8897
12157
|
replacePlaceholderWithPermanentElement(permanentElement) {
|
8898
12158
|
const placeholder = this.getPlaceholderById(permanentElement.id);
|
@@ -9014,10 +12274,10 @@
|
|
9014
12274
|
scrollFrameIntoView() {
|
9015
12275
|
if (this.currentElement.autoscroll || this.newElement.autoscroll) {
|
9016
12276
|
const element = this.currentElement.firstElementChild;
|
9017
|
-
const
|
12277
|
+
const block2 = readScrollLogicalPosition(this.currentElement.getAttribute("data-autoscroll-block"), "end");
|
9018
12278
|
const behavior = readScrollBehavior(this.currentElement.getAttribute("data-autoscroll-behavior"), "auto");
|
9019
12279
|
if (element) {
|
9020
|
-
element.scrollIntoView({ block, behavior });
|
12280
|
+
element.scrollIntoView({ block: block2, behavior });
|
9021
12281
|
return true;
|
9022
12282
|
}
|
9023
12283
|
}
|
@@ -9238,8 +12498,8 @@
|
|
9238
12498
|
return element;
|
9239
12499
|
}
|
9240
12500
|
var PageSnapshot = class _PageSnapshot extends Snapshot {
|
9241
|
-
static fromHTMLString(
|
9242
|
-
return this.fromDocument(parseHTMLDocument(
|
12501
|
+
static fromHTMLString(html3 = "") {
|
12502
|
+
return this.fromDocument(parseHTMLDocument(html3));
|
9243
12503
|
}
|
9244
12504
|
static fromElement(element) {
|
9245
12505
|
return this.fromDocument(element.ownerDocument);
|
@@ -9257,11 +12517,11 @@
|
|
9257
12517
|
const selectElements = this.element.querySelectorAll("select");
|
9258
12518
|
const clonedSelectElements = clonedElement.querySelectorAll("select");
|
9259
12519
|
for (const [index, source] of selectElements.entries()) {
|
9260
|
-
const
|
9261
|
-
for (const option of
|
12520
|
+
const clone2 = clonedSelectElements[index];
|
12521
|
+
for (const option of clone2.selectedOptions)
|
9262
12522
|
option.selected = false;
|
9263
12523
|
for (const option of source.selectedOptions)
|
9264
|
-
|
12524
|
+
clone2.options[option.index].selected = true;
|
9265
12525
|
}
|
9266
12526
|
for (const clonedPasswordInput of clonedElement.querySelectorAll('input[type="password"]')) {
|
9267
12527
|
clonedPasswordInput.value = "";
|
@@ -9367,7 +12627,7 @@
|
|
9367
12627
|
snapshotCached = false;
|
9368
12628
|
state = VisitState.initialized;
|
9369
12629
|
viewTransitioner = new ViewTransitioner();
|
9370
|
-
constructor(delegate, location2, restorationIdentifier,
|
12630
|
+
constructor(delegate, location2, restorationIdentifier, options2 = {}) {
|
9371
12631
|
this.delegate = delegate;
|
9372
12632
|
this.location = location2;
|
9373
12633
|
this.restorationIdentifier = restorationIdentifier || uuid();
|
@@ -9386,7 +12646,7 @@
|
|
9386
12646
|
direction
|
9387
12647
|
} = {
|
9388
12648
|
...defaultOptions,
|
9389
|
-
...
|
12649
|
+
...options2
|
9390
12650
|
};
|
9391
12651
|
this.action = action;
|
9392
12652
|
this.historyChanged = historyChanged;
|
@@ -9709,9 +12969,9 @@
|
|
9709
12969
|
constructor(session2) {
|
9710
12970
|
this.session = session2;
|
9711
12971
|
}
|
9712
|
-
visitProposedToLocation(location2,
|
12972
|
+
visitProposedToLocation(location2, options2) {
|
9713
12973
|
if (locationIsVisitable(location2, this.navigator.rootLocation)) {
|
9714
|
-
this.navigator.startVisit(location2,
|
12974
|
+
this.navigator.startVisit(location2, options2?.restorationIdentifier || uuid(), options2);
|
9715
12975
|
} else {
|
9716
12976
|
window.location.href = location2.toString();
|
9717
12977
|
}
|
@@ -10039,10 +13299,10 @@
|
|
10039
13299
|
const target = event.target;
|
10040
13300
|
const isLink = target.matches && target.matches("a[href]:not([target^=_]):not([download])");
|
10041
13301
|
if (isLink && this.#isPrefetchable(target)) {
|
10042
|
-
const
|
10043
|
-
const location2 = getLocationForLink(
|
10044
|
-
if (this.delegate.canPrefetchRequestToLocation(
|
10045
|
-
this.#prefetchedLink =
|
13302
|
+
const link2 = target;
|
13303
|
+
const location2 = getLocationForLink(link2);
|
13304
|
+
if (this.delegate.canPrefetchRequestToLocation(link2, location2)) {
|
13305
|
+
this.#prefetchedLink = link2;
|
10046
13306
|
const fetchRequest = new FetchRequest(
|
10047
13307
|
this,
|
10048
13308
|
FetchMethod.get,
|
@@ -10072,10 +13332,10 @@
|
|
10072
13332
|
}
|
10073
13333
|
};
|
10074
13334
|
prepareRequest(request) {
|
10075
|
-
const
|
13335
|
+
const link2 = request.target;
|
10076
13336
|
request.headers["X-Sec-Purpose"] = "prefetch";
|
10077
|
-
const turboFrame =
|
10078
|
-
const turboFrameTarget =
|
13337
|
+
const turboFrame = link2.closest("turbo-frame");
|
13338
|
+
const turboFrameTarget = link2.getAttribute("data-turbo-frame") || turboFrame?.getAttribute("target") || turboFrame?.id;
|
10079
13339
|
if (turboFrameTarget && turboFrameTarget !== "_top") {
|
10080
13340
|
request.headers["Turbo-Frame"] = turboFrameTarget;
|
10081
13341
|
}
|
@@ -10096,72 +13356,72 @@
|
|
10096
13356
|
get #cacheTtl() {
|
10097
13357
|
return Number(getMetaContent("turbo-prefetch-cache-time")) || cacheTtl;
|
10098
13358
|
}
|
10099
|
-
#isPrefetchable(
|
10100
|
-
const href =
|
13359
|
+
#isPrefetchable(link2) {
|
13360
|
+
const href = link2.getAttribute("href");
|
10101
13361
|
if (!href)
|
10102
13362
|
return false;
|
10103
|
-
if (unfetchableLink(
|
13363
|
+
if (unfetchableLink(link2))
|
10104
13364
|
return false;
|
10105
|
-
if (linkToTheSamePage(
|
13365
|
+
if (linkToTheSamePage(link2))
|
10106
13366
|
return false;
|
10107
|
-
if (linkOptsOut(
|
13367
|
+
if (linkOptsOut(link2))
|
10108
13368
|
return false;
|
10109
|
-
if (nonSafeLink(
|
13369
|
+
if (nonSafeLink(link2))
|
10110
13370
|
return false;
|
10111
|
-
if (eventPrevented(
|
13371
|
+
if (eventPrevented(link2))
|
10112
13372
|
return false;
|
10113
13373
|
return true;
|
10114
13374
|
}
|
10115
13375
|
};
|
10116
|
-
var unfetchableLink = (
|
10117
|
-
return
|
13376
|
+
var unfetchableLink = (link2) => {
|
13377
|
+
return link2.origin !== document.location.origin || !["http:", "https:"].includes(link2.protocol) || link2.hasAttribute("target");
|
10118
13378
|
};
|
10119
|
-
var linkToTheSamePage = (
|
10120
|
-
return
|
13379
|
+
var linkToTheSamePage = (link2) => {
|
13380
|
+
return link2.pathname + link2.search === document.location.pathname + document.location.search || link2.href.startsWith("#");
|
10121
13381
|
};
|
10122
|
-
var linkOptsOut = (
|
10123
|
-
if (
|
13382
|
+
var linkOptsOut = (link2) => {
|
13383
|
+
if (link2.getAttribute("data-turbo-prefetch") === "false")
|
10124
13384
|
return true;
|
10125
|
-
if (
|
13385
|
+
if (link2.getAttribute("data-turbo") === "false")
|
10126
13386
|
return true;
|
10127
|
-
const turboPrefetchParent = findClosestRecursively(
|
13387
|
+
const turboPrefetchParent = findClosestRecursively(link2, "[data-turbo-prefetch]");
|
10128
13388
|
if (turboPrefetchParent && turboPrefetchParent.getAttribute("data-turbo-prefetch") === "false")
|
10129
13389
|
return true;
|
10130
13390
|
return false;
|
10131
13391
|
};
|
10132
|
-
var nonSafeLink = (
|
10133
|
-
const turboMethod =
|
13392
|
+
var nonSafeLink = (link2) => {
|
13393
|
+
const turboMethod = link2.getAttribute("data-turbo-method");
|
10134
13394
|
if (turboMethod && turboMethod.toLowerCase() !== "get")
|
10135
13395
|
return true;
|
10136
|
-
if (isUJS(
|
13396
|
+
if (isUJS(link2))
|
10137
13397
|
return true;
|
10138
|
-
if (
|
13398
|
+
if (link2.hasAttribute("data-turbo-confirm"))
|
10139
13399
|
return true;
|
10140
|
-
if (
|
13400
|
+
if (link2.hasAttribute("data-turbo-stream"))
|
10141
13401
|
return true;
|
10142
13402
|
return false;
|
10143
13403
|
};
|
10144
|
-
var isUJS = (
|
10145
|
-
return
|
13404
|
+
var isUJS = (link2) => {
|
13405
|
+
return link2.hasAttribute("data-remote") || link2.hasAttribute("data-behavior") || link2.hasAttribute("data-confirm") || link2.hasAttribute("data-method");
|
10146
13406
|
};
|
10147
|
-
var eventPrevented = (
|
10148
|
-
const event = dispatch("turbo:before-prefetch", { target:
|
13407
|
+
var eventPrevented = (link2) => {
|
13408
|
+
const event = dispatch("turbo:before-prefetch", { target: link2, cancelable: true });
|
10149
13409
|
return event.defaultPrevented;
|
10150
13410
|
};
|
10151
13411
|
var Navigator = class {
|
10152
13412
|
constructor(delegate) {
|
10153
13413
|
this.delegate = delegate;
|
10154
13414
|
}
|
10155
|
-
proposeVisit(location2,
|
10156
|
-
if (this.delegate.allowsVisitingLocationWithAction(location2,
|
10157
|
-
this.delegate.visitProposedToLocation(location2,
|
13415
|
+
proposeVisit(location2, options2 = {}) {
|
13416
|
+
if (this.delegate.allowsVisitingLocationWithAction(location2, options2.action)) {
|
13417
|
+
this.delegate.visitProposedToLocation(location2, options2);
|
10158
13418
|
}
|
10159
13419
|
}
|
10160
|
-
startVisit(locatable, restorationIdentifier,
|
13420
|
+
startVisit(locatable, restorationIdentifier, options2 = {}) {
|
10161
13421
|
this.stop();
|
10162
13422
|
this.currentVisit = new Visit(this, expandURL(locatable), restorationIdentifier, {
|
10163
13423
|
referrer: this.location,
|
10164
|
-
...
|
13424
|
+
...options2
|
10165
13425
|
});
|
10166
13426
|
this.currentVisit.start();
|
10167
13427
|
}
|
@@ -10476,13 +13736,13 @@
|
|
10476
13736
|
}
|
10477
13737
|
};
|
10478
13738
|
async receiveMessageResponse(response) {
|
10479
|
-
const
|
10480
|
-
if (
|
10481
|
-
this.receiveMessageHTML(
|
13739
|
+
const html3 = await response.responseHTML;
|
13740
|
+
if (html3) {
|
13741
|
+
this.receiveMessageHTML(html3);
|
10482
13742
|
}
|
10483
13743
|
}
|
10484
|
-
receiveMessageHTML(
|
10485
|
-
this.delegate.receivedMessageFromStream(StreamMessage.wrap(
|
13744
|
+
receiveMessageHTML(html3) {
|
13745
|
+
this.delegate.receivedMessageFromStream(StreamMessage.wrap(html3));
|
10486
13746
|
}
|
10487
13747
|
};
|
10488
13748
|
function fetchResponseFromEvent(event) {
|
@@ -10930,10 +14190,10 @@
|
|
10930
14190
|
return potentialSoftMatch;
|
10931
14191
|
}
|
10932
14192
|
function parseContent(newContent) {
|
10933
|
-
let
|
14193
|
+
let parser2 = new DOMParser();
|
10934
14194
|
let contentWithSvgsRemoved = newContent.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim, "");
|
10935
14195
|
if (contentWithSvgsRemoved.match(/<\/html>/) || contentWithSvgsRemoved.match(/<\/head>/) || contentWithSvgsRemoved.match(/<\/body>/)) {
|
10936
|
-
let content =
|
14196
|
+
let content = parser2.parseFromString(newContent, "text/html");
|
10937
14197
|
if (contentWithSvgsRemoved.match(/<\/html>/)) {
|
10938
14198
|
content.generatedByIdiomorph = true;
|
10939
14199
|
return content;
|
@@ -10947,7 +14207,7 @@
|
|
10947
14207
|
}
|
10948
14208
|
}
|
10949
14209
|
} else {
|
10950
|
-
let responseDoc =
|
14210
|
+
let responseDoc = parser2.parseFromString("<body><template>" + newContent + "</template></body>", "text/html");
|
10951
14211
|
let content = responseDoc.body.querySelector("template").content;
|
10952
14212
|
content.generatedByIdiomorph = true;
|
10953
14213
|
return content;
|
@@ -11449,18 +14709,18 @@
|
|
11449
14709
|
document.removeEventListener("DOMContentLoaded", this.#preloadAll);
|
11450
14710
|
}
|
11451
14711
|
preloadOnLoadLinksForView(element) {
|
11452
|
-
for (const
|
11453
|
-
if (this.delegate.shouldPreloadLink(
|
11454
|
-
this.preloadURL(
|
14712
|
+
for (const link2 of element.querySelectorAll(this.selector)) {
|
14713
|
+
if (this.delegate.shouldPreloadLink(link2)) {
|
14714
|
+
this.preloadURL(link2);
|
11455
14715
|
}
|
11456
14716
|
}
|
11457
14717
|
}
|
11458
|
-
async preloadURL(
|
11459
|
-
const location2 = new URL(
|
14718
|
+
async preloadURL(link2) {
|
14719
|
+
const location2 = new URL(link2.href);
|
11460
14720
|
if (this.snapshotCache.has(location2)) {
|
11461
14721
|
return;
|
11462
14722
|
}
|
11463
|
-
const fetchRequest = new FetchRequest(this, FetchMethod.get, location2, new URLSearchParams(),
|
14723
|
+
const fetchRequest = new FetchRequest(this, FetchMethod.get, location2, new URLSearchParams(), link2);
|
11464
14724
|
await fetchRequest.perform();
|
11465
14725
|
}
|
11466
14726
|
// Fetch request delegate
|
@@ -11576,14 +14836,14 @@
|
|
11576
14836
|
registerAdapter(adapter) {
|
11577
14837
|
this.adapter = adapter;
|
11578
14838
|
}
|
11579
|
-
visit(location2,
|
11580
|
-
const frameElement =
|
14839
|
+
visit(location2, options2 = {}) {
|
14840
|
+
const frameElement = options2.frame ? document.getElementById(options2.frame) : null;
|
11581
14841
|
if (frameElement instanceof FrameElement) {
|
11582
|
-
const action =
|
14842
|
+
const action = options2.action || getVisitAction(frameElement);
|
11583
14843
|
frameElement.delegate.proposeVisitIfNavigatedWithAction(frameElement, action);
|
11584
14844
|
frameElement.src = location2.toString();
|
11585
14845
|
} else {
|
11586
|
-
this.navigator.proposeVisit(expandURL(location2),
|
14846
|
+
this.navigator.proposeVisit(expandURL(location2), options2);
|
11587
14847
|
}
|
11588
14848
|
}
|
11589
14849
|
refresh(url, requestId) {
|
@@ -11655,31 +14915,31 @@
|
|
11655
14915
|
this.history.updateRestorationData({ scrollPosition: position });
|
11656
14916
|
}
|
11657
14917
|
// Form click observer delegate
|
11658
|
-
willSubmitFormLinkToLocation(
|
11659
|
-
return this.elementIsNavigatable(
|
14918
|
+
willSubmitFormLinkToLocation(link2, location2) {
|
14919
|
+
return this.elementIsNavigatable(link2) && locationIsVisitable(location2, this.snapshot.rootLocation);
|
11660
14920
|
}
|
11661
14921
|
submittedFormLinkToLocation() {
|
11662
14922
|
}
|
11663
14923
|
// Link hover observer delegate
|
11664
|
-
canPrefetchRequestToLocation(
|
11665
|
-
return this.elementIsNavigatable(
|
14924
|
+
canPrefetchRequestToLocation(link2, location2) {
|
14925
|
+
return this.elementIsNavigatable(link2) && locationIsVisitable(location2, this.snapshot.rootLocation);
|
11666
14926
|
}
|
11667
14927
|
// Link click observer delegate
|
11668
|
-
willFollowLinkToLocation(
|
11669
|
-
return this.elementIsNavigatable(
|
14928
|
+
willFollowLinkToLocation(link2, location2, event) {
|
14929
|
+
return this.elementIsNavigatable(link2) && locationIsVisitable(location2, this.snapshot.rootLocation) && this.applicationAllowsFollowingLinkToLocation(link2, location2, event);
|
11670
14930
|
}
|
11671
|
-
followedLinkToLocation(
|
11672
|
-
const action = this.getActionForLink(
|
11673
|
-
const acceptsStreamResponse =
|
14931
|
+
followedLinkToLocation(link2, location2) {
|
14932
|
+
const action = this.getActionForLink(link2);
|
14933
|
+
const acceptsStreamResponse = link2.hasAttribute("data-turbo-stream");
|
11674
14934
|
this.visit(location2.href, { action, acceptsStreamResponse });
|
11675
14935
|
}
|
11676
14936
|
// Navigator delegate
|
11677
14937
|
allowsVisitingLocationWithAction(location2, action) {
|
11678
14938
|
return this.locationWithActionIsSamePage(location2, action) || this.applicationAllowsVisitingLocation(location2);
|
11679
14939
|
}
|
11680
|
-
visitProposedToLocation(location2,
|
14940
|
+
visitProposedToLocation(location2, options2) {
|
11681
14941
|
extendURLWithDeprecatedProperties(location2);
|
11682
|
-
this.adapter.visitProposedToLocation(location2,
|
14942
|
+
this.adapter.visitProposedToLocation(location2, options2);
|
11683
14943
|
}
|
11684
14944
|
// Visit delegate
|
11685
14945
|
visitStarted(visit2) {
|
@@ -11732,8 +14992,8 @@
|
|
11732
14992
|
this.notifyApplicationBeforeCachingSnapshot();
|
11733
14993
|
}
|
11734
14994
|
}
|
11735
|
-
allowsImmediateRender({ element },
|
11736
|
-
const event = this.notifyApplicationBeforeRender(element,
|
14995
|
+
allowsImmediateRender({ element }, options2) {
|
14996
|
+
const event = this.notifyApplicationBeforeRender(element, options2);
|
11737
14997
|
const {
|
11738
14998
|
defaultPrevented,
|
11739
14999
|
detail: { render }
|
@@ -11761,17 +15021,17 @@
|
|
11761
15021
|
this.notifyApplicationAfterFrameRender(fetchResponse, frame);
|
11762
15022
|
}
|
11763
15023
|
// Application events
|
11764
|
-
applicationAllowsFollowingLinkToLocation(
|
11765
|
-
const event = this.notifyApplicationAfterClickingLinkToLocation(
|
15024
|
+
applicationAllowsFollowingLinkToLocation(link2, location2, ev) {
|
15025
|
+
const event = this.notifyApplicationAfterClickingLinkToLocation(link2, location2, ev);
|
11766
15026
|
return !event.defaultPrevented;
|
11767
15027
|
}
|
11768
15028
|
applicationAllowsVisitingLocation(location2) {
|
11769
15029
|
const event = this.notifyApplicationBeforeVisitingLocation(location2);
|
11770
15030
|
return !event.defaultPrevented;
|
11771
15031
|
}
|
11772
|
-
notifyApplicationAfterClickingLinkToLocation(
|
15032
|
+
notifyApplicationAfterClickingLinkToLocation(link2, location2, event) {
|
11773
15033
|
return dispatch("turbo:click", {
|
11774
|
-
target:
|
15034
|
+
target: link2,
|
11775
15035
|
detail: { url: location2.href, originalEvent: event },
|
11776
15036
|
cancelable: true
|
11777
15037
|
});
|
@@ -11788,9 +15048,9 @@
|
|
11788
15048
|
notifyApplicationBeforeCachingSnapshot() {
|
11789
15049
|
return dispatch("turbo:before-cache");
|
11790
15050
|
}
|
11791
|
-
notifyApplicationBeforeRender(newBody,
|
15051
|
+
notifyApplicationBeforeRender(newBody, options2) {
|
11792
15052
|
return dispatch("turbo:before-render", {
|
11793
|
-
detail: { newBody, ...
|
15053
|
+
detail: { newBody, ...options2 },
|
11794
15054
|
cancelable: true
|
11795
15055
|
});
|
11796
15056
|
}
|
@@ -11851,8 +15111,8 @@
|
|
11851
15111
|
}
|
11852
15112
|
}
|
11853
15113
|
// Private
|
11854
|
-
getActionForLink(
|
11855
|
-
return getVisitAction(
|
15114
|
+
getActionForLink(link2) {
|
15115
|
+
return getVisitAction(link2) || "advance";
|
11856
15116
|
}
|
11857
15117
|
get snapshot() {
|
11858
15118
|
return this.view.snapshot;
|
@@ -11876,8 +15136,8 @@
|
|
11876
15136
|
function registerAdapter(adapter) {
|
11877
15137
|
session.registerAdapter(adapter);
|
11878
15138
|
}
|
11879
|
-
function visit(location2,
|
11880
|
-
session.visit(location2,
|
15139
|
+
function visit(location2, options2) {
|
15140
|
+
session.visit(location2, options2);
|
11881
15141
|
}
|
11882
15142
|
function connectStreamSource(source) {
|
11883
15143
|
session.connectStreamSource(source);
|
@@ -12009,9 +15269,9 @@
|
|
12009
15269
|
this.sourceURL = fetchResponse.response.url;
|
12010
15270
|
}
|
12011
15271
|
try {
|
12012
|
-
const
|
12013
|
-
if (
|
12014
|
-
const document2 = parseHTMLDocument(
|
15272
|
+
const html3 = await fetchResponse.responseHTML;
|
15273
|
+
if (html3) {
|
15274
|
+
const document2 = parseHTMLDocument(html3);
|
12015
15275
|
const pageSnapshot = PageSnapshot.fromDocument(document2);
|
12016
15276
|
if (pageSnapshot.isVisitable) {
|
12017
15277
|
await this.#loadFrameResponse(fetchResponse, document2);
|
@@ -12029,11 +15289,11 @@
|
|
12029
15289
|
this.#loadSourceURL();
|
12030
15290
|
}
|
12031
15291
|
// Form link click observer delegate
|
12032
|
-
willSubmitFormLinkToLocation(
|
12033
|
-
return this.#shouldInterceptNavigation(
|
15292
|
+
willSubmitFormLinkToLocation(link2) {
|
15293
|
+
return this.#shouldInterceptNavigation(link2);
|
12034
15294
|
}
|
12035
|
-
submittedFormLinkToLocation(
|
12036
|
-
const frame = this.#findFrameElement(
|
15295
|
+
submittedFormLinkToLocation(link2, _location, form) {
|
15296
|
+
const frame = this.#findFrameElement(link2);
|
12037
15297
|
if (frame)
|
12038
15298
|
form.setAttribute("data-turbo-frame", frame.id);
|
12039
15299
|
}
|
@@ -12108,10 +15368,10 @@
|
|
12108
15368
|
clearBusyState(formElement, this.#findFrameElement(formElement));
|
12109
15369
|
}
|
12110
15370
|
// View delegate
|
12111
|
-
allowsImmediateRender({ element: newFrame },
|
15371
|
+
allowsImmediateRender({ element: newFrame }, options2) {
|
12112
15372
|
const event = dispatch("turbo:before-frame-render", {
|
12113
15373
|
target: this.element,
|
12114
|
-
detail: { newFrame, ...
|
15374
|
+
detail: { newFrame, ...options2 },
|
12115
15375
|
cancelable: true
|
12116
15376
|
});
|
12117
15377
|
const {
|
@@ -12190,7 +15450,7 @@
|
|
12190
15450
|
const { statusCode, redirected } = fetchResponse;
|
12191
15451
|
const responseHTML = await fetchResponse.responseHTML;
|
12192
15452
|
const response = { statusCode, redirected, responseHTML };
|
12193
|
-
const
|
15453
|
+
const options2 = {
|
12194
15454
|
response,
|
12195
15455
|
visitCachedSnapshot,
|
12196
15456
|
willRender: false,
|
@@ -12199,8 +15459,8 @@
|
|
12199
15459
|
snapshot: pageSnapshot
|
12200
15460
|
};
|
12201
15461
|
if (this.action)
|
12202
|
-
|
12203
|
-
session.visit(frame.src,
|
15462
|
+
options2.action = this.action;
|
15463
|
+
session.visit(frame.src, options2);
|
12204
15464
|
}
|
12205
15465
|
};
|
12206
15466
|
}
|
@@ -12220,11 +15480,11 @@
|
|
12220
15480
|
#willHandleFrameMissingFromResponse(fetchResponse) {
|
12221
15481
|
this.element.setAttribute("complete", "");
|
12222
15482
|
const response = fetchResponse.response;
|
12223
|
-
const visit2 = async (url,
|
15483
|
+
const visit2 = async (url, options2) => {
|
12224
15484
|
if (url instanceof Response) {
|
12225
15485
|
this.#visitResponse(url);
|
12226
15486
|
} else {
|
12227
|
-
session.visit(url,
|
15487
|
+
session.visit(url, options2);
|
12228
15488
|
}
|
12229
15489
|
};
|
12230
15490
|
const event = dispatch("turbo:frame-missing", {
|
@@ -12640,6 +15900,9 @@
|
|
12640
15900
|
})();
|
12641
15901
|
/*! Bundled license information:
|
12642
15902
|
|
15903
|
+
dompurify/dist/purify.es.mjs:
|
15904
|
+
(*! @license DOMPurify 3.2.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.2/LICENSE *)
|
15905
|
+
|
12643
15906
|
@hotwired/turbo/dist/turbo.es2017-esm.js:
|
12644
15907
|
(*!
|
12645
15908
|
Turbo 8.0.4
|