@subiz/widget-v4 4.0.50 → 4.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/img/default.jpg +0 -0
- package/assets/less/message.less +101 -10
- package/compiled_src/chatbox/Event.js +6 -0
- package/compiled_src/chatbox/OrderAttachments.js +113 -0
- package/compiled_src/chatbox/ProductAttachments.js +6 -4
- package/compiled_src/store/store.js +150 -0
- package/compiled_src/util/common.js +7 -0
- package/dist/{17cbc0a3e5f.178.js → 17d02a15859.178.js} +0 -0
- package/dist/{17cbc0a3e5f.213.js → 17d02a15859.213.js} +0 -0
- package/dist/{17cbc0a3e5f.362.js → 17d02a15859.362.js} +0 -0
- package/dist/17d02a15859.441.js +1 -0
- package/dist/{17cbc0a3e5f.605.js → 17d02a15859.605.js} +0 -0
- package/dist/{17cbc0a3e5f.619.js → 17d02a15859.619.js} +0 -0
- package/dist/{17cbc0a3e5f.678.js → 17d02a15859.678.js} +0 -0
- package/dist/{17cbc0a3e5f.712.js → 17d02a15859.712.js} +1 -1
- package/dist/{17cbc0a3e5f.782.js → 17d02a15859.782.js} +0 -0
- package/dist/17d02a15859.app.js +1 -0
- package/dist/{17cbc0a3e5f.index.html → 17d02a15859.index.html} +1 -1
- package/dist/{17cbc0a3e5f.library.html → 17d02a15859.library.html} +1 -1
- package/dist/17d02a15859.library.js +1 -0
- package/dist/{17cbc0a3e5f.preview.html → 17d02a15859.preview.html} +1 -1
- package/dist/17d02a15859.preview.js +1 -0
- package/dist/HASH +1 -1
- package/package.json +6 -6
- package/src/chatbox/Event.js +2 -0
- package/src/chatbox/OrderAttachments.js +112 -0
- package/src/chatbox/ProductAttachments.js +11 -5
- package/src/store/store.js +146 -8
- package/src/util/common.js +6 -0
- package/dist/17cbc0a3e5f.84.js +0 -1
- package/dist/17cbc0a3e5f.app.js +0 -1
- package/dist/17cbc0a3e5f.library.js +0 -1
- package/dist/17cbc0a3e5f.preview.js +0 -1
|
Binary file
|
package/assets/less/message.less
CHANGED
|
@@ -148,13 +148,13 @@
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
a.message_error {
|
|
151
|
-
color
|
|
151
|
+
.color(@red);
|
|
152
152
|
display: block;
|
|
153
153
|
text-align: end;
|
|
154
154
|
font-size: 13px;
|
|
155
155
|
margin-bottom: 10px;
|
|
156
156
|
&:hover {
|
|
157
|
-
color
|
|
157
|
+
.color(@red);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
|
|
@@ -404,7 +404,7 @@ a.message_error {
|
|
|
404
404
|
border: 1px solid @primary-color;
|
|
405
405
|
margin-right: 10px;
|
|
406
406
|
margin-top: 10px;
|
|
407
|
-
color
|
|
407
|
+
.color(@primary-color);
|
|
408
408
|
border-radius: 5px;
|
|
409
409
|
user-select: none;
|
|
410
410
|
overflow: hidden;
|
|
@@ -508,14 +508,14 @@ a.message_error {
|
|
|
508
508
|
display: flex;
|
|
509
509
|
align-items: center;
|
|
510
510
|
justify-content: center;
|
|
511
|
-
color
|
|
511
|
+
.color(rgba(255, 255, 255, 0.85));
|
|
512
512
|
text-shadow: 0 10px 25px rgba(0, 0, 0, 0.75);
|
|
513
513
|
z-index: 999;
|
|
514
514
|
user-select: none;
|
|
515
515
|
|
|
516
516
|
&:hover {
|
|
517
517
|
text-shadow: 0 10px 20px rgba(0, 0, 0, 0.75);
|
|
518
|
-
color
|
|
518
|
+
.color(rgba(255, 255, 255, 1));
|
|
519
519
|
}
|
|
520
520
|
|
|
521
521
|
&.generic-attachment-navigator--disabled {
|
|
@@ -535,6 +535,98 @@ a.message_error {
|
|
|
535
535
|
font-size: 80px;
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
+
.order_attachment__product_img {
|
|
539
|
+
width: 40px;
|
|
540
|
+
height: 40px;
|
|
541
|
+
margin-right: 10px;
|
|
542
|
+
border-radius: 5px;
|
|
543
|
+
flex-shrink: 0;
|
|
544
|
+
display: block;
|
|
545
|
+
object-fit: contain;
|
|
546
|
+
background: whitesmoke;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
.order_attachment__product_name {
|
|
550
|
+
text-overflow: ellipsis;
|
|
551
|
+
white-space: nowrap;
|
|
552
|
+
overflow: hidden;
|
|
553
|
+
.color(black);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
.order_attachment__header {
|
|
557
|
+
padding-bottom: 5px;
|
|
558
|
+
border-bottom: 1px solid #ccc;
|
|
559
|
+
margin-bottom: 5px;
|
|
560
|
+
display: flex;
|
|
561
|
+
align-items: center;
|
|
562
|
+
justify-content: space-between;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.order_attachment__product_desc {
|
|
566
|
+
text-overflow: ellipsis;
|
|
567
|
+
white-space: nowrap;
|
|
568
|
+
overflow: hidden;
|
|
569
|
+
.color(#999);
|
|
570
|
+
font-size: 13px;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.order_attachment__product {
|
|
574
|
+
display: flex;
|
|
575
|
+
align-items: center;
|
|
576
|
+
margin-top: 5px;
|
|
577
|
+
margin-bottom: 5;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
.order_attachment__text_sm {
|
|
581
|
+
font-size: 13px;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.order_attachment__text_muted {
|
|
585
|
+
.color(@text-muted);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.order_attachment__text_truncate {
|
|
589
|
+
text-overflow: ellipsis;
|
|
590
|
+
white-space: nowrap;
|
|
591
|
+
overflow: hidden;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
.order_attachment {
|
|
595
|
+
margin-top: 10px;
|
|
596
|
+
.color(black);
|
|
597
|
+
border: 1px solid #aaa;
|
|
598
|
+
background: white;
|
|
599
|
+
border-radius: 8px;
|
|
600
|
+
width: 220px;
|
|
601
|
+
overflow-y: auto;
|
|
602
|
+
overflow-x: hidden;
|
|
603
|
+
padding: 10px;
|
|
604
|
+
}
|
|
605
|
+
.order_attachment__footer {
|
|
606
|
+
margin-top: 10px;
|
|
607
|
+
padding-top: 10px;
|
|
608
|
+
display: flex;
|
|
609
|
+
justify-content: space-between;
|
|
610
|
+
border-top: 1px solid #ccc;
|
|
611
|
+
line-height: 1;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.order_attachment__label {
|
|
615
|
+
font-size: 13px;
|
|
616
|
+
.color(#777);
|
|
617
|
+
margin-top: 10px;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.order_attachment.order_attachment__user {
|
|
621
|
+
margin-right: 50px;
|
|
622
|
+
|
|
623
|
+
align-self: flex-end;
|
|
624
|
+
|
|
625
|
+
margin-right: 0;
|
|
626
|
+
margin-left: 50px;
|
|
627
|
+
align-self: flex-start;
|
|
628
|
+
}
|
|
629
|
+
|
|
538
630
|
.product_attachment {
|
|
539
631
|
margin-top: 10px;
|
|
540
632
|
|
|
@@ -567,7 +659,6 @@ a.message_error {
|
|
|
567
659
|
}
|
|
568
660
|
|
|
569
661
|
.product_attachment__price {
|
|
570
|
-
color: #aaa;
|
|
571
662
|
padding-left: 10px;
|
|
572
663
|
}
|
|
573
664
|
|
|
@@ -579,7 +670,7 @@ a.message_error {
|
|
|
579
670
|
display: flex;
|
|
580
671
|
padding: 8px 10px;
|
|
581
672
|
align-items: center;
|
|
582
|
-
color
|
|
673
|
+
.color(@black);
|
|
583
674
|
justify-content: center;
|
|
584
675
|
cursor: pointer;
|
|
585
676
|
text-transform: capitalize;
|
|
@@ -587,7 +678,7 @@ a.message_error {
|
|
|
587
678
|
margin-right: 0;
|
|
588
679
|
}
|
|
589
680
|
&:hover {
|
|
590
|
-
color
|
|
681
|
+
.color(@primary-color);
|
|
591
682
|
}
|
|
592
683
|
}
|
|
593
684
|
|
|
@@ -595,14 +686,14 @@ a.product_attachment__title {
|
|
|
595
686
|
display: block;
|
|
596
687
|
padding: 8px 10px 0 10px;
|
|
597
688
|
font-weight: 500;
|
|
598
|
-
color
|
|
689
|
+
.color(@black);
|
|
599
690
|
|
|
600
691
|
word-break: break-all;
|
|
601
692
|
}
|
|
602
693
|
|
|
603
694
|
.product_attachment__subtitle {
|
|
604
695
|
padding: 5px 10px;
|
|
605
|
-
color
|
|
696
|
+
.color(#aaa);
|
|
606
697
|
padding-top: 0;
|
|
607
698
|
}
|
|
608
699
|
|
|
@@ -23,6 +23,8 @@ var _GenericTemplateAttachments = _interopRequireDefault(require("./GenericTempl
|
|
|
23
23
|
|
|
24
24
|
var _ProductAttachments = _interopRequireDefault(require("./ProductAttachments.js"));
|
|
25
25
|
|
|
26
|
+
var _OrderAttachments = _interopRequireDefault(require("./OrderAttachments.js"));
|
|
27
|
+
|
|
26
28
|
var _VideoAttachments = _interopRequireDefault(require("./VideoAttachments.js"));
|
|
27
29
|
|
|
28
30
|
var _TextMessage = _interopRequireDefault(require("./TextMessage.js"));
|
|
@@ -199,6 +201,10 @@ class Event extends _common.Com {
|
|
|
199
201
|
t: this.props.t,
|
|
200
202
|
store: this.props.store,
|
|
201
203
|
ev: ev
|
|
204
|
+
}), (0, _preact.h)(_OrderAttachments.default, {
|
|
205
|
+
t: this.props.t,
|
|
206
|
+
store: this.props.store,
|
|
207
|
+
ev: ev
|
|
202
208
|
}), (0, _preact.h)(_QuickReplies.default, {
|
|
203
209
|
store: this.props.store,
|
|
204
210
|
ev: ev,
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _index = _interopRequireDefault(require("../util/index.js"));
|
|
9
|
+
|
|
10
|
+
var _common = require("../common.js");
|
|
11
|
+
|
|
12
|
+
var _preact = require("preact");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
class ProductAttachments extends _common.Com {
|
|
17
|
+
render() {
|
|
18
|
+
let byType = _index.default.get(this.props.ev, 'by.type');
|
|
19
|
+
|
|
20
|
+
if (byType === 'user') return null;
|
|
21
|
+
let acc = this.props.store.matchAccount();
|
|
22
|
+
|
|
23
|
+
var attachments = _index.default.get(this.props.ev, 'data.message.attachments', []);
|
|
24
|
+
|
|
25
|
+
let orders = _index.default.filter(attachments, att => att.type === 'order' && att.order).map(att => att.order);
|
|
26
|
+
|
|
27
|
+
if (orders.length === 0) return null;
|
|
28
|
+
|
|
29
|
+
let $orders = _index.default.map(orders, (order, index) => {
|
|
30
|
+
let $note = null;
|
|
31
|
+
|
|
32
|
+
if (order.note) {
|
|
33
|
+
$note = (0, _preact.h)("div", null, (0, _preact.h)("div", {
|
|
34
|
+
class: "order_attachment__label"
|
|
35
|
+
}, this.props.t('note')), (0, _preact.h)("div", {
|
|
36
|
+
class: "order_attachment__text_truncate"
|
|
37
|
+
}, order.note));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let $products = null;
|
|
41
|
+
|
|
42
|
+
if (_index.default.size(order.items) > 0) {
|
|
43
|
+
$products = (0, _preact.h)("div", null, (0, _preact.h)("div", {
|
|
44
|
+
class: "order_attachment__label"
|
|
45
|
+
}, this.props.t('product')), _index.default.map(order.items, item => {
|
|
46
|
+
let product = item.product || {};
|
|
47
|
+
let price = this.props.store.getPrice(product, 'price', order.currency);
|
|
48
|
+
return (0, _preact.h)("div", {
|
|
49
|
+
class: "order_attachment__product"
|
|
50
|
+
}, (0, _preact.h)("img", {
|
|
51
|
+
class: "order_attachment__product_img",
|
|
52
|
+
src: (_index.default.get(product, 'images.0'), require('../../assets/img/default.jpg'))
|
|
53
|
+
}), (0, _preact.h)("div", {
|
|
54
|
+
style: "overflow: hidden !important;"
|
|
55
|
+
}, (0, _preact.h)("div", {
|
|
56
|
+
class: "order_attachment__product_name"
|
|
57
|
+
}, this.props.t.i18n(product.name)), (0, _preact.h)("div", {
|
|
58
|
+
class: "order_attachment__product_desc"
|
|
59
|
+
}, this.props.t.i18n(product.short_description) || this.props.t.i18n(product.description)), (0, _preact.h)("div", {
|
|
60
|
+
class: "order_attachment__product_desc"
|
|
61
|
+
}, this.props.t('qty'), " ", item.quantity, "\xA0\xB7\xA0", _index.default.formatCurrency(price))));
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
let {
|
|
66
|
+
total
|
|
67
|
+
} = this.props.store.getOrderTotal(order);
|
|
68
|
+
let $total = (0, _preact.h)("div", {
|
|
69
|
+
class: "order_attachment__footer"
|
|
70
|
+
}, (0, _preact.h)("div", null, this.props.t('total')), ' ', (0, _preact.h)("div", null, (0, _preact.h)("b", null, _index.default.formatCurrency(total))));
|
|
71
|
+
|
|
72
|
+
let addr = _index.default.get(order, 'shipping.address', {});
|
|
73
|
+
|
|
74
|
+
let fulladdr = [addr.street, addr.ward, addr.district, addr.region, addr.country].filter(a => a).join(', ');
|
|
75
|
+
let address = fulladdr;
|
|
76
|
+
let phoneattr = _index.default.find(_index.default.get(order, 'user.attributes', []), attr => attr.key === 'phones') || {
|
|
77
|
+
key: 'phones',
|
|
78
|
+
text: ''
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
let phone = _index.default.get(order, 'shipping.address.phone', '').trim();
|
|
82
|
+
|
|
83
|
+
phone = phone || _index.default.trim(phoneattr.text);
|
|
84
|
+
if (phone) phone = this.props.t('phn') + ': ' + phone;
|
|
85
|
+
let $shipto = null;
|
|
86
|
+
|
|
87
|
+
if (address || phone) {
|
|
88
|
+
$shipto = (0, _preact.h)("div", null, (0, _preact.h)("div", {
|
|
89
|
+
class: "order_attachment__label"
|
|
90
|
+
}, this.props.t('ship_to')), (0, _preact.h)("div", {
|
|
91
|
+
class: "order_attachment__text_truncate"
|
|
92
|
+
}, address), (0, _preact.h)("div", {
|
|
93
|
+
class: "order_attachment__text_truncate"
|
|
94
|
+
}, phone));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return (0, _preact.h)("div", {
|
|
98
|
+
class: `order_attachment order_attachment__${byType}`
|
|
99
|
+
}, (0, _preact.h)("div", {
|
|
100
|
+
class: "order_attachment__header"
|
|
101
|
+
}, this.props.t('order'), (0, _preact.h)("span", {
|
|
102
|
+
class: "order_attachment__text_muted order_attachment__text_sm"
|
|
103
|
+
}, "#", order.id)), $products, $shipto, (0, _preact.h)("div", null, (0, _preact.h)("div", {
|
|
104
|
+
class: "order_attachment__label"
|
|
105
|
+
}, this.props.t('payment')), (0, _preact.h)("div", null, "COD")), $note, $total);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
return $orders;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
exports.default = ProductAttachments;
|
|
@@ -25,6 +25,7 @@ class ProductAttachments extends _common.Com {
|
|
|
25
25
|
|
|
26
26
|
products = products.filter(product => product.product && product.product.name);
|
|
27
27
|
if (products.length === 0) return null;
|
|
28
|
+
let acc = this.props.store.matchAccount();
|
|
28
29
|
|
|
29
30
|
let $products = _index.default.map(products, (att, index) => {
|
|
30
31
|
let product = att.product;
|
|
@@ -45,15 +46,16 @@ class ProductAttachments extends _common.Com {
|
|
|
45
46
|
target: "_blank"
|
|
46
47
|
}, this.props.t.i18n(product.name));
|
|
47
48
|
let $subtitle = null;
|
|
48
|
-
|
|
49
|
+
let desc = this.props.t.i18n(product.short_description) || this.props.t.i18n(product.description);
|
|
50
|
+
if (desc) $subtitle = (0, _preact.h)("div", {
|
|
49
51
|
class: "product_attachment__subtitle"
|
|
50
|
-
},
|
|
52
|
+
}, desc);
|
|
51
53
|
let $price = null;
|
|
52
54
|
|
|
53
|
-
if (product.
|
|
55
|
+
if (product.price) {
|
|
54
56
|
$price = (0, _preact.h)("div", {
|
|
55
57
|
class: "product_attachment__price"
|
|
56
|
-
}, product.
|
|
58
|
+
}, product.currency || _index.default.get(acc, 'currency', ''), " ", _index.default.formatCurrency(product.price));
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
return (0, _preact.h)("div", {
|
|
@@ -1015,6 +1015,156 @@ class Store {
|
|
|
1015
1015
|
setTimeout(() => this.loopTime(), 60000);
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
+
getPrice(obj, field, currency) {
|
|
1019
|
+
if (!obj) return 0;
|
|
1020
|
+
if (!currency) return obj[field] || 0;
|
|
1021
|
+
|
|
1022
|
+
let defcur = _index.default.get(this.matchAccount(), 'currency');
|
|
1023
|
+
|
|
1024
|
+
if (currency != defcur) return _index.default.get(obj, [field + '_locale', currency], 0);
|
|
1025
|
+
return obj[field] || 0;
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
getOrderTotal(order) {
|
|
1029
|
+
let subtotal = 0;
|
|
1030
|
+
|
|
1031
|
+
_index.default.map(order.items, item => {
|
|
1032
|
+
if (!item.product) return 0;
|
|
1033
|
+
let price = this.getPrice(item.product, 'price', order.currency) * item.quantity;
|
|
1034
|
+
|
|
1035
|
+
if (item.discount_type) {
|
|
1036
|
+
if (item.discount_type == 'percentage') {
|
|
1037
|
+
if (item.discount_before_tax && item.discount_percentage > 0) {
|
|
1038
|
+
price = price * (1 - item.discount_percentage / 10000);
|
|
1039
|
+
}
|
|
1040
|
+
} else if (item.discount_type == 'amount') {
|
|
1041
|
+
let computed_discount = this.getPrice(item, 'discount', order.currency);
|
|
1042
|
+
|
|
1043
|
+
if (item.discount_before_tax && computed_discount > 0) {
|
|
1044
|
+
price = price - computed_discount;
|
|
1045
|
+
if (price <= 0) price = 0;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
subtotal += price;
|
|
1051
|
+
});
|
|
1052
|
+
|
|
1053
|
+
let computed_discount = 0;
|
|
1054
|
+
|
|
1055
|
+
_index.default.map(order.items, item => {
|
|
1056
|
+
if (!item.discount_type) return;
|
|
1057
|
+
if (!item.product) return 0;
|
|
1058
|
+
let price = this.getPrice(item.product, 'price', order.currency) * item.quantity;
|
|
1059
|
+
let tax = item.product.tax;
|
|
1060
|
+
let taxprice = 0;
|
|
1061
|
+
if (tax && tax.id) taxprice = price * tax.percentage / 10000;
|
|
1062
|
+
|
|
1063
|
+
if (item.discount_type == 'percentage' && !item.discount_before_tax && item.discount_percentage > 0) {
|
|
1064
|
+
computed_discount += (price + taxprice) * item.discount_percentage / 10000;
|
|
1065
|
+
} else if (item.discount_type == 'amount') {
|
|
1066
|
+
let itemdiscount = this.getPrice(item, 'discount', order.currency);
|
|
1067
|
+
|
|
1068
|
+
if (!item.discount_before_tax && itemdiscount > 0) {
|
|
1069
|
+
if (itemdiscount > price + taxprice) itemdiscount = price + taxprice;
|
|
1070
|
+
computed_discount += itemdiscount;
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
let totaltax = 0;
|
|
1076
|
+
let taxM = {};
|
|
1077
|
+
|
|
1078
|
+
_index.default.map(order.items, (item, i) => {
|
|
1079
|
+
if (!item.product) return;
|
|
1080
|
+
let tax = item.product.tax;
|
|
1081
|
+
if (!tax) return;
|
|
1082
|
+
if (!tax.id) return;
|
|
1083
|
+
let price = this.getPrice(item.product, 'price', order.currency) * item.quantity;
|
|
1084
|
+
|
|
1085
|
+
if (item.discount_type) {
|
|
1086
|
+
if (item.discount_type == 'percentage') {
|
|
1087
|
+
if (item.discount_before_tax && item.discount_percentage > 0) {
|
|
1088
|
+
price = price * (1 - item.discount_percentage / 10000);
|
|
1089
|
+
}
|
|
1090
|
+
} else if (item.discount_type == 'amount') {
|
|
1091
|
+
let computed_discount = this.getPrice(item, 'discount', order.currency);
|
|
1092
|
+
|
|
1093
|
+
if (item.discount_before_tax && computed_discount > 0) {
|
|
1094
|
+
price = price - computed_discount;
|
|
1095
|
+
if (price <= 0) price = 0;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
let taxprice = price * tax.percentage / 10000;
|
|
1101
|
+
taxM[i] = {
|
|
1102
|
+
tax: tax,
|
|
1103
|
+
taxprice: taxprice
|
|
1104
|
+
};
|
|
1105
|
+
});
|
|
1106
|
+
|
|
1107
|
+
if (order.discount_before_tax) {
|
|
1108
|
+
if (order.discount_type == 'percentage' && order.discount_percentage > 0) {
|
|
1109
|
+
_index.default.map(taxM, t => {
|
|
1110
|
+
t.taxprice = t.taxprice * (1 - order.discount_percentage / 10000);
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
computed_discount += subtotal * order.discount_percentage / 10000;
|
|
1114
|
+
} else if (order.discount_type == 'amount') {
|
|
1115
|
+
let discount = this.getPrice(order, 'discount', order.currency);
|
|
1116
|
+
|
|
1117
|
+
if (subtotal > 0) {
|
|
1118
|
+
_index.default.map(taxM, t => {
|
|
1119
|
+
if (discount > subtotal) discount = subtotal;
|
|
1120
|
+
t.taxprice = t.taxprice * (1 - discount / subtotal);
|
|
1121
|
+
});
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
computed_discount += discount;
|
|
1125
|
+
}
|
|
1126
|
+
} else {
|
|
1127
|
+
if (order.discount_type == 'percentage' && order.discount_percentage > 0) {
|
|
1128
|
+
let taxprice = 0;
|
|
1129
|
+
|
|
1130
|
+
_index.default.map(taxM, t => taxprice += t.taxprice);
|
|
1131
|
+
|
|
1132
|
+
computed_discount += (subtotal + taxprice) * order.discount_percentage / 10000;
|
|
1133
|
+
} else if (order.discount_type == 'amount') {
|
|
1134
|
+
let discount = this.getPrice(order, 'discount', order.currency);
|
|
1135
|
+
computed_discount += discount;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1139
|
+
let shippingfee = this.getPrice(order.shipping, 'fee', order.currency);
|
|
1140
|
+
|
|
1141
|
+
if (shippingfee > 0) {
|
|
1142
|
+
if (_index.default.get(order, 'shipping.tax.id')) {
|
|
1143
|
+
let tax = order.shipping.tax;
|
|
1144
|
+
let taxprice = shippingfee * tax.percentage / 10000;
|
|
1145
|
+
taxM['ship'] = {
|
|
1146
|
+
tax: tax,
|
|
1147
|
+
taxprice: taxprice
|
|
1148
|
+
};
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
let taxprice = 0;
|
|
1153
|
+
|
|
1154
|
+
_index.default.map(taxM, t => taxprice += t.taxprice);
|
|
1155
|
+
|
|
1156
|
+
let total = subtotal + taxprice - computed_discount + shippingfee;
|
|
1157
|
+
let adj = this.getPrice(order, 'adjustment', order.currency);
|
|
1158
|
+
total += adj;
|
|
1159
|
+
if (total < 0) total = 0;
|
|
1160
|
+
return {
|
|
1161
|
+
subtotal,
|
|
1162
|
+
computed_discount,
|
|
1163
|
+
taxM,
|
|
1164
|
+
total
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1018
1168
|
replaceFileUrl(src) {
|
|
1019
1169
|
if (!src) return '';
|
|
1020
1170
|
if (_index.default.startsWith(src, '/')) return src;
|
|
@@ -15,6 +15,7 @@ exports.diffYear = diffYear;
|
|
|
15
15
|
exports.each = each;
|
|
16
16
|
exports.filter = filter;
|
|
17
17
|
exports.find = find;
|
|
18
|
+
exports.formatCurrency = formatCurrency;
|
|
18
19
|
exports.getAgentDisplayName = getAgentDisplayName;
|
|
19
20
|
exports.getDayName = getDayName;
|
|
20
21
|
exports.getIntegrationId = getIntegrationId;
|
|
@@ -1129,6 +1130,12 @@ var sleep = ms => new Promise(res => setTimeout(res, ms));
|
|
|
1129
1130
|
|
|
1130
1131
|
exports.sleep = sleep;
|
|
1131
1132
|
|
|
1133
|
+
function formatCurrency(val) {
|
|
1134
|
+
if (!val) return 0;
|
|
1135
|
+
val = Math.round(val);
|
|
1136
|
+
return val.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
|
|
1137
|
+
}
|
|
1138
|
+
|
|
1132
1139
|
function replaceFileUrl(src) {
|
|
1133
1140
|
let fileurl = 'https://vcdn.subiz-cdn.com/file/';
|
|
1134
1141
|
if (!src) return '';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_subiz_widget_v4=self.webpackChunk_subiz_widget_v4||[]).push([[441],{7441:(e,t,n)=>{function s(){return{baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}n.r(t),n.d(t,{Lexer:()=>O,Parser:()=>j,Renderer:()=>C,Slugger:()=>B,TextRenderer:()=>D,Tokenizer:()=>E,defaults:()=>r,getDefaults:()=>s,lexer:()=>V,marked:()=>P,options:()=>Q,parse:()=>X,parseInline:()=>F,parser:()=>G,setOptions:()=>U,use:()=>M,walkTokens:()=>N});let r={baseUrl:null,breaks:!1,extensions:null,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1};const i=/[&<>"']/,l=/[&<>"']/g,o=/[<>"']|&(?!#?\w+;)/,a=/[<>"']|&(?!#?\w+;)/g,c={"&":"&","<":"<",">":">",'"':""","'":"'"},h=e=>c[e];function p(e,t){if(t){if(i.test(e))return e.replace(l,h)}else if(o.test(e))return e.replace(a,h);return e}const u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function g(e){return e.replace(u,((e,t)=>"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""))}const k=/(^|[^\[])\^/g;function f(e,t){e=e.source||e,t=t||"";const n={replace:(t,s)=>(s=(s=s.source||s).replace(k,"$1"),e=e.replace(t,s),n),getRegex:()=>new RegExp(e,t)};return n}const d=/[^\w:]/g,x=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;function m(e,t,n){if(e){let e;try{e=decodeURIComponent(g(n)).replace(d,"").toLowerCase()}catch(e){return null}if(0===e.indexOf("javascript:")||0===e.indexOf("vbscript:")||0===e.indexOf("data:"))return null}t&&!x.test(n)&&(n=function(e,t){b[" "+e]||(w.test(e)?b[" "+e]=e+"/":b[" "+e]=T(e,"/",!0));const n=-1===(e=b[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(_,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(y,"$1")+t:e+t}(t,n));try{n=encodeURI(n).replace(/%25/g,"%")}catch(e){return null}return n}const b={},w=/^[^:]+:\/*[^/]*$/,_=/^([^:]+:)[\s\S]*$/,y=/^([^:]+:\/*[^/]*)[\s\S]*$/,z={exec:function(){}};function $(e){let t,n,s=1;for(;s<arguments.length;s++)for(n in t=arguments[s],t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function S(e,t){const n=e.replace(/\|/g,((e,t,n)=>{let s=!1,r=t;for(;--r>=0&&"\\"===n[r];)s=!s;return s?"|":" |"})).split(/ \|/);let s=0;if(n[0].trim()||n.shift(),n[n.length-1].trim()||n.pop(),n.length>t)n.splice(t);else for(;n.length<t;)n.push("");for(;s<n.length;s++)n[s]=n[s].trim().replace(/\\\|/g,"|");return n}function T(e,t,n){const s=e.length;if(0===s)return"";let r=0;for(;r<s;){const i=e.charAt(s-r-1);if(i!==t||n){if(i===t||!n)break;r++}else r++}return e.substr(0,s-r)}function A(e){e&&e.sanitize&&!e.silent&&console.warn("marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options")}function R(e,t){if(t<1)return"";let n="";for(;t>1;)1&t&&(n+=e),t>>=1,e+=e;return n+e}function I(e,t,n,s){const r=t.href,i=t.title?p(t.title):null,l=e[1].replace(/\\([\[\]])/g,"$1");if("!"!==e[0].charAt(0)){s.state.inLink=!0;const e={type:"link",raw:n,href:r,title:i,text:l,tokens:s.inlineTokens(l,[])};return s.state.inLink=!1,e}return{type:"image",raw:n,href:r,title:i,text:p(l)}}class E{constructor(e){this.options=e||r}space(e){const t=this.rules.block.newline.exec(e);if(t)return t[0].length>1?{type:"space",raw:t[0]}:{raw:"\n"}}code(e){const t=this.rules.block.code.exec(e);if(t){const e=t[0].replace(/^ {1,4}/gm,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:T(e,"\n")}}}fences(e){const t=this.rules.block.fences.exec(e);if(t){const e=t[0],n=function(e,t){const n=e.match(/^(\s+)(?:```)/);if(null===n)return t;const s=n[1];return t.split("\n").map((e=>{const t=e.match(/^\s+/);if(null===t)return e;const[n]=t;return n.length>=s.length?e.slice(s.length):e})).join("\n")}(e,t[3]||"");return{type:"code",raw:e,lang:t[2]?t[2].trim():t[2],text:n}}}heading(e){const t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){const t=T(e,"#");this.options.pedantic?e=t.trim():t&&!/ $/.test(t)||(e=t.trim())}const n={type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:[]};return this.lexer.inline(n.text,n.tokens),n}}hr(e){const t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:t[0]}}blockquote(e){const t=this.rules.block.blockquote.exec(e);if(t){const e=t[0].replace(/^ *> ?/gm,"");return{type:"blockquote",raw:t[0],tokens:this.lexer.blockTokens(e,[]),text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n,s,r,i,l,o,a,c,h,p,u=t[1].trim();const g=u.length>1,k={type:"list",raw:"",ordered:g,start:g?+u.slice(0,-1):"",loose:!1,items:[]};u=g?`\\d{1,9}\\${u.slice(-1)}`:`\\${u}`,this.options.pedantic&&(u=g?u:"[*+-]");const f=new RegExp(`^( {0,3}${u})((?: [^\\n]*| *)(?:\\n[^\\n]*)*(?:\\n|$))`);for(;e&&!this.rules.block.hr.test(e)&&(t=f.exec(e));){h=t[2].split("\n"),this.options.pedantic?(i=2,p=h[0].trimLeft()):(i=t[2].search(/[^ ]/),i=t[1].length+(i>4?1:i),p=h[0].slice(i-t[1].length)),o=!1,n=t[0],!h[0]&&/^ *$/.test(h[1])&&(n=t[1]+h.slice(0,2).join("\n")+"\n",k.loose=!0,h=[]);const u=new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])`);for(l=1;l<h.length;l++){if(c=h[l],this.options.pedantic&&(c=c.replace(/^ {1,4}(?=( {4})*[^ ])/g," ")),u.test(c)){n=t[1]+h.slice(0,l).join("\n")+"\n";break}if(o){if(!(c.search(/[^ ]/)>=i)&&c.trim()){n=t[1]+h.slice(0,l).join("\n")+"\n";break}p+="\n"+c.slice(i)}else c.trim()||(o=!0),c.search(/[^ ]/)>=i?p+="\n"+c.slice(i):p+="\n"+c}k.loose||(a?k.loose=!0:/\n *\n *$/.test(n)&&(a=!0)),this.options.gfm&&(s=/^\[[ xX]\] /.exec(p),s&&(r="[ ] "!==s[0],p=p.replace(/^\[[ xX]\] +/,""))),k.items.push({type:"list_item",raw:n,task:!!s,checked:r,loose:!1,text:p}),k.raw+=n,e=e.slice(n.length)}k.items[k.items.length-1].raw=n.trimRight(),k.items[k.items.length-1].text=p.trimRight(),k.raw=k.raw.trimRight();const d=k.items.length;for(l=0;l<d;l++)this.lexer.state.top=!1,k.items[l].tokens=this.lexer.blockTokens(k.items[l].text,[]),k.items[l].tokens.some((e=>"space"===e.type))&&(k.loose=!0,k.items[l].loose=!0);return k}}html(e){const t=this.rules.block.html.exec(e);if(t){const e={type:"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:t[0]};return this.options.sanitize&&(e.type="paragraph",e.text=this.options.sanitizer?this.options.sanitizer(t[0]):p(t[0]),e.tokens=[],this.lexer.inline(e.text,e.tokens)),e}}def(e){const t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{type:"def",tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}}table(e){const t=this.rules.block.table.exec(e);if(t){const e={type:"table",header:S(t[1]).map((e=>({text:e}))),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),rows:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(e.header.length===e.align.length){e.raw=t[0];let n,s,r,i,l=e.align.length;for(n=0;n<l;n++)/^ *-+: *$/.test(e.align[n])?e.align[n]="right":/^ *:-+: *$/.test(e.align[n])?e.align[n]="center":/^ *:-+ *$/.test(e.align[n])?e.align[n]="left":e.align[n]=null;for(l=e.rows.length,n=0;n<l;n++)e.rows[n]=S(e.rows[n],e.header.length).map((e=>({text:e})));for(l=e.header.length,s=0;s<l;s++)e.header[s].tokens=[],this.lexer.inlineTokens(e.header[s].text,e.header[s].tokens);for(l=e.rows.length,s=0;s<l;s++)for(i=e.rows[s],r=0;r<i.length;r++)i[r].tokens=[],this.lexer.inlineTokens(i[r].text,i[r].tokens);return e}}}lheading(e){const t=this.rules.block.lheading.exec(e);if(t){const e={type:"heading",raw:t[0],depth:"="===t[2].charAt(0)?1:2,text:t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}paragraph(e){const t=this.rules.block.paragraph.exec(e);if(t){const e={type:"paragraph",raw:t[0],text:"\n"===t[1].charAt(t[1].length-1)?t[1].slice(0,-1):t[1],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}text(e){const t=this.rules.block.text.exec(e);if(t){const e={type:"text",raw:t[0],text:t[0],tokens:[]};return this.lexer.inline(e.text,e.tokens),e}}escape(e){const t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:p(t[1])}}tag(e){const t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:this.options.sanitize?"text":"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):p(t[0]):t[0]}}link(e){const t=this.rules.inline.link.exec(e);if(t){const e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;const t=T(e.slice(0,-1),"\\");if((e.length-t.length)%2==0)return}else{const e=function(e,t){if(-1===e.indexOf(t[1]))return-1;const n=e.length;let s=0,r=0;for(;r<n;r++)if("\\"===e[r])r++;else if(e[r]===t[0])s++;else if(e[r]===t[1]&&(s--,s<0))return r;return-1}(t[2],"()");if(e>-1){const n=(0===t[0].indexOf("!")?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){const e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],s=e[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),I(t,{href:n?n.replace(this.rules.inline._escapes,"$1"):n,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=(n[2]||n[1]).replace(/\s+/g," ");if(e=t[e.toLowerCase()],!e||!e.href){const e=n[0].charAt(0);return{type:"text",raw:e,text:e}}return I(n,e,n[0],this.lexer)}}emStrong(e,t,n=""){let s=this.rules.inline.emStrong.lDelim.exec(e);if(!s)return;if(s[3]&&n.match(/[\p{L}\p{N}]/u))return;const r=s[1]||s[2]||"";if(!r||r&&(""===n||this.rules.inline.punctuation.exec(n))){const n=s[0].length-1;let r,i,l=n,o=0;const a="*"===s[0][0]?this.rules.inline.emStrong.rDelimAst:this.rules.inline.emStrong.rDelimUnd;for(a.lastIndex=0,t=t.slice(-1*e.length+n);null!=(s=a.exec(t));){if(r=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!r)continue;if(i=r.length,s[3]||s[4]){l+=i;continue}if((s[5]||s[6])&&n%3&&!((n+i)%3)){o+=i;continue}if(l-=i,l>0)continue;if(i=Math.min(i,i+l+o),Math.min(n,i)%2){const t=e.slice(1,n+s.index+i);return{type:"em",raw:e.slice(0,n+s.index+i+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}const t=e.slice(2,n+s.index+i-1);return{type:"strong",raw:e.slice(0,n+s.index+i+1),text:t,tokens:this.lexer.inlineTokens(t,[])}}}}codespan(e){const t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g," ");const n=/[^ ]/.test(e),s=/^ /.test(e)&&/ $/.test(e);return n&&s&&(e=e.substring(1,e.length-1)),e=p(e,!0),{type:"codespan",raw:t[0],text:e}}}br(e){const t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){const t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2],[])}}autolink(e,t){const n=this.rules.inline.autolink.exec(e);if(n){let e,s;return"@"===n[2]?(e=p(this.options.mangle?t(n[1]):n[1]),s="mailto:"+e):(e=p(n[1]),s=e),{type:"link",raw:n[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}url(e,t){let n;if(n=this.rules.inline.url.exec(e)){let e,s;if("@"===n[2])e=p(this.options.mangle?t(n[0]):n[0]),s="mailto:"+e;else{let t;do{t=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(t!==n[0]);e=p(n[0]),s="www."===n[1]?"http://"+e:e}return{type:"link",raw:n[0],text:e,href:s,tokens:[{type:"text",raw:e,text:e}]}}}inlineText(e,t){const n=this.rules.inline.text.exec(e);if(n){let e;return e=this.lexer.state.inRawBlock?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(n[0]):p(n[0]):n[0]:p(this.options.smartypants?t(n[0]):n[0]),{type:"text",raw:n[0],text:e}}}}const Z={newline:/^(?: *(?:\n|$))+/,code:/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3}bull)( [^\n]+?)?(?:\n|$)/,html:"^ {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|$))",def:/^ {0,3}\[(label)\]: *\n? *<?([^\s>]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,table:z,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html| +\n)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};Z.def=f(Z.def).replace("label",Z._label).replace("title",Z._title).getRegex(),Z.bullet=/(?:[*+-]|\d{1,9}[.)])/,Z.listItemStart=f(/^( *)(bull) */).replace("bull",Z.bullet).getRegex(),Z.list=f(Z.list).replace(/bull/g,Z.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+Z.def.source+")").getRegex(),Z._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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Z._comment=/<!--(?!-?>)[\s\S]*?(?:-->|$)/,Z.html=f(Z.html,"i").replace("comment",Z._comment).replace("tag",Z._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Z.paragraph=f(Z._paragraph).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").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",Z._tag).getRegex(),Z.blockquote=f(Z.blockquote).replace("paragraph",Z.paragraph).getRegex(),Z.normal=$({},Z),Z.gfm=$({},Z.normal,{table:"^ *([^\\n ].*\\|.*)\\n {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),Z.gfm.table=f(Z.gfm.table).replace("hr",Z.hr).replace("heading"," {0,3}#{1,6} ").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",Z._tag).getRegex(),Z.pedantic=$({},Z.normal,{html:f("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",Z._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(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:z,paragraph:f(Z.normal._paragraph).replace("hr",Z.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",Z.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});const q={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:z,tag:"^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,reflinkSearch:"reflink|nolink(?!\\()",emStrong:{lDelim:/^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,rDelimAst:/^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,rDelimUnd:/^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/},code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:z,text:/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,punctuation:/^([\spunctuation])/};function v(e){return e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…")}function L(e){let t,n,s="";const r=e.length;for(t=0;t<r;t++)n=e.charCodeAt(t),Math.random()>.5&&(n="x"+n.toString(16)),s+="&#"+n+";";return s}q._punctuation="!\"#$%&'()+\\-.,/:;<=>?@\\[\\]`^{|}~",q.punctuation=f(q.punctuation).replace(/punctuation/g,q._punctuation).getRegex(),q.blockSkip=/\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g,q.escapedEmSt=/\\\*|\\_/g,q._comment=f(Z._comment).replace("(?:--\x3e|$)","--\x3e").getRegex(),q.emStrong.lDelim=f(q.emStrong.lDelim).replace(/punct/g,q._punctuation).getRegex(),q.emStrong.rDelimAst=f(q.emStrong.rDelimAst,"g").replace(/punct/g,q._punctuation).getRegex(),q.emStrong.rDelimUnd=f(q.emStrong.rDelimUnd,"g").replace(/punct/g,q._punctuation).getRegex(),q._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,q._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,q._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])?)+(?![-_])/,q.autolink=f(q.autolink).replace("scheme",q._scheme).replace("email",q._email).getRegex(),q._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,q.tag=f(q.tag).replace("comment",q._comment).replace("attribute",q._attribute).getRegex(),q._label=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,q._href=/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/,q._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,q.link=f(q.link).replace("label",q._label).replace("href",q._href).replace("title",q._title).getRegex(),q.reflink=f(q.reflink).replace("label",q._label).getRegex(),q.reflinkSearch=f(q.reflinkSearch,"g").replace("reflink",q.reflink).replace("nolink",q.nolink).getRegex(),q.normal=$({},q),q.pedantic=$({},q.normal,{strong:{start:/^__|\*\*/,middle:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,endAst:/\*\*(?!\*)/g,endUnd:/__(?!_)/g},em:{start:/^_|\*/,middle:/^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,endAst:/\*(?!\*)/g,endUnd:/_(?!_)/g},link:f(/^!?\[(label)\]\((.*?)\)/).replace("label",q._label).getRegex(),reflink:f(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",q._label).getRegex()}),q.gfm=$({},q.normal,{escape:f(q.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/}),q.gfm.url=f(q.gfm.url,"i").replace("email",q.gfm._extended_email).getRegex(),q.breaks=$({},q.gfm,{br:f(q.br).replace("{2,}","*").getRegex(),text:f(q.gfm.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()});class O{constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||r,this.options.tokenizer=this.options.tokenizer||new E,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const t={block:Z.normal,inline:q.normal};this.options.pedantic?(t.block=Z.pedantic,t.inline=q.pedantic):this.options.gfm&&(t.block=Z.gfm,this.options.breaks?t.inline=q.breaks:t.inline=q.gfm),this.tokenizer.rules=t}static get rules(){return{block:Z,inline:q}}static lex(e,t){return new O(t).lex(e)}static lexInline(e,t){return new O(t).inlineTokens(e)}lex(e){let t;for(e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens);t=this.inlineQueue.shift();)this.inlineTokens(t.src,t.tokens);return this.tokens}blockTokens(e,t=[]){let n,s,r,i;for(this.options.pedantic&&(e=e.replace(/^ +$/gm,""));e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.space(e))e=e.substring(n.raw.length),n.type&&t.push(n);else if(n=this.tokenizer.code(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?t.push(n):(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.fences(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.heading(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.hr(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.blockquote(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.list(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.html(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.def(e))e=e.substring(n.raw.length),s=t[t.length-1],!s||"paragraph"!==s.type&&"text"!==s.type?this.tokens.links[n.tag]||(this.tokens.links[n.tag]={href:n.href,title:n.title}):(s.raw+="\n"+n.raw,s.text+="\n"+n.raw,this.inlineQueue[this.inlineQueue.length-1].src=s.text);else if(n=this.tokenizer.table(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.lheading(e))e=e.substring(n.raw.length),t.push(n);else{if(r=e,this.options.extensions&&this.options.extensions.startBlock){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startBlock.forEach((function(e){s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(this.state.top&&(n=this.tokenizer.paragraph(r)))s=t[t.length-1],i&&"paragraph"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n),i=r.length!==e.length,e=e.substring(n.raw.length);else if(n=this.tokenizer.text(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===s.type?(s.raw+="\n"+n.raw,s.text+="\n"+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=s.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}return this.state.top=!0,t}inline(e,t){this.inlineQueue.push({src:e,tokens:t})}inlineTokens(e,t=[]){let n,s,r,i,l,o,a=e;if(this.tokens.links){const e=Object.keys(this.tokens.links);if(e.length>0)for(;null!=(i=this.tokenizer.rules.inline.reflinkSearch.exec(a));)e.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(a=a.slice(0,i.index)+"["+R("a",i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;null!=(i=this.tokenizer.rules.inline.blockSkip.exec(a));)a=a.slice(0,i.index)+"["+R("a",i[0].length-2)+"]"+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;null!=(i=this.tokenizer.rules.inline.escapedEmSt.exec(a));)a=a.slice(0,i.index)+"++"+a.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);for(;e;)if(l||(o=""),l=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some((s=>!!(n=s.call({lexer:this},e,t))&&(e=e.substring(n.raw.length),t.push(n),!0)))))if(n=this.tokenizer.escape(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.tag(e))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.link(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.reflink(e,this.tokens.links))e=e.substring(n.raw.length),s=t[t.length-1],s&&"text"===n.type&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(n=this.tokenizer.emStrong(e,a,o))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.codespan(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.br(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.del(e))e=e.substring(n.raw.length),t.push(n);else if(n=this.tokenizer.autolink(e,L))e=e.substring(n.raw.length),t.push(n);else if(this.state.inLink||!(n=this.tokenizer.url(e,L))){if(r=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0;const n=e.slice(1);let s;this.options.extensions.startInline.forEach((function(e){s=e.call({lexer:this},n),"number"==typeof s&&s>=0&&(t=Math.min(t,s))})),t<1/0&&t>=0&&(r=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(r,v))e=e.substring(n.raw.length),"_"!==n.raw.slice(-1)&&(o=n.raw.slice(-1)),l=!0,s=t[t.length-1],s&&"text"===s.type?(s.raw+=n.raw,s.text+=n.text):t.push(n);else if(e){const t="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(t);break}throw new Error(t)}}else e=e.substring(n.raw.length),t.push(n);return t}}class C{constructor(e){this.options=e||r}code(e,t,n){const s=(t||"").match(/\S*/)[0];if(this.options.highlight){const t=this.options.highlight(e,s);null!=t&&t!==e&&(n=!0,e=t)}return e=e.replace(/\n$/,"")+"\n",s?'<pre><code class="'+this.options.langPrefix+p(s,!0)+'">'+(n?e:p(e,!0))+"</code></pre>\n":"<pre><code>"+(n?e:p(e,!0))+"</code></pre>\n"}blockquote(e){return"<blockquote>\n"+e+"</blockquote>\n"}html(e){return e}heading(e,t,n,s){return this.options.headerIds?"<h"+t+' id="'+this.options.headerPrefix+s.slug(n)+'">'+e+"</h"+t+">\n":"<h"+t+">"+e+"</h"+t+">\n"}hr(){return this.options.xhtml?"<hr/>\n":"<hr>\n"}list(e,t,n){const s=t?"ol":"ul";return"<"+s+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"</"+s+">\n"}listitem(e){return"<li>"+e+"</li>\n"}checkbox(e){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox"'+(this.options.xhtml?" /":"")+"> "}paragraph(e){return"<p>"+e+"</p>\n"}table(e,t){return t&&(t="<tbody>"+t+"</tbody>"),"<table>\n<thead>\n"+e+"</thead>\n"+t+"</table>\n"}tablerow(e){return"<tr>\n"+e+"</tr>\n"}tablecell(e,t){const n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"</"+n+">\n"}strong(e){return"<strong>"+e+"</strong>"}em(e){return"<em>"+e+"</em>"}codespan(e){return"<code>"+e+"</code>"}br(){return this.options.xhtml?"<br/>":"<br>"}del(e){return"<del>"+e+"</del>"}link(e,t,n){if(null===(e=m(this.options.sanitize,this.options.baseUrl,e)))return n;let s='<a href="'+p(e)+'"';return t&&(s+=' title="'+t+'"'),s+=">"+n+"</a>",s}image(e,t,n){if(null===(e=m(this.options.sanitize,this.options.baseUrl,e)))return n;let s='<img src="'+e+'" alt="'+n+'"';return t&&(s+=' title="'+t+'"'),s+=this.options.xhtml?"/>":">",s}text(e){return e}}class D{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return""+n}image(e,t,n){return""+n}br(){return""}}class B{constructor(){this.seen={}}serialize(e){return e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-")}getNextSafeSlug(e,t){let n=e,s=0;if(this.seen.hasOwnProperty(n)){s=this.seen[e];do{s++,n=e+"-"+s}while(this.seen.hasOwnProperty(n))}return t||(this.seen[e]=s,this.seen[n]=0),n}slug(e,t={}){const n=this.serialize(e);return this.getNextSafeSlug(n,t.dryrun)}}class j{constructor(e){this.options=e||r,this.options.renderer=this.options.renderer||new C,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new D,this.slugger=new B}static parse(e,t){return new j(t).parse(e)}static parseInline(e,t){return new j(t).parseInline(e)}parse(e,t=!0){let n,s,r,i,l,o,a,c,h,p,u,k,f,d,x,m,b,w,_,y="";const z=e.length;for(n=0;n<z;n++)if(p=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[p.type]&&(_=this.options.extensions.renderers[p.type].call({parser:this},p),!1!==_||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(p.type)))y+=_||"";else switch(p.type){case"space":continue;case"hr":y+=this.renderer.hr();continue;case"heading":y+=this.renderer.heading(this.parseInline(p.tokens),p.depth,g(this.parseInline(p.tokens,this.textRenderer)),this.slugger);continue;case"code":y+=this.renderer.code(p.text,p.lang,p.escaped);continue;case"table":for(c="",a="",i=p.header.length,s=0;s<i;s++)a+=this.renderer.tablecell(this.parseInline(p.header[s].tokens),{header:!0,align:p.align[s]});for(c+=this.renderer.tablerow(a),h="",i=p.rows.length,s=0;s<i;s++){for(o=p.rows[s],a="",l=o.length,r=0;r<l;r++)a+=this.renderer.tablecell(this.parseInline(o[r].tokens),{header:!1,align:p.align[r]});h+=this.renderer.tablerow(a)}y+=this.renderer.table(c,h);continue;case"blockquote":h=this.parse(p.tokens),y+=this.renderer.blockquote(h);continue;case"list":for(u=p.ordered,k=p.start,f=p.loose,i=p.items.length,h="",s=0;s<i;s++)x=p.items[s],m=x.checked,b=x.task,d="",x.task&&(w=this.renderer.checkbox(m),f?x.tokens.length>0&&"paragraph"===x.tokens[0].type?(x.tokens[0].text=w+" "+x.tokens[0].text,x.tokens[0].tokens&&x.tokens[0].tokens.length>0&&"text"===x.tokens[0].tokens[0].type&&(x.tokens[0].tokens[0].text=w+" "+x.tokens[0].tokens[0].text)):x.tokens.unshift({type:"text",text:w}):d+=w),d+=this.parse(x.tokens,f),h+=this.renderer.listitem(d,b,m);y+=this.renderer.list(h,u,k);continue;case"html":y+=this.renderer.html(p.text);continue;case"paragraph":y+=this.renderer.paragraph(this.parseInline(p.tokens));continue;case"text":for(h=p.tokens?this.parseInline(p.tokens):p.text;n+1<z&&"text"===e[n+1].type;)p=e[++n],h+="\n"+(p.tokens?this.parseInline(p.tokens):p.text);y+=t?this.renderer.paragraph(h):h;continue;default:{const e='Token with "'+p.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return y}parseInline(e,t){t=t||this.renderer;let n,s,r,i="";const l=e.length;for(n=0;n<l;n++)if(s=e[n],this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[s.type]&&(r=this.options.extensions.renderers[s.type].call({parser:this},s),!1!==r||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(s.type)))i+=r||"";else switch(s.type){case"escape":case"text":i+=t.text(s.text);break;case"html":i+=t.html(s.text);break;case"link":i+=t.link(s.href,s.title,this.parseInline(s.tokens,t));break;case"image":i+=t.image(s.href,s.title,s.text);break;case"strong":i+=t.strong(this.parseInline(s.tokens,t));break;case"em":i+=t.em(this.parseInline(s.tokens,t));break;case"codespan":i+=t.codespan(s.text);break;case"br":i+=t.br();break;case"del":i+=t.del(this.parseInline(s.tokens,t));break;default:{const e='Token with "'+s.type+'" type was not found.';if(this.options.silent)return void console.error(e);throw new Error(e)}}return i}}function P(e,t,n){if(null==e)throw new Error("marked(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");if("function"==typeof t&&(n=t,t=null),A(t=$({},P.defaults,t||{})),n){const s=t.highlight;let r;try{r=O.lex(e,t)}catch(e){return n(e)}const i=function(e){let i;if(!e)try{t.walkTokens&&P.walkTokens(r,t.walkTokens),i=j.parse(r,t)}catch(t){e=t}return t.highlight=s,e?n(e):n(null,i)};if(!s||s.length<3)return i();if(delete t.highlight,!r.length)return i();let l=0;return P.walkTokens(r,(function(e){"code"===e.type&&(l++,setTimeout((()=>{s(e.text,e.lang,(function(t,n){if(t)return i(t);null!=n&&n!==e.text&&(e.text=n,e.escaped=!0),l--,0===l&&i()}))}),0))})),void(0===l&&i())}try{const n=O.lex(e,t);return t.walkTokens&&P.walkTokens(n,t.walkTokens),j.parse(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+p(e.message+"",!0)+"</pre>";throw e}}P.options=P.setOptions=function(e){var t;return $(P.defaults,e),t=P.defaults,r=t,P},P.getDefaults=s,P.defaults=r,P.use=function(...e){const t=$({},...e),n=P.defaults.extensions||{renderers:{},childTokens:{}};let s;e.forEach((e=>{if(e.extensions&&(s=!0,e.extensions.forEach((e=>{if(!e.name)throw new Error("extension name required");if(e.renderer){const t=n.renderers?n.renderers[e.name]:null;n.renderers[e.name]=t?function(...n){let s=e.renderer.apply(this,n);return!1===s&&(s=t.apply(this,n)),s}:e.renderer}if(e.tokenizer){if(!e.level||"block"!==e.level&&"inline"!==e.level)throw new Error("extension level must be 'block' or 'inline'");n[e.level]?n[e.level].unshift(e.tokenizer):n[e.level]=[e.tokenizer],e.start&&("block"===e.level?n.startBlock?n.startBlock.push(e.start):n.startBlock=[e.start]:"inline"===e.level&&(n.startInline?n.startInline.push(e.start):n.startInline=[e.start]))}e.childTokens&&(n.childTokens[e.name]=e.childTokens)}))),e.renderer){const n=P.defaults.renderer||new C;for(const t in e.renderer){const s=n[t];n[t]=(...r)=>{let i=e.renderer[t].apply(n,r);return!1===i&&(i=s.apply(n,r)),i}}t.renderer=n}if(e.tokenizer){const n=P.defaults.tokenizer||new E;for(const t in e.tokenizer){const s=n[t];n[t]=(...r)=>{let i=e.tokenizer[t].apply(n,r);return!1===i&&(i=s.apply(n,r)),i}}t.tokenizer=n}if(e.walkTokens){const n=P.defaults.walkTokens;t.walkTokens=function(t){e.walkTokens.call(this,t),n&&n.call(this,t)}}s&&(t.extensions=n),P.setOptions(t)}))},P.walkTokens=function(e,t){for(const n of e)switch(t.call(P,n),n.type){case"table":for(const e of n.header)P.walkTokens(e.tokens,t);for(const e of n.rows)for(const n of e)P.walkTokens(n.tokens,t);break;case"list":P.walkTokens(n.items,t);break;default:P.defaults.extensions&&P.defaults.extensions.childTokens&&P.defaults.extensions.childTokens[n.type]?P.defaults.extensions.childTokens[n.type].forEach((function(e){P.walkTokens(n[e],t)})):n.tokens&&P.walkTokens(n.tokens,t)}},P.parseInline=function(e,t){if(null==e)throw new Error("marked.parseInline(): input parameter is undefined or null");if("string"!=typeof e)throw new Error("marked.parseInline(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected");A(t=$({},P.defaults,t||{}));try{const n=O.lexInline(e,t);return t.walkTokens&&P.walkTokens(n,t.walkTokens),j.parseInline(n,t)}catch(e){if(e.message+="\nPlease report this to https://github.com/markedjs/marked.",t.silent)return"<p>An error occurred:</p><pre>"+p(e.message+"",!0)+"</pre>";throw e}},P.Parser=j,P.parser=j.parse,P.Renderer=C,P.TextRenderer=D,P.Lexer=O,P.lexer=O.lex,P.Tokenizer=E,P.Slugger=B,P.parse=P;const Q=P.options,U=P.setOptions,M=P.use,N=P.walkTokens,F=P.parseInline,X=P,G=j.parse,V=O.lex}}]);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|