@sparkle-learning/core 0.0.23 → 0.0.26

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.
Files changed (42) hide show
  1. package/dist/cjs/header-mobile-collapse_60.cjs.entry.js +1 -1
  2. package/dist/cjs/{index.es-c12b0714.js → index.es-91493ac6.js} +1 -1
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/{purify-e34cd5cf.js → purify-ed567052.js} +1 -1
  5. package/dist/cjs/sparkle-animation-player.cjs.entry.js +5 -2
  6. package/dist/cjs/sparkle-core.cjs.js +1 -1
  7. package/dist/cjs/sparkle-youtube.cjs.entry.js +14 -168
  8. package/dist/collection/assets/img/forward.svg +5 -0
  9. package/dist/collection/assets/img/pause.svg +5 -0
  10. package/dist/collection/assets/img/play-symbol.svg +8 -0
  11. package/dist/collection/assets/img/play.svg +4 -0
  12. package/dist/collection/assets/img/rewind.svg +5 -0
  13. package/dist/collection/components/sparkle-animation-player/assets/play-button-disabled-overlay.png +0 -0
  14. package/dist/collection/components/sparkle-animation-player/assets/play-button-overlay.png +0 -0
  15. package/dist/collection/components/sparkle-animation-player/sparkle-animation-player.js +10 -7
  16. package/dist/collection/components/sparkle-course-root/sparkle-course-root.js +14 -0
  17. package/dist/collection/components/sparkle-youtube/sparkle-youtube.css +16 -0
  18. package/dist/collection/components/sparkle-youtube/sparkle-youtube.js +25 -307
  19. package/dist/collection/pages/course/welcome-to-mind-body/introduction/animation/m4l1p1_part1.js +2727 -0
  20. package/dist/collection/pages/course/welcome-to-mind-body/introduction/animation/m4l1p1_part2.js +2042 -0
  21. package/dist/esm/header-mobile-collapse_60.entry.js +1 -1
  22. package/dist/esm/{index.es-34d81aa0.js → index.es-32e2f407.js} +1 -1
  23. package/dist/esm/loader.js +1 -1
  24. package/dist/esm/{purify-76414f98.js → purify-f1a55787.js} +1 -1
  25. package/dist/esm/sparkle-animation-player.entry.js +6 -3
  26. package/dist/esm/sparkle-core.js +1 -1
  27. package/dist/esm/sparkle-youtube.entry.js +15 -169
  28. package/dist/sparkle-core/assets/play-button-disabled-overlay.png +0 -0
  29. package/dist/sparkle-core/assets/play-button-overlay.png +0 -0
  30. package/dist/sparkle-core/{p-315af535.js → p-0d3fe46c.js} +1 -1
  31. package/dist/sparkle-core/{p-fc739e6b.js → p-14ff8097.js} +4 -4
  32. package/dist/sparkle-core/p-1e1f5e98.entry.js +1 -0
  33. package/dist/sparkle-core/p-82d95fcd.entry.js +1 -0
  34. package/dist/sparkle-core/{p-ba79a250.js → p-ab5cdfeb.js} +1 -1
  35. package/dist/sparkle-core/{p-1af89970.entry.js → p-f6ce91f2.entry.js} +1 -1
  36. package/dist/sparkle-core/sparkle-core.esm.js +1 -1
  37. package/dist/types/components/sparkle-course-root/sparkle-course-root.d.ts +1 -0
  38. package/dist/types/components/sparkle-youtube/sparkle-youtube.d.ts +6 -20
  39. package/dist/types/components.d.ts +3 -14
  40. package/package.json +2 -2
  41. package/dist/sparkle-core/p-0bd3e81f.entry.js +0 -1
  42. package/dist/sparkle-core/p-d069b834.entry.js +0 -1
@@ -1,187 +1,33 @@
1
- import { r as registerInstance, h, H as Host, d as getElement } from './index-55fc9f5e.js';
1
+ import { r as registerInstance, h, d as getElement } from './index-55fc9f5e.js';
2
2
 
