/* ! * Tiny PowerPaste plugin * * Copyright (c) 2023 Ephox Corporation DBA Tiny Technologies, Inc. * Licensed under the Tiny commercial license. See https://www.tiny.cloud/legal/ * * Version: 6.2.2-625 */ !function(){"use strict";const e=e=>t=>(e=>{const t=typeof e;return null===e?"null":"object"===t&&Array.isArray(e)?"array":"object"===t&&((e,t,n)=>{var r,o;return o=e,!!t.prototype.isPrototypeOf(o)||(null===(r=e.constructor)||void 0===r?void 0:r.name)===t.name})(e,String)?"string":t})(t)===e,t=e=>t=>typeof t===e,n=e("string"),r=e("object"),o=e("array"),s=t("boolean"),a=(void 0,e=>undefined===e);const i=e=>null==e,l=e=>!i(e),c=t("function"),u=t("number"),d=()=>{},h=(e,t)=>(...n)=>e(t.apply(null,n)),m=e=>()=>e,p=e=>e,f=(e,t)=>e===t;function g(e,...t){return(...n)=>{const r=t.concat(n);return e.apply(null,r)}}const v=e=>()=>{throw new Error(e)},y=e=>e(),b=m(!1),x=m(!0);class k{constructor(e,t){this.tag=e,this.value=t}static some(e){return new k(!0,e)}static none(){return k.singletonNone}fold(e,t){return this.tag?t(this.value):e()}isSome(){return this.tag}isNone(){return!this.tag}map(e){return this.tag?k.some(e(this.value)):k.none()}bind(e){return this.tag?e(this.value):k.none()}exists(e){return this.tag&&e(this.value)}forall(e){return!this.tag||e(this.value)}filter(e){return!this.tag||e(this.value)?this:k.none()}getOr(e){return this.tag?this.value:e}or(e){return this.tag?this:e}getOrThunk(e){return this.tag?this.value:e()}orThunk(e){return this.tag?this:e()}getOrDie(e){if(this.tag)return this.value;throw new Error(null!=e?e:"Called getOrDie on None")}static from(e){return l(e)?k.some(e):k.none()}getOrNull(){return this.tag?this.value:null}getOrUndefined(){return this.value}each(e){this.tag&&e(this.value)}toArray(){return this.tag?[this.value]:[]}toString(){return this.tag?`some(${this.value})`:"none()"}}k.singletonNone=new k(!1);const w=Array.prototype.slice,S=Array.prototype.indexOf,C=Array.prototype.push,T=(e,t)=>((e,t)=>S.call(e,t))(e,t)>-1,I=(e,t)=>{for(let n=0,r=e.length;n{const n=e.length,r=new Array(n);for(let o=0;o{for(let n=0,r=e.length;n{const n=[],r=[];for(let o=0,s=e.length;o{const n=[];for(let r=0,o=e.length;r(O(e,((e,r)=>{n=t(n,e,r)})),n),_=(e,t)=>((e,t,n)=>{for(let r=0,o=e.length;r{for(let n=0,r=e.length;n{const t=[];for(let n=0,r=e.length;nP(A(e,t)),M=(e,t)=>{for(let n=0,r=e.length;n{const n={};for(let r=0,o=e.length;r((e,t)=>0{for(let n=0;n""===t||e.length>=t.length&&e.substr(n,n+t.length)===t,z=(e,t)=>W(e,t)?((e,t)=>e.substring(t))(e,t.length):e,H=(e,t,n=0,r)=>{const o=e.indexOf(t,n);return-1!==o&&(!!a(r)||o+t.length<=r)},W=(e,t)=>B(e,t,0),$=(e,t)=>B(e,t,e.length-t.length),V=(G=/^\s+|\s+$/g,e=>e.replace(G,""));var G;const q=e=>parseInt(e,10),K=(e,t)=>{const n=e-t;return 0===n?0:n>0?1:-1},J=(e,t,n)=>({major:e,minor:t,patch:n}),Y=e=>{const t=/([0-9]+)\.([0-9]+)\.([0-9]+)(?:(\-.+)?)/.exec(e);return t?J(q(t[1]),q(t[2]),q(t[3])):J(0,0,0)},X=e=>t=>t.options.get(e),Z=X("paste_as_text"),Q=X("paste_merge_formats"),ee=X("paste_tab_spaces"),te=X("smart_paste"),ne=X("cache_suffix"),re=X("automatic_uploads"),oe=X("indent_use_margin"),se=X("powerpaste_block_drop"),ae=X("powerpaste_keep_unsupported_src"),ie=X("powerpaste_allow_local_images"),le=X("powerpaste_word_import"),ce=X("powerpaste_googledocs_import"),ue=X("powerpaste_html_import"),de=X("powerpaste_clean_filtered_inline_elements"),he=X("link_default_protocol"),me=e=>{var t;return tinymce.explode(null!==(t=e.options.get("images_file_types"))&&void 0!==t?t:"")},pe=e=>{let t=e;return{get:()=>t,set:e=>{t=e}}},fe=()=>{const e=(e=>{const t=pe(k.none()),n=()=>t.get().each(e);return{clear:()=>{n(),t.set(k.none())},isSet:()=>t.get().isSome(),get:()=>t.get(),set:e=>{n(),t.set(k.some(e))}}})(d);return{...e,on:t=>e.get().each(t)}},ge=(e,t)=>{const n=t=>e(t)?k.from(t.dom.nodeValue):k.none();return{get:r=>{if(!e(r))throw new Error("Can only get "+t+" value of a "+t+" node");return n(r).getOr("")},getOption:n,set:(n,r)=>{if(!e(n))throw new Error("Can only set raw "+t+" value of a "+t+" node");n.dom.nodeValue=r}}},ve="undefined"!=typeof window?window:Function("return this;")(),ye=(e,t)=>(void 0!==e[t]&&null!==e[t]||(e[t]={}),e[t]),be=(e,t)=>((e,t)=>{let n=void 0!==t?t:ve;for(let t=0;te.dom.nodeName.toLowerCase(),ke=e=>e.dom.nodeType,we=e=>t=>ke(t)===e,Se=e=>8===ke(e)||"#comment"===xe(e),Ce=we(1),Te=we(3),Ie=we(9),Ae=we(11),Oe=e=>t=>Ce(t)&&xe(t)===e,Ee=ge(Se,"comment"),Le=e=>Ee.get(e),Ne=e=>{if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}},_e={fromHtml:(e,t)=>{const n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1){const t="HTML does not have a single root node";throw console.error(t,e),new Error(t)}return Ne(n.childNodes[0])},fromTag:(e,t)=>{const n=(t||document).createElement(e);return Ne(n)},fromText:(e,t)=>{const n=(t||document).createTextNode(e);return Ne(n)},fromDom:Ne,fromPoint:(e,t,n)=>k.from(e.dom.elementFromPoint(t,n)).map(Ne)},De=Object.keys,Pe=Object.hasOwnProperty,Re=(e,t)=>{const n=De(e);for(let r=0,o=n.length;rje(e,((e,n)=>({k:n,v:t(e,n)}))),je=(e,t)=>{const n={};return Re(e,((e,r)=>{const o=t(e,r);n[o.k]=o.v})),n},Fe=(e,t)=>{const n={};return((e,t,n,r)=>{Re(e,((e,o)=>{(t(e,o)?n:r)(e,o)}))})(e,t,(e=>(t,n)=>{e[n]=t})(n),d),n},Ue=e=>De(e).length,Be=(e,t)=>Pe.call(e,t),ze=e=>{let t,n=!1;return(...r)=>(n||(n=!0,t=e.apply(null,r)),t)},He=()=>We(0,0),We=(e,t)=>({major:e,minor:t}),$e={nu:We,detect:(e,t)=>{const n=String(t).toLowerCase();return 0===e.length?He():((e,t)=>{const n=((e,t)=>{for(let n=0;nNumber(t.replace(n,"$"+e));return We(r(1),r(2))})(e,n)},unknown:He},Ve=(e,t)=>{const n=String(t).toLowerCase();return _(e,(e=>e.search(n)))},Ge=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,qe=e=>t=>H(t,e),Ke=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:e=>H(e,"edge/")&&H(e,"chrome")&&H(e,"safari")&&H(e,"applewebkit")},{name:"Chromium",brand:"Chromium",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ge],search:e=>H(e,"chrome")&&!H(e,"chromeframe")},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:e=>H(e,"msie")||H(e,"trident")},{name:"Opera",versionRegexes:[Ge,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:qe("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:qe("firefox")},{name:"Safari",versionRegexes:[Ge,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:e=>(H(e,"safari")||H(e,"mobile/"))&&H(e,"applewebkit")}],Je=[{name:"Windows",search:qe("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:e=>H(e,"iphone")||H(e,"ipad"),versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:qe("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"macOS",search:qe("mac os x"),versionRegexes:[/.*?mac\ os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:qe("linux"),versionRegexes:[]},{name:"Solaris",search:qe("sunos"),versionRegexes:[]},{name:"FreeBSD",search:qe("freebsd"),versionRegexes:[]},{name:"ChromeOS",search:qe("cros"),versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/]}],Ye={browsers:m(Ke),oses:m(Je)},Xe="Edge",Ze="Chromium",Qe="Opera",et="Firefox",tt="Safari",nt=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isEdge:r(Xe),isChromium:r(Ze),isIE:r("IE"),isOpera:r(Qe),isFirefox:r(et),isSafari:r(tt)}},rt=()=>nt({current:void 0,version:$e.unknown()}),ot=nt,st=(m(Xe),m(Ze),m("IE"),m(Qe),m(et),m(tt),"Windows"),at="Android",it="Linux",lt="macOS",ct="Solaris",ut="FreeBSD",dt="ChromeOS",ht=e=>{const t=e.current,n=e.version,r=e=>()=>t===e;return{current:t,version:n,isWindows:r(st),isiOS:r("iOS"),isAndroid:r(at),isMacOS:r(lt),isLinux:r(it),isSolaris:r(ct),isFreeBSD:r(ut),isChromeOS:r(dt)}},mt=()=>ht({current:void 0,version:$e.unknown()}),pt=ht,ft=(m(st),m("iOS"),m(at),m(it),m(lt),m(ct),m(ut),m(dt),e=>window.matchMedia(e).matches);let gt=ze((()=>((e,t,n)=>{const r=Ye.browsers(),o=Ye.oses(),s=t.bind((e=>((e,t)=>U(t.brands,(t=>{const n=t.brand.toLowerCase();return _(e,(e=>{var t;return n===(null===(t=e.brand)||void 0===t?void 0:t.toLowerCase())})).map((e=>({current:e.name,version:$e.nu(parseInt(t.version,10),0)})))})))(r,e))).orThunk((()=>((e,t)=>Ve(e,t).map((e=>{const n=$e.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(r,e))).fold(rt,ot),a=((e,t)=>Ve(e,t).map((e=>{const n=$e.detect(e.versionRegexes,t);return{current:e.name,version:n}})))(o,e).fold(mt,pt),i=((e,t,n,r)=>{const o=e.isiOS()&&!0===/ipad/i.test(n),s=e.isiOS()&&!o,a=e.isiOS()||e.isAndroid(),i=a||r("(pointer:coarse)"),l=o||!s&&a&&r("(min-device-width:768px)"),c=s||a&&!l,u=t.isSafari()&&e.isiOS()&&!1===/safari/i.test(n),d=!c&&!l&&!u;return{isiPad:m(o),isiPhone:m(s),isTablet:m(l),isPhone:m(c),isTouch:m(i),isAndroid:e.isAndroid,isiOS:e.isiOS,isWebView:m(u),isDesktop:m(d)}})(a,s,e,n);return{browser:s,os:a,deviceType:i}})(navigator.userAgent,k.from(navigator.userAgentData),ft)));const vt=()=>gt(),yt=vt(),bt=yt.deviceType.isiOS()||yt.deviceType.isAndroid(),xt=m({isSupported:!1,cleanDocument:()=>Promise.reject("not supported")});var kt=bt?xt:(e,t,n)=>{const r=t+"/wordimport.js"+(e=>k.from(e).filter((e=>0!==e.length)).map((e=>(-1===e.indexOf("?")?"?":"")+e)).getOr(""))(n||"v=9.2.1"),o=e.loadScript("ephox.wimp",r);return o.catch((e=>{console.error("Unable to load word import: ",e)})),{isSupported:!0,cleanDocument:(e,t,n)=>o.then((r=>r.cleanDocument(e,t,n.cleanFilteredInlineElements)))}};const wt=e=>{let t=[];return{bind:e=>{if(void 0===e)throw new Error("Event bind error: undefined handler");t.push(e)},unbind:e=>{t=L(t,(t=>t!==e))},trigger:(...n)=>{const r={};O(e,((e,t)=>{r[e]=n[t]})),O(t,(e=>{e(r)}))}}},St=e=>{const t=Me(e,(e=>({bind:e.bind,unbind:e.unbind}))),n=Me(e,(e=>e.trigger));return{registry:t,trigger:n}},Ct=(e,t)=>{const n=e.dom;if(1!==n.nodeType)return!1;{const e=n;if(void 0!==e.matches)return e.matches(t);if(void 0!==e.msMatchesSelector)return e.msMatchesSelector(t);if(void 0!==e.webkitMatchesSelector)return e.webkitMatchesSelector(t);if(void 0!==e.mozMatchesSelector)return e.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")}},Tt=(e,t)=>{const n=void 0===t?document:t.dom;return 1!==(r=n).nodeType&&9!==r.nodeType&&11!==r.nodeType||0===r.childElementCount?[]:A(n.querySelectorAll(e),_e.fromDom);var r},It=(e,t)=>e.dom===t.dom,At=Ct,Ot=(e,t,n)=>{const r=e.document.createRange();var o;return o=r,t.fold((e=>{o.setStartBefore(e.dom)}),((e,t)=>{o.setStart(e.dom,t)}),(e=>{o.setStartAfter(e.dom)})),((e,t)=>{t.fold((t=>{e.setEndBefore(t.dom)}),((t,n)=>{e.setEnd(t.dom,n)}),(t=>{e.setEndAfter(t.dom)}))})(r,n),r},Et=(e,t,n,r,o)=>{const s=e.document.createRange();return s.setStart(t.dom,n),s.setEnd(r.dom,o),s},Lt=e=>{if(!o(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");const t=[],n={};return O(e,((r,s)=>{const a=De(r);if(1!==a.length)throw new Error("one and only one name per case");const i=a[0],l=r[i];if(void 0!==n[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!o(l))throw new Error("case arguments must be an array");t.push(i),n[i]=(...n)=>{const r=n.length;if(r!==l.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+l.length+" ("+l+"), got "+r);return{fold:(...t)=>{if(t.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+t.length);return t[s].apply(null,n)},match:e=>{const r=De(e);if(t.length!==r.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+r.join(","));if(!M(t,(e=>T(r,e))))throw new Error("Not all branches were specified when using match. Specified: "+r.join(", ")+"\nRequired: "+t.join(", "));return e[i].apply(null,n)},log:e=>{console.log(e,{constructors:t,constructor:i,params:n})}}}})),n},Nt=Lt([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),_t=(e,t,n)=>t(_e.fromDom(n.startContainer),n.startOffset,_e.fromDom(n.endContainer),n.endOffset);Nt.ltr,Nt.rtl;const Dt=(e,t,n,r)=>({start:e,soffset:t,finish:n,foffset:r}),Pt=e=>_e.fromDom(e.dom.ownerDocument),Rt=e=>Ie(e)?e:Pt(e),Mt=e=>_e.fromDom(Rt(e).dom.defaultView),jt=e=>k.from(e.dom.parentNode).map(_e.fromDom),Ft=e=>k.from(e.dom.previousSibling).map(_e.fromDom),Ut=e=>k.from(e.dom.nextSibling).map(_e.fromDom),Bt=e=>(e=>{const t=w.call(e,0);return t.reverse(),t})(((e,t)=>{const n=[],r=e=>(n.push(e),t(e));let o=t(e);do{o=o.bind(r)}while(o.isSome());return n})(e,Ft)),zt=e=>A(e.dom.childNodes,_e.fromDom),Ht=c(Element.prototype.attachShadow)&&c(Node.prototype.getRootNode),Wt=m(Ht),$t=Ht?e=>_e.fromDom(e.dom.getRootNode()):Rt,Vt=e=>_e.fromDom(e.dom.host),Gt=e=>{const t=Te(e)?e.dom.parentNode:e.dom;if(null==t||null===t.ownerDocument)return!1;const n=t.ownerDocument;return(e=>{const t=$t(e);return Ae(n=t)&&l(n.dom.host)?k.some(t):k.none();var n})(_e.fromDom(t)).fold((()=>n.body.contains(t)),(r=Gt,o=Vt,e=>r(o(e))));var r,o},qt=(e,t)=>{let n=[];return O(zt(e),(e=>{t(e)&&(n=n.concat([e])),n=n.concat(qt(e,t))})),n},Kt=(e,t)=>Tt(t,e),Jt=Lt([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Yt={before:Jt.before,on:Jt.on,after:Jt.after,cata:(e,t,n,r)=>e.fold(t,n,r),getStart:e=>e.fold(p,p,p)},Xt=Lt([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Zt={domRange:Xt.domRange,relative:Xt.relative,exact:Xt.exact,exactFromRange:e=>Xt.exact(e.start,e.soffset,e.finish,e.foffset),getWin:e=>{const t=(e=>e.match({domRange:e=>_e.fromDom(e.startContainer),relative:(e,t)=>Yt.getStart(e),exact:(e,t,n,r)=>e}))(e);return Mt(t)},range:Dt},Qt=(e,t)=>{const n=xe(e);return"input"===n?Yt.after(e):T(["br","img"],n)?0===t?Yt.before(e):Yt.after(e):Yt.on(e,t)},en=(e,t,n,r)=>{const o=Pt(e).dom.createRange();return o.setStart(e.dom,t),o.setEnd(n.dom,r),o},tn=e=>k.from(e.getSelection()),nn=(e,t,n,r,o)=>{((e,t)=>{tn(e).each((e=>{e.removeAllRanges(),e.addRange(t)}))})(e,Et(e,t,n,r,o))},rn=(e,t,n,r,o)=>{const s=((e,t,n,r)=>{const o=Qt(e,t),s=Qt(n,r);return Zt.relative(o,s)})(t,n,r,o);((e,t)=>{((e,t)=>{const n=((e,t)=>t.match({domRange:e=>({ltr:m(e),rtl:k.none}),relative:(t,n)=>({ltr:ze((()=>Ot(e,t,n))),rtl:ze((()=>k.some(Ot(e,n,t))))}),exact:(t,n,r,o)=>({ltr:ze((()=>Et(e,t,n,r,o))),rtl:ze((()=>k.some(Et(e,r,o,t,n))))})}))(e,t);return((e,t)=>{const n=t.ltr();return n.collapsed?t.rtl().filter((e=>!1===e.collapsed)).map((e=>Nt.rtl(_e.fromDom(e.endContainer),e.endOffset,_e.fromDom(e.startContainer),e.startOffset))).getOrThunk((()=>_t(0,Nt.ltr,n))):_t(0,Nt.ltr,n)})(0,n)})(e,t).match({ltr:(t,n,r,o)=>{nn(e,t,n,r,o)},rtl:(t,n,r,o)=>{tn(e).each((s=>{if(s.setBaseAndExtent)s.setBaseAndExtent(t.dom,n,r.dom,o);else if(s.extend)try{((e,t,n,r,o,s)=>{t.collapse(n.dom,r),t.extend(o.dom,s)})(0,s,t,n,r,o)}catch(s){nn(e,r,o,t,n)}else nn(e,r,o,t,n)}))}})})(e,s)},on=e=>{if(e.rangeCount>0){const t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return k.some(Dt(_e.fromDom(t.startContainer),t.startOffset,_e.fromDom(n.endContainer),n.endOffset))}return k.none()},sn=e=>{if(null===e.anchorNode||null===e.focusNode)return on(e);{const t=_e.fromDom(e.anchorNode),n=_e.fromDom(e.focusNode);return((e,t,n,r)=>{const o=en(e,t,n,r),s=It(e,n)&&t===r;return o.collapsed&&!s})(t,e.anchorOffset,n,e.focusOffset)?k.some(Dt(t,e.anchorOffset,n,e.focusOffset)):on(e)}},an=e=>tn(e).filter((e=>e.rangeCount>0)).bind(sn),ln=(e,t)=>{jt(e).each((n=>{n.dom.insertBefore(t.dom,e.dom)}))},cn=(e,t)=>{Ut(e).fold((()=>{jt(e).each((e=>{dn(e,t)}))}),(e=>{ln(e,t)}))},un=(e,t)=>{(e=>((e,t)=>{const n=e.dom.childNodes;return k.from(n[0]).map(_e.fromDom)})(e))(e).fold((()=>{dn(e,t)}),(n=>{e.dom.insertBefore(t.dom,n.dom)}))},dn=(e,t)=>{e.dom.appendChild(t.dom)},hn=(e,t)=>{ln(e,t),dn(t,e)},mn=(e,t)=>{O(t,((n,r)=>{const o=0===r?e:t[r-1];cn(o,n)}))},pn=(e,t)=>{O(t,(t=>{dn(e,t)}))},fn=e=>{e.dom.textContent="",O(zt(e),(e=>{gn(e)}))},gn=e=>{const t=e.dom;null!==t.parentNode&&t.parentNode.removeChild(t)},vn=e=>{const t=zt(e);t.length>0&&mn(e,t),gn(e)},yn=(e,t,n,r)=>{const o=It(e,n)&&t===r;return{startContainer:m(e),startOffset:m(t),endContainer:m(n),endOffset:m(r),collapsed:m(o)}};let bn=0;const xn=e=>{const t=(new Date).getTime(),n=Math.floor(1e9*Math.random());return bn++,e+"_"+n+bn+String(t)},kn=(e,t,r)=>{if(!(n(r)||s(r)||u(r)))throw console.error("Invalid call to Attribute.set. Key ",t,":: Value ",r,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,r+"")},wn=(e,t,n)=>{kn(e.dom,t,n)},Sn=(e,t)=>{const n=e.dom;Re(t,((e,t)=>{kn(n,t,e)}))},Cn=(e,t)=>{const n=e.dom.getAttribute(t);return null===n?void 0:n},Tn=(e,t)=>k.from(Cn(e,t)),In=(e,t)=>{const n=e.dom;return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},An=(e,t)=>{e.dom.removeAttribute(t)},On=(e,t)=>{const n=Cn(e,t);return void 0===n||""===n?[]:n.split(" ")},En=e=>void 0!==e.dom.classList,Ln=e=>On(e,"class"),Nn=(e,t)=>{En(e)?e.dom.classList.add(t):((e,t)=>{((e,t,n)=>{const r=On(e,t).concat([n]);wn(e,t,r.join(" "))})(e,"class",t)})(e,t)},_n=(e,t)=>{En(e)?e.dom.classList.remove(t):((e,t)=>{((e,t,n)=>{const r=L(On(e,t),(e=>e!==n));r.length>0?wn(e,t,r.join(" ")):An(e,t)})(e,"class",t)})(e,t),(e=>{0===(En(e)?e.dom.classList:Ln(e)).length&&An(e,"class")})(e)},Dn=(e,t)=>En(e)&&e.dom.classList.contains(t),Pn=(e,t,n=f)=>e.exists((e=>n(e,t))),Rn=(e,t)=>e?k.some(t):k.none(),Mn=e=>void 0!==e.style&&c(e.style.getPropertyValue),jn=(e,t,r)=>{if(!n(r))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",r,":: Element ",e),new Error("CSS value must be a string: "+r);Mn(e)&&e.style.setProperty(t,r)},Fn=(e,t)=>{Mn(e)&&e.style.removeProperty(t)},Un=(e,t,n)=>{const r=e.dom;jn(r,t,n)},Bn=(e,t)=>{const n=e.dom;Re(t,((e,t)=>{jn(n,t,e)}))},zn=(e,t)=>{const n=e.dom,r=window.getComputedStyle(n).getPropertyValue(t);return""!==r||Gt(e)?r:Hn(n,t)},Hn=(e,t)=>Mn(e)?e.style.getPropertyValue(t):"",Wn=(e,t)=>{const n=e.dom,r=Hn(n,t);return k.from(r).filter((e=>e.length>0))},$n=e=>{const t={},n=e.dom;if(Mn(n))for(let e=0;e{const n=e.dom;Fn(n,t),Pn(Tn(e,"style").map(V),"")&&An(e,"style")},Gn=e=>"rtl"===zn(e,"direction")?"rtl":"ltr",qn=(e,t)=>{const n=(t||document).createElement("div");return n.innerHTML=e,zt(_e.fromDom(n))},Kn=e=>e.dom.innerHTML,Jn=(e,t,n)=>{let r=e.dom;const o=c(n)?n:b;for(;r.parentNode;){r=r.parentNode;const e=_e.fromDom(r);if(t(e))return k.some(e);if(o(e))break}return k.none()},Yn=(e,t)=>_(e.dom.childNodes,(e=>t(_e.fromDom(e)))).map(_e.fromDom),Xn=(e,t)=>{const n=e=>{for(let r=0;rJn(e,(e=>Ct(e,t)),n),Qn=(e,t,n)=>((e,t,n,r,o)=>((e,t)=>Ct(e,t))(n,r)?k.some(n):c(o)&&o(n)?k.none():t(n,r,o))(0,Zn,e,t,n),er=e=>{const t=tr(e);return{resolve:e=>{const n=e.split(" ");return A(n,(e=>nr(t,e))).join(" ")}}},tr=e=>e.replace(/\./g,"-"),nr=(e,t)=>e+"-"+t,rr=er("ephox-sloth").resolve,or=m(rr("bin")),sr=["b","i","u","sub","sup","strike"],ar=or(),ir=ar+xn(""),lr=("-100000px","100000px",e=>"rtl"===Gn(e)?"100000px":"-100000px");const cr=(e,t)=>{const n=_e.fromTag("div");var r;Sn(n,t),Sn(n,{contenteditable:"true","aria-hidden":"true"}),Bn(n,{position:"fixed",top:"0px",width:"100px",height:"100px",overflow:"hidden",opacity:"0"}),r=n,O([ar,ir],(e=>{Nn(r,e)}));const o=e=>Dn(e,ir);return{attach:e=>{fn(n),Un(n,"left",lr(e)),dn(e,n)},focus:()=>{Zn(n,"body").each((t=>{e.toOff(t,n)}))},contents:()=>(((e,t)=>{Ut(e).filter(t).each((t=>{const n=zt(t);pn(e,n),gn(t)})),((e,t)=>{const n=zt(e);O(n,(e=>{t(e)&&((e,t)=>{const n=zt(e),r=_e.fromTag("div",Pt(e).dom);pn(r,n),ln(e,r),gn(e)})(e)}))})(e,t),O(zt(e),(e=>{(e=>Ce(e)&&!e.dom.hasChildNodes()&&T(sr,xe(e)))(e)&&gn(e)}))})(n,o),{elements:zt(n),html:Kn(n),offscreen:n}),container:m(n),detach:()=>{gn(n)}}},ur=e=>{const t=It(e.start,e.finish)&&e.soffset===e.foffset;return{startContainer:m(e.start),startOffset:m(e.soffset),endContainer:m(e.finish),endOffset:m(e.foffset),collapsed:m(t)}},dr={set:(e,t)=>{rn(e,t.startContainer(),t.startOffset(),t.endContainer(),t.endOffset())},get:e=>an(e).map(ur)};var hr=e=>t=>{const n=St({after:wt(["container"])}),r=(e=>{const t=_e.fromTag("br");let n=k.none();const r=e=>Mt(e).dom;return{cleanup:()=>{gn(t)},toOn:(t,o)=>{const s=r(o);n.each((n=>{const r=(e=>e.dom.childNodes.length)(t),o=It(t,n.startContainer())&&r{const a=r(s);dn(s,t),n=e.get(a),e.set(a,yn(t,0,t,0))}}})(dr),o=((e,t,n)=>{const r=cr(e,n),o=()=>{e.cleanup();const t=r.contents();r.detach(),s.trigger.after(t.elements,t.html,r.container())},s=St({before:wt([]),after:wt(["elements","html","container"])}),a=d;return{instance:m((()=>{s.trigger.before(),r.attach(t),r.focus(),((e,t)=>{((e,t)=>{setTimeout(t,1)})(0,t)})(Pt(t),o)})),destroy:a,events:s.registry}})(r,t,e);return o.events.after.bind((e=>{r.toOn(t,e.container),n.trigger.after(e.container)})),{run:()=>{o.instance()()},events:n.registry}};const mr=er("ephox-cement").resolve,pr={cacheSuffix:"",pasteBinAttrs:{},keepSrc:!1,sanitizer:{sanitizeHtml:m(""),sanitizeText:m("")},tabSpaces:4,cleanFilteredInlineElements:[],indentUseMargin:!1,defaultProtocol:"https"},fr=m(mr("smartpaste-eph-bin")),gr=e=>{let t=k.none(),n=[];const r=e=>{o()?s(e):n.push(e)},o=()=>t.isSome(),s=e=>{t.each((t=>{setTimeout((()=>{e(t)}),0)}))};return e((e=>{o()||(t=k.some(e),O(n,s),n=[])})),{get:r,map:e=>gr((t=>{r((n=>{t(e(n))}))})),isReady:o}},vr={nu:gr,pure:e=>gr((t=>{t(e)}))},yr=e=>{setTimeout((()=>{throw e}),0)},br=e=>{const t=t=>{e().then(t,yr)};return{map:t=>br((()=>e().then(t))),bind:t=>br((()=>e().then((e=>t(e).toPromise())))),anonBind:t=>br((()=>e().then((()=>t.toPromise())))),toLazy:()=>vr.nu(t),toCached:()=>{let t=null;return br((()=>(null===t&&(t=e()),t)))},toPromise:e,get:t}},xr=e=>br((()=>new Promise(e))),kr=e=>((e,t)=>t((t=>{const n=[];let r=0;0===e.length?t([]):O(e,((o,s)=>{o.get((o=>s=>{n[o]=s,r++,r>=e.length&&t(n)})(s))}))})))(e,xr),wr=()=>{const e={};return{getOrSetIndexed:(t,n)=>(t=>void 0!==e[t])(t)?e[t]:((t,n)=>(e[t]=n,n))(t,n()),waitForLoad:()=>{const t=((e,t)=>{const n=[];return Re(e,((e,r)=>{n.push(t(e,r))})),n})(e,p);return kr(t)}}},Sr=e=>{const t=t=>t(e),n=m(e),r=()=>o,o={tag:!0,inner:e,fold:(t,n)=>n(e),isValue:x,isError:b,map:t=>Tr.value(t(e)),mapError:r,bind:t,exists:t,forall:t,getOr:n,or:r,getOrThunk:n,orThunk:r,getOrDie:n,each:t=>{t(e)},toOptional:()=>k.some(e)};return o},Cr=e=>{const t=()=>n,n={tag:!1,inner:e,fold:(t,n)=>t(e),isValue:b,isError:x,map:t,mapError:t=>Tr.error(t(e)),bind:t,exists:b,forall:x,getOr:p,or:p,getOrThunk:y,orThunk:y,getOrDie:v(String(e)),each:d,toOptional:k.none};return n},Tr={value:Sr,error:Cr,fromOption:(e,t)=>e.fold((()=>Cr(t)),Sr)},Ir=e=>{const t=_e.fromDom((e=>{if(Wt()&&l(e.target)){const t=_e.fromDom(e.target);if(Ce(t)&&l(t.dom.shadowRoot)&&e.composed&&e.composedPath){const t=e.composedPath();if(t)return F(t)}}return k.from(e.target)})(e).getOr(e.target)),n=()=>e.stopPropagation(),r=()=>e.preventDefault(),o=h(r,n);return((e,t,n,r,o,s,a)=>({target:e,x:t,y:n,stop:r,prevent:o,kill:s,raw:a}))(t,e.clientX,e.clientY,n,r,o,e)},Ar=(e,t,n,r)=>{e.dom.removeEventListener(t,n,r)},Or=x,Er=(e,t,n)=>((e,t,n,r)=>((e,t,n,r,o)=>{const s=((e,t)=>n=>{e(n)&&t(Ir(n))})(n,r);return e.dom.addEventListener(t,s,o),{unbind:g(Ar,e,t,s,o)}})(e,t,n,r,!1))(e,t,Or,n),Lr=(e=>{const t=g(be,e);be("callbacks",t());const n=(n,o)=>{const s=t(),a=(e=>{const t=void 0===e.count?0:e.count,n="callback_"+t;return e.count=t+1,n})(s);return s.callbacks[a]=(...e)=>{o||r(a),n(...e)},(t=>e+".callbacks."+t)(a)},r=e=>{const n=e.substring(e.lastIndexOf(".")+1),r=t();void 0!==r.callbacks[n]&&delete r.callbacks[n]};return{ephemeral:e=>n(e,!1),permanent:e=>n(e,!0),unregister:r}})("ephox.henchman.features"),Nr=(e,t)=>vr.nu((n=>{const o=t=>{O(a,(e=>{e.unbind()})),n(t.fold((t=>Tr.error(t+'Unable to download editor stylesheets from "'+e+'"')),Tr.value))},s=((e,t)=>{const n=_e.fromDom(document),r=_e.fromTag("link",n.dom);return Sn(r,{rel:"stylesheet",type:"text/css",href:e}),((e,t)=>{const n=(e=>{const t=e.dom.head;if(null==t)throw new Error("Head is not available yet");return _e.fromDom(t)})(e);dn(n,t)})(n,r),r})(e),a=[Er(s,"load",(e=>{(e=>{var t;try{const n=null===(t=e.target.dom.sheet)||void 0===t?void 0:t.cssRules;return r(n)&&0===n.length}catch(e){}return!1})(e)?o(Tr.error("")):t(o)})),Er(s,"error",g(o,Tr.error("")))]})),_r=(()=>{const e=wr(),t=()=>e.waitForLoad();return{preload:()=>{t().get(p)},addStylesheet:(t,n)=>e.getOrSetIndexed(t,(()=>Nr(t,n))),addScript:(t,n)=>e.getOrSetIndexed(t,(()=>(e=>vr.nu((t=>{const n=()=>{o.unbind(),s.unbind()},r=_e.fromTag("script");wn(r,"src",e),wn(r,"type","text/javascript"),wn(r,"async","async"),wn(r,"data-main",Lr.ephemeral((e=>{t(Tr.value(e))})));const o=Er(r,"error",(()=>{n(),t(Tr.error("Error loading external script tag "+e))})),s=Er(r,"load",n);dn(_e.fromDom(document.head),r)})))(t).map(n))),waitForLoad:t}})(),Dr={loadScript:(e,t)=>new Promise(((e,n)=>{((e,t)=>_r.addScript(e,t))(t,p).get((t=>{t.fold(n,e)}))}))},Pr=Lt([{error:["message"]},{paste:["elements","correlated"]},{cancel:[]},{incomplete:["elements","correlated","message"]}]),Rr=(e,t,n,r,o)=>e.fold(t,n,r,o),Mr=Pr.error,jr=Pr.paste,Fr=Pr.cancel,Ur=Pr.incomplete,Br=["officeStyles","htmlStyles","gdocsStyles","isWord","isGoogleDocs","proxyBin","isInternal"],zr=(e,t)=>{const n={};return O(Br,(r=>{t[r].or(e[r]).each((e=>{n[r]=e}))})),Hr(n)},Hr=e=>j(Br,(t=>k.from(e[t]))),Wr=e=>({response:Mr(e),bundle:Hr({})}),$r=e=>Promise.resolve(Wr(e)),Vr={response:Fr(),bundle:Hr({})},Gr=e=>l(e.then),qr=(e,t,n,r)=>({steps:e,input:t,label:n,capture:r}),Kr=(e,t)=>{const n=zr(e.bundle,t.bundle),r=((e,t)=>Rr(e,k.none,k.none,k.none,((e,n,r)=>Rr(t,k.none,((e,t)=>k.some(Pr.incomplete(e,t,r))),k.none,k.none))).getOr(t))(e.response,t.response);return{response:r,bundle:n}},Jr=(e,t,n)=>{const r=()=>e,o=()=>{const r=n(t,e);return Gr(r)?r.then((t=>Kr(e,t))):Kr(e,r)};return Rr(e.response,r,o,r,o)},Yr=(Xr=(e,t)=>t,(...e)=>{if(0===e.length)throw new Error("Can't merge zero objects");const t={};for(let n=0;ne.fold(((e,n)=>0===n(t).indexOf(n(e))),((e,n)=>e.test(n(t))),((e,n)=>n(t).indexOf(n(e))>=0),((e,n)=>n(t)===n(e)),x,(e=>!eo(e,t))),to={starts:Zr.starts,pattern:Zr.pattern,contains:Zr.contains,exact:Zr.exact,all:Zr.all,not:Zr.not,cata:(e,t,n,r,o,s,a)=>e.fold(t,n,r,o,s,a),matches:eo,caseSensitive:Qr,caseInsensitive:e=>e.toLowerCase()},no=(e,t)=>{const n=xe(e),r=t.name,o=void 0!==t.condition?t.condition:x;return to.matches(r,n)&&o(e)},ro=(e,t,n)=>{const r=(e=>{const t={},n=l(e)?e.split(";"):[];return O(n,(e=>{const n=e.split(":");2===n.length&&(t[V(n[0])]=V(n[1]))})),t})(e.dom.getAttribute("style")),o={};return O(t,(e=>{const t=r[e];void 0===t||n(t,e)||(o[e]=t)})),o},oo=e=>{const t=De(e);return A(t,(t=>t+": "+e[t])).join("; ")},so=["mso-list"],ao=(e,t)=>{const n=ro(e,so,t),r=((e,t)=>{const n=e.dom.style,r=i(n)?[]:n,o={};return O(r,(n=>{Wn(e,n).each((e=>{t(e,n)||(o[n]=e)}))})),o})(e,t);((e,t,n)=>{wn(e,"style","");const r=Ue(t),o=Ue(n);if(0===r&&0===o)An(e,"style");else if(0===r)wn(e,"style",oo(n));else{Re(t,((t,n)=>{Un(e,n,t)}));const r=Cn(e,"style"),s=o>0?oo(n)+"; ":"";wn(e,"style",s+r)}})(e,r,n)},io=(e,t)=>{const n=((e,t)=>{const n={};return O(e.dom.attributes,(e=>{t(e.value,e.name)||(n[e.name]=e.value)})),n})(e,t);((e,t)=>{const n=A(e.dom.attributes,(e=>e.name));Ue(t)!==n.length&&((e,t,n)=>{O(t,(t=>{An(e,t)})),Re(n,((t,n)=>{wn(e,n,t)}))})(e,n,t)})(e,n)},lo=(e,t)=>{ao(_e.fromDom(e),t)},co=(e,t,n)=>{e(n,((e,r)=>I(t,(t=>((e,t,n,r)=>{const o=r.name,s=void 0!==r.condition?r.condition:x,a=void 0!==r.value?r.value:to.all();return to.matches(o,n)&&to.matches(a,t)&&s(e)})(n,e,r,t)))))},uo="startElement",ho="endElement",mo="text",po="comment",fo=(e,t,n)=>{let r,o,s;const a=_e.fromDom(e);switch(e.nodeType){case 1:t?r=ho:(r=uo,Bn(a,n||{}));const i=e;o="HTML"!==i.scopeName&&i.scopeName&&i.tagName&&i.tagName.indexOf(":")<=0?(i.scopeName+":"+i.tagName).toLowerCase():i.tagName.toLowerCase();break;case 3:r=mo,s=e.nodeValue;break;case 8:r=po,s=e.nodeValue;break;default:console.log("WARNING: Unsupported node type encountered: "+e.nodeType)}return{getNode:m(e),tag:()=>o,type:()=>r,text:()=>s}},go=(e,t,n,r)=>{const o=r.createElement(e);return Re(t,((e,t)=>{o.setAttribute(t,e+"")})),fo(o,!1,n)},vo=(e,t)=>fo(t.createElement(e),!0),yo=vo("html",window.document),bo=e=>{const t=e.createDocumentFragment();let n=t;const r=e=>{n.appendChild(e)};return{dom:t,receive:o=>{switch(o.type()){case uo:s=o.getNode().cloneNode(!1),r(s),n=s;break;case mo:(t=>{const n=e.createTextNode(t.text());r(n)})(o);break;case ho:(()=>{const e=n.parentNode;n=null===e?t:e})();break;case po:break;default:throw new Error("Unsupported token type: "+o.type())}var s},label:"SERIALISER"}},xo=e=>t=>{((e,t)=>{const n=Yr({styles:[],attributes:[],classes:[],tags:[]},t),r=Kt(e,"*");O(r,(e=>{co(ao,n.styles,e),co(io,n.attributes,e),O(n.classes,(t=>{const n=In(e,"class")?(e=>En(e)?(e=>{const t=e.dom.classList,n=new Array(t.length);for(let e=0;e{to.matches(t.name,n)&&_n(e,n)}))}))}));const o=Kt(e,"*");O(o,(e=>{I(n.tags,g(no,e))&&gn(e)}))})(t,e)},ko=e=>t=>{((e,t)=>{const n=Yr({tags:[]},t),r=Kt(e,"*");O(r,(e=>{I(n.tags,g(no,e))&&vn(e)}))})(t,e)},wo=e=>t=>{((e,t)=>{const n=Yr({tags:[]},t),r=Kt(e,"*");O(r,(e=>{_(n.tags,g(no,e)).each((t=>{t.mutate(e)}))}))})(t,e)},So=e=>t=>{const n=Kn(t),r=((e,t,n)=>{const r=bo(e),o=((e,t=window.document)=>{const n=t.createElement("div");t.body.appendChild(n),n.style.position="absolute",n.style.left="-10000px",n.innerHTML=e;let r=n.firstChild||yo;const o=[];let s=!1;return{hasNext:()=>void 0!==r,next:()=>{const e=r,a=r,i=s;return!s&&e.firstChild?(o.push(e),r=e.firstChild):s||1!==e.nodeType?e.nextSibling?(r=e.nextSibling,s=!1):(r=o.pop(),s=!0):s=!0,a===yo||r||(t.body.removeChild(n),r=yo),(l=a)===yo?l:l?fo(l,i):void 0;var l}}})(t,e),s=((e,t,n)=>{let r=n;for(let n=t.length-1;n>=0;n--)r=t[n](r,{},e);return r})(e,n,r);for(;o.hasNext();){const e=o.next();s.receive(e)}return r.dom})(Pt(t).dom,n,e);fn(t),t.dom.appendChild(r)},Co=(e,t,n)=>{const r=_e.fromTag("div",e.dom);Bn(r,{position:"fixed",left:"-100000px",top:"0px"}),dn((e=>{const t=e.dom.body;if(null==t)throw new Error("Body is not available yet");return _e.fromDom(t)})(e),r),r.dom.innerHTML=t,O(n,(e=>{e(r)}));const o=Kn(r);return gn(r),o},To=(e,t)=>n=>{const r=e=>{n.receive(e)},o=(e,t,n)=>(n=void 0!==n?n:e.type()===ho,fo(t,n,{})),s={emit:r,emitTokens:e=>{O(e,r)},receive:t=>{e(s,t,o)},document:window.document};return t(s),s},Io=(e,t)=>{if(void 0===e||void 0===t)throw console.trace(),new Error("brick");e.nextFilter.set(t)},Ao=(e,t,n=!1)=>e===t||l(e)&&l(t)&&e.tag===t.tag&&e.type===t.type&&(n||e.variant===t.variant),Oo=(e,t)=>In(_e.fromDom(t.getNode()),"data-list-level"),Eo=(e,t,n,r)=>{const o=n.getCurrentListType(),s=n.getCurrentLevel()==r.level()?o:null;return(a=r.emblems(),i=s,_(a,(e=>"ul"===e.tag||l(i)&&Ao(e,i,!0))).orThunk((()=>F(a)))).filter((e=>!("ol"===e.tag&&(e=>{if(T(["p"],e.tag())){const t=((e,t)=>{const n=_e.fromDom(e.getNode());return Cn(n,"class")})(e);return l(t)&&/^MsoHeading/.test(t)}return!0})(t))));var a,i},Lo=e=>(t,n,r)=>{const o=r,s=(e=>{const t=parseInt(Cn(e,"data-list-level"),10),n=Cn(e,"data-list-emblems"),r=l(n)?JSON.parse(n):[];return An(e,"data-list-level"),An(e,"data-list-emblems"),{level:m(t),emblems:m(r)}})(_e.fromDom(o.getNode()));n.originalToken.set(o);const a=((e,t,n)=>(Eo(n.listType.get(),e,n.emitter,t).each(n.listType.set),((e,t,n)=>({level:m(e),token:m(t),type:m(n)}))(t.level(),n.originalToken.get(),n.listType.get())))(o,s,n);n.emitter.openItem(a.level(),a.token(),a.type()),Io(n,e.inside())},No=(e,t,n)=>({pred:e,action:t,label:m(n)});var _o=(e,t,n)=>{const r=(e,r,o)=>{_(t,(e=>e.pred(r,o))).fold(m(n),(e=>e.action))(e,r,o)};return r.toString=()=>"Handlers for "+e,r};const Do=(e,t)=>({state:m(e),result:m(t)}),Po=(e,t)=>({state:m(e),value:m(t)}),Ro=(e,t,n,r)=>({level:m(e),type:m(t),types:m(n),items:m(r)}),Mo=e=>{const t=e.items().slice(0);if(t.length>0&&"p"!==t[t.length-1]){const n=t[t.length-1];t[t.length-1]="p";const r=Ro(e.level(),e.type(),e.types(),t);return Po(r,k.some(n))}return Po(e,k.none())},jo=(e,t,n)=>{let r=[],o=e;for(;t(o);){const e=n(o);o=e.state(),r=r.concat(e.result())}return Do(o,r)},Fo=(e,t,n)=>{const r=t.start&&t.start>1?{start:t.start}:{},o=e.level()+1,s=t,a=e.types().concat([t]),i=[g(go,t.tag,r,n)],l=Ro(o,s,a,e.items());return Do(l,i)},Uo=e=>{const t=e.types().slice(0),n=[g(vo,t.pop().tag)],r=e.level()-1,o=t[t.length-1],s=Ro(r,o,t,e.items());return Do(s,n)},Bo=(e,t,n)=>{const r=(c=t)?(e=>{const t=((e,t)=>{const n=_e.fromDom(e.getNode());return zn(n,"margin-left")})(e);return l(t)&&"0px"!==t?{"margin-left":t}:{}})(c):{"list-style-type":"none"},o=e.type()&&!Ao(e.type(),n)?((e,t)=>{const n=Uo(e),r=Fo(n.state(),t,t.type?{"list-style-type":t.type}:{});return Do(r.state(),n.result().concat(r.result()))})(e,n):Do(e,[]),s=[g(go,"li",{},r)],a=((e,t)=>{const n=e.items().slice(0),r=void 0!==t&&"p"!==t?k.some(t):k.none();r.fold((()=>{n.push("p")}),(e=>{n.push(e)}));const o=Ro(e.level(),e.type(),e.types(),n);return Po(o,r)})(o.state(),t&&t.tag()),i=a.value().map((e=>{const n=t;return lo(n.getNode(),x),[m(n)]})).getOr([]);var c;return Do(a.state(),o.result().concat(s).concat(i))},zo=e=>{const t=g(vo,"li"),n=Mo(e),r=n.value().fold((()=>[t]),(e=>[g(vo,e),t]));return Do(n.state(),r)},Ho=e=>{if(0===e.length)throw new Error("Compose must have at least one element in the list");const t=e[e.length-1],n=R(e,(e=>e.result()));return Do(t.state(),n)},Wo=e=>{const t=zo(e),n=Uo(t.state());return Ho([t,n])},$o=(e,t)=>((e,t,n)=>jo(e,(e=>e.level()>t),n))(e,t,Wo),Vo=(e,t,n,r)=>{const o=e.level()>t?$o(e,t):Do(e,[]),s=o.state().level()===t?((e,t,n)=>{const r=e.level()>0?zo(e):Do(e,[]),o=Bo(r.state(),n,t);return Ho([r,o])})(o.state(),r,n):((e,t,n,r)=>{const o=n>1?Mo(e):Po(e,k.none()),s=o.value().map((e=>[g(vo,e)])).getOr([]),a=((e,t,n,r)=>((e,t,n)=>jo(e,(e=>e.level()((e,t,n,r)=>{const o=e.level()===n-1&&t.type?{"list-style-type":t.type}:{},s=Fo(e,t,o),a=Bo(s.state(),s.state().level()==n?r:void 0,t);return Ho([s,a])})(e,t,n,r))))(o.state(),t,n,r);return Do(a.state(),s.concat(a.result()))})(o.state(),r,t,n);return Ho([o,s])},Go=$o,qo=["disc","circle","square"],Ko={getCurrentListType:()=>Jo().getCurrentListType(),getCurrentLevel:()=>Jo().getCurrentLevel(),closeAllLists:()=>Jo().closeAllLists(),openItem:(e,t,n)=>Jo().openItem(e,t,n)};let Jo=()=>({getCurrentListType:m({}),getCurrentLevel:m(1),closeAllLists:d,openItem:p});const Yo={inside:()=>Zo,outside:()=>Qo},Xo=(()=>{let e=!1;return{check:t=>!(!e||t.type()!==mo)||(t.type()===uo&&"style"===t.tag()?(e=!0,!0):t.type()===ho&&"style"===t.tag()&&(e=!1,!0))}})(),Zo=(e=>_o("Inside.List.Item",[No(((e,t)=>{const n=e.originalToken.get();return t.type()===ho&&null!==n&&t.tag()===n.tag()}),((t,n)=>{Io(n,e.outside())}),"Closing open tag")],((e,t,n)=>{e.emit(n)})))(Yo),Qo=(e=>_o("Outside.List.Item",[No(Oo,Lo(e),"Data List ****"),No(((e,t)=>t.type()===mo&&(e=>e.type()===mo&&/^[\s\u00A0]*$/.test(e.text()))(t)),((e,t,n)=>{e.emit(n)}),"Whitespace")],((t,n,r)=>{n.emitter.closeAllLists(),t.emit(r),Io(n,e.outside())})))(Yo),es=(e=>{const t=pe(e),n=pe(null),r=pe(null);return{reset:o=>{t.set(e),n.set(null),r.set(null),Jo=m(((e,t)=>{let n=Ro(0,void 0,[],[]);const r=n=>{O(n.result(),(n=>{const r=n(t);e.emit(r)}))};return{closeAllLists:()=>{const e=Go(n,0);n=e.state(),r(e)},openItem:(e,t,o)=>{if(!o)return;const s=((e,t)=>"ul"===e.tag&&qo[t-1]===e.type?{tag:"ul"}:e)(o,e),a=Vo(n,e,t,s);n=a.state(),r(a)},getCurrentListType:()=>n.type(),getCurrentLevel:()=>n.level()}})(o,o.document))},nextFilter:t,originalToken:n,listType:r,emitter:Ko}})(Qo);var ts=To(((e,t,n)=>{Xo.check(t)||((e,t,n)=>{t.nextFilter.get()(e,t,n)})(e,es,t)}),es.reset);const ns=e=>e.dom.textContent,rs=[{regex:/^\(?[dc][\.\)]$/,type:{tag:"ol",type:"lower-alpha"}},{regex:/^\(?[DC][\.\)]$/,type:{tag:"ol",type:"upper-alpha"}},{regex:/^\(?M*(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})[\.\)]$/,type:{tag:"ol",type:"upper-roman"}},{regex:/^\(?m*(cm|cd|d?c{0,3})(xc|xl|l?x{0,3})(ix|iv|v?i{0,3})[\.\)]$/,type:{tag:"ol",type:"lower-roman"}},{regex:/^\(?[0-9]+[\.\)]$/,type:{tag:"ol"}},{regex:/^([0-9]+\.)*[0-9]+\.?$/,type:{tag:"ol",variant:"outline"}},{regex:/^\(?[a-z]+[\.\)]$/,type:{tag:"ol",type:"lower-alpha"}},{regex:/^\(?[A-Z]+[\.\)]$/,type:{tag:"ol",type:"upper-alpha"}}],os={"\u2022":{tag:"ul",type:"disc"},"\xb7":{tag:"ul",type:"disc"},"\xa7":{tag:"ul",type:"square"}},ss={o:{tag:"ul",type:"circle"},"-":{tag:"ul",type:"disc"},"\u25cf":{tag:"ul",type:"disc"},"\ufffd":{tag:"ul",type:"circle"}},as=(e,t)=>a(e.variant)?"("===t.charAt(0)?"()":")"===t.charAt(t.length-1)?")":".":e.variant,is=e=>{const t=e.split("."),n=(()=>{if(0===t.length)return e;const n=t[t.length-1];return 0===n.length&&t.length>1?t[t.length-2]:n})(),r=parseInt(n,10);return isNaN(r)?{}:{start:r}},ls=e=>{const t=(e=>ro(e,["mso-list"],b)["mso-list"])(e),n=l(t)&&/ level([0-9]+)/.exec(t);return n&&n[1]?k.some(parseInt(n[1],10)):k.none()},cs=(e,t)=>{const n=((e,t)=>{const n=ss[e]?[ss[e]]:[],r=((e,t)=>t&&os[e]?[os[e]]:t?[{tag:"ul",variant:e}]:[])(e,t),o=R(rs,(t=>t.regex.test(e)?[Yr(t.type,is(e),{variant:as(t.type,e)})]:[])),s=n.concat(r).concat(o);return A(s,(t=>void 0!==t.variant?t:Yr(t,{variant:e})))})(ns(e).trim(),t);return n.length>0?k.some(n):k.none()},us=e=>Yn(e,Se).bind(Ut).filter(Oe("span")),ds=e=>Xn(e,(e=>!!(Ce(e)?ro(e,["mso-list"],b):{})["mso-list"])),hs=e=>Ce(e)&&Wn(e,"font-family").exists((e=>T(["wingdings","symbol"],e.toLowerCase()))),ms=(e,t,n,r)=>{((e,t,n)=>{wn(e,"data-list-level",t);const r=JSON.stringify(n);wn(e,"data-list-emblems",r)})(e,t,n),(e=>{const t=((e,t)=>{const n=t.getOr(x);return(e=>{const t=[];for(;null!==e.nextNode();)t.push(_e.fromDom(e.currentNode));return t})(document.createTreeWalker(e.dom,NodeFilter.SHOW_COMMENT,{acceptNode:e=>n(e.nodeValue)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}))})(e,k.none());O(t,gn)})(e),O(r,gn),An(e,"style"),An(e,"class")},ps=e=>(e=>ls(e).bind((t=>(e=>Yn(e,hs))(e).bind((n=>cs(n,!0).map((r=>({mutate:()=>{ms(e,t,r,[n])}}))))))))(e).orThunk((()=>(e=>ls(e).bind((t=>us(e).bind((n=>cs(n,hs(n)).map((r=>({mutate:()=>{ms(e,t,r,[n])}}))))))))(e))).orThunk((()=>(e=>ls(e).bind((t=>us(e).bind((n=>cs(n,hs(n)).map((r=>({mutate:()=>{ms(e,t,r,[n])}}))))))))(e))).orThunk((()=>(e=>"p"!==xe(e)?k.none():ls(e).bind((t=>ds(e).bind((n=>cs(n,!1).map((r=>({mutate:()=>{ms(e,t,r,[jt(n).getOr(n)])}}))))))))(e))).orThunk((()=>(e=>"p"!==xe(e)?k.none():ds(e).bind((t=>{const n=jt(t).getOr(t),r=hs(n);return cs(t,r).bind((t=>(e=>Wn(e,"margin-left").bind((e=>{const t=parseInt(e,10);return isNaN(t)?k.none():k.some(Math.max(1,Math.ceil(t/18)))})))(e).map((r=>({mutate:()=>{ms(e,r,t,[n])}})))))})))(e))),fs=wo({tags:[{name:to.pattern(/^(p|h\d+)$/,to.caseInsensitive),mutate:e=>{ps(e).each((e=>{e.mutate()}))}}]}),gs=ts,vs=e=>{return(o=e,Se(o)?(t=o,n="v:shape",k.from((r=t,r.dom.nodeValue)).bind((e=>{const t=e.indexOf("]>"),r=(e=>{try{return(new DOMParser).parseFromString(e,"text/html").body}catch(t){const n=document.implementation.createHTMLDocument("").body;return n.innerHTML=e,n}})(`
${e.slice(t+2,e.lastIndexOf("`);return Xn(_e.fromDom(r),(e=>xe(e)===n))}))):k.none()).map((e=>{const t=Cn(e,"o:spid"),n=void 0===t?Tn(e,"id").getOr(""):t,r=_e.fromTag("img");return Nn(r,"rtf-data-image"),wn(r,"data-image-id",n.substr(7)),wn(r,"data-image-type","code"),((e,t)=>{const n=e.dom;Re(t,((e,t)=>{e.fold((()=>{Fn(n,t)}),(e=>{jn(n,t,e)}))}))})(r,{width:Wn(e,"width"),height:Wn(e,"height")}),r}));var t,n,r,o},ys=e=>{if(Oe("img")(e)){const t=Cn(e,"src");if(null!=t&&W(t,"file://")){const n=(e=>((e,t)=>_e.fromDom(e.dom.cloneNode(!1)))(e))(e),r=t.split(/[\/\\]/),o=r[r.length-1];return wn(n,"data-image-id",o),An(n,"src"),wn(n,"data-image-type","local"),Nn(n,"rtf-data-image"),k.some(n)}return k.none()}return k.none()};var bs;!function(e){e[e.Word=0]="Word",e[e.GoogleDocs=1]="GoogleDocs",e[e.Html=2]="Html"}(bs||(bs={}));const xs=e=>t=>{Tn(t,e.attrName).each((n=>{const r=l(e.styleName)?e.styleName:e.attrName;if(Wn(t,r).isNone()){const o=e.mapValue(n);Un(t,r,o)}An(t,e.attrName)}))},ks=e=>{const t=xe(e);return"td"===t||"tr"===t||"col"===t||"th"===t},ws=/^#?([a-f\d])([a-f\d])([a-f\d])$/i,Ss=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i,Cs=e=>z(e,"#").toUpperCase(),Ts=e=>{const t=e.toString(16);return(1===t.length?"0"+t:t).toUpperCase()},Is=e=>(e=>({value:Cs(e)}))(Ts(e.red)+Ts(e.green)+Ts(e.blue)),As=/^\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)\s*$/i,Os=/^\s*rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d?(?:\.\d+)?)\s*\)\s*$/i,Es=(e,t,n,r)=>({red:e,green:t,blue:n,alpha:r}),Ls=(e,t,n,r)=>{const o=parseInt(e,10),s=parseInt(t,10),a=parseInt(n,10),i=parseFloat(r);return Es(o,s,a,i)},Ns=["background-repeat-x","background-repeat-y"],_s=e=>{return"currentcolor"===e||"transparent"===e?e:"#"+(t=z(e,"#").toUpperCase(),(e=>ws.test(e)||Ss.test(e))(t)?k.some({value:Cs(t)}):k.none()).orThunk((()=>(e=>{if("transparent"===e)return k.some(Es(0,0,0,0));const t=As.exec(e);if(null!==t)return k.some(Ls(t[1],t[2],t[3],"1"));const n=Os.exec(e);return null!==n?k.some(Ls(n[1],n[2],n[3],n[4])):k.none()})(e).map(Is))).getOrThunk((()=>{const t=document.createElement("canvas");t.height=1,t.width=1;const n=t.getContext("2d");n.clearRect(0,0,t.width,t.height),n.fillStyle="#FFFFFF",n.fillStyle=e,n.fillRect(0,0,1,1);const r=n.getImageData(0,0,1,1).data,o=r[0],s=r[1],a=r[2],i=r[3];return Is(Es(o,s,a,i))})).value;var t},Ds=(e,t)=>{if(a(e))return"";switch(t){case"color":return _s(e);case"font-family":return e.replace(/['"]/g,"");case"font-weight":return(e=>{switch(e){case"bold":return"700";case"normal":return"400";default:return e}})(e);default:return $(t,"-color")?_s(e):(e=>e.replace(/^0(pt|px|pc|in|cm|mm|Q|cap|ch|ic|em|ex|lh|rlh|rem|vw|vh|vb|vi|vmax|vmin|%)$/,"0"))(e)}},Ps=wo({tags:[{name:to.pattern(/^(p|div)$/,to.caseInsensitive),mutate:e=>{const t="ltr"===Gn(e),n=t?"margin-left":"margin-right",r=t?"padding-left":"padding-right";Wn(e,n).each((()=>{const t=zn(e,n);Un(e,r,t),Vn(e,n)}))}}]}),Rs=ko({tags:[{name:to.exact("b",to.caseInsensitive),condition:e=>Tn(e,"id").exists((e=>W(e,"docs-internal-guid")))}]}),Ms=xo({attributes:[{name:to.exact("id",to.caseInsensitive),value:to.starts("docs-internal-guid",to.caseInsensitive)}]}),js=[wo({tags:[{name:to.exact("col",to.caseInsensitive),mutate:xs({attrName:"width",mapValue:e=>e.replace(/^(\d+)$/,"$1px")})}]})],Fs=e=>wo({tags:[{name:to.exact(e.matchTag,to.caseInsensitive),mutate:t=>{var n,r;(n=$n(t),r=e.key,Be(n,r)?k.from(n[r]):k.none()).exists((t=>T(e.values,t)))&&(hn(t,_e.fromTag(e.newTag)),Vn(t,e.key),o(e.removeExtra)&&O(e.removeExtra,(e=>Vn(t,e))))}}]}),Us=[Fs({matchTag:"span",key:"font-weight",values:["700","bold"],newTag:"strong"}),Fs({matchTag:"span",key:"font-style",values:["italic"],newTag:"em"}),Fs({matchTag:"span",key:"vertical-align",values:["sub"],newTag:"sub",removeExtra:["font-size"]}),Fs({matchTag:"span",key:"vertical-align",values:["super"],newTag:"sup",removeExtra:["font-size"]})],Bs=e=>t=>{const n=[],r={border:e.browser.isFirefox()?"medium none":"none","text-decoration":"none",...e.browser.isChromium()&&e.browser.version.major>=114?{"white-space":"pre-wrap"}:{}},o=(e,t)=>{if(!a(t)){const r=_e.fromTag(xe(e));dn(t,r),n.push({me:e,fake:r})}const r=L(zt(e),Ce);O(r,(t=>o(t,e)))};o(t);const s=A(n,(e=>{const{fake:t,me:n}=e,o=$n(n),s=Fe(o,((e,r)=>{const o=((e,t)=>T(Ns,t)?Wn(e,"background-repeat"):k.none())(n,r).getOr(e),s=((e,t)=>T(Ns,t)?zn(e,"background-repeat"):zn(e,t))(t,r);return Ds(o,r)===Ds(s,r)})),a=Fe(r,((e,t)=>Pn(Wn(n,t),e)));return{fake:t,me:n,toRemove:s,toPreserve:a}}));O(s,(e=>{const{me:t,toRemove:n,toPreserve:r,fake:o}=e;Re(n,((e,n)=>{Vn(t,n)})),Re(r,((e,n)=>{Un(t,n,e)})),gn(o)}))},zs=["p","div","article","aside","details","dt","figcaption","footer","form","fieldset","header","hgroup","html","main","nav","section","summary","body","dl","multicol","dd","figure","address","center","blockquote","h1","h2","h3","h4","h5","h6","listing","xmp","pre","plaintext","menu","dir","ul","ol","li","hr","table","tbody","thead","tfoot","th","tr","td","caption"],Hs=e=>{const t=e.browser.isChromium()&&e.browser.version.major>=114?[{name:to.exact("white-space-collapse",to.caseInsensitive),value:to.starts("preserve",to.caseInsensitive)},{name:to.exact("text-wrap",to.caseInsensitive),value:to.not(to.exact("wrap",to.caseInsensitive))}]:[];return xo({styles:[...t,{name:to.exact("background-color",to.caseInsensitive),value:to.exact("transparent",to.caseInsensitive)},{name:to.exact("white-space",to.caseInsensitive),value:to.starts("pre",to.caseInsensitive)},{name:to.pattern(/^overflow(-[xy])?$/,to.caseInsensitive),condition:e=>ks(e)&&Pn(Wn(e,"overflow"),"hidden")},{name:to.exact("overflow-wrap",to.caseInsensitive),condition:ks},{name:to.exact("table-layout",to.caseInsensitive),value:to.exact("fixed",to.caseInsensitive),condition:Oe("table")},{name:to.exact("line-height",to.caseInsensitive),value:to.exact("1.38",to.caseInsensitive)},{name:to.exact("vertical-align",to.caseInsensitive),value:to.exact("baseline",to.caseInsensitive)},{name:to.exact("font-style",to.caseInsensitive),value:to.exact("normal",to.caseInsensitive)},{name:to.exact("font-variant",to.caseInsensitive),value:to.exact("normal",to.caseInsensitive)},{name:to.exact("background-color",to.caseInsensitive),value:to.exact("transparent",to.caseInsensitive)},{name:to.starts("padding",to.caseInsensitive),condition:ks},{name:to.pattern(/^text-decoration(-(line|thickness|style|color))?$/,to.caseInsensitive),condition:e=>!Oe("a")(e)&&Pn(Wn(e,"text-decoration"),"none")}],attributes:[{name:to.exact("aria-level",to.caseInsensitive),condition:Oe("li")},{name:to.exact("dir",to.caseInsensitive),value:to.exact("ltr",to.caseInsensitive),condition:e=>T(zs,xe(e))},{name:to.exact("role",to.caseInsensitive),value:to.exact("presentation",to.caseInsensitive),condition:e=>Oe("p")(e)&&jt(e).exists(Oe("li"))}]})},Ws=xo({styles:[{name:to.exact("text-align",to.caseInsensitive),value:to.exact("right",to.caseInsensitive),condition:e=>"rtl"===Gn(e)}]}),$s=wo({tags:[{name:to.exact("p",to.caseInsensitive),condition:e=>{const t=t=>Wn(e,t).map((e=>parseInt(e,10))).filter((e=>!isNaN(e))).getOr(0),n=Gn(e);return t("text-indent")+t("rtl"===n?"padding-right":"padding-left")===0},mutate:e=>{const t=Gn(e);Vn(e,"text-indent"),Vn(e,"rtl"===t?"padding-right":"padding-left")}}]}),Vs=e=>t=>Dn(t,e),Gs=ge(Te,"text"),qs=e=>Gs.get(e),Ks=e=>{const t=e.dom.attributes;return null==t||0===t.length||1===t.length&&"style"===t[0].name},Js=(e,t)=>{const n=_e.fromTag(e);ln(t,n);const r=t.dom.attributes;O(r,(e=>{n.dom.setAttribute(e.name,e.value)}));const o=zt(t);return pn(n,o),gn(t),n},Ys=Oe("li"),Xs=e=>Ft(e).bind((e=>Te(e)&&0===qs(e).trim().length?Xs(e):Ys(e)?k.some(e):k.none())),Zs=e=>{const t=Js("span",e),n={"font-size":{1:"8pt",2:"10pt",3:"12pt",4:"14pt",5:"18pt",6:"24pt",7:"36pt"}};Re({face:"font-family",size:"font-size",color:"color"},((e,r)=>{Tn(t,r).each((o=>{const s=n[e],a=void 0!==s&&void 0!==s[o]?s[o]:o;Un(t,e,a),An(t,r)}))}))},Qs=xo({tags:[{name:to.exact("script",to.caseInsensitive)},{name:to.exact("link",to.caseInsensitive)},{name:to.exact("style",to.caseInsensitive),condition:e=>0===Kn(e).length}],attributes:[{name:to.starts("on",to.caseInsensitive)},{name:to.exact('"',to.caseInsensitive)},{name:to.exact("lang",to.caseInsensitive)},{name:to.exact("language",to.caseInsensitive)}],styles:[{name:to.all(),value:to.pattern(/OLE_LINK/i,to.caseInsensitive)}]}),ea=xo({tags:[{name:to.exact("meta",to.caseInsensitive)}]}),ta=xo({tags:[{name:to.exact("style",to.caseInsensitive)}]}),na=xo({styles:[{name:to.not(to.pattern(/^(width|height|list-style-type)$/,to.caseInsensitive)),condition:e=>!Dn(e,"ephox-limbo-transform")},{name:to.pattern(/^(width|height)$/,to.caseInsensitive),condition:e=>{return(e=>"img"!==xe(e))(e)&&!("table"===xe(t=e)||ks(t));var t}}]}),ra=(e=[])=>{const t=A(e,(e=>({name:to.exact(e,to.caseInsensitive)})));return ko({tags:t})},oa=xo({classes:[{name:to.not(to.exact("rtf-data-image",to.caseInsensitive))}]}),sa=xo({styles:[{name:to.pattern(/^(mso-.*|tab-stops|tab-interval|language|text-underline|text-effect|text-line-through|font-color|horiz-align|list-image-[0-9]+|separator-image|table-border-color-(dark|light)|vert-align|vnd\..*)$/,to.caseInsensitive)}]}),aa=xo({classes:[{name:to.pattern(/mso/i,to.caseInsensitive)}]}),ia=ko({tags:[{name:to.exact("img",to.caseInsensitive),condition:e=>{const t=Cn(e,"src");return n(t)&&/^file:/.test(t)}}]}),la=ko({tags:[{name:to.exact("a",to.caseInsensitive),condition:Ks}]}),ca=xo({attributes:[{name:to.exact("style",to.caseInsensitive),value:to.exact("",to.caseInsensitive)}]}),ua=xo({attributes:[{name:to.exact("class",to.caseInsensitive),value:to.exact("",to.caseInsensitive)}]}),da=ko({tags:[{name:to.pattern(/^(font|em|strong|samp|acronym|cite|code|dfn|kbd|tt|b|i|u|s|sub|sup|ins|del|var|span)$/,to.caseInsensitive),condition:(ha=e=>!Ks(e)||(e=>{const t=e.dom.attributes,n=null!=t&&t.length>0;return"span"!==xe(e)||n})(e)&&Xn(e,(e=>{const t=!Ks(e),n=!T(["font","em","strong","samp","acronym","cite","code","dfn","kbd","tt","b","i","u","s","sub","sup","ins","del","var","span"],xe(e));return Te(e)||t||n})).isSome(),e=>!ha(e))}]});var ha;const ma=wo({tags:[{name:to.exact("p",to.caseInsensitive),mutate:e=>{0===Kn(e).length&&dn(e,_e.fromTag("br"))}}]}),pa=e=>{const t=Js("span",e);Nn(t,"ephox-limbo-transform"),Un(t,"text-decoration","underline")},fa=wo({tags:[{name:to.pattern(/ol|ul/,to.caseInsensitive),mutate:e=>{jt(e).each((t=>{const n=xe(t);T(["ol","ul"],n)&&Xs(e).fold((()=>{const t=_e.fromTag("li");Un(t,"list-style-type","none"),hn(e,t)}),(t=>{dn(t,e)}))}))}}]}),ga=e=>{const t=[{name:"b",transform:{mutate:g(Js,"strong")}},{name:"i",transform:{mutate:g(Js,"em")}},{name:"u",transform:{mutate:pa}},{name:"s",transform:{mutate:g(Js,"strike")}},{name:"font",transform:{mutate:Zs,debug:!0}}],n=L(t,(t=>!T(e,t.name))).map((e=>({name:to.exact(e.name,to.caseInsensitive),...e.transform})));return wo({tags:n})},va=xo({classes:[{name:to.exact("ephox-limbo-transform",to.caseInsensitive)}]}),ya=xo({tags:[{name:to.exact("br",to.caseInsensitive),condition:Vs("Apple-interchange-newline")}]}),ba=xo({styles:[{name:to.pattern(/^-/,to.caseInsensitive)},{name:to.all(),value:to.exact("initial",to.caseInsensitive)},{name:to.exact("background-color",to.caseInsensitive),value:to.exact("transparent",to.caseInsensitive)},{name:to.exact("font-style",to.caseInsensitive),value:to.exact("normal",to.caseInsensitive)},{name:to.pattern(/font-variant.*/,to.caseInsensitive)},{name:to.exact("letter-spacing",to.caseInsensitive)},{name:to.exact("font-weight",to.caseInsensitive),value:to.pattern(/400|normal/,to.caseInsensitive)},{name:to.exact("orphans",to.caseInsensitive)},{name:to.exact("text-decoration",to.caseInsensitive),value:to.exact("none",to.caseInsensitive)},{name:to.exact("text-size-adjust",to.caseInsensitive)},{name:to.exact("text-indent",to.caseInsensitive),value:to.exact("0px",to.caseInsensitive)},{name:to.exact("text-transform",to.caseInsensitive),value:to.exact("none",to.caseInsensitive)},{name:to.exact("white-space",to.caseInsensitive),value:to.exact("normal",to.caseInsensitive)},{name:to.exact("widows",to.caseInsensitive)},{name:to.exact("word-spacing",to.caseInsensitive),value:to.exact("0px",to.caseInsensitive)},{name:to.exact("text-align",to.caseInsensitive),value:to.pattern(/start|end/,to.caseInsensitive)},{name:to.exact("font-weight",to.caseInsensitive),value:to.pattern(/700|bold/,to.caseInsensitive),condition:e=>/^h\d$/.test(xe(e))}]}),xa=(()=>{const e=(e,t)=>n=>e(n).filter((e=>Te(n)&&t(ns(e)||""," "))).isSome(),t=e(Ft,$),n=e(Ut,W);return wo({tags:[{name:to.exact("span",to.caseInsensitive),condition:Vs("Apple-converted-space"),mutate:e=>{"\xa0"===ns(e)&&(t(e)||n(e)?vn(e):(ln(e,_e.fromText(" ")),gn(e)))}}]})})(),ka=(()=>{const e=/^file:\/\/\/[^#]+(#[^#]+)$/;return wo({tags:[{name:to.exact("a",to.caseInsensitive),condition:t=>{const n=Cn(t,"href");return!!n&&e.test(n)},mutate:t=>{Tn(t,"href").each((n=>{wn(t,"href",n.replace(e,"$1"))}))}}]})})(),wa=xo({attributes:[{name:to.exact("href",to.caseInsensitive),value:to.starts("file:///",to.caseInsensitive)}]}),Sa=(()=>{const e=(e,t,n)=>({name:to.exact(e,to.caseInsensitive),condition:e=>In(e,t),mutate:e=>{Tn(e,t).each((r=>{wn(e,n,r),An(e,t)}))}});return wo({tags:[e("a","data-ephox-href","href"),e("img","data-ephox-src","src")]})})(),Ca=e=>{const t=["table","thead","tbody","tfoot","th","tr","td","ul","ol","li"],n=qt(e,Se),r=_(n,(e=>H(Le(e),"StartFragment"))),o=_(n,(e=>H(Le(e),"EndFragment")));r.each((n=>{o.each((r=>{let o=n;const s=[];let a=((e,t,n,r)=>{const o=en(e,0,n,0);return _e.fromDom(o.commonAncestorContainer)})(n,0,r);for(;void 0!==a&&!It(a,e);)T(t,xe(a))?o=a:s.push(a),a=jt(a).getOrUndefined();O(s,vn),O(Bt(o),gn)})),gn(n)})),o.each(gn)},Ta=wo({tags:[{name:to.pattern(/^(img|table)$/,to.caseInsensitive),mutate:e=>{Wn(e,"margin-left").exists((e=>W(e,"-")))&&Vn(e,"margin-left"),W(zn(e,"margin-left"),"-")&&(Un(e,"margin-top",zn(e,"margin-top")),Un(e,"margin-bottom",zn(e,"margin-bottom")),Un(e,"margin-right",zn(e,"margin-right")),Vn(e,"margin"))}}]}),Ia=wo({tags:[{name:to.exact("p",to.caseInsensitive),mutate:xs({attrName:"align",styleName:"text-align",mapValue:p})}]}),Aa=(e,t)=>{return(n=e,Gs.getOption(n)).exists((e=>0===t(e).length));var n},Oa=xo({tags:[{name:to.exact("font",to.caseInsensitive),condition:e=>{const t=zt(e),n=e=>e.replace(/[ \r\n\uFEFF]+/g,"");return 0===t.length||M(t,(e=>Aa(e,n)))}}]}),Ea=e=>O(zt(e),(e=>{Aa(e,V)&&gn(e)})),La=wo({tags:[{name:to.exact("ol",to.caseInsensitive),mutate:Ea},{name:to.exact("ul",to.caseInsensitive),mutate:Ea}]}),Na=ko({tags:[{name:to.pattern(/^([OVWXP]|U[0-9]+|ST[0-9]+):/i,to.caseInsensitive)}]}),_a=[So([gs])],Da=xo({attributes:[{name:to.exact("height",to.caseInsensitive),condition:Oe("table")}]}),Pa=xo({attributes:[{name:to.pattern(/^(width|height)$/,to.caseInsensitive),condition:ks}]}),Ra=wo({tags:[{name:to.exact("table",to.caseInsensitive),mutate:xs({attrName:"width",mapValue:e=>e.replace(/^(\d+)$/,"$1px")})}]}),Ma=xo({styles:[{name:to.exact("height",to.caseInsensitive),condition:Oe("td")},{name:to.exact("width",to.caseInsensitive),condition:Oe("tr")},{name:to.exact("height",to.caseInsensitive),condition:Oe("col")}]}),ja=xo({attributes:[{name:to.pattern(/^v:/,to.caseInsensitive)},{name:to.exact("href",to.caseInsensitive),value:to.contains("#_toc",to.caseInsensitive)},{name:to.exact("href",to.caseInsensitive),value:to.contains("#_mso",to.caseInsensitive)},{name:to.pattern(/^xmlns(:|$)/,to.caseInsensitive)},{name:to.exact("type",to.caseInsensitive),condition:e=>"ol"===xe(e)||"ul"===xe(e)}]});ko({tags:[{name:to.exact("p",to.caseInsensitive),condition:("li",e=>jt(e).exists((e=>"li"===xe(e)&&1===zt(e).length)))}]}),wo({tags:[{name:to.pattern(/^(img|table)$/,to.caseInsensitive),mutate:e=>{Wn(e,"margin-left").exists((e=>W(e,"-")))&&Vn(e,"margin-left"),W(zn(e,"margin-left"),"-")&&(Un(e,"margin-top",zn(e,"margin-top")),Un(e,"margin-bottom",zn(e,"margin-bottom")),Un(e,"margin-right",zn(e,"margin-right")),Vn(e,"margin"))}}]});const Fa=e=>{const t=[Ia,sa,aa],n=[Ia,na,ra(e.cleanFilteredInlineElements),oa];return e.merge?t:n},Ua=e=>e.type===bs.Word?[fs]:[],Ba=e=>e.type===bs.Word?[Na,..._a,ja]:[],za=e=>e.type===bs.GoogleDocs?[Rs]:[],Ha=e=>e.type!==bs.GoogleDocs||e.indentUseMargin?[]:[Ps],Wa=(e,t)=>e.type===bs.GoogleDocs?[Hs(t),...Us,...js,Bs(t),Ws,$s,...Ha(e)]:[],$a=e=>e.type===bs.Html&&e.merge?[ba]:[],Va=e=>e.type===bs.Word?[Ma,Ra,Pa,Da]:[];Lt([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);const Ga=(e,t)=>Ja(document.createElement("canvas"),e,t),qa=e=>{const t=Ga(e.width,e.height);return Ka(t).drawImage(e,0,0),t},Ka=e=>e.getContext("2d"),Ja=(e,t,n)=>(e.width=t,e.height=n,e),Ya=e=>e.naturalWidth||e.width,Xa=e=>e.naturalHeight||e.height,Za=e=>fetch(e).then((e=>e.ok?e.blob():Promise.reject(new Error("Error "+e.status+" downloading image"))),(()=>Promise.reject((()=>{const e=new Error("No access to download image");return e.code=18,e.name="SecurityError",e})()))),Qa=e=>{const t=e.split(","),n=/data:([^;]+)/.exec(t[0]);if(!n)return k.none();const r=n[1],o=t[1],s=1024,a=atob(o),i=a.length,l=Math.ceil(i/s),c=new Array(l);for(let e=0;enew Promise(((t,n)=>{Qa(e).fold((()=>{n("uri is not base64: "+e)}),t)})),ti=(e,t,n)=>(t=t||"image/png",c(HTMLCanvasElement.prototype.toBlob)?new Promise(((r,o)=>{e.toBlob((e=>{e?r(e):o()}),t,n)})):ei(e.toDataURL(t,n))),ni=e=>(e=>{const t=URL.createObjectURL(e),n=new Image;return n.src=t,(e=>new Promise(((t,n)=>{const r=()=>{s(),t(e)},o=[Er(e,"load",r),Er(e,"error",(()=>{s(),n("Unable to load data from image: "+e.dom.src)}))],s=()=>O(o,(e=>e.unbind()));e.dom.complete&&r()})))(_e.fromDom(n)).then((e=>e.dom))})(e).then((e=>{oi(e);const t=Ga(Ya(e),Xa(e));return Ka(t).drawImage(e,0,0),t})),ri=e=>new Promise((t=>{const n=new FileReader;n.onloadend=()=>{t(n.result)},n.readAsDataURL(e)})),oi=e=>{URL.revokeObjectURL(e.src)},si=(e,t,n)=>{const r=t.type,o=m(r),s=m(n),a=(t,n)=>e.then((e=>((e,t,n)=>(t=t||"image/png",e.toDataURL(t,n)))(e,t,n)));return{getType:o,toBlob:()=>Promise.resolve(t),toDataURL:s,toBase64:()=>n.split(",")[1],toAdjustedBlob:(t,n)=>e.then((e=>ti(e,t,n))),toAdjustedDataURL:a,toAdjustedBase64:(e,t)=>a(e,t).then((e=>e.split(",")[1])),toCanvas:()=>e.then(qa)}},ai=(e,t)=>ti(e,t).then((t=>si(Promise.resolve(e),t,e.toDataURL()))),ii=(e,t,n)=>{const r=Ya(e),o=Xa(e);let s=t/r,a=n/o,i=!1;(s<.5||s>2)&&(s=s<.5?.5:2,i=!0),(a<.5||a>2)&&(a=a<.5?.5:2,i=!0);const l=li(e,s,a);return i?l.then((e=>ii(e,t,n))):l},li=(e,t,n)=>new Promise((r=>{const o=Ya(e),s=Xa(e),a=Math.floor(o*t),i=Math.floor(s*n),l=Ga(a,i);Ka(l).drawImage(e,0,0,o,s,0,0,a,i),r(l)})),ci=(e,t=2)=>{const n=Math.pow(10,t),r=Math.round(e*n);return Math.ceil(r/n)},ui=(e,t,n,r,o)=>((e,t,n,r,o)=>e.toCanvas().then((s=>((e,t,n,r,o,s)=>{const a=Ga(o,s);return Ka(a).drawImage(e,-n,-r),ai(a,t)})(s,e.getType(),t,n,r,o))))(e,t,n,r,o),di=(e,t)=>((e,t)=>e.toCanvas().then((n=>((e,t,n)=>{const r=(n<0?360+n:n)*Math.PI/180,o=e.width,s=e.height,a=Math.sin(r),i=Math.cos(r),l=ci(Math.abs(o*i)+Math.abs(s*a)),c=ci(Math.abs(o*a)+Math.abs(s*i)),u=Ga(l,c),d=Ka(u);return d.translate(l/2,c/2),d.rotate(r),d.drawImage(e,-o/2,-s/2),ai(u,t)})(n,e.getType(),t))))(e,t),hi=(e,t)=>((e,t)=>si(ni(e),e,t))(e,t),mi=e=>(e=>(e=>{const t=e.src;return 0===t.indexOf("data:")?ei(t):Za(t)})(e).then((e=>(e=>ri(e).then((t=>si(ni(e),e,t))))(e))))(e),pi=e=>e.toBlob(),fi=e=>e.toDataURL(),gi=e=>parseInt(e,10),vi=e=>e.isPx&&(e.cropWidth!==e.width||e.cropHeight!==e.height),yi=/rotate\((\d\.\d+)rad\)/,bi=(e,t,n)=>mi(e.dom).then((e=>t=>((e,t,n)=>((e,t,n)=>e.toCanvas().then((r=>ii(r,t,n).then((t=>ai(t,e.getType()))))))(e,t,n))(t,e.width,e.height))(t)).then(((e,t)=>n=>{if(vi(t)){const r=-1*gi(zn(e,"margin-top")),o=-1*gi(zn(e,"margin-left"));return ui(n,o,r,t.cropWidth,t.cropHeight).then((n=>(Sn(e,{width:t.cropWidth,height:t.cropHeight}),n)))}return Promise.resolve(n)})(e,t)).then(((e,t)=>n=>(e=>{const t=zn(e,"transform");return k.from(yi.exec(t)).map((e=>Math.round(parseFloat(e[1])*(180/Math.PI))))})(t).fold((()=>Promise.resolve(n)),(r=>di(n,r).then((n=>(Vn(t,"transform"),An(e,"width"),An(e,"height"),n))))))(e,n)).then((t=>{const n=fi(t);return wn(e,"src",n),Promise.resolve()})),xi=e=>jt(e).filter(Oe("span")).map((t=>{const n=()=>((e,t)=>{var n,r,o;Vn(e,"margin-top"),Vn(e,"margin-left"),Vn(t,"width"),Vn(t,"height"),Vn(t,"overflow"),Vn(t,"display"),r=e,o=["transform"],Ce(n=t)&&Ce(r)&&O(o,(e=>{((e,t,n)=>{Wn(e,n).each((e=>{Wn(t,n).isNone()&&Un(t,n,e)}))})(n,r,e)})),Vn(t,"transform")})(e,t),r=((e,t)=>{const n=(e,t)=>Tn(e,t).map(gi).filter((e=>!isNaN(e))).getOr(0),r=zn(t,"width"),o=zn(t,"height"),s=n(e,"width"),a=n(e,"height"),i=/^\d+px$/;return{isPx:i.test(r)&&i.test(o),cropWidth:gi(r),cropHeight:gi(o),width:s,height:a}})(e,t);return(vi(r)||yi.test(zn(t,"transform"))?bi(e,r,t):Promise.resolve()).then(n,n)})).getOrThunk((()=>Promise.resolve()));var ki=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];const wi=(e,t)=>D(e,(e=>e.start===t)),Si=(e,t,n=0)=>N(e,((e,n)=>t(n,e.len).fold(m(e),(t=>({len:t.finish,list:e.list.concat([t])})))),{len:n,list:[]}).list,Ci=(e,t,n)=>0===t.length?e:R(e,(e=>{const r=R(t,(t=>((e,t)=>t>=e.start&&t<=e.finish)(e,t)?[t-e.start]:[]));return r.length>0?((e,t,n)=>((e,t)=>A(e,(e=>({...e,start:e.start+t,finish:e.finish+t}))))(n(e,t),e.start))(e,r,n):[e]})),Ti=(e,t,n)=>({element:e,start:t,finish:n}),Ii=Lt([{include:["item"]},{excludeWith:["item"]},{excludeWithout:["item"]}]),Ai={include:Ii.include,excludeWith:Ii.excludeWith,excludeWithout:Ii.excludeWithout,cata:(e,t,n,r)=>e.fold(t,n,r)},Oi=Lt([{boundary:["item","universe"]},{empty:["item","universe"]},{text:["item","universe"]},{nonEditable:["item","universe"]}]),Ei=b,Li=x,Ni=m(0),_i=m(1),Di=e=>({...e,isBoundary:()=>e.fold(Li,Ei,Ei,Ei),toText:()=>e.fold(k.none,k.none,(e=>k.some(e)),k.none),is:t=>e.fold(Ei,Ei,((e,n)=>n.eq(e,t)),Ei),len:()=>e.fold(Ni,_i,((e,t)=>t.property().getText(e).length),_i)}),Pi={text:h(Di,Oi.text),boundary:h(Di,Oi.boundary),empty:h(Di,Oi.empty),nonEditable:h(Di,Oi.empty),cata:(e,t,n,r,o)=>e.fold(t,n,r,o)},Ri=m([]),Mi=(e,t,n)=>{if(e.property().isText(t))return[Pi.text(t,e)];if(e.property().isEmptyTag(t))return[Pi.empty(t,e)];if(e.property().isNonEditable(t))return[];if(e.property().isElement(t)){const r=e.property().children(t),o=e.property().isBoundary(t)?[Pi.boundary(t,e)]:[],s=void 0!==n&&n(t)?[]:R(r,(t=>Mi(e,t,n)));return o.concat(s).concat(o)}return[]},ji=Mi,Fi=(e,t,n)=>{const r=((e,t)=>{const n=[];let r=[];return O(e,(e=>{const o=t(e);Ai.cata(o,(()=>{r.push(e)}),(()=>{r.length>0&&n.push(r),n.push([e]),r=[]}),(()=>{r.length>0&&n.push(r),r=[]}))})),r.length>0&&n.push(r),n})(R(t,(t=>ji(e,t,n))),(e=>e.match({boundary:()=>Ai.excludeWithout(e),empty:()=>Ai.excludeWith(e),text:()=>Ai.include(e),nonEditable:()=>Ai.excludeWithout(e)})));return L(r,(e=>e.length>0))},Ui=(e,t,n)=>{const r=R(n,(e=>[e.start,e.finish])),o=Ci(t,r,((t,n)=>((e,t,n)=>{const r=e.property().getText(t),o=L(((e,t)=>{if(0===t.length)return[e];const n=N(t,((t,n)=>{if(0===n)return t;const r=e.substring(t.prev,n);return{prev:n,values:t.values.concat([r])}}),{prev:0,values:[]}),r=t[t.length-1];return re.length>0));if(o.length<=1)return[Ti(t,0,r.length)];e.property().setText(t,o[0]);const s=Si(o.slice(1),((t,n)=>{const r=e.create().text(t),o=Ti(r,n,n+t.length);return k.some(o)}),o[0].length),a=A(s,(e=>e.element));return e.insert().afterAll(t,a),[Ti(t,0,o[0].length)].concat(s)})(e,t.element,n)));return A(n,(t=>{const n=((e,t,n)=>{const r=wi(e,t),o=wi(e,n);return r.bind((t=>{const r=o.getOr(((e,t)=>e[e.length-1]&&e[e.length-1].finish===t?e.length+1:-1)(e,n));return r>-1?k.some(e.slice(t,r)):k.none()})).getOr([])})(o,t.start,t.finish),r=A(n,(e=>e.element)),s=A(r,e.property().getText).join("");return{elements:r,word:t.word,exact:s}}))},Bi=(e,t,n,r)=>{const o=Fi(e,t,r),s=R(o,(t=>{const r=R(t,(e=>e.fold(Ri,Ri,(e=>[e]),Ri))),o=((e,t)=>{const n=R(t,(t=>{const n=((e,t)=>{const n=t.term(),r=[];let o=n.exec(e);for(;o;){const s=o.index+t.prefix(o),a=o[0].length-t.prefix(o)-t.suffix(o);r.push({start:s,finish:s+a}),n.lastIndex=s+a,o=n.exec(e)}return r})(e,t.pattern);return A(n,(e=>({...t,...e})))}));return(e=>{const t=Array.prototype.slice.call(e,0);return t.sort(((e,t)=>e.startSi(t,((t,n)=>{const r=n+e.property().getText(t).length;return k.from(Ti(t,n,r))})))(e,r);return Ui(e,s,o)}));return s},zi={up:m({selector:Zn,closest:Qn,predicate:Jn,all:(e,t)=>{const n=c(t)?t:b;let r=e.dom;const o=[];for(;null!==r.parentNode&&void 0!==r.parentNode;){const e=r.parentNode,t=_e.fromDom(e);if(o.push(t),!0===n(t))break;r=e}return o}}),down:m({selector:Kt,predicate:qt}),styles:m({get:zn,getRaw:Wn,set:Un,remove:Vn}),attrs:m({get:Cn,set:wn,remove:An,copyTo:(e,t)=>{const n=N(e.dom.attributes,((e,t)=>(e[t.name]=t.value,e)),{});Sn(t,n)}}),insert:m({before:ln,after:cn,afterAll:mn,append:dn,appendAll:pn,prepend:un,wrap:hn}),remove:m({unwrap:vn,remove:gn}),create:m({nu:_e.fromTag,clone:e=>_e.fromDom(e.dom.cloneNode(!1)),text:_e.fromText}),query:m({comparePosition:(e,t)=>e.dom.compareDocumentPosition(t.dom),prevSibling:Ft,nextSibling:Ut}),property:m({children:zt,name:xe,parent:jt,document:e=>Rt(e).dom,isText:Te,isComment:Se,isElement:Ce,isSpecial:e=>{const t=xe(e);return T(["script","noscript","iframe","noframes","noembed","title","style","textarea","xmp"],t)},getLanguage:e=>Ce(e)?Tn(e,"lang"):k.none(),getText:qs,setText:(e,t)=>Gs.set(e,t),isBoundary:e=>!!Ce(e)&&("body"===xe(e)||T(ki,xe(e))),isEmptyTag:e=>!!Ce(e)&&T(["br","img","hr","input"],xe(e)),isNonEditable:e=>Ce(e)&&"false"===Cn(e,"contenteditable")}),eq:It,is:At},Hi=/(?:[A-Za-z][A-Za-z\d.+-]{0,14}:\/\/(?:[-.~*+=!&;:'%@?^${}(),\w]+@)?|www\.|[-;:&=+$,.\w]+@)[A-Za-z\d-]+(?:\.[A-Za-z\d-]+)*(?::\d+)?(?:\/(?:[-.~*+=!;:'%@$(),\/\w]*[-~*+=%@$()\/\w])?)?(?:\?(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?(?:#(?:[-.~*+=!&;:'%@?^${}(),\/\w]+))?/g.source,Wi=e=>!Qn(e,"a",undefined).isSome(),$i=(e,t)=>{const n=(e=>{return((e,t,n)=>Bi(zi,e,t,void 0))(e,[{word:"__INTERNAL__",pattern:(t=Hi,((e,t,n,r)=>({term:()=>new RegExp(e,r.getOr("g")),prefix:t,suffix:n}))(t,m(0),m(0),k.none()))}]);var t})(e);O(n,(e=>{const n=e.exact;if(n.indexOf("@")<0||Vi(n)){const r=H(n,"://")?n:`${t.defaultProtocol}://${n}`;((e,t)=>{k.from(e[0]).filter(Wi).map((n=>{const r=_e.fromTag("a");return ln(n,r),pn(r,e),wn(r,"href",t),r}))})(e.elements,r)}}))},Vi=e=>{const t=e.indexOf("://");return t>=3&&t<=9},Gi=(e,t)=>{O(e,(e=>{Ce(e)&&Wn(e,"position").isSome()&&Vn(e,"position")}))},qi=(e,t)=>{const n=L(e,Oe("li"));if(n.length>0){const t=Bt(n[0]),r=_e.fromTag("ul");if(ln(e[0],r),t.length>0){const e=_e.fromTag("li");dn(r,e),pn(e,t)}pn(r,n)}},Ki=(e,t)=>{const n=zt(e);O([$i,Gi,qi],(e=>{e(n,t)}))},Ji={disabled:()=>({discriminator:"disabled",data:{}}),fromClipboard:e=>({discriminator:"fromClipboard",data:{rtf:e}})},Yi=De(Ji),Xi=Ji.disabled,Zi=Ji.fromClipboard,Qi=e=>void 0!==e&&void 0!==e.types&&null!==e.types,el=(e,t)=>{const n=new RegExp(t,"i");return U(e,(e=>Rn(null!==n.exec(e),{type:e,flavor:t})))};function tl(e){return tl="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},tl(e)}function nl(e,t){return nl=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},nl(e,t)}function rl(e,t,n){return rl=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&nl(o,n.prototype),o},rl.apply(null,arguments)}function ol(e){return function(e){if(Array.isArray(e))return sl(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return sl(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?sl(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sl(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?n-1:0),o=1;o/gm),Gl=hl(/\${[\w\W]*}/gm),ql=hl(/^data-[\-\w.\u00B7-\uFFFF]/),Kl=hl(/^aria-[\-\w]+$/),Jl=hl(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Yl=hl(/^(?:\w+script|data):/i),Xl=hl(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Zl=hl(/^html$/i),Ql=function(){return"undefined"==typeof window?null:window},ec=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Ql(),n=function(t){return e(t)};if(n.version="2.4.7",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,o=t.document,s=t.DocumentFragment,a=t.HTMLTemplateElement,i=t.Node,l=t.Element,c=t.NodeFilter,u=t.NamedNodeMap,d=void 0===u?t.NamedNodeMap||t.MozNamedAttrMap:u,h=t.HTMLFormElement,m=t.DOMParser,p=t.trustedTypes,f=l.prototype,g=_l(f,"cloneNode"),v=_l(f,"nextSibling"),y=_l(f,"childNodes"),b=_l(f,"parentNode");if("function"==typeof a){var x=o.createElement("template");x.content&&x.content.ownerDocument&&(o=x.content.ownerDocument)}var k=function(e,t){if("object"!==tl(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 o="dompurify"+(n?"#"+n:"");try{return e.createPolicy(o,{createHTML:function(e){return e},createScriptURL:function(e){return e}})}catch(e){return console.warn("TrustedTypes policy "+o+" could not be created."),null}}(p,r),w=k?k.createHTML(""):"",S=o,C=S.implementation,T=S.createNodeIterator,I=S.createDocumentFragment,A=S.getElementsByTagName,O=r.importNode,E={};try{E=Nl(o).documentMode?o.documentMode:{}}catch(e){}var L={};n.isSupported="function"==typeof b&&C&&void 0!==C.createHTMLDocument&&9!==E;var N,_,D=$l,P=Vl,R=Gl,M=ql,j=Kl,F=Yl,U=Xl,B=Jl,z=null,H=Ll({},[].concat(ol(Dl),ol(Pl),ol(Rl),ol(jl),ol(Ul))),W=null,$=Ll({},[].concat(ol(Bl),ol(zl),ol(Hl),ol(Wl))),V=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),G=null,q=null,K=!0,J=!0,Y=!1,X=!0,Z=!1,Q=!1,ee=!1,te=!1,ne=!1,re=!1,oe=!1,se=!0,ae=!1,ie=!0,le=!1,ce={},ue=null,de=Ll({},["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"]),he=null,me=Ll({},["audio","video","img","source","image","track"]),pe=null,fe=Ll({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ge="http://www.w3.org/1998/Math/MathML",ve="http://www.w3.org/2000/svg",ye="http://www.w3.org/1999/xhtml",be=ye,xe=!1,ke=null,we=Ll({},[ge,ve,ye],wl),Se=["application/xhtml+xml","text/html"],Ce=null,Te=o.createElement("form"),Ie=function(e){return e instanceof RegExp||e instanceof Function},Ae=function(e){Ce&&Ce===e||(e&&"object"===tl(e)||(e={}),e=Nl(e),N=N=-1===Se.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,_="application/xhtml+xml"===N?wl:kl,z="ALLOWED_TAGS"in e?Ll({},e.ALLOWED_TAGS,_):H,W="ALLOWED_ATTR"in e?Ll({},e.ALLOWED_ATTR,_):$,ke="ALLOWED_NAMESPACES"in e?Ll({},e.ALLOWED_NAMESPACES,wl):we,pe="ADD_URI_SAFE_ATTR"in e?Ll(Nl(fe),e.ADD_URI_SAFE_ATTR,_):fe,he="ADD_DATA_URI_TAGS"in e?Ll(Nl(me),e.ADD_DATA_URI_TAGS,_):me,ue="FORBID_CONTENTS"in e?Ll({},e.FORBID_CONTENTS,_):de,G="FORBID_TAGS"in e?Ll({},e.FORBID_TAGS,_):{},q="FORBID_ATTR"in e?Ll({},e.FORBID_ATTR,_):{},ce="USE_PROFILES"in e&&e.USE_PROFILES,K=!1!==e.ALLOW_ARIA_ATTR,J=!1!==e.ALLOW_DATA_ATTR,Y=e.ALLOW_UNKNOWN_PROTOCOLS||!1,X=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Z=e.SAFE_FOR_TEMPLATES||!1,Q=e.WHOLE_DOCUMENT||!1,ne=e.RETURN_DOM||!1,re=e.RETURN_DOM_FRAGMENT||!1,oe=e.RETURN_TRUSTED_TYPE||!1,te=e.FORCE_BODY||!1,se=!1!==e.SANITIZE_DOM,ae=e.SANITIZE_NAMED_PROPS||!1,ie=!1!==e.KEEP_CONTENT,le=e.IN_PLACE||!1,B=e.ALLOWED_URI_REGEXP||B,be=e.NAMESPACE||ye,V=e.CUSTOM_ELEMENT_HANDLING||{},e.CUSTOM_ELEMENT_HANDLING&&Ie(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(V.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&Ie(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(V.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(V.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Z&&(J=!1),re&&(ne=!0),ce&&(z=Ll({},ol(Ul)),W=[],!0===ce.html&&(Ll(z,Dl),Ll(W,Bl)),!0===ce.svg&&(Ll(z,Pl),Ll(W,zl),Ll(W,Wl)),!0===ce.svgFilters&&(Ll(z,Rl),Ll(W,zl),Ll(W,Wl)),!0===ce.mathMl&&(Ll(z,jl),Ll(W,Hl),Ll(W,Wl))),e.ADD_TAGS&&(z===H&&(z=Nl(z)),Ll(z,e.ADD_TAGS,_)),e.ADD_ATTR&&(W===$&&(W=Nl(W)),Ll(W,e.ADD_ATTR,_)),e.ADD_URI_SAFE_ATTR&&Ll(pe,e.ADD_URI_SAFE_ATTR,_),e.FORBID_CONTENTS&&(ue===de&&(ue=Nl(ue)),Ll(ue,e.FORBID_CONTENTS,_)),ie&&(z["#text"]=!0),Q&&Ll(z,["html","head","body"]),z.table&&(Ll(z,["tbody"]),delete G.tbody),dl&&dl(e),Ce=e)},Oe=Ll({},["mi","mo","mn","ms","mtext"]),Ee=Ll({},["foreignobject","desc","title","annotation-xml"]),Le=Ll({},["title","style","font","a","script"]),Ne=Ll({},Pl);Ll(Ne,Rl),Ll(Ne,Ml);var _e=Ll({},jl);Ll(_e,Fl);var De=function(e){xl(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=w}catch(t){e.remove()}}},Pe=function(e,t){try{xl(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){xl(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!W[e])if(ne||re)try{De(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},Re=function(e){var t,n;if(te)e=""+e;else{var r=Sl(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===N&&be===ye&&(e=''+e+"");var s=k?k.createHTML(e):e;if(be===ye)try{t=(new m).parseFromString(s,N)}catch(e){}if(!t||!t.documentElement){t=C.createDocument(be,"template",null);try{t.documentElement.innerHTML=xe?w:s}catch(e){}}var a=t.body||t.documentElement;return e&&n&&a.insertBefore(o.createTextNode(n),a.childNodes[0]||null),be===ye?A.call(t,Q?"html":"body")[0]:Q?t.documentElement:a},Me=function(e){return T.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},je=function(e){return"object"===tl(i)?e instanceof i:e&&"object"===tl(e)&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},Fe=function(e,t,r){L[e]&&yl(L[e],(function(e){e.call(n,t,r,Ce)}))},Ue=function(e){var t,r;if(Fe("beforeSanitizeElements",e,null),(r=e)instanceof h&&("string"!=typeof r.nodeName||"string"!=typeof r.textContent||"function"!=typeof r.removeChild||!(r.attributes instanceof d)||"function"!=typeof r.removeAttribute||"function"!=typeof r.setAttribute||"string"!=typeof r.namespaceURI||"function"!=typeof r.insertBefore||"function"!=typeof r.hasChildNodes))return De(e),!0;if(Al(/[\u0080-\uFFFF]/,e.nodeName))return De(e),!0;var o=_(e.nodeName);if(Fe("uponSanitizeElement",e,{tagName:o,allowedTags:z}),e.hasChildNodes()&&!je(e.firstElementChild)&&(!je(e.content)||!je(e.content.firstElementChild))&&Al(/<[/\w]/g,e.innerHTML)&&Al(/<[/\w]/g,e.textContent))return De(e),!0;if("select"===o&&Al(/