md-editor-v3 4.15.5 → 4.15.6

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.
@@ -3,19 +3,37 @@ const vue = require("vue");
3
3
  const config = require("./config.cjs");
4
4
  const eventName = require("./event-name.cjs");
5
5
  const dom = require("./dom.cjs");
6
- const util = require("@vavt/util");
6
+ const util$2 = require("@vavt/util");
7
7
  const mediumZoom = require("medium-zoom");
8
8
  const copy = require("copy-to-clipboard");
9
9
  const mdit = require("markdown-it");
10
10
  const ImageFiguresPlugin = require("markdown-it-image-figures");
11
11
  const TaskListPlugin = require("markdown-it-task-lists");
12
- const XSSPlugin = require("markdown-it-xss");
13
- const index = require("./index4.cjs");
12
+ const index$1 = require("./index4.cjs");
14
13
  const lruCache = require("lru-cache");
14
+ function _mergeNamespaces(n, m) {
15
+ for (var i = 0; i < m.length; i++) {
16
+ const e = m[i];
17
+ if (typeof e !== "string" && !Array.isArray(e)) {
18
+ for (const k in e) {
19
+ if (k !== "default" && !(k in n)) {
20
+ const d = Object.getOwnPropertyDescriptor(e, k);
21
+ if (d) {
22
+ Object.defineProperty(n, k, d.get ? d : {
23
+ enumerable: true,
24
+ get: () => e[k]
25
+ });
26
+ }
27
+ }
28
+ }
29
+ }
30
+ }
31
+ return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
32
+ }
15
33
  const userZoom = (props, html) => {
16
34
  const editorId = vue.inject("editorId");
17
35
  const { noImgZoomIn } = props;
18
- const zoomHander = util.debounce(() => {
36
+ const zoomHander = util$2.debounce(() => {
19
37
  const imgs = document.querySelectorAll(`#${editorId}-preview img:not(.not-zoom)`);
20
38
  if (imgs.length === 0) {
21
39
  return;
@@ -192,7 +210,7 @@ const useMermaid = (props) => {
192
210
  mermaidSourceEles.forEach(async (item) => {
193
211
  let mermaidHtml = mermaidCache.get(item.innerText);
194
212
  if (!mermaidHtml) {
195
- const idRand = util.uuid();
213
+ const idRand = util$2.uuid();
196
214
  const render = mermaidRef.value.renderAsync || mermaidRef.value.render;
197
215
  let svg = "";
198
216
  try {
@@ -431,7 +449,7 @@ const AdmonitionPlugin = (md, options) => {
431
449
  options = options || {};
432
450
  const markers = 3, markerStr = options.marker || "!", markerChar = markerStr.charCodeAt(0), markerLen = markerStr.length;
433
451
  let type = "", title = "";
434
- const render = (tokens, idx, _options, _env, self) => {
452
+ const render = (tokens, idx, _options, _env, self2) => {
435
453
  const token = tokens[idx];
436
454
  if (token.type === "admonition_open") {
437
455
  tokens[idx].attrPush([
@@ -441,7 +459,7 @@ const AdmonitionPlugin = (md, options) => {
441
459
  } else if (token.type === "admonition_title_open") {
442
460
  tokens[idx].attrPush(["class", `${config.prefix}-admonition-title`]);
443
461
  }
444
- return self.renderToken(tokens, idx, _options);
462
+ return self2.renderToken(tokens, idx, _options);
445
463
  };
446
464
  const validate = (params) => {
447
465
  const array = params.trim().split(" ", 2);
@@ -567,8 +585,8 @@ const HeadingPlugin = (md, options) => {
567
585
  }
568
586
  return md.renderer.renderToken(tokens, idx, options);
569
587
  };
570
- md.renderer.rules.heading_close = (tokens, idx, opts, _env, self) => {
571
- return self.renderToken(tokens, idx, opts);
588
+ md.renderer.rules.heading_close = (tokens, idx, opts, _env, self2) => {
589
+ return self2.renderToken(tokens, idx, opts);
572
590
  };
573
591
  };
574
592
  const HeadingPlugin$1 = HeadingPlugin;
@@ -659,6 +677,1331 @@ const codetabs = (md, _opts) => {
659
677
  md.renderer.rules.fence = fenceGroup;
660
678
  };
661
679
  const CodePlugin = codetabs;
680
+ function getDefaultExportFromCjs(x) {
681
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
682
+ }
683
+ var lib$1 = { exports: {} };
684
+ var _default$1 = {};
685
+ var lib = { exports: {} };
686
+ var _default = {};
687
+ function getDefaultWhiteList$1() {
688
+ var whiteList = {};
689
+ whiteList["align-content"] = false;
690
+ whiteList["align-items"] = false;
691
+ whiteList["align-self"] = false;
692
+ whiteList["alignment-adjust"] = false;
693
+ whiteList["alignment-baseline"] = false;
694
+ whiteList["all"] = false;
695
+ whiteList["anchor-point"] = false;
696
+ whiteList["animation"] = false;
697
+ whiteList["animation-delay"] = false;
698
+ whiteList["animation-direction"] = false;
699
+ whiteList["animation-duration"] = false;
700
+ whiteList["animation-fill-mode"] = false;
701
+ whiteList["animation-iteration-count"] = false;
702
+ whiteList["animation-name"] = false;
703
+ whiteList["animation-play-state"] = false;
704
+ whiteList["animation-timing-function"] = false;
705
+ whiteList["azimuth"] = false;
706
+ whiteList["backface-visibility"] = false;
707
+ whiteList["background"] = true;
708
+ whiteList["background-attachment"] = true;
709
+ whiteList["background-clip"] = true;
710
+ whiteList["background-color"] = true;
711
+ whiteList["background-image"] = true;
712
+ whiteList["background-origin"] = true;
713
+ whiteList["background-position"] = true;
714
+ whiteList["background-repeat"] = true;
715
+ whiteList["background-size"] = true;
716
+ whiteList["baseline-shift"] = false;
717
+ whiteList["binding"] = false;
718
+ whiteList["bleed"] = false;
719
+ whiteList["bookmark-label"] = false;
720
+ whiteList["bookmark-level"] = false;
721
+ whiteList["bookmark-state"] = false;
722
+ whiteList["border"] = true;
723
+ whiteList["border-bottom"] = true;
724
+ whiteList["border-bottom-color"] = true;
725
+ whiteList["border-bottom-left-radius"] = true;
726
+ whiteList["border-bottom-right-radius"] = true;
727
+ whiteList["border-bottom-style"] = true;
728
+ whiteList["border-bottom-width"] = true;
729
+ whiteList["border-collapse"] = true;
730
+ whiteList["border-color"] = true;
731
+ whiteList["border-image"] = true;
732
+ whiteList["border-image-outset"] = true;
733
+ whiteList["border-image-repeat"] = true;
734
+ whiteList["border-image-slice"] = true;
735
+ whiteList["border-image-source"] = true;
736
+ whiteList["border-image-width"] = true;
737
+ whiteList["border-left"] = true;
738
+ whiteList["border-left-color"] = true;
739
+ whiteList["border-left-style"] = true;
740
+ whiteList["border-left-width"] = true;
741
+ whiteList["border-radius"] = true;
742
+ whiteList["border-right"] = true;
743
+ whiteList["border-right-color"] = true;
744
+ whiteList["border-right-style"] = true;
745
+ whiteList["border-right-width"] = true;
746
+ whiteList["border-spacing"] = true;
747
+ whiteList["border-style"] = true;
748
+ whiteList["border-top"] = true;
749
+ whiteList["border-top-color"] = true;
750
+ whiteList["border-top-left-radius"] = true;
751
+ whiteList["border-top-right-radius"] = true;
752
+ whiteList["border-top-style"] = true;
753
+ whiteList["border-top-width"] = true;
754
+ whiteList["border-width"] = true;
755
+ whiteList["bottom"] = false;
756
+ whiteList["box-decoration-break"] = true;
757
+ whiteList["box-shadow"] = true;
758
+ whiteList["box-sizing"] = true;
759
+ whiteList["box-snap"] = true;
760
+ whiteList["box-suppress"] = true;
761
+ whiteList["break-after"] = true;
762
+ whiteList["break-before"] = true;
763
+ whiteList["break-inside"] = true;
764
+ whiteList["caption-side"] = false;
765
+ whiteList["chains"] = false;
766
+ whiteList["clear"] = true;
767
+ whiteList["clip"] = false;
768
+ whiteList["clip-path"] = false;
769
+ whiteList["clip-rule"] = false;
770
+ whiteList["color"] = true;
771
+ whiteList["color-interpolation-filters"] = true;
772
+ whiteList["column-count"] = false;
773
+ whiteList["column-fill"] = false;
774
+ whiteList["column-gap"] = false;
775
+ whiteList["column-rule"] = false;
776
+ whiteList["column-rule-color"] = false;
777
+ whiteList["column-rule-style"] = false;
778
+ whiteList["column-rule-width"] = false;
779
+ whiteList["column-span"] = false;
780
+ whiteList["column-width"] = false;
781
+ whiteList["columns"] = false;
782
+ whiteList["contain"] = false;
783
+ whiteList["content"] = false;
784
+ whiteList["counter-increment"] = false;
785
+ whiteList["counter-reset"] = false;
786
+ whiteList["counter-set"] = false;
787
+ whiteList["crop"] = false;
788
+ whiteList["cue"] = false;
789
+ whiteList["cue-after"] = false;
790
+ whiteList["cue-before"] = false;
791
+ whiteList["cursor"] = false;
792
+ whiteList["direction"] = false;
793
+ whiteList["display"] = true;
794
+ whiteList["display-inside"] = true;
795
+ whiteList["display-list"] = true;
796
+ whiteList["display-outside"] = true;
797
+ whiteList["dominant-baseline"] = false;
798
+ whiteList["elevation"] = false;
799
+ whiteList["empty-cells"] = false;
800
+ whiteList["filter"] = false;
801
+ whiteList["flex"] = false;
802
+ whiteList["flex-basis"] = false;
803
+ whiteList["flex-direction"] = false;
804
+ whiteList["flex-flow"] = false;
805
+ whiteList["flex-grow"] = false;
806
+ whiteList["flex-shrink"] = false;
807
+ whiteList["flex-wrap"] = false;
808
+ whiteList["float"] = false;
809
+ whiteList["float-offset"] = false;
810
+ whiteList["flood-color"] = false;
811
+ whiteList["flood-opacity"] = false;
812
+ whiteList["flow-from"] = false;
813
+ whiteList["flow-into"] = false;
814
+ whiteList["font"] = true;
815
+ whiteList["font-family"] = true;
816
+ whiteList["font-feature-settings"] = true;
817
+ whiteList["font-kerning"] = true;
818
+ whiteList["font-language-override"] = true;
819
+ whiteList["font-size"] = true;
820
+ whiteList["font-size-adjust"] = true;
821
+ whiteList["font-stretch"] = true;
822
+ whiteList["font-style"] = true;
823
+ whiteList["font-synthesis"] = true;
824
+ whiteList["font-variant"] = true;
825
+ whiteList["font-variant-alternates"] = true;
826
+ whiteList["font-variant-caps"] = true;
827
+ whiteList["font-variant-east-asian"] = true;
828
+ whiteList["font-variant-ligatures"] = true;
829
+ whiteList["font-variant-numeric"] = true;
830
+ whiteList["font-variant-position"] = true;
831
+ whiteList["font-weight"] = true;
832
+ whiteList["grid"] = false;
833
+ whiteList["grid-area"] = false;
834
+ whiteList["grid-auto-columns"] = false;
835
+ whiteList["grid-auto-flow"] = false;
836
+ whiteList["grid-auto-rows"] = false;
837
+ whiteList["grid-column"] = false;
838
+ whiteList["grid-column-end"] = false;
839
+ whiteList["grid-column-start"] = false;
840
+ whiteList["grid-row"] = false;
841
+ whiteList["grid-row-end"] = false;
842
+ whiteList["grid-row-start"] = false;
843
+ whiteList["grid-template"] = false;
844
+ whiteList["grid-template-areas"] = false;
845
+ whiteList["grid-template-columns"] = false;
846
+ whiteList["grid-template-rows"] = false;
847
+ whiteList["hanging-punctuation"] = false;
848
+ whiteList["height"] = true;
849
+ whiteList["hyphens"] = false;
850
+ whiteList["icon"] = false;
851
+ whiteList["image-orientation"] = false;
852
+ whiteList["image-resolution"] = false;
853
+ whiteList["ime-mode"] = false;
854
+ whiteList["initial-letters"] = false;
855
+ whiteList["inline-box-align"] = false;
856
+ whiteList["justify-content"] = false;
857
+ whiteList["justify-items"] = false;
858
+ whiteList["justify-self"] = false;
859
+ whiteList["left"] = false;
860
+ whiteList["letter-spacing"] = true;
861
+ whiteList["lighting-color"] = true;
862
+ whiteList["line-box-contain"] = false;
863
+ whiteList["line-break"] = false;
864
+ whiteList["line-grid"] = false;
865
+ whiteList["line-height"] = false;
866
+ whiteList["line-snap"] = false;
867
+ whiteList["line-stacking"] = false;
868
+ whiteList["line-stacking-ruby"] = false;
869
+ whiteList["line-stacking-shift"] = false;
870
+ whiteList["line-stacking-strategy"] = false;
871
+ whiteList["list-style"] = true;
872
+ whiteList["list-style-image"] = true;
873
+ whiteList["list-style-position"] = true;
874
+ whiteList["list-style-type"] = true;
875
+ whiteList["margin"] = true;
876
+ whiteList["margin-bottom"] = true;
877
+ whiteList["margin-left"] = true;
878
+ whiteList["margin-right"] = true;
879
+ whiteList["margin-top"] = true;
880
+ whiteList["marker-offset"] = false;
881
+ whiteList["marker-side"] = false;
882
+ whiteList["marks"] = false;
883
+ whiteList["mask"] = false;
884
+ whiteList["mask-box"] = false;
885
+ whiteList["mask-box-outset"] = false;
886
+ whiteList["mask-box-repeat"] = false;
887
+ whiteList["mask-box-slice"] = false;
888
+ whiteList["mask-box-source"] = false;
889
+ whiteList["mask-box-width"] = false;
890
+ whiteList["mask-clip"] = false;
891
+ whiteList["mask-image"] = false;
892
+ whiteList["mask-origin"] = false;
893
+ whiteList["mask-position"] = false;
894
+ whiteList["mask-repeat"] = false;
895
+ whiteList["mask-size"] = false;
896
+ whiteList["mask-source-type"] = false;
897
+ whiteList["mask-type"] = false;
898
+ whiteList["max-height"] = true;
899
+ whiteList["max-lines"] = false;
900
+ whiteList["max-width"] = true;
901
+ whiteList["min-height"] = true;
902
+ whiteList["min-width"] = true;
903
+ whiteList["move-to"] = false;
904
+ whiteList["nav-down"] = false;
905
+ whiteList["nav-index"] = false;
906
+ whiteList["nav-left"] = false;
907
+ whiteList["nav-right"] = false;
908
+ whiteList["nav-up"] = false;
909
+ whiteList["object-fit"] = false;
910
+ whiteList["object-position"] = false;
911
+ whiteList["opacity"] = false;
912
+ whiteList["order"] = false;
913
+ whiteList["orphans"] = false;
914
+ whiteList["outline"] = false;
915
+ whiteList["outline-color"] = false;
916
+ whiteList["outline-offset"] = false;
917
+ whiteList["outline-style"] = false;
918
+ whiteList["outline-width"] = false;
919
+ whiteList["overflow"] = false;
920
+ whiteList["overflow-wrap"] = false;
921
+ whiteList["overflow-x"] = false;
922
+ whiteList["overflow-y"] = false;
923
+ whiteList["padding"] = true;
924
+ whiteList["padding-bottom"] = true;
925
+ whiteList["padding-left"] = true;
926
+ whiteList["padding-right"] = true;
927
+ whiteList["padding-top"] = true;
928
+ whiteList["page"] = false;
929
+ whiteList["page-break-after"] = false;
930
+ whiteList["page-break-before"] = false;
931
+ whiteList["page-break-inside"] = false;
932
+ whiteList["page-policy"] = false;
933
+ whiteList["pause"] = false;
934
+ whiteList["pause-after"] = false;
935
+ whiteList["pause-before"] = false;
936
+ whiteList["perspective"] = false;
937
+ whiteList["perspective-origin"] = false;
938
+ whiteList["pitch"] = false;
939
+ whiteList["pitch-range"] = false;
940
+ whiteList["play-during"] = false;
941
+ whiteList["position"] = false;
942
+ whiteList["presentation-level"] = false;
943
+ whiteList["quotes"] = false;
944
+ whiteList["region-fragment"] = false;
945
+ whiteList["resize"] = false;
946
+ whiteList["rest"] = false;
947
+ whiteList["rest-after"] = false;
948
+ whiteList["rest-before"] = false;
949
+ whiteList["richness"] = false;
950
+ whiteList["right"] = false;
951
+ whiteList["rotation"] = false;
952
+ whiteList["rotation-point"] = false;
953
+ whiteList["ruby-align"] = false;
954
+ whiteList["ruby-merge"] = false;
955
+ whiteList["ruby-position"] = false;
956
+ whiteList["shape-image-threshold"] = false;
957
+ whiteList["shape-outside"] = false;
958
+ whiteList["shape-margin"] = false;
959
+ whiteList["size"] = false;
960
+ whiteList["speak"] = false;
961
+ whiteList["speak-as"] = false;
962
+ whiteList["speak-header"] = false;
963
+ whiteList["speak-numeral"] = false;
964
+ whiteList["speak-punctuation"] = false;
965
+ whiteList["speech-rate"] = false;
966
+ whiteList["stress"] = false;
967
+ whiteList["string-set"] = false;
968
+ whiteList["tab-size"] = false;
969
+ whiteList["table-layout"] = false;
970
+ whiteList["text-align"] = true;
971
+ whiteList["text-align-last"] = true;
972
+ whiteList["text-combine-upright"] = true;
973
+ whiteList["text-decoration"] = true;
974
+ whiteList["text-decoration-color"] = true;
975
+ whiteList["text-decoration-line"] = true;
976
+ whiteList["text-decoration-skip"] = true;
977
+ whiteList["text-decoration-style"] = true;
978
+ whiteList["text-emphasis"] = true;
979
+ whiteList["text-emphasis-color"] = true;
980
+ whiteList["text-emphasis-position"] = true;
981
+ whiteList["text-emphasis-style"] = true;
982
+ whiteList["text-height"] = true;
983
+ whiteList["text-indent"] = true;
984
+ whiteList["text-justify"] = true;
985
+ whiteList["text-orientation"] = true;
986
+ whiteList["text-overflow"] = true;
987
+ whiteList["text-shadow"] = true;
988
+ whiteList["text-space-collapse"] = true;
989
+ whiteList["text-transform"] = true;
990
+ whiteList["text-underline-position"] = true;
991
+ whiteList["text-wrap"] = true;
992
+ whiteList["top"] = false;
993
+ whiteList["transform"] = false;
994
+ whiteList["transform-origin"] = false;
995
+ whiteList["transform-style"] = false;
996
+ whiteList["transition"] = false;
997
+ whiteList["transition-delay"] = false;
998
+ whiteList["transition-duration"] = false;
999
+ whiteList["transition-property"] = false;
1000
+ whiteList["transition-timing-function"] = false;
1001
+ whiteList["unicode-bidi"] = false;
1002
+ whiteList["vertical-align"] = false;
1003
+ whiteList["visibility"] = false;
1004
+ whiteList["voice-balance"] = false;
1005
+ whiteList["voice-duration"] = false;
1006
+ whiteList["voice-family"] = false;
1007
+ whiteList["voice-pitch"] = false;
1008
+ whiteList["voice-range"] = false;
1009
+ whiteList["voice-rate"] = false;
1010
+ whiteList["voice-stress"] = false;
1011
+ whiteList["voice-volume"] = false;
1012
+ whiteList["volume"] = false;
1013
+ whiteList["white-space"] = false;
1014
+ whiteList["widows"] = false;
1015
+ whiteList["width"] = true;
1016
+ whiteList["will-change"] = false;
1017
+ whiteList["word-break"] = true;
1018
+ whiteList["word-spacing"] = true;
1019
+ whiteList["word-wrap"] = true;
1020
+ whiteList["wrap-flow"] = false;
1021
+ whiteList["wrap-through"] = false;
1022
+ whiteList["writing-mode"] = false;
1023
+ whiteList["z-index"] = false;
1024
+ return whiteList;
1025
+ }
1026
+ function onAttr(name, value, options) {
1027
+ }
1028
+ function onIgnoreAttr(name, value, options) {
1029
+ }
1030
+ var REGEXP_URL_JAVASCRIPT = /javascript\s*\:/img;
1031
+ function safeAttrValue$1(name, value) {
1032
+ if (REGEXP_URL_JAVASCRIPT.test(value))
1033
+ return "";
1034
+ return value;
1035
+ }
1036
+ _default.whiteList = getDefaultWhiteList$1();
1037
+ _default.getDefaultWhiteList = getDefaultWhiteList$1;
1038
+ _default.onAttr = onAttr;
1039
+ _default.onIgnoreAttr = onIgnoreAttr;
1040
+ _default.safeAttrValue = safeAttrValue$1;
1041
+ var util$1 = {
1042
+ indexOf: function(arr, item) {
1043
+ var i, j;
1044
+ if (Array.prototype.indexOf) {
1045
+ return arr.indexOf(item);
1046
+ }
1047
+ for (i = 0, j = arr.length; i < j; i++) {
1048
+ if (arr[i] === item) {
1049
+ return i;
1050
+ }
1051
+ }
1052
+ return -1;
1053
+ },
1054
+ forEach: function(arr, fn, scope) {
1055
+ var i, j;
1056
+ if (Array.prototype.forEach) {
1057
+ return arr.forEach(fn, scope);
1058
+ }
1059
+ for (i = 0, j = arr.length; i < j; i++) {
1060
+ fn.call(scope, arr[i], i, arr);
1061
+ }
1062
+ },
1063
+ trim: function(str) {
1064
+ if (String.prototype.trim) {
1065
+ return str.trim();
1066
+ }
1067
+ return str.replace(/(^\s*)|(\s*$)/g, "");
1068
+ },
1069
+ trimRight: function(str) {
1070
+ if (String.prototype.trimRight) {
1071
+ return str.trimRight();
1072
+ }
1073
+ return str.replace(/(\s*$)/g, "");
1074
+ }
1075
+ };
1076
+ var _$3 = util$1;
1077
+ function parseStyle$1(css2, onAttr2) {
1078
+ css2 = _$3.trimRight(css2);
1079
+ if (css2[css2.length - 1] !== ";")
1080
+ css2 += ";";
1081
+ var cssLength = css2.length;
1082
+ var isParenthesisOpen = false;
1083
+ var lastPos = 0;
1084
+ var i = 0;
1085
+ var retCSS = "";
1086
+ function addNewAttr() {
1087
+ if (!isParenthesisOpen) {
1088
+ var source = _$3.trim(css2.slice(lastPos, i));
1089
+ var j2 = source.indexOf(":");
1090
+ if (j2 !== -1) {
1091
+ var name = _$3.trim(source.slice(0, j2));
1092
+ var value = _$3.trim(source.slice(j2 + 1));
1093
+ if (name) {
1094
+ var ret = onAttr2(lastPos, retCSS.length, name, value, source);
1095
+ if (ret)
1096
+ retCSS += ret + "; ";
1097
+ }
1098
+ }
1099
+ }
1100
+ lastPos = i + 1;
1101
+ }
1102
+ for (; i < cssLength; i++) {
1103
+ var c = css2[i];
1104
+ if (c === "/" && css2[i + 1] === "*") {
1105
+ var j = css2.indexOf("*/", i + 2);
1106
+ if (j === -1)
1107
+ break;
1108
+ i = j + 1;
1109
+ lastPos = i + 1;
1110
+ isParenthesisOpen = false;
1111
+ } else if (c === "(") {
1112
+ isParenthesisOpen = true;
1113
+ } else if (c === ")") {
1114
+ isParenthesisOpen = false;
1115
+ } else if (c === ";") {
1116
+ if (isParenthesisOpen)
1117
+ ;
1118
+ else {
1119
+ addNewAttr();
1120
+ }
1121
+ } else if (c === "\n") {
1122
+ addNewAttr();
1123
+ }
1124
+ }
1125
+ return _$3.trim(retCSS);
1126
+ }
1127
+ var parser$2 = parseStyle$1;
1128
+ var DEFAULT$1 = _default;
1129
+ var parseStyle = parser$2;
1130
+ function isNull$1(obj) {
1131
+ return obj === void 0 || obj === null;
1132
+ }
1133
+ function shallowCopyObject$1(obj) {
1134
+ var ret = {};
1135
+ for (var i in obj) {
1136
+ ret[i] = obj[i];
1137
+ }
1138
+ return ret;
1139
+ }
1140
+ function FilterCSS$2(options) {
1141
+ options = shallowCopyObject$1(options || {});
1142
+ options.whiteList = options.whiteList || DEFAULT$1.whiteList;
1143
+ options.onAttr = options.onAttr || DEFAULT$1.onAttr;
1144
+ options.onIgnoreAttr = options.onIgnoreAttr || DEFAULT$1.onIgnoreAttr;
1145
+ options.safeAttrValue = options.safeAttrValue || DEFAULT$1.safeAttrValue;
1146
+ this.options = options;
1147
+ }
1148
+ FilterCSS$2.prototype.process = function(css2) {
1149
+ css2 = css2 || "";
1150
+ css2 = css2.toString();
1151
+ if (!css2)
1152
+ return "";
1153
+ var me = this;
1154
+ var options = me.options;
1155
+ var whiteList = options.whiteList;
1156
+ var onAttr2 = options.onAttr;
1157
+ var onIgnoreAttr2 = options.onIgnoreAttr;
1158
+ var safeAttrValue2 = options.safeAttrValue;
1159
+ var retCSS = parseStyle(css2, function(sourcePosition, position, name, value, source) {
1160
+ var check = whiteList[name];
1161
+ var isWhite = false;
1162
+ if (check === true)
1163
+ isWhite = check;
1164
+ else if (typeof check === "function")
1165
+ isWhite = check(value);
1166
+ else if (check instanceof RegExp)
1167
+ isWhite = check.test(value);
1168
+ if (isWhite !== true)
1169
+ isWhite = false;
1170
+ value = safeAttrValue2(name, value);
1171
+ if (!value)
1172
+ return;
1173
+ var opts = {
1174
+ position,
1175
+ sourcePosition,
1176
+ source,
1177
+ isWhite
1178
+ };
1179
+ if (isWhite) {
1180
+ var ret = onAttr2(name, value, opts);
1181
+ if (isNull$1(ret)) {
1182
+ return name + ":" + value;
1183
+ } else {
1184
+ return ret;
1185
+ }
1186
+ } else {
1187
+ var ret = onIgnoreAttr2(name, value, opts);
1188
+ if (!isNull$1(ret)) {
1189
+ return ret;
1190
+ }
1191
+ }
1192
+ });
1193
+ return retCSS;
1194
+ };
1195
+ var css = FilterCSS$2;
1196
+ (function(module2, exports2) {
1197
+ var DEFAULT2 = _default;
1198
+ var FilterCSS2 = css;
1199
+ function filterCSS(html, options) {
1200
+ var xss2 = new FilterCSS2(options);
1201
+ return xss2.process(html);
1202
+ }
1203
+ exports2 = module2.exports = filterCSS;
1204
+ exports2.FilterCSS = FilterCSS2;
1205
+ for (var i in DEFAULT2)
1206
+ exports2[i] = DEFAULT2[i];
1207
+ if (typeof window !== "undefined") {
1208
+ window.filterCSS = module2.exports;
1209
+ }
1210
+ })(lib, lib.exports);
1211
+ var libExports$1 = lib.exports;
1212
+ var util = {
1213
+ indexOf: function(arr, item) {
1214
+ var i, j;
1215
+ if (Array.prototype.indexOf) {
1216
+ return arr.indexOf(item);
1217
+ }
1218
+ for (i = 0, j = arr.length; i < j; i++) {
1219
+ if (arr[i] === item) {
1220
+ return i;
1221
+ }
1222
+ }
1223
+ return -1;
1224
+ },
1225
+ forEach: function(arr, fn, scope) {
1226
+ var i, j;
1227
+ if (Array.prototype.forEach) {
1228
+ return arr.forEach(fn, scope);
1229
+ }
1230
+ for (i = 0, j = arr.length; i < j; i++) {
1231
+ fn.call(scope, arr[i], i, arr);
1232
+ }
1233
+ },
1234
+ trim: function(str) {
1235
+ if (String.prototype.trim) {
1236
+ return str.trim();
1237
+ }
1238
+ return str.replace(/(^\s*)|(\s*$)/g, "");
1239
+ },
1240
+ spaceIndex: function(str) {
1241
+ var reg = /\s|\n|\t/;
1242
+ var match = reg.exec(str);
1243
+ return match ? match.index : -1;
1244
+ }
1245
+ };
1246
+ var FilterCSS$1 = libExports$1.FilterCSS;
1247
+ var getDefaultCSSWhiteList = libExports$1.getDefaultWhiteList;
1248
+ var _$2 = util;
1249
+ function getDefaultWhiteList() {
1250
+ return {
1251
+ a: ["target", "href", "title"],
1252
+ abbr: ["title"],
1253
+ address: [],
1254
+ area: ["shape", "coords", "href", "alt"],
1255
+ article: [],
1256
+ aside: [],
1257
+ audio: [
1258
+ "autoplay",
1259
+ "controls",
1260
+ "crossorigin",
1261
+ "loop",
1262
+ "muted",
1263
+ "preload",
1264
+ "src"
1265
+ ],
1266
+ b: [],
1267
+ bdi: ["dir"],
1268
+ bdo: ["dir"],
1269
+ big: [],
1270
+ blockquote: ["cite"],
1271
+ br: [],
1272
+ caption: [],
1273
+ center: [],
1274
+ cite: [],
1275
+ code: [],
1276
+ col: ["align", "valign", "span", "width"],
1277
+ colgroup: ["align", "valign", "span", "width"],
1278
+ dd: [],
1279
+ del: ["datetime"],
1280
+ details: ["open"],
1281
+ div: [],
1282
+ dl: [],
1283
+ dt: [],
1284
+ em: [],
1285
+ figcaption: [],
1286
+ figure: [],
1287
+ font: ["color", "size", "face"],
1288
+ footer: [],
1289
+ h1: [],
1290
+ h2: [],
1291
+ h3: [],
1292
+ h4: [],
1293
+ h5: [],
1294
+ h6: [],
1295
+ header: [],
1296
+ hr: [],
1297
+ i: [],
1298
+ img: ["src", "alt", "title", "width", "height", "loading"],
1299
+ ins: ["datetime"],
1300
+ kbd: [],
1301
+ li: [],
1302
+ mark: [],
1303
+ nav: [],
1304
+ ol: [],
1305
+ p: [],
1306
+ pre: [],
1307
+ s: [],
1308
+ section: [],
1309
+ small: [],
1310
+ span: [],
1311
+ sub: [],
1312
+ summary: [],
1313
+ sup: [],
1314
+ strong: [],
1315
+ strike: [],
1316
+ table: ["width", "border", "align", "valign"],
1317
+ tbody: ["align", "valign"],
1318
+ td: ["width", "rowspan", "colspan", "align", "valign"],
1319
+ tfoot: ["align", "valign"],
1320
+ th: ["width", "rowspan", "colspan", "align", "valign"],
1321
+ thead: ["align", "valign"],
1322
+ tr: ["rowspan", "align", "valign"],
1323
+ tt: [],
1324
+ u: [],
1325
+ ul: [],
1326
+ video: [
1327
+ "autoplay",
1328
+ "controls",
1329
+ "crossorigin",
1330
+ "loop",
1331
+ "muted",
1332
+ "playsinline",
1333
+ "poster",
1334
+ "preload",
1335
+ "src",
1336
+ "height",
1337
+ "width"
1338
+ ]
1339
+ };
1340
+ }
1341
+ var defaultCSSFilter = new FilterCSS$1();
1342
+ function onTag(tag, html, options) {
1343
+ }
1344
+ function onIgnoreTag(tag, html, options) {
1345
+ }
1346
+ function onTagAttr(tag, name, value) {
1347
+ }
1348
+ function onIgnoreTagAttr(tag, name, value) {
1349
+ }
1350
+ function escapeHtml(html) {
1351
+ return html.replace(REGEXP_LT, "&lt;").replace(REGEXP_GT, "&gt;");
1352
+ }
1353
+ function safeAttrValue(tag, name, value, cssFilter) {
1354
+ value = friendlyAttrValue(value);
1355
+ if (name === "href" || name === "src") {
1356
+ value = _$2.trim(value);
1357
+ if (value === "#")
1358
+ return "#";
1359
+ if (!(value.substr(0, 7) === "http://" || value.substr(0, 8) === "https://" || value.substr(0, 7) === "mailto:" || value.substr(0, 4) === "tel:" || value.substr(0, 11) === "data:image/" || value.substr(0, 6) === "ftp://" || value.substr(0, 2) === "./" || value.substr(0, 3) === "../" || value[0] === "#" || value[0] === "/")) {
1360
+ return "";
1361
+ }
1362
+ } else if (name === "background") {
1363
+ REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
1364
+ if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {
1365
+ return "";
1366
+ }
1367
+ } else if (name === "style") {
1368
+ REGEXP_DEFAULT_ON_TAG_ATTR_7.lastIndex = 0;
1369
+ if (REGEXP_DEFAULT_ON_TAG_ATTR_7.test(value)) {
1370
+ return "";
1371
+ }
1372
+ REGEXP_DEFAULT_ON_TAG_ATTR_8.lastIndex = 0;
1373
+ if (REGEXP_DEFAULT_ON_TAG_ATTR_8.test(value)) {
1374
+ REGEXP_DEFAULT_ON_TAG_ATTR_4.lastIndex = 0;
1375
+ if (REGEXP_DEFAULT_ON_TAG_ATTR_4.test(value)) {
1376
+ return "";
1377
+ }
1378
+ }
1379
+ if (cssFilter !== false) {
1380
+ cssFilter = cssFilter || defaultCSSFilter;
1381
+ value = cssFilter.process(value);
1382
+ }
1383
+ }
1384
+ value = escapeAttrValue(value);
1385
+ return value;
1386
+ }
1387
+ var REGEXP_LT = /</g;
1388
+ var REGEXP_GT = />/g;
1389
+ var REGEXP_QUOTE = /"/g;
1390
+ var REGEXP_QUOTE_2 = /&quot;/g;
1391
+ var REGEXP_ATTR_VALUE_1 = /&#([a-zA-Z0-9]*);?/gim;
1392
+ var REGEXP_ATTR_VALUE_COLON = /&colon;?/gim;
1393
+ var REGEXP_ATTR_VALUE_NEWLINE = /&newline;?/gim;
1394
+ var REGEXP_DEFAULT_ON_TAG_ATTR_4 = /((j\s*a\s*v\s*a|v\s*b|l\s*i\s*v\s*e)\s*s\s*c\s*r\s*i\s*p\s*t\s*|m\s*o\s*c\s*h\s*a):/gi;
1395
+ var REGEXP_DEFAULT_ON_TAG_ATTR_7 = /e\s*x\s*p\s*r\s*e\s*s\s*s\s*i\s*o\s*n\s*\(.*/gi;
1396
+ var REGEXP_DEFAULT_ON_TAG_ATTR_8 = /u\s*r\s*l\s*\(.*/gi;
1397
+ function escapeQuote(str) {
1398
+ return str.replace(REGEXP_QUOTE, "&quot;");
1399
+ }
1400
+ function unescapeQuote(str) {
1401
+ return str.replace(REGEXP_QUOTE_2, '"');
1402
+ }
1403
+ function escapeHtmlEntities(str) {
1404
+ return str.replace(REGEXP_ATTR_VALUE_1, function replaceUnicode(str2, code) {
1405
+ return code[0] === "x" || code[0] === "X" ? String.fromCharCode(parseInt(code.substr(1), 16)) : String.fromCharCode(parseInt(code, 10));
1406
+ });
1407
+ }
1408
+ function escapeDangerHtml5Entities(str) {
1409
+ return str.replace(REGEXP_ATTR_VALUE_COLON, ":").replace(REGEXP_ATTR_VALUE_NEWLINE, " ");
1410
+ }
1411
+ function clearNonPrintableCharacter(str) {
1412
+ var str2 = "";
1413
+ for (var i = 0, len = str.length; i < len; i++) {
1414
+ str2 += str.charCodeAt(i) < 32 ? " " : str.charAt(i);
1415
+ }
1416
+ return _$2.trim(str2);
1417
+ }
1418
+ function friendlyAttrValue(str) {
1419
+ str = unescapeQuote(str);
1420
+ str = escapeHtmlEntities(str);
1421
+ str = escapeDangerHtml5Entities(str);
1422
+ str = clearNonPrintableCharacter(str);
1423
+ return str;
1424
+ }
1425
+ function escapeAttrValue(str) {
1426
+ str = escapeQuote(str);
1427
+ str = escapeHtml(str);
1428
+ return str;
1429
+ }
1430
+ function onIgnoreTagStripAll() {
1431
+ return "";
1432
+ }
1433
+ function StripTagBody(tags, next) {
1434
+ if (typeof next !== "function") {
1435
+ next = function() {
1436
+ };
1437
+ }
1438
+ var isRemoveAllTag = !Array.isArray(tags);
1439
+ function isRemoveTag(tag) {
1440
+ if (isRemoveAllTag)
1441
+ return true;
1442
+ return _$2.indexOf(tags, tag) !== -1;
1443
+ }
1444
+ var removeList = [];
1445
+ var posStart = false;
1446
+ return {
1447
+ onIgnoreTag: function(tag, html, options) {
1448
+ if (isRemoveTag(tag)) {
1449
+ if (options.isClosing) {
1450
+ var ret = "[/removed]";
1451
+ var end = options.position + ret.length;
1452
+ removeList.push([
1453
+ posStart !== false ? posStart : options.position,
1454
+ end
1455
+ ]);
1456
+ posStart = false;
1457
+ return ret;
1458
+ } else {
1459
+ if (!posStart) {
1460
+ posStart = options.position;
1461
+ }
1462
+ return "[removed]";
1463
+ }
1464
+ } else {
1465
+ return next(tag, html, options);
1466
+ }
1467
+ },
1468
+ remove: function(html) {
1469
+ var rethtml = "";
1470
+ var lastPos = 0;
1471
+ _$2.forEach(removeList, function(pos) {
1472
+ rethtml += html.slice(lastPos, pos[0]);
1473
+ lastPos = pos[1];
1474
+ });
1475
+ rethtml += html.slice(lastPos);
1476
+ return rethtml;
1477
+ }
1478
+ };
1479
+ }
1480
+ function stripCommentTag(html) {
1481
+ var retHtml = "";
1482
+ var lastPos = 0;
1483
+ while (lastPos < html.length) {
1484
+ var i = html.indexOf("<!--", lastPos);
1485
+ if (i === -1) {
1486
+ retHtml += html.slice(lastPos);
1487
+ break;
1488
+ }
1489
+ retHtml += html.slice(lastPos, i);
1490
+ var j = html.indexOf("-->", i);
1491
+ if (j === -1) {
1492
+ break;
1493
+ }
1494
+ lastPos = j + 3;
1495
+ }
1496
+ return retHtml;
1497
+ }
1498
+ function stripBlankChar(html) {
1499
+ var chars = html.split("");
1500
+ chars = chars.filter(function(char) {
1501
+ var c = char.charCodeAt(0);
1502
+ if (c === 127)
1503
+ return false;
1504
+ if (c <= 31) {
1505
+ if (c === 10 || c === 13)
1506
+ return true;
1507
+ return false;
1508
+ }
1509
+ return true;
1510
+ });
1511
+ return chars.join("");
1512
+ }
1513
+ _default$1.whiteList = getDefaultWhiteList();
1514
+ _default$1.getDefaultWhiteList = getDefaultWhiteList;
1515
+ _default$1.onTag = onTag;
1516
+ _default$1.onIgnoreTag = onIgnoreTag;
1517
+ _default$1.onTagAttr = onTagAttr;
1518
+ _default$1.onIgnoreTagAttr = onIgnoreTagAttr;
1519
+ _default$1.safeAttrValue = safeAttrValue;
1520
+ _default$1.escapeHtml = escapeHtml;
1521
+ _default$1.escapeQuote = escapeQuote;
1522
+ _default$1.unescapeQuote = unescapeQuote;
1523
+ _default$1.escapeHtmlEntities = escapeHtmlEntities;
1524
+ _default$1.escapeDangerHtml5Entities = escapeDangerHtml5Entities;
1525
+ _default$1.clearNonPrintableCharacter = clearNonPrintableCharacter;
1526
+ _default$1.friendlyAttrValue = friendlyAttrValue;
1527
+ _default$1.escapeAttrValue = escapeAttrValue;
1528
+ _default$1.onIgnoreTagStripAll = onIgnoreTagStripAll;
1529
+ _default$1.StripTagBody = StripTagBody;
1530
+ _default$1.stripCommentTag = stripCommentTag;
1531
+ _default$1.stripBlankChar = stripBlankChar;
1532
+ _default$1.attributeWrapSign = '"';
1533
+ _default$1.cssFilter = defaultCSSFilter;
1534
+ _default$1.getDefaultCSSWhiteList = getDefaultCSSWhiteList;
1535
+ var parser$1 = {};
1536
+ var _$1 = util;
1537
+ function getTagName(html) {
1538
+ var i = _$1.spaceIndex(html);
1539
+ var tagName;
1540
+ if (i === -1) {
1541
+ tagName = html.slice(1, -1);
1542
+ } else {
1543
+ tagName = html.slice(1, i + 1);
1544
+ }
1545
+ tagName = _$1.trim(tagName).toLowerCase();
1546
+ if (tagName.slice(0, 1) === "/")
1547
+ tagName = tagName.slice(1);
1548
+ if (tagName.slice(-1) === "/")
1549
+ tagName = tagName.slice(0, -1);
1550
+ return tagName;
1551
+ }
1552
+ function isClosing(html) {
1553
+ return html.slice(0, 2) === "</";
1554
+ }
1555
+ function parseTag$1(html, onTag2, escapeHtml2) {
1556
+ var rethtml = "";
1557
+ var lastPos = 0;
1558
+ var tagStart = false;
1559
+ var quoteStart = false;
1560
+ var currentPos = 0;
1561
+ var len = html.length;
1562
+ var currentTagName = "";
1563
+ var currentHtml = "";
1564
+ chariterator:
1565
+ for (currentPos = 0; currentPos < len; currentPos++) {
1566
+ var c = html.charAt(currentPos);
1567
+ if (tagStart === false) {
1568
+ if (c === "<") {
1569
+ tagStart = currentPos;
1570
+ continue;
1571
+ }
1572
+ } else {
1573
+ if (quoteStart === false) {
1574
+ if (c === "<") {
1575
+ rethtml += escapeHtml2(html.slice(lastPos, currentPos));
1576
+ tagStart = currentPos;
1577
+ lastPos = currentPos;
1578
+ continue;
1579
+ }
1580
+ if (c === ">" || currentPos === len - 1) {
1581
+ rethtml += escapeHtml2(html.slice(lastPos, tagStart));
1582
+ currentHtml = html.slice(tagStart, currentPos + 1);
1583
+ currentTagName = getTagName(currentHtml);
1584
+ rethtml += onTag2(
1585
+ tagStart,
1586
+ rethtml.length,
1587
+ currentTagName,
1588
+ currentHtml,
1589
+ isClosing(currentHtml)
1590
+ );
1591
+ lastPos = currentPos + 1;
1592
+ tagStart = false;
1593
+ continue;
1594
+ }
1595
+ if (c === '"' || c === "'") {
1596
+ var i = 1;
1597
+ var ic = html.charAt(currentPos - i);
1598
+ while (ic.trim() === "" || ic === "=") {
1599
+ if (ic === "=") {
1600
+ quoteStart = c;
1601
+ continue chariterator;
1602
+ }
1603
+ ic = html.charAt(currentPos - ++i);
1604
+ }
1605
+ }
1606
+ } else {
1607
+ if (c === quoteStart) {
1608
+ quoteStart = false;
1609
+ continue;
1610
+ }
1611
+ }
1612
+ }
1613
+ }
1614
+ if (lastPos < len) {
1615
+ rethtml += escapeHtml2(html.substr(lastPos));
1616
+ }
1617
+ return rethtml;
1618
+ }
1619
+ var REGEXP_ILLEGAL_ATTR_NAME = /[^a-zA-Z0-9\\_:.-]/gim;
1620
+ function parseAttr$1(html, onAttr2) {
1621
+ var lastPos = 0;
1622
+ var lastMarkPos = 0;
1623
+ var retAttrs = [];
1624
+ var tmpName = false;
1625
+ var len = html.length;
1626
+ function addAttr(name, value) {
1627
+ name = _$1.trim(name);
1628
+ name = name.replace(REGEXP_ILLEGAL_ATTR_NAME, "").toLowerCase();
1629
+ if (name.length < 1)
1630
+ return;
1631
+ var ret = onAttr2(name, value || "");
1632
+ if (ret)
1633
+ retAttrs.push(ret);
1634
+ }
1635
+ for (var i = 0; i < len; i++) {
1636
+ var c = html.charAt(i);
1637
+ var v, j;
1638
+ if (tmpName === false && c === "=") {
1639
+ tmpName = html.slice(lastPos, i);
1640
+ lastPos = i + 1;
1641
+ lastMarkPos = html.charAt(lastPos) === '"' || html.charAt(lastPos) === "'" ? lastPos : findNextQuotationMark(html, i + 1);
1642
+ continue;
1643
+ }
1644
+ if (tmpName !== false) {
1645
+ if (i === lastMarkPos) {
1646
+ j = html.indexOf(c, i + 1);
1647
+ if (j === -1) {
1648
+ break;
1649
+ } else {
1650
+ v = _$1.trim(html.slice(lastMarkPos + 1, j));
1651
+ addAttr(tmpName, v);
1652
+ tmpName = false;
1653
+ i = j;
1654
+ lastPos = i + 1;
1655
+ continue;
1656
+ }
1657
+ }
1658
+ }
1659
+ if (/\s|\n|\t/.test(c)) {
1660
+ html = html.replace(/\s|\n|\t/g, " ");
1661
+ if (tmpName === false) {
1662
+ j = findNextEqual(html, i);
1663
+ if (j === -1) {
1664
+ v = _$1.trim(html.slice(lastPos, i));
1665
+ addAttr(v);
1666
+ tmpName = false;
1667
+ lastPos = i + 1;
1668
+ continue;
1669
+ } else {
1670
+ i = j - 1;
1671
+ continue;
1672
+ }
1673
+ } else {
1674
+ j = findBeforeEqual(html, i - 1);
1675
+ if (j === -1) {
1676
+ v = _$1.trim(html.slice(lastPos, i));
1677
+ v = stripQuoteWrap(v);
1678
+ addAttr(tmpName, v);
1679
+ tmpName = false;
1680
+ lastPos = i + 1;
1681
+ continue;
1682
+ } else {
1683
+ continue;
1684
+ }
1685
+ }
1686
+ }
1687
+ }
1688
+ if (lastPos < html.length) {
1689
+ if (tmpName === false) {
1690
+ addAttr(html.slice(lastPos));
1691
+ } else {
1692
+ addAttr(tmpName, stripQuoteWrap(_$1.trim(html.slice(lastPos))));
1693
+ }
1694
+ }
1695
+ return _$1.trim(retAttrs.join(" "));
1696
+ }
1697
+ function findNextEqual(str, i) {
1698
+ for (; i < str.length; i++) {
1699
+ var c = str[i];
1700
+ if (c === " ")
1701
+ continue;
1702
+ if (c === "=")
1703
+ return i;
1704
+ return -1;
1705
+ }
1706
+ }
1707
+ function findNextQuotationMark(str, i) {
1708
+ for (; i < str.length; i++) {
1709
+ var c = str[i];
1710
+ if (c === " ")
1711
+ continue;
1712
+ if (c === "'" || c === '"')
1713
+ return i;
1714
+ return -1;
1715
+ }
1716
+ }
1717
+ function findBeforeEqual(str, i) {
1718
+ for (; i > 0; i--) {
1719
+ var c = str[i];
1720
+ if (c === " ")
1721
+ continue;
1722
+ if (c === "=")
1723
+ return i;
1724
+ return -1;
1725
+ }
1726
+ }
1727
+ function isQuoteWrapString(text) {
1728
+ if (text[0] === '"' && text[text.length - 1] === '"' || text[0] === "'" && text[text.length - 1] === "'") {
1729
+ return true;
1730
+ } else {
1731
+ return false;
1732
+ }
1733
+ }
1734
+ function stripQuoteWrap(text) {
1735
+ if (isQuoteWrapString(text)) {
1736
+ return text.substr(1, text.length - 2);
1737
+ } else {
1738
+ return text;
1739
+ }
1740
+ }
1741
+ parser$1.parseTag = parseTag$1;
1742
+ parser$1.parseAttr = parseAttr$1;
1743
+ var FilterCSS = libExports$1.FilterCSS;
1744
+ var DEFAULT = _default$1;
1745
+ var parser = parser$1;
1746
+ var parseTag = parser.parseTag;
1747
+ var parseAttr = parser.parseAttr;
1748
+ var _ = util;
1749
+ function isNull(obj) {
1750
+ return obj === void 0 || obj === null;
1751
+ }
1752
+ function getAttrs(html) {
1753
+ var i = _.spaceIndex(html);
1754
+ if (i === -1) {
1755
+ return {
1756
+ html: "",
1757
+ closing: html[html.length - 2] === "/"
1758
+ };
1759
+ }
1760
+ html = _.trim(html.slice(i + 1, -1));
1761
+ var isClosing2 = html[html.length - 1] === "/";
1762
+ if (isClosing2)
1763
+ html = _.trim(html.slice(0, -1));
1764
+ return {
1765
+ html,
1766
+ closing: isClosing2
1767
+ };
1768
+ }
1769
+ function shallowCopyObject(obj) {
1770
+ var ret = {};
1771
+ for (var i in obj) {
1772
+ ret[i] = obj[i];
1773
+ }
1774
+ return ret;
1775
+ }
1776
+ function keysToLowerCase(obj) {
1777
+ var ret = {};
1778
+ for (var i in obj) {
1779
+ if (Array.isArray(obj[i])) {
1780
+ ret[i.toLowerCase()] = obj[i].map(function(item) {
1781
+ return item.toLowerCase();
1782
+ });
1783
+ } else {
1784
+ ret[i.toLowerCase()] = obj[i];
1785
+ }
1786
+ }
1787
+ return ret;
1788
+ }
1789
+ function FilterXSS(options) {
1790
+ options = shallowCopyObject(options || {});
1791
+ if (options.stripIgnoreTag) {
1792
+ if (options.onIgnoreTag) {
1793
+ console.error(
1794
+ 'Notes: cannot use these two options "stripIgnoreTag" and "onIgnoreTag" at the same time'
1795
+ );
1796
+ }
1797
+ options.onIgnoreTag = DEFAULT.onIgnoreTagStripAll;
1798
+ }
1799
+ if (options.whiteList || options.allowList) {
1800
+ options.whiteList = keysToLowerCase(options.whiteList || options.allowList);
1801
+ } else {
1802
+ options.whiteList = DEFAULT.whiteList;
1803
+ }
1804
+ this.attributeWrapSign = options.singleQuotedAttributeValue === true ? "'" : DEFAULT.attributeWrapSign;
1805
+ options.onTag = options.onTag || DEFAULT.onTag;
1806
+ options.onTagAttr = options.onTagAttr || DEFAULT.onTagAttr;
1807
+ options.onIgnoreTag = options.onIgnoreTag || DEFAULT.onIgnoreTag;
1808
+ options.onIgnoreTagAttr = options.onIgnoreTagAttr || DEFAULT.onIgnoreTagAttr;
1809
+ options.safeAttrValue = options.safeAttrValue || DEFAULT.safeAttrValue;
1810
+ options.escapeHtml = options.escapeHtml || DEFAULT.escapeHtml;
1811
+ this.options = options;
1812
+ if (options.css === false) {
1813
+ this.cssFilter = false;
1814
+ } else {
1815
+ options.css = options.css || {};
1816
+ this.cssFilter = new FilterCSS(options.css);
1817
+ }
1818
+ }
1819
+ FilterXSS.prototype.process = function(html) {
1820
+ html = html || "";
1821
+ html = html.toString();
1822
+ if (!html)
1823
+ return "";
1824
+ var me = this;
1825
+ var options = me.options;
1826
+ var whiteList = options.whiteList;
1827
+ var onTag2 = options.onTag;
1828
+ var onIgnoreTag2 = options.onIgnoreTag;
1829
+ var onTagAttr2 = options.onTagAttr;
1830
+ var onIgnoreTagAttr2 = options.onIgnoreTagAttr;
1831
+ var safeAttrValue2 = options.safeAttrValue;
1832
+ var escapeHtml2 = options.escapeHtml;
1833
+ var attributeWrapSign = me.attributeWrapSign;
1834
+ var cssFilter = me.cssFilter;
1835
+ if (options.stripBlankChar) {
1836
+ html = DEFAULT.stripBlankChar(html);
1837
+ }
1838
+ if (!options.allowCommentTag) {
1839
+ html = DEFAULT.stripCommentTag(html);
1840
+ }
1841
+ var stripIgnoreTagBody = false;
1842
+ if (options.stripIgnoreTagBody) {
1843
+ stripIgnoreTagBody = DEFAULT.StripTagBody(
1844
+ options.stripIgnoreTagBody,
1845
+ onIgnoreTag2
1846
+ );
1847
+ onIgnoreTag2 = stripIgnoreTagBody.onIgnoreTag;
1848
+ }
1849
+ var retHtml = parseTag(
1850
+ html,
1851
+ function(sourcePosition, position, tag, html2, isClosing2) {
1852
+ var info = {
1853
+ sourcePosition,
1854
+ position,
1855
+ isClosing: isClosing2,
1856
+ isWhite: Object.prototype.hasOwnProperty.call(whiteList, tag)
1857
+ };
1858
+ var ret = onTag2(tag, html2, info);
1859
+ if (!isNull(ret))
1860
+ return ret;
1861
+ if (info.isWhite) {
1862
+ if (info.isClosing) {
1863
+ return "</" + tag + ">";
1864
+ }
1865
+ var attrs = getAttrs(html2);
1866
+ var whiteAttrList = whiteList[tag];
1867
+ var attrsHtml = parseAttr(attrs.html, function(name, value) {
1868
+ var isWhiteAttr = _.indexOf(whiteAttrList, name) !== -1;
1869
+ var ret2 = onTagAttr2(tag, name, value, isWhiteAttr);
1870
+ if (!isNull(ret2))
1871
+ return ret2;
1872
+ if (isWhiteAttr) {
1873
+ value = safeAttrValue2(tag, name, value, cssFilter);
1874
+ if (value) {
1875
+ return name + "=" + attributeWrapSign + value + attributeWrapSign;
1876
+ } else {
1877
+ return name;
1878
+ }
1879
+ } else {
1880
+ ret2 = onIgnoreTagAttr2(tag, name, value, isWhiteAttr);
1881
+ if (!isNull(ret2))
1882
+ return ret2;
1883
+ return;
1884
+ }
1885
+ });
1886
+ html2 = "<" + tag;
1887
+ if (attrsHtml)
1888
+ html2 += " " + attrsHtml;
1889
+ if (attrs.closing)
1890
+ html2 += " /";
1891
+ html2 += ">";
1892
+ return html2;
1893
+ } else {
1894
+ ret = onIgnoreTag2(tag, html2, info);
1895
+ if (!isNull(ret))
1896
+ return ret;
1897
+ return escapeHtml2(html2);
1898
+ }
1899
+ },
1900
+ escapeHtml2
1901
+ );
1902
+ if (stripIgnoreTagBody) {
1903
+ retHtml = stripIgnoreTagBody.remove(retHtml);
1904
+ }
1905
+ return retHtml;
1906
+ };
1907
+ var xss$1 = FilterXSS;
1908
+ (function(module2, exports2) {
1909
+ var DEFAULT2 = _default$1;
1910
+ var parser2 = parser$1;
1911
+ var FilterXSS2 = xss$1;
1912
+ function filterXSS(html, options) {
1913
+ var xss2 = new FilterXSS2(options);
1914
+ return xss2.process(html);
1915
+ }
1916
+ exports2 = module2.exports = filterXSS;
1917
+ exports2.filterXSS = filterXSS;
1918
+ exports2.FilterXSS = FilterXSS2;
1919
+ (function() {
1920
+ for (var i in DEFAULT2) {
1921
+ exports2[i] = DEFAULT2[i];
1922
+ }
1923
+ for (var j in parser2) {
1924
+ exports2[j] = parser2[j];
1925
+ }
1926
+ })();
1927
+ if (typeof window !== "undefined") {
1928
+ window.filterXSS = module2.exports;
1929
+ }
1930
+ function isWorkerEnv() {
1931
+ return typeof self !== "undefined" && typeof DedicatedWorkerGlobalScope !== "undefined" && self instanceof DedicatedWorkerGlobalScope;
1932
+ }
1933
+ if (isWorkerEnv()) {
1934
+ self.filterXSS = module2.exports;
1935
+ }
1936
+ })(lib$1, lib$1.exports);
1937
+ var libExports = lib$1.exports;
1938
+ const index = /* @__PURE__ */ getDefaultExportFromCjs(libExports);
1939
+ const xss = /* @__PURE__ */ _mergeNamespaces({
1940
+ __proto__: null,
1941
+ default: index
1942
+ }, [libExports]);
1943
+ const MdWhiteList = {
1944
+ img: ["class"],
1945
+ // 支持任务列表
1946
+ input: ["class", "disabled", "type", "checked"],
1947
+ // 主要支持youtobe、腾讯视频、哔哩哔哩等内嵌视频代码
1948
+ iframe: [
1949
+ "class",
1950
+ "width",
1951
+ "height",
1952
+ "src",
1953
+ "title",
1954
+ "border",
1955
+ "frameborder",
1956
+ "framespacing",
1957
+ "allow",
1958
+ "allowfullscreen"
1959
+ ]
1960
+ };
1961
+ const XSSPlugin = (md, options) => {
1962
+ const { extendedWhiteList = {}, xss: xssOption = {} } = options;
1963
+ let xssIns;
1964
+ if (typeof xssOption === "function") {
1965
+ xssIns = new libExports.FilterXSS(xssOption(xss));
1966
+ } else {
1967
+ const whiteList = libExports.getDefaultWhiteList();
1968
+ const keys = [...Object.keys(extendedWhiteList), ...Object.keys(MdWhiteList)];
1969
+ keys.forEach((key) => {
1970
+ const xssWhiteItem = whiteList[key] || [];
1971
+ const innerWhiteItem = MdWhiteList[key] || [];
1972
+ const userDefWhiteItem = extendedWhiteList[key] || [];
1973
+ whiteList[key] = [
1974
+ .../* @__PURE__ */ new Set([...xssWhiteItem, ...innerWhiteItem, ...userDefWhiteItem])
1975
+ ];
1976
+ });
1977
+ xssIns = new libExports.FilterXSS({
1978
+ whiteList,
1979
+ // 自定义的优先级最高
1980
+ ...xssOption
1981
+ });
1982
+ }
1983
+ md.core.ruler.after("linkify", "xss", (state) => {
1984
+ for (let i = 0; i < state.tokens.length; i++) {
1985
+ const cur = state.tokens[i];
1986
+ switch (cur.type) {
1987
+ case "html_block": {
1988
+ cur.content = xssIns.process(cur.content);
1989
+ break;
1990
+ }
1991
+ case "inline": {
1992
+ const inlineTokens = cur.children || [];
1993
+ inlineTokens.forEach((it) => {
1994
+ if (it.type === "html_inline") {
1995
+ it.content = xssIns.process(it.content);
1996
+ }
1997
+ });
1998
+ break;
1999
+ }
2000
+ }
2001
+ }
2002
+ });
2003
+ };
2004
+ const XSSPlugin$1 = XSSPlugin;
662
2005
  const initLineNumber = (md) => {
663
2006
  md.core.ruler.push("init-line-number", (state) => {
664
2007
  state.tokens.forEach((token) => {
@@ -726,31 +2069,8 @@ const useMarkdownIt = (props, previewOnly) => {
726
2069
  },
727
2070
  {
728
2071
  type: "xss",
729
- plugin: XSSPlugin,
730
- options: {
731
- // https://github.com/leizongmin/js-xss/blob/master/README.zh.md
732
- xss(xss) {
733
- return {
734
- whiteList: Object.assign({}, xss.getDefaultWhiteList(), {
735
- // 支持任务列表
736
- input: ["class", "disabled", "type", "checked"],
737
- // 主要支持youtobe、腾讯视频、哔哩哔哩等内嵌视频代码
738
- iframe: [
739
- "class",
740
- "width",
741
- "height",
742
- "src",
743
- "title",
744
- "border",
745
- "frameborder",
746
- "framespacing",
747
- "allow",
748
- "allowfullscreen"
749
- ]
750
- })
751
- };
752
- }
753
- }
2072
+ plugin: XSSPlugin$1,
2073
+ options: {}
754
2074
  }
755
2075
  ];
756
2076
  if (!props.noKatex) {
@@ -795,12 +2115,12 @@ const useMarkdownIt = (props, previewOnly) => {
795
2115
  } else {
796
2116
  codeHtml = md.utils.escapeHtml(str);
797
2117
  }
798
- const codeSpan = showCodeRowNumber ? index.generateCodeRowNumber(codeHtml.replace(/^\n+|\n+$/g, "")) : `<span class="${config.prefix}-code-block">${codeHtml.replace(/^\n+|\n+$/g, "")}</span>`;
2118
+ const codeSpan = showCodeRowNumber ? index$1.generateCodeRowNumber(codeHtml.replace(/^\n+|\n+$/g, "")) : `<span class="${config.prefix}-code-block">${codeHtml.replace(/^\n+|\n+$/g, "")}</span>`;
799
2119
  return `<pre><code class="language-${language}" language=${language}>${codeSpan}</code></pre>`;
800
2120
  }
801
2121
  });
802
2122
  initLineNumber(md);
803
- const key = vue.ref(`_article-key_${util.uuid()}`);
2123
+ const key = vue.ref(`_article-key_${util$2.uuid()}`);
804
2124
  const html = vue.ref(props.sanitize(md.render(props.modelValue)));
805
2125
  const updatedTodo = () => {
806
2126
  eventName.bus.emit(editorId, eventName.BUILD_FINISHED, html.value);
@@ -820,7 +2140,7 @@ const useMarkdownIt = (props, previewOnly) => {
820
2140
  });
821
2141
  vue.watch(
822
2142
  [vue.toRef(props, "modelValue"), needReRender, reRenderRef],
823
- util.debounce(markHtml, previewOnly ? 0 : editorConfig.renderDelay)
2143
+ util$2.debounce(markHtml, previewOnly ? 0 : editorConfig.renderDelay)
824
2144
  );
825
2145
  vue.watch(
826
2146
  () => props.setting.preview,
@@ -842,7 +2162,7 @@ const useMarkdownIt = (props, previewOnly) => {
842
2162
  eventName.bus.on(editorId, {
843
2163
  name: eventName.RERENDER,
844
2164
  callback: () => {
845
- key.value = `_article-key_${util.uuid()}`;
2165
+ key.value = `_article-key_${util$2.uuid()}`;
846
2166
  markHtml();
847
2167
  }
848
2168
  });
@@ -1117,8 +2437,8 @@ const useProvidePreview = (props) => {
1117
2437
  ...config.staticTextDefault,
1118
2438
  ...config.configOption.editorConfig.languageUserDefined
1119
2439
  };
1120
- return util.deepMerge(
1121
- util.deepClone(config.staticTextDefault["en-US"]),
2440
+ return util$2.deepMerge(
2441
+ util$2.deepClone(config.staticTextDefault["en-US"]),
1122
2442
  allText[props.language] || {}
1123
2443
  );
1124
2444
  });
@@ -1166,9 +2486,9 @@ const useExpansion = (props) => {
1166
2486
  const noCropperScript = noUploadImg || editorExtensions.cropper.instance;
1167
2487
  vue.onMounted(() => {
1168
2488
  if (!noCropperScript) {
1169
- const { js = {}, css = {} } = editorExtensionsAttrs.cropper || {};
2489
+ const { js = {}, css: css2 = {} } = editorExtensionsAttrs.cropper || {};
1170
2490
  dom.appendHandler("link", {
1171
- ...css,
2491
+ ...css2,
1172
2492
  rel: "stylesheet",
1173
2493
  href: editorExtensions.cropper.css,
1174
2494
  id: `${config.prefix}-cropperCss`
@@ -1485,7 +2805,7 @@ const mdPreviewProps = {
1485
2805
  */
1486
2806
  editorId: {
1487
2807
  type: String,
1488
- default: () => index.getNextId("md-editor-v3_")
2808
+ default: () => index$1.getNextId("md-editor-v3_")
1489
2809
  },
1490
2810
  /**
1491
2811
  * 预览中代码是否显示行号