3
- const sparkleYoutubeCss = ":host(.loaded) div.youtube-container{opacity:var(--sparkle-youtube-opacity-loaded, 1)}div.youtube-container{opacity:var(--sparkle-youtube-opacity-not-loaded, 0);transition:var(--sparkle-youtube-transition, opacity 0.15s linear)}";
3
+ const sparkleYoutubeCss = ":host(.loaded) div.youtube-container{opacity:var(--sparkle-youtube-opacity-loaded, 1)}div.youtube-container{opacity:var(--sparkle-youtube-opacity-not-loaded, 0);transition:var(--sparkle-youtube-transition, opacity 0.15s linear)}.embed-container{position:relative;padding-bottom:56.25%;height:0;overflow:hidden;max-width:100%}.embed-container iframe,.embed-container object,.embed-container embed{position:absolute;top:0;left:0;width:100%;height:100%}";
4
4
 
5
5
  const SparkleYoutube = class {
6
6
  constructor(hostRef) {
7
7
  registerInstance(this, hostRef);
8
- this.allowFullscreen = true;
9
- this.instant = false;
10
- this.loading = false;
11
- this.loaded = false;
8
+ this.video_thumbnail = '';
12
9
  }
13
- async componentWillLoad() {
14
- await this.addPreconnectLink();
10
+ componentDidLoad() {
11
+ this.classMode = this.initialClassMode;
12
+ this.classModeChanged();
15
13
  }
16
- async componentDidLoad() {
17
- if (this.instant) {
18
- await this.lazyLoadContent();
19
- }
20
- }
21
- async updateIFrame(width, height) {
22
- const iframe = this.el.shadowRoot.querySelector('iframe');
23
- if (iframe) {
24
- iframe.width = '' + width;
25
- iframe.height = '' + height;
26
- }
27
- }
28
- lazyLoadContent() {
29
- return this.createIFrame();
30
- }
31
- async onSrcUpdate() {
32
- await this.createIFrame();
33
- }
34
- play() {
35
- return this.playPauseVideo(true);
36
- }
37
- pause() {
38
- return this.playPauseVideo(false);
39
- }
40
- addPreconnectLink() {
41
- return new Promise((resolve) => {
42
- if (!this.src || !document) {
43
- resolve();
44
- return;
45
- }
46
- const links = document.head.querySelectorAll("link[rel='preconnect'][youtube]");
47
- if (links && links.length > 0) {
48
- resolve();
49
- return;
50
- }
51
- const link = document.createElement('link');
52
- link.rel = 'preconnect';
53
- link.href = 'https://www.youtube.com';
54
- link.setAttribute('youtube', '');
55
- document.head.appendChild(link);
56
- resolve();
57
- });
58
- }
59
- createIFrame() {
60
- return new Promise(async (resolve) => {
61
- if (!this.src) {
62
- resolve();
63
- return;
64
- }
65
- if (this.loading) {
66
- resolve();
67
- return;
14
+ classModeChanged() {
15
+ if (this.classMode) {
16
+ var youtube_video_id = this.src.match(/youtube\.com.*(\?v=|\/embed\/)(.{11})/).pop();
17
+ if (youtube_video_id.length == 11) {
18
+ this.video_thumbnail = '//img.youtube.com/vi/' + youtube_video_id + '/0.jpg';
68
19
  }
69
- const iframe = this.el.shadowRoot.querySelector('iframe');
70
- if (iframe && !iframe.parentElement) {
71
- resolve();
72
- return;
73
- }
74
- this.loading = true;
75
- this.loaded = false;
76
- if (iframe) {
77
- iframe.parentElement.removeChild(iframe);
78
- }
79
- const element = document.createElement('iframe');
80
- const allow = document.createAttribute('allow');
81
- allow.value = 'accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture';
82
- this.setAttributeNode(element, allow);
83
- if (this.allowFullscreen) {
84
- const allowFullScreen = document.createAttribute('allowfullscreen');
85
- allowFullScreen.value = '';
86
- this.setAttributeNode(element, allowFullScreen);
87
- }
88
- let src = await this.formatSrc();
89
- if (!this.allowFullscreen) {
90
- // Not auto fullscreen on iOS: https://developers.google.com/youtube/player_parameters
91
- const playsinline = document.createAttribute('playsinline');
92
- playsinline.value = '1';
93
- this.setAttributeNode(element, playsinline);
94
- const split = src.split('?');
95
- src += `${split && split.length > 0 ? '&' : '?'}playsinline=1`;
96
- }
97
- element.src = src;
98
- element.width = '' + this.width;
99
- element.height = '' + this.height;
100
- element.frameBorder = '0';
101
- element.title = this.frameTitle;
102
- const div = this.el.shadowRoot.querySelector('div');
103
- if (!div) {
104
- resolve();
105
- return;
106
- }
107
- div.appendChild(element);
108
- this.loading = false;
109
- this.loaded = true;
110
- resolve();
111
- });
112
- }
113
- setAttributeNode(element, attr) {
114
- // Stencil prerendering
115
- if (element.setAttributeNode === 'function') {
116
- element.setAttributeNode(attr);
117
20
  }
118
21
  }
119
- formatSrc() {
120
- return new Promise(async (resolve) => {
121
- // Direct URL can't be embedded, like https://www.youtube.com/watch?v=oUOjJIfPIjw or https://youtu.be/e63Cgln6Yag
122
- const videoId = await this.findVideoId();
123
- if (videoId) {
124
- // In such a case return a link which could be embedded
125
- resolve('https://www.youtube.com/embed/' + videoId + '?enablejsapi=1');
126
- }
127
- else {
128
- // Otherwise we try the provided url
129
- if (!this.src) {
130
- resolve(this.src);
131
- return;
132
- }
133
- // But first, if an embed link, like https://www.youtube.com/embed/PnSNT5WpauE, would be passed, a parameter to enable js should be added otherwise play and pause could not be triggered
134
- // Therefore we add enablejsapi if needed in any case
135
- const url = new URL(this.src);
136
- if (!url.searchParams.get('enablejsapi')) {
137
- url.searchParams.append('enablejsapi', '1');
138
- }
139
- resolve(url.href);
140
- }
141
- });
142
- }
143
- findVideoId() {
144
- return new Promise((resolve) => {
145
- const url = new URL(this.src);
146
- let videoId = url.searchParams.get('v');
147
- if (!videoId) {
148
- const host = url.host;
149
- if (host === 'youtu.be') {
150
- // For shortened url
151
- const pathname = url.pathname;
152
- if (pathname) {
153
- const split = url.pathname.split('/');
154
- if (split && split.length >= 2) {
155
- videoId = url.pathname.split('/')[1];
156
- }
157
- }
158
- }
159
- }
160
- resolve(videoId);
161
- });
162
- }
163
- playPauseVideo(play) {
164
- return new Promise(async (resolve) => {
165
- const iframe = this.el.shadowRoot.querySelector('iframe');
166
- if (!iframe) {
167
- resolve();
168
- return;
169
- }
170
- iframe.contentWindow.postMessage(JSON.stringify({
171
- event: 'command',
172
- func: play ? 'playVideo' : 'pauseVideo',
173
- args: '',
174
- }), '*');
175
- resolve();
176
- });
22
+ classRoomModeChanged(val) {
23
+ this.classMode = val;
177
24
  }
178
25
  render() {
179
- const hostClass = this.loaded ? 'loaded' : '';
180
- return (h(Host, { class: hostClass }, h("div", { class: "youtube-container" })));
26
+ return (h("div", null, !this.classMode ? (h("div", { class: "embed-container" }, h("iframe", { src: this.src.replace("watch?v=", "embed/"), frameborder: "0", allowFullScreen: true }))) : (h("div", null, h("img", { src: this.video_thumbnail })))));
181
27
  }
182
28
  get el() { return getElement(this); }
183
29
  static get watchers() { return {
184
- "src": ["onSrcUpdate"]
30
+ "classMode": ["classModeChanged"]
185
31
  }; }
186
32
  };
187
33
  SparkleYoutube.style = sparkleYoutubeCss;
@@ -1,3 +1,3 @@
1
- import{c as e,a as t}from"./p-fc739e6b.js";var n=e((function(e){
1
+ import{c as e,a as t}from"./p-14ff8097.js";var n=e((function(e){
2
2
  /*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.2.2/LICENSE */
3
3
  e.exports=function(){var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,r=Object.getPrototypeOf,i=Object.getOwnPropertyDescriptor,o=Object.freeze,a=Object.seal,l=Object.create,s="undefined"!=typeof Reflect&&Reflect,c=s.apply,f=s.construct;c||(c=function(e,t,n){return e.apply(t,n)}),o||(o=function(e){return e}),a||(a=function(e){return e}),f||(f=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(t))))});var u,d=k(Array.prototype.forEach),m=k(Array.prototype.pop),p=k(Array.prototype.push),g=k(String.prototype.toLowerCase),h=k(String.prototype.match),y=k(String.prototype.replace),v=k(String.prototype.indexOf),b=k(String.prototype.trim),x=k(RegExp.prototype.test),w=(u=TypeError,function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return f(u,t)});function k(e){return function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return c(e,t,r)}}function S(e,r){t&&t(e,null);for(var i=r.length;i--;){var o=r[i];if("string"==typeof o){var a=g(o);a!==o&&(n(r)||(r[i]=a),o=a)}e[o]=!0}return e}function A(t){var n=l(null),r=void 0;for(r in t)c(e,t,[r])&&(n[r]=t[r]);return n}function z(e,t){for(;null!==e;){var n=i(e,t);if(n){if(n.get)return k(n.get);if("function"==typeof n.value)return k(n.value)}e=r(e)}return function(e){return console.warn("fallback value for",e),null}}var j=o(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),O=o(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),F=o(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),T=o(["animate","color-profile","cursor","discard","fedropshadow","feimage","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),D=o(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover"]),L=o(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),M=o(["#text"]),R=o(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","xmlns"]),E=o(["accent-height","accumulate","additive","alignment-baseline","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","targetx","targety","transform","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),_=o(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),B=o(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),q=a(/\{\{[\s\S]*|[\s\S]*\}\}/gm),N=a(/<%[\s\S]*|[\s\S]*%>/gm),I=a(/^data-[\-\w.\u00B7-\uFFFF]/),G=a(/^aria-[\-\w]+$/),C=a(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),U=a(/^(?:\w+script|data):/i),H=a(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function W(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}var $=function(){return"undefined"==typeof window?null:window},V=function(e,t){if("object"!==(void 0===e?"undefined":P(e))||"function"!=typeof e.createPolicy)return null;var n=null,r="data-tt-policy-suffix";t.currentScript&&t.currentScript.hasAttribute(r)&&(n=t.currentScript.getAttribute(r));var i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}};return function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:$(),n=function(t){return e(t)};if(n.version="2.2.7",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,i=t.document,a=t.DocumentFragment,l=t.HTMLTemplateElement,s=t.Node,c=t.Element,f=t.NodeFilter,u=t.NamedNodeMap,k=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,Y=t.Text,J=t.Comment,K=t.DOMParser,Q=t.trustedTypes,X=c.prototype,Z=z(X,"cloneNode"),ee=z(X,"nextSibling"),te=z(X,"childNodes"),ne=z(X,"parentNode");if("function"==typeof l){var re=i.createElement("template");re.content&&re.content.ownerDocument&&(i=re.content.ownerDocument)}var ie=V(Q,r),oe=ie&&Be?ie.createHTML(""):"",ae=i.implementation,le=i.createNodeIterator,se=i.getElementsByTagName,ce=i.createDocumentFragment,fe=r.importNode,ue={};try{ue=A(i).documentMode?i.documentMode:{}}catch(e){}var de={};n.isSupported="function"==typeof ne&&ae&&void 0!==ae.createHTMLDocument&&9!==ue;var me=q,pe=N,ge=I,he=G,ye=U,ve=H,be=C,xe=null,we=S({},[].concat(W(j),W(O),W(F),W(D),W(M))),ke=null,Se=S({},[].concat(W(R),W(E),W(_),W(B))),Ae=null,ze=null,je=!0,Oe=!0,Fe=!1,Te=!1,De=!1,Le=!1,Me=!1,Re=!1,Ee=!1,_e=!0,Be=!1,qe=!0,Ne=!0,Ie=!1,Ge={},Ce=S({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),Ue=null,He=S({},["audio","video","img","source","image","track"]),Pe=null,We=S({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),$e=null,Ve=i.createElement("form"),Ye=function(e){$e&&$e===e||(e&&"object"===(void 0===e?"undefined":P(e))||(e={}),e=A(e),xe="ALLOWED_TAGS"in e?S({},e.ALLOWED_TAGS):we,ke="ALLOWED_ATTR"in e?S({},e.ALLOWED_ATTR):Se,Pe="ADD_URI_SAFE_ATTR"in e?S(A(We),e.ADD_URI_SAFE_ATTR):We,Ue="ADD_DATA_URI_TAGS"in e?S(A(He),e.ADD_DATA_URI_TAGS):He,Ae="FORBID_TAGS"in e?S({},e.FORBID_TAGS):{},ze="FORBID_ATTR"in e?S({},e.FORBID_ATTR):{},je=!1!==e.ALLOW_ARIA_ATTR,Oe=!1!==e.ALLOW_DATA_ATTR,Fe=e.ALLOW_UNKNOWN_PROTOCOLS||!1,De=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,_e=!1!==e.RETURN_DOM_IMPORT,Be=e.RETURN_TRUSTED_TYPE||!1,Me=e.FORCE_BODY||!1,qe=!1!==e.SANITIZE_DOM,Ne=!1!==e.KEEP_CONTENT,Ie=e.IN_PLACE||!1,be=e.ALLOWED_URI_REGEXP||be,(Te=e.SAFE_FOR_TEMPLATES||!1)&&(Oe=!1),(Ee=e.RETURN_DOM_FRAGMENT||!1)&&(Re=!0),(Ge="USE_PROFILES"in e&&e.USE_PROFILES)&&(xe=S({},[].concat(W(M))),ke=[],!0===Ge.html&&(S(xe,j),S(ke,R)),!0===Ge.svg&&(S(xe,O),S(ke,E),S(ke,B)),!0===Ge.svgFilters&&(S(xe,F),S(ke,E),S(ke,B)),!0===Ge.mathMl&&(S(xe,D),S(ke,_),S(ke,B))),e.ADD_TAGS&&(xe===we&&(xe=A(xe)),S(xe,e.ADD_TAGS)),e.ADD_ATTR&&(ke===Se&&(ke=A(ke)),S(ke,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&S(Pe,e.ADD_URI_SAFE_ATTR),Ne&&(xe["#text"]=!0),De&&S(xe,["html","head","body"]),xe.table&&(S(xe,["tbody"]),delete Ae.tbody),o&&o(e),$e=e)},Je=S({},["mi","mo","mn","ms","mtext"]),Ke=S({},["foreignobject","desc","title","annotation-xml"]),Qe=S({},O);S(Qe,F),S(Qe,T);var Xe=S({},D);S(Xe,L);var Ze="http://www.w3.org/1998/Math/MathML",et="http://www.w3.org/2000/svg",tt="http://www.w3.org/1999/xhtml",nt=function(e){var t=ne(e);t&&t.tagName||(t={namespaceURI:tt,tagName:"template"});var n=g(e.tagName),r=g(t.tagName);if(e.namespaceURI===et)return t.namespaceURI===tt?"svg"===n:t.namespaceURI===Ze?"svg"===n&&("annotation-xml"===r||Je[r]):Boolean(Qe[n]);if(e.namespaceURI===Ze)return t.namespaceURI===tt?"math"===n:t.namespaceURI===et?"math"===n&&Ke[r]:Boolean(Xe[n]);if(e.namespaceURI===tt){if(t.namespaceURI===et&&!Ke[r])return!1;if(t.namespaceURI===Ze&&!Je[r])return!1;var i=S({},["title","style","font","a","script"]);return!Xe[n]&&(i[n]||!Qe[n])}return!1},rt=function(e){p(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=oe}catch(t){e.remove()}}},it=function(e,t){try{p(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){p(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!ke[e])if(Re||Ee)try{rt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},ot=function(e){var t=void 0,n=void 0;if(Me)e="<remove></remove>"+e;else{var r=h(e,/^[\r\n\t ]+/);n=r&&r[0]}var o=ie?ie.createHTML(e):e;try{t=(new K).parseFromString(o,"text/html")}catch(e){}if(!t||!t.documentElement){var a=(t=ae.createHTMLDocument("")).body;a.parentNode.removeChild(a.parentNode.firstElementChild),a.outerHTML=o}return e&&n&&t.body.insertBefore(i.createTextNode(n),t.body.childNodes[0]||null),se.call(t,De?"html":"body")[0]},at=function(e){return le.call(e.ownerDocument||e,e,f.SHOW_ELEMENT|f.SHOW_COMMENT|f.SHOW_TEXT,(function(){return f.FILTER_ACCEPT}),!1)},lt=function(e){return!(e instanceof Y||e instanceof J||"string"==typeof e.nodeName&&"string"==typeof e.textContent&&"function"==typeof e.removeChild&&e.attributes instanceof k&&"function"==typeof e.removeAttribute&&"function"==typeof e.setAttribute&&"string"==typeof e.namespaceURI&&"function"==typeof e.insertBefore)},st=function(e){return"object"===(void 0===s?"undefined":P(s))?e instanceof s:e&&"object"===(void 0===e?"undefined":P(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},ct=function(e,t,r){de[e]&&d(de[e],(function(e){e.call(n,t,r,$e)}))},ft=function(e){var t=void 0;if(ct("beforeSanitizeElements",e,null),lt(e))return rt(e),!0;if(h(e.nodeName,/[\u0080-\uFFFF]/))return rt(e),!0;var r=g(e.nodeName);if(ct("uponSanitizeElement",e,{tagName:r,allowedTags:xe}),!st(e.firstElementChild)&&(!st(e.content)||!st(e.content.firstElementChild))&&x(/<[/\w]/g,e.innerHTML)&&x(/<[/\w]/g,e.textContent))return rt(e),!0;if(!xe[r]||Ae[r]){if(Ne&&!Ce[r]){var i=ne(e),o=te(e);if(o&&i)for(var a=o.length-1;a>=0;--a)i.insertBefore(Z(o[a],!0),ee(e))}return rt(e),!0}return e instanceof c&&!nt(e)?(rt(e),!0):"noscript"!==r&&"noembed"!==r||!x(/<\/no(script|embed)/i,e.innerHTML)?(Te&&3===e.nodeType&&(t=y(t=e.textContent,me," "),t=y(t,pe," "),e.textContent!==t&&(p(n.removed,{element:e.cloneNode()}),e.textContent=t)),ct("afterSanitizeElements",e,null),!1):(rt(e),!0)},ut=function(e,t,n){if(qe&&("id"===t||"name"===t)&&(n in i||n in Ve))return!1;if(Oe&&x(ge,t));else if(je&&x(he,t));else{if(!ke[t]||ze[t])return!1;if(Pe[t]);else if(x(be,y(n,ve,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==v(n,"data:")||!Ue[e])if(Fe&&!x(ye,y(n,ve,"")));else if(n)return!1}return!0},dt=function(e){var t=void 0,r=void 0,i=void 0,o=void 0;ct("beforeSanitizeAttributes",e,null);var a=e.attributes;if(a){var l={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ke};for(o=a.length;o--;){var s=(t=a[o]).name,c=t.namespaceURI;if(r=b(t.value),i=g(s),l.attrName=i,l.attrValue=r,l.keepAttr=!0,l.forceKeepAttr=void 0,ct("uponSanitizeAttribute",e,l),r=l.attrValue,!l.forceKeepAttr&&(it(s,e),l.keepAttr))if(x(/\/>/i,r))it(s,e);else{Te&&(r=y(r,me," "),r=y(r,pe," "));var f=e.nodeName.toLowerCase();if(ut(f,i,r))try{c?e.setAttributeNS(c,s,r):e.setAttribute(s,r),m(n.removed)}catch(e){}}}ct("afterSanitizeAttributes",e,null)}},mt=function e(t){var n=void 0,r=at(t);for(ct("beforeSanitizeShadowDOM",t,null);n=r.nextNode();)ct("uponSanitizeShadowNode",n,null),ft(n)||(n.content instanceof a&&e(n.content),dt(n));ct("afterSanitizeShadowDOM",t,null)};return n.sanitize=function(e,i){var o=void 0,l=void 0,c=void 0,f=void 0,u=void 0;if(e||(e="\x3c!--\x3e"),"string"!=typeof e&&!st(e)){if("function"!=typeof e.toString)throw w("toString is not a function");if("string"!=typeof(e=e.toString()))throw w("dirty is not a string, aborting")}if(!n.isSupported){if("object"===P(t.toStaticHTML)||"function"==typeof t.toStaticHTML){if("string"==typeof e)return t.toStaticHTML(e);if(st(e))return t.toStaticHTML(e.outerHTML)}return e}if(Le||Ye(i),n.removed=[],"string"==typeof e&&(Ie=!1),Ie);else if(e instanceof s)1===(l=(o=ot("\x3c!----\x3e")).ownerDocument.importNode(e,!0)).nodeType&&"BODY"===l.nodeName||"HTML"===l.nodeName?o=l:o.appendChild(l);else{if(!Re&&!Te&&!De&&-1===e.indexOf("<"))return ie&&Be?ie.createHTML(e):e;if(!(o=ot(e)))return Re?null:oe}o&&Me&&rt(o.firstChild);for(var d=at(Ie?e:o);c=d.nextNode();)3===c.nodeType&&c===f||ft(c)||(c.content instanceof a&&mt(c.content),dt(c),f=c);if(f=null,Ie)return e;if(Re){if(Ee)for(u=ce.call(o.ownerDocument);o.firstChild;)u.appendChild(o.firstChild);else u=o;return _e&&(u=fe.call(r,u,!0)),u}var m=De?o.outerHTML:o.innerHTML;return Te&&(m=y(m,me," "),m=y(m,pe," ")),ie&&Be?ie.createHTML(m):m},n.setConfig=function(e){Ye(e),Le=!0},n.clearConfig=function(){$e=null,Le=!1},n.isValidAttribute=function(e,t,n){$e||Ye({});var r=g(e),i=g(t);return ut(r,i,n)},n.addHook=function(e,t){"function"==typeof t&&(de[e]=de[e]||[],p(de[e],t))},n.removeHook=function(e){de[e]&&m(de[e])},n.removeHooks=function(e){de[e]&&(de[e]=[])},n.removeAllHooks=function(){de={}},n}()}()}));const r=Object.freeze(Object.assign(Object.create(null),n,{default:n}));export{r as p}