/**JavaScript HTML Sanitizer v2.0.2, (c) Alexander Yumashev, Jitbit Software.*/
"use strict";var HtmlSanitizer=new function(){const e={A:!0,ABBR:!0,B:!0,BLOCKQUOTE:!0,BODY:!0,BR:!0,CENTER:!0,CODE:!0,DD:!0,DIV:!0,DL:!0,DT:!0,EM:!0,FONT:!0,H1:!0,H2:!0,H3:!0,H4:!0,H5:!0,H6:!0,HR:!0,I:!0,IMG:!0,LABEL:!0,LI:!0,OL:!0,P:!0,PRE:!0,SMALL:!0,IFRAME:!0,SPAN:!0,STRONG:!0,SUB:!0,SUP:!0,TABLE:!0,TBODY:!0,TR:!0,TD:!0,TH:!0,THEAD:!0,UL:!0,U:!0,VIDEO:!0},t={FORM:!0,"GOOGLE-SHEETS-HTML-ORIGIN":!0},r={rel:!0,class:!0,controls:!0,height:!0,href:!0,id:!0,src:!0,style:!0,target:!0,title:!0,type:!0,width:!0,frameborder:!0,allow:!0,allowfullscreen:!0},l={"background-color":!0,color:!0,"font-size":!0,float:!0,"font-weight":!0,"text-align":!0,"text-decoration":!0,width:!0},n=["http:","https:","data:","m-files:","file:","ftp:","mailto:","pw:"],a={href:!0,action:!0,target:!0},i=new DOMParser;function o(e,t){for(let r=0;r<t.length;r++)if(0==e.indexOf(t[r]))return!0;return!1}this.SanitizeHtml=function(s,d){if(""==(s=s.trim()))return"";if("<br>"==s)return"";-1==s.indexOf("<body")&&(s="<body>"+s+"</body>");let m=i.parseFromString(s,"text/html");"BODY"!==m.body.tagName&&m.body.remove(),"function"!=typeof m.createElement&&m.createElement.remove();let c=function i(s){let c;if(s.nodeType==Node.TEXT_NODE)c=s.cloneNode(!0);else if(s.nodeType==Node.ELEMENT_NODE&&(e[s.tagName]||t[s.tagName]||d&&s.matches(d))){c=t[s.tagName]?m.createElement("DIV"):m.createElement(s.tagName);for(let e=0;e<s.attributes.length;e++){let t=s.attributes[e];if(r[t.name])if("style"==t.name)for(let e=0;e<s.style.length;e++){let t=s.style[e];l[t]&&c.style.setProperty(t,s.style.getPropertyValue(t))}else{if(a[t.name]&&t.value.indexOf(":")>-1&&!o(t.value,n))continue;c.setAttribute(t.name,t.value)}}for(let e=0;e<s.childNodes.length;e++){let t=i(s.childNodes[e]);c.appendChild(t,!1)}if(("SPAN"==c.tagName||"B"==c.tagName||"I"==c.tagName||"U"==c.tagName)&&""==c.innerHTML.trim())return m.createDocumentFragment()}else c=m.createDocumentFragment();return c}(m.body);return c.innerHTML.replace(/<br[^>]*>(\S)/g,"<br>\n$1").replace(/div><div/g,"div>\n<div")},this.AllowedTags=e,this.AllowedAttributes=r,this.AllowedCssStyles=l,this.AllowedSchemas=n};