useblocks 1.3.10 → 1.3.11-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/{iframe-eblock.5455e870.html → iframe-eblock.fd4347fc.html} +2 -2
- package/iframe/{iframe.5455e870.html → iframe.fd4347fc.html} +2 -2
- package/iframe/js/{elMarkupHelper.Cv72GdwF.js → elMarkupHelper.DLCHSWwj.js} +4 -4
- package/iframe/js/{iframe-eblock.body.5455e870.js → iframe-eblock.body.fd4347fc.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.5455e870.js → iframe.body.fd4347fc.js} +1 -1
- package/iframe/js/iframe.js +2 -2
- package/package.json +1 -1
- package/runtime/react/index.js +1 -1
- package/static/core/{710be2de.js → 12963ed5.js} +1 -1
- package/static/core/{7d2c1fd4.js → 13a6a2d3.js} +1 -1
- package/static/core/{f033fd82.js → 153a5a27.js} +1 -1
- package/static/core/{5a290fb6.js → 17c8ebc4.js} +1 -1
- package/static/core/{e7f50492.js → 1fcc0627.js} +1 -1
- package/static/core/{91017e83.js → 2865f716.js} +1 -1
- package/static/core/{c24c3d6b.js → 2d58a94b.js} +1 -1
- package/static/core/{e532cd8d.js → 31d22827.js} +1 -1
- package/static/core/{4030ef2c.js → 31da6da0.js} +1 -1
- package/static/core/{395f9635.js → 37bf0f7a.js} +1 -1
- package/static/core/{97db045b.js → 3a5bea82.js} +1 -1
- package/static/core/{7a43af5d.js → 3ca0af3d.js} +1 -1
- package/static/core/{9ccecd4a.js → 4181d334.js} +1 -1
- package/static/core/{8606910e.js → 4f5add14.js} +1 -1
- package/static/core/{84c5ed0d.js → 579d4466.js} +1 -1
- package/static/core/{7774d8cb.js → 5fd45688.js} +1 -1
- package/static/core/{dd82fe37.js → 66b856ca.js} +1 -1
- package/static/core/{d8d10299.js → 68e393e4.js} +6 -6
- package/static/core/{19270609.js → 6ec347ff.js} +1 -1
- package/static/core/{fe47306c.js → 70749936.js} +1 -1
- package/static/core/{4de0fff7.js → 752288e6.js} +1 -1
- package/static/core/{7da32d21.js → 78500214.js} +1 -1
- package/static/core/{eeba774d.js → 7934ed7e.js} +1 -1
- package/static/core/{acf08b55.js → 846cd365.js} +1 -1
- package/static/core/{9f336cc6.js → 8d0796c1.js} +1 -1
- package/static/core/{f615b5d9.js → 925b75fb.js} +2 -2
- package/static/core/{e0f9c94e.js → 939d4a62.js} +1 -1
- package/static/core/{bf6643b0.js → 9438888a.js} +1 -1
- package/static/core/{2cf7ee08.js → 983a408d.js} +1 -1
- package/static/core/{c8cfd469.js → 9916b298.js} +2 -2
- package/static/core/{ef13a2d7.js → 9d57053a.js} +1 -1
- package/static/core/{630febfd.js → ab741434.js} +1 -1
- package/static/core/{43305d10.js → ae251a52.js} +1 -1
- package/static/core/{4274a244.js → b0edd3a1.js} +1 -1
- package/static/core/{791b9022.js → bbf48eb9.js} +1 -1
- package/static/core/{cbfe265e.js → c33a9c36.js} +1 -1
- package/static/core/{4fec552e.js → c5128299.js} +1 -1
- package/static/core/{48def854.js → cc4657d9.js} +1 -1
- package/static/core/{c41fa010.js → d48488c4.js} +1 -1
- package/static/core/{32f12150.js → dda98b73.js} +1 -1
- package/static/core/{6539262f.js → e37da9a7.js} +1 -1
- package/static/core/{233f23fd.js → e9281a4c.js} +1 -1
- package/static/core/{38606c7d.js → f126c14c.js} +1 -1
- package/static/core/{a802b68f.js → f8f52e6d.js} +1 -1
- package/static/esm/{b6a1b54a.js → f97f42d1.js} +1 -1
- package/static/umd-runtime/runtime.CQCs2kHH.js +1 -0
- package/{useblocks-core.5455e870.js → useblocks-core.fd4347fc.js} +44 -44
- package/useblocks-esm.js +6 -6
- package/{useblocks-po.5455e870.js → useblocks-po.fd4347fc.js} +1 -1
- package/useblocks.d.ts +2 -2
- package/useblocks.js +8 -8
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/static/umd-runtime/runtime.C1l7PfWP.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__useblocks__.define("js/elMarkupHelper.Cv72GdwF.js",["require","exports","module"],function(id,F,une){var Ag=Object.defineProperty,Sr=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ie=(e,t)=>{let n={};for(var r in e)Ag(n,r,{get:e[r],enumerable:!0});return t||Ag(n,Symbol.toStringTag,{value:"Module"}),n};function Xi(e){"@babel/helpers - typeof";return Xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xi(e)}function nL(e,t){if(Xi(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Xi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rL(e){var t=nL(e,"string");return Xi(t)=="symbol"?t:t+""}function A(e,t,n){return(t=rL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kg;kg=Symbol.toStringTag;var sd=class{constructor(){A(this,"_valuesMap",new Map),A(this,kg,"Storage")}getItem(e){const t=String(e);return this._valuesMap.has(e)?String(this._valuesMap.get(t)):null}setItem(e,t){this._valuesMap.set(String(e),String(t))}removeItem(e){this._valuesMap.delete(e)}clear(){this._valuesMap.clear()}key(e){if(arguments.length===0)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this._valuesMap.keys())[e]}get length(){return this._valuesMap.size}};function Lg(){const e=new sd;return new Proxy(e,{set:function(t,n,r){return typeof n=="string"&&sd.prototype.hasOwnProperty(n)?e[n]=r:typeof n=="string"&&e.setItem(n,String(r)),!0},get:function(t,n){if(typeof n=="string"){if(sd.prototype.hasOwnProperty(n)){const r=e[n];if(typeof r=="function"){const o=r;return(...i)=>o.apply(e,i)}return r}return e.getItem(n)}}})}function Ng(){const e=Lg(),t=Lg();Object.defineProperty(window,"localStorage",{configurable:!0,enumerable:!0,get:()=>e}),Object.defineProperty(window,"sessionStorage",{configurable:!0,enumerable:!0,get:()=>t});let n=Object.create(null);Object.defineProperty(document,"cookie",{enumerable:!1,configurable:!0,get(){const r=[];for(var o in n)r.push(o+"="+n[o]);return r.join(";")},set(r){const o=r.indexOf("=");var i=r.substr(0,o),s=r.substring(o+1);return n[i]=s,i+"="+s}}),Object.defineProperty(document,"clearCookies",{enumerable:!1,configurable:!0,value:()=>n=Object.create(null)})}Ng();var xg=Symbol.for("emailmaker.commandInputPause");function Og(){const e=window,t=e[xg];if(t)return t;const n=new Set;return e[xg]=n,window.addEventListener("input",r=>n.forEach(o=>o(r)),!0),n}function oL(){Og()}function iL(e){const t=Og();return t.add(e),()=>{t.delete(e)}}oL();var Rg=class{constructor(e){A(this,"_voidElements",void 0),this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},Ct=(function(e){return e[e.StartCommentTag=0]="StartCommentTag",e[e.Comment=1]="Comment",e[e.EndCommentTag=2]="EndCommentTag",e[e.StartTagOpen=3]="StartTagOpen",e[e.StartTagClose=4]="StartTagClose",e[e.StartTagSelfClose=5]="StartTagSelfClose",e[e.StartTag=6]="StartTag",e[e.EndTagOpen=7]="EndTagOpen",e[e.EndTagClose=8]="EndTagClose",e[e.EndTag=9]="EndTag",e[e.DelimiterAssign=10]="DelimiterAssign",e[e.AttributeName=11]="AttributeName",e[e.AttributeValue=12]="AttributeValue",e[e.StartDoctypeTag=13]="StartDoctypeTag",e[e.Doctype=14]="Doctype",e[e.EndDoctypeTag=15]="EndDoctypeTag",e[e.Content=16]="Content",e[e.Whitespace=17]="Whitespace",e[e.Unknown=18]="Unknown",e[e.Script=19]="Script",e[e.Styles=20]="Styles",e[e.EOS=21]="EOS",e[e.BogusComment=22]="BogusComment",e[e.AdvancedStart=100]="AdvancedStart",e[e.AdvancedEnd=101]="AdvancedEnd",e})({}),sL=class{constructor(e,t){A(this,"source",void 0),A(this,"len",void 0),A(this,"position",void 0),this.source=e,this.len=e.length,this.position=t}eos(){return this.len<=this.position}getSource(){return this.source}pos(){return this.position}goBackTo(e){this.position=e}goBack(e){this.position-=e}advance(e){this.position+=e}goToEnd(){this.position=this.source.length}nextChar(){return this.source.charCodeAt(this.position++)||0}peekChar(e=0){return this.source.charCodeAt(this.position+e)||0}advanceIfChar(e){return e===this.source.charCodeAt(this.position)?(this.position++,!0):!1}advanceIfChars(e){let t;if(this.position+e.length>this.source.length)return!1;for(t=0;t<e.length;t++)if(this.source.charCodeAt(this.position+t)!==e[t])return!1;return this.advance(t),!0}advanceIfRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index+t[0].length,t[0]):""}advanceUntilRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index,t[0]):(this.goToEnd(),"")}advanceUntilChar(e){for(;this.position<this.source.length;){if(this.source.charCodeAt(this.position)===e)return!0;this.advance(1)}return!1}advanceUntilChars(e){for(;this.position+e.length<=this.source.length;){let t=0;for(;t<e.length&&this.source.charCodeAt(this.position+t)===e[t];t++);if(t===e.length)return!0;this.advance(1)}return this.goToEnd(),!1}skipWhitespace(){return this.advanceWhileChar(e=>e===dL||e===fL||e===lL||e===uL||e===cL)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},ad=33,Ro=45,Ki=60,tn=62,Yi=47,aL=61,Mg=34,Pg=39,lL=10,cL=13,uL=12,dL=32,fL=9,Ig=63,mL=65,hL=90,pL=97,gL=122;function Dg(e){return e>=pL&&e<=gL||e>=mL&&e<=hL}function Bg(e){return Dg(e)||e===Yi||e===ad||e===Ig}var ja="(?=[\\s/>])",bL=new RegExp(`<!--|-->|<\\/?script${ja}\\s*\\/?>?`,"i"),yL=new RegExp(`<\\/style${ja}`,"i"),vL={"text/x-handlebars-template":!0,"text/html":!0};function EL(e,t=0,n=0,r=!1){const o=new sL(e,t);let i=n,s=0,a=18,l,c,u=!1,d,f,h;function m(){return o.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function p(){const y=o.pos();for(;!o.eos();){const w=o.nextChar();if(w===tn)return!0;if(w===Ki)break;if(w===Mg||w===Pg){if(!o.advanceUntilChar(w))break;o.advance(1)}}return o.goBackTo(y),!1}function v(){for(;o.advanceUntilChar(Ki)&&!Bg(o.peekChar(1));)o.advance(1)}function C(y){return o.advanceUntilChar(tn)&&o.advance(1),L(y,22)}function k(){return o.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function L(y,w,b){return a=w,s=y,l=b,w}function E(){const y=o.pos(),w=i,b=g();return b!==21&&y===o.pos()&&!(r&&(b===4||b===8))?(o.advance(1),L(y,18)):b}function g(){const y=o.pos();if(o.eos())return L(y,21);let w;switch(i){case 6:return o.advanceIfChars([Ro,Ro,tn])?(i=0,L(y,2)):(o.advanceUntilChars([Ro,Ro,tn]),L(y,1));case 3:return o.advanceIfChar(tn)?(i=0,L(y,15)):(o.advanceUntilChar(tn),L(y,14));case 0:return o.peekChar()===Ki&&Bg(o.peekChar(1))?(o.advance(1),o.peekChar()===ad?o.advanceIfChars([ad,Ro,Ro])?(i=6,L(y,0)):o.advanceIfRegExp(/^!doctype/i)?(i=3,L(y,13)):C(y):o.peekChar()===Ig?C(y):o.advanceIfChar(Yi)?Dg(o.peekChar())?(i=2,L(y,7)):C(y):(i=1,L(y,3))):(v(),L(y,16));case 2:return m().length>0?(i=5,u=!1,L(y,9)):o.skipWhitespace()?L(y,17,"Tag name must directly follow the open bracket."):(i=5,o.advanceUntilChar(tn),y<o.pos()?L(y,18,"End tag name expected."):g());case 5:if(o.skipWhitespace())return u=!0,L(y,17);if(o.advanceIfChar(tn))return i=0,L(y,8);if(r&&o.peekChar()===Ki)return i=0,L(y,8,"Closing bracket missing.");if((u||o.peekChar()===Yi)&&p())return i=0,L(y,8);w="Closing bracket expected.";break;case 1:return d=m(),h=void 0,f=void 0,d.length>0?(c=!1,i=4,L(y,6)):o.skipWhitespace()?L(y,17,"Tag name must directly follow the open bracket."):(i=4,o.advanceUntilChar(tn),y<o.pos()?L(y,18,"Start tag name expected."):g());case 4:return o.skipWhitespace()?(c=!0,L(y,17)):c&&(f=k(),f.length>0)?(i=9,c=!1,L(y,11)):o.advanceIfChars([Yi,tn])?(i=0,L(y,5)):o.advanceIfChar(tn)?(d==="script"?h&&vL[h]?i=0:i=7:d==="style"?i=8:i=0,L(y,4)):r&&o.peekChar()===Ki?(i=0,L(y,4,"Closing bracket missing.")):(o.advance(1),L(y,18,"Unexpected character in tag."));case 9:return o.skipWhitespace()?(c=!0,L(y,17)):o.advanceIfChar(aL)?(i=10,L(y,10)):(i=4,g());case 10:if(o.skipWhitespace())return L(y,17);let b=o.advanceIfRegExp(/^[^\s"'`=<>]+/);if(b.length>0)return o.peekChar()===tn&&o.peekChar(-1)===Yi&&(o.goBack(1),b=b.substr(0,b.length-1)),f==="type"&&(h=b),i=4,c=!1,L(y,12);const S=o.peekChar();return S===Pg||S===Mg?(o.advance(1),o.advanceUntilChar(S)&&o.advance(1),f==="type"&&(h=o.getSource().substring(y+1,o.pos()-1)),i=4,c=!1,L(y,12)):(i=4,c=!1,g());case 7:let _=1;for(;!o.eos();){const T=o.advanceIfRegExp(bL);if(T.length===0)return o.goToEnd(),L(y,19);if(T==="<!--")_===1&&(_=2);else if(T==="-->")_=1;else if(T[1]!=="/")_===2&&(_=3);else if(_===3)_=2;else{o.goBack(T.length);break}}return i=0,y<o.pos()?L(y,19):g();case 8:return o.advanceUntilRegExp(yL),i=0,y<o.pos()?L(y,20):g()}return o.advance(1),i=0,L(y,18,w)}return{scan:E,getTokenType:()=>a,getTokenOffset:()=>s,getTokenLength:()=>o.pos()-s,getTokenEnd:()=>o.pos(),getTokenText:()=>o.getSource().substring(s,o.pos()),getScannerState:()=>i,getTokenError:()=>l}}function SL(e,t){return t||e.start!==e.end?`<!DOCTYPE${e.content}>`:""}function wL(e,t){const n=`<!DOCTYPE${e.content}>`;return e.start=t,e.endTagStart=e.startTagEnd=e.end=t+n.length,n}function _L(e,t){return t||e.start!==e.end?`<!--${e.content}-->`:""}function CL(e,t){const n=`<!--${e.content}-->`;return e.start=t,e.startTagEnd=t+4,e.end=t+n.length,e.endTagStart=e.end-3,n}var ld=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function TL(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}var Hg=Object.create(null);function AL(e,t){const n=Hg[e]||(Hg[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[TL(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function cd(e,t){if(e.start===e.end||t)return"";switch(e.type){case D.ELEMENT:return dd(e,t);case D.ROOT:return[...e.children].map(n=>cd(n,t)).join("");case D.DOCTYPE:return SL(e,t);case D.COMMENT:return _L(e,t);default:return e.content||""}}function ud(){return{exact:new WeakMap,collapsed:new WeakMap}}function Jn(e,t=!1,n){if(e.start===e.end&&e.type!==D.ROOT)return"";const r=n&&(t?n.collapsed:n.exact),o=r?.get(e);if(o!==void 0)return o;const i=()=>e.children.map(a=>Jn(a,t,n)).join("");let s;switch(e.type){case D.ELEMENT:{const a=e.tag?.toLowerCase();s=`<${a}${e.attributeNames.map(l=>` ${l}=${JSON.stringify(e.attributes?.[l]??null)}`).join("")}>${i()}</${a}>`;break}case D.ROOT:s=i();break;case D.COMMENT:s=`<!--${e.content??""}-->`;break;case D.DOCTYPE:s=`<!${e.content??""}>`;break;default:{const a=e.content??"";s=t?a.replace(/\s+/g," ").trim():a}}return r?.set(e,s),s}function Va(e,t=0){if(e.start===e.end)return"";switch(e.type){case D.ELEMENT:return LL(e,t);case D.ROOT:return $g(e,t);case D.DOCTYPE:return wL(e,t);case D.COMMENT:return CL(e,t);default:return e.start=e.startTagEnd=t,e.end=e.endTagStart=t+(e.content?.length||0),e.content||""}}function Fg(e){const t=e.tag?.toLowerCase();let n="";if(t){const r=e.attributes;if(r){const o=Object.keys(r);for(const i of o){const s=r[i]===null?"":r[i];typeof s=="string"&&(n+=s===""&&i!=="em"&&!AL(t,i)?` ${i}`:` ${i}="${s.replaceAll('"',"'")}"`)}}}return n}function kL(e,t){let n="";if(e.startTagEnd!==e.endTagStart||t)for(const r of e.children)n+=cd(r);return n}function $g(e,t){let n="";if(e.startTagEnd!==e.endTagStart)for(const r of e.children)n+=Va(r,t+n.length);return n}function Wg(e,t){if(e.start!==e.startTagEnd||t){const n=e.tag?.toLowerCase()||"div",r=Fg(e);return n==="vk-snippet-end"?`<${n}${r}/>`:`<${n}${r}>`}return""}function qg(e,t){return t||e.endTagStart!==e.end?`</${e.tag?.toLowerCase()||"div"}>`:""}function dd(e,t,n=!0){const r=e.tag?.toLowerCase()||"div",o=Wg(e,t);if(ld.has(r))return o;{const i=qg(e,t);return`${o}${n?kL(e,t):""}${i}`}}function LL(e,t){const n=e.tag?.toLowerCase()||"div",r=Wg(e);if(e.start=t,e.startTagEnd=t+r.length,ld.has(n)){e.endTagStart=e.startTagEnd,e.end=e.startTagEnd;const o=i=>{for(const s of i.children)s.start=s.startTagEnd=s.endTagStart=s.end=i.end,o(s)};return o(e),r}else{const o=$g(e,e.startTagEnd);e.endTagStart=e.startTagEnd+o.length;const i=qg(e);return e.end=e.endTagStart+i.length,`${r}${o}${i}`}}function fd(e,t){let n=0,r=e.length;if(r===0)return 0;for(;n<r;){const o=Math.floor((n+r)/2);t(e[o])?r=o:n=o+1}return n}var D=(function(e){return e[e.HTML=0]="HTML",e[e.ELEMENT=1]="ELEMENT",e[e.ROOT=2]="ROOT",e[e.COMMENT=3]="COMMENT",e[e.DOCTYPE=4]="DOCTYPE",e[e.ADVANCED=5]="ADVANCED",e})({}),Ga=e=>e.type===0?e.start-1:e.start,NL=e=>e.type===0?e.end+1:e.end,Tt=class Zk{get attributeNames(){return this.attributes?Object.keys(this.attributes):[]}get root(){return this.parent?this.parent.root:this}constructor(t,n,r,o){A(this,"start",void 0),A(this,"end",void 0),A(this,"children",void 0),A(this,"parent",void 0),A(this,"content",void 0),A(this,"type",1),A(this,"tag",void 0),A(this,"closed",!1),A(this,"startTagEnd",void 0),A(this,"endTagStart",void 0),A(this,"attributes",void 0),A(this,"createdBy",void 0),A(this,"isDirty",void 0),this.start=t,this.end=n,this.children=r,this.parent=o}isSameTag(t){return this.tag===void 0?t===void 0:t!==void 0&&this.tag.length===t.length&&this.tag.toLowerCase()===t}get firstChild(){return this.children[0]}get lastChild(){return this.children.length?this.children[this.children.length-1]:void 0}findNodeBefore(t){const n=fd(this.children,r=>t<=Ga(r))-1;if(n>=0){const r=this.children[n];if(t>Ga(r)){if(t<r.end)return r.findNodeBefore(t);const o=r.lastChild;return o&&o.end===r.end?r.findNodeBefore(t):r}}return this}findNodeAt(t){const n=fd(this.children,r=>t<=Ga(r))-1;if(n>=0){const r=this.children[n];if(t>=Ga(r)&&t<=NL(r))return r.findNodeAt(t)}return this}find(t){if(t(this))return this;for(const n of this.children){const r=n.find(t);if(r)return r}}closest(t){let n=this;do if(t(n))return n;while(n=n.parent)}parents(){return this.parent?[this.parent,...this.parent.parents()]:[]}closestFromRoot(t,n=!0){const r=n?[this,...this.parents()]:this.parents();for(let o=r.length-1;o>=0;o--){const i=r[o];if(t(i))return i}}contains(t){return!!t.closest(n=>n===this)}clone(t=this.parent,n=this.start,r=!0){const o=this.start-n,i=new Zk(n,this.end-o,[],t);return i.children=r?this.children.map(s=>s.clone(i,s.start-o)):[],i.attributes={...this.attributes},i.closed=this.closed,i.content=this.content,i.startTagEnd=this.startTagEnd,i.endTagStart=this.endTagStart,i.tag=this.tag,i.type=this.type,i}};function xL(e){if(typeof e=="string"){const t=e.startsWith("'")||e.startsWith('"')?1:0,n=e.endsWith("'")||e.endsWith('"')?e.length-1:e.length;return e.substring(t,n)}return e}var zg=class{constructor(e,t){A(this,"text",void 0),A(this,"type",void 0),A(this,"node",void 0),A(this,"replaces",void 0),this.text=e,this.type=t}get hasNode(){return!!this.node}addReplace(e){this.replaces?.push(e)}start(e,t,n){if(!this.node){const r=this.node=new Tt(e,this.text.length,[],n);r.type=this.type,r.startTagEnd=t,this.replaces=[]}}finish(e,t){const n=this.replaces,r=this.node,o=e+(t||0);if(n){for(const i of n){const s=i.parent;if(!s)throw new Error("parent not defined");const a=s.children.indexOf(i);s.children.splice(a,1)}this.replaces=void 0}if(r){const i=r.parent;if(!i)throw new Error("parent not defined");i.children.push(r),r.closed=t!==void 0,r.endTagStart=e,r.end=o,r.content=this.text.substring(r.startTagEnd,e),this.node=void 0}}},Ug=class{constructor(e){A(this,"dataManager",void 0),this.dataManager=e}parse(e,t=[]){const n=EL(e,void 0,void 0,!0),r=new Tt(0,e.length,[],void 0);r.type=D.ROOT;let o=r,i=-1,s,a=null,l=n.scan();const c=()=>{if(!o.tag){const p=o.parent.children,v=p[p.length-2],C=e.substring(o.start,o.end);v?.type===D.HTML?(v.content=(v.content||"")+C,v.end=o.end,p.splice(p.length-1,1)):(o.type=D.HTML,o.content=C,o.children=[]),o.type=D.HTML}o=o.parent},u=new zg(e,D.COMMENT),d=new zg(e,D.DOCTYPE),f=p=>{o.children.push(p)},h=(p,v)=>{const C=new Tt(p,v,[],o);C.type=D.HTML,C.content=e.substring(p,v),f(C)};for(;l!==Ct.EOS;){switch(l){case Ct.StartDoctypeTag:d.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case Ct.EndDoctypeTag:{const L=o.lastChild,E=d.node;if(!E)throw new Error("");const g=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(g!==E.start){const y=e.substring(g,E.start);if(y){const w=new Tt(g,E.start,[],o);w.type=D.HTML,w.content=y,f(w)}}d.finish(n.getTokenOffset(),n.getTokenLength());break}case Ct.StartCommentTag:u.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case Ct.EndCommentTag:{const L=o.lastChild,E=u.node;if(!E)throw new Error("");const g=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(g!==E.start){const y=e.substring(g,E.start);if(y){const w=new Tt(g,E.start,[],o);w.type=D.HTML,w.content=y,f(w)}}u.finish(n.getTokenOffset(),n.getTokenLength());break}case Ct.StartTagOpen:const p=o.lastChild,v=new Tt(n.getTokenOffset(),e.length,[],o),C=p?p.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(C!==v.start){const L=e.substring(C,v.start);if(L){const E=new Tt(C,v.start,[],o);E.type=D.HTML,E.content=L,f(E)}}f(v),o=v;break;case Ct.BogusComment:{const L=o.lastChild?.end??o.startTagEnd??o.start;L<n.getTokenOffset()&&h(L,n.getTokenOffset()),h(n.getTokenOffset(),n.getTokenEnd());break}case Ct.StartTag:o.tag=n.getTokenText();break;case Ct.StartTagClose:o.parent&&(o.end=n.getTokenEnd(),n.getTokenLength()?(o.startTagEnd=n.getTokenEnd(),o.tag&&this.dataManager.isVoidElement(o.tag)&&(o.closed=!0,c())):c());break;case Ct.StartTagSelfClose:o.parent&&(o.closed=!0,o.end=n.getTokenEnd(),o.startTagEnd=n.getTokenEnd(),c());break;case Ct.EndTagOpen:i=n.getTokenOffset(),s=void 0;break;case Ct.EndTag:s=n.getTokenText().toLowerCase();break;case Ct.EndTagClose:let k=o;for(;!k.isSameTag(s)&&k.parent;)k=k.parent;if(k.parent){const L=o.lastChild,E=L?L.end:o.startTagEnd===void 0?o.start:o.startTagEnd;if(E!==i){const g=e.substring(E,i);if(g){const y=new Tt(E,i,[],o);y.type=D.HTML,y.content=g,f(y)}}for(;o!==k;)o.end=i,o.closed=!1,c();o.closed=!0,o.endTagStart=i,o.end=n.getTokenEnd(),c()}break;case Ct.AttributeName:{a=n.getTokenText();let L=o.attributes;L||(o.attributes=L={}),L[a]=null;break}case Ct.AttributeValue:{const L=n.getTokenText(),E=o.attributes;E&&a&&(E[a]=xL(L),a=null);break}}l=n.scan()}for(;o.parent;)o.end=e.length,o.closed=!1,c();u.hasNode,u.finish(e.length);const m=r.lastChild?.end||0;if(m<e.length){const p=e.substring(m);if(p){const v=new Tt(m,e.length,[],r);v.type=D.HTML,v.content=p,f(v)}}return{roots:r.children,findNodeBefore:r.findNodeBefore.bind(r),findNodeAt:r.findNodeAt.bind(r)}}},dne=new Ug(new Rg(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),OL=new Rg(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),RL=new Ug(OL);function hn(e){return RL.parse(e)}var md=Symbol("bogusCommentSource");function wr(e){if(e){const t=document.createElement("div");t.insertAdjacentHTML("afterbegin",e);const n=t.firstChild??document.createTextNode("");return n.nodeType===Node.COMMENT_NODE&&ML(n,e),n}else return document.createTextNode("")}function ML(e,t){const n={source:t,data:e.data};Object.defineProperty(e,md,{value:n,configurable:!0})}function Zi(e){const t=e[md];return t&&t.data===e.data?t:void 0}function Xa(e){return Zi(e)?.source}function jg(e,t){if(e.nodeType===Node.COMMENT_NODE){t.push(e);return}(e.nodeName==="TEMPLATE"?e.content:e).childNodes.forEach(n=>jg(n,t))}function Ka(...e){const t=[];return e.forEach(n=>jg(n,t)),t}function PL(e,t){return e.data===t.data&&(e.parent===void 0||t.parent===void 0||e.parent===t.parent)}function Vg(e,t){Zi(e)||Object.defineProperty(e,md,{value:t,configurable:!0})}function IL(e){const t=new Map,n=new Set;for(const{data:r,mark:o}of e){const i=t.get(r);!o||i&&i.source!==o.source?n.add(r):i||t.set(r,o)}return n.forEach(r=>t.delete(r)),t}function DL(e,t,n){if(!t.length||!e.some(o=>o.mark))return;const r=[];for(let o=0;o+t.length<=e.length;o++)n.every((i,s)=>PL(e[o+s],i))&&r.push(o);if(!r.length){const o=IL(e);t.forEach(i=>{const s=o.get(i.data);s&&Vg(i,s)});return}t.forEach((o,i)=>{const s=r.map(l=>e[l+i].mark),[a]=s;a&&s.every(l=>l?.source===a.source)&&Vg(o,a)})}function Gg(e,t){const n=e.parentNode,r=n&&n.nodeType===Node.ELEMENT_NODE&&!t.includes(n);return{data:e.data,mark:Zi(e),parent:r?n.nodeName.toLowerCase():void 0}}function Xg(e,t,n){const r=Ka(...t),o=n?[...t,n]:t;DL(e,r,r.map(i=>Gg(i,o)))}function nn(e,t){Xg(Ka(e).map(n=>Gg(n,[e])),[t],null)}var BL=/<[!?]|<\/[^a-zA-Z]/,HL=/^<[!?/]/;function FL(e){const t=[],n=r=>{const o=r.parent?.tag?.toLowerCase();if(r.type===D.COMMENT)t.push({data:r.content??"",mark:void 0,parent:o});else if(r.type===D.HTML&&r.content&&HL.test(r.content)){const i=wr(r.content);i.nodeType===Node.COMMENT_NODE&&t.push({data:i.data,mark:Zi(i),parent:o})}r.children.forEach(n)};try{hn(e).roots.forEach(n)}catch{return[]}return t}function Kg(e,t,n=null){BL.test(t)&&Xg(FL(t),e,n)}function hd(e,t){Kg([e],t)}var Qi="",$L=4,Yg=0;function WL(){return Yg+=1,`${Math.random().toString(36).slice(2)}${Yg.toString(36)}`}function qL(e,t,n){if(e.split(`${Qi}${t}:`).length-1!==n.length)return;const r=e.split(new RegExp(`<!--${Qi}${t}:(\\d+)${Qi}-->`)),o=r.filter((i,s)=>s%2===1).map(Number);if(!(o.length!==n.length||new Set(o).size!==n.length||o.some(i=>i>=n.length)))return r.map((i,s)=>s%2?n[Number(i)]:i).join("")}function Ya(e,t,n){const r=Ka(e),o=r.map(l=>Zi(l)?.source);if(o.every(l=>l===void 0))return t?e.outerHTML:e.innerHTML;const i=n?e:e.cloneNode(!0),s=n?r:Ka(i),a=r.map(l=>l.data);for(let l=0;l<$L;l++){const c=WL(),u=[];s.forEach((f,h)=>{const m=o[h];m!==void 0&&(f.data=`${Qi}${c}:${u.length}${Qi}`,u.push(m))});const d=qL(t?i.outerHTML:i.innerHTML,c,u);if(d!==void 0)return d}return s.forEach((l,c)=>{l.data=a[c]}),t?i.outerHTML:i.innerHTML}function _r(e){return Ya(e,!0,!1)}function Ke(e){return Ya(e,!1,!1)}function Zg(e){return Ya(e,!0,!0)}function zL(e){return Ya(e,!1,!0)}function ke(e,t){e.innerHTML=t,hd(e,t)}function jt(e,t){ke(e,Ke(t))}function pd(e){Ji(e,Ke(e))}function Ji(e,t){const n=e.parentNode,r=e.previousSibling,o=e.nextSibling;if(e.outerHTML=t,!n)return;const i=[];for(let s=r?r.nextSibling:n.firstChild;s&&s!==o;s=s.nextSibling)i.push(s);Kg(i,t,n)}var Qg=new Set(["text/x-handlebars-template","text/html"]);function Za(e,t){if(e.type!==D.HTML||!t)return!1;const n=t.tag?.toLowerCase(),r=t.attributes?.type;return n==="style"||n==="script"&&!Qg.has(typeof r=="string"?r:"")}var UL={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function gd(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,n)=>UL[n])}var Jg=Symbol("rawTextSource");function bd(e){const t=document.createTextNode(gd(e));return eb(t,e),t}function eb(e,t){Object.defineProperty(e,Jg,{value:t,configurable:!0})}function jL(e,t){e.data=gd(t),eb(e,t)}function tb(e){const t=e[Jg];return t!==void 0&&gd(t)===e.textContent?t:void 0}var Mo,Jr;function nb(e){const t=Mo;return Mo=e,()=>{Mo===e&&(Mo=t)}}function VL(e){const t=Jr;return Jr=e,()=>{Jr===e&&(Jr=t)}}function rb(e,t,n){return Mo?Mo(e,t,n):n}function GL(){return Jr!==void 0}function ob(e,t,n){return Jr?Jr(e,t,n):n}var yd;function XL(){return yd||(yd=document.implementation.createHTMLDocument("")),yd}function KL(e,t){let n;switch(t?.toLowerCase()){case"tr":n=e.createElement("table");break;case"td":n=e.createElement("tr");break;case"head":case"body":n=e.createElement("html");break;case"documenttype":case"html":{const r=e.implementation.createHTMLDocument();for(const o of[...r.childNodes])o.remove();return r}default:n=e.createElement("div")}return n}var YL=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),ZL=new Set(["script","style","xmp"]);function QL(e,t){return!(t&&ZL.has(t.toLowerCase())||YL.has(e.toLowerCase()))}var JL=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},eN=new Set(["head","body"]);function ib(e,t,n){let r=e.tagName.toLowerCase();r==="html"&&(r="div");const o=`<${r} ${t}="${n}"/>`,i=XL(),s=eN.has(r)?KL(i,r):i.createElement("template");if(s instanceof Document)return;s.innerHTML=o;const a=(s.tagName==="TEMPLATE"?s.content:s).querySelector(r);if(!a)throw new Error("targetElement is not defined");const l=a.getAttributeNode(t);l&&e.setAttributeNode(l.cloneNode())}function er(e,t,n){try{QL(t,e.tagName)&&!JL(n)?e.setAttribute(t,n):ib(e,t,n)}catch{ib(e,t,n)}}function sb(){return wr("<script><\/script>")}var tN="text/x-em-dormant",es=Symbol("dormantScriptType");function vd(e){e[es]=e.getAttribute("type"),e.setAttribute("type",tN)}function Qa(e){return es in e}function nN(e){const t=[...e].filter(n=>!Qa(n));return t.forEach(vd),t}function rN(e,t){return Qa(e)?(e[es]=t,!0):!1}function ab(e){const t=new Set;for(const n of e){const r="querySelectorAll"in n?n.querySelectorAll("script"):[];for(const o of[n,...r])Qa(o)&&t.add(o)}return[...t]}function lb(e){if(!Qa(e))return;const t=e[es];delete e[es],typeof t=="string"?e.setAttribute("type",t):e.removeAttribute("type")}var oN=["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"];function iN(e){const t=e.getAttribute("type"),n=e.getAttribute("language");return t===""||t===null&&!n?"text/javascript":(t===null?`text/${n}`:t.trim()).toLowerCase()}function cb(e){const t=iN(e);return oN.includes(t)?"classic":t==="module"||t==="importmap"||t==="speculationrules"?t:void 0}function sN(e){return cb(e)==="classic"}function aN(e){const t=e.getAttribute("for"),n=e.getAttribute("event");return t===null||n===null?!0:t.trim().toLowerCase()==="window"&&["onload","onload()"].includes(n.trim().toLowerCase())}function lN(e){const t=cb(e);return!t||t==="speculationrules"||Ja(e)?!1:t!=="classic"||!e.hasAttribute("nomodule")&&aN(e)}function cN(e){return e.hasAttribute("src")&&!["async","defer","nomodule"].some(t=>e.hasAttribute(t))&&sN(e)}function Ja(e){for(let t=e.parentElement;t;t=t.parentElement)if(t.localName==="template"&&t.namespaceURI==="http://www.w3.org/1999/xhtml")return!0;return!1}function ub(e,t){const n=e.parentNode;!n||!e.isConnected||(e.hasAttribute("src")&&!e.hasAttribute("async")&&(e.async=!1),t.run(e,()=>n.insertBefore(e,e.nextSibling)))}function db(e,t){[...t.attributes].forEach(r=>t.removeAttributeNode(r)),[...e.attributes].forEach(r=>t.setAttributeNode(r.cloneNode()));const n=Object.getOwnPropertyDescriptor(e,"$$tagName");n&&!Object.getOwnPropertyDescriptor(t,"$$tagName")&&Object.defineProperty(t,"$$tagName",n)}function fb(e,t,n){e.replaceWith(t),t.append(...e.childNodes),n.substitute?.(e,t)}function mb(e,t){const n=sb();return db(e,n),t.quiet(()=>fb(e,n,t)),n}function uN(e,t,n){const r=mb(t,n),o=()=>{e.removeEventListener("load",o),e.removeEventListener("error",o),r.isConnected&&(n.quiet(()=>{db(r,t),vd(t),fb(r,t,n),lb(t)}),ub(t,n))};e.addEventListener("load",o),e.addEventListener("error",o)}function hb(e,t){e.forEach(lb);const n=e.filter(Ja),r=e.filter(i=>i.isConnected&&!Ja(i));if(!r.length&&!n.length)return;r.sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t.awake?.(),n.forEach(i=>mb(i,t));let o;for(const i of r)o&&!i.hasAttribute("src")?uN(o,i,t):(ub(i,t),o=cN(i)?i:o)}function eo(e,t=!0,n=!1){const r=e.content;switch(e.type){case D.ROOT:{const o=document.implementation.createHTMLDocument();for(const i of[...o.childNodes])o.removeChild(i);if(t)for(const i of e.children)o.appendChild(eo(i,!0,n));return o}case D.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case D.COMMENT:return document.createComment(r||"");case D.ELEMENT:if(e.tag){const o=e.tag.toLowerCase()==="script",i=n===!0&&o?sb():document.createElement(e.tag);if(Object.defineProperty(i,"$$tagName",{enumerable:!1,configurable:!1,value:e.tag}),e.attributes)for(const s of e.attributeNames){const a=e.attributes[s];try{const l=rb(i,s,typeof a=="string"?a:"");l!==null&&er(i,s,l)}catch{}}if(n==="dormant"&&o&&vd(i),t){const s=e.tag.toLowerCase()==="template"?!0:n;for(const a of e.children)i.appendChild(Za(a,e)?bd(a.content||""):eo(a,!0,s))}return i}return document.createTextNode("<");case D.HTML:return wr(r||"");default:throw new Error("unsupported node")}}function Le(e,t=!1){return hn(e).roots.map(n=>eo(n,!0,t))}function el(e,t,n){switch(t){case"afterend":e.after(...n);break;case"afterbegin":e.prepend(...n);break;case"beforeend":e.append(...n);break;case"beforebegin":e.before(...n)}}function pb(e,t){e.replaceChildren(...Le(t,!0))}function tr(e,t,n){el(e,t,Le(n,!0))}var gb=Symbol.for("emailmaker.documentWriteGuard"),ts=Symbol.for("emailmaker.documentWriteSink");function dN(e,t=document){const n=t,r=n[ts];return n[ts]=e,()=>{n[ts]===e&&(n[ts]=r)}}function fne(e){}function Ed(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0})}function fN(e,t,n){for(let r=e.writerOf.get(t);r;r=e.writerOf.get(r))if(r===n)return!0;return!1}function mN(e,t){let n=t;for(;n.nextSibling&&fN(e,n.nextSibling,t);)n=n.nextSibling;return n}function bb(e,t,n){if(!n.length)return;n.forEach(i=>e.writerOf.set(i,t));const r=()=>{for(const i of n){const s=t.parentNode;if(!s)return;s.insertBefore(i,mN(e,t).nextSibling)}},o=e.doc[ts];o?o(n,r,t):r()}function yb(e,t){return!!e&&e.type===D.ELEMENT&&!e.closed&&e.end===t}function hN(e,t){let n="";for(let r=e;yb(r,t);r=r.lastChild)n=`</${r.tag}>${n}`;return n}function pN(e){const t=hn(e).roots,n=t[t.length-1],r=yb(n,e.length);return{nodes:(r?t.slice(0,-1):t).map(o=>eo(o)),rest:r?e.slice(n.start):""}}function gN(e){const t=[...e.pending];e.pending.clear();for(const[n,r]of t){const o=hn(r).roots,i=r+hN(o[o.length-1],r.length);bb(e,n,hn(i).roots.map(s=>eo(s)))}}function vb(e,t,n){const r=e.doc.currentScript;if(!r?.parentNode){return}const{nodes:o,rest:i}=pN((e.pending.get(r)??"")+n);i?(e.pending.size||queueMicrotask(()=>gN(e)),e.pending.set(r,i)):e.pending.delete(r),bb(e,r,o)}function bN(e=document){const t=e;if(t[gb])return;t[gb]=!0;const n={doc:t,writerOf:new WeakMap,pending:new Map};Ed(e,"write",(...r)=>vb(n,"write",r.join(""))),Ed(e,"writeln",(...r)=>vb(n,"writeln",`${r.join("")}
|
|
1
|
+
__useblocks__.define("js/elMarkupHelper.DLCHSWwj.js",["require","exports","module"],function(id,F,une){var Ag=Object.defineProperty,Sr=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),ie=(e,t)=>{let n={};for(var r in e)Ag(n,r,{get:e[r],enumerable:!0});return t||Ag(n,Symbol.toStringTag,{value:"Module"}),n};function Xi(e){"@babel/helpers - typeof";return Xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xi(e)}function nL(e,t){if(Xi(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Xi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rL(e){var t=nL(e,"string");return Xi(t)=="symbol"?t:t+""}function A(e,t,n){return(t=rL(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var kg;kg=Symbol.toStringTag;var sd=class{constructor(){A(this,"_valuesMap",new Map),A(this,kg,"Storage")}getItem(e){const t=String(e);return this._valuesMap.has(e)?String(this._valuesMap.get(t)):null}setItem(e,t){this._valuesMap.set(String(e),String(t))}removeItem(e){this._valuesMap.delete(e)}clear(){this._valuesMap.clear()}key(e){if(arguments.length===0)throw new TypeError("Failed to execute 'key' on 'Storage': 1 argument required, but only 0 present.");return Array.from(this._valuesMap.keys())[e]}get length(){return this._valuesMap.size}};function Lg(){const e=new sd;return new Proxy(e,{set:function(t,n,r){return typeof n=="string"&&sd.prototype.hasOwnProperty(n)?e[n]=r:typeof n=="string"&&e.setItem(n,String(r)),!0},get:function(t,n){if(typeof n=="string"){if(sd.prototype.hasOwnProperty(n)){const r=e[n];if(typeof r=="function"){const o=r;return(...i)=>o.apply(e,i)}return r}return e.getItem(n)}}})}function Ng(){const e=Lg(),t=Lg();Object.defineProperty(window,"localStorage",{configurable:!0,enumerable:!0,get:()=>e}),Object.defineProperty(window,"sessionStorage",{configurable:!0,enumerable:!0,get:()=>t});let n=Object.create(null);Object.defineProperty(document,"cookie",{enumerable:!1,configurable:!0,get(){const r=[];for(var o in n)r.push(o+"="+n[o]);return r.join(";")},set(r){const o=r.indexOf("=");var i=r.substr(0,o),s=r.substring(o+1);return n[i]=s,i+"="+s}}),Object.defineProperty(document,"clearCookies",{enumerable:!1,configurable:!0,value:()=>n=Object.create(null)})}Ng();var xg=Symbol.for("emailmaker.commandInputPause");function Og(){const e=window,t=e[xg];if(t)return t;const n=new Set;return e[xg]=n,window.addEventListener("input",r=>n.forEach(o=>o(r)),!0),n}function oL(){Og()}function iL(e){const t=Og();return t.add(e),()=>{t.delete(e)}}oL();var Rg=class{constructor(e){A(this,"_voidElements",void 0),this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},Ct=(function(e){return e[e.StartCommentTag=0]="StartCommentTag",e[e.Comment=1]="Comment",e[e.EndCommentTag=2]="EndCommentTag",e[e.StartTagOpen=3]="StartTagOpen",e[e.StartTagClose=4]="StartTagClose",e[e.StartTagSelfClose=5]="StartTagSelfClose",e[e.StartTag=6]="StartTag",e[e.EndTagOpen=7]="EndTagOpen",e[e.EndTagClose=8]="EndTagClose",e[e.EndTag=9]="EndTag",e[e.DelimiterAssign=10]="DelimiterAssign",e[e.AttributeName=11]="AttributeName",e[e.AttributeValue=12]="AttributeValue",e[e.StartDoctypeTag=13]="StartDoctypeTag",e[e.Doctype=14]="Doctype",e[e.EndDoctypeTag=15]="EndDoctypeTag",e[e.Content=16]="Content",e[e.Whitespace=17]="Whitespace",e[e.Unknown=18]="Unknown",e[e.Script=19]="Script",e[e.Styles=20]="Styles",e[e.EOS=21]="EOS",e[e.BogusComment=22]="BogusComment",e[e.AdvancedStart=100]="AdvancedStart",e[e.AdvancedEnd=101]="AdvancedEnd",e})({}),sL=class{constructor(e,t){A(this,"source",void 0),A(this,"len",void 0),A(this,"position",void 0),this.source=e,this.len=e.length,this.position=t}eos(){return this.len<=this.position}getSource(){return this.source}pos(){return this.position}goBackTo(e){this.position=e}goBack(e){this.position-=e}advance(e){this.position+=e}goToEnd(){this.position=this.source.length}nextChar(){return this.source.charCodeAt(this.position++)||0}peekChar(e=0){return this.source.charCodeAt(this.position+e)||0}advanceIfChar(e){return e===this.source.charCodeAt(this.position)?(this.position++,!0):!1}advanceIfChars(e){let t;if(this.position+e.length>this.source.length)return!1;for(t=0;t<e.length;t++)if(this.source.charCodeAt(this.position+t)!==e[t])return!1;return this.advance(t),!0}advanceIfRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index+t[0].length,t[0]):""}advanceUntilRegExp(e){const t=this.source.substr(this.position).match(e);return t?(this.position=this.position+t.index,t[0]):(this.goToEnd(),"")}advanceUntilChar(e){for(;this.position<this.source.length;){if(this.source.charCodeAt(this.position)===e)return!0;this.advance(1)}return!1}advanceUntilChars(e){for(;this.position+e.length<=this.source.length;){let t=0;for(;t<e.length&&this.source.charCodeAt(this.position+t)===e[t];t++);if(t===e.length)return!0;this.advance(1)}return this.goToEnd(),!1}skipWhitespace(){return this.advanceWhileChar(e=>e===dL||e===fL||e===lL||e===uL||e===cL)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},ad=33,Ro=45,Ki=60,tn=62,Yi=47,aL=61,Mg=34,Pg=39,lL=10,cL=13,uL=12,dL=32,fL=9,Ig=63,mL=65,hL=90,pL=97,gL=122;function Dg(e){return e>=pL&&e<=gL||e>=mL&&e<=hL}function Bg(e){return Dg(e)||e===Yi||e===ad||e===Ig}var ja="(?=[\\s/>])",bL=new RegExp(`<!--|-->|<\\/?script${ja}\\s*\\/?>?`,"i"),yL=new RegExp(`<\\/style${ja}`,"i"),vL={"text/x-handlebars-template":!0,"text/html":!0};function EL(e,t=0,n=0,r=!1){const o=new sL(e,t);let i=n,s=0,a=18,l,c,u=!1,d,f,h;function m(){return o.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function p(){const y=o.pos();for(;!o.eos();){const w=o.nextChar();if(w===tn)return!0;if(w===Ki)break;if(w===Mg||w===Pg){if(!o.advanceUntilChar(w))break;o.advance(1)}}return o.goBackTo(y),!1}function v(){for(;o.advanceUntilChar(Ki)&&!Bg(o.peekChar(1));)o.advance(1)}function C(y){return o.advanceUntilChar(tn)&&o.advance(1),L(y,22)}function k(){return o.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function L(y,w,b){return a=w,s=y,l=b,w}function E(){const y=o.pos(),w=i,b=g();return b!==21&&y===o.pos()&&!(r&&(b===4||b===8))?(o.advance(1),L(y,18)):b}function g(){const y=o.pos();if(o.eos())return L(y,21);let w;switch(i){case 6:return o.advanceIfChars([Ro,Ro,tn])?(i=0,L(y,2)):(o.advanceUntilChars([Ro,Ro,tn]),L(y,1));case 3:return o.advanceIfChar(tn)?(i=0,L(y,15)):(o.advanceUntilChar(tn),L(y,14));case 0:return o.peekChar()===Ki&&Bg(o.peekChar(1))?(o.advance(1),o.peekChar()===ad?o.advanceIfChars([ad,Ro,Ro])?(i=6,L(y,0)):o.advanceIfRegExp(/^!doctype/i)?(i=3,L(y,13)):C(y):o.peekChar()===Ig?C(y):o.advanceIfChar(Yi)?Dg(o.peekChar())?(i=2,L(y,7)):C(y):(i=1,L(y,3))):(v(),L(y,16));case 2:return m().length>0?(i=5,u=!1,L(y,9)):o.skipWhitespace()?L(y,17,"Tag name must directly follow the open bracket."):(i=5,o.advanceUntilChar(tn),y<o.pos()?L(y,18,"End tag name expected."):g());case 5:if(o.skipWhitespace())return u=!0,L(y,17);if(o.advanceIfChar(tn))return i=0,L(y,8);if(r&&o.peekChar()===Ki)return i=0,L(y,8,"Closing bracket missing.");if((u||o.peekChar()===Yi)&&p())return i=0,L(y,8);w="Closing bracket expected.";break;case 1:return d=m(),h=void 0,f=void 0,d.length>0?(c=!1,i=4,L(y,6)):o.skipWhitespace()?L(y,17,"Tag name must directly follow the open bracket."):(i=4,o.advanceUntilChar(tn),y<o.pos()?L(y,18,"Start tag name expected."):g());case 4:return o.skipWhitespace()?(c=!0,L(y,17)):c&&(f=k(),f.length>0)?(i=9,c=!1,L(y,11)):o.advanceIfChars([Yi,tn])?(i=0,L(y,5)):o.advanceIfChar(tn)?(d==="script"?h&&vL[h]?i=0:i=7:d==="style"?i=8:i=0,L(y,4)):r&&o.peekChar()===Ki?(i=0,L(y,4,"Closing bracket missing.")):(o.advance(1),L(y,18,"Unexpected character in tag."));case 9:return o.skipWhitespace()?(c=!0,L(y,17)):o.advanceIfChar(aL)?(i=10,L(y,10)):(i=4,g());case 10:if(o.skipWhitespace())return L(y,17);let b=o.advanceIfRegExp(/^[^\s"'`=<>]+/);if(b.length>0)return o.peekChar()===tn&&o.peekChar(-1)===Yi&&(o.goBack(1),b=b.substr(0,b.length-1)),f==="type"&&(h=b),i=4,c=!1,L(y,12);const S=o.peekChar();return S===Pg||S===Mg?(o.advance(1),o.advanceUntilChar(S)&&o.advance(1),f==="type"&&(h=o.getSource().substring(y+1,o.pos()-1)),i=4,c=!1,L(y,12)):(i=4,c=!1,g());case 7:let _=1;for(;!o.eos();){const T=o.advanceIfRegExp(bL);if(T.length===0)return o.goToEnd(),L(y,19);if(T==="<!--")_===1&&(_=2);else if(T==="-->")_=1;else if(T[1]!=="/")_===2&&(_=3);else if(_===3)_=2;else{o.goBack(T.length);break}}return i=0,y<o.pos()?L(y,19):g();case 8:return o.advanceUntilRegExp(yL),i=0,y<o.pos()?L(y,20):g()}return o.advance(1),i=0,L(y,18,w)}return{scan:E,getTokenType:()=>a,getTokenOffset:()=>s,getTokenLength:()=>o.pos()-s,getTokenEnd:()=>o.pos(),getTokenText:()=>o.getSource().substring(s,o.pos()),getScannerState:()=>i,getTokenError:()=>l}}function SL(e,t){return t||e.start!==e.end?`<!DOCTYPE${e.content}>`:""}function wL(e,t){const n=`<!DOCTYPE${e.content}>`;return e.start=t,e.endTagStart=e.startTagEnd=e.end=t+n.length,n}function _L(e,t){return t||e.start!==e.end?`<!--${e.content}-->`:""}function CL(e,t){const n=`<!--${e.content}-->`;return e.start=t,e.startTagEnd=t+4,e.end=t+n.length,e.endTagStart=e.end-3,n}var ld=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function TL(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}var Hg=Object.create(null);function AL(e,t){const n=Hg[e]||(Hg[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[TL(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function cd(e,t){if(e.start===e.end||t)return"";switch(e.type){case D.ELEMENT:return dd(e,t);case D.ROOT:return[...e.children].map(n=>cd(n,t)).join("");case D.DOCTYPE:return SL(e,t);case D.COMMENT:return _L(e,t);default:return e.content||""}}function ud(){return{exact:new WeakMap,collapsed:new WeakMap}}function Jn(e,t=!1,n){if(e.start===e.end&&e.type!==D.ROOT)return"";const r=n&&(t?n.collapsed:n.exact),o=r?.get(e);if(o!==void 0)return o;const i=()=>e.children.map(a=>Jn(a,t,n)).join("");let s;switch(e.type){case D.ELEMENT:{const a=e.tag?.toLowerCase();s=`<${a}${e.attributeNames.map(l=>` ${l}=${JSON.stringify(e.attributes?.[l]??null)}`).join("")}>${i()}</${a}>`;break}case D.ROOT:s=i();break;case D.COMMENT:s=`<!--${e.content??""}-->`;break;case D.DOCTYPE:s=`<!${e.content??""}>`;break;default:{const a=e.content??"";s=t?a.replace(/\s+/g," ").trim():a}}return r?.set(e,s),s}function Va(e,t=0){if(e.start===e.end)return"";switch(e.type){case D.ELEMENT:return LL(e,t);case D.ROOT:return $g(e,t);case D.DOCTYPE:return wL(e,t);case D.COMMENT:return CL(e,t);default:return e.start=e.startTagEnd=t,e.end=e.endTagStart=t+(e.content?.length||0),e.content||""}}function Fg(e){const t=e.tag?.toLowerCase();let n="";if(t){const r=e.attributes;if(r){const o=Object.keys(r);for(const i of o){const s=r[i]===null?"":r[i];typeof s=="string"&&(n+=s===""&&i!=="em"&&!AL(t,i)?` ${i}`:` ${i}="${s.replaceAll('"',"'")}"`)}}}return n}function kL(e,t){let n="";if(e.startTagEnd!==e.endTagStart||t)for(const r of e.children)n+=cd(r);return n}function $g(e,t){let n="";if(e.startTagEnd!==e.endTagStart)for(const r of e.children)n+=Va(r,t+n.length);return n}function Wg(e,t){if(e.start!==e.startTagEnd||t){const n=e.tag?.toLowerCase()||"div",r=Fg(e);return n==="vk-snippet-end"?`<${n}${r}/>`:`<${n}${r}>`}return""}function qg(e,t){return t||e.endTagStart!==e.end?`</${e.tag?.toLowerCase()||"div"}>`:""}function dd(e,t,n=!0){const r=e.tag?.toLowerCase()||"div",o=Wg(e,t);if(ld.has(r))return o;{const i=qg(e,t);return`${o}${n?kL(e,t):""}${i}`}}function LL(e,t){const n=e.tag?.toLowerCase()||"div",r=Wg(e);if(e.start=t,e.startTagEnd=t+r.length,ld.has(n)){e.endTagStart=e.startTagEnd,e.end=e.startTagEnd;const o=i=>{for(const s of i.children)s.start=s.startTagEnd=s.endTagStart=s.end=i.end,o(s)};return o(e),r}else{const o=$g(e,e.startTagEnd);e.endTagStart=e.startTagEnd+o.length;const i=qg(e);return e.end=e.endTagStart+i.length,`${r}${o}${i}`}}function fd(e,t){let n=0,r=e.length;if(r===0)return 0;for(;n<r;){const o=Math.floor((n+r)/2);t(e[o])?r=o:n=o+1}return n}var D=(function(e){return e[e.HTML=0]="HTML",e[e.ELEMENT=1]="ELEMENT",e[e.ROOT=2]="ROOT",e[e.COMMENT=3]="COMMENT",e[e.DOCTYPE=4]="DOCTYPE",e[e.ADVANCED=5]="ADVANCED",e})({}),Ga=e=>e.type===0?e.start-1:e.start,NL=e=>e.type===0?e.end+1:e.end,Tt=class Zk{get attributeNames(){return this.attributes?Object.keys(this.attributes):[]}get root(){return this.parent?this.parent.root:this}constructor(t,n,r,o){A(this,"start",void 0),A(this,"end",void 0),A(this,"children",void 0),A(this,"parent",void 0),A(this,"content",void 0),A(this,"type",1),A(this,"tag",void 0),A(this,"closed",!1),A(this,"startTagEnd",void 0),A(this,"endTagStart",void 0),A(this,"attributes",void 0),A(this,"createdBy",void 0),A(this,"isDirty",void 0),this.start=t,this.end=n,this.children=r,this.parent=o}isSameTag(t){return this.tag===void 0?t===void 0:t!==void 0&&this.tag.length===t.length&&this.tag.toLowerCase()===t}get firstChild(){return this.children[0]}get lastChild(){return this.children.length?this.children[this.children.length-1]:void 0}findNodeBefore(t){const n=fd(this.children,r=>t<=Ga(r))-1;if(n>=0){const r=this.children[n];if(t>Ga(r)){if(t<r.end)return r.findNodeBefore(t);const o=r.lastChild;return o&&o.end===r.end?r.findNodeBefore(t):r}}return this}findNodeAt(t){const n=fd(this.children,r=>t<=Ga(r))-1;if(n>=0){const r=this.children[n];if(t>=Ga(r)&&t<=NL(r))return r.findNodeAt(t)}return this}find(t){if(t(this))return this;for(const n of this.children){const r=n.find(t);if(r)return r}}closest(t){let n=this;do if(t(n))return n;while(n=n.parent)}parents(){return this.parent?[this.parent,...this.parent.parents()]:[]}closestFromRoot(t,n=!0){const r=n?[this,...this.parents()]:this.parents();for(let o=r.length-1;o>=0;o--){const i=r[o];if(t(i))return i}}contains(t){return!!t.closest(n=>n===this)}clone(t=this.parent,n=this.start,r=!0){const o=this.start-n,i=new Zk(n,this.end-o,[],t);return i.children=r?this.children.map(s=>s.clone(i,s.start-o)):[],i.attributes={...this.attributes},i.closed=this.closed,i.content=this.content,i.startTagEnd=this.startTagEnd,i.endTagStart=this.endTagStart,i.tag=this.tag,i.type=this.type,i}};function xL(e){if(typeof e=="string"){const t=e.startsWith("'")||e.startsWith('"')?1:0,n=e.endsWith("'")||e.endsWith('"')?e.length-1:e.length;return e.substring(t,n)}return e}var zg=class{constructor(e,t){A(this,"text",void 0),A(this,"type",void 0),A(this,"node",void 0),A(this,"replaces",void 0),this.text=e,this.type=t}get hasNode(){return!!this.node}addReplace(e){this.replaces?.push(e)}start(e,t,n){if(!this.node){const r=this.node=new Tt(e,this.text.length,[],n);r.type=this.type,r.startTagEnd=t,this.replaces=[]}}finish(e,t){const n=this.replaces,r=this.node,o=e+(t||0);if(n){for(const i of n){const s=i.parent;if(!s)throw new Error("parent not defined");const a=s.children.indexOf(i);s.children.splice(a,1)}this.replaces=void 0}if(r){const i=r.parent;if(!i)throw new Error("parent not defined");i.children.push(r),r.closed=t!==void 0,r.endTagStart=e,r.end=o,r.content=this.text.substring(r.startTagEnd,e),this.node=void 0}}},Ug=class{constructor(e){A(this,"dataManager",void 0),this.dataManager=e}parse(e,t=[]){const n=EL(e,void 0,void 0,!0),r=new Tt(0,e.length,[],void 0);r.type=D.ROOT;let o=r,i=-1,s,a=null,l=n.scan();const c=()=>{if(!o.tag){const p=o.parent.children,v=p[p.length-2],C=e.substring(o.start,o.end);v?.type===D.HTML?(v.content=(v.content||"")+C,v.end=o.end,p.splice(p.length-1,1)):(o.type=D.HTML,o.content=C,o.children=[]),o.type=D.HTML}o=o.parent},u=new zg(e,D.COMMENT),d=new zg(e,D.DOCTYPE),f=p=>{o.children.push(p)},h=(p,v)=>{const C=new Tt(p,v,[],o);C.type=D.HTML,C.content=e.substring(p,v),f(C)};for(;l!==Ct.EOS;){switch(l){case Ct.StartDoctypeTag:d.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case Ct.EndDoctypeTag:{const L=o.lastChild,E=d.node;if(!E)throw new Error("");const g=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(g!==E.start){const y=e.substring(g,E.start);if(y){const w=new Tt(g,E.start,[],o);w.type=D.HTML,w.content=y,f(w)}}d.finish(n.getTokenOffset(),n.getTokenLength());break}case Ct.StartCommentTag:u.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case Ct.EndCommentTag:{const L=o.lastChild,E=u.node;if(!E)throw new Error("");const g=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(g!==E.start){const y=e.substring(g,E.start);if(y){const w=new Tt(g,E.start,[],o);w.type=D.HTML,w.content=y,f(w)}}u.finish(n.getTokenOffset(),n.getTokenLength());break}case Ct.StartTagOpen:const p=o.lastChild,v=new Tt(n.getTokenOffset(),e.length,[],o),C=p?p.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(C!==v.start){const L=e.substring(C,v.start);if(L){const E=new Tt(C,v.start,[],o);E.type=D.HTML,E.content=L,f(E)}}f(v),o=v;break;case Ct.BogusComment:{const L=o.lastChild?.end??o.startTagEnd??o.start;L<n.getTokenOffset()&&h(L,n.getTokenOffset()),h(n.getTokenOffset(),n.getTokenEnd());break}case Ct.StartTag:o.tag=n.getTokenText();break;case Ct.StartTagClose:o.parent&&(o.end=n.getTokenEnd(),n.getTokenLength()?(o.startTagEnd=n.getTokenEnd(),o.tag&&this.dataManager.isVoidElement(o.tag)&&(o.closed=!0,c())):c());break;case Ct.StartTagSelfClose:o.parent&&(o.closed=!0,o.end=n.getTokenEnd(),o.startTagEnd=n.getTokenEnd(),c());break;case Ct.EndTagOpen:i=n.getTokenOffset(),s=void 0;break;case Ct.EndTag:s=n.getTokenText().toLowerCase();break;case Ct.EndTagClose:let k=o;for(;!k.isSameTag(s)&&k.parent;)k=k.parent;if(k.parent){const L=o.lastChild,E=L?L.end:o.startTagEnd===void 0?o.start:o.startTagEnd;if(E!==i){const g=e.substring(E,i);if(g){const y=new Tt(E,i,[],o);y.type=D.HTML,y.content=g,f(y)}}for(;o!==k;)o.end=i,o.closed=!1,c();o.closed=!0,o.endTagStart=i,o.end=n.getTokenEnd(),c()}break;case Ct.AttributeName:{a=n.getTokenText();let L=o.attributes;L||(o.attributes=L={}),L[a]=null;break}case Ct.AttributeValue:{const L=n.getTokenText(),E=o.attributes;E&&a&&(E[a]=xL(L),a=null);break}}l=n.scan()}for(;o.parent;)o.end=e.length,o.closed=!1,c();u.hasNode,u.finish(e.length);const m=r.lastChild?.end||0;if(m<e.length){const p=e.substring(m);if(p){const v=new Tt(m,e.length,[],r);v.type=D.HTML,v.content=p,f(v)}}return{roots:r.children,findNodeBefore:r.findNodeBefore.bind(r),findNodeAt:r.findNodeAt.bind(r)}}},dne=new Ug(new Rg(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),OL=new Rg(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),RL=new Ug(OL);function hn(e){return RL.parse(e)}var md=Symbol("bogusCommentSource");function wr(e){if(e){const t=document.createElement("div");t.insertAdjacentHTML("afterbegin",e);const n=t.firstChild??document.createTextNode("");return n.nodeType===Node.COMMENT_NODE&&ML(n,e),n}else return document.createTextNode("")}function ML(e,t){const n={source:t,data:e.data};Object.defineProperty(e,md,{value:n,configurable:!0})}function Zi(e){const t=e[md];return t&&t.data===e.data?t:void 0}function Xa(e){return Zi(e)?.source}function jg(e,t){if(e.nodeType===Node.COMMENT_NODE){t.push(e);return}(e.nodeName==="TEMPLATE"?e.content:e).childNodes.forEach(n=>jg(n,t))}function Ka(...e){const t=[];return e.forEach(n=>jg(n,t)),t}function PL(e,t){return e.data===t.data&&(e.parent===void 0||t.parent===void 0||e.parent===t.parent)}function Vg(e,t){Zi(e)||Object.defineProperty(e,md,{value:t,configurable:!0})}function IL(e){const t=new Map,n=new Set;for(const{data:r,mark:o}of e){const i=t.get(r);!o||i&&i.source!==o.source?n.add(r):i||t.set(r,o)}return n.forEach(r=>t.delete(r)),t}function DL(e,t,n){if(!t.length||!e.some(o=>o.mark))return;const r=[];for(let o=0;o+t.length<=e.length;o++)n.every((i,s)=>PL(e[o+s],i))&&r.push(o);if(!r.length){const o=IL(e);t.forEach(i=>{const s=o.get(i.data);s&&Vg(i,s)});return}t.forEach((o,i)=>{const s=r.map(l=>e[l+i].mark),[a]=s;a&&s.every(l=>l?.source===a.source)&&Vg(o,a)})}function Gg(e,t){const n=e.parentNode,r=n&&n.nodeType===Node.ELEMENT_NODE&&!t.includes(n);return{data:e.data,mark:Zi(e),parent:r?n.nodeName.toLowerCase():void 0}}function Xg(e,t,n){const r=Ka(...t),o=n?[...t,n]:t;DL(e,r,r.map(i=>Gg(i,o)))}function nn(e,t){Xg(Ka(e).map(n=>Gg(n,[e])),[t],null)}var BL=/<[!?]|<\/[^a-zA-Z]/,HL=/^<[!?/]/;function FL(e){const t=[],n=r=>{const o=r.parent?.tag?.toLowerCase();if(r.type===D.COMMENT)t.push({data:r.content??"",mark:void 0,parent:o});else if(r.type===D.HTML&&r.content&&HL.test(r.content)){const i=wr(r.content);i.nodeType===Node.COMMENT_NODE&&t.push({data:i.data,mark:Zi(i),parent:o})}r.children.forEach(n)};try{hn(e).roots.forEach(n)}catch{return[]}return t}function Kg(e,t,n=null){BL.test(t)&&Xg(FL(t),e,n)}function hd(e,t){Kg([e],t)}var Qi="",$L=4,Yg=0;function WL(){return Yg+=1,`${Math.random().toString(36).slice(2)}${Yg.toString(36)}`}function qL(e,t,n){if(e.split(`${Qi}${t}:`).length-1!==n.length)return;const r=e.split(new RegExp(`<!--${Qi}${t}:(\\d+)${Qi}-->`)),o=r.filter((i,s)=>s%2===1).map(Number);if(!(o.length!==n.length||new Set(o).size!==n.length||o.some(i=>i>=n.length)))return r.map((i,s)=>s%2?n[Number(i)]:i).join("")}function Ya(e,t,n){const r=Ka(e),o=r.map(l=>Zi(l)?.source);if(o.every(l=>l===void 0))return t?e.outerHTML:e.innerHTML;const i=n?e:e.cloneNode(!0),s=n?r:Ka(i),a=r.map(l=>l.data);for(let l=0;l<$L;l++){const c=WL(),u=[];s.forEach((f,h)=>{const m=o[h];m!==void 0&&(f.data=`${Qi}${c}:${u.length}${Qi}`,u.push(m))});const d=qL(t?i.outerHTML:i.innerHTML,c,u);if(d!==void 0)return d}return s.forEach((l,c)=>{l.data=a[c]}),t?i.outerHTML:i.innerHTML}function _r(e){return Ya(e,!0,!1)}function Ke(e){return Ya(e,!1,!1)}function Zg(e){return Ya(e,!0,!0)}function zL(e){return Ya(e,!1,!0)}function ke(e,t){e.innerHTML=t,hd(e,t)}function jt(e,t){ke(e,Ke(t))}function pd(e){Ji(e,Ke(e))}function Ji(e,t){const n=e.parentNode,r=e.previousSibling,o=e.nextSibling;if(e.outerHTML=t,!n)return;const i=[];for(let s=r?r.nextSibling:n.firstChild;s&&s!==o;s=s.nextSibling)i.push(s);Kg(i,t,n)}var Qg=new Set(["text/x-handlebars-template","text/html"]);function Za(e,t){if(e.type!==D.HTML||!t)return!1;const n=t.tag?.toLowerCase(),r=t.attributes?.type;return n==="style"||n==="script"&&!Qg.has(typeof r=="string"?r:"")}var UL={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function gd(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,n)=>UL[n])}var Jg=Symbol("rawTextSource");function bd(e){const t=document.createTextNode(gd(e));return eb(t,e),t}function eb(e,t){Object.defineProperty(e,Jg,{value:t,configurable:!0})}function jL(e,t){e.data=gd(t),eb(e,t)}function tb(e){const t=e[Jg];return t!==void 0&&gd(t)===e.textContent?t:void 0}var Mo,Jr;function nb(e){const t=Mo;return Mo=e,()=>{Mo===e&&(Mo=t)}}function VL(e){const t=Jr;return Jr=e,()=>{Jr===e&&(Jr=t)}}function rb(e,t,n){return Mo?Mo(e,t,n):n}function GL(){return Jr!==void 0}function ob(e,t,n){return Jr?Jr(e,t,n):n}var yd;function XL(){return yd||(yd=document.implementation.createHTMLDocument("")),yd}function KL(e,t){let n;switch(t?.toLowerCase()){case"tr":n=e.createElement("table");break;case"td":n=e.createElement("tr");break;case"head":case"body":n=e.createElement("html");break;case"documenttype":case"html":{const r=e.implementation.createHTMLDocument();for(const o of[...r.childNodes])o.remove();return r}default:n=e.createElement("div")}return n}var YL=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),ZL=new Set(["script","style","xmp"]);function QL(e,t){return!(t&&ZL.has(t.toLowerCase())||YL.has(e.toLowerCase()))}var JL=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},eN=new Set(["head","body"]);function ib(e,t,n){let r=e.tagName.toLowerCase();r==="html"&&(r="div");const o=`<${r} ${t}="${n}"/>`,i=XL(),s=eN.has(r)?KL(i,r):i.createElement("template");if(s instanceof Document)return;s.innerHTML=o;const a=(s.tagName==="TEMPLATE"?s.content:s).querySelector(r);if(!a)throw new Error("targetElement is not defined");const l=a.getAttributeNode(t);l&&e.setAttributeNode(l.cloneNode())}function er(e,t,n){try{QL(t,e.tagName)&&!JL(n)?e.setAttribute(t,n):ib(e,t,n)}catch{ib(e,t,n)}}function sb(){return wr("<script><\/script>")}var tN="text/x-em-dormant",es=Symbol("dormantScriptType");function vd(e){e[es]=e.getAttribute("type"),e.setAttribute("type",tN)}function Qa(e){return es in e}function nN(e){const t=[...e].filter(n=>!Qa(n));return t.forEach(vd),t}function rN(e,t){return Qa(e)?(e[es]=t,!0):!1}function ab(e){const t=new Set;for(const n of e){const r="querySelectorAll"in n?n.querySelectorAll("script"):[];for(const o of[n,...r])Qa(o)&&t.add(o)}return[...t]}function lb(e){if(!Qa(e))return;const t=e[es];delete e[es],typeof t=="string"?e.setAttribute("type",t):e.removeAttribute("type")}var oN=["application/ecmascript","application/javascript","application/x-ecmascript","application/x-javascript","text/ecmascript","text/javascript","text/javascript1.0","text/javascript1.1","text/javascript1.2","text/javascript1.3","text/javascript1.4","text/javascript1.5","text/jscript","text/livescript","text/x-ecmascript","text/x-javascript"];function iN(e){const t=e.getAttribute("type"),n=e.getAttribute("language");return t===""||t===null&&!n?"text/javascript":(t===null?`text/${n}`:t.trim()).toLowerCase()}function cb(e){const t=iN(e);return oN.includes(t)?"classic":t==="module"||t==="importmap"||t==="speculationrules"?t:void 0}function sN(e){return cb(e)==="classic"}function aN(e){const t=e.getAttribute("for"),n=e.getAttribute("event");return t===null||n===null?!0:t.trim().toLowerCase()==="window"&&["onload","onload()"].includes(n.trim().toLowerCase())}function lN(e){const t=cb(e);return!t||t==="speculationrules"||Ja(e)?!1:t!=="classic"||!e.hasAttribute("nomodule")&&aN(e)}function cN(e){return e.hasAttribute("src")&&!["async","defer","nomodule"].some(t=>e.hasAttribute(t))&&sN(e)}function Ja(e){for(let t=e.parentElement;t;t=t.parentElement)if(t.localName==="template"&&t.namespaceURI==="http://www.w3.org/1999/xhtml")return!0;return!1}function ub(e,t){const n=e.parentNode;!n||!e.isConnected||(e.hasAttribute("src")&&!e.hasAttribute("async")&&(e.async=!1),t.run(e,()=>n.insertBefore(e,e.nextSibling)))}function db(e,t){[...t.attributes].forEach(r=>t.removeAttributeNode(r)),[...e.attributes].forEach(r=>t.setAttributeNode(r.cloneNode()));const n=Object.getOwnPropertyDescriptor(e,"$$tagName");n&&!Object.getOwnPropertyDescriptor(t,"$$tagName")&&Object.defineProperty(t,"$$tagName",n)}function fb(e,t,n){e.replaceWith(t),t.append(...e.childNodes),n.substitute?.(e,t)}function mb(e,t){const n=sb();return db(e,n),t.quiet(()=>fb(e,n,t)),n}function uN(e,t,n){const r=mb(t,n),o=()=>{e.removeEventListener("load",o),e.removeEventListener("error",o),r.isConnected&&(n.quiet(()=>{db(r,t),vd(t),fb(r,t,n),lb(t)}),ub(t,n))};e.addEventListener("load",o),e.addEventListener("error",o)}function hb(e,t){e.forEach(lb);const n=e.filter(Ja),r=e.filter(i=>i.isConnected&&!Ja(i));if(!r.length&&!n.length)return;r.sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),t.awake?.(),n.forEach(i=>mb(i,t));let o;for(const i of r)o&&!i.hasAttribute("src")?uN(o,i,t):(ub(i,t),o=cN(i)?i:o)}function eo(e,t=!0,n=!1){const r=e.content;switch(e.type){case D.ROOT:{const o=document.implementation.createHTMLDocument();for(const i of[...o.childNodes])o.removeChild(i);if(t)for(const i of e.children)o.appendChild(eo(i,!0,n));return o}case D.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case D.COMMENT:return document.createComment(r||"");case D.ELEMENT:if(e.tag){const o=e.tag.toLowerCase()==="script",i=n===!0&&o?sb():document.createElement(e.tag);if(Object.defineProperty(i,"$$tagName",{enumerable:!1,configurable:!1,value:e.tag}),e.attributes)for(const s of e.attributeNames){const a=e.attributes[s];try{const l=rb(i,s,typeof a=="string"?a:"");l!==null&&er(i,s,l)}catch{}}if(n==="dormant"&&o&&vd(i),t){const s=e.tag.toLowerCase()==="template"?!0:n;for(const a of e.children)i.appendChild(Za(a,e)?bd(a.content||""):eo(a,!0,s))}return i}return document.createTextNode("<");case D.HTML:return wr(r||"");default:throw new Error("unsupported node")}}function Le(e,t=!1){return hn(e).roots.map(n=>eo(n,!0,t))}function el(e,t,n){switch(t){case"afterend":e.after(...n);break;case"afterbegin":e.prepend(...n);break;case"beforeend":e.append(...n);break;case"beforebegin":e.before(...n)}}function pb(e,t){e.replaceChildren(...Le(t,!0))}function tr(e,t,n){el(e,t,Le(n,!0))}var gb=Symbol.for("emailmaker.documentWriteGuard"),ts=Symbol.for("emailmaker.documentWriteSink");function dN(e,t=document){const n=t,r=n[ts];return n[ts]=e,()=>{n[ts]===e&&(n[ts]=r)}}function fne(e){}function Ed(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0})}function fN(e,t,n){for(let r=e.writerOf.get(t);r;r=e.writerOf.get(r))if(r===n)return!0;return!1}function mN(e,t){let n=t;for(;n.nextSibling&&fN(e,n.nextSibling,t);)n=n.nextSibling;return n}function bb(e,t,n){if(!n.length)return;n.forEach(i=>e.writerOf.set(i,t));const r=()=>{for(const i of n){const s=t.parentNode;if(!s)return;s.insertBefore(i,mN(e,t).nextSibling)}},o=e.doc[ts];o?o(n,r,t):r()}function yb(e,t){return!!e&&e.type===D.ELEMENT&&!e.closed&&e.end===t}function hN(e,t){let n="";for(let r=e;yb(r,t);r=r.lastChild)n=`</${r.tag}>${n}`;return n}function pN(e){const t=hn(e).roots,n=t[t.length-1],r=yb(n,e.length);return{nodes:(r?t.slice(0,-1):t).map(o=>eo(o)),rest:r?e.slice(n.start):""}}function gN(e){const t=[...e.pending];e.pending.clear();for(const[n,r]of t){const o=hn(r).roots,i=r+hN(o[o.length-1],r.length);bb(e,n,hn(i).roots.map(s=>eo(s)))}}function vb(e,t,n){const r=e.doc.currentScript;if(!r?.parentNode){return}const{nodes:o,rest:i}=pN((e.pending.get(r)??"")+n);i?(e.pending.size||queueMicrotask(()=>gN(e)),e.pending.set(r,i)):e.pending.delete(r),bb(e,r,o)}function bN(e=document){const t=e;if(t[gb])return;t[gb]=!0;const n={doc:t,writerOf:new WeakMap,pending:new Map};Ed(e,"write",(...r)=>vb(n,"write",r.join(""))),Ed(e,"writeln",(...r)=>vb(n,"writeln",`${r.join("")}
|
|
2
2
|
`)),Ed(e,"open",(...r)=>r.length>=3?e.defaultView?.open(r[0],r[1],r[2])??null:e)}bN();function yN(e){return e}var vN=class extends Error{constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),A(this,"cycle",void 0),this.cycle=e}};function EN(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const o=t.get(r)??[];o.push(n),t.set(r,o)}return t}function SN(e,t){const n=[];for(const r of e.awaits?.services??[])for(const o of t.get(r)??[])o!==e&&n.push(o);return n}function wN(e){const t=EN(e),n=[],r=new Set,o=[],i=new Set,s=a=>{if(!r.has(a)){if(i.has(a)){const l=o.indexOf(a);throw new vN([...o.slice(l),a].map(c=>c.name))}i.add(a),o.push(a);for(const l of SN(a,t))s(l);o.pop(),i.delete(a),r.add(a),n.push(a)}};for(const a of e)s(a);return n}var Ee=class Qk{constructor(t=[]){A(this,"_inner",void 0),A(this,"_isDisposed",!1),this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof Qk&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const n=this._inner.indexOf(t);n>=0&&this._inner.splice(n,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function Sd(e){return`service_container_${e}`}var ns=new Set,wd;function _N(){if(!wd)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,Eb.prototype.getInstanceAsync),e.stack}function _d(e){ns.delete(e)&&wd?.end(e)}var Eb=class Tg extends Ee{_runCallbacks(t){[...this._injectCallbacks].forEach(n=>n(t))}constructor(t=null){super(),A(this,"_parent",void 0),A(this,"_injectCallbacks",[]),A(this,"_injections",Object.create(null)),A(this,"onInject",n=>(this._injectCallbacks.push(n),{dispose:()=>{const r=this._injectCallbacks.indexOf(n);r>=0&&this._injectCallbacks.splice(r,1)}})),this._parent=t,t&&this.addDisposable(t.onInject(n=>this._runCallbacks(n)))}inject(t,n){this._injections[t]=()=>n,this._runCallbacks(t)}injectFactory(t,n,r){const o=this._injections[t];let i=typeof o=="function"?o():o;const s=this._injections[t]=()=>(i=n(this,i),i);r&&s(),this._runCallbacks(t)}_find(t,n=!0){return this._injections[t]||n&&this._parent?._find(t)}_onInject(t,n,r=new Ee){return r.addDisposable(this.onInject(o=>{t===o&&!r.isDisposed()&&(r.dispose(),n(this.getInstance(o)))})),this._parent&&r.addDisposable(this._parent._onInject(t,n,r)),this.addDisposable(r),r}getInstance(t,n=!0){const r=this._find(t,n);if(typeof r=="function")return r()}getOrCreateInstance(t,n){const r=this._find(t);if(typeof r=="function")return r();const o=n(this);return this.inject(t,o),o}getInstanceAsync(t){const n=this._find(t);if(typeof n=="function")return Promise.resolve(n());const r=_N();return new Promise((o,i)=>{const s={id:String(t),startedAt:Date.now(),origin:r,container:this,reject:i};ns.add(s),wd?.start(s),this._onInject(t,()=>{_d(s),o(this.getInstance(t))})})}failPendingWaits(t){for(const n of Array.from(ns))n.container===this&&(_d(n),n.reject(t))}pendingWaits(){return[...ns].filter(t=>t.container===this)}addService(t,n){const r=Sd(t);this.injectFactory(r,(i,s=[])=>s.indexOf(n)<0?[...s,n]:s);const o=new Ee;return o.addDispose(()=>{this.injectFactory(r,(i,s=[])=>s.filter(a=>a!==n))}),o}addServiceFactory(t,n,r){const o=Sd(t);let i;this.injectFactory(o,(a,l=[])=>(i=n(a,i),i===void 0?l:l.indexOf(i)<0?[...l,i]:l),r);const s=new Ee;return s.addDispose(()=>{this.injectFactory(o,(a,l=[])=>i===void 0?l:l.filter(c=>c!==i))}),s}getServices(t){const n=Sd(t);return[...this.getInstance(n,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new Tg(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const n=this._parent?.getOrCreateIsolatedContainer(t);return new Tg(n)})}remove(t){const n=this._injections;delete n[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(ns))t.container===this&&_d(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function Cd(e){return e.startsWith("__")?e:`__${e}__`}function CN(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=Cd(e),n=globalThis;return n[t]??(n[t]={})}function TN(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function AN(e){if(e)return Cd(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return Cd(t)}function Td(e){const t=AN(e),n=CN(t);if(TN(n.container))return n.container;const r=new Eb(null);return n.container=r,r}function kN(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(n){let r=Math.random()*16;return e>0?(r=(e+r)%16|0,e=Math.floor(e/16)):(r=(t+r)%16|0,t=Math.floor(t/16)),(n==="x"?r:r&3|8).toString(16)})}function LN(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():kN()}function ae(e=LN()){return e}function Sb(){return"iframe".trim()||"unknown"}function NN(e){if(typeof globalThis>"u")return;const t=Sb(),n=globalThis[e]??{};globalThis[e]=n;const r=n.__diagnostics??(n.__diagnostics={}),o=r.diModuleEval??(r.diModuleEval={evalCount:0,records:[]});o.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),o.evalCount+=1}function xN(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function ON(e,t){if(NN(t),typeof globalThis>"u")return e;const n=Sb(),r=globalThis,o=r[t]=r[t]||{},i=o.__diagnostics=o.__diagnostics||{},s=i.dependencyResolver=i.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:n,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var tl;function RN(){if(tl)return tl;const e=xN();return tl=ON(Td(e),e),tl}var mne=new Proxy({},{get(e,t,n){const r=RN(),o=Reflect.get(r,t,n);return typeof o=="function"?o.bind(r):o}}),MN=new Function("url","return import(url)");function PN(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Ad(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function wb(e){return e.type==="umd"||e.resolve==="registry"}var IN="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function DN(e){const t=Array.isArray(e)?e[0]:e;return Ad(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function BN(e,t){const n=DN(e),r=Ad(e)?e:void 0,o=t instanceof Error?t.message:String(t),i=r&&wb(r)&&!/compat/iu.test(o)?` ${IN}`:"",s=new Error(`Plugin "${n}" was skipped: it failed to load. ${o}${i}`);return s.cause=t,{name:n,url:r?.url,error:s}}function HN(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function hne(e){return e}var FN=class{constructor(e,t,n={}){A(this,"_context",void 0),A(this,"_pluginRegistry",void 0),A(this,"_options",void 0),A(this,"_map",new Map),A(this,"_optionsMap",new Map),A(this,"_readyMap",new Map),A(this,"_resolveMap",new Map),A(this,"_initializingPlugins",new Map),A(this,"_creatingPlugins",new Set),A(this,"_initializedPlugins",new Set),A(this,"_creationOrder",[]),A(this,"_lifecycleListeners",new Set),A(this,"_activated",!1),this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Ad(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(wb(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await MN(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let o;const i=a=>{o||(a.filename===r.src?o=this._scriptExecutionError(e,a.error??a.message):HN(a)&&(o=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},s=()=>window.removeEventListener("error",i);window.addEventListener("error",i),r.onload=()=>{if(s(),o){n(o);return}t()},r.onerror=()=>{s(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const o=await this._resolveOrSkip(r);if(!o)continue;const i=this._createOrSkip(o.ctor,o.options);i&&!n.has(i)&&(n.add(i),t.push(i))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const a=await this._resolveOrSkip(s);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((s,a)=>{t.has(a)||r.push({key:a,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:a,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const c=this._creationOrder.indexOf(l);c>=0&&this._creationOrder.splice(c,1)}const o=[],i=new Set;for(const{ctor:s,options:a}of n){const l=this._createOrSkip(s,a);l&&!i.has(l)&&(i.add(l),o.push(l))}this._activated&&await this._startPluginsBatch(o)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,o)=>{let i,s=!1;const a=()=>{s||(s=!0,i&&clearTimeout(i),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(i=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,a),o(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),o=this._createPluginInstance(e,r),i=o.constructor.name;this._emitLifecycle({type:"created",plugin:o,name:i}),o.required?.(),this._map.set(n,o),this._creationOrder.push(o),this._setupReadyPromise(o)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=BN(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return PN(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const o of t){if(this._initializedPlugins.has(o))continue;const i=this._initializingPlugins.get(o);if(i){n.add(i);continue}r.push(o)}if(r.length>0){const o=this._runBatchLifecycle(r);for(const i of r)this._initializingPlugins.set(i,o);n.add(o),o.finally(()=>{for(const i of r)this._initializingPlugins.get(i)===o&&this._initializingPlugins.delete(i)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const o=this._options.openEarlyWindow?.();try{await this._callSync(n,r,"init"),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}finally{o?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await this._callSync(n,r,"afterInit"),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(o){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:o})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}_callSync(e,t,n){this._emitLifecycle({type:`${n}:enter`,plugin:e,name:t});try{return e[n]?.()}finally{this._emitLifecycle({type:`${n}:leave`,plugin:e,name:t})}}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},_b=class{constructor(){A(this,"_plugins",new Map),A(this,"_listeners",new Map)}_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const o of n)try{o.callback(t)}catch{}const r=n.filter(o=>!o.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(o=>(t.ctor=o,t.loading=void 0,this._notifyListeners(e,o),o));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!1};return r.push(o),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const o={callback:t,once:!0};return r.push(o),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(o=>o.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},$N=class{constructor(e){A(this,"resolveRegistry",void 0),this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},Y=ae("SandboxHtmlDocument"),ot=ae("SandboxRemoteDocument"),rs=ae("SandboxTextDocument"),pn=ae("SandboxDocumentMapping"),Te=ae("SandboxSyncCommit"),os=ae("SandboxLayoutProfile"),Cb=ae("SandboxState"),Ne=ae("SandboxSelectionLock"),Ye=ae("SandboxEditLock"),Po=ae("SandboxAttributePipeline"),kd=ae("SandboxAmpService"),Ld=ae("SandboxImageReload"),nl=ae("SandboxImageCache"),it=ae("SandboxFocus"),Nd=ae("SandboxLocalization"),Ie=ae("SandboxElementSettings"),Io=ae("SandboxElementRefs"),yt=ae("SandboxSetCursor"),Tb=ae("SandboxStyleRoot"),Ab=ae("SandboxVmlWidthResolver"),rl=ae("SandboxPrepareHtml"),is=ae("SandboxSurfaceName"),Do=ae("SandboxDocumentSync"),Bo=ae("SandboxMapObj"),Ho=ae("SandboxActiveElementFingerprint"),ol=ae("SandboxToggleTextStyle"),gn=ae("SandboxWrapEditor"),Cr=ae("SandboxInsertServices"),ss=ae("SandboxInitPreview"),xd=ae("SandboxInsertPolicy"),Fo=ae("SandboxTableSelections"),kb=ae("SandboxNarrowTableTextAtom"),Lb=ae("SandboxSettingsExtras"),Nb=ae("SandboxViewportHandlers"),xb=ae("SandboxOperations"),$o=ae("SandboxApplyElementSettings"),Tr=ae("SandboxOperationEnvironment"),Wo=ae("SandboxHostFacts"),WN="__sandbox__",Mt=Td(WN);function qN(e){return e}function zN(e,t=Mt){t.inject(is,e.name),t.inject(os,e.profile);for(const n of wN(e.units))n.setup(t);return t}function bn(e,t){e.remove?.(t)}function R(e,t){const n=e.getInstance(t);if(n===void 0)throw new Error(`[sandbox] служба «${String(t)}» не зарегистрирована: её фича не подключена или ещё не зарегистрирована`);return n}var Ob=class extends Ee{constructor(e={}){super(),A(this,"_options",void 0),A(this,"_listeners",[]),A(this,"on",this._addListener.bind(this)),A(this,"event",this._addListener.bind(this)),A(this,"once",(t,n=0,r)=>{const o=this._addListener((...i)=>(o?.dispose(),r?t.call(r,...i):t(...i)),n);return o}),A(this,"un",t=>{const n=this._listeners.findIndex(([r])=>r===t);n>=0&&(this._listeners.splice(n,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())}),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,n){if(this.isDisposed())return{dispose:()=>{}};const r=this._listeners,o=this._options;n&&typeof e=="function"&&(e=e.bind(n));const i=r.findIndex(([,a])=>a<t),s=[e,t];return r.splice(i>=0?i:r.length,0,s),r.length===1&&o.onFirstListenerAdd&&o.onFirstListenerAdd(),{dispose:()=>{const a=r.indexOf(s);a>=0&&(r.splice(a,1),!r.length&&o.onLastListenerRemove&&o.onLastListenerRemove())}}}dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},UN=class extends Ob{execute(e,t){for(const n of t)try{n(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},ge=class extends UN{execute([e],t){for(const n of t)try{n(e)}catch{}}},jN=class extends Ob{fire(e){if(this.isDisposed())return;let t=!1,n=!1;const r={value:e,preventDefault(){t=!0},stopPropagation(){n=!0}},o=this.getListeners([r]);for(const i of o){if(n)break;try{i(r)}catch{}}return t?!1:void 0}};function VN(e,t,n){let r;const o=new ge({onFirstListenerAdd(){r=o.addDisposable(new Ee),r.addDisposable(e(i=>{t(i)!==!1&&o.fire(i)}))},onLastListenerRemove(){r?.dispose(),r=void 0}});return n?.addDisposable(o),o.event}function GN(e,t=window){return{peer:e,send(n){e.postMessage(n,"*")},subscribe(n){const r=o=>{n({data:o.data,source:o.source,ports:o.ports})};return t.addEventListener("message",r),{dispose:()=>t.removeEventListener("message",r)}},close(){}}}function XN(e){let t=!1;return{peer:e,send(n){e.postMessage(n)},subscribe(n){const r=o=>{n({data:o.data,source:e})};return e.addEventListener("message",r),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",r)}},close(){e.close()}}}function pne(e){return e}function KN(e){return e&&typeof e=="object"}function Rb(e,t){return e&&typeof e=="object"&&e.operationId===t}var Mn="INIT_MESSAGE",YN="em:port-ready",ZN="em:window-drained",Od="";function Mb(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var QN=class extends Ee{constructor(...e){super(...e),A(this,"_listeners",Object.create(null)),A(this,"addListenerAsync",(t,n,r=0,o)=>{const i=this._listeners[t]||(this._listeners[t]=[]);o&&typeof n=="function"&&(n=n.bind(o));const s=i.findIndex(([l,c])=>r<=c),a=[n,r];return this.isDisposed()||i.splice(s>=0?s:i.length,0,a),{dispose(){const l=i.indexOf(a);l>=0&&i.splice(l,1)}}}),A(this,"fireAsync",(t,n)=>{if(!this.isDisposed()){const r=this._listeners[t]||(this._listeners[t]=[]);let o;for(let i=0;i<r.length;i++){const s=r[i][0],a=o;o=l=>s(l,a)}if(o)return o(n)}}),A(this,"addListener",(t,n,r=0)=>this.addListenerAsync(t,(o,i)=>{try{n(o)}catch{}return i&&i(o)},r))}},JN=class extends Ee{constructor(e,t){super(),A(this,"_singleton",void 0),A(this,"_target",void 0),A(this,"_transport",void 0),A(this,"_transportSubscription",void 0),A(this,"_ports",new Map),A(this,"_drained",new WeakSet),A(this,"_portSendHeld",new WeakSet),A(this,"_inited",!1),A(this,"_emitter",this.addDisposable(new QN)),A(this,"_handshaken",new WeakSet),A(this,"_greeted",new WeakSet),A(this,"_outgoingFilter",void 0),A(this,"_outgoingObservers",new Set),A(this,"_offTargetListeners",new Map),A(this,"_onTransportMessage",n=>{const r=n,o=r.data,i=r.source,s=o?.port===!0?r.ports?.[0]:void 0,a=!this._isPortSource(r.source);if(a&&i&&o?.operationId==="em:window-drained"){this._ports.has(i)&&this._drained.add(i);return}if(a&&i&&this._drained.has(i))return;if(i&&i!==this._target&&this._greeted.has(i)&&Rb(o,Mn)){this._greeted.delete(i),this._handshaken.add(i),this._postMessage(i,{operationId:Mn,data:{}}),s&&this.usePort(s,!0,i);return}const l=r.source===this.target||this._isCurrentPort(r.source);if(l||this._notifyOffTarget(o?.operationId,r.source),KN(o)&&l||this._singleton&&Rb(o,Mn)){if(s&&l){const f=this._target;Promise.resolve().then(()=>this.usePort(s,!0,f))}const c=this._emitter.fireAsync(o.operationId||Od,o.operationId===void 0?r:o.data),u=o.result,d=o.error;u&&d&&Promise.resolve(c).then(f=>this._sendMessage(u,f),f=>this._sendMessage(d,f))}}),this._singleton=t,this._transport=GN({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(Mn,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(Mn))}),e&&this.setTarget(e)}setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(Mn,void 0);return}this._inited=!1,this._postMessage(e,{operationId:Mn,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:Mn,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const n of Array.from(this._outgoingObservers))try{n(e,t)}catch{}}addOffTargetListener(e,t){let n=this._offTargetListeners.get(e);return n||(n=new Set,this._offTargetListeners.set(e,n)),n.add(t),{dispose:()=>{n.delete(t)}}}_notifyOffTarget(e,t){const n=typeof e=="string"?this._offTargetListeners.get(e):void 0,r=n?.size?this._knownPeer(t):void 0;if(!(!n||!r))for(const o of Array.from(n))try{o(r)}catch{}}_knownPeer(e){for(const[n,r]of this._ports)if(r.transport.peer===e)return n;const t=e;return typeof e=="object"&&e!==null&&(this._handshaken.has(t)||this._greeted.has(t))?t:void 0}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:Mn,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,n=this._target){if(!n||this._ports.has(n))return;const r=XN(e),o=r.subscribe(this._onTransportMessage);this._ports.set(n,{transport:r,subscription:o}),t&&(r.send({operationId:YN,data:{}}),this.drainWindow(n))}holdPort(e=this._target){!e||!this._ports.has(e)||(this._portSendHeld.add(e),this._drained.delete(e))}resumePort(e=this._target){e&&this._portSendHeld.delete(e)}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)&&!this._portSendHeld.has(this._target)}hasPort(e,t){const n=this._ports.get(e);return n!==void 0&&(t===void 0||n.transport.peer===t)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e),this._portSendHeld.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:ZN,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,n){let r=t;this._outgoingFilter&&!n?.length&&(r="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const o=this._ports.get(e);if(o&&!this._portSendHeld.has(e)){o.transport.send(r);return}if(n?.length){e.postMessage(r,"*",n);return}e.postMessage(r,"*")}catch(o){if(o?.name==="DataCloneError"){const i=typeof r?.data=="object"&&r?.data!==null?r.data:void 0}throw o}}_sendMessage(e,t,n=!0){if(!n&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const r=this.addDisposable(this.onInit(o=>{const i=e?{operationId:e,data:t}:t;try{this._postMessage(o,{...i})}finally{r.dispose()}}))}send(e,t,n){return typeof e=="string"?this._sendMessage(e,t,n):this._sendMessage(Od,e,t)}sendAsync(e,t,n=!0){if(!n&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const r=Mb(),o=Mb();return new Promise((i,s)=>{const a=this.addDisposable(new Ee);a.addDisposable(this.onInit(l=>{try{this._postMessage(l,{operationId:e,data:t,result:r,error:o})}catch(c){a.dispose(),s(c);return}a.addDisposable(this._onMessage(r,c=>{i(c),a.dispose()})),a.addDisposable(this._onMessage(o,c=>{s(c),a.dispose()}))}))})}_onMessage(e,t,n=0){return this._emitter.addListener(e,t,n)}addListener(e,t,n){return t?this._onMessage(e,t,n):this._onMessage(Od,e)}addListenerAsyncPipe(e,t,n=0){return this._emitter.addListenerAsync(e,t,n)}addListenerAsync(e,t,n=0){return this._emitter.addListenerAsync(e,async(r,o)=>{const i=await t(r);return o?o(r):i},n)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,n=0){const r=this.addDisposable(new Ee);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?r.addDisposable(this.onInit(e,t,n)):e(this._target)}):r.addDisposable(this._onMessage(Mn,()=>{e(this._target)},n)),r}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function Pb(e,t){if(e===t)return;let n=0;const r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;let o=e.length,i=t.length;for(;o>n&&i>n&&e[o-1]===t[i-1];)o--,i--;return{start:n,fromEnd:o,toEnd:i}}function Ib(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return{length:e.length,hash:t>>>0}}var e2=/<\/?[a-zA-Z][a-zA-Z0-9:_.-]*(?:\s[^<>]*)?\/?>/g;function t2(e){return e.replace(e2,t=>/^<br\b/i.test(t)?" ":"")}var n2={theme:"canvas_fact_theme",flags:"canvas_fact_flags",commonStyles:"canvas_fact_common_styles",lockEditor:"canvas_fact_lock_editor",codeMode:"canvas_fact_code_mode",appName:"canvas_fact_app_name",previewPage:"canvas_fact_preview_page",viewport:"canvas_fact_viewport"},to=8e3,r2=2e3,o2=15e3,Rd=3e3,i2="fonts.googleapis.com",s2=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},a2=e=>{const t=s2(String(e??""));return t?t.hostname===i2&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},de={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_EBLOCK_CLEAR_EM_BLOCK_ID:"sandbox_eblock_clear_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_SYNC_DRIFT:"application_sync_drift",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:"sandbox_canvas_health",SANDBOX_CANVAS_SYNCED:"sandbox_canvas_synced",SANDBOX_ELEMENT_OPERATION:"sandbox_element_operation"},l2=e=>({REORDER_ATOM:e("Reorder element"),CLONE_ATOM:e("Clone element"),REMOVE_ATOM:e("Remove element"),EDIT_ATOM:e("Edit element"),CHANGE_IMAGE:e("Change image"),CHANGE_IMAGE_EDIT:e("Edit"),CHANGE_IMAGE_STOCK:e("Stock"),CHANGE_IMAGE_CHANGETO:e("Upload"),CHANGE_IMAGE_GIF:e("GIF"),CHANGE_IMAGE_AI:e("Generate"),REORDER_BLOCK:e("Reorder block"),REORDER_BLOCK_UP:e("Move up"),REORDER_BLOCK_DOWN:e("Move down"),EDIT_BLOCK:e("Edit block"),CLONE_BLOCK:e("Clone block"),MERGE_BLOCK:e("Merge with the chosen block"),UNMERGE_BLOCK:e("Split blocks"),COPY_BLOCK_TO_CLIPBOARD:e("Copy block to clipboard"),PASTE_BLOCK_FROM_CLIPBOARD:e("Paste block from clipboard"),REMOVE_BLOCK:e("Remove block"),SAVE_TO_BLOCKS:e("Save to Blocks"),UPDATE_GLOBAL_BLOCK_IN_TEMPLATES:e("Push block update to all templates"),ADD_BLOCK:e("Add block"),ADD_EMPTY_BLOCK:e("Add an empty block"),ADD_SAVED_BLOCK:e("Add a saved block"),ADD_COMMON_BLOCK:e("Add a common block"),ADD_TEMPLATE_BLOCK:e("Add a template block"),ADD_SEARCH_BLOCK:e("Search a block"),REORDER_GROUP:e("Reorder group"),EDIT_GROUP:e("Edit group"),CLONE_GROUP:e("Clone group"),REMOVE_GROUP:e("Remove group"),ADD_GROUP:e("Add group"),LINK:e("link"),TABLE_COLUMN:e("cell"),TABLE:e("table"),FLOAT_BLOCK:e("column"),CONTAINER:e("container"),PICTURE:e("picture"),CAROUSEL:e("carousel"),ACCORDION:e("accordion"),SOCIAL:e("Social media"),VERTICAL_INDENT:e("indent"),TEXT:e("text"),BUTTON:e("button"),VAR:e("variable"),STRUCTURE:e("block"),EMAIL:e("email"),GROUP:e("group"),TYPOGRAF:e("Typograf"),COUNTDOWN:e("countdown"),ELEMENT:e("element"),VIDEO:e("video"),ELEMENT_PATH_LINK:e("Link"),ELEMENT_PATH_BLOCK:e("Block"),ELEMENT_PATH_ATOM:e("Element"),ELEMENT_PATH_TD:e("Cell"),ELEMENT_PATH_TABLE:e("Table"),ELEMENT_PATH_FLOATBLOCK:e("Column"),ELEMENT_PATH_TEXT:e("Text"),ELEMENT_PATH_DIV:e("Container"),ELEMENT_PATH_GROUP:e("Group"),ELEMENT_PATH_EMAIL:e("Email"),ELEMENT_PATH_IMG:e("Picture"),ELEMENT_PATH_VINDENT:e("Indent"),ELEMENT_PATH_BUTTON:e("Button"),ELEMENT_PATH_CAROUSEL:e("Carousel"),ELEMENT_PATH_ACCORDION:e("Accordion"),ELEMENT_PATH_SOCIAL:e("Social media"),ELEMENT_PATH_SECTION:e("Section"),TINYMCE_CHANGECASE:e("Case Change"),TINYMCE_UPPERCASE:e("Uppercase"),TINYMCE_LOWERCASE:e("Lowercase"),PASTE_HERE:e("Drop here"),INSERT_COLUMN_BEFORE_TABLE:e("Insert column before"),INSERT_COLUMN_AFTER_TABLE:e("Insert column after"),INSERT_ROW_BEFORE_TABLE:e("Insert row before"),INSERT_ROW_AFTER_TABLE:e("Insert row after"),MERGE_RIGHT_CELL_TABLE:e("Merge right cell"),MERGE_LEFT_CELL_TABLE:e("Merge left cell"),MERGE_TOP_CELL_TABLE:e("Merge top cell"),MERGE_BOTTOM_CELL_TABLE:e("Merge bottom cell"),SPLIT_CELL_TABLE:e("Split cell"),REMOVE_COLUMN_TABLE:e("Remove column"),REMOVE_ROW_TABLE:e("Remove row"),TABLE_MENU_COLUMNS:e("Columns"),TABLE_MENU_ROWS:e("Rows"),DROP_BLOCK_HINT:e("Click or drag a block")}),z=new JN(window.parent,!0),il,as,Db=Math.random().toString(36).slice(2,8),c2=0,sl;function Bb(e,t){const n=il;il=e;try{return t()}finally{il=n}}function al(e,t){const n=as;as=e;try{return t()}finally{as=n}}function u2(){return as}function d2(){try{return il?.()}catch{return}}function f2(){return sl||(sl=`${Db}:${++c2}`,Promise.resolve().then(()=>{sl=void 0})),sl}function st(e,t){const n=d2();return z.send(de.APPLICATION_DOMPARSER_ERROR,{message:e,stack:new Error().stack,...n?{mutation:n}:{},source:as??"other",batch:f2(),instance:Db}),t}function Md(e,t){let n=t.children,r=e(t)||0;if(r!=0||!n)return r!==1;for(const o of n)if(Md(e,o)===!1)return!1;return!0}function Hb(e,t,n=[t]){for(;t=t.parent;)if(e(n=[t,...n])===!1)return!1;return!0}function m2(e,t){return Hb(([n,r])=>{const{children:o}=n;if(o){for(let i=o.indexOf(r)+1,s=o.length;i<s;i++)if(Md(e,o[i])===!1)return!1}},t)}function nr(e,t,n){Md(r=>{r.start+=t,r.startTagEnd!==void 0&&(r.startTagEnd+=t),r.end+=t,r.endTagStart!==void 0&&(r.endTagStart+=t)},e),n&&(Hb(([r])=>{r.end+=n,r.endTagStart!==void 0&&(r.endTagStart+=n)},e),m2(r=>{r.start+=n,r.startTagEnd!==void 0&&(r.startTagEnd+=n),r.end+=n,r.endTagStart!==void 0&&(r.endTagStart+=n)},e))}var h2=e=>e.type===D.HTML?e.start-1:e.start,p2=e=>e.type===D.HTML?e.end+1:e.end;function g2(e,t){const{start:n,end:r}=e;let o=t.findNodeAt(n);for(;o&&(h2(o)>=n||p2(o)<=r||o.start===o.startTagEnd);)o=o.parent;return o}function b2(e){return{start:e.start+(e.tag?.length||0)+1,end:(e.startTagEnd!==void 0?e.startTagEnd:e.start)-1}}function Fb(e){const t=e.parent?.children;if(t){const n=t.indexOf(e);if(n>0)return t[n-1]}}function Ar(e){let t=e;do t=y2(t);while(t&&t.type===D.HTML&&!t.content);return t}function y2(e){const t=e.parent?.children;if(t){const n=t.indexOf(e);if(n<0)return st("parent and child not sync",e);if(n<t.length-1)return t[n+1]||null}return null}var no=class{constructor(e,t,n,r){A(this,"originalStart",void 0),A(this,"originalLength",void 0),A(this,"modifiedStart",void 0),A(this,"modifiedLength",void 0),this.originalStart=e,this.originalLength=t,this.modifiedStart=n,this.modifiedLength=r}getOriginalEnd(){return this.originalStart+this.originalLength}getModifiedEnd(){return this.modifiedStart+this.modifiedLength}};function $b(e,t){return(t<<5)-t+e|0}function v2(e,t){t=$b(149417,t);for(let n=0,r=e.length;n<r;n++)t=$b(e.charCodeAt(n),t);return t}var Wb=class{constructor(e){A(this,"source",void 0),this.source=e}getElements(){const e=this.source,t=new Int32Array(e.length);for(let n=0,r=e.length;n<r;n++)t[n]=e.charCodeAt(n);return t}};function qb(e,t,n){return new E2(new Wb(e),new Wb(t)).ComputeDiff(n).changes}var qo=class{static Assert(e,t){if(!e)throw new Error(t)}},zo=class{static Copy(e,t,n,r,o){for(let i=0;i<o;i++)n[r+i]=e[t+i]}static Copy2(e,t,n,r,o){for(let i=0;i<o;i++)n[r+i]=e[t+i]}},zb=class{constructor(){A(this,"m_changes",void 0),A(this,"m_originalStart",void 0),A(this,"m_modifiedStart",void 0),A(this,"m_originalCount",void 0),A(this,"m_modifiedCount",void 0),this.m_changes=[],this.m_originalStart=1073741824,this.m_modifiedStart=1073741824,this.m_originalCount=0,this.m_modifiedCount=0}MarkNextChange(){(this.m_originalCount>0||this.m_modifiedCount>0)&&this.m_changes.push(new no(this.m_originalStart,this.m_originalCount,this.m_modifiedStart,this.m_modifiedCount)),this.m_originalCount=0,this.m_modifiedCount=0,this.m_originalStart=1073741824,this.m_modifiedStart=1073741824}AddOriginalElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_originalCount++}AddModifiedElement(e,t){this.m_originalStart=Math.min(this.m_originalStart,e),this.m_modifiedStart=Math.min(this.m_modifiedStart,t),this.m_modifiedCount++}getChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes}getReverseChanges(){return(this.m_originalCount>0||this.m_modifiedCount>0)&&this.MarkNextChange(),this.m_changes.reverse(),this.m_changes}},E2=class Gi{constructor(t,n,r=null){A(this,"ContinueProcessingPredicate",void 0),A(this,"_originalSequence",void 0),A(this,"_modifiedSequence",void 0),A(this,"_hasStrings",void 0),A(this,"_originalStringElements",void 0),A(this,"_originalElementsOrHash",void 0),A(this,"_modifiedStringElements",void 0),A(this,"_modifiedElementsOrHash",void 0),A(this,"m_forwardHistory",void 0),A(this,"m_reverseHistory",void 0),this.ContinueProcessingPredicate=r,this._originalSequence=t,this._modifiedSequence=n;const[o,i,s]=Gi._getElements(t),[a,l,c]=Gi._getElements(n);this._hasStrings=s&&c,this._originalStringElements=o,this._originalElementsOrHash=i,this._modifiedStringElements=a,this._modifiedElementsOrHash=l,this.m_forwardHistory=[],this.m_reverseHistory=[]}static _isStringArray(t){return t.length>0&&typeof t[0]=="string"}static _getElements(t){const n=t.getElements();if(Gi._isStringArray(n)){const r=new Int32Array(n.length);for(let o=0,i=n.length;o<i;o++)r[o]=v2(n[o],0);return[n,r,!0]}return n instanceof Int32Array?[[],n,!1]:[[],new Int32Array(n),!1]}ElementsAreEqual(t,n){return this._originalElementsOrHash[t]!==this._modifiedElementsOrHash[n]?!1:this._hasStrings?this._originalStringElements[t]===this._modifiedStringElements[n]:!0}ElementsAreStrictEqual(t,n){return this.ElementsAreEqual(t,n)?Gi._getStrictElement(this._originalSequence,t)===Gi._getStrictElement(this._modifiedSequence,n):!1}static _getStrictElement(t,n){return typeof t.getStrictElement=="function"?t.getStrictElement(n):null}OriginalElementsAreEqual(t,n){return this._originalElementsOrHash[t]!==this._originalElementsOrHash[n]?!1:this._hasStrings?this._originalStringElements[t]===this._originalStringElements[n]:!0}ModifiedElementsAreEqual(t,n){return this._modifiedElementsOrHash[t]!==this._modifiedElementsOrHash[n]?!1:this._hasStrings?this._modifiedStringElements[t]===this._modifiedStringElements[n]:!0}ComputeDiff(t){return this._ComputeDiff(0,this._originalElementsOrHash.length-1,0,this._modifiedElementsOrHash.length-1,t)}_ComputeDiff(t,n,r,o,i){const s=[!1];let a=this.ComputeDiffRecursive(t,n,r,o,s);return i&&(a=this.PrettifyChanges(a)),{quitEarly:s[0],changes:a}}ComputeDiffRecursive(t,n,r,o,i){for(i[0]=!1;t<=n&&r<=o&&this.ElementsAreEqual(t,r);)t++,r++;for(;n>=t&&o>=r&&this.ElementsAreEqual(n,o);)n--,o--;if(t>n||r>o){let c;return r<=o?(qo.Assert(t===n+1,"originalStart should only be one more than originalEnd"),c=[new no(t,0,r,o-r+1)]):t<=n?(qo.Assert(r===o+1,"modifiedStart should only be one more than modifiedEnd"),c=[new no(t,n-t+1,r,0)]):(qo.Assert(t===n+1,"originalStart should only be one more than originalEnd"),qo.Assert(r===o+1,"modifiedStart should only be one more than modifiedEnd"),c=[]),c}const s=[0],a=[0],l=this.ComputeRecursionPoint(t,n,r,o,s,a,i);return s[0],a[0],l!==null?l:[new no(t,n-t+1,r,o-r+1)]}WALKTRACE(t,n,r,o,i,s,a,l,c,u,d,f,h,m,p,v,C,k){let L=null,E=null,g=new zb,y=n,w=r,b=h[0]-v[0]-o,S=-1073741824,_=this.m_forwardHistory.length-1;do{const T=b+t;T===y||T<w&&c[T-1]<c[T+1]?(d=c[T+1],m=d-b-o,d<S&&g.MarkNextChange(),S=d,g.AddModifiedElement(d+1,m),b=T+1-t):(d=c[T-1]+1,m=d-b-o,d<S&&g.MarkNextChange(),S=d-1,g.AddOriginalElement(d,m+1),b=T-1-t),_>=0&&(c=this.m_forwardHistory[_],t=c[0],y=1,w=c.length-1)}while(--_>=-1);if(L=g.getReverseChanges(),k[0]){let T=h[0]+1,x=v[0]+1;if(L!==null&&L.length>0){const N=L[L.length-1];T=Math.max(T,N.getOriginalEnd()),x=Math.max(x,N.getModifiedEnd())}E=[new no(T,f-T+1,x,p-x+1)]}else{g=new zb,y=s,w=a,b=h[0]-v[0]-l,S=1073741824,_=C?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const T=b+i;T===y||T<w&&u[T-1]>=u[T+1]?(d=u[T+1]-1,m=d-b-l,d>S&&g.MarkNextChange(),S=d+1,g.AddOriginalElement(d+1,m+1),b=T+1-i):(d=u[T-1],m=d-b-l,d>S&&g.MarkNextChange(),S=d,g.AddModifiedElement(d+1,m+1),b=T-1-i),_>=0&&(u=this.m_reverseHistory[_],i=u[0],y=1,w=u.length-1)}while(--_>=-1);E=g.getChanges()}return this.ConcatenateChanges(L,E)}ComputeRecursionPoint(t,n,r,o,i,s,a){let l=0,c=0,u=0,d=0,f=0,h=0;t--,r--,i[0]=0,s[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const m=n-t+(o-r),p=m+1,v=new Int32Array(p),C=new Int32Array(p),k=o-r,L=n-t,E=t-r,g=n-o,y=(L-k)%2===0;v[k]=t,C[L]=n,a[0]=!1;for(let w=1;w<=m/2+1;w++){let b=0,S=0;if(w>100)return null;u=this.ClipDiagonalBound(k-w,w,k,p),d=this.ClipDiagonalBound(k+w,w,k,p);for(let T=u;T<=d;T+=2){T===u||T<d&&v[T-1]<v[T+1]?l=v[T+1]:l=v[T-1]+1,c=l-(T-k)-E;const x=l;for(;l<n&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(v[T]=l,l+c>b+S&&(b=l,S=c),!y&&Math.abs(T-L)<=w-1&&l>=C[T])return i[0]=l,s[0]=c,x<=C[T]&&w<=1448?this.WALKTRACE(k,u,d,E,L,f,h,g,v,C,l,n,i,c,o,s,y,a):null}const _=(b-t+(S-r)-w)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(b,_))return a[0]=!0,i[0]=b,s[0]=S,_>0&&w<=1448?this.WALKTRACE(k,u,d,E,L,f,h,g,v,C,l,n,i,c,o,s,y,a):(t++,r++,[new no(t,n-t+1,r,o-r+1)]);f=this.ClipDiagonalBound(L-w,w,L,p),h=this.ClipDiagonalBound(L+w,w,L,p);for(let T=f;T<=h;T+=2){T===f||T<h&&C[T-1]>=C[T+1]?l=C[T+1]-1:l=C[T-1],c=l-(T-L)-g;const x=l;for(;l>t&&c>r&&this.ElementsAreEqual(l,c);)l--,c--;if(C[T]=l,y&&Math.abs(T-k)<=w&&l<=v[T])return i[0]=l,s[0]=c,x>=v[T]&&w<=1448?this.WALKTRACE(k,u,d,E,L,f,h,g,v,C,l,n,i,c,o,s,y,a):null}if(w<=1447){let T=new Int32Array(d-u+2);T[0]=k-u+1,zo.Copy2(v,u,T,1,d-u+1),this.m_forwardHistory.push(T),T=new Int32Array(h-f+2),T[0]=L-f+1,zo.Copy2(C,f,T,1,h-f+1),this.m_reverseHistory.push(T)}}return this.WALKTRACE(k,u,d,E,L,f,h,g,v,C,l,n,i,c,o,s,y,a)}PrettifyChanges(t){for(let n=0;n<t.length;n++){const r=t[n],o=n<t.length-1?t[n+1].originalStart:this._originalElementsOrHash.length,i=n<t.length-1?t[n+1].modifiedStart:this._modifiedElementsOrHash.length,s=r.originalLength>0,a=r.modifiedLength>0;for(;r.originalStart+r.originalLength<o&&r.modifiedStart+r.modifiedLength<i&&(!s||this.OriginalElementsAreEqual(r.originalStart,r.originalStart+r.originalLength))&&(!a||this.ModifiedElementsAreEqual(r.modifiedStart,r.modifiedStart+r.modifiedLength));){const c=this.ElementsAreStrictEqual(r.originalStart,r.modifiedStart);if(this.ElementsAreStrictEqual(r.originalStart+r.originalLength,r.modifiedStart+r.modifiedLength)&&!c)break;r.originalStart++,r.modifiedStart++}const l=[null];if(n<t.length-1&&this.ChangesOverlap(t[n],t[n+1],l)){t[n]=l[0],t.splice(n+1,1),n--;continue}}for(let n=t.length-1;n>=0;n--){const r=t[n];let o=0,i=0;if(n>0){const d=t[n-1];o=d.originalStart+d.originalLength,i=d.modifiedStart+d.modifiedLength}const s=r.originalLength>0,a=r.modifiedLength>0;let l=0,c=this._boundaryScore(r.originalStart,r.originalLength,r.modifiedStart,r.modifiedLength);for(let d=1;;d++){const f=r.originalStart-d,h=r.modifiedStart-d;if(f<o||h<i||s&&!this.OriginalElementsAreEqual(f,f+r.originalLength)||a&&!this.ModifiedElementsAreEqual(h,h+r.modifiedLength))break;const m=(f===o&&h===i?5:0)+this._boundaryScore(f,r.originalLength,h,r.modifiedLength);m>c&&(c=m,l=d)}r.originalStart-=l,r.modifiedStart-=l;const u=[null];if(n>0&&this.ChangesOverlap(t[n-1],t[n],u)){t[n-1]=u[0],t.splice(n,1),n++;continue}}if(this._hasStrings)for(let n=1,r=t.length;n<r;n++){const o=t[n-1],i=t[n],s=i.originalStart-o.originalStart-o.originalLength,a=o.originalStart,l=i.originalStart+i.originalLength,c=l-a,u=o.modifiedStart,d=i.modifiedStart+i.modifiedLength,f=d-u;if(s<5&&c<20&&f<20){const h=this._findBetterContiguousSequence(a,c,u,f,s);if(h){const[m,p]=h;(m!==o.originalStart+o.originalLength||p!==o.modifiedStart+o.modifiedLength)&&(o.originalLength=m-o.originalStart,o.modifiedLength=p-o.modifiedStart,i.originalStart=m+s,i.modifiedStart=p+s,i.originalLength=l-i.originalStart,i.modifiedLength=d-i.modifiedStart)}}}return t}_findBetterContiguousSequence(t,n,r,o,i){if(n<i||o<i)return null;const s=t+n-i+1,a=r+o-i+1;let l=0,c=0,u=0;for(let d=t;d<s;d++)for(let f=r;f<a;f++){const h=this._contiguousSequenceScore(d,f,i);h>0&&h>l&&(l=h,c=d,u=f)}return l>0?[c,u]:null}_contiguousSequenceScore(t,n,r){let o=0;for(let i=0;i<r;i++){if(!this.ElementsAreEqual(t+i,n+i))return 0;o+=this._originalStringElements[t+i].length}return o}_OriginalIsBoundary(t){return t<=0||t>=this._originalElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._originalStringElements[t])}_OriginalRegionIsBoundary(t,n){if(this._OriginalIsBoundary(t)||this._OriginalIsBoundary(t-1))return!0;if(n>0){const r=t+n;if(this._OriginalIsBoundary(r-1)||this._OriginalIsBoundary(r))return!0}return!1}_ModifiedIsBoundary(t){return t<=0||t>=this._modifiedElementsOrHash.length-1?!0:this._hasStrings&&/^\s*$/.test(this._modifiedStringElements[t])}_ModifiedRegionIsBoundary(t,n){if(this._ModifiedIsBoundary(t)||this._ModifiedIsBoundary(t-1))return!0;if(n>0){const r=t+n;if(this._ModifiedIsBoundary(r-1)||this._ModifiedIsBoundary(r))return!0}return!1}_boundaryScore(t,n,r,o){return(this._OriginalRegionIsBoundary(t,n)?1:0)+(this._ModifiedRegionIsBoundary(r,o)?1:0)}ConcatenateChanges(t,n){const r=[];if(t.length===0||n.length===0)return n.length>0?n:t;if(this.ChangesOverlap(t[t.length-1],n[0],r)){const o=new Array(t.length+n.length-1);return zo.Copy(t,0,o,0,t.length-1),o[t.length-1]=r[0],zo.Copy(n,1,o,t.length,n.length-1),o}else{const o=new Array(t.length+n.length);return zo.Copy(t,0,o,0,t.length),zo.Copy(n,0,o,t.length,n.length),o}}ChangesOverlap(t,n,r){if(qo.Assert(t.originalStart<=n.originalStart,"Left change is not less than or equal to right change"),qo.Assert(t.modifiedStart<=n.modifiedStart,"Left change is not less than or equal to right change"),t.originalStart+t.originalLength>=n.originalStart||t.modifiedStart+t.modifiedLength>=n.modifiedStart){const o=t.originalStart;let i=t.originalLength;const s=t.modifiedStart;let a=t.modifiedLength;return t.originalStart+t.originalLength>=n.originalStart&&(i=n.originalStart+n.originalLength-t.originalStart),t.modifiedStart+t.modifiedLength>=n.modifiedStart&&(a=n.modifiedStart+n.modifiedLength-t.modifiedStart),r[0]=new no(o,i,s,a),!0}else return r[0]=null,!1}ClipDiagonalBound(t,n,r,o){if(t>=0&&t<o)return t;const i=r,s=o-r-1,a=n%2===0;return t<0?a===(i%2===0)?0:1:a===(s%2===0)?o-1:o-2}};function ll(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Vt=class{get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){A(this,"oldPosition",void 0),A(this,"oldText",void 0),A(this,"newPosition",void 0),A(this,"newText",void 0),this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${ll(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${ll(this.oldText)}")`:`(replace@${this.oldPosition} "${ll(this.oldText)}" with "${ll(this.newText)}")`}};function At(e,t){return e===null||e.length===0?t:new S2(e,t).compress()}var S2=class Er{constructor(t,n){A(this,"_prevEdits",void 0),A(this,"_currEdits",void 0),A(this,"_result",void 0),A(this,"_resultLen",void 0),A(this,"_prevLen",void 0),A(this,"_prevDeltaOffset",void 0),A(this,"_currLen",void 0),A(this,"_currDeltaOffset",void 0),this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),o=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(o===null)break;this._acceptCurr(o),o=this._getCurr(++n);continue}if(o===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldEnd<=r.newPosition){this._acceptCurr(o),o=this._getCurr(++n);continue}if(r.newEnd<=o.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(o.oldPosition<r.newPosition){const[l,c]=Er._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(l),o=c;continue}if(r.newPosition<o.oldPosition){const[l,c]=Er._splitPrev(r,o.oldPosition-r.newPosition);this._acceptPrev(l),r=c;continue}let s,a;if(o.oldEnd===r.newEnd)s=r,a=o,r=this._getPrev(++t),o=this._getCurr(++n);else if(o.oldEnd<r.newEnd){const[l,c]=Er._splitPrev(r,o.oldLength);s=l,a=o,r=c,o=this._getCurr(++n)}else{const[l,c]=Er._splitCurr(o,r.newLength);s=r,a=l,r=this._getPrev(++t),o=c}this._result[this._resultLen++]=new Vt(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const i=Er._merge(this._result);return Er._removeNoOps(i)}_acceptCurr(t){this._result[this._resultLen++]=Er._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=Er._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new Vt(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new Vt(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),o=t.newText.substr(n);return[new Vt(t.oldPosition,t.oldText,t.newPosition,r),new Vt(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new Vt(t.oldPosition,r,t.newPosition,t.newText),new Vt(t.oldPosition+n,o,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,o=t[0];for(let i=1;i<t.length;i++){const s=t[i];o.oldEnd===s.oldPosition?o=new Vt(o.oldPosition,o.oldText+s.oldText,o.newPosition,o.newText+s.newText):(n[r++]=o,o=s)}return n[r++]=o,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let o=0;o<t.length;o++){const i=t[o];i.oldText!==i.newText&&(n[r++]=i)}return n}};function Ub(e){return new Vt(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Pn(e){return e.map(Ub)}function w2(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const o=t[r];n=n.slice(0,o.oldPosition)+o.newText+n.slice(o.oldEnd)}return n}function _2(e,t,n){let r=0;const o=e.start===e.end;for(const i of t){const s=i.newLength-i.oldLength;if(i.oldLength===0){const a=i.oldPosition;if(o&&a===e.start)r+=n==="after"?s:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=s)}continue}if(o){if(e.start>=i.oldEnd)r+=s;else if(e.start>i.oldPosition)return null;continue}if(e.start>=i.oldEnd)r+=s;else if(e.end>i.oldPosition)return null}return{start:e.start+r,end:e.end+r}}function cl(e,t,n){if(!t.length)return[...e];const r=[];let o=0;for(const i of e){const s=_2({start:i.oldPosition,end:i.oldEnd},t,n);if(!s)return null;r.push(new Vt(s.start,i.oldText,s.start+o,i.newText)),o+=i.newLength-i.oldLength}return r}function jb(e,t,n=0){const r=e.range;return new Vt(e.range.start,typeof t=="string"?t.substring(r.start,r.end):t.getText(r),r.start+n,e.text)}function Uo(e,t){let n=0;return e.map(({text:r,range:{start:o,end:i}})=>{let s=n;return n+=r.length-(i-o),jb({text:r,range:{start:o,end:i}},t,s)})}function C2(e){return{range:{start:e.oldPosition,end:e.oldEnd},text:e.newText}}function ro(e){return e.map(t=>C2(t))}function T2(e,t=ls(e)){const n=e.getLength(),{start:r,end:o}=t;return r>n||o<0?null:{start:r,end:o}}var gne=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");function A2(e,{start:t,end:n}){return{start:t,end:n+(e.newLength-e.oldLength)}}function ls(e){return{start:0,end:e.getLength()}}function k2(e,t,n){return`${e.substring(0,n.start)}${t}${e.substring(n.end)}`}function cs(e,t){const n=[e];for(let r=t.length-1;r>=0;r--){const{text:o,range:i}=t[r],s=n[0];n.splice(0,1,s.substring(0,i.start),o,s.substring(i.end))}return n.join("")}function L2(e,t){return t=ul(t).sort(({range:n},{range:r})=>n.start-r.start),cs(e,t)}function us(e,t){return e>=t.start&&e<=t.end}function ul(e,t){e=[...e];let n=e.length;if(n<=1)return e;e=e.sort(({range:r},{range:o})=>r.start-o.start);for(let r=0;r<n;r++){let o=e[r],i=e[r].range;for(let s=r+1;s<n;s++){const a=e[s];let l=e[s].range,c;if(us(i.start,l)&&us(i.start,l))c=l;else if(us(l.start,i))us(l.end,i)?c=i:c={start:i.start,end:l.end};else if(us(l.end,i))c={start:l.start,end:i.end};else continue;const u=o.text;let d=l.start-i.start+u.length,f=l.end-i.start+u.length;const h=k2(u,a.text,{start:d,end:f});e[r]=o={range:i=c,text:h},e.splice(s--,1),n--}}return e}function N2(e,t){if(e.length<=1)return e[0]||null;e=ul(e);const n=e.reduce((r,{range:o})=>({start:Math.min(r.start,o.start),end:Math.max(r.end,o.end)}),{start:Number.MAX_VALUE,end:Number.MIN_VALUE});return{text:cs(t.substring(n.start,n.end),e.map(({range:r,text:o})=>({text:o,range:{start:r.start-n.start,end:r.end-n.start}}))),range:n}}function x2(e,t){const n=Pn(e),r=N2(ro(n),t);if(r){const o=jb(r,t);return Ub(o)}return null}function O2(e,{range:t,text:n}){const r=e.getText(t);return qb(r,n,!0).map(o=>({range:{start:t.start+o.originalStart,end:t.start+o.originalStart+o.originalLength},text:n.substring(o.modifiedStart,o.modifiedStart+o.modifiedLength)}))}function Vb({oldText:e,newText:t,oldPosition:n,newPosition:r}){return qb(e,t,!0).map(o=>new Vt(n+o.originalStart,e.substring(o.originalStart,o.originalStart+o.originalLength),r+o.modifiedStart,t.substring(o.modifiedStart,o.modifiedStart+o.modifiedLength)))}var R2=class{constructor(e,t){A(this,"index",void 0),A(this,"values",void 0),A(this,"type","insert"),this.index=e,this.values=t}},M2=class{constructor(e,t){A(this,"index",void 0),A(this,"howMany",void 0),A(this,"type","remove"),this.index=e,this.howMany=t}},P2=class{constructor(e,t,n){A(this,"from",void 0),A(this,"to",void 0),A(this,"howMany",void 0),A(this,"type","move"),this.from=e,this.to=t,this.howMany=n}};function I2(e,t){return e===t}function D2(e,t,n=I2){for(var r=e.length,o=t.length,i=[],s=Object.create(null),a=Object.create(null),l=0;l<r;l++)for(var c=e[l],u=0;u<o;u++)if(!a[u]&&n(c,t[u])){var d=l,f=u,h=0;do s[l++]=a[u++]=!0,h++;while(l<r&&u<o&&n(e[l],t[u])&&!a[u]);i.push(new P2(d,f,h)),l--;break}var m=[];for(l=0;l<r;){if(s[l]){l++;continue}for(var p=l,h=0;l<r&&!s[l++];)h++;m.push(new M2(p,h))}for(var v=[],u=0;u<o;){if(a[u]){u++;continue}for(var p=u,h=0;u<o&&!a[u++];)h++;var C=t.slice(p,p+h);v.push(new R2(p,C))}var k=v.length,L=m.length,E=i.length,g,y,w=0;for(g=0;g<L;g++){var b=m[g];for(b.index-=w,w+=b.howMany,y=0;y<E;y++){var S=i[y];S.from>=b.index&&(S.from-=b.howMany)}}for(g=k;g--;){var _=v[g],h=_.values.length;for(y=E;y--;){var S=i[y];S.to>=_.index&&(S.to-=h)}}for(g=E;g-- >1;){var S=i[g];if(S.to!==S.from)for(y=g;y--;){var T=i[y];T.to>=S.to&&(T.to-=S.howMany),T.to>=S.from&&(T.to+=S.howMany)}}var x=[];for(g=0;g<E;g++){var S=i[g];if(S.to!==S.from)for(x.push(S),y=g+1;y<E;y++){var N=i[y];N.from>=S.from&&(N.from-=S.howMany),N.from>=S.to&&(N.from+=S.howMany)}}return[...m,...x,...v]}var Gb=class{constructor(){A(this,"_byKey",new Map),A(this,"_byValue",new Map)}set(e,t){this._byKey.set(e,t),this._byValue.set(t,e)}getByKey(e){return this._byKey.get(e)}getByValue(e){return this._byValue.get(e)}delete(e){const t=this._byKey.has(e);if(t){const n=this._byKey.get(e);this._byKey.delete(e),this._byValue.delete(n)}return t}deleteByValue(e){const t=this._byValue.has(e);if(t){const n=this._byValue.get(e);this._byValue.delete(e),this._byKey.delete(n)}return t}get size(){return this._byKey.size}},le;(function(e){function t(d,f,h){return{type:"Add",node:f,nextSibling:h,parent:d}}e.add=t;function n(d){return{type:"Remove",node:d}}e.remove=n;function r(d,f,h){return{type:"Attribute",node:d,name:f,value:h}}e.attribute=r;function o(d,f,h){return h?{type:"Update",prev:d,next:f,soft:h}:{type:"Update",prev:d,next:f}}e.update=o;function i(d,f,h,m){return[{type:"Remove",node:d},{type:"Add",node:h,nextSibling:m,parent:f,replaces:d}]}e.recreate=i;function s(d,f,h){return{type:"Move",node:f,nextSibling:h,parent:d}}e.move=s;function a(d,f){return{type:"Set",node:d,data:f}}e.set=a;function l(d,f,h){return{type:"ClassList",node:d,addedClasses:f,removedClasses:h}}e.classList=l;function c(d,f){return{type:"Style",node:d,value:f}}e.style=c;function u(d,f){return{type:"Hidden",node:d,value:f}}e.hidden=u})(le||(le={}));function Xb(e,t){return e.push(t),{dispose:()=>{const n=e.indexOf(t);n!==-1&&e.splice(n,1)}}}var Kb=[],Yb=[];function B2(e){return Xb(Kb,e)}function Pd(e){return e?Kb.some(t=>t(e)):!1}function H2(e){return Xb(Yb,e)}function F2(e){return Yb.some(t=>t(e))}function $2(e,t){const n=e.attributes||{},r=t.attributes||{},o=e.attributeNames,i=t.attributeNames,s=o.length,a=i.length,l=[];let c=0;for(;c<s;c++){const u=o[c];if(u!==i[c]){for(let d=c;d<s;d++){const f=o[d];l.push(le.attribute(t,f,void 0))}break}else r[u]!==n[u]&&l.push(le.attribute(t,u,r[u]))}for(;c<a;c++){const u=i[c];l.push(le.attribute(t,u,r[u]))}return l}function W2(e){let t=[];const n=e.children.filter(o=>o.type!==D.HTML||!!o.content);let r;for(let o=n.length-1;o>=0;o--)t.push(le.add(e,n[o],r)),r=n[o];return t}function q2(e){return le.remove(e)}var z2=new Set(["head","body","html"]),U2=e=>e.type===D.ROOT||e.type===D.DOCTYPE||e.type===D.ELEMENT&&e.tag&&z2.has(e.tag.toLowerCase()),j2=/^<[!?/]/;function Id(e){return e.type===D.ELEMENT?String(e.tag):e.type===D.HTML&&j2.test(e.content??"")?"bogus":String(e.type)}function dl(e){const t=new Gb,n=Object.create(null);for(const r of e){const o=Id(r)+(!U2(r)&&r.start===r.end?"_hidden":"");let i="";r.type===D.ELEMENT&&r.attributes?.id?i=`id_${r.attributes.id}`:i=n[o]=(n[o]||0)+1,t.set(`${o}_${i}`,r)}return t}function Zb(e){const t=[];let n=0;for(const r of[...e].sort((o,i)=>o.oldPosition-i.oldPosition)){const o=r.newLength-r.oldLength,i=t[t.length-1];i&&r.oldPosition<i.oldEnd?(i.oldEnd=Math.max(i.oldEnd,r.oldEnd),i.delta+=o):t.push({oldPosition:r.oldPosition,oldEnd:r.oldEnd,shift:n,delta:o}),n+=o}return t}function fl(e,t){const n=e[t-1];return t<e.length?e[t].shift:n.shift+n.delta}function Dd(e,t){return(e.type===D.HTML?e.end+1:e.end)<=t.oldPosition}function V2(e,t){return(e.type===D.HTML?e.start-1:e.start)>=t.oldEnd}function Bd(e,t,n){return!!t&&t.start===n&&t.type===e.type&&t.tag===e.tag&&t.attributes?.id===e.attributes?.id&&t.end-t.start===e.end-e.start}function Hd(e,t){return t.type===e.type&&Id(t)===Id(e)&&t.attributes?.id===e.attributes?.id}function ds(e,t,n){return Jn(e,!1,n)===Jn(t,!1,n)}function Fd(e,t,n){let r=t,o=e;for(;r<o;){const i=r+o>>1;n(i)?o=i:r=i+1}return r}function ml(e,t,n=0){return Fd(t.length,n,r=>!V2(e,t[r]))}function $d(e,t){const n=ml(e,t);return t.slice(n,ey(e,t,n))}function Qb(e,t){const n=ml(e,t);return n<t.length&&!Dd(e,t[n])?void 0:e.start+fl(t,n)}function hl(e){return e.type===D.ELEMENT?e.attributes?.id:void 0}function Jb(e){const t=new Set,n=new Set;for(const r of e){const o=hl(r);o&&(t.has(o)?n:t).add(o)}return n}function G2(e,t,n){const r=new Set([...Jb(t),...Jb(n)]),o=new Map;e.forEach((s,a)=>{for(let l=s.prevFrom;l<s.prevTo;l++){const c=hl(t[l]);c&&o.set(c,{node:t[l],gap:a})}});const i=new Map;return e.forEach((s,a)=>{for(let l=s.nextFrom;l<s.nextTo;l++){const c=hl(n[l]),u=c?o.get(c):void 0;c&&u&&u.gap!==a&&!r.has(c)&&Hd(u.node,n[l])&&i.set(c,u.node)}}),i}function X2(e,t,n){const r=[];let o={prevFrom:0,prevTo:0,nextFrom:0,nextTo:0},i=0,s=0,a=0;const l=(c,u,d)=>{(c>o.prevFrom||u>o.nextFrom)&&r.push({...o,prevTo:c,nextTo:u,edits:n.slice(i,d)})};for(let c=0;c<e.length;c++){const u=e[c];if(s=ml(u,n,s),s<n.length&&!Dd(u,n[s]))continue;const d=u.start+fl(n,s),f=Fd(t.length,a,h=>t[h].start>=d);Bd(u,t[f],d)&&(a=f,l(c,a,s),o={prevFrom:c+1,prevTo:c+1,nextFrom:a+1,nextTo:a+1},i=s,a++)}return l(e.length,t.length,n.length),r}function ey(e,t,n){return Fd(t.length,n,r=>Dd(e,t[r]))}function ty(e,t,n,r,o,i,s){const a=ml(e,o),l=ey(e,o,a),c=(p,v=()=>!0)=>p?.find(C=>C>=n&&C<r&&Hd(e,t[C])&&v(t[C]))??-1,u=e.start+fl(o,a),d=e.end+fl(o,l),f=a===o.length||e.start<o[a].oldPosition,h=f?c(s.byStart.get(u)):-1,m=l>a&&e.end>o[l-1].oldEnd?c(s.byEnd.get(d),p=>!(f&&Y2(e,p,u))):-1;return h>=0&&m>=0&&h!==m?ds(e,t[h],i)||ds(e,t[m],i)?ds(e,t[h],i)?h:m:ry(e,t[m],o)>ry(e,t[h],o)?m:h:h>=0?h:m}function ny(e,t,n){const r=e.get(t);r?r.push(n):e.set(t,[n])}function K2(e,t,n){const r={byStart:new Map,byEnd:new Map};for(let o=t;o<n;o++)ny(r.byStart,e[o].start,o),ny(r.byEnd,e[o].end,o);return r}function Y2(e,t,n){for(let r=t.lastChild;r&&r.end===t.end;r=r.lastChild)if(r.start===n&&Hd(e,r))return!0;return!1}function ry(e,t,n){const r=new Map(t.children.map(o=>[o.start,o]));return e.children.filter(o=>{const i=Qb(o,n);return i!==void 0&&Bd(o,r.get(i),i)}).length}function oy(e,t){return $d(e,t).reduce((n,r)=>n-Math.max(0,Math.min(e.end,r.oldEnd)-Math.max(e.start,r.oldPosition)),e.end-e.start)}function Z2(e,t,n,r,o,i){const s=ds(e,t,i),a=ds(n,r,i);return s!==a?a:oy(n,o)>oy(e,o)}function Q2(e,t,n,r){const o=n.edits??[],i=[],s=[];let{prevFrom:a,prevTo:l,nextFrom:c,nextTo:u}=n;const d=K2(t,c,u);for(;o.length&&a<l&&c<u;){const f=ty(e[l-1],t,c,u,o,r,d);if(l-1===a){f>=0&&s.unshift([a,f]);break}const h=ty(e[a],t,c,u,o,r,d);let m=h>=0,p=f>=0;if(m&&p&&h>=f&&(p=Z2(e[a],t[h],e[l-1],t[f],o,r),m=!p),!m&&!p)break;m&&(i.push([a,h]),a++,c=h+1),p&&(s.unshift([l-1,f]),l--,u=f)}return[...i,...s]}function J2(e,t){const n=[];let r=e.prevFrom,o=e.nextFrom;for(const[i,s]of[...t,[e.prevTo,e.nextTo]])(i>r||s>o)&&n.push({prevFrom:r,prevTo:i,nextFrom:o,nextTo:s,edits:e.edits}),r=i+1,o=s+1;return n}function ex(e,t,n,r,o){const i=o?.length?Qb(e,o):void 0;return(i===void 0?void 0:t.children.find(s=>Bd(e,s,i)))??r.getByKey(n.getByValue(e)??"")}function fs(e,t){for(const n of t)e.push(n)}function iy(e,t,n,r,o,i,s,a,l=new Map){const c=[],u=r.prevFrom,d=t.slice(u,r.prevTo),f=n.slice(r.nextFrom,r.nextTo),[h,m]=o??[dl(d),dl(f)],p=D2(d,f,(C,k)=>h.getByValue(C)===m.getByValue(k)),v=C=>{const k=hl(C);return k?l.get(k):void 0};for(const C of p)switch(C.type){case"insert":{const k=u+C.index;let L=t[k];for(const E of C.values.reverse()){t.splice(k,0,E),i.add(E);const g=v(E);g?(fs(c,pl(g,E,s,a)),c.push(le.move(e,E,L))):c.push(le.add(e,E,L)),L=E}break}case"remove":{const k=t.splice(u+C.index,C.howMany);for(const L of k)v(L)!==L&&c.push(le.remove(L));break}case"move":{const k=t.splice(u+C.from,C.howMany);let L=t[u+C.to];t.splice(u+C.to,0,...k);for(const E of k.reverse()){const g=m.getByKey(h.getByValue(E)??"");if(!g)return st("error while sync",c);i.add(g),fs(c,pl(E,g,s,a,r.edits&&$d(E,r.edits))),c.push(le.move(e,g,L)),L=E}break}}return c}function Wd(e,t,n=!1,r=ud(),o){const i=[],s=dl(e.children),a=dl(t.children);for(let p=e.children.length-1;p>=0;p--){const v=e.children[p];if(v.type===D.ELEMENT&&v.start===v.end){const C=s.getByValue(v);if(!a.getByKey(C)){let k=!1;for(let L=p+1;L<e.children.length;L++){const E=e.children[L];if(E){const g=ex(E,t,s,a,o);if(g){const y=g.start,w=v.clone();t.children.splice(t.children.indexOf(g),0,w),nr(w,y-v.start),w.parent=t,a.set(C,w),k=!0;break}}}if(!k){const L=t.endTagStart===void 0?t.end:t.endTagStart,E=v.clone();t.children.push(E),a.set(C,E),nr(E,L-v.start),E.parent=t}}}}const l=e.children.filter(p=>p.type!==D.HTML||!!p.content),c=t.children.filter(p=>p.type!==D.HTML||!!p.content),u=o?.length?X2(l,c,o):null,d=u?G2(u,l,c):new Map,f=new Set;for(const p of u?[...u].reverse():[]){const v=J2(p,Q2(l,c,p,r)).reverse();for(const C of v)fs(i,iy(t,l,c,C,void 0,f,n,r,d))}const h={prevFrom:0,prevTo:l.length,nextFrom:0,nextTo:c.length,edits:o};u||fs(i,iy(t,l,c,h,[s,a],f,n,r)),c.length!==l.length&&st("error while sync");const m=new Map;for(const p of u??[h])for(let v=p.nextFrom;v<p.nextTo;v++)m.set(v,p.edits);for(let p=c.length-1;p>=0;p--){const v=c[p];if(!f.has(v)){const C=m.get(p);fs(i,pl(l[p],v,n,r,C&&$d(l[p],C)))}}return i}function qd(e){return e.type===D.ELEMENT&&Pd(e.tag)}function pl(e,t,n=!1,r=ud(),o){if(e.type===t.type&&!(e.isDirty||t.isDirty)){if(qd(e)&&e.tag===t.tag){if(Jn(e,!1,r)===Jn(t,!1,r))return[le.update(e,t,n),...Wd(e,t,!0,r)]}else if((e.type===D.ELEMENT||e.type===D.ROOT)&&e.tag===t.tag)return[le.update(e,t,n),...$2(e,t),...Wd(e,t,n,r,o)];if(e.type===D.HTML||e.type===D.COMMENT)return e.content===t.content?[le.update(e,t,n)]:[le.update(e,t,n),le.set(t,t.content)]}return!e.parent||!t.parent?st("cannot replace document",[]):qd(e)&&e.tag===t.tag?le.recreate(e,t.parent,t,Ar(t)||void 0):[le.remove(e),le.add(t.parent,t,Ar(t)||void 0)]}var rr="FROM_DOM",or="FROM_REMOTE",tx=/<\/.*>/i;function nx(e){return tx.test(e)}var rx=/^<[!?/][^>]*$/,ox=class extends Ee{constructor(e,t){super(),A(this,"_baseDocument",void 0),A(this,"_createRoot",void 0),A(this,"_beforeTextChangeEmitter",this.addDisposable(new ge)),A(this,"_onTextChangeEmitter",this.addDisposable(new ge)),A(this,"_onMutateEmitter",this.addDisposable(new ge)),A(this,"_beforeRefreshEmitter",this.addDisposable(new ge)),A(this,"_onRefreshEmitter",this.addDisposable(new ge)),A(this,"_root",new Tt(0,0,[])),A(this,"_applyingMutation",void 0),A(this,"_insertRun",void 0),A(this,"beforeTextChange",this._beforeTextChangeEmitter.event),A(this,"beforeRefresh",this._beforeRefreshEmitter.event),A(this,"onTextChange",this._onTextChangeEmitter.event),A(this,"onRefresh",this._onRefreshEmitter.event),A(this,"onMutate",this._onMutateEmitter.event),this._baseDocument=e,this._createRoot=t,this._baseDocument.onChanged(this._onTextChange.bind(this));const n=this._root=new Tt(0,0,[]);n.type=D.ROOT}get root(){return this._root}contains(e){return e.root===this.root}isAttached(e){let t=e;for(;t.parent;){if(!t.parent.children.includes(t))return!1;t=t.parent}return t===this.root}get applyingMutation(){return this._applyingMutation}initialize(e,t,n){const r=this._root;this._beforeRefreshEmitter.fire();let{roots:o}=hn(e),i=this._root=this._createRoot?this._createRoot(o,e):new Tt(0,e.length,o);if(i.type=D.ROOT,this._createRoot||o.forEach(s=>s.parent=i),!t){const s=n&&Zb(n);this._onRefreshEmitter.fire(r?Wd(r,i,!1,void 0,s):W2(i))}}_onTextChange({source:e,changes:t}){if(e==="FROM_REMOTE"){const n=x2(t,this._baseDocument.getText());if(n)try{this._beforeTextChangeEmitter.fire(),al("text",()=>this.replaceWithHtml(n,or,t))}finally{this._onTextChangeEmitter.fire()}}}insertBefore(e,t,n,r){if(t.parent){if(t.parent===e&&Ar(t)===n)return t;this.remove(t,r)}const o=this.contains(e),i=Va(t),s=e.children,a=n?s.indexOf(n):s.length;if(a<0)return st("referenced node is not a child of parent node",t);s.splice(a,0,t);const l=n?n.start:e.endTagStart===void 0?e.end:e.endTagStart;return t.parent=e,nr(t,l-t.start,i.length),o&&(r!=="FROM_DOM"&&this._onMutateEmitter.fire([le.add(e,t,n||void 0)]),r!=="FROM_REMOTE"&&this._baseDocument.applyEdits(r,[{text:i,range:{start:l,end:l}}])),t}_batchInsert(e,t,n){const r=this._insertRun;if(t.parent||!this.contains(e))return!1;const o=n?n.start:e.endTagStart===void 0?e.end:e.endTagStart,i=e.children,s=n?r?.items[0].node===n?r.start:i.indexOf(n):i.length;if(s<0||r&&r.parent!==e)return!1;const a=s-(r?r.start:s);if(r&&(a<0||a>r.items.length))return!1;const l=Va(t),c=r??(this._insertRun={parent:e,start:s,offset:o,items:[],length:0});return i.splice(s,0,t),t.parent=e,c.items.splice(a,0,{node:t,text:l}),c.length+=l.length,!0}_flushInsertRun(e){const t=this._insertRun;if(!t)return;this._insertRun=void 0;let n=t.offset;for(const{node:r,text:o}of t.items)nr(r,n-r.start),n+=o.length;nr(t.items[t.items.length-1].node,0,t.length),e!=="FROM_REMOTE"&&this._baseDocument.applyEdits(e,[{text:t.items.map(r=>r.text).join(""),range:{start:t.offset,end:t.offset}}])}getContext(e){return e.closest(t=>Pd(t.tag))}replaceWithHtml(e,t,n=[e]){const r=this._baseDocument,o=u=>{const d=this.getContext(u);if(d)return d.isDirty=!0,Promise.resolve().then(()=>{d.isDirty=!1}),!1;if(u.type!==D.HTML){if(!u.closed)return!1}else return!u.content||!nx(u.content)&&!rx.test(u.content);return!0};if(!this._root)return this.initialize(r.getText(),!1,n);let i={start:e.oldPosition,end:e.oldEnd},s=g2(i,this._root);if(!s)return this.initialize(r.getText(),!1,n);let a,l,c;do{const u=A2(e,s);a=this._baseDocument.getText(u),[l,...c]=hn(a).roots}while((!l||c.length||!o(s)||!o(l)||l.end-l.start!==a.length)&&(s=s.parent));if(!s||!s.parent)return this.initialize(r.getText(),!1,n);this.replaceChild(s.parent,{node:l,text:a},s,t,n)}replaceChild(e,t,n,r,o){const{text:i,node:s}=t,a=e.children,l=a.indexOf(n);if(l<0)return st("referenced node is not a child of parent node",s);a.splice(l,1,s);const c=i.length-(n.end-n.start);return s.parent=e,nr(s,n.start-s.start,c),this._baseDocument.getText(s)!==i?(st("Error while sync"),s):(r!=="FROM_DOM"&&this._onMutateEmitter.fire(pl(n,s,!1,void 0,o&&Zb(o))),n.parent=void 0,s)}remove(e,t){const n=this.contains(e),r=e.parent;if(!r)return st("node is not in tree");const o=r.children,i=o.indexOf(e);if(i<0)return st("referenced node is not a child of parent node");const s=e.end-e.start;nr(e,0,-s),o.splice(i,1),n&&(t!=="FROM_DOM"&&this._onMutateEmitter.fire([q2(e)]),t!=="FROM_REMOTE"&&this._baseDocument.applyEdits(t,[{text:"",range:{start:e.start,end:e.end}}])),e.parent=void 0}setAttribute(e,t,n,r){const o=this.contains(e),i=e.attributes||(e.attributes=Object.create(null));if(typeof n=="string"?i[t]=n:delete i[t],e.start===e.startTagEnd)return;const s=Fg(e),a=e.startTagEnd===void 0?0:e.startTagEnd-e.start-(e.tag?.length||0)-2,l=b2(e),c=s.length-a,u=e.start;nr(e,c,c),e.start=u,o&&this._baseDocument.applyEdits(r,[{text:s,range:l}])}setContent(e,t,n){const r=this.contains(e),o=e.start,i=e.end;e.content=t;const s=e.end-e.start;if(!s)return;const a=Va(e,o),l=a.length-s;nr(e,0,l),r&&this._baseDocument.applyEdits(n,[{text:a,range:{start:o,end:i}}])}replaceWith(e,t,n){const r=e.parent;if(r){let o=Ar(e);this.remove(e,n);for(let i=t.length-1;i>=0;i--){const s=t[i];this.insertBefore(r,s,o,n),o=s}}return t}replaceWithEx(e,t,n){if(typeof t=="string"){const i=hn(t).roots;i.length!==1&&st("Error while replacing with string"),t=i[0]}const r=e.children;this.replaceWith(e,[t],n);let o=null;for(let i=r.length-1;i>=0;i--){let s=r[i];this.insertBefore(t,s,o,n),o=s}return t}setHidden(e,t,n){t?e.parent&&this.remove(e,n):this.replaceWith(e,[...e.children],n)}applyMutations(e){this._baseDocument.beginUpdate();try{for(const t of e){if(this._applyingMutation=t,t.type==="Add"){const n=t.parent||this.root,r=t.nextSibling||null;this._batchInsert(n,t.node,r)||(this._flushInsertRun(rr),this.insertBefore(n,t.node,r,rr));continue}switch(this._flushInsertRun(rr),t.type){case"Remove":this.remove(t.node,rr);break;case"Set":this.setContent(t.node,t.data,rr);break;case"Hidden":this.setHidden(t.node,t.value,rr);break;case"Attribute":this.setAttribute(t.node,t.name,t.value===void 0?null:t.value,rr)}}}finally{try{this._flushInsertRun(rr)}finally{this._applyingMutation=void 0,this._baseDocument.endUpdate()}}}getNodeByPosition(e){return this._root?.findNodeAt(e)}};function ix(e,t){return e.replace(new RegExp(`<(?=/${t.tagName}${ja})`,"gi"),"<")}function sy(e,t){return tb(e)??ix(e.textContent??"",t)}function yn(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e.tagName.toUpperCase();return t==="STYLE"||t==="SCRIPT"&&!Qg.has(e.getAttribute("type")??"")}var sx=4,ax=3,lx=80,ay={Add:"insertBefore",Remove:"remove",Set:"set",Hidden:"hidden",Attribute:"attribute",Update:"update",Move:"move"},cx={[D.HTML]:"text",[D.ELEMENT]:"element",[D.ROOT]:"root",[D.COMMENT]:"comment",[D.DOCTYPE]:"doctype",[D.ADVANCED]:"advanced"},ux=new Set(["head","body"]);function zd(e){return(e??"").replace(/^(['"])(.*)\1$/s,"$2")}function ly(e,t,n,r){const o=n.split(/\s+/).filter(Boolean).slice(0,ax);return(e+(t?`#${t}`:"")+o.map(i=>`.${i}`).join("")+(r?`[em=${r}]`:"")).slice(0,lx)}function dx(e){if(!e.tag)return`#${e.type}`;const t=e.attributes??{};return ly(e.tag,zd(t.id),zd(t.class),zd(t.em))}function cy(e){return e instanceof Element?ly(e.localName,e.id,e.getAttribute("class")??"",e.getAttribute("em")??""):e.nodeName.toLowerCase()}function Ud(e,t,n){const r=[];let o=e;for(;o&&r.length<sx;)r.unshift(n(o)),o=t(o);return r.join(" > ")}function fx(e){let t,n=e;for(;;){const r=n.tag?.toLowerCase();if(!t&&r&&ux.has(r)?t=r:r==="html"&&(t??(t="html")),!n.parent)break;n=n.parent}return n.type!==D.ROOT?"outside":t??"top"}function jd(e,t,n){const r=t(e);return{path:Ud(e,o=>o.parent,dx),inTree:n(e),inDom:!!r?.isConnected,...r?{domPath:Ud(r,o=>o.parentNode,cy)}:{},inMap:!!r,hasParent:!!e.parent,kind:cx[e.type]??String(e.type),root:fx(e)}}function uy(e,t,n){if(!e)return;const r=i=>jd(i,t,n);if(e.type==="Update")return{type:ay.Update,node:r(e.prev),...e.next.parent?{parent:r(e.next.parent)}:{}};if(!("node"in e))return;const o={type:ay[e.type]??e.type,node:r(e.node)};return e.type==="Add"||e.type==="Move"?(e.parent&&(o.parent=r(e.parent)),e.nextSibling&&(o.reference=r(e.nextSibling))):e.node.parent&&(o.parent=r(e.node.parent)),o}function Vd(e){let t=e;for(;t.parent;){if(!t.parent.children.includes(t))return!1;t=t.parent}return t.type===D.ROOT}function mx(e,t,n,r){const o=s=>jd(s,a=>r.getByNode(a),Vd),i=Ud(e,s=>s.parentNode,cy);return{type:"insertBefore",node:{path:i,inTree:!1,inDom:e.isConnected,domPath:i},parent:o(t),reference:o(n)}}function hx(e,t){const n=r=>jd(r,o=>t.getByNode(o),Vd);return{type:"remove",node:n(e),...e.parent?{parent:n(e.parent)}:{}}}function px(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}function dy(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var fy=Object.create(null);function my(e,t){const n=fy[e]||(fy[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[px(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function In(e){return e.nodeType===Node.ELEMENT_NODE}function hy(e){return In(e)?e.tagName==="AMP-IMG"?!0:my(e.tagName.toLowerCase(),"src"):!1}function Gd(e){return In(e)&&!e.ownerSVGElement}function gx(e){return e.tagName==="IMG"}function bx(e){return e.tagName==="FORM"}function yx(e){return e.tagName==="SCRIPT"}function vx(e){return e.tagName==="STYLE"}function Xd(e){return e.nodeType===Node.DOCUMENT_NODE}function py(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var ms;(function(e){function t(f){return f.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function n(f){return f.constructor.name==="CSSImportRule"}e.isImportRule=n;function r(f){return f.constructor.name==="CSSMediaRule"}e.isMediaRule=r;function o(f){return f.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=o;function i(f){return f.constructor.name==="CSSPageRule"}e.isPageRule=i;function s(f){return f.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=s;function a(f){return f.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=a;function l(f){return f.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=l;function c(f){return f.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=c;function u(f){return f.constructor.name==="CSSSupportsRule"}e.isSupportsRule=u;function d(f){return f.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=d})(ms||(ms={}));function hs(e){return e.nodeType===Node.COMMENT_NODE}function oo(e){return e.nodeType===Node.TEXT_NODE}function Ex(e){return e.tagName==="TABLE"}async function Sx(e,t=5e3){return typeof e.complete<"u"&&!e.complete?new Promise((n,r)=>{setTimeout(n,t),e.onload=()=>n(getComputedStyle(e)),e.onerror=o=>{}}):getComputedStyle(e)}function Pt(e){if(In(e))return gy(e);if(Xd(e))return[...e.childNodes].map(r=>Pt(r)).join("");if(py(e))return dy(e);const t=Xa(e);if(t!==void 0)return t;const n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),n.innerHTML}function wx(e){const t=e.tagName.toLowerCase();let n="";for(const r of e.attributes){const o=r.name,i=r.value;n+=i===""&&o!=="em"&&!my(t,o)?` ${o}`:` ${o}="${i.replaceAll('"',"'")}"`}return n}function kt(e){let t="";for(const n of e.childNodes)t+=tb(n)??Pt(n);return t}function gy(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),n=wx(e);return ld.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${n}/>`:`<${t}${n}>`:vx(e)?`<${t}${n}>${e.innerHTML}</${t}>`:`<${t}${n}>${kt(e)}</${t}>`}function _x(e){return typeof e=="string"?e:""}function by(e,t,n){if(n&&e.type===D.DOCTYPE&&n?.type!==D.ROOT){const o=document.createTextNode(e.content||"");return t.set(e,o),o}const r=Za(e,n)?bd(e.content||""):eo(e,!1,"dormant");t.set(e,r);for(const o of e.children){const i=by(o,t,e);r.appendChild(i)}return r}function jo(e,t,n,r){let o=e,i;for(let s=e.parentNode;s&&s!==t;s=s.parentNode)r?.(s)?i=s.parentNode?{host:s.parentNode,before:s}:void 0:n(s)?i??(i={host:s,before:o}):i=void 0,o=s;return i}function Cx(e,t,n=Vd,r=()=>!1,o=()=>!1,i=()=>!1){let s,a;const l=new Map,c=()=>{const d=uy(s,f=>t.getByNode(f)||l.get(f),n);return d&&{...d,stage:"dom",...a?{cause:a}:{}}},u=d=>{a=d;try{st("Element node not in tree")}finally{a=void 0}};return Bb(c,()=>Tx(e,t,l,d=>s=d,u,r,o,i))}function Tx(e,t,n,r,o,i,s,a){const l=[],c=new Map,u=y=>t.getByNode(y)||n.get(y),d=y=>{if(y){const w=y.lastChild;let b=(w?u(w)?.nextSibling:u(y)?.firstChild)||void 0;for(;b&&c.has(b);)b=b.nextSibling||void 0;return b?.parentNode===u(y)?b:void 0}},f=new Map(e.flatMap(y=>y.type==="Update"?[[y.next,y.prev]]:[])),h=new Set(e.flatMap(y=>{if(y.type!=="Move")return[];const w=f.get(y.node);return[t.getByNode(y.node)??(w&&t.getByNode(w))]})),m=(y,w)=>{for(let b=Fb(y);b;b=Fb(b)){const S=f.get(b),_=u(b)??(S&&u(S));if(_&&!c.has(_)&&!h.has(_)&&w.contains(_)){const T=jo(_,w,i,s);if(T)return T;let x=_;for(;x.parentNode&&x.parentNode!==w;)x=x.parentNode;return{host:w,before:x}}}},p=y=>!!t.getByElement(y)||i(y)||s(y),v=new Set(e.flatMap(y=>y.type==="Remove"?[t.getByNode(y.node)]:[])),C=y=>!c.has(y)&&!v.has(y)&&!h.has(y),k=y=>Array.from(y.childNodes).some(w=>C(w)&&(!!t.getByElement(w)||k(w))),L=(y,w)=>{for(let b=w?w.previousSibling:y.lastChild;b;b=b.previousSibling)if(C(b)){if(t.getByElement(b))return;if(a(b))return k(b)?void 0:b}},E=(y,w,b)=>{const S=y===b?L(b,w):void 0;return S?{host:S,before:Array.from(S.childNodes).find(_=>C(_)&&i(_))}:{host:y,before:w}},g=(y,w,b)=>{const S=m(y,b);if(!S)return{host:b,before:d(w)};let _=S.before.nextSibling??void 0;for(;_&&(c.has(_)||h.has(_)||!p(_));)_=_.nextSibling??void 0;return{host:S.host,before:_}};for(const y of e)switch(r(y),y.type){case"Add":{let{node:w,nextSibling:b}=y;const S=w.parent;if(S){const _=by(w,n,S);if(S.type===D.ROOT)l.push(le.add(null,_,b&&u(b)));else{const T=u(S);if(T){let x,N=T;for(;b;){const I=n.get(b);if(I){const M=jo(I,T,i,s);x=M?.before??I,N=M?.host??T;break}let O=t.getByNode(b);if(O&&!c.has(O)&&T.contains(O)){x=O;const M=jo(O,T,i,s);if(M){N=M.host,x=M.before;break}for(;O.parentNode!==T&&O.parentNode;)O=O.parentNode,In(O)&&O.replaceWith(...O.childNodes);break}b=Ar(b)||void 0}x||({host:N,before:x}=g(w,S,T)),{host:N,before:x}=E(N,x,T),l.push(le.add(N,_,x))}else o("parent-not-mapped")}}else o("no-parent");break}case"Move":{let{node:w,nextSibling:b}=y;const S=w.parent,_=u(w);if(S&&_)if(S.type===D.ROOT)l.push(le.move(null,_,b&&u(b)));else{const T=u(S);if(T){let x,N=T;for(;b;){const I=n.get(b);if(I){const M=jo(I,T,i,s);x=M?.before??I,N=M?.host??T;break}let O=t.getByNode(b);if(O&&!c.has(O)&&T.contains(O)){const M=jo(O,T,i,s);if(M)N=M.host,O=M.before;else for(;O.parentNode!==T&&O.parentNode;)O=O.parentNode;O||st("error while calculating next sibling"),x=O;break}b=Ar(b)||void 0}x||({host:N,before:x}=g(w,S,T)),l.push(le.move(N,_,x))}else o("parent-not-mapped")}else o(S?"node-not-mapped":"no-parent");break}case"Remove":{const w=y.node,b=u(w);if(w.type===D.HTML&&!w.content)continue;b?(c.set(b,w),l.push(le.remove(b))):o("node-not-mapped");break}case"Update":{const w=y.prev,b=u(w);b?n.set(y.next,b):y.soft||o("node-not-mapped");break}case"Attribute":{const w=u(y.node);w?l.push(le.attribute(w,y.name,y.value)):o("node-not-mapped");break}case"Set":{const w=y.node,b=u(w);b?w.type===D.HTML&&Ax(b,String(y.data??""))||py(b)&&w.type===D.DOCTYPE?l.push(le.set(b,y.data||"")):e.push(le.remove(w),le.add(w.parent||null,w,Ar(w)||void 0)):o("node-not-mapped");break}}return{mutations:l,toAdd:n,toRemove:c,isService:i}}function Ax(e,t){return oo(e)?!t.includes("<")||yn(e.parentNode)||oo(wr(t)):!1}function kx({mutations:e}){return ab(e.flatMap(t=>t.type==="Add"?[t.node]:[]))}var Lx=["src","type"];function Nx({mutations:e}){const t=new Set,n=r=>{r instanceof HTMLScriptElement&&r.isConnected&&!Ja(r)&&t.add(r)};for(const r of e)r.type==="Add"||r.type==="Move"?(n(r.parent),n(r.node.parentNode)):r.type==="Remove"||r.type==="Set"?n(r.node.parentNode):r.type==="Attribute"&&Lx.includes(r.name.toLowerCase())&&n(r.node);return[...t]}function xx(e,t,n){const r=e.data,o=Math.min(r.length,t.length),i=e.ownerDocument.getSelection(),s=!!i?.isCollapsed&&i.anchorNode===e&&i.anchorOffset===0&&t.length>r.length&&t.endsWith(r);let a=0;for(;!s&&a<o&&r[a]===t[a];)a++;let l=0;for(;l<o-a&&r[r.length-1-l]===t[t.length-1-l];)l++;const c=r.length-a-l,u=t.slice(a,t.length-l),d=!!i?.isCollapsed&&i.anchorNode===e&&i.anchorOffset>=a&&i.anchorOffset<=a+c,f=d&&n.get(e)===i.anchorOffset;e.replaceData(a,c,u),u&&i?.anchorNode!==e&&n.set(e,a),d&&i.collapse(e,f?a:a+u.length)}function yy(e){const t=e.ownerDocument?.getSelection();return t?.anchorNode&&e.contains(t.anchorNode)?t:null}function Ox(e,t){const n=e?.ownerDocument;if(!e||!n)return null;if(e.nodeType===Node.TEXT_NODE)return e;const r=n.createTreeWalker(e,NodeFilter.SHOW_TEXT);let o=null;for(let i=r.nextNode();i&&(o=i,!!t);i=r.nextNode());return o}function Rx(e,t,n){const r=yy(t),{anchorNode:o,anchorOffset:i,focusNode:s,focusOffset:a}=r??{};if(e.insertBefore(t,n),!(!r||!o||!s))try{const l=t.contains(o),c=t.contains(s);r.setBaseAndExtent(l?o:r.anchorNode??o,l?i??0:r.anchorOffset,c?s:r.focusNode??s,c?a??0:r.focusOffset)}catch{}}function Mx(e){return!!e&&e.prev!==e.next&&e.prev.at(-1)!==e.next.at(-1)}function Px(e){return!!e&&e.next.length>e.prev.length&&e.next.endsWith(e.prev)}function Kd(e,t,n,r){let o;for(let i=t?e.previousSibling:e.nextSibling;i;i=t?i.previousSibling:i.nextSibling){if(n?.has(i))continue;const s=Ox(i,t),a=s?.parentElement?.closest("a")??s?.parentElement?.closest("em-replace");if(!s&&o)break;if(!s){o=i;continue}if(o&&!(t&&i===s&&Mx(r?.get(s))))break;return a&&i.contains(a)?{beside:a}:{text:s}}return o?{beside:o}:null}function vy(e,t,n){const r=t.parentNode;r&&e.collapse(r,[...r.childNodes].indexOf(t)+(n?1:0))}function Ix(e,t,{removed:n,rewrites:r}){const o=yy(e),i=o&&Kd(e,!0,n,r),s=o&&!i?Kd(e,!1,n,r):null;if(e.parentNode?.removeChild(e),!!o)try{if(i?.text){const a=t.get(i.text)??i.text.length;t.set(i.text,a),o.collapse(i.text,a)}else{if(i)return vy(o,i.beside,!0),i.beside.nodeName==="BR"?i.beside:void 0;s?.text?o.collapse(s.text,0):s&&vy(o,s.beside,!1)}}catch{}}function Dx(e){const t=e.ownerDocument?.getSelection(),{anchorNode:n,anchorOffset:r}=t??{};return!!t?.isCollapsed&&n===e.parentNode&&n?.childNodes[(r??0)-1]===e}function Ey(e,t,{removed:n,moved:r,edited:o,rewrites:i}){if(e.nodeType!==Node.ELEMENT_NODE)return{node:e,offset:t};const[s,a]=[e.childNodes[t-1],e.childNodes[t]];return![s,a].some(l=>l&&n.has(l))||s&&r.has(s)?{node:e,offset:t}:s?.nodeType===Node.TEXT_NODE?{node:s,offset:s.length}:(!s||n.has(s))&&a?.nodeType===Node.TEXT_NODE&&!r.has(a)&&(!o.has(a)||Px(i.get(a)))&&(!n.has(a)||Kd(a,!0,n,i)?.text)?{node:a,offset:0}:{node:e,offset:t}}function Bx(e,t){const n=e?.getSelection(),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}=n??{};if(!(!n||!r||!i||!t.removed.size)&&!/^(INPUT|TEXTAREA)$/.test(e?.activeElement?.tagName??""))try{const a=Ey(r,o??0,t),l=Ey(i,s??0,t);(a.node!==r||l.node!==i)&&n.setBaseAndExtent(a.node,a.offset,l.node,l.offset)}catch{}}function Sy(e,t,n){if(t?.parentNode===e)return[e,t];const r=t&&n?jo(t,e,n):void 0;return r&&e.contains(r.host)?[r.host,r.before]:[e,null]}function Hx(e){const t=new Map;for(const n of e)n.type==="Set"&&n.node instanceof Text&&!yn(n.node.parentNode)&&t.set(n.node,{prev:n.node.data,next:wr(String(n.data??"")).textContent??""});return t}function Fx({mutations:e,toAdd:t,toRemove:n,isService:r},o,i){const s=f=>new Set(e.flatMap(h=>h.type===f?[h.node]:[])),a=s("Remove"),l={removed:a,moved:s("Move"),edited:s("Set"),rewrites:Hx(e)};Bx([...a].find(f=>f.ownerDocument)?.ownerDocument,l);const c=(f,h,m)=>{if(!f)return st("Element node not in tree");if(!(f instanceof Element))return st("node is not HTMLEement");const p=m===void 0?void 0:rb(f,h,_x(m));if(!(h.toLowerCase()==="type"&&rN(f,p??null)))try{p!=null?er(f,h,p):f.removeAttribute(h)}catch{}},u=new Map;let d;for(const f of e)switch(f.type){case"Add":{const{node:h,nextSibling:m,parent:p}=f;if(p){const[v,C]=Sy(p,m,r);v.insertBefore(h,C)}break}case"Move":{const{node:h,nextSibling:m,parent:p}=f;if(p){const[v,C]=Sy(p,m,r);Rx(v,h,C)}break}case"Remove":{const{node:h}=f;if(h instanceof Document)for(const m of[...h.childNodes])m.parentNode?.removeChild(m);else d=Ix(h,u,l)??d;break}case"Attribute":c(f.node,f.name,f.value);break;case"Set":{const{node:h,data:m}=f;if(h instanceof Comment)h.data=m;else if(h instanceof Text){const p=String(m??"");yn(h.parentNode)?jL(h,p):xx(h,wr(p).textContent??"",u)}break}}for(const[f,h]of n)o.remove(h);for(const[f,h]of t){const m=o.getByElement(h);m&&o.remove(m),o.set(f,h)}if(i&&d?.isConnected&&Dx(d))try{i(d)}catch{}}var $x=class{constructor(){A(this,"_byKey",new WeakMap),A(this,"_byValue",new WeakMap)}get(e){return this._byKey.get(e)}getByValue(e){return this._byValue.get(e)?.deref()}set(e,t){this._byKey.set(e,t),this._byValue.set(t,new WeakRef(e))}delete(e){const t=this.get(e);t&&(this._byKey.delete(e),this._byValue.delete(t))}deleteByValue(e){const t=this.getByValue(e);t&&(this._byKey.delete(t),this._byValue.delete(e))}},Wx=class{constructor(){A(this,"_map",new $x)}getByNode(e){return this._map.getByValue(e)}getByElement(e){return this._map.get(e)}set(e,t){this._map.set(t,e)}remove(e,t=!0){const n=this._map.getByValue(e);if(n&&this._map.delete(n),t){const r=e.children;for(let o=0,i=r.length;o<i;o++)this.remove(r[o])}}};function wy(e,t){for(let n=e;n;n=n.parent)if(n===t)return!0;return!1}function qx(e){let t;for(let n=e;n;n=n.parent)qd(n)&&(t=n);return t}function zx(e){return e.type==="Update"?e.prev:e.node}function Ux(e,t){const n=new Map;for(const o of e){if(o.type!=="Update"||!o.soft)continue;const i=qx(o.next);if(!i?.parent||n.has(i))continue;const s=e.find(c=>c.type==="Update"&&c.next===i),a=s?.type==="Update"?t.getByNode(s.prev):void 0;if(s?.type!=="Update"||!a?.isConnected)continue;const l=t.getByNode(o.prev);(!l||!l.isConnected||!a.contains(l))&&n.set(i,s.prev)}if(!n.size)return e;const r=[];for(const o of e){const i=zx(o),s=o.type==="Update"||o.type==="Remove"?t.getByNode(i):void 0;let a=!1;for(const[l,c]of n){const u=t.getByNode(c);if(wy(i,l)||wy(i,c)||s&&u?.contains(s)){a=!0,o.type==="Update"&&o.next===l&&l.parent&&r.push(...le.recreate(c,l.parent,l,Ar(l)||void 0));break}}a||r.push(o)}return r}var Yd;(function(e){function t(r,o,i=(s,a)=>s===a){const s=r.length;let a=s===o.length;if(a){for(let l=0;l<s;l++)if(!i(r[l],o[l])){a=!1;break}}return a}e.isEqual=t;function n(r,o,i=(s,a)=>s===a){const s=new Set,a=new Set;for(const l of r)for(const c of o)i(l,c)&&(s.add(l),a.add(c));return{added:o.filter(l=>!a.has(l)),removed:r.filter(l=>!s.has(l))}}e.compare=n})(Yd||(Yd={}));var gl=new Set;function kr(e,t){gl.has(e)||(gl.size||Promise.resolve().then(()=>gl.clear()),gl.add(e),z.send(de.APPLICATION_SYNC_DRIFT,{reason:e,...t()}))}var _y=new WeakMap;function jx(e){const t=[],n=new Set(e);function r(o){if(n.has(o)){const{parentNode:i,nextSibling:s}=o;i&&n.has(i)&&r(i),s&&n.has(s)&&r(s),t.push(o),n.delete(o)}}for(const o of n)r(o);return t}function Vx(e){return{added:e,removed:[],reparented:[],reordered:[]}}function Gx(e,t){let n=_y.get(e);if(!n){let l=function(c){for(const u of c)o.push(u),t(u)?i.push(u):l(u.childNodes)};var r=l;let{added:o,removed:i,reparented:s=[],reordered:a=[]}=e;o=[...o],i=[...i],s&&l(s),a&&l(a),o=jx(o),n={added:o,removed:i},_y.set(e,n)}return n}function Cy(e,t){const n={};for(const[r,o]of Object.entries(t))n[r]={value:o,enumerable:!0};return Object.create(e,n)}function Ty(e){return new Set((e??"").split(/\s+/).filter(Boolean))}function Xx(e,t){const n=i=>{for(let s=i;s&&!t.isMapped(s);s=s.parentNode)if(s instanceof Element&&t.isServicePanel(s))return!0;return!1},r=i=>t.isWrapper(i)||n(i),o=[];return{summaries:e.map(i=>{const s=new Set(i.added.filter(r));return o.push(...[...s].filter(a=>!a.parentNode||!s.has(a.parentNode))),Cy(i,{added:i.added.filter(a=>!s.has(a)),reparented:i.reparented?.filter(a=>!n(a)),reordered:i.reordered?.filter(a=>!n(a)),characterDataChanged:i.characterDataChanged?.filter(a=>!n(a)),attributeChanged:Kx(i,t,r)})}),service:o}}function Kx(e,t,n){const r={};for(const[o,i]of Object.entries(e.attributeChanged??{})){if(t.isServiceAttribute(o))continue;const s=i.filter(a=>!n(a)&&!(o==="class"&&Yx(e,a,t)));s.length&&(r[o]=s)}return r}function Yx(e,t,n){const r=Ty(e.getOldAttribute(t,"class")),o=Ty(t.getAttribute("class")),i=[...r,...o].filter(s=>r.has(s)!==o.has(s));return i.length>0&&i.every(s=>n.isServiceClass(s))}var Ay=Object.getPrototypeOf(customElements),Zx=Reflect.get(Ay,"define"),Zd=new ge,Qd=new ge,Qx=Zd.event,Jx=Qd.event,eO=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","connectedMoveCallback","formAssociatedCallback","formResetCallback","formDisabledCallback","formStateRestoreCallback"];function tO(e){Zd.fire();try{return e()}finally{Qd.fire()}}Ay.define=function(e,t,n){const r=t.prototype,o=class extends t{constructor(...i){Zd.fire();try{super(...i)}finally{Qd.fire()}}};Object.defineProperty(o,"name",{configurable:!0,value:t.name});for(const i of eO){const s=r[i];typeof s=="function"&&Object.defineProperty(o.prototype,i,{configurable:!0,writable:!0,value:function(...a){return tO(()=>s.call(this,...a))}})}Zx.call(this,e,o,n)};function ky(e,t,n,r){const o=[...e.childNodes],i=t(e,r);for(const s of o)n(i,ky(s,t,n,i));return i}function Vo(e,t,n){if(t(e,n)!==!1)for(const r of[...e.childNodes])Vo(r,t,e)}var ir="___em-internal";function Jd(e,t=!0,n=!1){let r=e.content;switch(e.type){case D.ROOT:{const o=document.implementation.createHTMLDocument();for(const i of[...o.childNodes])o.removeChild(i);if(t)for(const i of e.children)o.appendChild(Jd(i,t,n));return o}case D.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case D.COMMENT:return document.createComment(r||"");case D.ELEMENT:if(e.tag){if(n&&customElements.get(e.tag)){const i=document.createElement("div");return i.innerHTML=cd(e),i.firstChild}const o=document.createElement(e.tag);if(e.attributes)for(const i of e.attributeNames){const s=e.attributes[i];try{er(o,i,typeof s=="string"?s:"")}catch{}}if(t)for(const i of e.children)o.appendChild(Za(i,e)?bd(i.content||""):Jd(i,t,n));return o}return document.createTextNode("<");case D.HTML:return wr(r||"");default:throw new Error("unsupported node")}}function nO(e){return hn(e).roots.map(t=>Jd(t,!0,!0))}function Ly(){const e=document.implementation.createHTMLDocument();for(const t of[...e.childNodes])t.remove();return e}function rO(e){let t;switch(e){case"tr":t=document.createElement("table");break;case"td":t=document.createElement("tr");break;case"head":case"body":t=document.createElement("html");break;case"DocumentType":case"html":return Ly();default:t=document.createElement("div")}return t}function oO(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}function bl(e){if(e instanceof Element)return gy(e);if(e instanceof Document)return[...e.childNodes].map(r=>bl(r)).join("");if(e instanceof DocumentType)return oO(e);if(e instanceof DocumentFragment)return[...e.childNodes].map(r=>bl(r)).join("");const t=Xa(e);if(t!==void 0)return t;const n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),n.innerHTML}function Ny(e,t=e.parentNode){return yn(t)?sy(e,t):bl(e)}function iO(e,t,n){let r=1;const o=new Gb,i=new Map,s=new Map,a=new Map;let l=!1;const c=ky(e,h=>{const m=String(r++);let p;if(hy(h)||h instanceof Element&&h.hasAttribute("src")){const v=document.createElement(h.tagName);for(const{name:C,value:k}of h.attributes){const L=ob(h,C,k);L!==null&&er(v,C==="src"?"___src":C,L)}p=v}else p=h.cloneNode(),pO(h,p);if(p)p instanceof DocumentType&&(l=!0),a.set(p,m),i.set(h,m);else return document.createDocumentFragment();return p},(h,m)=>h&&m&&h.appendChild(m));let u=l?Ly():document.createDocumentFragment();u.appendChild(c),Vo(u,(h,m)=>{if(m){const p=a.get(h);if(yn(m))return;if(!p)return st("Error while mapping: not found element");h instanceof Element?h.setAttribute(ir,p):m.insertBefore(document.createComment(`${ir}${p}`),h)}});let d=nO(t(u)).filter(h=>!!h),f;if(!d.length)return o;if(u instanceof Document){const h=rO("html");for(const m of d)h.appendChild(m);f=h}else{f=document.createDocumentFragment();for(const h of d)f.appendChild(h)}return Vo(f,(h,m)=>{let p=null;if(h instanceof HTMLHtmlElement)s.set("1",h);else{if(h instanceof Element&&h.hasAttribute(ir)){p=h.getAttribute(ir),p&&s.set(p,h);return}const v=h.previousSibling;if(v instanceof Comment&&(!(h instanceof Comment)||h.data.indexOf(ir)<0)){const C=v.data,k=C.indexOf(ir);k>=0&&(p=C.substring(k+14),p&&s.set(p,h))}}}),Vo(f,h=>{if(h instanceof Element&&h.hasAttribute(ir)){h.removeAttribute(ir);return}h instanceof Comment&&h.data.indexOf(ir)>=0&&h.remove()}),Vo(e,h=>{const m=i.get(h),p=s.get(m);p&&(o.set(h,p),yn(h)&&h.firstChild&&p.firstChild&&o.set(h.firstChild,p.firstChild))}),o}function sO(e){const t=xy(e.cloneNode()),n=dd(t),r=n.length;return t.startTagEnd=t.startTagEnd===void 0?void 0:n.indexOf(">",Math.max(n.lastIndexOf("'"),n.lastIndexOf('"')))+1,t.endTagStart=t.endTagStart===void 0?void 0:t.endTagStart+(r-t.end),t.end=r,t.type=D.ELEMENT,t}var Go;(function(e){e.HiddenResult=(function(t){return t[t.none=0]="none",t[t.node=1]="node",t[t.children=2]="children",t[t.all=3]="all",t})({})})(Go||(Go={}));function xy(e){if(oo(e)&&yn(e.parentNode))return Oy(sy(e,e.parentNode));const t=Xa(e);if(t!==void 0)return Oy(t);let n=hn(bl(e.cloneNode())).roots[0];return n||(n=new Tt(0,0,[]),n.type=D.HTML,n.content=""),n}function Oy(e){const t=new Tt(0,e.length,[]);return t.type=D.HTML,t.content=e,t}function Ry(e,t=Go.HiddenResult.node){if(t&Go.HiddenResult.node&&(e.end=e.start=e.startTagEnd=e.endTagStart=e.end=0),t&Go.HiddenResult.children)for(const n of e.children)Ry(n,Go.HiddenResult.all)}function aO(e,t=[],n){let r;return e instanceof Element?r=sO(e):r=xy(e),r.children=t,r.parent=void 0,n&&Ry(r,n(r)),r}function ef(e,t,n){let r=t.getByElement(e);if(r)return n?.(e)?void 0:r;for(const o of e.childNodes)if(r=ef(o,t,n),r)return r}function My(e,t,n,r){kr("tree-node-out-of-place",()=>({mutation:n()}))}function Py(e,t,n,r,o){let i=e.parentNode,s=e.nextSibling,a;const l=(c,u)=>!o||o(c,u)?!0:(My("insertBefore",c,()=>mx(e,u,c,t),u),!1);for(;i;){const c=t.getByElement(i)??(n&&i===n.node?n.treeNode:void 0);if(c){if(a){let u=t.getByNode(a);if(u&&i.contains(u)&&l(a,c))return{parentTreeNode:c,nextSiblingTreeNode:a};a=void 0}for(;s;){const u=ef(s,t,r);if(u&&l(u,c))return{parentTreeNode:c,nextSiblingTreeNode:u};s=s.nextSibling}return{parentTreeNode:c}}if(!a)for(;s;){const u=ef(s,t,r);if(u){a=u,s=s.nextSibling;break}s=s.nextSibling}s||(s=i.nextSibling),i=i.parentNode}}function lO(e,t){const n=[],r=e.attributeChanged;if(r)for(const o of Object.keys(r)){const i=r[o];for(const s of i){const a=t.getByElement(s);if(a){const l=s.getAttribute(o);n.push(le.attribute(a,o,typeof l=="string"?l:void 0))}}}return n}function Iy(e,t){return e.type===D.HTML?Xa(t)??`<!--${t.data}-->`:t.data}function cO(e,t){const n=[],r=e.characterDataChanged;if(r)for(const o of r){const i=t.getByElement(o);i&&n.push(le.set(i,hs(o)?Iy(i,o):Ny(o)))}return n}function uO(e){return(e instanceof Element?e:e.parentElement)?.closest(".sortable-fallback")??null}function dO(e){if(e.nodeType!==Node.TEXT_NODE)return!1;const t=e.parentElement;if(!t||t.closest(".em-element-list-ul, .em-element-list-ol")&&t.closest(".em-element-list-bullet"))return!1;const n=t.closest('[class*="em-element-"]:not(.em-element-resize-img-container)');return!(!n||[".em-element-list-ul",".em-element-list-ol",".em-element-custom-table"].some(r=>n.matches(r)))}function fO(e,t,n,r){const o=s=>{let a=s.parentNode;if(!a||a===n?.node||t.getByElement(a))return!1;for(;a&&a!==n?.node&&!t.getByElement(a);a=a.parentNode)if(!r(a))return!1;return!0},i=new Set;for(const s of _O(e)){const a=t.getByElement(s),l=a?.parent?.children,c=a&&l?l.indexOf(a):-1;if(!a||!l||c<0||!o(s))continue;const{parentTreeNode:u,nextSiblingTreeNode:d}=Py(s,t,n)||{};u===a.parent&&d===l[c+1]&&i.add(s)}return i}function mO(e,t,n,r=new Set){const o=[],i=new Set,s=new Map,a=(l,c)=>{const u=s.get(l);return u?u===c:l.parent===c&&c.children.includes(l)};for(const l of e){const{added:c,removed:u}=Gx(l,d=>!!t.getByElement(d));for(const d of u)if(!i.has(d)&&!r.has(d)){const f=t.getByElement(d);if(f){const h=s.get(f)??f.parent;!h||!a(f,h)?My("remove",f,()=>hx(f,t)):o.push(le.remove(f)),s.delete(f),i.add(d)}}for(const d of c){if(r.has(d)||dO(d))continue;const f=uO(d);if(f&&!t.getByElement(f))continue;const{parentTreeNode:h,nextSiblingTreeNode:m}=Py(d,t,n,p=>i.has(p),a)||{};if(h){let p=t.getByElement(d);p||(p=aO(d),t.set(p,d)),o.push(le.add(h,p,m)),s.set(p,h),i.delete(d)}}o.push(...lO(l,t)),o.push(...cO(l,t))}return o}function hO(e,t,n){const r=[],o=t.attributes,i=n.attributes;for(const s of o){const a=s.name,l=i.getNamedItem(a==="src"?"___src":a);if(l){const c=l.value;c!==s.value&&r.push(le.attribute(e,a,c))}else r.push(le.attribute(e,a,void 0))}for(const s of i){const a=s.name==="___src"?"src":s.name;o.getNamedItem(a)||r.push(le.attribute(e,a,s.value))}return r}function pO(e,t){if(!(!GL()||!(e instanceof Element)||!(t instanceof Element)))for(const{name:n,value:r}of Array.from(e.attributes)){const o=ob(e,n,r);o===null?t.removeAttribute(n):o!==r&&er(t,n,o)}}function gO(e,t,n,r=()=>!1){const o=[],i=iO(e,n,t);return Vo(e,s=>{const a=t.getByElement(s);if(!a)return;const l=i.getByKey(s);if(l){if(l instanceof Element){if(!(s instanceof Element))return st("CharacterData mapped to Element");o.push(...hO(a,s,l))}else if(l instanceof CharacterData){if(!(s instanceof CharacterData))return st("Element mapped to CharacterData");const c=yn(s.parentNode)&&(s.parentNode?.nodeName==="SCRIPT"||!r(s));l.data!==s.data&&!c&&o.push(le.set(a,hs(l)?Iy(a,l):Ny(l,s.parentNode)))}else if(l instanceof Document&&!(s instanceof Document))return st("Node mapped to Document")}else{const c=d=>{for(const f of d.childNodes)if(i.getByKey(f)||!c(f))return!1;return!0};let u;return c(s)?(o.push(le.hidden(a,!0)),u=!1):o.push(le.hidden(a,!1)),u}}),o}function bO(e,t){let n,r=e;do{if(t.getByElement(r))return n;n=r}while(r=r.parentNode);for(;e.parentNode;)e=e.parentNode}function yO(e){return[...new Set(e)]}function vO(e,t){return yO([...e.added,...e.reparented||[],...e.reordered||[],...Object.values(e.characterDataChanged||{}),...Object.values(e.attributeChanged||{})].flat().map(n=>bO(n,t)||n))}function EO(e,t){let n=[];for(const r of e){const o=vO(r,t),i=s=>{for(let a=0;a<n.length;a++){const l=n[a];if(l.contains(s)||l===s)return;if(s.contains(l)){n.splice(a,1,s);return}}n.push(s)};for(const s of o)i(s)}return n}function SO(e,t,n){const r=EO(e,t),o=wO(e);return r.flatMap(i=>gO(i,t,n,o))}function wO(e){const t=new Set(e.flatMap(n=>[...n.added,...Object.values(n.characterDataChanged||{}).flat()]));return n=>{for(let r=n;r;r=r.parentNode)if(t.has(r))return!0;return!1}}function _O(e){return e.flatMap(t=>[...t.reparented??[],...t.reordered??[]])}function CO(e,t){return Cy(e,{reparented:e.reparented?.filter(n=>!t.has(n)),reordered:e.reordered?.filter(n=>!t.has(n))})}function TO(e,t,n,r,o=()=>!1){const i=fO(e,t,r,o),s=i.size?e.map(a=>CO(a,i)):e;return[...mO(e,t,r,i),...SO(s,t,n)]}function AO(e){const t=[],n=new Map;for(let r=e.length-1;r>=0;r--){const o=e[r];if(o.type==="Attribute"){const{node:i,name:s,value:a}=o;let l=n.get(i);l||n.set(i,l={}),l.hasOwnProperty(s)||(l[s]=a,i.attributes?.[s]!==a&&t.unshift(o))}else t.unshift(o)}return t}var kO=class{constructor(){A(this,"_map",new WeakMap)}getAttribute(e,t){return this._map.get(e)?.[t]}setAttribute(e,t,n){let r=this._map.get(e);r||this._map.set(e,r=Object.create(null)),r[t]=n}removeAttribute(e,t){let n=this._map.get(e);n&&delete n[t]}hasAttribute(e,t){return this._map.has(e)?.hasOwnProperty(t)}getAttributes(e){return this._map.get(e)}has(e){return this._map.has(e)}replaceNode(e,t){const n=this._map.get(e);n&&(this._map.delete(e),this._map.set(t,n))}},Dy=class{constructor(e=10){A(this,"_max",void 0),A(this,"_cache",new Map),this._max=e}get(e){let t=this._cache.get(e);return t!==void 0&&(this._cache.delete(e),this._cache.set(e,t)),t}put(e,t){this._cache.has(e)?this._cache.delete(e):this._cache.size==this._max&&this._cache.delete(this.first()),this._cache.set(e,t)}first(){return this._cache.keys().next().value}},By=new Dy(1e3);function Xo(e){if(e=e?.trim(),e){let t=By.get(e);return t||(t=new Set(e.split(" ").filter(n=>!!n).map(n=>n)),By.put(e,t)),t}else return new Set}function yl(e){e||(e="");const t=document.createElement("div");return t.setAttribute("style",e),t.style}var Hy=new Dy(1e3);function ps(e){e||(e="");let t=Hy.get(e);return t||(t=yl(e),Hy.put(e,t)),t}function LO(e,t,n){const r=e?e.split(" "):[],o=Xo(n),i=Xo(t),s=r.filter(a=>(a=a.trim(),o.has(a)?i.has(a):!0));return s.length===r.length?e:s.join(" ")}function NO(e,t,n){const r=yl(e),o=ps(n),i=ps(t);let s=!1;for(const a of o){const l=o.getPropertyValue(a);r.getPropertyValue(a)===l&&i.getPropertyValue(a)!==l&&(s=!0,r.removeProperty(a))}return s?r.cssText:e}function Fy(e,t,n,r){return typeof r!="string"?t:e==="class"?LO(t,n,r)||null:e==="style"?NO(t,n,r)||null:n!==t&&t===r?null:t}function xO(e,t){const n=Xo(e),r=Xo(t);for(const o of r)n.has(o)||(e=e?`${e.trimEnd()} ${o}`:o);return e}function OO(e,t){const n=yl(e),r=ps(t);let o=!1;for(const i of r){const s=r.getPropertyValue(i);n.getPropertyValue(i)!==s&&(o=!0,n.setProperty(i,s))}return o?n.cssText:e}function RO(e,t,n){return typeof n!="string"?t:e==="class"?xO(t,n)||null:e==="style"?OO(t,n)||null:t}function MO(e,t,n){if(!t)return t;const r=Xo(e),o=Xo(n),i=t.split(" "),s=i.filter(a=>(a=a.trim(),!r.has(a)||o.has(a)));return s.length!==i.length?s.join(" "):t}function PO(e,t,n){if(!t)return t;const r=ps(e),o=yl(t),i=ps(n);let s=!1;for(const a of o){const l=o.getPropertyValue(a);r.getPropertyValue(a)===l&&i.getPropertyValue(a)!==l&&(s=!0,o.removeProperty(a))}return s?o.cssText:t}function $y(e){return e.type===D.ELEMENT&&e.start!==e.end}function Wy(e){return e.filter(t=>t.type===D.ELEMENT)}function IO(e,t,n){const r=Wy(e),o=Wy(t),i=[],s=new Set,a=new Set,l=u=>{const d=(h,m)=>{const p=new Map;for(const v of h){const C=m.has(v)?void 0:u(v);C!==void 0&&p.set(C,p.has(C)?null:v)}return p},f=d(r,s);for(const[h,m]of d(o,a)){const p=f.get(h);m&&p&&(i.push([p,m,!0]),s.add(p),a.add(m))}};l(u=>typeof u.attributes?.id=="string"?`${u.tag}#${u.attributes.id}`:void 0),l(u=>Jn(u,!1,n)),l(u=>Jn(u,!0,n));const c=new Set(o.map(u=>u.tag));for(const u of c){const d=m=>m.filter(p=>p.tag===u),f=d(r).filter(m=>!s.has(m)),h=d(o).filter(m=>!a.has(m));if(f.length===h.length&&d(r).length===d(o).length){const m=f.length===1&&!f[0].attributes?.id&&!h[0].attributes?.id;h.forEach((p,v)=>i.push([f[v],p,m]))}}return i}var DO=class{constructor(e,t,n,r){A(this,"element",void 0),A(this,"name",void 0),A(this,"nextValue",void 0),A(this,"prevValue",void 0),this.element=e,this.name=t,this.nextValue=n,this.prevValue=r}},BO=class{constructor(e){A(this,"_nodeMap",void 0),A(this,"_map",new kO),A(this,"_hiddenMutations",[]),A(this,"_restore",[]),this._nodeMap=e}_onHiddenMutate(){try{for(const{name:e,element:t,prevValue:n,nextValue:r}of this._hiddenMutations){const o=this._nodeMap.getByElement(t);if(o)if(e==="class"){const i=MO(n,r,this._map.getAttribute(o,e))||null;i===null?this._map.removeAttribute(o,e):this._map.setAttribute(o,e,i)}else if(e==="style"){const i=PO(n,r,this._map.getAttribute(o,e))||null;i===null?this._map.removeAttribute(o,e):this._map.setAttribute(o,e,i)}else r===null?this._map.removeAttribute(o,e):this._map.setAttribute(o,e,r)}}finally{this._hiddenMutations=[]}}onHiddenMutate(e){const t=this._hiddenMutations;for(const n of e){const r=n.attributeChanged;if(r)for(const o of Object.keys(r)){const i=r[o];for(const s of i)t.push(new DO(s,o,s.getAttribute(o),n.getOldAttribute(s,o)))}}}beforeCommit(e){this._onHiddenMutate();const t=[];for(const n of e){if(n.type==="Attribute"){const{name:r,node:o,value:i}=n,s=Fy(r,i,o.attributes?.[r]||null,this._map.getAttribute(o,r));if(s!==i){t.push(le.attribute(o,r,s));continue}}if(t.push(n),n.type==="Add"){const{node:r}=n,o=r.attributes;if(o)for(const i of Object.keys(o)){const s=o[i],a=this._map.getAttribute(r,i);if(a){const l=Fy(i,s,null,a);l!==s&&t.push(le.attribute(r,i,l))}}}}return t}onRemoteMutate(e){this._onHiddenMutate(),this._restore=[];const t=[];for(const n of e){if(n.type==="Attribute"){const{name:r,node:o,value:i}=n,s=RO(r,i,this._map.getAttribute(o,r));if(s!==i){t.push(le.attribute(o,r,s));continue}}else n.type==="Update"?this._map.replaceNode(n.prev,n.next):n.type==="Add"&&n.replaces&&this._carryHidden(n.replaces,n.node,!0,ud());t.push(n)}return t}_carryHidden(e,t,n,r){if(e.type!==t.type||e.tag!==t.tag)return;const o=this._map.getAttributes(e);if(n&&!Pd(t.tag)&&o){const i=[];for(const[s,a]of Object.entries(o))F2(s)||(this._map.setAttribute(t,s,a),i.push([s,e.attributes?.[s]??null]));i.length&&this._restore.push({node:t,carried:i})}if(n&&Jn(e,!1,r)===Jn(t,!1,r)){const i=t.children.filter($y);e.children.filter($y).forEach((s,a)=>{i[a]&&this._carryHidden(s,i[a],!0,r)});return}for(const[i,s,a]of IO(e.children,t.children,r))this._carryHidden(i,s,a,r)}restoreHidden(){const e=this._restore;this._restore=[];for(const{node:t,carried:n}of e){const r=this._nodeMap.getByNode(t);if(r instanceof Element)for(const[o,i]of n){if((t.attributes?.[o]??null)!==i){this._map.removeAttribute(t,o);continue}const s=this._map.getAttribute(t,o);typeof s=="string"&&r.setAttribute(o,s)}}}},HO=class{constructor(e){A(this,"_isMapped",void 0),A(this,"_foreign",new WeakSet),A(this,"_movedTo",new WeakMap),A(this,"_output",new WeakSet),A(this,"_service",new WeakSet),A(this,"_wrappers",new WeakSet),A(this,"_outer",new WeakSet),A(this,"_hasForeign",!1),A(this,"_hasOutput",!1),this._isMapped=e}observeLost(e){for(const t of e){for(const n of t.added)this.markForeign(n);for(const n of[...t.reparented??[],...t.reordered??[]])!this._foreign.has(n)&&n.parentNode&&this._movedTo.set(n,n.parentNode)}}markForeign(e){this._hasForeign=!0,this._foreign.add(e)}markOutput(e){this.markForeign(e),this._hasOutput=!0,this._output.add(e)}isOutput(e){return this._hasOutput&&this._isInside(e,this._output)}get hasOutput(){return this._hasOutput}isMarked(e){return this._foreign.has(e)}isOffModel(e){return this._hasForeign&&this._isInside(e,this._foreign)}isForeign(e){return this._hasForeign&&this._nearestMark(e)==="foreign"}markService(e){this._service.add(e)}markWrapper(e){this._wrappers.add(e)}isWrapper(e){return this._wrappers.has(e)}forgetService(e){this._service.delete(e)}markOuterWrapper(e){this._outer.add(e)}isOuterWrapper(e){return this._outer.has(e)}isService(e){return this._isInside(e,this._service)}markOf(e){return this._service.has(e)?"service":this._foreign.has(e)?"foreign":void 0}_nearestMark(e){for(let t=e;t&&!this._isMapped(t);t=t.parentNode){const n=this.markOf(t);if(n)return n}}_isInside(e,t){for(let n=e;n;n=n.parentNode){if(this._isMapped(n))return!1;if(t.has(n))return!0}return!1}isPlacedInForeign(e){return this._hasForeign&&this.isForeign(this._isMapped(e)?e.parentNode:e)}movedTo(e){return this._movedTo.get(e)}forget(e){this._movedTo.delete(e)}},qy="foreign-structure-in-commit";function FO(e,t,n){const r=[],o=(s,a)=>{t.isPlacedInForeign(s)&&r.push({kind:t.movedTo(s)?"moved-own-node":a,node:s})},i=s=>{o(s,"moved"),n(s)||s.childNodes.forEach(i)};for(const s of e)s.added.forEach(a=>o(a,"inserted")),[...s.reparented??[],...s.reordered??[]].forEach(i),new Set(Object.values(s.attributeChanged??{}).flat()).forEach(a=>t.isForeign(a)&&r.push({kind:"attribute",node:a})),(s.characterDataChanged??[]).forEach(a=>t.isForeign(a)&&r.push({kind:"text",node:a}));for(const s of e)[...s.added,...s.reparented??[],...s.reordered??[]].forEach(a=>t.forget(a));return r}function vl(e){if(!(e instanceof Element))return{tag:e.nodeName.toLowerCase()};const t=e.getAttribute("class");return{tag:e.tagName.toLowerCase(),...t?{class:t}:{}}}var zy="implicit-tbody-in-canvas";function $O(e,t){const n=new Set;for(const r of e)for(const o of r.added)o instanceof Element&&(o.tagName==="TBODY"?[o]:Array.from(o.querySelectorAll("tbody"))).filter(i=>!t(i)).forEach(i=>n.add(i));return[...n]}function WO(e,t){if(!e.length||t.has("implicit-tbody-in-canvas"))return;const[n]=e,r={kind:"implicit-tbody",kinds:["implicit-tbody"],count:e.length,node:vl(n),parent:n.parentNode?vl(n.parentNode):void 0};t.add(zy),kr(zy,()=>({foreign:r}))}function qO(e,t){if(!e.length)return;const[n]=e,r=[...new Set(e.map(({kind:i})=>i))],o={kind:n.kind,kinds:r,count:e.length,node:vl(n.node),parent:n.node.parentNode?vl(n.node.parentNode):void 0};t.has("foreign-structure-in-commit")||(t.add(qy),kr(qy,()=>({foreign:o})))}var tf="unaccounted-node";function Uy(e,t,n,r){if(t.isMapped(e))return"own";const o=t.markOf(e)??n;return o==="foreign"||o==="service"?o:!r||t.isCanvasNode(e)?"interface":"unaccounted"}function jy(e,t){let n,r=!1,o=t.isMapped(e);for(let i=e.parentNode;i;i=i.parentNode)r||(r=t.roots.has(i)),!o&&!n&&(o=t.isMapped(i),n=o?void 0:t.markOf(i));return Uy(e,t,n,r||t.roots.has(e))}function Vy(e,t){const n=[],r=[];for(let o=e.lastChild;o;o=o.previousSibling)r.push([o,void 0,!1]);for(let o=r.pop();o;o=r.pop()){const[i,s,a]=o,l=a||t.roots.has(i),c=Uy(i,t,s,l);c==="unaccounted"&&s!=="unaccounted"&&n.push(i);const u=c==="own"||c==="interface"?void 0:c;for(let d=i.lastChild;d;d=d.previousSibling)r.push([d,u,l])}return n}function zO(e){const t=new WeakSet,n=(e.ownerDocument??e).createTreeWalker(e,NodeFilter.SHOW_ALL);for(let r=n.nextNode();r;r=n.nextNode())t.add(r);return t}function UO(e,t){const n=new Set;for(const r of e)r.isConnected&&jy(r,t)==="unaccounted"&&n.add(r);return[...n].filter(r=>!r.parentNode||!n.has(r.parentNode))}function jO(e){const t=e.nodeType===Node.ELEMENT_NODE?e.tagName.toLowerCase():e.nodeName,n=e.parentNode;return n?`${t}:${Array.prototype.indexOf.call(n.childNodes,e)+1}`:t}function Gy(e){const t=[];for(let o=e;o&&o.nodeType!==Node.DOCUMENT_NODE;o=o.parentNode)t.unshift(jO(o));const n=e instanceof Element?e.getAttribute("class"):null,r=e instanceof Element?e.tagName.toLowerCase():e.nodeName;return{path:t.join(" > "),tag:r,...n?{class:n}:{}}}function Xy(e,t){if(!e.length)return;const n={count:e.length,node:Gy(e[0])};t.has(tf)||(t.add(tf),kr(tf,()=>({unaccounted:n})))}var VO=Sr(((e,t)=>{(function(n,r){typeof e=="object"&&typeof t<"u"?r(e):typeof define=="function"&&define.amd?define(["exports"],r):(n=typeof globalThis<"u"?globalThis:n||self,r(n.MutationSummary={}))})(e,(function(n){"use strict";var r=(function(){function E(){this._nodes=[],this._values=[]}return E._isIndex=function(g){return+g===g>>>0},E._nodeId=function(g){var y=g[E._ID_PROP];return y||(y=g[E._ID_PROP]=E._NEXT_ID++),y},E.prototype.set=function(g,y){var w=E._nodeId(g);this._nodes[w]=g,this._values[w]=y},E.prototype.get=function(g){var y=E._nodeId(g);return y!==void 0?this._values[y]:void 0},E.prototype.has=function(g){return E._nodeId(g)in this._nodes},E.prototype.delete=function(g){var y=E._nodeId(g);delete this._nodes[y],this._values[y]=void 0},E.prototype.keys=function(){var g=[];for(var y in this._nodes)E._isIndex(y)&&g.push(this._nodes[y]);return g},E._ID_PROP="__mutation_summary_node_map_id__",E._NEXT_ID=1,E})(),o=(function(){function E(){this.added=new r,this.removed=new r,this.maybeMoved=new r,this.oldPrevious=new r,this.moved=void 0}return E})();n.Movement=void 0,(function(E){E[E.STAYED_OUT=0]="STAYED_OUT",E[E.ENTERED=1]="ENTERED",E[E.STAYED_IN=2]="STAYED_IN",E[E.REPARENTED=3]="REPARENTED",E[E.REORDERED=4]="REORDERED",E[E.EXITED=5]="EXITED"})(n.Movement||(n.Movement={}));var i=function(E,g){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,w){y.__proto__=w}||function(y,w){for(var b in w)Object.prototype.hasOwnProperty.call(w,b)&&(y[b]=w[b])},i(E,g)};function s(E,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");i(E,g);function y(){this.constructor=E}E.prototype=g===null?Object.create(g):(y.prototype=g.prototype,new y)}var a=(function(){function E(g,y,w,b,S,_,T,x){y===void 0&&(y=!1),w===void 0&&(w=!1),b===void 0&&(b=!1),S===void 0&&(S=null),_===void 0&&(_=!1),T===void 0&&(T=null),x===void 0&&(x=null),this.node=g,this.childList=y,this.attributes=w,this.characterData=b,this.oldParentNode=S,this.added=_,this.attributeOldValues=T,this.characterDataOldValue=x,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return E.prototype.getAttributeOldValue=function(g){if(this.attributeOldValues)return this.isCaseInsensitive&&(g=g.toLowerCase()),this.attributeOldValues[g]},E.prototype.getAttributeNamesMutated=function(){var g=[];if(!this.attributeOldValues)return g;for(var y in this.attributeOldValues)this.attributeOldValues.hasOwnProperty(y)&&g.push(y);return g},E.prototype.attributeMutated=function(g,y){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},!(g in this.attributeOldValues)&&(this.attributeOldValues[g]=y)},E.prototype.characterDataMutated=function(g){this.characterData||(this.characterData=!0,this.characterDataOldValue=g)},E.prototype.removedFromParent=function(g){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=g},E.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},E.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},E})(),l=(function(E){s(g,E);function g(y,w){var b=E.call(this)||this;b.rootNode=y,b.reachableCache=void 0,b.wasReachableCache=void 0,b.anyParentsChanged=!1,b.anyAttributesChanged=!1,b.anyCharacterDataChanged=!1;for(var S=0;S<w.length;S++){var _=w[S];switch(_.type){case"childList":b.anyParentsChanged=!0;for(var T=0;T<_.removedNodes.length;T++){var x=_.removedNodes[T];b.getChange(x).removedFromParent(_.target)}for(var T=0;T<_.addedNodes.length;T++){var x=_.addedNodes[T];b.getChange(x).insertedIntoParent()}break;case"attributes":b.anyAttributesChanged=!0;var N=b.getChange(_.target);N.attributeMutated(_.attributeName,_.oldValue);break;case"characterData":b.anyCharacterDataChanged=!0;var N=b.getChange(_.target);N.characterDataMutated(_.oldValue)}}return b}return g.prototype.getChange=function(y){var w=this.get(y);return w||(w=new a(y),this.set(y,w)),w},g.prototype.getOldParent=function(y){var w=this.get(y);return w?w.getOldParent():y.parentNode},g.prototype.getIsReachable=function(y){if(y===this.rootNode)return!0;if(!y)return!1;this.reachableCache=this.reachableCache||new r;var w=this.reachableCache.get(y);return w===void 0&&(w=this.getIsReachable(y.parentNode),this.reachableCache.set(y,w)),w},g.prototype.getWasReachable=function(y){if(y===this.rootNode)return!0;if(!y)return!1;this.wasReachableCache=this.wasReachableCache||new r;var w=this.wasReachableCache.get(y);return w===void 0&&(w=this.getWasReachable(this.getOldParent(y)),this.wasReachableCache.set(y,w)),w},g.prototype.reachabilityChange=function(y){return this.getIsReachable(y)?this.getWasReachable(y)?n.Movement.STAYED_IN:n.Movement.ENTERED:this.getWasReachable(y)?n.Movement.EXITED:n.Movement.STAYED_OUT},g})(r),c=(function(){function E(g,y,w,b,S){this.rootNode=g,this.mutations=y,this.selectors=w,this.calcReordered=b,this.calcOldPreviousSibling=S,this.treeChanges=new l(g,y),this.entered=[],this.exited=[],this.stayedIn=new r,this.visited=new r,this.childListChangeMap=void 0,this.characterDataOnly=void 0,this.matchCache=void 0,this.processMutations()}return E.prototype.processMutations=function(){if(!(!this.treeChanges.anyParentsChanged&&!this.treeChanges.anyAttributesChanged))for(var g=this.treeChanges.keys(),y=0;y<g.length;y++)this.visitNode(g[y],void 0)},E.prototype.visitNode=function(g,y){if(!this.visited.has(g)){this.visited.set(g,!0);var w=this.treeChanges.get(g),b=y;if((w&&w.childList||b==null)&&(b=this.treeChanges.reachabilityChange(g)),b!==n.Movement.STAYED_OUT){if(this.matchabilityChange(g),b===n.Movement.ENTERED)this.entered.push(g);else if(b===n.Movement.EXITED)this.exited.push(g),this.ensureHasOldPreviousSiblingIfNeeded(g);else if(b===n.Movement.STAYED_IN){var S=n.Movement.STAYED_IN;w&&w.childList&&(w.oldParentNode!==g.parentNode?(S=n.Movement.REPARENTED,this.ensureHasOldPreviousSiblingIfNeeded(g)):this.calcReordered&&this.wasReordered(g)&&(S=n.Movement.REORDERED)),this.stayedIn.set(g,S)}if(b!==n.Movement.STAYED_IN)for(var _=g.firstChild;_;_=_.nextSibling)this.visitNode(_,b)}}},E.prototype.ensureHasOldPreviousSiblingIfNeeded=function(g){if(this.calcOldPreviousSibling){this.processChildlistChanges();var y=g.parentNode,w=this.treeChanges.get(g);w&&w.oldParentNode&&(y=w.oldParentNode);var b=this.childListChangeMap.get(y);b||(b=new o,this.childListChangeMap.set(y,b)),b.oldPrevious.has(g)||b.oldPrevious.set(g,g.previousSibling)}},E.prototype.getChanged=function(g,y,w){this.selectors=y,this.characterDataOnly=w;for(var b=0;b<this.entered.length;b++){var S=this.entered[b],_=this.matchabilityChange(S);(_===n.Movement.ENTERED||_===n.Movement.STAYED_IN)&&g.added.push(S)}for(var T=this.stayedIn.keys(),b=0;b<T.length;b++){var S=T[b],_=this.matchabilityChange(S);if(_===n.Movement.ENTERED)g.added.push(S);else if(_===n.Movement.EXITED)g.removed.push(S);else if(_===n.Movement.STAYED_IN&&(g.reparented||g.reordered)){var x=this.stayedIn.get(S);g.reparented&&x===n.Movement.REPARENTED?g.reparented.push(S):g.reordered&&x===n.Movement.REORDERED&&g.reordered.push(S)}}for(var b=0;b<this.exited.length;b++){var S=this.exited[b],_=this.matchabilityChange(S);(_===n.Movement.EXITED||_===n.Movement.STAYED_IN)&&g.removed.push(S)}},E.prototype.getOldParentNode=function(g){var y=this.treeChanges.get(g);if(y&&y.childList)return y.oldParentNode?y.oldParentNode:null;var w=this.treeChanges.reachabilityChange(g);if(w===n.Movement.STAYED_OUT||w===n.Movement.ENTERED)throw Error("getOldParentNode requested on invalid node.");return g.parentNode},E.prototype.getOldPreviousSibling=function(g){var y=g.parentNode,w=this.treeChanges.get(g);w&&w.oldParentNode&&(y=w.oldParentNode);var b=this.childListChangeMap.get(y);if(!b)throw Error("getOldPreviousSibling requested on invalid node.");return b.oldPrevious.get(g)},E.prototype.getOldAttribute=function(g,y){var w=this.treeChanges.get(g);if(!w||!w.attributes)throw Error("getOldAttribute requested on invalid node.");var b=w.getAttributeOldValue(y);if(b===void 0)throw Error("getOldAttribute requested for unchanged attribute name.");return b},E.prototype.attributeChangedNodes=function(g){if(!this.treeChanges.anyAttributesChanged)return{};var y,w;if(g){y={},w={};for(var b=0;b<g.length;b++){var S=g[b];y[S]=!0,w[S.toLowerCase()]=S}}for(var _={},T=this.treeChanges.keys(),b=0;b<T.length;b++){var x=T[b],N=this.treeChanges.get(x);if(N.attributes&&!(n.Movement.STAYED_IN!==this.treeChanges.reachabilityChange(x)||n.Movement.STAYED_IN!==this.matchabilityChange(x)))for(var I=x,O=N.getAttributeNamesMutated(),M=0;M<O.length;M++){var S=O[M];y&&!y[S]&&!(N.isCaseInsensitive&&w[S])||N.getAttributeOldValue(S)!==I.getAttribute(S)&&(w&&N.isCaseInsensitive&&(S=w[S]),_[S]=_[S]||[],_[S].push(I))}}return _},E.prototype.getOldCharacterData=function(g){var y=this.treeChanges.get(g);if(!y||!y.characterData)throw Error("getOldCharacterData requested on invalid node.");return y.characterDataOldValue},E.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var g=this.treeChanges.keys(),y=[],w=0;w<g.length;w++){var b=g[w];if(n.Movement.STAYED_IN===this.treeChanges.reachabilityChange(b)){var S=this.treeChanges.get(b);!S.characterData||b.textContent==S.characterDataOldValue||y.push(b)}}return y},E.prototype.computeMatchabilityChange=function(g,y){this.matchCache||(this.matchCache=[]),this.matchCache[g.uid]||(this.matchCache[g.uid]=new r);var w=this.matchCache[g.uid],b=w.get(y);return b===void 0&&(b=g.matchabilityChange(y,this.treeChanges.get(y)),w.set(y,b)),b},E.prototype.matchabilityChange=function(g){var y=this;if(this.characterDataOnly)switch(g.nodeType){case Node.COMMENT_NODE:case Node.TEXT_NODE:return n.Movement.STAYED_IN;default:return n.Movement.STAYED_OUT}if(!this.selectors)return n.Movement.STAYED_IN;if(g.nodeType!==Node.ELEMENT_NODE)return n.Movement.STAYED_OUT;for(var w=g,b=this.selectors.map(function(T){return y.computeMatchabilityChange(T,w)}),S=n.Movement.STAYED_OUT,_=0;S!==n.Movement.STAYED_IN&&_<b.length;){switch(b[_]){case n.Movement.STAYED_IN:S=n.Movement.STAYED_IN;break;case n.Movement.ENTERED:S===n.Movement.EXITED?S=n.Movement.STAYED_IN:S=n.Movement.ENTERED;break;case n.Movement.EXITED:S===n.Movement.ENTERED?S=n.Movement.STAYED_IN:S=n.Movement.EXITED}_++}return S},E.prototype.getChildlistChange=function(g){var y=this.childListChangeMap.get(g);return y||(y=new o,this.childListChangeMap.set(g,y)),y},E.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new r;for(var g=function(b){var S=y.mutations[b];if(S.type!="childList"||y.treeChanges.reachabilityChange(S.target)!==n.Movement.STAYED_IN&&!y.calcOldPreviousSibling)return"continue";for(var _=y.getChildlistChange(S.target),T=S.previousSibling,x=function(O,M){!O||_.oldPrevious.has(O)||_.added.has(O)||_.maybeMoved.has(O)||M&&(_.added.has(M)||_.maybeMoved.has(M))||_.oldPrevious.set(O,M)},N=0;N<S.removedNodes.length;N++){var I=S.removedNodes[N];x(I,T),_.added.has(I)?_.added.delete(I):(_.removed.set(I,!0),_.maybeMoved.delete(I)),T=I}x(S.nextSibling,T);for(var N=0;N<S.addedNodes.length;N++){var I=S.addedNodes[N];_.removed.has(I)?(_.removed.delete(I),_.maybeMoved.set(I,!0)):_.added.set(I,!0)}},y=this,w=0;w<this.mutations.length;w++)g(w)}},E.prototype.wasReordered=function(g){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var y=g.parentNode,w=this.treeChanges.get(g);w&&w.oldParentNode&&(y=w.oldParentNode);var b=this.childListChangeMap.get(y);if(!b)return!1;if(b.moved)return b.moved.get(g);b.moved=new r;var S=new r;function _(O){if(!O||!b.maybeMoved.has(O))return!1;var M=b.moved.get(O);return M!==void 0||(S.has(O)?M=!0:(S.set(O,!0),M=I(O)!==x(O)),S.has(O)?(S.delete(O),b.moved.set(O,M)):M=b.moved.get(O)),M}var T=new r;function x(O){var M=T.get(O);if(M!==void 0)return M;for(M=b.oldPrevious.get(O);M&&(b.removed.has(M)||_(M));)M=x(M);return M===void 0&&(M=O.previousSibling),T.set(O,M),M}var N=new r;function I(O){if(N.has(O))return N.get(O);for(var M=O.previousSibling;M&&(b.added.has(M)||_(M));)M=M.previousSibling;return N.set(O,M),M}return b.maybeMoved.keys().forEach(_),b.moved.get(g)},E})(),u=(function(){function E(g,y){var w=this;if(this.projection=g,this.added=[],this.removed=[],this.reparented=y.all||y.element||y.characterData?[]:void 0,this.reordered=y.all?[]:void 0,g.getChanged(this,y.elementFilter,y.characterData),y.all||y.attribute||y.attributeList){var b=y.attribute?[y.attribute]:y.attributeList,S=g.attributeChangedNodes(b);y.attribute?this.valueChanged=S[y.attribute]||[]:(this.attributeChanged=S,y.attributeList&&y.attributeList.forEach(function(T){w.attributeChanged.hasOwnProperty(T)||(w.attributeChanged[T]=[])}))}if(y.all||y.characterData){var _=g.getCharacterDataChanged();y.characterData?this.valueChanged=_:this.characterDataChanged=_}this.reordered&&(this.getOldPreviousSibling=g.getOldPreviousSibling.bind(g))}return E.prototype.getOldParentNode=function(g){return this.projection.getOldParentNode(g)},E.prototype.getOldAttribute=function(g,y){return this.projection.getOldAttribute(g,y)},E.prototype.getOldCharacterData=function(g){return this.projection.getOldCharacterData(g)},E.prototype.getOldPreviousSibling=function(g){return this.projection.getOldPreviousSibling(g)},E})(),d=(function(){function E(){}return E.prototype.matches=function(g){if(g===null)return!1;if(this.attrValue===void 0)return!0;if(!this.contains)return this.attrValue==g;for(var y=g.split(" "),w=0;w<y.length;w++)if(this.attrValue===y[w])return!0;return!1},E.prototype.toString=function(){return this.attrName==="class"&&this.contains?"."+this.attrValue:this.attrName==="id"&&!this.contains?"#"+this.attrValue:this.contains?"["+this.attrName+"~="+f(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+f(this.attrValue)+"]":"["+this.attrName+"]"},E})();function f(E){return'"'+E.replace(/"/,'\\"')+'"'}var h=/[a-zA-Z_]+/,m=/[a-zA-Z0-9_\-]+/,p=(function(){function E(){this.uid=E.nextUid++,this.qualifiers=[]}return Object.defineProperty(E.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(E.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!1,configurable:!0}),E.prototype.isMatching=function(g){return g[E.matchesSelector](this.selectorString)},E.prototype.wasMatching=function(g,y,w){if(!y||!y.attributes)return w;var b=y.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if(b!=="*"&&b!==g.tagName)return!1;for(var S=[],_=!1,T=0;T<this.qualifiers.length;T++){var x=this.qualifiers[T],N=y.getAttributeOldValue(x.attrName);S.push(N),_=_||N!==void 0}if(!_)return w;for(var T=0;T<this.qualifiers.length;T++){var x=this.qualifiers[T],N=S[T];if(N===void 0&&(N=g.getAttribute(x.attrName)),!x.matches(N))return!1}return!0},E.prototype.matchabilityChange=function(g,y){var w=this.isMatching(g);return w?this.wasMatching(g,y,w)?n.Movement.STAYED_IN:n.Movement.ENTERED:this.wasMatching(g,y,w)?n.Movement.EXITED:n.Movement.STAYED_OUT},E.parseSelectors=function(g){var y=[],w,b;function S(){w&&(b&&(w.qualifiers.push(b),b=void 0),y.push(w)),w=new E}function _(){b&&w.qualifiers.push(b),b=new d}for(var T=/\s/,x=void 0,N="Invalid or unsupported selector syntax.",I=1,O=2,M=3,V=4,K=5,se=6,te=7,Z=8,ve=9,fe=10,_e=11,ct=12,ne=13,q=14,oe=I,Wt=0;Wt<g.length;){var U=g[Wt++];switch(oe){case I:if(U.match(h)){S(),w.tagName=U,oe=O;break}if(U=="*"){S(),w.tagName="*",oe=M;break}if(U=="."){S(),_(),w.tagName="*",b.attrName="class",b.contains=!0,oe=V;break}if(U=="#"){S(),_(),w.tagName="*",b.attrName="id",oe=V;break}if(U=="["){S(),_(),w.tagName="*",b.attrName="",oe=se;break}if(U.match(T))break;throw Error(N);case O:if(U.match(m)){w.tagName+=U;break}if(U=="."){_(),b.attrName="class",b.contains=!0,oe=V;break}if(U=="#"){_(),b.attrName="id",oe=V;break}if(U=="["){_(),b.attrName="",oe=se;break}if(U.match(T)){oe=q;break}if(U==","){oe=I;break}throw Error(N);case M:if(U=="."){_(),b.attrName="class",b.contains=!0,oe=V;break}if(U=="#"){_(),b.attrName="id",oe=V;break}if(U=="["){_(),b.attrName="",oe=se;break}if(U.match(T)){oe=q;break}if(U==","){oe=I;break}throw Error(N);case V:if(U.match(h)){b.attrValue=U,oe=K;break}throw Error(N);case K:if(U.match(m)){b.attrValue+=U;break}if(U=="."){_(),b.attrName="class",b.contains=!0,oe=V;break}if(U=="#"){_(),b.attrName="id",oe=V;break}if(U=="["){_(),oe=se;break}if(U.match(T)){oe=q;break}if(U==","){oe=I;break}throw Error(N);case se:if(U.match(h)){b.attrName=U,oe=te;break}if(U.match(T))break;throw Error(N);case te:if(U.match(m)){b.attrName+=U;break}if(U.match(T)){oe=Z;break}if(U=="~"){b.contains=!0,oe=ve;break}if(U=="="){b.attrValue="",oe=_e;break}if(U=="]"){oe=M;break}throw Error(N);case Z:if(U=="~"){b.contains=!0,oe=ve;break}if(U=="="){b.attrValue="",oe=_e;break}if(U=="]"){oe=M;break}if(U.match(T))break;throw Error(N);case ve:if(U=="="){b.attrValue="",oe=_e;break}throw Error(N);case fe:if(U=="]"){oe=M;break}if(U.match(T))break;throw Error(N);case _e:if(U.match(T))break;if(U=='"'||U=="'"){x=U,oe=ne;break}b.attrValue+=U,oe=ct;break;case ct:if(U.match(T)){oe=fe;break}if(U=="]"){oe=M;break}if(U=="'"||U=='"')throw Error(N);b.attrValue+=U;break;case ne:if(U==x){oe=fe;break}b.attrValue+=U;break;case q:if(U.match(T))break;if(U==","){oe=I;break}throw Error(N)}}switch(oe){case I:case O:case M:case K:case q:S();break;default:throw Error(N)}if(!y.length)throw Error(N);return y},E.nextUid=1,E.matchesSelector="matches",E})(),v=(function(){function E(){}return E.createObserverOptions=function(g){var y={childList:!0,subtree:!0},w;function b(S){if(!(y.attributes&&!w)){if(y.attributes=!0,y.attributeOldValue=!0,!S){w=void 0;return}w=w||{},S.forEach(function(_){w[_]=!0,w[_.toLowerCase()]=!0})}}return g.forEach(function(S){if(S.characterData){y.characterData=!0,y.characterDataOldValue=!0;return}if(S.all){b(),y.characterData=!0,y.characterDataOldValue=!0;return}if(S.attribute){b([S.attribute.trim()]);return}var _=E._elementFilterAttributes(S.elementFilter).concat(S.attributeList||[]);_.length&&b(_)}),w&&(y.attributeFilter=Object.keys(w)),y},E.validateOptions=function(g){for(var y in g)if(!(y in E._optionKeys))throw Error("Invalid option: "+y);if(typeof g.callback!="function")throw Error("Invalid options: callback is required and must be a function");if(!g.queries||!g.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var w={callback:g.callback,rootNode:g.rootNode||document,observeOwnChanges:!!g.observeOwnChanges,oldPreviousSibling:!!g.oldPreviousSibling,queries:[]},b=0;b<g.queries.length;b++){var S=g.queries[b];if(S.all){if(Object.keys(S).length>1)throw Error("Invalid request option. all has no options.");w.queries.push({all:!0});continue}if("attribute"in S){var _={attribute:E._validateAttribute(S.attribute)};if(_.elementFilter=p.parseSelectors("*["+_.attribute+"]"),Object.keys(S).length>1)throw Error("Invalid request option. attribute has no options.");w.queries.push(_);continue}if("element"in S){var T=Object.keys(S).length,_={element:S.element,elementFilter:p.parseSelectors(S.element)};if(S.hasOwnProperty("elementAttributes")&&(_.attributeList=E._validateElementAttributes(S.elementAttributes),T--),T>1)throw Error("Invalid request option. element only allows elementAttributes option.");w.queries.push(_);continue}if(S.characterData){if(Object.keys(S).length>1)throw Error("Invalid request option. characterData has no options.");w.queries.push({characterData:!0});continue}throw Error("Invalid request option. Unknown query request.")}return w},E._validateElementAttributes=function(g){if(!g.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var y={},w={},b=g.split(/\s+/),S=0;S<b.length;S++){var _=b[S];if(_){_=E._validateAttribute(_);var T=_.toLowerCase();if(y[T])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");w[_]=!0,y[T]=!0}}return Object.keys(w)},E._elementFilterAttributes=function(g){var y={};return g.forEach(function(w){w.qualifiers.forEach(function(b){y[b.attrName]=!0})}),Object.keys(y)},E._validateAttribute=function(g){if(typeof g!="string"||(g=g.trim(),!g))throw Error("Invalid request option. attribute must be a non-zero length string.");if(!g.match(E._attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+g);return g},E._attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:.]*)$/,E._optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},E})(),C=(function(){function E(g){var y=this;this._connected=!1,this._options=v.validateOptions(g),this._observerOptions=v.createObserverOptions(this._options.queries),this._root=this._options.rootNode,this._callback=this._options.callback,this._elementFilter=Array.prototype.concat.apply([],this._options.queries.map(function(w){return w.elementFilter?w.elementFilter:[]})),this._elementFilter.length||(this._elementFilter=void 0),this._calcReordered=this._options.queries.some(function(w){return w.all}),this._queryValidators=[],E.createQueryValidator&&(this._queryValidators=this._options.queries.map(function(w){return E.createQueryValidator(y._root,w)})),this._observer=new MutationObserver(function(w){y._observerCallback(w)}),this.reconnect()}return E.prototype.reconnect=function(){if(this._connected)throw Error("Already connected");this._observer.observe(this._root,this._observerOptions),this._connected=!0,this._checkpointQueryValidators()},E.prototype.takeSummaries=function(){if(!this._connected)throw Error("Not connected");var g=this._createSummaries(this._observer.takeRecords());return this._changesToReport(g)?g:void 0},E.prototype.disconnect=function(){var g=this.takeSummaries();return this._observer.disconnect(),this._connected=!1,g},E.prototype._observerCallback=function(g){this._options.observeOwnChanges||this._observer.disconnect();var y=this._createSummaries(g);this._runQueryValidators(y),this._options.observeOwnChanges&&this._checkpointQueryValidators(),this._changesToReport(y)&&this._callback(y),!this._options.observeOwnChanges&&this._connected&&(this._checkpointQueryValidators(),this._observer.observe(this._root,this._observerOptions))},E.prototype._createSummaries=function(g){if(!g||!g.length)return[];for(var y=new c(this._root,g,this._elementFilter,this._calcReordered,this._options.oldPreviousSibling),w=[],b=0;b<this._options.queries.length;b++)w.push(new u(y,this._options.queries[b]));return w},E.prototype._checkpointQueryValidators=function(){this._queryValidators.forEach(function(g){g&&g.recordPreviousState()})},E.prototype._runQueryValidators=function(g){this._queryValidators.forEach(function(y,w){y&&y.validate(g[w])})},E.prototype._changesToReport=function(g){return g.some(function(y){return!!(["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some(function(w){return y[w]&&y[w].length})||y.attributeChanged&&Object.keys(y.attributeChanged).some(function(w){return!!y.attributeChanged[w].length}))})},E})(),k=(function(){function E(g,y){this.root=g,this.delegate=y,this.idMap={}}return E.prototype.initialize=function(g,y){this.idMap[g]=this.root;for(var w=0;w<y.length;w++)this.deserializeNode(y[w],this.root)},E.prototype.applyChanged=function(g,y,w,b){var S=this;y.forEach(function(_){var T=S.deserializeNode(_);S.deserializeNode(_.parentNode),S.deserializeNode(_.previousSibling),T.parentNode&&T.parentNode.removeChild(T)}),g.forEach(function(_){var T=S.deserializeNode(_);T.parentNode&&T.parentNode.removeChild(T)}),y.forEach(function(_){var T=S.deserializeNode(_),x=S.deserializeNode(_.parentNode),N=S.deserializeNode(_.previousSibling);x.insertBefore(T,N?N.nextSibling:x.firstChild)}),w.forEach(function(_){var T=S.deserializeNode(_);Object.keys(_.attributes).forEach(function(x){var N=_.attributes[x];N===null?T.removeAttribute(x):(!S.delegate||!S.delegate.setAttribute||!S.delegate.setAttribute(T,x,N))&&T.setAttribute(x,N)})}),b.forEach(function(_){var T=S.deserializeNode(_);T.textContent=_.textContent}),g.forEach(function(_){delete S.idMap[_.id]})},E.prototype.deserializeNode=function(g,y){var w=this;if(g===null)return null;var b=this.idMap[g.id];if(b)return b;var S=this.root.ownerDocument;switch(S===null&&(S=this.root),g.nodeType){case Node.COMMENT_NODE:b=S.createComment(g.textContent);break;case Node.TEXT_NODE:b=S.createTextNode(g.textContent);break;case Node.DOCUMENT_TYPE_NODE:b=S.implementation.createDocumentType(g.name,g.publicId,g.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(b=this.delegate.createElement(g.tagName)),b||(b=S.createElement(g.tagName)),Object.keys(g.attributes).forEach(function(T){(!w.delegate||!w.delegate.setAttribute||!w.delegate.setAttribute(b,T,g.attributes[T]))&&b.setAttribute(T,g.attributes[T])});break;default:throw"Unsupported node type: "+g.nodeType}if(this.idMap[g.id]=b,y&&y.appendChild(b),g.childNodes)for(var _=0;_<g.childNodes.length;_++)this.deserializeNode(g.childNodes[_],b);return b},E})(),L=(function(){function E(g,y,w){var b=this;this.target=g,this.mirror=y,this.nextId=1,this.knownNodes=new r;for(var S=this.serializeNode(g).id,_=[],T=g.firstChild;T;T=T.nextSibling)_.push(this.serializeNode(T,!0));this.mirror.initialize(S,_);var x=[{all:!0}];w&&(x=x.concat(w)),this.mutationSummary=new C({rootNode:g,callback:function(N){b.applyChanged(N)},queries:x})}return E.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},E.prototype.rememberNode=function(g){var y=this.nextId++;return this.knownNodes.set(g,y),y},E.prototype.forgetNode=function(g){this.knownNodes.delete(g)},E.prototype.serializeNode=function(g,y){if(g===null)return null;var w=this.knownNodes.get(g);if(w!==void 0)return{id:w};var b={nodeType:g.nodeType,id:this.rememberNode(g)};switch(b.nodeType){case Node.DOCUMENT_TYPE_NODE:var S=g;b.name=S.name,b.publicId=S.publicId,b.systemId=S.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:b.textContent=g.textContent;break;case Node.ELEMENT_NODE:var _=g;b.tagName=_.tagName,b.attributes={};for(var T=0;T<_.attributes.length;T++){var x=_.attributes[T];b.attributes[x.name]=x.value}if(y&&_.childNodes.length){b.childNodes=[];for(var N=_.firstChild;N;N=N.nextSibling)b.childNodes.push(this.serializeNode(N,!0))}}return b},E.prototype.serializeAddedAndMoved=function(g,y,w){var b=this,S=g.concat(y).concat(w),_=new r;S.forEach(function(x){var N=x.parentNode,I=_.get(N);I||(I=new r,_.set(N,I)),I.set(x,!0)});var T=[];return _.keys().forEach(function(x){for(var N=_.get(x),I=N.keys();I.length;){for(var O=I[0];O.previousSibling&&N.has(O.previousSibling);)O=O.previousSibling;for(;O&&N.has(O);){var M=b.serializeNode(O);M.previousSibling=b.serializeNode(O.previousSibling),M.parentNode=b.serializeNode(O.parentNode),T.push(M),N.delete(O),O=O.nextSibling}I=N.keys()}}),T},E.prototype.serializeAttributeChanges=function(g){var y=this,w=new r;return Object.keys(g).forEach(function(b){g[b].forEach(function(S){var _=w.get(S);_||(_=y.serializeNode(S),_.attributes={},w.set(S,_)),_.attributes[b]=S.getAttribute(b)})}),w.keys().map(function(b){return w.get(b)})},E.prototype.applyChanged=function(g){var y=this,w=g[0],b=w.removed.map(function(x){return y.serializeNode(x)}),S=this.serializeAddedAndMoved(w.added,w.reparented,w.reordered),_=this.serializeAttributeChanges(w.attributeChanged),T=w.characterDataChanged.map(function(x){var N=y.serializeNode(x);return N.textContent=x.textContent,N});this.mirror.applyChanged(b,S,_,T),w.removed.forEach(function(x){y.forgetNode(x)})},E})();if(MutationObserver===void 0)throw Error("DOM Mutation Observers are required");n.ChildListChange=o,n.MutationProjection=c,n.MutationSummary=C,n.NodeChange=a,n.NodeMap=r,n.Qualifier=d,n.Selector=p,n.Summary=u,n.TreeChanges=l,n.TreeMirror=k,n.TreeMirrorClient=L,Object.defineProperty(n,"__esModule",{value:!0})}))})),GO=VO(),Ko=0,Yo=new Array(1e3);function XO(){for(let e=0;e<Ko;e+=2){const t=Yo[e],n=Yo[e+1];t(...n),Yo[e]=void 0,Yo[e+1]=void 0}Ko=0}function KO(e,...t){Yo[Ko]=e,Yo[Ko+1]=t,Ko+=2,Ko===2&&ZO()}function YO(){let e=0;const t=new MutationObserver(XO),n=document.createTextNode("");return t.observe(n,{characterData:!0}),()=>{n.data=String(e=++e%2)}}var ZO=YO();function Ky(){KO(()=>{nf.hasListeners()&&(nf.fire(),Ky())})}var nf=new ge({onFirstListenerAdd:Ky}),El=nf.once;function QO(e,t,n){const r=new ge;let o=[];return r.addDisposable(e(i=>{El(()=>{r.fire(t(o)),o=[]}),o.push(i)})),n?.addDisposable(r),r.event}var JO=class extends ge{constructor(e={}){super(),A(this,"_mutationSummary",void 0),this._mutationSummary=new GO.MutationSummary({...e,observeOwnChanges:!0,callback:t=>this.fire(t),queries:[{all:!0}]})}dispose(){this._mutationSummary.disconnect(),super.dispose()}trigger(e){if(this.isDisposed())return;const t=this._mutationSummary.takeSummaries();return(e||t?.length)&&this.fire(t||[]),t}},eR=class extends Ee{_nextTickHandler(){El(()=>{this.trigger(),this._summaries.length&&(this._innerEmitter.hasListeners()?this._innerEmitter.fire(this._summaries):this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)}constructor(e={}){super(),A(this,"_mutationEmitter",void 0),A(this,"_innerEmitter",this.addDisposable(new ge({onFirstListenerAdd:()=>{this._nextTickHandler()}}))),A(this,"_lostEmitter",this.addDisposable(new ge)),A(this,"_paused",0),A(this,"_stopped",0),A(this,"_foreignCode",0),A(this,"_summaries",[]),A(this,"onMutate",this._innerEmitter.event),A(this,"onLost",this._lostEmitter.event),A(this,"onNativeMutate",void 0),this._mutationEmitter=this.addDisposable(new JO(e)),this.onNativeMutate=this._mutationEmitter.event,this.addDisposable(this._mutationEmitter.event(t=>{(!this._stopped||this._foreignCode)&&(this._paused?this._lostEmitter.fire(t):(this._summaries.push(...t),El(()=>{this._summaries.length&&!this._innerEmitter.hasListeners()&&(this._lostEmitter.fire(this._summaries),this._summaries=[])},Number.MAX_VALUE)))}))}get isStoped(){return this._paused>0||this._stopped>0}stop(){this._mutationEmitter.trigger(),this._stopped++}start(){this._mutationEmitter.trigger(),this._stopped--}pause(){this._mutationEmitter.trigger(),this._paused++}resume(){this._mutationEmitter.trigger(),this._paused--}pauseForForeignCode(){this.pause(),this._foreignCode++}resumeAfterForeignCode(){this.resume(),this._foreignCode--}unpaused(e){if(!this._paused||this._stopped)return e();this._mutationEmitter.trigger();const t=this._paused;this._paused=0;try{return e()}finally{try{this._mutationEmitter.trigger()}finally{this._paused+=t}}}trigger(){this._mutationEmitter.trigger(!0)}takeRecords(){this._mutationEmitter.trigger()}flush(){if(this._mutationEmitter.trigger(),this._summaries.length&&this._innerEmitter.hasListeners()){const e=this._summaries;this._summaries=[],this._innerEmitter.fire(e)}}},tR=1,Yy=e=>e.nodeType===tR,rf=e=>e?.nodeName==="STYLE";function nR(e){return e.some(t=>t.attributeChanged&&Object.keys(t.attributeChanged).length||t.reparented?.length||t.reordered?.length||t.added?.some(n=>Yy(n)||rf(n.parentNode))||t.removed?.some(n=>Yy(n)||rf(t.getOldParentNode(n)))?!0:!!t.characterDataChanged?.some(n=>rf(n.parentNode)))}var rR=El;function oR(e,t){let n=0;for(const r of t){if(r.oldPosition>e)break;const o=r.oldLength>0&&r.newLength>0,i=e===r.oldPosition||e===r.oldEnd;if(o&&i||r.oldPosition<e&&e<r.oldEnd)return;r.oldEnd<=e&&(n=r.newEnd-r.oldEnd)}return e+n}var Zy=/&(?:#\d+|#x[\da-f]+|[a-z][a-z\d]*);/iy;function Qy(e,t){Zy.lastIndex=t;const n=Zy.exec(e);return n?n[0].length:e.startsWith(`\r
|
|
3
3
|
`,t)?2:1}function Jy(e){return e.length===1?1:(wr(e).textContent??"").length}function iR(e,t,n){if(n)return Math.min(t,e.length);let r=0,o=0;for(;o<e.length&&r<t;){const i=Qy(e,o);r+=Jy(e.slice(o,o+i)),o+=i}return o}function sR(e,t,n){if(n)return Math.min(t,e.length);let r=0;for(let o=0;o<e.length;){const i=Qy(e,o);if(o+i>t)break;r+=Jy(e.slice(o,o+i)),o+=i}return r}function gs(e,t){const n=t.nodeMap.getByElement(e);return n&&t.isAttached(n)?n:void 0}var aR='[contenteditable="true"], editor';function ev(e,t,n){const r=e.childNodes;for(let i=t;i<r.length;i++){const s=gs(r[i],n);if(s)return s.start}for(let i=Math.min(t,r.length)-1;i>=0;i--){const s=gs(r[i],n);if(s)return s.end}const o=gs(e,n);return o&&(o.startTagEnd??o.start)}function tv(e,t){if((e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(aR))for(let n=e,r=e.parentNode;r;n=r,r=r.parentNode){const o=ev(r,Array.from(r.childNodes).indexOf(n),t);if(o!==void 0)return o}}function lR({node:e,offset:t},n){if(e.nodeType===Node.TEXT_NODE){const r=gs(e,n);if(r?.type!==D.HTML)return tv(e,n);const o=n.textAt(r.start,r.end);return r.start+iR(o,t,yn(e.parentNode))}return ev(e,t,n)??(gs(e,n)?void 0:tv(e,n))}function of(e,t,n){const r=n.nodeMap.getByNode(e),o=r?.parentNode;if(!(!r||!o))return{node:o,offset:Array.from(o.childNodes).indexOf(r)+(t?1:0)}}function cR(e,t){const n=t.nodeAt(e);if(!n)return;if(n.type===D.HTML){const s=t.nodeMap.getByNode(n);return s?.nodeType!==Node.TEXT_NODE?void 0:{node:s,offset:sR(t.textAt(n.start,n.end),Math.max(0,Math.min(e,n.end)-n.start),yn(s.parentNode))}}if(e<=n.start||e>=n.end)return of(n,e>=n.end&&e>n.start,t);const r=n.children.find(s=>s.start>=e);if(r)return of(r,!1,t);const o=n.children[n.children.length-1];if(o)return of(o,!0,t);const i=t.nodeMap.getByNode(n);return i&&{node:i,offset:0}}var bne=400,nv=3e3,uR=class extends Ee{constructor(e,t=400){super(),A(this,"_waitMs",void 0),A(this,"_actionId",void 0),A(this,"_queue",[]),A(this,"_timer",void 0),A(this,"_guid",void 0),A(this,"_releaseOnReady",!1),A(this,"_releasing",!1),this._waitMs=t,this.addDisposable(e.onHistoryAction(n=>this._wait(n))),this.addDisposable(e.onHistoryActionSent(n=>this._sent(n))),this.addDisposable(e.onHistoryActionAnswered(n=>this._answered(n))),this.addDisposable(e.onEntitySet(n=>this._entitySet(n))),this.addDisposable(e.onReady(()=>this._ready())),this.addDispose(()=>this._drop())}hold(e){return this._actionId===void 0?!1:(this._queue.push(e),!0)}holdBehindQueued(e){return!this._queue.length||this._releasing?!1:(this._queue.push(e),!0)}isWaiting(){return this._actionId!==void 0}hasQueued(){return this._queue.length>0&&!this._releasing}releaseNow(){this._queue.length&&this._release()}_wait(e){this._actionId=e,this._restartTimer(nv)}_sent(e){e===this._actionId&&!this._releaseOnReady&&this._restartTimer(this._waitMs)}_restartTimer(e){clearTimeout(this._timer),this._timer=setTimeout(()=>this._release(),e)}_answered(e){e===this._actionId&&this._release()}_release(){clearTimeout(this._timer),this._actionId=void 0,this._releaseOnReady=!1,this._releasing=!0;try{for(;this._actionId===void 0&&this._queue.length;){const e=this._queue.shift();try{e?.()}catch{}}}finally{this._releasing=!1}}_entitySet(e){const t=e===this._guid;this._guid=e,t?this._actionId!==void 0&&(this._restartTimer(this._waitMs),this._releaseOnReady=!0):this._drop()}_ready(){this._releaseOnReady&&(this._releaseOnReady=!1,this._release())}_drop(){clearTimeout(this._timer),this._actionId=void 0,this._releaseOnReady=!1,this._queue=[]}},rv=2e3,dR=3;function fR(e,t,n){const r=e.data.indexOf(n,Math.max(0,t-n.length));return n.trim().length>=dR&&r>=0&&r<=t}function ov(e,t){if(!e||e.nodeType===Node.TEXT_NODE)return e;const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);let r;for(let o=n.nextNode();o&&(t||!r);o=n.nextNode())r=o;return r}function mR(e,t){if(e.nodeType===Node.TEXT_NODE)return{text:e,offset:t};const n=ov(e.childNodes[t-1],!0),r=n?void 0:ov(e.childNodes[t],!1);return n?{text:n,offset:n.length}:r&&{text:r,offset:0}}var hR=class extends Ee{beginTextUpdate(){this._baseDocument.beginUpdate()}endTextUpdate(){this._baseDocument.endUpdate()}constructor(e,t,n){super(),A(this,"_baseDocument",void 0),A(this,"_remoteDocument",void 0),A(this,"_parsedDocument",void 0),A(this,"_nodeMap",void 0),A(this,"_beforeChangeEmitter",this.addDisposable(new ge)),A(this,"_beforeCommitEmitter",this.addDisposable(new ge)),A(this,"_beforeTextCommitEmitter",this.addDisposable(new ge)),A(this,"_onTextCommitEmitter",this.addDisposable(new ge)),A(this,"_onRefreshEmitter",this.addDisposable(new ge)),A(this,"_documentElement",void 0),A(this,"_docType",void 0),A(this,"_parseFn",void 0),A(this,"_serviceMarkup",void 0),A(this,"_mapHTMLRoots",void 0),A(this,"_roots",void 0),A(this,"_getRootsParent",void 0),A(this,"_mutationCollector",this.addDisposable(new eR)),A(this,"_attributeMapper",void 0),A(this,"_trackedOffsets",new Set),A(this,"_inputHold",void 0),A(this,"_shownEntity",void 0),A(this,"_savedCaret",void 0),A(this,"ownership",void 0),A(this,"holdCaretAfterBreak",void 0),A(this,"_reportedDrifts",new Set),A(this,"_hiddenEmptyTexts",new WeakSet),A(this,"_canvasNodes",zO(document)),A(this,"_accountingTimer",void 0),A(this,"_lastAccounting",0),A(this,"_capture",void 0),A(this,"_openBatches",0),A(this,"_pushUndoStop",!1),A(this,"_locked",!1),A(this,"_beforeCommitPending",!1),A(this,"_closeStep",!1),A(this,"_styleDirty",!0),A(this,"_outputs",new Map),A(this,"_runningScripts",[]),A(this,"scriptRunner",{run:(o,i)=>this.runScript(o,i),quiet:o=>this.renderOnly(o),substitute:(o,i)=>{const s=this._nodeMap.getByElement(o);s&&(this._nodeMap.remove(s,!1),this._nodeMap.set(s,i))}}),A(this,"_commands",[]),A(this,"_pauseOnCommandInput",o=>{const i=this._commands[this._commands.length-1];if(i){i.paused||(i.paused=!0,this._mutationCollector.pause());return}o.isTrusted&&(this._pushUndoStop=!0,this.recordNow())}),A(this,"_treeMutations",[]),A(this,"beforeChange",this._beforeChangeEmitter.event),A(this,"beforeCommit",this._beforeCommitEmitter.event),A(this,"beforeTextCommit",this._beforeTextCommitEmitter.event),A(this,"onTextCommit",this._onTextCommitEmitter.event),A(this,"onChange",VN(QO(this._mutationCollector.onNativeMutate,o=>o.flat(),this),o=>o.length>0,this)),A(this,"onRefresh",this._onRefreshEmitter.event),this._baseDocument=e,this._remoteDocument=t,this._parseFn=n.prepareHtml,this._serviceMarkup=n.serviceMarkup,this._mapHTMLRoots=n.mapHTMLRoots,this._getRootsParent=n.rootsParent,this._roots=[...document.childNodes];const r=this._parsedDocument=new ox(e,n.createRoot);this._nodeMap=new Wx,this.addDisposable(r.onRefresh(this._onRefresh.bind(this))),this.addDisposable(r.onMutate(this._onRemoteMutate.bind(this))),this._attributeMapper=new BO(this._nodeMap),this.addDisposable(Qx(()=>this._mutationCollector.pauseForForeignCode())),this.addDisposable(Jx(()=>this._mutationCollector.resumeAfterForeignCode())),this.addDisposable(this._mutationCollector.onNativeMutate(o=>{this._styleDirty||(this._styleDirty=nR(o))})),this.addDisposable(this._mutationCollector.onLost(o=>this._attributeMapper.onHiddenMutate(o))),this.ownership=new HO(o=>!!this._nodeMap.getByElement(o)),this.addDisposable(this._mutationCollector.onLost(o=>this._bindScriptOutput(o))),this.addDisposable(this._mutationCollector.onLost(o=>this.ownership.observeLost(o))),this.addDispose(iL(this._pauseOnCommandInput)),t.collectCanvasEdits=()=>this.commit(!1),this.addDispose(()=>clearTimeout(this._accountingTimer)),this.addDisposable(t.onEntitySet(o=>this._rememberCaret(o))),this.addDisposable(t.onReady(()=>this._dropForeignCaret())),this._inputHold=this.addDisposable(new uR(t)),this.addDisposable(e.onChanged(({changes:o})=>this._rebaseTracked(o))),this.addDisposable(t.onEntitySet(()=>this._forgetTracked()))}trackOffset(e){const t={offset:e};return this._trackedOffsets.add(t),{current:()=>t.offset,release:()=>this._trackedOffsets.delete(t)}}_rebaseTracked(e){for(const t of this._trackedOffsets)t.offset=t.offset===void 0?void 0:oR(t.offset,e)}_forgetTracked(){for(const e of this._trackedOffsets)e.offset=void 0;this._trackedOffsets.clear()}holdInput(e){return this._inputHold.hold(e)}holdInputBehindQueued(e){return this._inputHold.holdBehindQueued(e)}isHoldingInput(){return this._inputHold.isWaiting()}hasHeldInput(){return this._inputHold.hasQueued()}releaseHeldInput(){this._inputHold.releaseNow()}_rememberCaret(e){const t=e===this._shownEntity;this._shownEntity=e,this._savedCaret=void 0;const n=document.getSelection();if(!t||!n?.isCollapsed||document.activeElement?.closest("input, textarea, select, .monaco-editor"))return;const r=n.anchorNode,o=r?.childNodes,i=r?.nodeType===Node.TEXT_NODE?r:[o?.[n.anchorOffset-1],o?.[n.anchorOffset]].find(s=>s?.nodeType===Node.TEXT_NODE);i&&(this._savedCaret={node:i,text:i.data})}_dropForeignCaret(){const e=this._savedCaret;if(this._savedCaret=void 0,!e||document.activeElement?.closest("input, textarea, select, .monaco-editor"))return;const t=document.getSelection(),n=t?.anchorNode;if(!e.node.isConnected){const l=n?mR(n,t?.anchorOffset??0):void 0;l&&l.text!==e.node&&!fR(l.text,l.offset,e.text)&&t?.removeAllRanges();return}const{text:r}=e,o=e.node.data,i=Math.min(r.length,o.length);let s=0;for(;s<i&&r[s]===o[s];)s++;let a=0;for(;a<i-s&&r[r.length-1-a]===o[o.length-1-a];)a++;s+a<Math.ceil(i/2)&&(n===e.node||n===e.node.parentNode)&&t?.removeAllRanges()}_typedIntoHidden(e){const t=e.flatMap(n=>n.characterDataChanged??[]).filter(n=>this._hiddenEmptyTexts.has(n)&&n.isConnected&&n.data!==""&&!this.isBehindHidden(n));for(const n of t)this._hiddenEmptyTexts.delete(n),this.ownership.forgetService(n);return t.length?[Vx(t)]:[]}isBehindHidden(e){for(let t=e.parentNode;t&&!this._nodeMap.getByElement(t);t=t.parentNode)if(!this.ownership.isWrapper(t)&&this.ownership.markOf(t))return!0;return!1}isUntracked(e){return this.ownership.isMarked(e)||this.ownership.isOffModel(e.parentNode)||this.ownership.isService(e)}markUntracked(e){this.ownership.markForeign(e)}_reportSafely(e){try{e()}catch{}}_reportForeignStructure(e){this._reportSafely(()=>{const t=n=>!!this._nodeMap.getByElement(n);qO(FO(e,this.ownership,t),this._reportedDrifts),WO($O(e,t),this._reportedDrifts)})}_accountingRules(){const e=new Set;for(const t of this._parsedDocument.root.children){const n=this._nodeMap.getByNode(t);n&&e.add(n)}return this._getRootsParent?.()?.childNodes.forEach(t=>e.add(t)),{isMapped:t=>!!this._nodeMap.getByElement(t),markOf:t=>this.ownership.markOf(t),isCanvasNode:t=>this._canvasNodes.has(t),roots:e}}nodeBucket(e){return jy(e,this._accountingRules())}auditNodes(){return Vy(document,this._accountingRules()).map(Gy)}checkAccounting(){this._reportSafely(()=>Xy(Vy(document,this._accountingRules()),this._reportedDrifts))}_checkCommitted(e){this._reportSafely(()=>{const t=e.flatMap(n=>[...n.added,...n.reparented??[],...n.reordered??[]]);Xy(UO(t,this._accountingRules()),this._reportedDrifts)})}_scheduleAccountingCheck(){if(this._accountingTimer!==void 0||this.isDisposed())return;const e=()=>{this._accountingTimer=void 0,this._lastAccounting=Date.now(),this.isDisposed()||this.checkAccounting()},t=Math.max(0,this._lastAccounting+rv-Date.now());this._accountingTimer=setTimeout(()=>{const n=window.requestIdleCallback;n?n(e,{timeout:rv}):e()},t)}closeUndoStep(){this._closeStep=!0}commit(e=!0,t=!1){this._pushUndoStop||(this._pushUndoStop=e),this._locked||(this._locked=t);const n=this._capture??this._startCapture();return this._runBeforeCommit(),n}takeStyleDirty(){this._mutationCollector.takeRecords();const e=this._styleDirty;return this._styleDirty=!1,e}_runBeforeCommit(){this._beforeCommitPending&&!this.isDisposed()&&(this._beforeCommitPending=!1,this._mutationCollector.unpaused(()=>this._beforeCommitEmitter.fire()))}flushCommit(){this._capture!==void 0&&this._mutationCollector.flush()}recordNow(){this._capture===void 0&&this._startCapture(),this._mutationCollector.flush()}_startCapture(){let e;const t=new Promise(n=>e=n);return this._capture=t,this._openBatches++,this._beforeCommitPending=!0,this._sealOnNextTick(e),t}_letterEdits(e){const t=this._serviceMarkup;if(!t)return e;const n=Xx(e,{...t,isWrapper:r=>this.ownership.isWrapper(r),isMapped:r=>!!this._nodeMap.getByElement(r)});return n.service.forEach(r=>this.ownership.markService(r)),n.summaries}_sealOnNextTick(e){const t=this._mutationCollector.onMutate(n=>{n.length&&(this._reportSafely(()=>this._beforeTextCommitEmitter.fire()),this._dropForeignOutput(n),this._reportForeignStructure(n),this._dropForeignNodes(n),al("commit",()=>{const r=TO(this._letterEdits([...n,...this._typedIntoHidden(n)]),this._nodeMap,this._parseFn,this._rootsParent(),o=>this.ownership.isWrapper(o));this._commit(r)}),this._reportSafely(()=>this._onTextCommitEmitter.fire()),this._checkCommitted(n),this._dropOrphanedOutput())});rR(()=>{this._beforeCommitPending&&this._reportSafely(()=>this._runBeforeCommit()),this._reportSafely(()=>this._mutationCollector.flush()),this._beforeCommitPending=!1,t.dispose();const{_pushUndoStop:n,_locked:r}=this;this._capture=void 0,this._pushUndoStop=this._locked=!1,this._closeStep&&n&&(this._closeStep=!1,this._remoteDocument.closeStep());const o=()=>{this._openBatches--,e()};if(r&&!this.isDisposed()){this._remoteDocument.saveChangesAsync(n).finally(o);return}try{this.isDisposed()||this._remoteDocument.saveChanges(n)}finally{o()}})}get entityId(){return this._remoteDocument.entityId}whenSent(e=!1){return this._remoteDocument.whenSent(e)}sendAfterCurrentEdits(e){const t=this._pushUndoStop;return this._pushUndoStop=!1,this._remoteDocument.sendAfterCurrentEdits(e,t)}holdsTypedEdits(){return this._remoteDocument.holdsTypedEdits()}hasEditsAfterBoundary(){return this._remoteDocument.hasEditsAfterBoundary()}markHistoryAction(){return this._remoteDocument.markHistoryAction()}noteHistoryActionSent(e){this._remoteDocument.noteHistoryActionSent(e)}_textPoints(){return{nodeMap:this._nodeMap,textAt:(e,t)=>this._baseDocument.getText({start:e,end:t}),nodeAt:e=>this._parsedDocument.getNodeByPosition(e),isAttached:e=>this._parsedDocument.isAttached(e)}}pointToOffset(e){return lR(e,this._textPoints())}offsetToPoint(e){return cR(e,this._textPoints())}renderOnly(e){this._mutationCollector.stop();try{return e()}finally{this._mutationCollector.start()}}applyHidden(e){this._mutationCollector.pause();try{return e()}finally{this._mutationCollector.resume()}}applyForeignOutput(e,t,n){e.forEach(r=>this.ownership.markOutput(r)),this.applyHidden(t),this._keepOutput(n,e)}_keepOutput(e,t){t.length&&this._outputs.set(e,[...this._outputs.get(e)??[],...t])}_isGone(e){return!e.isConnected&&!this.isInLetter(e)}isInLetter(e){const t=this._nodeMap.getByElement(e);return!!t&&this._parsedDocument.isAttached(t)}letterChildren(e){return(this._nodeMap.getByElement(e)?.children??[]).flatMap(t=>{const n=this._nodeMap.getByNode(t);return n?[n]:[]})}runScript(e,t){this._mutationCollector.pauseForForeignCode(),this._runningScripts.push(e);try{t()}finally{try{this._mutationCollector.resumeAfterForeignCode()}finally{this._runningScripts.pop()}}}_scriptOf(){if(this._runningScripts.length)return this._runningScripts[this._runningScripts.length-1]??void 0;const e=document.currentScript;return e&&(this._nodeMap.getByElement(e)||this.ownership.isOutput(e))?e:void 0}_bindScriptOutput(e){const t=this._scriptOf();if(!t)return;const n=new Set(e.flatMap(o=>o.added)),r=[...n].filter(o=>!(o.parentNode&&n.has(o.parentNode))&&!this._nodeMap.getByElement(o)&&!this.ownership.isOutput(o)&&!this.ownership.isService(o)&&!this._runningScripts.includes(o));r.forEach(o=>this.ownership.markOutput(o)),this._keepOutput(t,r)}_dropOrphanedOutput(){let e=[...this._outputs.keys()].filter(t=>this._isGone(t));for(;e.length;){const t=e.flatMap(n=>this._outputs.get(n)??[]);e.forEach(n=>this._outputs.delete(n)),this.applyHidden(()=>t.flatMap(n=>this._unwrapOutput(n))).forEach(n=>this.ownership.forget(n)),e=[...this._outputs.keys()].filter(n=>this._isGone(n))}}_unwrapOutput(e){const t=[],n=r=>r.childNodes.forEach(o=>this.isInLetter(o)?t.push(o):n(o));return n(e),e.parentNode&&e.replaceWith(...t),t}_dropForeignOutput(e){if(this.ownership.hasOutput){const t=n=>!(this.ownership.isMarked(n)&&this.ownership.isOutput(n));for(const n of e)n.added=n.added.filter(t),n.reparented=n.reparented?.filter(t),n.reordered=n.reordered?.filter(t)}}_dropForeignNodes(e){const t=n=>!this.ownership.isMarked(n)||!!this._nodeMap.getByElement(n);for(const n of e)n.added=n.added.filter(t),n.reparented=n.reparented?.filter(t),n.reordered=n.reordered?.filter(t)}applyOwn(e){this._mutationCollector.takeRecords(),this._runningScripts.push(null);try{return this._mutationCollector.unpaused(e)}finally{this._runningScripts.pop()}}applyCommand(e){const t={paused:!1};this._commands.push(t);try{return this._mutationCollector.unpaused(e)}finally{this._commands.pop(),t.paused&&this._mutationCollector.resume()}}_rootsParent(){const e=this._getRootsParent?.();return e?{node:e,treeNode:this._parsedDocument.root}:void 0}getMappedParent(e){for(;e;){const t=this._nodeMap.getByElement(e);if(t){const n=this._parsedDocument.getContext(t);return n?this._nodeMap.getByNode(n):void 0}else e=e.parentNode}}getContext(e){return this.getMappedParent(e)||e}isInExternal(e){return this.getContext(e)!==e}isVisible(e){return!!this._nodeMap.getByElement(e)}getVisibleNode(e){let t=e;do{if(!t||this._nodeMap.getByElement(t))return t;t=t.parentNode||void 0}while(t)}_commit(e){if(e.length){e=this._attributeMapper.beforeCommit(e),e=AO(e);try{this._baseDocument.beginUpdate();const t=this._parsedDocument;Bb(()=>{const n=uy(t.applyingMutation,r=>this._nodeMap.getByNode(r),r=>t.isAttached(r));return n&&{...n,stage:"tree"}},()=>t.applyMutations(e));for(const n of e)if(n.type==="Hidden"){const r=this._nodeMap.getByNode(n.node);r&&(this.ownership.markService(r),r.nodeType===Node.TEXT_NODE&&r.data===""&&this._hiddenEmptyTexts.add(r)),this._nodeMap.remove(n.node,n.value)}}finally{this._baseDocument.endUpdate()}}}correctNodes(e){const t=new Map;for(const n of e)if(!t.has(n)&&this._parsedDocument.contains(n)&&n.type===D.ELEMENT){const r=dd(n,!1,!1);r!==this._baseDocument.getText({start:n.start,end:n.startTagEnd===void 0?n.start:n.startTagEnd})+this._baseDocument.getText({start:n.endTagStart===void 0?n.end:n.endTagStart,end:n.end})&&t.set(n,r)}try{this._baseDocument.beginUpdate();for(const[n,r]of t)if(r!==this._baseDocument.getText({start:n.start,end:n.end})){const o=this._parsedDocument.replaceWithEx(n,r,rr),i=this._nodeMap.getByNode(n);i&&(this._nodeMap.remove(n),this._nodeMap.set(o,i))}}finally{this._baseDocument.endUpdate()}}_onRefresh(e){try{al("refresh",()=>this._onRemoteMutate(e,!0))}finally{this._onRefreshEmitter.fire()}}_onRemoteMutate(e,t){if(this._treeMutations.push([e,t,u2()??"other"]),!(this._remoteDocument.hasChanges()&&!this._remoteDocument.isApplyingRemote()))for(const[n,r,o]of this._treeMutations)al(o,()=>this._doOnRemoteMutate(n,r))}_doOnRemoteMutate(e,t){try{if(this._mutationCollector.stop(),e=Ux(this._attributeMapper.onRemoteMutate(e),this._nodeMap),this._treeMutations=[],!t){const o=this._parsedDocument.root;for(const i of e)if(i.type==="Add"){if(i.parent===o){t=!0;break}}else if(i.type==="Remove"){if(i.node.parent===o){t=!0;break}}else if(i.type==="Move"&&(i.node.parent===o||i.parent===o)){t=!0;break}}const n=Cx(e,this._nodeMap,o=>this._parsedDocument.isAttached(o),o=>this.ownership.markOf(o)==="service",o=>this.ownership.isOuterWrapper(o),o=>this.ownership.isWrapper(o)&&o.nodeName==="EDITOR"),r=kx(n);this._beforeChangeEmitter.fire({domMutations:n.mutations,treeMutations:e}),r.push(...nN(Nx(n)));try{if(Fx(n,this._nodeMap,this.holdCaretAfterBreak),this._dropOrphanedOutput(),this._attributeMapper.restoreHidden(),t){const o=this._parsedDocument.root?.children;if(o){const i=o.map(a=>this._nodeMap.getByNode(a)).filter(a=>!!a),s=this._roots=this._mapHTMLRoots(i,this);Yd.isEqual(i,s)}}}finally{hb(r,this.scriptRunner)}}finally{this._mutationCollector.start(),this._scheduleAccountingCheck()}}getLinks(e){const t=this._nodeMap.getByElement(e),n=t?[[t,e]]:[];for(const r of e.childNodes)n.push(...this.getLinks(r));return n}setLinks(e){for(const[t,n]of e)this._nodeMap.set(t,n)}_clearLinks(e){for(const[t]of e)this._nodeMap.remove(t)}_removeByLinks(e,t){const n=new Set,r=[];for(const[o,i]of e)o.parent&&!n.has(o.parent)&&(this._parsedDocument.remove(o,t),r.unshift(le.remove(i))),n.add(o);return r}getInnerHtml(e){let t=this._nodeMap.getByElement(e);return t?this._baseDocument.getText({start:t.startTagEnd===void 0?t.start:t.startTagEnd,end:t.endTagStart===void 0?t.end:t.endTagStart}):""}getOuterHtml(e){let t=this._nodeMap.getByElement(e);return t?this._baseDocument.getText({start:t.start,end:t.end}):""}getRootsHtml(){const e=this._getRootsParent?.();return e?[...e.childNodes].map(t=>this.getOuterHtml(t)).join(""):""}setInnerHtml(e,t){if(e instanceof Element)e.innerHTML=t;else if(e instanceof Comment)e.data=t;else if(e instanceof Document){st("not supported inner html of Document");return}else e instanceof Text&&(e.textContent=t)}getElementByPosition(e){let t=this._parsedDocument.getNodeByPosition(e);if(t){let n;do n=this._nodeMap.getByNode(t);while(!n&&(t=t?.parent));return n}}getRangeByElement(e,t=!1){if(e){let n=null;do n=this._nodeMap.getByElement(e);while(t&&!n&&(e=e.parentElement));if(n)return{start:n.start,end:n.end}}}},yne=1500,vne=2,pR=100,gR=class{constructor(e){A(this,"_options",void 0),A(this,"_watches",new Map),A(this,"_timer",void 0),A(this,"_last",0),A(this,"_tick",()=>{const t=Date.now(),n=Math.min(Math.max(t-this._last,0),200);this._last=t;for(const[r,o]of this._watches){if(!this._options.isAwaiting(r)){this._watches.delete(r);continue}if(o.waited+=n,!(o.waited<1500)){if(o.retries<2){o.retries+=1,o.waited=0,o.resend();continue}t-o.startedAt<15e3||(this._watches.delete(r),this._options.onGiveUp(r,o.retries))}}this._watches.size||this._stop()}),this._options=e}watch(e,t){this._watches.set(e,{startedAt:Date.now(),waited:0,retries:0,resend:t}),this._timer===void 0&&(this._last=Date.now(),this._timer=setInterval(this._tick,pR))}resendNow(e){const t=this._watches.get(e);t&&(t.waited=0,t.resend())}giveUpNow(e){const t=this._watches.get(e);this._watches.delete(e),this._options.onGiveUp(e,t?.retries??0)}dispose(){this._watches.clear(),this._stop()}_stop(){this._timer!==void 0&&(clearInterval(this._timer),this._timer=void 0)}},sf=class{constructor(){A(this,"_changes",null),A(this,"_typedAt",null),A(this,"_selection",null),A(this,"_closesStep",!1)}get(){return this._changes}hasChanges(){return!!this._changes?.length}add(e){this.hasChanges()||(this._selection=null);const t=At(this._changes,e);this._changes=t.length?t:null;const n=Date.now();this._typedAt=this._changes?{from:this._typedAt?.from??n,to:n}:null}clear(){this._changes=null,this._typedAt=null,this._selection=null,this._closesStep=!1}closeStep(){this._closesStep=!0}closesStep(){return this._closesStep}replace(e){this._changes=e.length?e:null,this._selection=null,this._changes||(this._typedAt=null)}typedAt(){return this._typedAt}selection(){return this._selection}noteSelection(e,t){this.hasChanges()&&(this._selection=t?e:this._selection&&{before:this._selection.before,after:e.after})}takeFrom(e){this._changes=e._changes,this._typedAt=e._typedAt,this._selection=e._selection,this._closesStep=e._closesStep,e.clear()}absorb(e){const t=this._typedAt,n=e._typedAt,r=this.hasChanges()?this._selection&&e._selection&&{...this._selection,after:e._selection.after}:e._selection;e._changes&&this.add(e._changes),this._closesStep=e._closesStep,this._selection=this._changes?r:null,this._changes&&(this._typedAt=t&&n?{from:Math.min(t.from,n.from),to:Math.max(t.to,n.to)}:n??t)}correctOffset(e,t){const n=this._changes;if(n){let r=0;for(let o=0,i=n.length;o<i;o++){const s=n[o];if(s.oldPosition<e)r+=s.newLength-s.oldLength;else break}e=e+(t?1:-1)*r}return e}correctRange(e,t){return{start:this.correctOffset(e.start,t),end:this.correctOffset(e.end,t)}}},iv=60;function bR(e,t){const n=Pb(e,t);if(!n)return;const r=n.start;return{offset:r,ownLength:e.length,cachedLength:t.length,own:e.substring(r,r+iv),cached:t.substring(r,r+iv)}}var yR=64,vR=class extends Ee{constructor(...e){super(...e),A(this,"_onApplyEmitter",this.addDisposable(new ge)),A(this,"_onEmptyEmitter",this.addDisposable(new ge)),A(this,"_dispatched",[]),A(this,"_echoed",new Set),A(this,"_revertedAwaiting",new Set),A(this,"onApply",this._onApplyEmitter.event),A(this,"onEmpty",this._onEmptyEmitter.event)}_emit(e){e.length&&this._onApplyEmitter.fire(e),this.hasDispatched()||this._onEmptyEmitter.fire()}hasDispatched(){return!!this._dispatched.length}isInFlight(e){return this._dispatched.some(t=>t.changeId===e)}hasRevertedAwaiting(){return this._revertedAwaiting.size>0}revertedAwaitingIds(){return new Set(this._revertedAwaiting)}awaitingIds(){return[...this._dispatched.flatMap(e=>e.changeId===void 0?[]:[e.changeId]),...this._revertedAwaiting]}isRevertedAwaiting(e){return this._revertedAwaiting.has(e)}forgetReverted(e){for(const t of e)this._revertedAwaiting.delete(t)}wasEchoed(e){return e!==void 0&&this._echoed.has(e)}countDispatched(){return this._dispatched.reduce((e,t)=>e+t.textChanges.length,0)}_remember(e){this._echoed.add(e),this._echoed.size>yR&&this._echoed.delete(this._echoed.values().next().value)}append(e,t){this._dispatched.unshift({changeId:t,textChanges:e})}apply(e,t,n=!1,r=[e]){const o=t===void 0?-1:this._dispatched.findIndex(i=>i.changeId===t);if(t!==void 0&&(this._remember(t),this._revertedAwaiting.delete(t)),o>=0){this._confirmEcho(o,e);return}n&&this._rebaseDispatched(r)||this._applyExternal(e)}_rebaseDispatched(e){const t=[...this._dispatched].reverse().map(r=>({...r}));let n=[];for(const r of e){let o=r;for(const i of t){const s=cl(i.textChanges,o,"after"),a=s&&cl(o,i.textChanges,"before");if(!s||!a)return!1;i.textChanges=s,o=a}n=At(n,o)}return this._dispatched=t.reverse(),this._emit(n),!0}_confirmEcho(e,t){const[n]=this._dispatched.splice(e,1);this._emit(At(Pn(n.textChanges),t))}_applyExternal(e){let t=[];for(const n of this._dispatched)t=At(t,Pn(n.textChanges)),n.changeId!==void 0&&this._revertedAwaiting.add(n.changeId);this._dispatched=[],this._emit(At(t,e))}clear(){const e=this.hasDispatched();this._dispatched=[],this._revertedAwaiting.clear(),e&&this._onEmptyEmitter.fire()}},ER=class Jk extends Ee{constructor(t=""){super(),A(this,"_text",void 0),this._text=t}getText(t){const n=T2(this,t);return n?this._text.substring(n.start,n.end):""}getLength(){return this._text.length}clone(){return new Jk(this._text)}},Sl=class eL extends ER{constructor(t=""){super(t),A(this,"_eventQueue",void 0),A(this,"_lockCounter",0),A(this,"_onChangeEmitter",this.addDisposable(new ge)),A(this,"_onChangedEmitter",this.addDisposable(new ge)),A(this,"onChanged",this._onChangedEmitter.event)}applyEdits(t,n){if(n=n.flatMap(r=>O2(this,r)),n.length){const r=Uo(n,this);this._eventQueue&&this._eventQueue.push({source:t,changes:r}),this.change(t,n),this._eventQueue||this._onChangedEmitter.fire({source:t,changes:r})}}change(t,n){this._text=L2(this._text,n)}beginUpdate(){this._lockCounter++===0&&(this._eventQueue=[])}endUpdate(t){const n=this._eventQueue;if(--this._lockCounter===0&&n&&(this._eventQueue=void 0,n.length)){t===void 0&&(t=n[0].source);let r=null;for(const{changes:o}of n)r=At(r,o);if(r=r?.filter(o=>o.oldPosition!==o.newPosition||o.newText!==o.oldText),r?.length)return this._onChangedEmitter.fire({source:t,changes:r}),!0}return!1}clone(){return new eL(this._text)}};function sv(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function wl(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",o=!1;for(let i=t;i<e.length;i++){const s=e[i];if(o){o=!1;continue}if(s==="\\"){o=!0;continue}if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n++;continue}if(s===")"&&(n--,n<0))return!1}return n===0}function SR(e){return(t,n,r)=>wl(t)?e(t,n,r):!1}function wR(e){return t=>wl(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function _R(e){return(t,n,r)=>wl(t)?sv(t)?e(t,n,r):t:!1}function CR(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return wl(n)?sv(n)?e(t):t:!1}}function TR(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function af(e,t){const n=e.length;for(let r=0;r<n;r++){const o=e.charCodeAt(r);if(o===0||t==='"'&&o===34||t==="'"&&o===39||t===""&&(o===32||o===9||o===10||o===13||o===12||o===34||o===39||o===60||o===62||o===61||o===96))return!1}return!0}function AR(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let o="";for(let i=0;i<e;i++){const s=r[i]%62;o+=t.charAt(s)}return o}var kR=8,LR=class{constructor(){A(this,"_byKey",Object.create(null)),A(this,"_byValue",Object.create(null))}getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=AR(kR),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},_l=new LR;function av(e,t){return t!==void 0&&!af(e,t)?`%|{${_l.getOrCreateByKey(e)}}|%`:e}function NR(e){const t=_l.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function Ze(e,t,n){return t!==void 0?af(e,t)?e:`%|{${_l.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function xR(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function ze(e){return e.startsWith("<!--")&&e.endsWith("-->")?xR(e.slice(4,-3)):e}function OR(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const o=e.match(/\[%\s*([^%]*?)\s*%\]/);o&&(r=o[1]);const i=r.trim();return t.test(i)||n.test(i)}function RR(e,t,n){return t!==void 0?af(e,t)?e:`%|{${_l.getOrCreateByKey(e)}}|%`:n||TR(e)||OR(e)?`<!--${e}-->`:e}var io=SR(Ze),so=wR(ze),MR=_R(Ze),PR=CR(ze),IR=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",NR),e.escape("@{","}",Ze,!0).unescape("<!--@{","}-->",ze,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",av,!0),e.escape("{{","}}",av,!0),e.createSyntax("brace-percent").escape("{%","%}",Ze).unescape("<!--{%","%}-->",ze),e.createSyntax("brace-hash").escape("{#","#}",Ze).unescape("<!--{#","#}-->",ze),e.createSyntax("proscript").escape("[%","%]",RR,!0).unescape("<!--[%","%]-->",ze,!0),e.createSyntax("getresponse").escape("[[IF","]]",Ze).escape("[[if","]]",Ze).escape("[[ELSE]]","",Ze).escape("[[else]]","",Ze).escape("[[ENDIF]]","",Ze).escape("[[endif]]","",Ze).unescape("<!--[[IF","]]-->",ze).unescape("<!--[[if","]]-->",ze).unescape("<!--[[ELSE]]","-->",ze).unescape("<!--[[else]]","-->",ze).unescape("<!--[[ENDIF]]","-->",ze).unescape("<!--[[endif]]","-->",ze),e.createSyntax("expert-sender").escape("<if",">",Ze).escape("</if",">",Ze).escape("<else",">",Ze).escape("</else",">",Ze).escape("<var ",">",Ze,!0).unescape("<!--<if ",">-->",ze).unescape("<!--</if",">-->",ze).unescape("<!--<else ",">-->",ze).unescape("<!--</else",">-->",ze).unescape("<!--<var",">-->",ze,!0),e.createSyntax("velocity").escape("#if",")",io).escape("#elseif",")",io).escape("#else","",Ze).escape("#foreach",")",io).escape("#macro",")",io).escape("#set",")",MR,!0).escape("#parse",")",io).escape("#include",")",io).escape("#evaluate",")",io).escape("#end","",Ze).escape("#break","",Ze).escape("#stop","",Ze).unescape("<!--#macro","-->",so).unescape("<!--#if","-->",so).unescape("<!--#elseif","-->",so).unescape("<!--#else","-->",ze).unescape("<!--#foreach","-->",so).unescape("<!--#parse","-->",so).unescape("<!--#include","-->",so).unescape("<!--#evaluate","-->",so).unescape("<!--#end","-->",ze).unescape("<!--#break","-->",ze).unescape("<!--#stop","-->",ze).unescape("<!--#set","-->",PR,!0),e.createSyntax("mailchimp").escape("*|","|*",Ze).unescape("<!--*|","|*-->",ze)},lv="bare",lf=new Map;function DR(e){for(const t of Object.keys(e)){const n=e[t];n&&lf.set(t,n)}}function BR(e){return e?lf.get(e)??lv:lv}function HR(){lf.clear()}function cv(e,t,n,r){for(let o=t;o<n;o++){const i=e[o];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?i===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(i)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):i==="<"?r.insideTag=!0:i===">"?r.insideTag=!1:r.insideTag&&(i==='"'||i==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=i,r.unquotedAttr=!1):r.insideTag&&/\S/.test(i)&&r.attributeQuoteChar===void 0&&e[o-1]==="="&&!['"',"'","`"].includes(i)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function bs(e,t){return e.start<t.end&&t.start<e.end}function uv(e,t,n,r,o=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const i=t.flatMap(u=>u.match(e).flatMap(d=>!Number.isInteger(d.start)||!Number.isInteger(d.end)||d.start<0||d.end>e.length||d.start>=d.end?[]:[{range:d,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end),s=[],a=o.slice().sort((u,d)=>u.start-d.start),l={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(const{range:u,mapFn:d,overrideBuiltins:f,syntax:h,isVariable:m}of i){if(r?(l.insideAttributeValue=!0,l.attributeQuoteChar='"'):cv(e,c,u.start,l),c=u.end,a.some(k=>bs(k,u)))continue;const p=l.insideAttributeValue?l.attributeQuoteChar??"":void 0,v=e.substring(u.start,u.end),C=d(v,p,l.insideTag);C!==!1&&C!==v&&(s.push({range:u,text:C,overrideBuiltins:f,syntax:h,isVariable:m}),a.push(u))}return s.sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end)}function FR(e,t){const n=t.reduce((a,{mapFn:l,start:c,end:u,syntax:d,isVariable:f})=>(a[c]||(a[c]=[]),a[c].push({value:u,mapFn:l,syntax:d,isVariable:f}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),o=new RegExp(r,"g"),i=[];let s;for(;(s=o.exec(e))!==null;){const a=s[0];i.push({start:s.index,startToken:a,endTokens:n[a]})}return i}function cf(e,t,n,r,o=!1){const i=[];if(n&&(t=t.filter(c=>c.isVariable)),!t.length)return i;const s=FR(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let l=0;for(let c=0;c<s.length;c++){const{start:u,startToken:d,endTokens:f}=s[c];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):cv(e,l,u,a),l=u;const h=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let m=!1;for(const{mapFn:p,value:v,syntax:C,isVariable:k}of f){let L=u+d.length,E=e.indexOf(v,L);for(;E!==-1;){let g=E,y=u+d.length,w=0;for(;g!==-1;){const x=e.indexOf(d,y);if(x!==-1&&x<g)w++,y=x+d.length,g=e.indexOf(v,y);else if(w>0)w--,y=g+v.length,g=e.indexOf(v,y);else break}if(g<0)break;const b=g+v.length,S=e.substring(u,b),_=p(S,h,a.insideTag);if(_===!1){L=E+Math.max(v.length,1),E=e.indexOf(v,L);continue}(o||_!==S)&&i.push({range:{start:u,end:b},text:o?S:_,syntax:C,isVariable:k});const T=s.findIndex(({start:x})=>x>=b);T>c?c=T-1:c=s.length,m=!0;break}if(m)break}}return i}function Cl(e,t){if(!t.length)return e;const n=t.slice().sort((o,i)=>i.range.start-o.range.start);let r=e;for(const{text:o,range:i}of n)r=r.slice(0,i.start)+o+r.slice(i.end);return r}var dv=class{constructor(e=IR){A(this,"_disposables",[]),A(this,"_escapes",[]),A(this,"_unescapes",[]),A(this,"_escapeMatchers",[]),A(this,"_unescapeMatchers",[]);const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,o,i,s){return t.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this},unescape(r,o,i,s){return n.push({start:r,end:o,mapFn:i,isVariable:s,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let o=!1;const i={dispose:()=>{o||(o=!0,this._escapeMatchers=this._escapeMatchers.filter(s=>s!==n),this._unescapeMatchers=this._unescapeMatchers.filter(s=>s!==r))}};return this.addDisposable(i),i}_collectMappings(e,t,n){const r=cf(e,this._escapes,t,n),o=uv(e,this._escapeMatchers,t,n),i=o.filter(l=>l.overrideBuiltins).map(l=>l.range),s=r.filter(l=>!i.some(c=>bs(c,l.range))),a=o.filter(l=>l.overrideBuiltins||!s.some(c=>bs(l.range,c.range)));return[...s,...a].sort((l,c)=>l.range.start-c.range.start||l.range.end-c.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=cf(e,this._unescapes,t),r=uv(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),i=n.filter(a=>!o.some(l=>bs(l,a.range))),s=r.filter(a=>a.overrideBuiltins||!i.some(l=>bs(a.range,l.range)));return[...i,...s].sort((a,l)=>a.range.start-l.range.start||a.range.end-l.range.end)}getRevertMappings(e,t,n){const r=n?o=>o!==void 0&&n.has(o):o=>BR(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return cf(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Cl(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Cl(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=i=>i===void 0?void 0:t[i],r=Object.values(t);let o=e;return r.includes("bare")&&(o=Cl(o,this._collectRevertMappings(o).filter(i=>n(i.syntax)==="bare"))),r.includes("html-comment")&&(o=Cl(o,this._collectMappings(o).filter(i=>!i.isVariable&&n(i.syntax)==="html-comment"&&i.text.startsWith("<!--")&&i.text.endsWith("-->")))),o}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}},$R=1e4,fv=3,WR=o2+Rd;function qR(e){return(e??[]).reduce((t,n)=>t+n.oldLength,0)}function zR(e,t){return e.stack.closesStep()?!1:e.undoStop===t.undoStop||e.serviceRemoval+t.serviceRemoval<=200}var UR=class extends Sl{constructor(){super(),A(this,"_editStack",new sf),A(this,"_frozenStack",new sf),A(this,"_frozenUndoStop",!0),A(this,"_barrierSends",[]),A(this,"_barrierResolves",[]),A(this,"_queuedBarriers",[]),A(this,"_editLog",[]),A(this,"_entityId",void 0),A(this,"_versionController",this.addDisposable(new vR)),A(this,"_beforeSaveEmitter",this.addDisposable(new jN)),A(this,"_onReadyEmitter",this.addDisposable(new ge)),A(this,"_onEntitySetEmitter",this.addDisposable(new ge)),A(this,"_onPendingSentEmitter",this.addDisposable(new ge)),A(this,"_onHistoryAnswerEmitter",this.addDisposable(new ge)),A(this,"_onHistoryActionEmitter",this.addDisposable(new ge)),A(this,"_onHistoryActionSentEmitter",this.addDisposable(new ge)),A(this,"_onHistoryActionAnsweredEmitter",this.addDisposable(new ge)),A(this,"_canvasEdits",0),A(this,"_nextActionId",1),A(this,"_historyAction",null),A(this,"_cache",new Sl),A(this,"beforeSave",this._beforeSaveEmitter.event),A(this,"_reverting",!1),A(this,"_inited",!1),A(this,"_nextChangeId",1),A(this,"_originId",`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`),A(this,"_rev",null),A(this,"_sealed",[]),A(this,"_saveHeld",!1),A(this,"_releasing",!1),A(this,"_applyingRemote",!1),A(this,"collectCanvasEdits",()=>Promise.resolve()),A(this,"_echoLost",!1),A(this,"_reportedText",null),A(this,"_reportId",0),A(this,"_lostChangeIds",new Set),A(this,"_recoveryTimer",void 0),A(this,"_recoveryOverdue",!1),A(this,"_coveredRev",null),A(this,"_awaitingRefill",!1),A(this,"_resyncing",!1),A(this,"_onEchoLostEmitter",this.addDisposable(new ge)),A(this,"_onEchoRecoveredEmitter",this.addDisposable(new ge)),A(this,"_echoWatchdog",this.addDisposable(new gR({isAwaiting:e=>this._versionController.isInFlight(e)||this._versionController.isRevertedAwaiting(e),onGiveUp:(e,t)=>this._onEchoLost(e,t)}))),A(this,"_handleUpdateEntity",e=>{const{edits:t,guid:n,changeId:r,rev:o}=e;if(e.resync&&n===this._entityId){const{reportId:i,textFingerprint:s}=e.resync,a=this._awaitingRefill?null:this._reportedText;return a!==null&&i===this._reportId?this._applyResync(e,s,a):void 0}if(this._versionController.wasEchoed(r)||this._isCovered(e)){e.historyAnswer?.actionId!==void 0&&n===this._entityId&&this._takeHistoryAnswer({actionId:e.historyAnswer.actionId});return}if(n===this._entityId){this._reportSyncDrift("update-entity");const i=this._onRemoteChange(t,r,o);return e.historyAnswer&&this._takeHistoryAnswer(e.historyAnswer),i}}),A(this,"_handleSetEntity",e=>{this._reportSyncDrift("set-entity"),HR(),DR(e.templateDirectivesPolicy??{});const t=e.guid===this._entityId,n=this._unsentLayers().some(r=>r.hasChanges());this._entityId=e.guid,this._onEntitySetEmitter.fire(e.guid),this._historyAction=null,this._editStack.clear(),this._sealed=[],this._releasing=!1,this._clearFrozen(),this._finishBarrier(t&&!this._holdsUnsent()&&!n),this._versionController.clear(),this._saveHeld=!1,this._awaitingRefill=!1,this._clearEchoLost(),this._onPendingSentEmitter.fire(),this._replaceText(e.html),this._rev=e.rev??null,this._coveredRev=this._rev,this._onReadyEmitter.fire()}),A(this,"_onRemoteChange",(e,t,n)=>t===void 0&&this._echoLost&&e.every(r=>!r.length)?this._whenNoneDispatched():new Promise((r,o)=>{const i=this._applyGroupsToCache(e),s=i.reduce((c,u)=>At(c,u),[]);this._rev=n??null;const a=this._versionController.revertedAwaitingIds();this._versionController.apply(s,t,n!==void 0&&!this._echoLost,i);const l=[...this._lostChangeIds].filter(c=>a.has(c)&&this._versionController.isRevertedAwaiting(c)&&this.hasChanges());!this._versionController.hasDispatched()&&!this._awaitingRefill&&!l.length&&(this._versionController.forgetReverted(this._lostChangeIds),this._clearEchoLost(),this._flushPendingSave()),this._whenNoneDispatched().then(r)})),A(this,"onReady",this._onReadyEmitter.event),A(this,"onEntitySet",this._onEntitySetEmitter.event),A(this,"onHistoryAnswer",this._onHistoryAnswerEmitter.event),A(this,"onHistoryAction",this._onHistoryActionEmitter.event),A(this,"onHistoryActionSent",this._onHistoryActionSentEmitter.event),A(this,"onHistoryActionAnswered",this._onHistoryActionAnsweredEmitter.event),this.addDisposable(z.addListenerAsync(de.SANDBOX_SET_ENTITY,this._handleSetEntity)),this.addDisposable(z.addListenerAsync(de.SANDBOX_UPDATE_ENTITY,this._handleUpdateEntity)),this.addDisposable(z.addListenerAsync(de.SANDBOX_CANVAS_SYNCED,e=>this.whenSynced(e?.applied))),this._versionController.onApply(this._onApply.bind(this)),this.addDisposable({dispose:()=>clearTimeout(this._recoveryTimer)})}loadState(e){this._entityId=e.entityId;const t=[[{range:ls(this._cache),text:e.text}]];this._onRemoteChange(t)}get entityId(){return this._entityId}saveState(){return{entityId:this._entityId,text:this.getText()}}_onApply(e){const t=this._unsentLayers();if(t.every(i=>!i.hasChanges())){super.applyEdits(or,ro(e));return}let n=e;const r=[];let o=-1;for(const[i,s]of t.entries()){const a=s.get();if(!a){r.push(null);continue}const l=cl(a,n,"after"),c=l&&cl(n,a,"before");if(!l||!c){o=i;break}r.push(l),n=c}if(o>=0){this._dropLayersFrom(o,t,n),t.slice(0,o).forEach((i,s)=>{const a=r[s];a&&i.replace(a)}),this._compactSealed();return}try{this._applyingRemote=!0,super.applyEdits(or,ro(n))}finally{this._applyingRemote=!1}t.forEach((i,s)=>{const a=r[s];a&&i.replace(a)}),this._compactSealed()}_dropLayersFrom(e,t,n){const r=t.slice(e).reduce((a,l)=>At(a,l.get()??[]),[]),o=[],i=[],s=Math.max(e-1,0);this._sealed.splice(Math.max(e-1-this._queuedBarriers.length,0));for(const a of this._queuedBarriers.splice(s))o.push(...a.sends),i.push(...a.resolves);e===0&&(this._frozenStack.clear(),o.unshift(...this._barrierSends.splice(0)),i.unshift(...this._barrierResolves.splice(0))),this._editStack.clear(),this._setSaveHeld(this._saveHeld&&this._sealed.length>0),super.applyEdits(or,ro(At(Pn(r),n))),this._runBarrier(o,i,!1)}_unsentLayers(){return[this._frozenStack,...this._queuedBarriers.map(e=>e.stack),...this._sealed.map(e=>e.stack),this._editStack]}_unsentChanges(){return this._unsentLayers().reduce((e,t)=>At(e,t.get()??[]),[])}_textWithoutUnsent(){return w2(this.getText(),Pn(this._unsentChanges()))}isApplyingRemote(){return this._applyingRemote}_flushPendingSave(){this._versionController.hasRevertedAwaiting()||(this._releaseBarrier(),this._sealed.length&&(this._sendSealed(),this._onPendingSentEmitter.fire()))}_setSaveHeld(e){const t=this._saveHeld&&!e;this._saveHeld=e,t&&this._onPendingSentEmitter.fire()}_isSent(e=!1){return!this._frozenStack.hasChanges()&&(!this._sealed.length||e&&this._saveHeld)}_seal(e){if(this._editStack.hasChanges()){const t=e?0:qR(this._editStack.get()),n=new sf;n.takeFrom(this._editStack),this._sealed.push({stack:n,undoStop:e,serviceRemoval:t})}this._compactSealed()}_compactSealed(){const e=this._sealed.length>0,t=[];for(const n of this._sealed){const r=t[t.length-1];if(n.stack.hasChanges()){if(!r||!zR(r,n)){t.push(n);continue}r.stack.absorb(n.stack),r.undoStop||(r.undoStop=n.undoStop),r.serviceRemoval+=n.serviceRemoval,r.stack.hasChanges()||t.pop()}}this._sealed=t,e&&!t.length&&(this._releasing=!1,this._saveHeld=!1,this._onPendingSentEmitter.fire())}_sendSealed(e=!1,t=!1){if(this._compactSealed(),this._rev!==null&&(this._awaitsEcho()||this._frozenStack.hasChanges()||this._holdsUnsent()))return!0;const n=e||this._sealed.some(o=>o.undoStop);if(!t&&!this._releasing&&this._beforeSaveEmitter.fire(n)===!1)return this._setSaveHeld(this._sealed.length>0),!1;const r=this._entityId;if(!r)return!1;for(;this._sealed.length;){const[o]=this._sealed.splice(0,1),i=o?.stack.get()?.flatMap(s=>Vb(s));if(o&&i?.length&&(this._dispatch(r,i,o.undoStop,o.stack.typedAt(),o.stack.selection(),o.stack.closesStep()),this._rev!==null))break}return this._compactSealed(),this._setSaveHeld(!1),!0}whenSent(e=!1){return this._isSent(e)?Promise.resolve():new Promise(t=>{const n=this._onPendingSentEmitter.event(()=>{this._isSent(e)&&(n.dispose(),t())})})}_countUnsent(){const e=this._unsentLayers().reduce((t,n)=>t+(n.get()?.length??0),0);return this._versionController.countDispatched()+e}_onEchoLost(e,t){if(this._lostChangeIds.add(e),this._echoLost)return;this._echoLost=!0,this._armRecoveryDeadline();const n=this._countUnsent(),r=this._textWithoutUnsent(),o=++this._reportId;this._reportedText=r,kr("echo-timeout",()=>({guid:this._entityId,at:"update-entity",unsent:n,textFingerprint:Ib(r),canvasText:r,reportId:o,dropsCovered:!0,originId:this._originId})),this._onEchoLostEmitter.fire()}holdsTypedEdits(){return this._frozenStack.hasChanges()}hasEditsAfterBoundary(){return this._editStack.hasChanges()||this._sealed.length>0}markHistoryAction(){const e=this._nextActionId++;return this._historyAction={id:e,edits:this._canvasEdits,answered:!1},this._onHistoryActionEmitter.fire(e),e}noteHistoryActionSent(e){this._onHistoryActionSentEmitter.fire(e)}noteSelection(e,t){const n=this._sealed.length>0&&this._editStack.selection()===null;this._editStack.noteSelection(e,t||n)}_takeHistoryAnswer({actionId:e,selection:t}){const n=this._historyAction,r=e!==void 0,o=r&&n?.id===e?n:void 0;o&&(o.answered=!0);const i=r?o?.edits===this._canvasEdits:!n||n.answered;t&&i&&!this.hasChanges()&&!this._awaitsEcho()&&!this._holdsUnsent()&&this._onHistoryAnswerEmitter.fire({selection:t,own:r}),o&&this._onHistoryActionAnsweredEmitter.fire(o.id)}_holdsUnsent(){return this._echoLost||this._awaitingRefill}async whenSynced(e){const t=new ge;let n=!1;const r=setTimeout(()=>{n=!0,t.fire()},WR),o=e!==void 0&&e.guid!==this._entityId;try{return e&&!o&&this._settleByReceipt(e),await this.collectCanvasEdits(),o?this._syncState():await this._syncedBefore(t,()=>n)}finally{clearTimeout(r),t.dispose(),this._releasing=!1}}async _syncedBefore(e,t){const n=()=>({synced:!1,unsent:this._countUnsent()});let r=0;if(t())return this._syncState();for(;;){if(this._echoLost){if(!await this._awaitEchoRecovery(e)||t())return n();continue}if(this._saveHeld&&r++<fv&&(this._releasing=!0,this._sendSealed(!0,!0)),await this._awaitAny([this._onEchoLostEmitter.event,e.event],this.whenSent(!this._releasing)),t())return n();if(!this._echoLost&&!(this._sealed.length>0&&!this._saveHeld)){if(this._saveHeld){if(r<fv)continue;return n()}if(!this._versionController.hasDispatched())return{synced:!0,unsent:0};if(await this._awaitAny([this._versionController.onEmpty,this._onEchoLostEmitter.event,e.event]),t())return n()}}}_syncState(){return this._hasUnsynced()?{synced:!1,unsent:this._countUnsent()}:{synced:!0,unsent:0}}_settleByReceipt(e){const t=e.originId===void 0||e.originId===this._originId?e.changeId:0;for(const n of this._versionController.awaitingIds())n<=t?this._echoWatchdog.giveUpNow(n):this._echoWatchdog.resendNow(n)}_hasUnsynced(){return this._holdsUnsent()||this._sealed.length>0||this._frozenStack.hasChanges()||this._versionController.hasDispatched()}_awaitAny(e,t){return new Promise(n=>{const r=()=>{o.forEach(i=>i.dispose()),n()},o=e.map(i=>i(r));t?.then(r)})}_awaitEchoRecovery(e){return new Promise(t=>{const n=setTimeout(()=>i(!1),Rd),r=this._onEchoRecoveredEmitter.event(()=>i(!0)),o=e.event(()=>i(!1)),i=s=>{clearTimeout(n),r.dispose(),o.dispose(),t(s)}})}_armRecoveryDeadline(){clearTimeout(this._recoveryTimer),this._recoveryTimer=setTimeout(()=>{this._recoveryOverdue=!0,this._finishBarrier(!1)},Rd)}_connectionLost(){return this._recoveryOverdue||this._awaitingRefill}_clearEchoLost(){const e=this._echoLost;clearTimeout(this._recoveryTimer),this._recoveryOverdue=!1,this._echoLost=!1,this._reportedText=null,this._lostChangeIds.clear(),e&&this._onEchoRecoveredEmitter.fire()}_isCovered({guid:e,rev:t,changeId:n}){return this._coveredRev===null||t===void 0||e!==this._entityId||t>this._coveredRev?!1:!(n!==void 0&&(this._versionController.isInFlight(n)||this._versionController.isRevertedAwaiting(n)))}_applyResync({edits:e,rev:t},n,r){this._versionController.clear();try{this._resyncing=!0,this._cache.applyEdits(or,[{range:ls(this._cache),text:r}]),this._rev=t??null,this._applyToCache(e),this._versionController.apply(this._changesToCache())}catch{}finally{this._resyncing=!1}const o=Ib(this._cache.getText());if(o.length!==n.length||o.hash!==n.hash){this._awaitingRefill=!0,this._finishBarrier(!1),kr("resync-failed",()=>({guid:this._entityId,textFingerprint:o}));return}this._coveredRev=this._rev,this._clearEchoLost(),this._flushPendingSave(),this._onReadyEmitter.fire()}_replaceText(e){this._cache.applyEdits(or,[{range:ls(this._cache),text:e}]),super.applyEdits(or,[{range:ls(this),text:e}])}_reportSyncDrift(e){if(this.hasChanges()||this._versionController.hasDispatched())return;const t=bR(this.getText(),this._cache.getText());if(t){const{offset:n,ownLength:r,cachedLength:o}=t;kr("host-copy-drift",()=>({at:e,text:{offset:n,ownLength:r,cachedLength:o}}))}}_changesToCache(){const e=this._textWithoutUnsent(),t=this._cache.getText(),n=Pb(e,t);if(!n)return[];const{start:r,fromEnd:o,toEnd:i}=n;return[new Vt(r,e.slice(r,o),r,t.slice(r,i))]}_applyToCache(e){return this._applyGroupsToCache(e).reduce((t,n)=>At(t,n),[])}_applyGroupsToCache(e){const t=[];for(const n of e){const r=n.reverse();t.push(Uo(r,this._cache)),this._cache.applyEdits(or,r)}return t}_whenNoneDispatched(){return new Promise(e=>{if(!this._versionController.hasDispatched()){this._onReadyEmitter.fire(),e();return}const t=this._versionController.onEmpty(()=>{t.dispose(),e()})})}applyEdits(e,t){if(!this._reverting){const n=Uo(t,this);n.length&&this._canvasEdits++,this._editStack.add(n),super.applyEdits(e,t),this._editLog.push(t)}}correctOffset(e,t){const n=this._unsentLayers();return t?n.reduce((r,o)=>o.correctOffset(r,!0),e):n.reduceRight((r,o)=>o.correctOffset(r),e)}correctRange(e,t){return{start:this.correctOffset(e.start,t),end:this.correctOffset(e.end,t)}}_awaitsEcho(){return this._versionController.hasDispatched()||this._versionController.hasRevertedAwaiting()}saveChanges(e=!0,t=!1){return this._reverting?!1:(this._seal(e),this._sendSealed(e,t))}closeStep(){this._editStack.closeStep()}_dispatch(e,t,n,r,o=null,i=!1){const s=this._nextChangeId++;this._versionController.append(t,s);const a={guid:e,pushUndoStop:n,edits:ro(t),changeId:s,originId:this._originId,...this._rev!==null?{baseRev:this._rev}:{},...r?{typedAt:r}:{},...o?{selection:o}:{},...i?{closesStep:i}:{}},l=()=>z.send(de.APPLICATION_UPDATE_ENTITY,a);l(),this._echoWatchdog.watch(s,()=>{this._versionController.isInFlight(s)&&l()})}async sendAfterCurrentEdits(e,t=!1){if(this._connectionLost()&&this.hasChanges())return!1;this._seal(t);const n=this._frozenStack.hasChanges();if(!n&&!this._sealed.length)return e(),!0;const r=this._rev!==null&&(this._awaitsEcho()||this._holdsUnsent());return!n&&!r&&(this._sendSealed(),!this._sealed.length||this._saveHeld)?(e(),!0):new Promise(o=>this._freezeSealed(e,o))}_freezeSealed(e,t){this._compactSealed();for(const{stack:r,undoStop:o}of this._sealed.splice(0))this._frozenStack.hasChanges()||this._queuedBarriers.length?this._queuedBarriers.push({stack:r,undoStop:o,sends:[],resolves:[]}):(this._frozenStack.takeFrom(r),this._frozenUndoStop=o);this._setSaveHeld(!1);const n=this._queuedBarriers[this._queuedBarriers.length-1];(n?.sends??this._barrierSends).push(e),(n?.resolves??this._barrierResolves).push(t)}_releaseBarrier(){const e=this._frozenStack.get();if(!e)return;const t=this._frozenStack.typedAt(),n=this._frozenStack.selection(),r=this._frozenStack.closesStep();this._frozenStack.clear(),this._entityId&&this._dispatch(this._entityId,e.flatMap(a=>Vb(a)),this._frozenUndoStop,t,n,r);const o=this._barrierSends,i=this._barrierResolves,s=this._queuedBarriers.shift();this._barrierSends=s?.sends??[],this._barrierResolves=s?.resolves??[],s&&(this._frozenStack.takeFrom(s.stack),this._frozenUndoStop=s.undoStop),this._runBarrier(o,i,!0)}_clearFrozen(){this._frozenStack.clear();for(const e of this._queuedBarriers.splice(0))this._barrierSends.push(...e.sends),this._barrierResolves.push(...e.resolves)}_finishBarrier(e){const t=this._barrierSends,n=this._barrierResolves;this._barrierSends=[],this._barrierResolves=[];for(const r of this._queuedBarriers)t.push(...r.sends.splice(0)),n.push(...r.resolves.splice(0));this._runBarrier(t,n,e)}_runBarrier(e,t,n){n&&e.forEach(r=>r()),t.forEach(r=>r(n)),this._onPendingSentEmitter.fire()}saveChangesAsync(e=!0){return new Promise(t=>{if(this.saveChanges(e),this._entityId||!this.hasChanges()||this._saveHeld){t();return}const n=setTimeout(()=>{r.dispose(),this._reportSaveTimeout(),t()},$R),r=this.onReady(()=>{r.dispose(),clearTimeout(n),t()})})}_reportSaveTimeout(){kr("save-timeout",()=>({}))}hasChanges(){return this._editStack.hasChanges()||this._frozenStack.hasChanges()||this._sealed.length>0}},jR=class extends dv{constructor(e,t){super(),A(this,"_baseDocument",void 0),A(this,"_mappedDocument",void 0),A(this,"_mappings",[]),A(this,"_cachedMappedDocument",new Sl),this._baseDocument=e,this._mappedDocument=t,this._baseDocument.onChanged(this._onBaseChange.bind(this),Number.MAX_SAFE_INTEGER),this._mappedDocument.onChanged(this._onMappedChange.bind(this),Number.MAX_SAFE_INTEGER)}_onBaseChange({source:e,changes:t}){if(e==="FROM_REMOTE"){const n=this._baseDocument.getText(),r=Uo(this.getMappings(n),this._baseDocument),o=Pn(this._mappings);if(t=At(o,t),t=At(t,r),this._mappings=r,t.length){const i=ro(t);this._mappedDocument.applyEdits(e,ul(i))}}}correctOffset(e,t){const n=t?this._mappings:Pn(this._mappings),r=fd(n,({oldPosition:i})=>i>=e),o=r>0?n[r-1]:void 0;return o&&(o.oldEnd>e?e+=o.newPosition-o.oldPosition:e+=o.newEnd-o.oldEnd),e}correctRange(e,t){return{start:this.correctOffset(e.start,t),end:this.correctOffset(e.end,t)}}getMappedReplacementRangeAtPosition(e){const t=Pn(this._mappings).find(({oldPosition:n,oldEnd:r})=>e>=n&&e<r);return t?{start:t.oldPosition,end:t.oldEnd}:null}hasMappedReplacementRangeInRange(e){return Pn(this._mappings).some(({oldPosition:t,oldEnd:n})=>t<e.end&&n>e.start)}isMappedElementInPosition(e){return!!this._mappings.find(t=>t.newPosition<e&&t.newEnd>e)}escape(e,t){const n=this.getMappings(e,!1,t);return cs(e,n)}unescape(e){const t=this.getRevertMappings(e);return cs(e,t)}registerMatcherPair(e){const t=super.registerMatcherPair(e);this.rebuildFromBase();let n=!1;return{dispose:()=>{n||(n=!0,t.dispose(),this.rebuildFromBase())}}}rebuildFromBase(e=or){const t=this._baseDocument.getText(),n=this.getMappings(t),r=cs(t,n);this._mappings=Uo(n,this._baseDocument),this._mappedDocument.getText()!==r&&this._mappedDocument.applyEdits(e,[{range:{start:0,end:this._mappedDocument.getLength()},text:r}])}_onMappedChange({source:e,changes:t}){if(e!=="FROM_REMOTE"){const n=this._mappedDocument.getText(),r=Uo(this.getRevertMappings(n),this._mappedDocument),o=this._mappings;if(t=At(o,t),t=At(t,r),this._mappings=Pn(r),t.length){const i=ro(t);this._baseDocument.applyEdits(e,ul(i))}}}},VR="input, textarea, select, .monaco-editor",GR=/^(Arrow(Left|Right|Up|Down)|Home|End|PageUp|PageDown|Tab)$/;function mv(e,t){return e?.node===t?.node&&e?.offset===t?.offset}function XR(e,t){return mv(e?.anchor,t?.anchor)&&mv(e?.focus,t?.focus)}function Tl(){const e=document.getSelection();if(!(!e?.rangeCount||!e.anchorNode||!e.focusNode))return{anchor:{node:e.anchorNode,offset:e.anchorOffset},focus:{node:e.focusNode,offset:e.focusOffset}}}var KR=class extends Ee{constructor(e,t,n){super(),A(this,"_htmlDocument",void 0),A(this,"_mapping",void 0),A(this,"_remoteDocument",void 0),A(this,"_mark",void 0),A(this,"_pending",void 0),A(this,"_actionMark",void 0),A(this,"_moved",!1),this._htmlDocument=e,this._mapping=t,this._remoteDocument=n,this._listen(window,"keydown",!0),this._listen(window,"beforeinput",!0),this._listen(document,"selectionchange",!1,()=>{this._moved||(this._moved=!XR(this._mark,this._actionMark))}),this._listen(window,"pointerdown",!0,()=>{this._moved=!0}),this._listen(window,"keydown",!1,r=>{this._moved||(this._moved=!r.defaultPrevented&&GR.test(r.key??""))}),this.addDisposable(e.beforeTextCommit(()=>this._beforeCommit())),this.addDisposable(e.onTextCommit(()=>this._afterCommit())),this.addDisposable(n.onHistoryAnswer(r=>this._restore(r))),this.addDisposable(n.onHistoryAction(()=>{this._actionMark=Tl(),this._moved=!1}))}_listen(e,t,n,r){const o=i=>{this._mark=Tl(),r?.(i)};e.addEventListener(t,o,n),this.addDispose(()=>e.removeEventListener(t,o,n))}_beforeCommit(){this._pending={before:this._toText(this._mark),opened:!this._remoteDocument.hasEditsAfterBoundary()}}_afterCommit(){const e=this._pending;if(this._pending=void 0,this._mark=Tl(),e){const t={before:e.before,after:this._toText(this._mark)};this._remoteDocument.noteSelection(t,e.opened)}}_toText(e){const t=e&&this._htmlDocument.pointToOffset(e.anchor),n=e&&this._htmlDocument.pointToOffset(e.focus);if(t===void 0||n===void 0)return;const[r,o]=[this._mapping.correctOffset(t),this._mapping.correctOffset(n)].sort((i,s)=>i-s);return{start:r,end:o}}_toPoint(e){return this._htmlDocument.offsetToPoint(this._mapping.correctOffset(this._remoteDocument.correctOffset(e,!0),!0))}_restore({selection:e,own:t}){if(t&&this._moved||!t&&!document.hasFocus()||document.activeElement?.closest(VR))return;const n=this._toPoint(e.start),r=e.end===e.start?n:this._toPoint(e.end);!n||!r||(document.getSelection()?.setBaseAndExtent(n.node,n.offset,r.node,r.offset),this._mark=Tl())}};function YR(e){let t=e.documentElement;return t||(t=e.createElement("html"),e.appendChild(t)),t}function ys(e){let t=e.head;if(!t){t=e.createElement("head");const n=YR(e);n.insertBefore(t,n.firstChild)}return t}function ZR(e){const t=Object.create(null),n=e.getAttributeNames();for(const r of n)t[r]=e.getAttribute(r);return t}function QR(e){for(const t of document.querySelectorAll("iframe"))if(t.contentDocument===e.ownerDocument)return t}function JR(e){const t=ys(e);if(!e.querySelector("style[amp4email-boilerplate]")){const n=e.createElement("style");n.setAttribute("amp4email-boilerplate",""),n.innerHTML="body{visibility:hidden}",t.prepend(n)}}var hv="amp-custom";function eM(e,t){return`em-${e.replaceAll("-","_")}-${t.toLowerCase()}`}function pv(e,t,n){for(const r of t)if(ms.isStyleRule(r)){const o=r.selectorText.split(/\+>~/).flatMap(i=>i.trim().split(" "));if(o.length===1&&o[0].trim().startsWith(".em-")){for(const i of r.style)if(r.style.getPropertyPriority(i)==="important"){for(const s of e.querySelectorAll(r.selectorText))if(Gd(s)){const a=s.style;for(const l of[...a])if(l.startsWith(i)){const c=n(l,a.getPropertyValue(l)),u=s.getAttribute("class");s.setAttribute("class",u?`${c} ${u}`:c),a.removeProperty(l)}}}}}else ms.isMediaRule(r)&&pv(e,r.cssRules,n)}function gv(e,t){const n=t.sheet;if(n){const i=new Set;pv(e,n.cssRules,(s,a)=>{const l=eM(s,a),c=[...n.cssRules],u=`.${l} { ${s}: ${a} }`;return!c.find(d=>ms.isStyleRule(d)&&d.selectorText===`.${l}`)&&!i.has(u)&&(i.add(u),t.innerHTML=`
|
|
4
4
|
.${l} { ${s}: ${a} };
|
|
@@ -27,9 +27,9 @@ ${o.join("")}
|
|
|
27
27
|
`){a=k(a),a+=`
|
|
28
28
|
`;continue}if(!L(l)){a=k(a),a+=`
|
|
29
29
|
`,y(),a+=l,d=f.Property;continue}a+=l;continue}if(d===f.Property){if(l===":"){a=k(a),a+=": ",d=f.Expression,L(c)&&(d=f.Separator);continue}if(l==="}"){b(),d=f.Start,h>0&&(d=f.Block);continue}a+=l;continue}if(d===f.Separator){if(!L(l)){a+=l,d=f.Expression;continue}E(c)&&(d=f.Expression);continue}if(d===f.Expression){if(l==="}"){b(),d=f.Start,h>0&&(d=f.Block);continue}if(l===";"){a=k(a),a+=`;
|
|
30
|
-
`,d=f.Ruleset;continue}if(a+=l,l==="("&&a.charAt(a.length-2)==="l"&&a.charAt(a.length-3)==="r"&&a.charAt(a.length-4)==="u"){d=f.URL;continue}continue}if(d===f.URL&&l===")"&&a.charAt(a.length-1!=="\\")){a+=l,d=f.Expression;continue}a+=l}return a=s.join("")+a,a}window.cssbeautify=e})();function xM(e,t,n){n.state.update({iframeOffsetTop:e.iframeOffsetTop,scrollTop:e.scrollTop,previewHeight:e.previewHeight,applicationMode:e.mode}),typeof t<"u"&&n.state.set("codeMode",e.mode==="code");const r=document.querySelector(".em-element-path");r&&(r.style.top=n.previewHeight-n.iframeOffsetTop-65+n.scrollTop+"px");const o=document.querySelector(".em-editor-wrapper");o&&o.style.display==="none"?n.setBlockGroupControlsPosition():setTimeout(()=>{n.setBlockGroupControlsPosition()},400)}var OM=["transform","transform-origin","overflow-x","height"];function RM(e,t){return!(e>0)||!(t>0)||e<=t?1:t/e}function Es(e,t){const n=t<1?`scale(${t})`:"";if(e.style.transform===n)return!1;for(const r of OM)e.style.removeProperty(r);return n?(e.style.overflowX="visible",e.style.transformOrigin="left top",e.style.transform=n):e.getAttribute("style")||e.removeAttribute("style"),!0}function MM(e,t){const n=e,r=n?.querySelector("table:first-child"),o=Math.max(n?.offsetWidth??0,r?.offsetWidth??0);return o>0?o:(Es(t,1),t.scrollWidth)}function PM(e,t=window){const n=t.document.documentElement,r=n.style.transform,o=RM(MM(e,n),t.innerWidth);return Es(n,o),n.style.transform!==r&&t.parentIFrame?.size?.(),o}function IM(e,t){Es(document.documentElement,1);const n=t.globalHolder?.querySelector("table:first-child");if(n&&n.offsetWidth>=e.iframeWidth-2&&t.globalHolder){const r=e.iframeWidth/t.globalHolder.offsetWidth;Es(document.documentElement,r),document.querySelector(".em-narrow-table")&&e.iframeWidth>370&&t.messageService.send({operation:"application_preview_alert_show",settings:{show:r<.9}})}setTimeout(()=>{t.messageService.send({operation:"application_iframe_set_height",settings:{height:document.body.getBoundingClientRect().height}})},300)}function dt(e){const t=R(e,Te);return n=>{t.commit(n)}}function at(){return R(Mt,Y)}function DM(){return R(Mt,ot)}function BM(){return R(Mt,pn)}function ft(){return Mt.getInstance(Y)!==void 0}function ao(e){R(Mt,Te).commit(e)}function HM(e){if(!ft())return e(),Promise.resolve(!0);const t=at();return t.commit(!1),t.flushCommit(),t.sendAfterCurrentEdits(e)}function FM(){if(!ft())return!1;const e=at();return e.commit(!1),e.flushCommit(),e.hasEditsAfterBoundary()}function $M(){return ft()?at().markHistoryAction():void 0}function WM(e){ft()&&at().noteHistoryActionSent(e)}function bf(e){return ft()&&at().holdInput(e)}function kv(e){return ft()&&at().holdInputBehindQueued(e)}function Lv(){ft()&&at().closeUndoStep()}function yf(){return ft()&&at().isHoldingInput()}function Nv(){return ft()&&at().hasHeldInput()}function xv(){ft()&&at().releaseHeldInput()}function Ov(){return ft()&&at().holdsTypedEdits()}function Ss(e){return ft()?at().renderOnly(e):e()}function Nl(e){return e.nodeType===1&&e.localName==="template"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function vf(e){return[...e.querySelectorAll?.("template")??[]].filter(Nl)}function qM(e){return Nl(e)||vf(e).length>0}function rn(e){const t=[...Nl(e)?[e]:[],...vf(e)];for(const n of t)if(n.content.firstChild){for(;n.content.firstChild;)n.appendChild(n.content.firstChild);for(const r of n.children)rn(r)}}function Zo(e){const t=[...Nl(e)?[e]:[],...vf(e)];for(const n of t)for(;n.firstChild;)n.content.appendChild(n.firstChild)}function Gt(){return ft()?at():void 0}function It(e){const t=Gt();return t?t.applyHidden(e):e()}function Be(e,t,...n){e&&It(()=>t?e.classList.add(...n):e.classList.remove(...n))}function lo(e){const t=document.activeElement;t instanceof HTMLElement&&t!==document.body&&e.contains(t)&&It(()=>t.blur())}function Ef(e){Gt()?.ownership.markService(e)}function Rv(e){Gt()?.ownership.markWrapper(e)}function Mv(e){Gt()?.ownership.markOuterWrapper(e)}function ws(e,t){e.removeAllRanges(),It(()=>e.addRange(t))}function xl(e){const t=document.implementation.createHTMLDocument("").importNode(e,!0);nn(e,t);const n=new Map([[e,t]]),r=Gt()?.ownership,o=(i,s)=>{const a=[...s.childNodes];i.childNodes.forEach((l,c)=>{const u=a[c];n.set(l,u),o(l,u),r?.isOffModel(l)&&u.replaceWith(...u.childNodes)})};return o(e,t),Zo(t),{copy:t,counterpart:i=>n.get(i)}}function Ol(e){return Zg(xl(e).copy)}function Ue(e){return zL(xl(e).copy)}function _s(e){const t=Gt();return t?(t.flushCommit(),t.getOuterHtml(e)):e.outerHTML}function Sf(e){return Pv(e)}function Pv(e){const t=Gt();return!t||t.isInLetter(e)||!t.isUntracked(e)&&!t.ownership.isService(e)}function wf(e){const t=Gt();return t?t.ownership.markOf(e)?"foreign":t.isInLetter(e)?"letter":t.isBehindHidden(e)?"foreign":"new":"letter"}function _f(e,t){const n=[...e.querySelectorAll(t)].filter(Sf);return n[n.length-1]??null}function Iv(e,t){const n=o=>t==="next"?o.nextElementSibling:o.previousElementSibling;let r=n(e);for(;r&&!Sf(r);)r=n(r);return r}function Dv(e,t){return[...e.childNodes].flatMap(n=>t.isInLetter(n)?[n]:Dv(n,t))}function Cf(e){lo(e);const t=Gt();if(!t)return;t.flushCommit();const n=[...e.querySelectorAll("*")].filter(r=>t.ownership.markOf(r)==="service");for(const r of n)e.contains(r)&&r.replaceWith(...Dv(r,t))}function zM(e){const t=[...e.childNodes],n=Gt();if(!n)return t;let r;for(const o of n.letterChildren(e))o.isConnected||t.splice(r?t.indexOf(r)+1:0,0,o),r=o;return t}function UM(){const e=Gt();return e?{...e.scriptRunner,awake:()=>e.recordNow()}:{run:(t,n)=>n(),quiet:t=>t()}}function sr(e,t){const n=Le(e,"dormant"),r=ab(n);try{return t(n)}finally{hb(r,UM())}}function Bv(e,t,n){sr(n,r=>el(e,t,r))}function Cs(e,t,n){return e==="new"?sr(t,n):n(Le(t,!0))}function ar(e,t,n,r){Cs(e,r,o=>el(t,n,o))}function pt(e){return function(...t){const n=Gt(),r=()=>Reflect.apply(e,this,t);return n?n.applyOwn(r):r()}}function lr(e,t=!1,n){const r=()=>document.execCommand(e,t,n),o=Gt();return o?o.applyCommand(r):r()}function Hv(e){const t=()=>{Be(document.body,e,"mceNonEditable"),document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable",e?"false":"true")})};ft()?at().applyHidden(t):t()}function jM(){let e=!1,t=!0,n=!0;const r=new Set,o=i=>{t!==i&&(t=i,[...r].forEach(s=>{try{s()}catch{}}))};return{setApp(i){e=i},setIntegrator:o,isAppLocked:()=>e,isIntegratorLocked:()=>t,isTextLocked:()=>e||t,closeEditorInit(){n=!0},openEditorInit(){n=!1},isEditorInitClosed:()=>n,onIntegratorChange(i){const s=()=>i();return r.add(s),()=>r.delete(s)},reset(){e=!1,o(!0),n=!0}}}var Tf=jM();function VM(e){return{dispose:e.onIntegratorChange(()=>Hv(e.isTextLocked()))}}function GM(e,t){return e.beforeChange(({domMutations:n})=>{const r=n.flatMap(o=>o.type==="Add"&&o.node instanceof Element?[o.node]:[]);r.length&&queueMicrotask(()=>{if(!t.isTextLocked())return;const o=r.flatMap(i=>[...i.tagName==="EDITOR"?[i]:[],...Array.from(i.querySelectorAll("editor"))]);e.applyHidden(()=>{for(const i of o)i.isConnected&&i.setAttribute("contenteditable","false")})})})}function Af(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const i=e,s=t;return i.length===s.length&&i.every((a,l)=>Af(a,s[l]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&Af(e[i],t[i]))}function Fv(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&Af(o,a)||(o=a,i=!0,r(a))})},select(r){return Fv(n,r)}};return n}function $v(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(i){t=i,n=!0;for(const s of Array.from(r))s(i)},watch(i){return r.add(i),n&&i(t),{dispose:()=>r.delete(i)}},select(i){return Fv(o,i)}};return o}var Rl={applicationTheme:"light",applicationMode:"default",previewHeight:0,emailWidth:0,previewPage:!1,globalHolder:null,elementPath:[],iframeOffsetTop:0,scrollTop:0,copyPasteEnabled:!0,saveBlockEnabled:!0,editImageControlEnabled:!0,elementAIimageEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterEditorEnabled:!0,blocksAddPanelEnabled:!0,codeMode:!0,appName:"",isLeftButtonDown:!1,isProgrammaticSelection:!1,activeCell:[],commonStyles:{},loadStylesTimer:!1,_pushUndoStop:!1},Ts=$v({...Rl});function Dn(){return Ts.get()}var Ml=new ge,Qo=new Map,j={source:Ts,get(e){return Dn()[e]},getState(){return{...Dn()}},getStateRef(){return Dn()},set(e,t){if(Dn()[e]===t)return;Ts.set({...Dn(),[e]:t}),Ml.fire({[e]:t});const n=Qo.get(e);n&&n.forEach(r=>r(t))},update(e){let t=!1;const n={};for(const r of Object.keys(e)){const o=e[r];if(Dn()[r]!==o){Ts.set({...Dn(),[r]:o}),n[r]=o,t=!0;const i=Qo.get(r);i&&i.forEach(s=>s(o))}}t&&Ml.fire(n)},increment(e,t=1){const n=Dn()[e];typeof n=="number"&&j.set(e,n+t)},decrement(e,t=1){const n=Dn()[e];typeof n=="number"&&j.set(e,n-t)},subscribe(e){return Ml.event(e)},subscribeToKey(e,t){Qo.has(e)||Qo.set(e,new Set);const n=Qo.get(e),r=t;return n.add(r),()=>{n.delete(r),n.size===0&&Qo.delete(e)}},reset(){Ts.set({...Rl}),Ml.fire(Dn())},resetKey(e){this.set(e,Rl[e])},getInitialState(){return Rl}};function XM(e,t){const n=$v(),r=e.addListener(t,o=>n.set(o));return{source:n,dispose:()=>r.dispose()}}var KM=["copyPasteEnabled","saveBlockEnabled","editImageControlEnabled","elementAIimageEnabled","imageCenterStockEnabled","imageCenterGifEnabled","imageCenterEditorEnabled","blocksAddPanelEnabled"];function YM(e){const t="5455e870";let n=document.getElementsByTagName("head")[0];!n&&document.documentElement&&(n=document.createElement("head"),document.documentElement.insertBefore(n,document.documentElement.firstChild));const r=`css/sandbox-${e}.css?${t}`,o=e==="light"?"dark":"light",i=document.querySelectorAll(`[href="css/sandbox-${o}.css?${t}"]`);if(!document.querySelector(`[href="${r}"]`)){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",r),n?.appendChild(s)}for(const s of i)s.remove()}var ZM={name:"sandbox.hostFacts",provides:[Wo],setup(e){const t=Object.fromEntries(Object.entries(n2).map(([n,r])=>[n,XM(z,r).source]));e.inject(Wo,t)}},QM={name:"sandbox.hostFactsToState",awaits:{services:[Wo,Te,Y,Ye]},setup(e){const t=R(e,Wo),n=dt(e),r=R(e,Ye);t.theme.watch(o=>{j.set("applicationTheme",o),YM(o),n(!1)}),t.commonStyles.watch(o=>{o&&j.set("commonStyles",o)}),t.flags.watch(o=>{for(const i of KM)typeof o[i]<"u"&&j.set(i,o[i])}),VM(r),GM(R(e,Y),r),t.lockEditor.watch(o=>r.setIntegrator(o)),t.codeMode.watch(o=>j.set("codeMode",o)),t.appName.watch(o=>j.set("appName",o)),t.previewPage.watch(o=>{j.set("previewPage",o),Be(document.body,!!o,"em-sandbox-preview")})}},JM={name:"sandbox.viewport",awaits:{services:[Wo]},setup(e){R(e,Wo).viewport.watch(t=>xM(t,void 0,{state:j,previewHeight:t.previewHeight,iframeOffsetTop:t.iframeOffsetTop,scrollTop:t.scrollTop,globalHolder:j.get("globalHolder"),setBlockGroupControlsPosition:()=>e.getServices(Nb).forEach(n=>n()),messageService:z}))}};function Lr(e){for(const t of document.querySelectorAll(`[${e}]`))t.removeAttribute(e)}function Lt(e,t,n=!1){for(const r of e.querySelectorAll(t))n||!r.childNodes.length?r.remove():r.replaceWith(...r.childNodes)}function eP(e,t){if(e.data.value)document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable","false")}),Be(document.body,!0,"em-sandbox-discuss");else{const n=t.editLock.isTextLocked()?"false":"true";document.querySelectorAll("editor").forEach(r=>{r.setAttribute("contenteditable",n)}),Be(document.body,!1,"em-sandbox-discuss","em-sandbox-discuss_set-target")}}function tP(e,t){Be(document.body,!!e.data.value,"em-sandbox-discuss_set-target")}function nP(e,t){const n=e.data.value,r=document.querySelector(`[em-discuss-id="${n}"]`);r&&t.messageService.send({operation:"application_scroll-to",settings:{value:r.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),Be(document.body,!1,"em-sandbox-discuss_set-target"),document.querySelectorAll(".em-discuss-id-new").forEach(o=>{o.removeAttribute("em-discuss-id")}),t.removeAllAttributes("em-edit"),r&&document.querySelectorAll(`[em-discuss-id="${n}"]`).forEach(o=>{o.removeAttribute("em-discuss-id")}),t.commit()}function rP(e,t){Be(document.body,!1,"em-sandbox-discuss_set-target"),document.querySelectorAll(".em-discuss-id-new").forEach(n=>{n.classList.remove("em-discuss-id-new")}),t.removeAllAttributes("em-edit"),t.commit(),setTimeout(()=>{t.messageService.send({operation:"application_discuss_save_target"})},500)}function oP(e,t){const n=e.data.value,r=document.querySelector(`[em-discuss-id="${n}"]`);r?(t.messageService.send({operation:"application_scroll-to",settings:{value:r.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),r.classList.add("em-discuss-target-active"),setTimeout(()=>{r.classList.remove("em-discuss-target-active")},2e3)):t.messageService.send({operation:"application_discuss_no_comment"})}var iP={sandbox_lock_discuss:eP,sandbox_discuss_set_target:tP,sandbox_discuss_remove_target:nP,sandbox_discuss_reset:rP,sandbox_discuss_get_target:oP};function sP(e,t){t.editLock.setApp(!!e.data.data),Hv(t.editLock.isTextLocked())}function aP(e,t){t.setEditorFocus(e.data.data)}function lP(e,t){let n=e.data.data;if(typeof n!="number")return;n=DM().correctOffset(n,!0),n=BM().correctOffset(n,!0);let r=at().getElementByPosition(n);if(r&&!(r instanceof Element)&&(r=r.parentElement),!(r instanceof HTMLElement))return;const o=r.getBoundingClientRect();r.tagName!=="BODY"&&o.height&&o.width&&document.querySelector("[em-edit]")!==r&&t.applicationElementSettingsSet({elem:r});const i=r.getBoundingClientRect(),s=i.top-j.get("previewHeight")/2+i.height/2;t.messageService.send({operation:"application_scroll-to",settings:{value:j.get("applicationMode")==="default"?s+j.get("iframeOffsetTop"):s}})}var cP={sandbox_lock_edit:sP,editor_change_focus:aP,update_position_from_editor:lP};function uP(e,t){document.querySelectorAll("[em-optimise-error]").forEach(n=>{n.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((n,r)=>{n.setAttribute("em-optimise",`image_${r}`)}),t.commit()}function dP(e,t){document.querySelectorAll("[em-optimise-error]").forEach(n=>{n.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((n,r)=>{n.setAttribute("em-optimise",`link_${r}`)}),t.commit()}function fP(e,t){const n=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);n&&(e.data.settings.isError&&(n.setAttribute("em-optimise-error","true"),t.commit()),t.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),t.setCursorPosition(n),t.applicationElementSettingsSet({elem:n}))}function mP(e,t){const n=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);n&&(t.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),t.setCursorPosition(n),t.applicationElementSettingsSet({elem:n}),e.data.settings.isError&&n.setAttribute("em-optimise-error","true"),t.commit())}var hP={sandbox_set_attr_to_images:uP,sandbox_set_attr_to_links:dP,sandbox_set_position_to_img:fP,sandbox_set_position_to_link:mP},pP={brightness:100,contrast:100,sepia:0},Pl={DARK:"dark",LIGHT:"light"},Wv=!1;function gP(e){Wv||(e.setFetchMethod(t=>window.fetch(t)),Wv=!0)}function bP(){let e=null,t=Pl.LIGHT;return{set(n){if(t=n,n===Pl.DARK){e??(e=df(()=>Promise.resolve().then(()=>id("./darkreader.CyLMh7_H.js")),void 0,{}.url)),e.then(r=>{t===Pl.DARK&&(gP(r),r.enable(pP))}).catch(r=>{e=null});return}e?.then(r=>{t===Pl.LIGHT&&r.disable()})},clear(n){return n.replaceAll(/\s*?--darkreader.+?: .*?;/g,"")}}}var Il=bP();function yP(e,t){t.initPreview(!0)}function vP(e){const t=e.data?.data?.theme;(t==="light"||t==="dark")&&Il.set(t)}var EP={init_preview:yP,sandbox_switch_theme:vP};function vn(e,t,n,r){return{name:`sandbox.operations.${e}`,awaits:n,setup(o){const i=r(o),s={};for(const[a,l]of Object.entries(t))l&&(s[a]=c=>l(c,i()));o.addService(xb,{owner:e,handlers:s})}}}var SP={name:"sandbox.operationEnvironment",provides:[Tr],setup(e){const t={iframeOffsetTop:0,previewHeight:0,elementPath:[]};j.subscribe(n=>{for(const r of["iframeOffsetTop","previewHeight","elementPath"])r in n&&n[r]!==void 0&&Object.assign(t,{[r]:n[r]})}),e.inject(Tr,t)}},wP=vn("discuss",iP,{services:[Te,Tr,Ye]},e=>{const t=dt(e),n=R(e,Tr),r=R(e,Ye);return()=>({commit:t,editLock:r,iframeOffsetTop:n.iframeOffsetTop,previewHeight:n.previewHeight,messageService:z,removeAllAttributes:Lr})}),_P=vn("editor",cP,{services:[Ie,it,Ye]},e=>{const t=R(e,Ie),n=R(e,it),r=R(e,Ye);return()=>({applicationElementSettingsSet:t,editLock:r,messageService:z,setEditorFocus:o=>n.setEditorFocus(o)})}),CP=vn("images",hP,{services:[Ie,yt,Te,Tr]},e=>{const t=R(e,Ie),n=R(e,yt),r=dt(e),o=R(e,Tr);return()=>({applicationElementSettingsSet:t,commit:r,iframeOffsetTop:o.iframeOffsetTop,previewHeight:o.previewHeight,messageService:z,setCursorPosition:i=>n(i)})}),TP=vn("preview",EP,{services:[ss]},e=>()=>({initPreview:t=>R(e,ss)(t)})),AP={name:"sandbox.operationsDispatcher",setup(e){z.addListener(t=>{const n=t.data?.operation;if(!n)return;const r=e.getServices(xb).map(i=>i.handlers[n]).filter(Boolean).pop();if(!r)return;const o=i=>{};try{Promise.resolve(r(t)).catch(o)}catch(i){o(i)}})}},kP=[SP,wP,_P,CP,TP,AP],LP=["em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document","em-block-insert_bottom","em-block-insert_top","em-blockatom-insert","em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top","em-block-insert-empty","em-atom-insert-empty","em-block-insert-body","em-atom-insert-body","em-resize-start","sortable-chosen","sortable-ghost","em-vindent-table","em-vindent_low","em-vindent","em-relative","em-display-block","em-sandbox-discuss_set-target","em-sandbox-discuss","em-element-list-bullet","remove-new-editor-element","em-just-inserted","em-native-img-uploading","em-native-img-drop-target","em-native-img-drop-loading","em-native-file-drag"],NP=["style","class","align","href"],xP=new Set([...LP,"em-element-path_img"]);function OP(e){return e.split(/\s+/).filter(t=>t&&!xP.has(t)).join(" ")}var RP=32;function MP(e){return!!(e.tagName==="BODY"||e.getAttribute("em")==="atom"||e.tagName==="TABLE"&&e.hasAttribute("em"))}function PP(e){const t=[e.tagName];for(const n of NP){const r=e.getAttribute(n),o=n==="class"&&r!==null?OP(r):r;o!==null&&o!==""&&t.push(`${n}=${o}`)}return t.join("|")}function IP(e){if(!e||!e.isConnected)return"";const t=[];let n=e,r=0;for(;n&&r<RP&&(t.push(PP(n)),!MP(n));)n=n.parentElement,r++;return t.join("||")}function DP(e){let t={text:"",ancestors:""};const n=r=>({text:r?e(r):"",ancestors:IP(r)});return{remember(r){t=n(r)},forget(){t={...t,text:""}},take:n,differs(r){return t.text!==r.text||t.ancestors!==r.ancestors},accept(r){t=r}}}function BP(e,t){t.onReleased(()=>{Promise.resolve().then(()=>{t.isLocked()||e.remember(document.querySelector("[em-edit]"))})})}var qv=Promise.resolve(),zv=null;function HP(e,t){const{HTMLDocument:n,documentMapping:r,remoteDocument:o,messageService:i}=t;let s=n.getRangeByElement(e,!0);if(s){const a=r.getMappedReplacementRangeAtPosition(s.start)||r.getMappedReplacementRangeAtPosition(Math.max(s.end-1,s.start));a&&(s=a),s=r.correctRange(s),s=o.correctRange(s);const l={operation:"update_position_from_iframe",data:s};i.send(l)}}function FP(e,t){zv=e,qv=qv.finally(()=>{zv===e&&HP(e,t)})}function $P(e,t="unknown"){const n=Mt.getInstance(it);if(!n){e();return}n.controller.whenEditorLostFocus(e,t)}function WP(e){const t=e.innerHTML.trim();return[t===" ",t==="<div> </div>",/^<div[^>]*> <\/div>$/.test(t),/^<[^>]*> <\/[^>]*>$/.test(t),t.replace(/<[^>]*>/g,"").trim()===" ",e.textContent?.trim()===" "||e.textContent?.trim().charCodeAt(0)===160].some(n=>n===!0)}function qP(e){window.getSelection();const t=e.startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t instanceof Element?t:null;if(!n||!n.contains(e.commonAncestorContainer))return!1;const r=n.textContent??"",o=e.toString(),i=r.replace(/\s+/g," ").trim(),s=o.replace(/\s+/g," ").trim();return r===o||i===s}var _ne="br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object",As="data-em-caret",Cne="",cr=e=>e();function Dt(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("data-em-caret")}function co(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.tagName==="EM-REPLACE"&&!e.hasAttribute("src")}function Nr(e){return(e??"").replaceAll("","")}function kf(e){return Nr(e.textContent)}function zP(e){return(e.nodeType===Node.TEXT_NODE||Dt(e))&&Nr(e.textContent)===""}function Lf(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=window.getSelection();r&&ws(r,n)}function Uv(e){if(!e.collapsed)return null;const{startContainer:t,startOffset:n}=e,r=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("em-replace");if(!co(r))return null;const o=document.createRange();if(o.selectNodeContents(r),o.setEnd(t,n),Nr(o.toString())==="")return{em:r,side:"before"};const i=document.createRange();return i.selectNodeContents(r),i.setStart(t,n),Nr(i.toString())===""?{em:r,side:"after"}:null}function Nf(e,t){if(!e.collapsed)return null;const n=Uv(e);if(n)return n.side===(t==="backward"?"after":"before")?n.em:null;const{startContainer:r,startOffset:o}=e;let i;if(r.nodeType===Node.TEXT_NODE){const s=r.data;if(Nr(t==="backward"?s.slice(0,o):s.slice(o))!=="")return null;const a=r.parentNode,l=Dt(a)?a:r;i=t==="backward"?l.previousSibling:l.nextSibling}else{const s=r.childNodes;i=t==="backward"?s[o-1]??null:s[o]??null}for(;i&&zP(i);)i=t==="backward"?i.previousSibling:i.nextSibling;return co(i)?i:null}function Dl(e,t,n=cr){return xf(e,t,n)}function xf(e,t,n=cr){const r=t==="after"?e.nextSibling:e.previousSibling;let o;if(Dt(r))o=r;else{const s=document.createElement("span");s.setAttribute(As,""),Ef(s),s.appendChild(document.createTextNode("")),n(()=>t==="after"?e.after(s):e.before(s)),o=s}let i=o.lastChild;if(!i||i.nodeType!==Node.TEXT_NODE){i=document.createTextNode("");const s=i;n(()=>o.appendChild(s))}return Lf(i,i.length),o}var UP="p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";function Of(e,t=cr,n=e.parentElement?.closest('[contenteditable="true"]')){jv(e,n)&&xf(e,"after",t)}function jv(e,t){if(!t)return!1;const n=e.parentElement?.closest(UP),r=n&&t.contains(n)?n:t,o=document.createRange();o.setStartAfter(e),o.setEnd(r,r.childNodes.length);const i=o.cloneContents();return i.querySelectorAll(`[${As}]`).forEach(s=>s.remove()),!/[^ \t\n\r]/.test(i.textContent??"")&&!i.querySelector("br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object")}function Vv(e){const t=Dt(e)&&kf(e)===""?e.previousSibling:null;return t?.nodeName==="BR"&&jv(t,t.parentElement?.closest('[contenteditable="true"]'))}function Rf(e,t=cr){if(!Vv(e)||!e.parentNode)return null;const n=window.getSelection(),r=!!n?.anchorNode&&e.contains(n.anchorNode),o=document.createElement("br");e.before(o),t(()=>e.remove());const i=o.parentNode;return r&&Lf(i,Array.prototype.indexOf.call(i.childNodes,o)),o}function Gv(){const e=window.getSelection(),t=e?.rangeCount?e.getRangeAt(0):null,n=t?.collapsed?t.startContainer:null,r=Dt(n)?n:n?.parentNode;return Vv(r)?r:null}function jP(e,t=cr,n){return Array.from(e.querySelectorAll(`[${As}]`)).filter(r=>r!==n).map(r=>Rf(r,t)).some(Boolean)}function VP(e,t=cr,n){const r=Array.from(e.querySelectorAll(`[${As}]`)).filter(o=>o!==n&&Nr(o.textContent)==="");r.length&&t(()=>r.forEach(o=>o.remove()))}function GP(e,t=cr){const n=Nr(e.textContent);if(n==="")return null;const r=document.createTextNode(n);return e.before(r),t(()=>e.remove()),Lf(r,r.length),r}function Xv(e){if(!e.collapsed)return;const{startContainer:t}=e,n=Dt(t)?t:t.parentNode;Dt(n)&&(co(n.previousSibling)?e.setStartAfter(n):e.setStartBefore(n),e.collapse(!0))}function Kv(e){e.querySelectorAll(`[${As}]`).forEach(t=>{const n=Nr(t.textContent);n===""?t.remove():t.replaceWith(t.ownerDocument.createTextNode(n))})}function XP(e,t){const n=Nf(e,t);if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o&&ws(o,r),n}function KP(e,t){const n=Array.from(e.querySelectorAll("em-replace")).find(i=>co(i)&&t.intersectsNode(i)&&!Yv(t,i));if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o?.removeAllRanges(),o?.addRange(r),n}function Yv(e,t){const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(e.START_TO_START,n)<=0&&e.compareBoundaryPoints(e.END_TO_END,n)>=0}function YP(){document.execCommand("delete")}function ZP(){const e=window.getSelection()?.getRangeAt(0);e?.deleteContents(),e?.collapse(!0)}function Zv(e,t=cr,n=YP){if(e.collapsed)return!1;const r=e.commonAncestorContainer,o=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(!Array.from(o?.querySelectorAll("em-replace")??[]).some(l=>co(l)&&Yv(e,l)))return!1;n();const i=window.getSelection();if(!i?.rangeCount)return!0;const{startContainer:s,startOffset:a}=i.getRangeAt(0);if(s.nodeType===Node.ELEMENT_NODE){const l=s.childNodes[a-1]??null,c=s.childNodes[a]??null;co(l)?Dl(l,"after",t):!l&&co(c)&&Dl(c,"before",t)}return!0}function Qv(){const e=window.getSelection();return e?.rangeCount?Nf(e.getRangeAt(0),"backward"):null}function QP(e,t=cr){const n=e.isConnected?e:Qv();if(!n)return;const r=n.closest('[contenteditable="true"]');It(()=>r?.focus({preventScroll:!0})),Dl(n,"after",t)}var Jv=Symbol("held-input-replay"),eE={insertText:"insertText",insertReplacementText:"insertText",deleteContentBackward:"delete",deleteContentForward:"forwardDelete",insertParagraph:"insertParagraph",insertLineBreak:"insertLineBreak",insertOrderedList:"insertOrderedList",insertUnorderedList:"insertUnorderedList",insertHorizontalRule:"insertHorizontalRule",formatBold:"bold",formatItalic:"italic",formatUnderline:"underline",formatStrikeThrough:"strikeThrough",formatSuperscript:"superscript",formatSubscript:"subscript",formatJustifyLeft:"justifyLeft",formatJustifyCenter:"justifyCenter",formatJustifyRight:"justifyRight",formatJustifyFull:"justifyFull",formatIndent:"indent",formatOutdent:"outdent",formatRemove:"removeFormat"},tE={deleteWordBackward:["backward","word"],deleteWordForward:["forward","word"],deleteSoftLineBackward:["backward","lineboundary"],deleteSoftLineForward:["forward","lineboundary"],deleteHardLineBackward:["backward","paragraphboundary"],deleteHardLineForward:["forward","paragraphboundary"]};function JP(e){return e in eE||e in tE}var eI={Backspace:["deleteContentBackward","deleteWordBackward","deleteSoftLineBackward"],Delete:["deleteContentForward","deleteWordForward","deleteSoftLineForward"]},nE={ArrowLeft:["backward","character","word"],ArrowRight:["forward","character","word"],ArrowUp:["backward","line","paragraphboundary"],ArrowDown:["forward","line","paragraphboundary"],Home:["backward","lineboundary","documentboundary"],End:["forward","lineboundary","documentboundary"]};function Mf(){return/Mac/.test(window.navigator.platform)}function rE(e){return Mf()?e.altKey:e.ctrlKey}function tI(e){const t=e.ctrlKey||e.metaKey;return t&&/^[cxv]$/i.test(e.key)||e.key==="Insert"&&(t||e.shiftKey)}function nI(e){return e.key in nE||(e.ctrlKey||e.metaKey)&&e.key.length===1&&!tI(e)}function Pf(e){return Jv in e}function If(e){return e.target?.closest?.('[contenteditable="true"], editor')??void 0}function oE(e){if(e.key.length===1&&!e.metaKey&&(!e.ctrlKey||e.altKey))return"insertText";if(e.key==="Enter"&&!e.ctrlKey&&!e.metaKey&&!e.altKey)return e.shiftKey?"insertLineBreak":"insertParagraph";const t=eI[e.key];if(t)return Mf()&&e.metaKey?t[2]:rE(e)?t[1]:t[0]}function rI(e){const t=nE[e.key];if(!t)return;const n=Mf()&&e.metaKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")?"lineboundary":rE(e)?t[2]:t[1];document.getSelection()?.modify?.(e.shiftKey?"extend":"move",t[0],n)}function Df(e){return Object.defineProperty(e,Jv,{value:!0}),e}function iE(e,t){return e.isConnected&&t<=(e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length)}function sE(e){if(!iE(e.startContainer,e.startOffset)||!iE(e.endContainer,e.endOffset))return;const t=document.createRange();return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),t.toString()}function oI(e,t){return t===void 0||sE(e)!==t?!1:(document.getSelection()?.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),!0)}function iI({inputType:e,data:t}){const n=tE[e];if(n){const o=document.getSelection();o?.isCollapsed&&o.modify?.("extend",n[0],n[1]),lr(n[0]==="backward"?"delete":"forwardDelete");return}const r=eE[e];r&&lr(r,!1,t??void 0)}function aE(e,t){if(t.target&&!oI(t.target,t.targetText))return;const{inputType:n,data:r}=t,o=Df(new window.InputEvent("beforeinput",{inputType:n,data:r,bubbles:!0,cancelable:!0}));e.dispatchEvent(o)&&iI(t)}function sI(e,t){const n=Df(new window.KeyboardEvent("keydown",{...t,bubbles:!0,cancelable:!0}));if(Object.defineProperty(n,"keyCode",{value:t.keyCode}),!e.dispatchEvent(n))return;const r=oE(t);r?aE(e,{inputType:r,data:r==="insertText"?t.key:null}):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a"?lr("selectAll"):rI(t)}var aI='[contenteditable="true"], editor';function Bf(e){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement)?.closest(aI)??void 0}function lI(){const e=document.getSelection();if(!e?.rangeCount||!e.anchorNode||!e.focusNode||!ft())return;const t=at(),n=t.pointToOffset({node:e.anchorNode,offset:e.anchorOffset}),r=t.pointToOffset({node:e.focusNode,offset:e.focusOffset});return n===void 0||r===void 0?void 0:{anchor:t.trackOffset(n),focus:t.trackOffset(r)}}function lE(e){e?.anchor.release(),e?.focus.release()}function cE({node:e}){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement,n=e.nodeType===Node.TEXT_NODE&&/^\s*$/.test(e.data)&&/\n/.test(e.data);return e.isConnected&&!!Bf(e)&&!n&&!t?.closest("em-replace, [data-em-caret]")}function uE(e){const t=e.current(),n=t===void 0||!ft()?void 0:at().offsetToPoint(t);return n&&cE(n)?n:void 0}function cI(e){const t=e&&uE(e.anchor),n=e&&uE(e.focus);if(!(!t||!n))return document.getSelection()?.setBaseAndExtent(t.node,t.offset,n.node,n.offset),Bf(t.node)}function uI(){const e=document.getSelection(),t=e?.rangeCount?e.anchorNode:null;return t&&cE({node:t})?Bf(t):void 0}function dI(e){const t=cI(e)??uI();return t}function Bl(e,t){const n=lI(),r=e(()=>{ft()&&at().flushCommit();const o=dI(n);lE(n),o&&t(o)});return r||lE(n),r}function Hf(e){e.preventDefault(),e.stopImmediatePropagation()}function fI(e){return/^(Tab|Escape|PageUp|PageDown|F\d{1,2})$/.test(e.key)||e.key==="Enter"&&(e.ctrlKey||e.metaKey)}var dE=e=>{if(!If(e)||Pf(e)||e.isComposing||e.keyCode===229)return;const{key:t,code:n,keyCode:r,shiftKey:o,ctrlKey:i,metaKey:s,altKey:a}=e,l={key:t,code:n,keyCode:r,shiftKey:o,ctrlKey:i,metaKey:s,altKey:a},c=u=>sI(u,l);oE(l)?yf()&&Bl(bf,c)&&Hf(e):nI(l)?Nv()&&Bl(kv,c)&&Hf(e):fI(l)&&Nv()&&xv()},fE=()=>{xv()},mE=e=>{if(!If(e)||!JP(e.inputType)||e.isComposing||Pf(e)||!yf())return;const t=e.inputType==="insertReplacementText",n=t?e.getTargetRanges?.()[0]:void 0;if(t&&!n)return;const r={inputType:e.inputType,data:t&&e.dataTransfer?.getData("text/plain")||e.data,target:n,targetText:n&&sE(n)};Bl(bf,o=>aE(o,r))&&Hf(e)};function mI(e){return"clipboardData"in e?e.clipboardData:e.dataTransfer}var hI=["text/html","text/plain"];function pI(e,t){const n=Array.from(t.types??[]),r=Object.fromEntries(hI.filter(o=>n.includes(o)).map(o=>[o,t.getData(o)]));return Df({target:e.target,clipboardData:{types:Object.keys(r),files:[],getData:o=>r[o]??""},preventDefault:()=>{},stopPropagation:()=>{}})}function gI(e,t){if(Pf(e)||!yf()||!If(e))return!1;try{const n=mI(e);if(!n||n.files?.length)return!1;const r=pI(e,n);if(!Bl(bf,()=>t(r)))return!1}catch{return e.preventDefault(),!1}return e.preventDefault(),e.stopPropagation(),!0}function bI(){return window.addEventListener("keydown",dE,!0),window.addEventListener("beforeinput",mE,!0),window.addEventListener("pointerdown",fE,!0),{dispose(){window.removeEventListener("keydown",dE,!0),window.removeEventListener("beforeinput",mE,!0),window.removeEventListener("pointerdown",fE,!0)}}}function yI(e,t){const n=t==="sup"?"sub":"sup";e.querySelectorAll(`${t}, ${n}`).forEach(r=>{const o=r.parentNode;if(o){for(;r.firstChild;)o.insertBefore(r.firstChild,r);r.remove()}})}function hE(e,t,n){const r=document.createElement(n);try{if(typeof t=="string")r.textContent=t||e.toString();else if(t instanceof DocumentFragment)r.appendChild(t);else if(t instanceof HTMLElement)for(;t.firstChild;)r.appendChild(t.firstChild);else r.textContent=e.toString();e.deleteContents(),e.insertNode(r)}catch{return null}return r}function vI(e){const t=e.parentNode;if(!t)return document.createTextNode("");if(Array.from(e.childNodes).some(n=>n.nodeType===1)){const n=document.createDocumentFragment(),r=Array.from(e.childNodes);for(;e.firstChild;)n.appendChild(e.firstChild);return t.replaceChild(n,e),r[0]||document.createTextNode("")}else{const n=e.textContent||"",r=document.createTextNode(n);return t.replaceChild(r,e),r}}function EI(e,t,n){if(!e)return!1;const r=e.textContent?.trim()||"";let o="";if(n){const i=t.cloneRange(),s=i;try{s.expand&&s.expand("word"),o=i.toString().trim()}catch{return!1}}else o=t.toString().trim();return r===o}function SI(e,t){const n=e.textContent||"",r=t.toString(),o=t.startOffset,i=t.endOffset,s=document.createTextNode(n.slice(0,o)),a=document.createTextNode(r),l=document.createTextNode(n.slice(i)),c=e.parentNode;return c&&(c.insertBefore(s,e),c.insertBefore(a,e),l.textContent&&c.insertBefore(l,e),e.remove()),t.setStart(a,0),t.setEnd(a,a.length),a}function wI(e,t=[]){const n=[...new Set(["strong","em","b","i","u","sub","sup","strike",...t])].join(", ");e.querySelectorAll(n).forEach(r=>{!r.textContent?.trim()&&(!r.hasChildNodes()||Array.from(r.childNodes).every(o=>o.nodeType===Node.TEXT_NODE&&!o.textContent?.trim()))&&r.remove()})}function pE(e,t=10){const n=e.length;return n===0?!1:(e.match(/[а-яА-ЯёЁ]/g)||[]).length/n*100>t}var _I={bold:"strong|s|b",italic:"em|i",strike:"strike",underline:"u",strikeUnderline:"strike|u"};function ks(e,t){const n=_I[t]||t,r=new RegExp(`<\\/?(${n})>`,"gi");return e.replaceAll(r,"")}var CI=["strong","em","strike","sub","sup","b","i","s","u"];function TI(e,t){if(t)for(const n of CI)t.closest(n)&&e.querySelectorAll(n).forEach(r=>{const o=r.parentNode;if(o){for(;r.firstChild;)o.insertBefore(r.firstChild,r);r.remove()}})}function AI(e,t){t&&t.closest("a")&&e.querySelectorAll("a").forEach(n=>{const r=n.parentNode;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);n.remove()}})}var Tne="#1C52DC",Ane="#1C52DC",kne="#1C52DC";function kI(e){if(typeof e.isContentEditable=="boolean")return e.isContentEditable;const t=e.closest("[contenteditable]");return!!t&&t.getAttribute("contenteditable")!=="false"}function gE(e,t,n,r){const o=document.createRange();return o.selectNodeContents(e),r?o.setStart(t,n):o.setEnd(t,n),o.toString()!==""||!!o.cloneContents().querySelector("br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object")}function LI(e){const{startContainer:t,startOffset:n}=e,r=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("a"),o=r?.parentElement;if(!e.collapsed||!r?.textContent||!o||!kI(o))return;const{display:i}=getComputedStyle(r);if(!(i&&i!=="inline")){if(!gE(r,t,n,!0))e.setStartAfter(r);else if(!gE(r,t,n,!1))e.setStartBefore(r);else return;e.collapse(!0)}}var NI="./js/sanitize-html/sanitize-html.js",bE="data-sanitize-html-loader",Hl=null,Ls=null;function yE(){return typeof __useblocks__<"u"?__useblocks__:void 0}function xI(e){const t=yE();if(typeof t?.moduleTransport!="function"||t.blobBlocked)return null;try{return t.moduleTransport(e)}catch{return null}}function OI(){const e=yE();e&&(e.blobBlocked=!0)}function RI(){return new URL(NI,document.baseURI||window.location.href).href}function Ff(){const e=globalThis.sanitizeHtml;return typeof e!="function"||!("defaults"in e)?null:e}function MI(){if(Ff())return Promise.resolve();const e=RI();return document.querySelector(`script[${bE}]`)?Ls??Promise.resolve():(Ls||(Ls=PI(e).catch(t=>{throw Ls=null,t})),Ls)}async function PI(e){const t=xI(e);if(!t)return Fl(e);const n=await t.catch(()=>null);if(!n)return Fl(e);const r=URL.createObjectURL(n),o=await Fl(r).then(()=>!0,()=>!1);URL.revokeObjectURL(r),o||(OI(),await Fl(e))}function Fl(e){return new Promise((t,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,r.setAttribute(bE,"true"),r.onload=()=>t(),r.onerror=()=>{r.remove(),n(new Error(`Failed to load sanitize-html script: ${e}`))},document.head.appendChild(r)})}async function vE(){const e=Ff();return e||(Hl||(Hl=(async()=>{await MI();const t=Ff();if(t)return t;throw new Error("sanitizeHtml not available after script load")})().catch(t=>{throw Hl=null,t})),Hl)}function $l(e){return e?.nodeType===Node.TEXT_NODE}function II(e,t,n){if(t?.nodeType===Node.TEXT_NODE)return e.includes(t)?{text:t,offset:n}:null;if(!t||t!==e[0]?.parentNode)return null;const r=t.childNodes[n-1];if(r?.nodeType===Node.TEXT_NODE&&e.includes(r))return{text:r,offset:r.length};const o=t.childNodes[n];return o?.nodeType===Node.TEXT_NODE&&e.includes(o)?{text:o,offset:0}:null}function EE(e,t,n,r){const o=II(e,n,r);if(!o)return null;let i=o.text,s=0;for(;i!==t&&i.previousSibling?.nodeType===Node.TEXT_NODE;)i=i.previousSibling,s+=i.length;return{head:i,offset:s+o.offset}}function SE(e,t,n,r){return e.node===t&&e.offset>n?{...e,offset:e.offset-r}:e}function $f(e,t,n=()=>"letter"){const r=e?.previousSibling,o=t?.nextSibling,i=$l(r)&&n(r)==="letter",s=i&&$l(e),a=$l(t)&&$l(o)&&(n(o)==="letter"||i&&n(o)==="new");if(!s&&!a)return;const l=window.getSelection(),c=s?r:e,u=a?o:t;if(!c||!u)return;const d=[];for(let E=c;E;E=E===u?null:E.nextSibling)d.push(E);const f=c.parentNode,h=Array.prototype.indexOf.call(f?.childNodes??[],u),m={node:l?.anchorNode??null,offset:l?.anchorOffset??0},p={node:l?.focusNode??null,offset:l?.focusOffset??0},v=EE(d,c,m.node,m.offset),C=EE(d,c,p.node,p.offset);let k=null,L=0;for(let E=c;E;){const g=E===u?null:E.nextSibling;E.nodeType!==Node.TEXT_NODE?k=null:k?(k.appendData(E.data),E.parentNode?.removeChild(E),L++):k=E,E=g}if(l&&(v||C)){const E=v?{node:v.head,offset:v.offset}:SE(m,f,h,L),g=C?{node:C.head,offset:C.offset}:SE(p,f,h,L);E.node&&g.node&&l.setBaseAndExtent(E.node,E.offset,g.node,g.offset)}}var DI=["strong","em","i","a","br","span","ul","ol","li","strike","sub","sup","s"],BI={a:["href"],span:["data-font-size","data-bold","data-italic"],strong:["data-italic"],ul:["data-list-type"],ol:["data-list-type","data-list-start"],li:["data-list-item"]};function HI(e){const t=/^\s*(\d+(?:\.\d+)?)(px|pt|em)?\s*$/i.exec(e??"");return t?`${t[1]}${(t[2]||"px").toLowerCase()}`:null}var FI=/<span\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,$I=/\sdata-(?:buffer|metadata)=(?:"[^"]*"|'[^']*')/gi;function WI(e){return e.replace(FI,t=>t.replace($I,""))}function qI(e){const t=window.clipboardData;return("clipboardData"in e?e.clipboardData:e.dataTransfer)||t}function zI(e){return UI(e.replace(/\r\n?/g,`
|
|
30
|
+
`,d=f.Ruleset;continue}if(a+=l,l==="("&&a.charAt(a.length-2)==="l"&&a.charAt(a.length-3)==="r"&&a.charAt(a.length-4)==="u"){d=f.URL;continue}continue}if(d===f.URL&&l===")"&&a.charAt(a.length-1!=="\\")){a+=l,d=f.Expression;continue}a+=l}return a=s.join("")+a,a}window.cssbeautify=e})();function xM(e,t,n){n.state.update({iframeOffsetTop:e.iframeOffsetTop,scrollTop:e.scrollTop,previewHeight:e.previewHeight,applicationMode:e.mode}),typeof t<"u"&&n.state.set("codeMode",e.mode==="code");const r=document.querySelector(".em-element-path");r&&(r.style.top=n.previewHeight-n.iframeOffsetTop-65+n.scrollTop+"px");const o=document.querySelector(".em-editor-wrapper");o&&o.style.display==="none"?n.setBlockGroupControlsPosition():setTimeout(()=>{n.setBlockGroupControlsPosition()},400)}var OM=["transform","transform-origin","overflow-x","height"];function RM(e,t){return!(e>0)||!(t>0)||e<=t?1:t/e}function Es(e,t){const n=t<1?`scale(${t})`:"";if(e.style.transform===n)return!1;for(const r of OM)e.style.removeProperty(r);return n?(e.style.overflowX="visible",e.style.transformOrigin="left top",e.style.transform=n):e.getAttribute("style")||e.removeAttribute("style"),!0}function MM(e,t){const n=e,r=n?.querySelector("table:first-child"),o=Math.max(n?.offsetWidth??0,r?.offsetWidth??0);return o>0?o:(Es(t,1),t.scrollWidth)}function PM(e,t=window){const n=t.document.documentElement,r=n.style.transform,o=RM(MM(e,n),t.innerWidth);return Es(n,o),n.style.transform!==r&&t.parentIFrame?.size?.(),o}function IM(e,t){Es(document.documentElement,1);const n=t.globalHolder?.querySelector("table:first-child");if(n&&n.offsetWidth>=e.iframeWidth-2&&t.globalHolder){const r=e.iframeWidth/t.globalHolder.offsetWidth;Es(document.documentElement,r),document.querySelector(".em-narrow-table")&&e.iframeWidth>370&&t.messageService.send({operation:"application_preview_alert_show",settings:{show:r<.9}})}setTimeout(()=>{t.messageService.send({operation:"application_iframe_set_height",settings:{height:document.body.getBoundingClientRect().height}})},300)}function dt(e){const t=R(e,Te);return n=>{t.commit(n)}}function at(){return R(Mt,Y)}function DM(){return R(Mt,ot)}function BM(){return R(Mt,pn)}function ft(){return Mt.getInstance(Y)!==void 0}function ao(e){R(Mt,Te).commit(e)}function HM(e){if(!ft())return e(),Promise.resolve(!0);const t=at();return t.commit(!1),t.flushCommit(),t.sendAfterCurrentEdits(e)}function FM(){if(!ft())return!1;const e=at();return e.commit(!1),e.flushCommit(),e.hasEditsAfterBoundary()}function $M(){return ft()?at().markHistoryAction():void 0}function WM(e){ft()&&at().noteHistoryActionSent(e)}function bf(e){return ft()&&at().holdInput(e)}function kv(e){return ft()&&at().holdInputBehindQueued(e)}function Lv(){ft()&&at().closeUndoStep()}function yf(){return ft()&&at().isHoldingInput()}function Nv(){return ft()&&at().hasHeldInput()}function xv(){ft()&&at().releaseHeldInput()}function Ov(){return ft()&&at().holdsTypedEdits()}function Ss(e){return ft()?at().renderOnly(e):e()}function Nl(e){return e.nodeType===1&&e.localName==="template"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function vf(e){return[...e.querySelectorAll?.("template")??[]].filter(Nl)}function qM(e){return Nl(e)||vf(e).length>0}function rn(e){const t=[...Nl(e)?[e]:[],...vf(e)];for(const n of t)if(n.content.firstChild){for(;n.content.firstChild;)n.appendChild(n.content.firstChild);for(const r of n.children)rn(r)}}function Zo(e){const t=[...Nl(e)?[e]:[],...vf(e)];for(const n of t)for(;n.firstChild;)n.content.appendChild(n.firstChild)}function Gt(){return ft()?at():void 0}function It(e){const t=Gt();return t?t.applyHidden(e):e()}function Be(e,t,...n){e&&It(()=>t?e.classList.add(...n):e.classList.remove(...n))}function lo(e){const t=document.activeElement;t instanceof HTMLElement&&t!==document.body&&e.contains(t)&&It(()=>t.blur())}function Ef(e){Gt()?.ownership.markService(e)}function Rv(e){Gt()?.ownership.markWrapper(e)}function Mv(e){Gt()?.ownership.markOuterWrapper(e)}function ws(e,t){e.removeAllRanges(),It(()=>e.addRange(t))}function xl(e){const t=document.implementation.createHTMLDocument("").importNode(e,!0);nn(e,t);const n=new Map([[e,t]]),r=Gt()?.ownership,o=(i,s)=>{const a=[...s.childNodes];i.childNodes.forEach((l,c)=>{const u=a[c];n.set(l,u),o(l,u),r?.isOffModel(l)&&u.replaceWith(...u.childNodes)})};return o(e,t),Zo(t),{copy:t,counterpart:i=>n.get(i)}}function Ol(e){return Zg(xl(e).copy)}function Ue(e){return zL(xl(e).copy)}function _s(e){const t=Gt();return t?(t.flushCommit(),t.getOuterHtml(e)):e.outerHTML}function Sf(e){return Pv(e)}function Pv(e){const t=Gt();return!t||t.isInLetter(e)||!t.isUntracked(e)&&!t.ownership.isService(e)}function wf(e){const t=Gt();return t?t.ownership.markOf(e)?"foreign":t.isInLetter(e)?"letter":t.isBehindHidden(e)?"foreign":"new":"letter"}function _f(e,t){const n=[...e.querySelectorAll(t)].filter(Sf);return n[n.length-1]??null}function Iv(e,t){const n=o=>t==="next"?o.nextElementSibling:o.previousElementSibling;let r=n(e);for(;r&&!Sf(r);)r=n(r);return r}function Dv(e,t){return[...e.childNodes].flatMap(n=>t.isInLetter(n)?[n]:Dv(n,t))}function Cf(e){lo(e);const t=Gt();if(!t)return;t.flushCommit();const n=[...e.querySelectorAll("*")].filter(r=>t.ownership.markOf(r)==="service");for(const r of n)e.contains(r)&&r.replaceWith(...Dv(r,t))}function zM(e){const t=[...e.childNodes],n=Gt();if(!n)return t;let r;for(const o of n.letterChildren(e))o.isConnected||t.splice(r?t.indexOf(r)+1:0,0,o),r=o;return t}function UM(){const e=Gt();return e?{...e.scriptRunner,awake:()=>e.recordNow()}:{run:(t,n)=>n(),quiet:t=>t()}}function sr(e,t){const n=Le(e,"dormant"),r=ab(n);try{return t(n)}finally{hb(r,UM())}}function Bv(e,t,n){sr(n,r=>el(e,t,r))}function Cs(e,t,n){return e==="new"?sr(t,n):n(Le(t,!0))}function ar(e,t,n,r){Cs(e,r,o=>el(t,n,o))}function pt(e){return function(...t){const n=Gt(),r=()=>Reflect.apply(e,this,t);return n?n.applyOwn(r):r()}}function lr(e,t=!1,n){const r=()=>document.execCommand(e,t,n),o=Gt();return o?o.applyCommand(r):r()}function Hv(e){const t=()=>{Be(document.body,e,"mceNonEditable"),document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable",e?"false":"true")})};ft()?at().applyHidden(t):t()}function jM(){let e=!1,t=!0,n=!0;const r=new Set,o=i=>{t!==i&&(t=i,[...r].forEach(s=>{try{s()}catch{}}))};return{setApp(i){e=i},setIntegrator:o,isAppLocked:()=>e,isIntegratorLocked:()=>t,isTextLocked:()=>e||t,closeEditorInit(){n=!0},openEditorInit(){n=!1},isEditorInitClosed:()=>n,onIntegratorChange(i){const s=()=>i();return r.add(s),()=>r.delete(s)},reset(){e=!1,o(!0),n=!0}}}var Tf=jM();function VM(e){return{dispose:e.onIntegratorChange(()=>Hv(e.isTextLocked()))}}function GM(e,t){return e.beforeChange(({domMutations:n})=>{const r=n.flatMap(o=>o.type==="Add"&&o.node instanceof Element?[o.node]:[]);r.length&&queueMicrotask(()=>{if(!t.isTextLocked())return;const o=r.flatMap(i=>[...i.tagName==="EDITOR"?[i]:[],...Array.from(i.querySelectorAll("editor"))]);e.applyHidden(()=>{for(const i of o)i.isConnected&&i.setAttribute("contenteditable","false")})})})}function Af(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const i=e,s=t;return i.length===s.length&&i.every((a,l)=>Af(a,s[l]))}const r=Object.keys(e),o=Object.keys(t);return r.length!==o.length?!1:r.every(i=>Object.prototype.hasOwnProperty.call(t,i)&&Af(e[i],t[i]))}function Fv(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&Af(o,a)||(o=a,i=!0,r(a))})},select(r){return Fv(n,r)}};return n}function $v(...e){let t=e[0],n=e.length>0;const r=new Set,o={get(){return n?t:void 0},set(i){t=i,n=!0;for(const s of Array.from(r))s(i)},watch(i){return r.add(i),n&&i(t),{dispose:()=>r.delete(i)}},select(i){return Fv(o,i)}};return o}var Rl={applicationTheme:"light",applicationMode:"default",previewHeight:0,emailWidth:0,previewPage:!1,globalHolder:null,elementPath:[],iframeOffsetTop:0,scrollTop:0,copyPasteEnabled:!0,saveBlockEnabled:!0,editImageControlEnabled:!0,elementAIimageEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterEditorEnabled:!0,blocksAddPanelEnabled:!0,codeMode:!0,appName:"",isLeftButtonDown:!1,isProgrammaticSelection:!1,activeCell:[],commonStyles:{},loadStylesTimer:!1,_pushUndoStop:!1},Ts=$v({...Rl});function Dn(){return Ts.get()}var Ml=new ge,Qo=new Map,j={source:Ts,get(e){return Dn()[e]},getState(){return{...Dn()}},getStateRef(){return Dn()},set(e,t){if(Dn()[e]===t)return;Ts.set({...Dn(),[e]:t}),Ml.fire({[e]:t});const n=Qo.get(e);n&&n.forEach(r=>r(t))},update(e){let t=!1;const n={};for(const r of Object.keys(e)){const o=e[r];if(Dn()[r]!==o){Ts.set({...Dn(),[r]:o}),n[r]=o,t=!0;const i=Qo.get(r);i&&i.forEach(s=>s(o))}}t&&Ml.fire(n)},increment(e,t=1){const n=Dn()[e];typeof n=="number"&&j.set(e,n+t)},decrement(e,t=1){const n=Dn()[e];typeof n=="number"&&j.set(e,n-t)},subscribe(e){return Ml.event(e)},subscribeToKey(e,t){Qo.has(e)||Qo.set(e,new Set);const n=Qo.get(e),r=t;return n.add(r),()=>{n.delete(r),n.size===0&&Qo.delete(e)}},reset(){Ts.set({...Rl}),Ml.fire(Dn())},resetKey(e){this.set(e,Rl[e])},getInitialState(){return Rl}};function XM(e,t){const n=$v(),r=e.addListener(t,o=>n.set(o));return{source:n,dispose:()=>r.dispose()}}var KM=["copyPasteEnabled","saveBlockEnabled","editImageControlEnabled","elementAIimageEnabled","imageCenterStockEnabled","imageCenterGifEnabled","imageCenterEditorEnabled","blocksAddPanelEnabled"];function YM(e){const t="fd4347fc";let n=document.getElementsByTagName("head")[0];!n&&document.documentElement&&(n=document.createElement("head"),document.documentElement.insertBefore(n,document.documentElement.firstChild));const r=`css/sandbox-${e}.css?${t}`,o=e==="light"?"dark":"light",i=document.querySelectorAll(`[href="css/sandbox-${o}.css?${t}"]`);if(!document.querySelector(`[href="${r}"]`)){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",r),n?.appendChild(s)}for(const s of i)s.remove()}var ZM={name:"sandbox.hostFacts",provides:[Wo],setup(e){const t=Object.fromEntries(Object.entries(n2).map(([n,r])=>[n,XM(z,r).source]));e.inject(Wo,t)}},QM={name:"sandbox.hostFactsToState",awaits:{services:[Wo,Te,Y,Ye]},setup(e){const t=R(e,Wo),n=dt(e),r=R(e,Ye);t.theme.watch(o=>{j.set("applicationTheme",o),YM(o),n(!1)}),t.commonStyles.watch(o=>{o&&j.set("commonStyles",o)}),t.flags.watch(o=>{for(const i of KM)typeof o[i]<"u"&&j.set(i,o[i])}),VM(r),GM(R(e,Y),r),t.lockEditor.watch(o=>r.setIntegrator(o)),t.codeMode.watch(o=>j.set("codeMode",o)),t.appName.watch(o=>j.set("appName",o)),t.previewPage.watch(o=>{j.set("previewPage",o),Be(document.body,!!o,"em-sandbox-preview")})}},JM={name:"sandbox.viewport",awaits:{services:[Wo]},setup(e){R(e,Wo).viewport.watch(t=>xM(t,void 0,{state:j,previewHeight:t.previewHeight,iframeOffsetTop:t.iframeOffsetTop,scrollTop:t.scrollTop,globalHolder:j.get("globalHolder"),setBlockGroupControlsPosition:()=>e.getServices(Nb).forEach(n=>n()),messageService:z}))}};function Lr(e){for(const t of document.querySelectorAll(`[${e}]`))t.removeAttribute(e)}function Lt(e,t,n=!1){for(const r of e.querySelectorAll(t))n||!r.childNodes.length?r.remove():r.replaceWith(...r.childNodes)}function eP(e,t){if(e.data.value)document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable","false")}),Be(document.body,!0,"em-sandbox-discuss");else{const n=t.editLock.isTextLocked()?"false":"true";document.querySelectorAll("editor").forEach(r=>{r.setAttribute("contenteditable",n)}),Be(document.body,!1,"em-sandbox-discuss","em-sandbox-discuss_set-target")}}function tP(e,t){Be(document.body,!!e.data.value,"em-sandbox-discuss_set-target")}function nP(e,t){const n=e.data.value,r=document.querySelector(`[em-discuss-id="${n}"]`);r&&t.messageService.send({operation:"application_scroll-to",settings:{value:r.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),Be(document.body,!1,"em-sandbox-discuss_set-target"),document.querySelectorAll(".em-discuss-id-new").forEach(o=>{o.removeAttribute("em-discuss-id")}),t.removeAllAttributes("em-edit"),r&&document.querySelectorAll(`[em-discuss-id="${n}"]`).forEach(o=>{o.removeAttribute("em-discuss-id")}),t.commit()}function rP(e,t){Be(document.body,!1,"em-sandbox-discuss_set-target"),document.querySelectorAll(".em-discuss-id-new").forEach(n=>{n.classList.remove("em-discuss-id-new")}),t.removeAllAttributes("em-edit"),t.commit(),setTimeout(()=>{t.messageService.send({operation:"application_discuss_save_target"})},500)}function oP(e,t){const n=e.data.value,r=document.querySelector(`[em-discuss-id="${n}"]`);r?(t.messageService.send({operation:"application_scroll-to",settings:{value:r.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),r.classList.add("em-discuss-target-active"),setTimeout(()=>{r.classList.remove("em-discuss-target-active")},2e3)):t.messageService.send({operation:"application_discuss_no_comment"})}var iP={sandbox_lock_discuss:eP,sandbox_discuss_set_target:tP,sandbox_discuss_remove_target:nP,sandbox_discuss_reset:rP,sandbox_discuss_get_target:oP};function sP(e,t){t.editLock.setApp(!!e.data.data),Hv(t.editLock.isTextLocked())}function aP(e,t){t.setEditorFocus(e.data.data)}function lP(e,t){let n=e.data.data;if(typeof n!="number")return;n=DM().correctOffset(n,!0),n=BM().correctOffset(n,!0);let r=at().getElementByPosition(n);if(r&&!(r instanceof Element)&&(r=r.parentElement),!(r instanceof HTMLElement))return;const o=r.getBoundingClientRect();r.tagName!=="BODY"&&o.height&&o.width&&document.querySelector("[em-edit]")!==r&&t.applicationElementSettingsSet({elem:r});const i=r.getBoundingClientRect(),s=i.top-j.get("previewHeight")/2+i.height/2;t.messageService.send({operation:"application_scroll-to",settings:{value:j.get("applicationMode")==="default"?s+j.get("iframeOffsetTop"):s}})}var cP={sandbox_lock_edit:sP,editor_change_focus:aP,update_position_from_editor:lP};function uP(e,t){document.querySelectorAll("[em-optimise-error]").forEach(n=>{n.removeAttribute("em-optimise-error")}),document.querySelectorAll("img").forEach((n,r)=>{n.setAttribute("em-optimise",`image_${r}`)}),t.commit()}function dP(e,t){document.querySelectorAll("[em-optimise-error]").forEach(n=>{n.removeAttribute("em-optimise-error")}),document.querySelectorAll("a[href]").forEach((n,r)=>{n.setAttribute("em-optimise",`link_${r}`)}),t.commit()}function fP(e,t){const n=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);n&&(e.data.settings.isError&&(n.setAttribute("em-optimise-error","true"),t.commit()),t.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),t.setCursorPosition(n),t.applicationElementSettingsSet({elem:n}))}function mP(e,t){const n=document.querySelector(`[em-optimise="${e.data.settings.elementId}"]`);n&&(t.messageService.send({operation:"application_scroll-to",settings:{value:n.getBoundingClientRect().top+t.iframeOffsetTop-t.previewHeight/2}}),t.setCursorPosition(n),t.applicationElementSettingsSet({elem:n}),e.data.settings.isError&&n.setAttribute("em-optimise-error","true"),t.commit())}var hP={sandbox_set_attr_to_images:uP,sandbox_set_attr_to_links:dP,sandbox_set_position_to_img:fP,sandbox_set_position_to_link:mP},pP={brightness:100,contrast:100,sepia:0},Pl={DARK:"dark",LIGHT:"light"},Wv=!1;function gP(e){Wv||(e.setFetchMethod(t=>window.fetch(t)),Wv=!0)}function bP(){let e=null,t=Pl.LIGHT;return{set(n){if(t=n,n===Pl.DARK){e??(e=df(()=>Promise.resolve().then(()=>id("./darkreader.CyLMh7_H.js")),void 0,{}.url)),e.then(r=>{t===Pl.DARK&&(gP(r),r.enable(pP))}).catch(r=>{e=null});return}e?.then(r=>{t===Pl.LIGHT&&r.disable()})},clear(n){return n.replaceAll(/\s*?--darkreader.+?: .*?;/g,"")}}}var Il=bP();function yP(e,t){t.initPreview(!0)}function vP(e){const t=e.data?.data?.theme;(t==="light"||t==="dark")&&Il.set(t)}var EP={init_preview:yP,sandbox_switch_theme:vP};function vn(e,t,n,r){return{name:`sandbox.operations.${e}`,awaits:n,setup(o){const i=r(o),s={};for(const[a,l]of Object.entries(t))l&&(s[a]=c=>l(c,i()));o.addService(xb,{owner:e,handlers:s})}}}var SP={name:"sandbox.operationEnvironment",provides:[Tr],setup(e){const t={iframeOffsetTop:0,previewHeight:0,elementPath:[]};j.subscribe(n=>{for(const r of["iframeOffsetTop","previewHeight","elementPath"])r in n&&n[r]!==void 0&&Object.assign(t,{[r]:n[r]})}),e.inject(Tr,t)}},wP=vn("discuss",iP,{services:[Te,Tr,Ye]},e=>{const t=dt(e),n=R(e,Tr),r=R(e,Ye);return()=>({commit:t,editLock:r,iframeOffsetTop:n.iframeOffsetTop,previewHeight:n.previewHeight,messageService:z,removeAllAttributes:Lr})}),_P=vn("editor",cP,{services:[Ie,it,Ye]},e=>{const t=R(e,Ie),n=R(e,it),r=R(e,Ye);return()=>({applicationElementSettingsSet:t,editLock:r,messageService:z,setEditorFocus:o=>n.setEditorFocus(o)})}),CP=vn("images",hP,{services:[Ie,yt,Te,Tr]},e=>{const t=R(e,Ie),n=R(e,yt),r=dt(e),o=R(e,Tr);return()=>({applicationElementSettingsSet:t,commit:r,iframeOffsetTop:o.iframeOffsetTop,previewHeight:o.previewHeight,messageService:z,setCursorPosition:i=>n(i)})}),TP=vn("preview",EP,{services:[ss]},e=>()=>({initPreview:t=>R(e,ss)(t)})),AP={name:"sandbox.operationsDispatcher",setup(e){z.addListener(t=>{const n=t.data?.operation;if(!n)return;const r=e.getServices(xb).map(i=>i.handlers[n]).filter(Boolean).pop();if(!r)return;const o=i=>{};try{Promise.resolve(r(t)).catch(o)}catch(i){o(i)}})}},kP=[SP,wP,_P,CP,TP,AP],LP=["em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document","em-block-insert_bottom","em-block-insert_top","em-blockatom-insert","em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top","em-block-insert-empty","em-atom-insert-empty","em-block-insert-body","em-atom-insert-body","em-resize-start","sortable-chosen","sortable-ghost","em-vindent-table","em-vindent_low","em-vindent","em-relative","em-display-block","em-sandbox-discuss_set-target","em-sandbox-discuss","em-element-list-bullet","remove-new-editor-element","em-just-inserted","em-native-img-uploading","em-native-img-drop-target","em-native-img-drop-loading","em-native-file-drag"],NP=["style","class","align","href"],xP=new Set([...LP,"em-element-path_img"]);function OP(e){return e.split(/\s+/).filter(t=>t&&!xP.has(t)).join(" ")}var RP=32;function MP(e){return!!(e.tagName==="BODY"||e.getAttribute("em")==="atom"||e.tagName==="TABLE"&&e.hasAttribute("em"))}function PP(e){const t=[e.tagName];for(const n of NP){const r=e.getAttribute(n),o=n==="class"&&r!==null?OP(r):r;o!==null&&o!==""&&t.push(`${n}=${o}`)}return t.join("|")}function IP(e){if(!e||!e.isConnected)return"";const t=[];let n=e,r=0;for(;n&&r<RP&&(t.push(PP(n)),!MP(n));)n=n.parentElement,r++;return t.join("||")}function DP(e){let t={text:"",ancestors:""};const n=r=>({text:r?e(r):"",ancestors:IP(r)});return{remember(r){t=n(r)},forget(){t={...t,text:""}},take:n,differs(r){return t.text!==r.text||t.ancestors!==r.ancestors},accept(r){t=r}}}function BP(e,t){t.onReleased(()=>{Promise.resolve().then(()=>{t.isLocked()||e.remember(document.querySelector("[em-edit]"))})})}var qv=Promise.resolve(),zv=null;function HP(e,t){const{HTMLDocument:n,documentMapping:r,remoteDocument:o,messageService:i}=t;let s=n.getRangeByElement(e,!0);if(s){const a=r.getMappedReplacementRangeAtPosition(s.start)||r.getMappedReplacementRangeAtPosition(Math.max(s.end-1,s.start));a&&(s=a),s=r.correctRange(s),s=o.correctRange(s);const l={operation:"update_position_from_iframe",data:s};i.send(l)}}function FP(e,t){zv=e,qv=qv.finally(()=>{zv===e&&HP(e,t)})}function $P(e,t="unknown"){const n=Mt.getInstance(it);if(!n){e();return}n.controller.whenEditorLostFocus(e,t)}function WP(e){const t=e.innerHTML.trim();return[t===" ",t==="<div> </div>",/^<div[^>]*> <\/div>$/.test(t),/^<[^>]*> <\/[^>]*>$/.test(t),t.replace(/<[^>]*>/g,"").trim()===" ",e.textContent?.trim()===" "||e.textContent?.trim().charCodeAt(0)===160].some(n=>n===!0)}function qP(e){window.getSelection();const t=e.startContainer,n=t.nodeType===Node.TEXT_NODE?t.parentElement:t instanceof Element?t:null;if(!n||!n.contains(e.commonAncestorContainer))return!1;const r=n.textContent??"",o=e.toString(),i=r.replace(/\s+/g," ").trim(),s=o.replace(/\s+/g," ").trim();return r===o||i===s}var _ne="br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object",As="data-em-caret",Cne="",cr=e=>e();function Dt(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("data-em-caret")}function co(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.tagName==="EM-REPLACE"&&!e.hasAttribute("src")}function Nr(e){return(e??"").replaceAll("","")}function kf(e){return Nr(e.textContent)}function zP(e){return(e.nodeType===Node.TEXT_NODE||Dt(e))&&Nr(e.textContent)===""}function Lf(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=window.getSelection();r&&ws(r,n)}function Uv(e){if(!e.collapsed)return null;const{startContainer:t,startOffset:n}=e,r=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("em-replace");if(!co(r))return null;const o=document.createRange();if(o.selectNodeContents(r),o.setEnd(t,n),Nr(o.toString())==="")return{em:r,side:"before"};const i=document.createRange();return i.selectNodeContents(r),i.setStart(t,n),Nr(i.toString())===""?{em:r,side:"after"}:null}function Nf(e,t){if(!e.collapsed)return null;const n=Uv(e);if(n)return n.side===(t==="backward"?"after":"before")?n.em:null;const{startContainer:r,startOffset:o}=e;let i;if(r.nodeType===Node.TEXT_NODE){const s=r.data;if(Nr(t==="backward"?s.slice(0,o):s.slice(o))!=="")return null;const a=r.parentNode,l=Dt(a)?a:r;i=t==="backward"?l.previousSibling:l.nextSibling}else{const s=r.childNodes;i=t==="backward"?s[o-1]??null:s[o]??null}for(;i&&zP(i);)i=t==="backward"?i.previousSibling:i.nextSibling;return co(i)?i:null}function Dl(e,t,n=cr){return xf(e,t,n)}function xf(e,t,n=cr){const r=t==="after"?e.nextSibling:e.previousSibling;let o;if(Dt(r))o=r;else{const s=document.createElement("span");s.setAttribute(As,""),Ef(s),s.appendChild(document.createTextNode("")),n(()=>t==="after"?e.after(s):e.before(s)),o=s}let i=o.lastChild;if(!i||i.nodeType!==Node.TEXT_NODE){i=document.createTextNode("");const s=i;n(()=>o.appendChild(s))}return Lf(i,i.length),o}var UP="p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";function Of(e,t=cr,n=e.parentElement?.closest('[contenteditable="true"]')){jv(e,n)&&xf(e,"after",t)}function jv(e,t){if(!t)return!1;const n=e.parentElement?.closest(UP),r=n&&t.contains(n)?n:t,o=document.createRange();o.setStartAfter(e),o.setEnd(r,r.childNodes.length);const i=o.cloneContents();return i.querySelectorAll(`[${As}]`).forEach(s=>s.remove()),!/[^ \t\n\r]/.test(i.textContent??"")&&!i.querySelector("br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object")}function Vv(e){const t=Dt(e)&&kf(e)===""?e.previousSibling:null;return t?.nodeName==="BR"&&jv(t,t.parentElement?.closest('[contenteditable="true"]'))}function Rf(e,t=cr){if(!Vv(e)||!e.parentNode)return null;const n=window.getSelection(),r=!!n?.anchorNode&&e.contains(n.anchorNode),o=document.createElement("br");e.before(o),t(()=>e.remove());const i=o.parentNode;return r&&Lf(i,Array.prototype.indexOf.call(i.childNodes,o)),o}function Gv(){const e=window.getSelection(),t=e?.rangeCount?e.getRangeAt(0):null,n=t?.collapsed?t.startContainer:null,r=Dt(n)?n:n?.parentNode;return Vv(r)?r:null}function jP(e,t=cr,n){return Array.from(e.querySelectorAll(`[${As}]`)).filter(r=>r!==n).map(r=>Rf(r,t)).some(Boolean)}function VP(e,t=cr,n){const r=Array.from(e.querySelectorAll(`[${As}]`)).filter(o=>o!==n&&Nr(o.textContent)==="");r.length&&t(()=>r.forEach(o=>o.remove()))}function GP(e,t=cr){const n=Nr(e.textContent);if(n==="")return null;const r=document.createTextNode(n);return e.before(r),t(()=>e.remove()),Lf(r,r.length),r}function Xv(e){if(!e.collapsed)return;const{startContainer:t}=e,n=Dt(t)?t:t.parentNode;Dt(n)&&(co(n.previousSibling)?e.setStartAfter(n):e.setStartBefore(n),e.collapse(!0))}function Kv(e){e.querySelectorAll(`[${As}]`).forEach(t=>{const n=Nr(t.textContent);n===""?t.remove():t.replaceWith(t.ownerDocument.createTextNode(n))})}function XP(e,t){const n=Nf(e,t);if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o&&ws(o,r),n}function KP(e,t){const n=Array.from(e.querySelectorAll("em-replace")).find(i=>co(i)&&t.intersectsNode(i)&&!Yv(t,i));if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o?.removeAllRanges(),o?.addRange(r),n}function Yv(e,t){const n=document.createRange();return n.selectNode(t),e.compareBoundaryPoints(e.START_TO_START,n)<=0&&e.compareBoundaryPoints(e.END_TO_END,n)>=0}function YP(){document.execCommand("delete")}function ZP(){const e=window.getSelection()?.getRangeAt(0);e?.deleteContents(),e?.collapse(!0)}function Zv(e,t=cr,n=YP){if(e.collapsed)return!1;const r=e.commonAncestorContainer,o=r.nodeType===Node.ELEMENT_NODE?r:r.parentElement;if(!Array.from(o?.querySelectorAll("em-replace")??[]).some(l=>co(l)&&Yv(e,l)))return!1;n();const i=window.getSelection();if(!i?.rangeCount)return!0;const{startContainer:s,startOffset:a}=i.getRangeAt(0);if(s.nodeType===Node.ELEMENT_NODE){const l=s.childNodes[a-1]??null,c=s.childNodes[a]??null;co(l)?Dl(l,"after",t):!l&&co(c)&&Dl(c,"before",t)}return!0}function Qv(){const e=window.getSelection();return e?.rangeCount?Nf(e.getRangeAt(0),"backward"):null}function QP(e,t=cr){const n=e.isConnected?e:Qv();if(!n)return;const r=n.closest('[contenteditable="true"]');It(()=>r?.focus({preventScroll:!0})),Dl(n,"after",t)}var Jv=Symbol("held-input-replay"),eE={insertText:"insertText",insertReplacementText:"insertText",deleteContentBackward:"delete",deleteContentForward:"forwardDelete",insertParagraph:"insertParagraph",insertLineBreak:"insertLineBreak",insertOrderedList:"insertOrderedList",insertUnorderedList:"insertUnorderedList",insertHorizontalRule:"insertHorizontalRule",formatBold:"bold",formatItalic:"italic",formatUnderline:"underline",formatStrikeThrough:"strikeThrough",formatSuperscript:"superscript",formatSubscript:"subscript",formatJustifyLeft:"justifyLeft",formatJustifyCenter:"justifyCenter",formatJustifyRight:"justifyRight",formatJustifyFull:"justifyFull",formatIndent:"indent",formatOutdent:"outdent",formatRemove:"removeFormat"},tE={deleteWordBackward:["backward","word"],deleteWordForward:["forward","word"],deleteSoftLineBackward:["backward","lineboundary"],deleteSoftLineForward:["forward","lineboundary"],deleteHardLineBackward:["backward","paragraphboundary"],deleteHardLineForward:["forward","paragraphboundary"]};function JP(e){return e in eE||e in tE}var eI={Backspace:["deleteContentBackward","deleteWordBackward","deleteSoftLineBackward"],Delete:["deleteContentForward","deleteWordForward","deleteSoftLineForward"]},nE={ArrowLeft:["backward","character","word"],ArrowRight:["forward","character","word"],ArrowUp:["backward","line","paragraphboundary"],ArrowDown:["forward","line","paragraphboundary"],Home:["backward","lineboundary","documentboundary"],End:["forward","lineboundary","documentboundary"]};function Mf(){return/Mac/.test(window.navigator.platform)}function rE(e){return Mf()?e.altKey:e.ctrlKey}function tI(e){const t=e.ctrlKey||e.metaKey;return t&&/^[cxv]$/i.test(e.key)||e.key==="Insert"&&(t||e.shiftKey)}function nI(e){return e.key in nE||(e.ctrlKey||e.metaKey)&&e.key.length===1&&!tI(e)}function Pf(e){return Jv in e}function If(e){return e.target?.closest?.('[contenteditable="true"], editor')??void 0}function oE(e){if(e.key.length===1&&!e.metaKey&&(!e.ctrlKey||e.altKey))return"insertText";if(e.key==="Enter"&&!e.ctrlKey&&!e.metaKey&&!e.altKey)return e.shiftKey?"insertLineBreak":"insertParagraph";const t=eI[e.key];if(t)return Mf()&&e.metaKey?t[2]:rE(e)?t[1]:t[0]}function rI(e){const t=nE[e.key];if(!t)return;const n=Mf()&&e.metaKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")?"lineboundary":rE(e)?t[2]:t[1];document.getSelection()?.modify?.(e.shiftKey?"extend":"move",t[0],n)}function Df(e){return Object.defineProperty(e,Jv,{value:!0}),e}function iE(e,t){return e.isConnected&&t<=(e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length)}function sE(e){if(!iE(e.startContainer,e.startOffset)||!iE(e.endContainer,e.endOffset))return;const t=document.createRange();return t.setStart(e.startContainer,e.startOffset),t.setEnd(e.endContainer,e.endOffset),t.toString()}function oI(e,t){return t===void 0||sE(e)!==t?!1:(document.getSelection()?.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),!0)}function iI({inputType:e,data:t}){const n=tE[e];if(n){const o=document.getSelection();o?.isCollapsed&&o.modify?.("extend",n[0],n[1]),lr(n[0]==="backward"?"delete":"forwardDelete");return}const r=eE[e];r&&lr(r,!1,t??void 0)}function aE(e,t){if(t.target&&!oI(t.target,t.targetText))return;const{inputType:n,data:r}=t,o=Df(new window.InputEvent("beforeinput",{inputType:n,data:r,bubbles:!0,cancelable:!0}));e.dispatchEvent(o)&&iI(t)}function sI(e,t){const n=Df(new window.KeyboardEvent("keydown",{...t,bubbles:!0,cancelable:!0}));if(Object.defineProperty(n,"keyCode",{value:t.keyCode}),!e.dispatchEvent(n))return;const r=oE(t);r?aE(e,{inputType:r,data:r==="insertText"?t.key:null}):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a"?lr("selectAll"):rI(t)}var aI='[contenteditable="true"], editor';function Bf(e){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement)?.closest(aI)??void 0}function lI(){const e=document.getSelection();if(!e?.rangeCount||!e.anchorNode||!e.focusNode||!ft())return;const t=at(),n=t.pointToOffset({node:e.anchorNode,offset:e.anchorOffset}),r=t.pointToOffset({node:e.focusNode,offset:e.focusOffset});return n===void 0||r===void 0?void 0:{anchor:t.trackOffset(n),focus:t.trackOffset(r)}}function lE(e){e?.anchor.release(),e?.focus.release()}function cE({node:e}){const t=e.nodeType===Node.ELEMENT_NODE?e:e.parentElement,n=e.nodeType===Node.TEXT_NODE&&/^\s*$/.test(e.data)&&/\n/.test(e.data);return e.isConnected&&!!Bf(e)&&!n&&!t?.closest("em-replace, [data-em-caret]")}function uE(e){const t=e.current(),n=t===void 0||!ft()?void 0:at().offsetToPoint(t);return n&&cE(n)?n:void 0}function cI(e){const t=e&&uE(e.anchor),n=e&&uE(e.focus);if(!(!t||!n))return document.getSelection()?.setBaseAndExtent(t.node,t.offset,n.node,n.offset),Bf(t.node)}function uI(){const e=document.getSelection(),t=e?.rangeCount?e.anchorNode:null;return t&&cE({node:t})?Bf(t):void 0}function dI(e){const t=cI(e)??uI();return t}function Bl(e,t){const n=lI(),r=e(()=>{ft()&&at().flushCommit();const o=dI(n);lE(n),o&&t(o)});return r||lE(n),r}function Hf(e){e.preventDefault(),e.stopImmediatePropagation()}function fI(e){return/^(Tab|Escape|PageUp|PageDown|F\d{1,2})$/.test(e.key)||e.key==="Enter"&&(e.ctrlKey||e.metaKey)}var dE=e=>{if(!If(e)||Pf(e)||e.isComposing||e.keyCode===229)return;const{key:t,code:n,keyCode:r,shiftKey:o,ctrlKey:i,metaKey:s,altKey:a}=e,l={key:t,code:n,keyCode:r,shiftKey:o,ctrlKey:i,metaKey:s,altKey:a},c=u=>sI(u,l);oE(l)?yf()&&Bl(bf,c)&&Hf(e):nI(l)?Nv()&&Bl(kv,c)&&Hf(e):fI(l)&&Nv()&&xv()},fE=()=>{xv()},mE=e=>{if(!If(e)||!JP(e.inputType)||e.isComposing||Pf(e)||!yf())return;const t=e.inputType==="insertReplacementText",n=t?e.getTargetRanges?.()[0]:void 0;if(t&&!n)return;const r={inputType:e.inputType,data:t&&e.dataTransfer?.getData("text/plain")||e.data,target:n,targetText:n&&sE(n)};Bl(bf,o=>aE(o,r))&&Hf(e)};function mI(e){return"clipboardData"in e?e.clipboardData:e.dataTransfer}var hI=["text/html","text/plain"];function pI(e,t){const n=Array.from(t.types??[]),r=Object.fromEntries(hI.filter(o=>n.includes(o)).map(o=>[o,t.getData(o)]));return Df({target:e.target,clipboardData:{types:Object.keys(r),files:[],getData:o=>r[o]??""},preventDefault:()=>{},stopPropagation:()=>{}})}function gI(e,t){if(Pf(e)||!yf()||!If(e))return!1;try{const n=mI(e);if(!n||n.files?.length)return!1;const r=pI(e,n);if(!Bl(bf,()=>t(r)))return!1}catch{return e.preventDefault(),!1}return e.preventDefault(),e.stopPropagation(),!0}function bI(){return window.addEventListener("keydown",dE,!0),window.addEventListener("beforeinput",mE,!0),window.addEventListener("pointerdown",fE,!0),{dispose(){window.removeEventListener("keydown",dE,!0),window.removeEventListener("beforeinput",mE,!0),window.removeEventListener("pointerdown",fE,!0)}}}function yI(e,t){const n=t==="sup"?"sub":"sup";e.querySelectorAll(`${t}, ${n}`).forEach(r=>{const o=r.parentNode;if(o){for(;r.firstChild;)o.insertBefore(r.firstChild,r);r.remove()}})}function hE(e,t,n){const r=document.createElement(n);try{if(typeof t=="string")r.textContent=t||e.toString();else if(t instanceof DocumentFragment)r.appendChild(t);else if(t instanceof HTMLElement)for(;t.firstChild;)r.appendChild(t.firstChild);else r.textContent=e.toString();e.deleteContents(),e.insertNode(r)}catch{return null}return r}function vI(e){const t=e.parentNode;if(!t)return document.createTextNode("");if(Array.from(e.childNodes).some(n=>n.nodeType===1)){const n=document.createDocumentFragment(),r=Array.from(e.childNodes);for(;e.firstChild;)n.appendChild(e.firstChild);return t.replaceChild(n,e),r[0]||document.createTextNode("")}else{const n=e.textContent||"",r=document.createTextNode(n);return t.replaceChild(r,e),r}}function EI(e,t,n){if(!e)return!1;const r=e.textContent?.trim()||"";let o="";if(n){const i=t.cloneRange(),s=i;try{s.expand&&s.expand("word"),o=i.toString().trim()}catch{return!1}}else o=t.toString().trim();return r===o}function SI(e,t){const n=e.textContent||"",r=t.toString(),o=t.startOffset,i=t.endOffset,s=document.createTextNode(n.slice(0,o)),a=document.createTextNode(r),l=document.createTextNode(n.slice(i)),c=e.parentNode;return c&&(c.insertBefore(s,e),c.insertBefore(a,e),l.textContent&&c.insertBefore(l,e),e.remove()),t.setStart(a,0),t.setEnd(a,a.length),a}function wI(e,t=[]){const n=[...new Set(["strong","em","b","i","u","sub","sup","strike",...t])].join(", ");e.querySelectorAll(n).forEach(r=>{!r.textContent?.trim()&&(!r.hasChildNodes()||Array.from(r.childNodes).every(o=>o.nodeType===Node.TEXT_NODE&&!o.textContent?.trim()))&&r.remove()})}function pE(e,t=10){const n=e.length;return n===0?!1:(e.match(/[а-яА-ЯёЁ]/g)||[]).length/n*100>t}var _I={bold:"strong|s|b",italic:"em|i",strike:"strike",underline:"u",strikeUnderline:"strike|u"};function ks(e,t){const n=_I[t]||t,r=new RegExp(`<\\/?(${n})>`,"gi");return e.replaceAll(r,"")}var CI=["strong","em","strike","sub","sup","b","i","s","u"];function TI(e,t){if(t)for(const n of CI)t.closest(n)&&e.querySelectorAll(n).forEach(r=>{const o=r.parentNode;if(o){for(;r.firstChild;)o.insertBefore(r.firstChild,r);r.remove()}})}function AI(e,t){t&&t.closest("a")&&e.querySelectorAll("a").forEach(n=>{const r=n.parentNode;if(r){for(;n.firstChild;)r.insertBefore(n.firstChild,n);n.remove()}})}var Tne="#1C52DC",Ane="#1C52DC",kne="#1C52DC";function kI(e){if(typeof e.isContentEditable=="boolean")return e.isContentEditable;const t=e.closest("[contenteditable]");return!!t&&t.getAttribute("contenteditable")!=="false"}function gE(e,t,n,r){const o=document.createRange();return o.selectNodeContents(e),r?o.setStart(t,n):o.setEnd(t,n),o.toString()!==""||!!o.cloneContents().querySelector("br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object")}function LI(e){const{startContainer:t,startOffset:n}=e,r=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest("a"),o=r?.parentElement;if(!e.collapsed||!r?.textContent||!o||!kI(o))return;const{display:i}=getComputedStyle(r);if(!(i&&i!=="inline")){if(!gE(r,t,n,!0))e.setStartAfter(r);else if(!gE(r,t,n,!1))e.setStartBefore(r);else return;e.collapse(!0)}}var NI="./js/sanitize-html/sanitize-html.js",bE="data-sanitize-html-loader",Hl=null,Ls=null;function yE(){return typeof __useblocks__<"u"?__useblocks__:void 0}function xI(e){const t=yE();if(typeof t?.moduleTransport!="function"||t.blobBlocked)return null;try{return t.moduleTransport(e)}catch{return null}}function OI(){const e=yE();e&&(e.blobBlocked=!0)}function RI(){return new URL(NI,document.baseURI||window.location.href).href}function Ff(){const e=globalThis.sanitizeHtml;return typeof e!="function"||!("defaults"in e)?null:e}function MI(){if(Ff())return Promise.resolve();const e=RI();return document.querySelector(`script[${bE}]`)?Ls??Promise.resolve():(Ls||(Ls=PI(e).catch(t=>{throw Ls=null,t})),Ls)}async function PI(e){const t=xI(e);if(!t)return Fl(e);const n=await t.catch(()=>null);if(!n)return Fl(e);const r=URL.createObjectURL(n),o=await Fl(r).then(()=>!0,()=>!1);URL.revokeObjectURL(r),o||(OI(),await Fl(e))}function Fl(e){return new Promise((t,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,r.setAttribute(bE,"true"),r.onload=()=>t(),r.onerror=()=>{r.remove(),n(new Error(`Failed to load sanitize-html script: ${e}`))},document.head.appendChild(r)})}async function vE(){const e=Ff();return e||(Hl||(Hl=(async()=>{await MI();const t=Ff();if(t)return t;throw new Error("sanitizeHtml not available after script load")})().catch(t=>{throw Hl=null,t})),Hl)}function $l(e){return e?.nodeType===Node.TEXT_NODE}function II(e,t,n){if(t?.nodeType===Node.TEXT_NODE)return e.includes(t)?{text:t,offset:n}:null;if(!t||t!==e[0]?.parentNode)return null;const r=t.childNodes[n-1];if(r?.nodeType===Node.TEXT_NODE&&e.includes(r))return{text:r,offset:r.length};const o=t.childNodes[n];return o?.nodeType===Node.TEXT_NODE&&e.includes(o)?{text:o,offset:0}:null}function EE(e,t,n,r){const o=II(e,n,r);if(!o)return null;let i=o.text,s=0;for(;i!==t&&i.previousSibling?.nodeType===Node.TEXT_NODE;)i=i.previousSibling,s+=i.length;return{head:i,offset:s+o.offset}}function SE(e,t,n,r){return e.node===t&&e.offset>n?{...e,offset:e.offset-r}:e}function $f(e,t,n=()=>"letter"){const r=e?.previousSibling,o=t?.nextSibling,i=$l(r)&&n(r)==="letter",s=i&&$l(e),a=$l(t)&&$l(o)&&(n(o)==="letter"||i&&n(o)==="new");if(!s&&!a)return;const l=window.getSelection(),c=s?r:e,u=a?o:t;if(!c||!u)return;const d=[];for(let E=c;E;E=E===u?null:E.nextSibling)d.push(E);const f=c.parentNode,h=Array.prototype.indexOf.call(f?.childNodes??[],u),m={node:l?.anchorNode??null,offset:l?.anchorOffset??0},p={node:l?.focusNode??null,offset:l?.focusOffset??0},v=EE(d,c,m.node,m.offset),C=EE(d,c,p.node,p.offset);let k=null,L=0;for(let E=c;E;){const g=E===u?null:E.nextSibling;E.nodeType!==Node.TEXT_NODE?k=null:k?(k.appendData(E.data),E.parentNode?.removeChild(E),L++):k=E,E=g}if(l&&(v||C)){const E=v?{node:v.head,offset:v.offset}:SE(m,f,h,L),g=C?{node:C.head,offset:C.offset}:SE(p,f,h,L);E.node&&g.node&&l.setBaseAndExtent(E.node,E.offset,g.node,g.offset)}}var DI=["strong","em","i","a","br","span","ul","ol","li","strike","sub","sup","s"],BI={a:["href"],span:["data-font-size","data-bold","data-italic"],strong:["data-italic"],ul:["data-list-type"],ol:["data-list-type","data-list-start"],li:["data-list-item"]};function HI(e){const t=/^\s*(\d+(?:\.\d+)?)(px|pt|em)?\s*$/i.exec(e??"");return t?`${t[1]}${(t[2]||"px").toLowerCase()}`:null}var FI=/<span\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,$I=/\sdata-(?:buffer|metadata)=(?:"[^"]*"|'[^']*')/gi;function WI(e){return e.replace(FI,t=>t.replace($I,""))}function qI(e){const t=window.clipboardData;return("clipboardData"in e?e.clipboardData:e.dataTransfer)||t}function zI(e){return UI(e.replace(/\r\n?/g,`
|
|
31
31
|
`).replace(/\n$/,"").replace(/&/g,"&").replace(/\n/g,"<br>"))}function UI(e){const t=new DOMParser().parseFromString(`<body>${e}`,"text/html").body;return t.querySelectorAll("script").forEach(n=>n.remove()),t.querySelectorAll("*").forEach(n=>{Array.from(n.attributes).forEach(r=>{/^on/i.test(r.name)&&n.removeAttribute(r.name)})}),t.innerHTML}var xr=new Map,jI=3e3,VI=1e4;function GI(){const e=performance.now();return[...xr.values()].some(t=>t.waiting&&e-t.startedAt<VI)}function XI(){for(const[e,t]of xr)t.waiting&&(t.superseded=!0,xr.delete(e))}function KI(){return xr.size>0}async function YI(){let e;const t=new Promise(r=>{e=setTimeout(()=>{r()},jI)}),n=(async()=>{for(;xr.size;)await Promise.allSettled(xr.keys())})();await Promise.race([n,t]),clearTimeout(e)}function Wl(e,t=!1,n,r,o){if(gI(e,a=>{Wl(a,t,n,r,o)}))return Promise.resolve();if(GI())return e.preventDefault(),e.stopPropagation(),Promise.resolve();XI();const i={startedAt:performance.now(),waiting:!0,superseded:!1},s=ZI(e,t,n,r,o,i);return xr.set(s,i),s.finally(()=>xr.delete(s))}function wE(){const e=window.getSelection();e?.rangeCount&&LI(e.getRangeAt(0))}async function ZI(e,t,n,r,o,i){e.preventDefault(),e.stopPropagation();const s=qI(e);if(!s)return;const a=s.getData("text/html"),l=s.getData("text/plain");try{let c=a;if(!c||t)wE(),c=zI(l);else{const d=await vE();if(i.superseded)return;wE();const f=n?.text?.fontSize||16;let h=d(WI(c),{allowedTags:DI,allowedAttributes:BI,allowedStyles:{},transformTags:{span:function(E,g){let y="",w=!1,b=!1;if(g.style){const S=g.style.toLowerCase();(S.includes("font-weight: bold")||S.includes("font-weight:bold")||S.includes("font-weight: 700")||S.includes("font-weight:700"))&&(w=!0),(S.includes("font-style: italic")||S.includes("font-style:italic"))&&(b=!0),S.includes("text-decoration: underline")||S.includes("text-decoration:underline"),w&&b?(y="strong",g["data-italic"]="true"):w?y="strong":b&&(y="em")}return{tagName:y||"",attribs:g}},h1:function(E,g){return g["data-font-size"]=Math.round(1.5*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h2:function(E,g){return g["data-font-size"]=Math.round(1.25*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h3:function(E,g){return g["data-font-size"]=Math.round(1.125*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h4:function(E,g){return g["data-font-size"]=f.toString(),g["data-bold"]="true",g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},h5:function(E,g){return g["data-font-size"]=Math.round(.875*f).toString(),g.style&&(g.style.toLowerCase().includes("font-style: italic")||g.style.toLowerCase().includes("font-style:italic"))&&(g["data-italic"]="true"),{tagName:"span",attribs:g}},ul:function(E,g){return g["data-list-type"]="unordered",delete g.style,delete g["margin-top"],delete g["margin-bottom"],delete g["padding-inline-start"],{tagName:"ul",attribs:g}},ol:function(E,g){return g["data-list-type"]="ordered",g.start&&(g["data-list-start"]=g.start),delete g.style,delete g.start,{tagName:"ol",attribs:g}},li:function(E,g){return g["data-list-item"]="true",delete g.style,delete g.dir,delete g["aria-level"],delete g["list-style-type"],{tagName:"li",attribs:g}},p:function(E,g){return{tagName:"br",attribs:{}}},div:"br",b:function(E,g){if(g.style){const y=g.style.toLowerCase();return y.includes("font-weight: bold")||y.includes("font-weight:bold")||y.includes("font-weight: 700")||y.includes("font-weight:700")?{tagName:"strong"}:!1}return{tagName:"strong"}},i:function(E,g){if(g.style){const y=g.style.toLowerCase();return y.includes("font-style: italic")||y.includes("font-style:italic")?{tagName:"em"}:!1}return{tagName:"em"}},s:function(E,g){return{tagName:"strike",attribs:g}}},textFilter:function(E){return E.replace(/\s+/g," ")}});h=h.replace(/<[^\/>][^>]*>\s*<\/[^>]+>/g,"").replace(/(<br\s*\/?>){2,}/g,"<br>").trim();const m=document.createElement("div");m.innerHTML=h,(E=>{E.querySelectorAll("ul[data-list-type], ol[data-list-type]").forEach((g,y)=>{const w=g.getAttribute("data-list-type")==="ordered",b=g.querySelectorAll("li[data-list-item]");let S=1;w&&g.getAttribute("data-list-start")&&(S=parseInt(g.getAttribute("data-list-start"),10)||1);const _=document.createDocumentFragment(),T=g.previousSibling;T&&(T.nodeType===Node.TEXT_NODE&&T.textContent.trim()!==""||T.nodeType===Node.ELEMENT_NODE&&T.tagName!=="BR")&&_.appendChild(document.createElement("br")),b.forEach((x,N)=>{const I=document.createElement("span");I.innerHTML=w?`${S}. `:"• ",_.appendChild(I),(M=>{const V=document.createElement("div");V.innerHTML=M.innerHTML;let K=V.firstChild;for(;K&&K.nodeType===1&&K.tagName==="BR";)V.removeChild(K),K=V.firstChild;if(!V.hasChildNodes()){const se=document.createTextNode("");V.appendChild(se)}for(;V.firstChild;)_.appendChild(V.firstChild)})(x),N<b.length-1&&_.appendChild(document.createElement("br")),S++}),g.parentNode.replaceChild(_,g)}),E.querySelectorAll("[data-list-type], [data-list-item], [data-list-start]").forEach(g=>{g.removeAttribute("data-list-type"),g.removeAttribute("data-list-item"),g.removeAttribute("data-list-start")})})(m),m.firstChild&&m.firstChild.nodeType===Node.ELEMENT_NODE&&m.firstChild.tagName==="BR"&&m.removeChild(m.firstChild),m.querySelectorAll("[data-font-size]").forEach(E=>{const g=HI(E.getAttribute("data-font-size"));let y=g?`font-size: ${g};`:"";E.getAttribute("data-bold")==="true"&&(y+=" font-weight: bold;"),E.getAttribute("data-italic")==="true"&&(y+=" font-style: italic;"),y&&E.setAttribute("style",y.trim()),E.removeAttribute("data-font-size"),E.removeAttribute("data-bold"),E.removeAttribute("data-italic")}),m.querySelectorAll("[data-italic]").forEach(E=>{const g=document.createElement("em");g.innerHTML=E.innerHTML,E.innerHTML="",E.appendChild(g),E.removeAttribute("data-italic")}),m.querySelectorAll("a").forEach(E=>{const g=E.getAttribute("href");if(!g||g.trim()==="")E.replaceWith(...E.childNodes);else{E.setAttribute("target","_blank");const y=n?.links?.color??"#1C52DC",w=n?.links?.underline??!0?"underline":"none";E.setAttribute("style",`color: ${y}; text-decoration: ${w};`)}});const v=m.querySelectorAll("*");let C=0;v.forEach(E=>{E.tagName!=="BR"&&E.tagName!=="SPAN"&&E.textContent.replace(/[\u200B-\u200F\uFEFF\u2000-\u200A\u2028\u2029\u2060\u00A0\u1680\u180E]/g,"").trim()===""&&(E.parentNode.removeChild(E),C++)}),m.querySelectorAll("span").forEach(E=>{E.innerHTML==="• "||/^\d+\. $/.test(E.innerHTML)||E.textContent.replace(/[\u200B-\u200F\uFEFF\u2000-\u200A\u2028\u2029\u2060\u00A0\u1680\u180E]/g,"").trim()===""&&E.children.length===0&&(E.parentNode.removeChild(E),C++)});const k=window.getSelection(),L=k?.anchorNode?.nodeType===Node.ELEMENT_NODE?k.anchorNode:k?.anchorNode?.parentElement||null;TI(m,L),AI(m,L),c=m.innerHTML}const u=window.getSelection();if(u&&u.rangeCount>0){const d=u.getRangeAt(0);Xv(d),d.deleteContents();const f=document.createRange().createContextualFragment(c),h=f.firstChild,m=f.lastChild;d.insertNode(f),m?.nodeType===Node.TEXT_NODE&&d.setEnd(m,m.length),d.collapse(!1),$f(h,m,wf)}}catch{if(i.superseded)return;lr("insertText",!1,l)}i.waiting=!1,r(e),o(),await new Promise(c=>setTimeout(c,0))}var ql=e=>e?.trim().replaceAll(/[\s\u00A0]+/g," ").replaceAll(/\n/g,"");function _E(e){let t=e;for(;t;){if(t.tagName==="TR")return t;t=t.parentElement}return null}function uo(e,t){return Array.from(e.classList).find(n=>n.includes(t))}function CE(e){return!e||!e.childNodes?!1:Array.from(e.childNodes).every(t=>t.nodeType===Node.TEXT_NODE?(t.textContent?.trim()??"")!=="":t.nodeType===Node.ELEMENT_NODE?CE(t):!1)}function B(e){const t=document.createElement(e.tag||"div");if(t.setAttribute("contentEditable","false"),e.width&&(t.style.width=e.width+"px"),e.height&&(t.style.height=e.height+"px"),e.left&&(t.style.left=e.left+"px"),e.top&&(t.style.top=e.top+"px"),e.className&&(t.className=e.className),e.style&&t.setAttribute("style",e.style),e.HTMLcontent&&(t.innerHTML=e.HTMLcontent),e.title&&t.setAttribute("title",e.title),e["data-id"]&&t.setAttribute("data-id",e["data-id"]),e.targetElement){const n=typeof e.targetElement=="string"?document.querySelector(e.targetElement):e.targetElement;if(n)switch(e.insertType){case"append":n.append(t);break;case"prepend":n.prepend(t);break;case"before":n.before(t);break;case"after":n.after(t);break;case"replaceWith":n.replaceWith(t)}}return t}function QI(e){try{return JSON.parse(e),!0}catch{return!1}}function TE(e,t,n=2){const r=e.split(""),o=t.split("");if(Math.abs(r.length-o.length)>n)return!1;let i=0;if(r.length===o.length){for(let s=0;s<r.length;s++)if(r[s]!==o[s]&&(i++,i>n))return!1}else{const s=r.length>o.length?r:o,a=r.length>o.length?o:r;let l=0,c=0;for(;l<s.length&&c<a.length;)if(s[l]!==a[c]){if(i++,i>n)return!1;l++}else l++,c++;if(l<s.length&&i++,i>1)return!1}return!0}function Jo(e){const t=window.getSelection();t&&(t.removeAllRanges(),t.addRange(e))}function JI(e){const t=e.style?.fontWeight;if(typeof t=="number")return t>=600;if(typeof t=="string"){const n=t.toLowerCase();return n.includes("bold")||n.includes("black")||parseInt(n)>=600}return!1}function zl(){const e=window.getSelection();if(!e||e.rangeCount===0)return null;const t=e.getRangeAt(0).commonAncestorContainer;return t.nodeType===1?t:t.parentElement}function Wf(e,t=null){const n=e?.innerText;for(;e!==null;){if(e.innerText===n){const r=e.parentElement;if(r===null||r.innerText!==n||r.tagName==="EDITOR"||e.tagName===t?.toUpperCase())return e.tagName===t?.toUpperCase()||!t?e:null}e=e.parentElement}return null}function Ns(e,t=zl()){e=ql(e)??"";const n=i=>ql(i?.textContent||"")??"",r=Array.from(t?.childNodes||[]).filter(i=>!!i&&i.nodeName!=="BR");let o=null;if(t&&t.nodeType===Node.TEXT_NODE&&n(t).includes(e)&&n(t)===e)return t;for(let i=0;i<r.length;i++){const s=r[i];if(s.nodeType===Node.TEXT_NODE&&n(s).includes(e)&&n(s)===e){o=s.parentNode;break}else if(s.nodeType===Node.ELEMENT_NODE&&(o=Ns(e,s),o))break}return o}function Ul(e){const t=Array.from(e),n=t.map(i=>i.clientWidth),r=n.reduce((i,s)=>i+s,0),o=n.map(i=>((i||0)/r*100).toFixed(1));t.forEach((i,s)=>{i.setAttribute("data-percent",o[s])})}function jl(e){e.elem.nodeName==="#comment"&&e.elem.textContent&&e.elem.textContent.indexOf("mso")>-1?e.elem.textContent=e.elem.textContent.replace(/width=".*"/gi,`width="${e.width}"`):e.elem.previousSibling&&jl({elem:e.elem.previousSibling,width:e.width})}function e5(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";let o=0;for(;o<e;)t+=n.charAt(Math.floor(Math.random()*62)),o+=1;return t}var t5=e=>{if(e instanceof Text)return e.textContent||"";if(e instanceof Element){if(e.tagName==="BR")return`
|
|
32
|
-
`;if(e.classList?.contains(".em-element-path"))return"";if(e.classList?.contains("em-code"))return"⃠";if(e.tagName==="EM-REPLACE")return"⃡"}};function AE(e,t){if(!e)return"";const n=t(e);return n===void 0?[...e.childNodes].map(r=>AE(r,t)).join(""):n}function n5(e,t,n,r){e.setAttribute("style",n?.getAttribute("style")||t.getAttribute("innerStyle")||t.getAttribute("style")||""),e.style.color=r(e.style.color)??"",e.style.backgroundColor=r(e.style.backgroundColor)??"";const o=t.getAttribute("innerClass");o&&(e.className=o);const i=t.getAttribute("innerHref"),s=t.getAttribute("href"),a=n.getAttribute("href");(i!==null||s!==null||a!==null)&&(t.tagName==="A"||n.tagName==="A")&&e.setAttribute("href",i??s??a??"");const l=t.getAttribute("innerTarget");l&&e.setAttribute("target",l);const c=t.getAttribute("innerAlign");c&&e.setAttribute("align",c);const u=n.hasAttribute("em-edit")?n:n.querySelector("[em-edit]");u&&e.setAttribute("em-edit",u.getAttribute("em-edit")||"")}function r5(e,t=!0){const n=document.createRange(),r=window.getSelection();r&&(n.selectNodeContents(e),n.collapse(t),r.removeAllRanges(),r.addRange(n))}function o5(e){let t=!1;return e&&e.childNodes.forEach(n=>{if(n.nodeType===Node.TEXT_NODE&&n.nodeValue?.trim()!==""){const r=n.nodeValue?.trim()||"";/[a-zA-Zа-яА-Я]/.test(r)&&(t=!0)}}),t}function xs(){return yM()}function i5(e,t=!1){if(e.closest("EDITOR")||!e.isConnected)return!0;let n=!1;if(!t)for(const r of Array.from(e.childNodes))if(r.tagName==="EDITOR"){if(n)return!1;n=!0}else return!1;return n}function kE(e,t){if(e instanceof Text){const n=e.textContent,r=n;n!==r&&e.replaceWith(...t(r||""))}else if(e instanceof Element){const n=[...e.childNodes];if(e.tagName==="EDITOR")e.replaceWith(...n);else if(e.tagName==="SPAN"&&e.classList.contains("mce-nbsp-wrap"))return;for(const r of n)kE(r,t)}}function s5(e=document){e.querySelectorAll('[em-edit="active"]').forEach(t=>t.removeAttribute("em-edit"))}function G(e){if(a5(e))return l5(e)?e.trim():c5(e)}var LE={RGB:/^rgba?\s*\(\s*(?<r>\d+)\s*,\s*(?<g>\d+)\s*,\s*(?<b>\d+)\s*(?:,\s*(?<a>(?:0?\.)?\d+)\s*)?\)/i,HEX:/^\s*#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})\s*$/i},a5=e=>typeof e=="string"&&e.trim()!=="",l5=e=>LE.HEX.test(e);function c5(e){const t=LE.RGB.exec(e)?.groups;if(!t)return;const n=u5(t);return f5(n)}var u5=e=>({r:qf(e.r),g:qf(e.g),b:qf(e.b),a:d5(e.a)}),qf=e=>parseInt(e||"0",10),d5=e=>parseFloat(e||"1"),f5=e=>`#${zf(e.r)}${zf(e.g)}${zf(e.b)}`,zf=e=>e.toString(16).padStart(2,"0"),m5=0;function mt(e){return e>=48&&e<=57}function Or(e){return mt(e)||e>=65&&e<=70||e>=97&&e<=102}function Uf(e){return e>=65&&e<=90}function h5(e){return e>=97&&e<=122}function p5(e){return Uf(e)||h5(e)}function g5(e){return e>=128}function Vl(e){return p5(e)||g5(e)||e===95}function NE(e){return Vl(e)||mt(e)||e===45}function b5(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Gl(e){return e===10||e===13||e===12}function fo(e){return Gl(e)||e===32||e===9}function Bn(e,t){return!(e!==92||Gl(t)||t===m5)}function Xl(e,t,n){return e===45?Vl(t)||t===45||Bn(t,n):Vl(e)?!0:e===92?Bn(e,t):!1}function jf(e,t,n){return e===43||e===45?mt(t)?2:t===46&&mt(n)?3:0:e===46?mt(t)?2:0:mt(e)?1:0}function xE(e){return e===65279||e===65534?1:0}var Vf=new Array(128),Lne=128,Nne=130,xne=131,One=132,Rne=133;for(let e=0;e<Vf.length;e++)Vf[e]=fo(e)&&130||mt(e)&&131||Vl(e)&&132||b5(e)&&133||e||128;function Gf(e){return e<128?Vf[e]:132}function ei(e,t){return t<e.length?e.charCodeAt(t):0}function Xf(e,t,n){return n===13&&ei(e,t+1)===10?2:1}function ti(e,t,n){let r=e.charCodeAt(t);return Uf(r)&&(r=r|32),r===n}function Os(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let o=t;o<n;o++){const i=r.charCodeAt(o-t);let s=e.charCodeAt(o);if(Uf(s)&&(s=s|32),s!==i)return!1}return!0}function y5(e,t){for(;t>=0&&fo(e.charCodeAt(t));t--);return t+1}function Kl(e,t){for(;t<e.length&&fo(e.charCodeAt(t));t++);return t}function Kf(e,t){for(;t<e.length&&mt(e.charCodeAt(t));t++);return t}function ni(e,t){if(t+=2,Or(ei(e,t-1))){for(const r=Math.min(e.length,t+5);t<r&&Or(ei(e,t));t++);const n=ei(e,t);fo(n)&&(t+=Xf(e,t,n))}return t}function Yl(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!NE(n)){if(Bn(n,ei(e,t+1))){t=ni(e,t)-1;continue}break}}return t}function Zl(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),mt(n)&&(t=Kf(e,t+1),n=e.charCodeAt(t)),n===46&&mt(e.charCodeAt(t+1))&&(t+=2,t=Kf(e,t)),ti(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),mt(n)&&(t=Kf(e,t+1+r+1))}return t}function Yf(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(n===41){t++;break}Bn(n,ei(e,t+1))&&(t=ni(e,t))}return t}function OE(e){if(e.length===1&&!Or(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var RE=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"],v5=16384;function Ql(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,v5)):e}var ME=10,E5=12,PE=13;function IE(e){const t=e.source,n=t.length,r=t.length>0?xE(t.charCodeAt(0)):0,o=Ql(e.lines,n),i=Ql(e.columns,n);let s=e.startLine,a=e.startColumn;for(let l=r;l<n;l++){const c=t.charCodeAt(l);o[l]=s,i[l]=a++,(c===ME||c===PE||c===E5)&&(c===PE&&l+1<n&&t.charCodeAt(l+1)===ME&&(l++,o[l]=s,i[l]=a),s++,a=1)}o[n]=s,i[n]=a,e.lines=o,e.columns=i,e.computed=!0}var S5=class{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(e,t=0,n=1,r=1){this.source=e,this.startOffset=t,this.startLine=n,this.startColumn=r,this.computed=!1}getLocation(e,t){return this.computed||IE(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||IE(this),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}},on=16777215,Rr=24,w5=new Map([[2,22],[21,22],[19,20],[23,24]]),_5=class{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",t=()=>{}){e=String(e||"");const n=e.length,r=Ql(this.offsetAndType,e.length+1),o=Ql(this.balance,e.length+1);let i=0,s=0,a=0,l=-1;for(this.offsetAndType=null,this.balance=null,t(e,(c,u,d)=>{switch(c){default:o[i]=n;break;case s:{let f=a&on;for(a=o[f],s=a>>Rr,o[i]=f,o[f++]=i;f<i;f++)o[f]===n&&(o[f]=i);break}case 21:case 2:case 19:case 23:o[i]=a,s=w5.get(c),a=s<<Rr|i}r[i++]=c<<Rr|d,l===-1&&(l=u)}),r[i]=0<<Rr|n,o[i]=n,o[n]=n;a!==0;){const c=a&on;a=o[c],o[c]=n}this.source=e,this.firstCharOffset=l===-1?0:l,this.tokenCount=i,this.offsetAndType=r,this.balance=o,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e]>>Rr:0}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&on:this.source.length}lookupValue(e,t){return e+=this.tokenIndex,e<this.tokenCount?Os(this.source,this.offsetAndType[e-1]&on,this.offsetAndType[e]&on,t):!1}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&on:this.offsetAndType[this.tokenCount]&on:this.firstCharOffset}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,t){return t?this.lookupType(t)===9&&this.source.charCodeAt(this.lookupOffset(t))===e:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]&on,t=this.offsetAndType[t],this.tokenType=t>>Rr,this.tokenEnd=t&on):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>Rr,this.tokenEnd=e&on):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(e,t){let n=e,r,o;e:for(;n<this.tokenCount;n++){if(r=this.balance[n],r<e)break e;switch(o=n>0?this.offsetAndType[n-1]&on:this.firstCharOffset,t(this.source.charCodeAt(o))){case 1:break e;case 2:n++;break e;default:this.balance[r]===n&&(n=r)}}this.skip(n-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t<this.tokenCount;t++){const r=n,o=this.offsetAndType[t],i=o&on,s=o>>Rr;n=i,e(s,r,i,t)}}dump(){const e=new Array(this.tokenCount);return this.forEachToken((t,n,r,o)=>{e[o]={idx:o,type:RE[t],chunk:this.source.substring(n,r),balance:this.balance[o]}}),e}};function Jl(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=Zl(e,c),Xl(n(c),n(c+1),n(c+2))){u=12,c=Yl(e,c);return}if(n(c)===37){u=11,c++;return}u=10}function o(){const d=c;if(c=Yl(e,c),Os(e,d,c,"url")&&n(c)===40){if(c=Kl(e,c+1),n(c)===34||n(c)===39){u=2,c=d+4;return}s();return}if(n(c)===40){u=2,c++;return}u=1}function i(d){for(d||(d=n(c++)),u=5;c<e.length;c++){const f=e.charCodeAt(c);switch(Gf(f)){case d:c++;return;case 130:if(Gl(f)){c+=Xf(e,c,f),u=6;return}break;case 92:if(c===e.length-1)break;const h=n(c+1);Gl(h)?c+=Xf(e,c+1,h):Bn(f,h)&&(c=ni(e,c)-1)}}}function s(){for(u=7,c=Kl(e,c);c<e.length;c++){const d=e.charCodeAt(c);switch(Gf(d)){case 41:c++;return;case 130:if(c=Kl(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=Yf(e,c),u=8;return;case 34:case 39:case 40:case 133:c=Yf(e,c),u=8;return;case 92:if(Bn(d,n(c+1))){c=ni(e,c)-1;break}c=Yf(e,c),u=8;return}}}e=String(e||"");const a=e.length;let l=xE(n(0)),c=l,u;for(;c<a;){const d=e.charCodeAt(c);switch(Gf(d)){case 130:u=13,c=Kl(e,c+1);break;case 34:i();break;case 35:NE(n(c+1))||Bn(n(c+1),n(c+2))?(u=4,c=Yl(e,c+1)):(u=9,c++);break;case 39:i();break;case 40:u=21,c++;break;case 41:u=22,c++;break;case 43:jf(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 44:u=18,c++;break;case 45:jf(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(u=15,c=c+3):Xl(d,n(c+1),n(c+2))?o():(u=9,c++);break;case 46:jf(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 47:n(c+1)===42?(u=25,c=e.indexOf("*/",c+2),c=c===-1?e.length:c+2):(u=9,c++);break;case 58:u=16,c++;break;case 59:u=17,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(u=14,c=c+4):(u=9,c++);break;case 64:Xl(n(c+1),n(c+2),n(c+3))?(u=3,c=Yl(e,c+1)):(u=9,c++);break;case 91:u=19,c++;break;case 92:Bn(d,n(c+1))?o():(u=9,c++);break;case 93:u=20,c++;break;case 123:u=23,c++;break;case 125:u=24,c++;break;case 131:r();break;case 132:o();break;default:u=9,c++}t(u,l,l=c)}}var ri=null,je=class Rn{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return Rn.createItem(t)}allocateCursor(t,n){let r;return ri!==null?(r=ri,ri=ri.cursor,r.prev=t,r.next=n,r.cursor=this.cursor):r={prev:t,next:n,cursor:this.cursor},this.cursor=r,r}releaseCursor(){const{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=ri,ri=t}updateCursors(t,n,r,o){let{cursor:i}=this;for(;i!==null;)i.prev===t&&(i.prev=n),i.next===r&&(i.next=o),i=i.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let n=this.head;n!==null;n=n.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let r of t){const o=Rn.createItem(r);n!==null?n.next=o:this.head=o,o.prev=n,n=o}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,n=this){const r=this.allocateCursor(null,this.head);for(;r.next!==null;){const o=r.next;r.next=o.next,t.call(n,o.data,o,this)}this.releaseCursor()}forEachRight(t,n=this){const r=this.allocateCursor(this.tail,null);for(;r.prev!==null;){const o=r.prev;r.prev=o.prev,t.call(n,o.data,o,this)}this.releaseCursor()}reduce(t,n,r=this){let o=this.allocateCursor(null,this.head),i=n,s;for(;o.next!==null;)s=o.next,o.next=s.next,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}reduceRight(t,n,r=this){let o=this.allocateCursor(this.tail,null),i=n,s;for(;o.prev!==null;)s=o.prev,o.prev=s.prev,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}some(t,n=this){for(let r=this.head;r!==null;r=r.next)if(t.call(n,r.data,r,this))return!0;return!1}map(t,n=this){const r=new Rn;for(let o=this.head;o!==null;o=o.next)r.appendData(t.call(n,o.data,o,this));return r}filter(t,n=this){const r=new Rn;for(let o=this.head;o!==null;o=o.next)t.call(n,o.data,o,this)&&r.appendData(o.data);return r}nextUntil(t,n,r=this){if(t===null)return;const o=this.allocateCursor(null,t);for(;o.next!==null;){const i=o.next;if(o.next=i.next,n.call(r,i.data,i,this))break}this.releaseCursor()}prevUntil(t,n,r=this){if(t===null)return;const o=this.allocateCursor(t,null);for(;o.prev!==null;){const i=o.prev;if(o.prev=i.prev,n.call(r,i.data,i,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const t=new Rn;for(let n of this)t.appendData(n);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(Rn.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(Rn.createItem(t))}insert(t,n=null){if(n!==null)if(this.updateCursors(n.prev,t,n,t),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=t,n.prev=t,t.next=n,this.updateCursors(null,t)}else n.prev.next=t,t.prev=n.prev,n.prev=t,t.next=n;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,n){return this.insert(Rn.createItem(t),n)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(Rn.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(Rn.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,n){return t.head===null?this:(n!=null?(this.updateCursors(n.prev,t.tail,n,t.head),n.prev!==null?(n.prev.next=t.head,t.head.prev=n.prev):this.head=t.head,n.prev=t.tail,t.tail.next=n):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,n){"head"in n?this.insertList(n,t):this.insert(n,t),this.remove(t)}};function ec(e,t){const n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
|
|
32
|
+
`;if(e.classList?.contains(".em-element-path"))return"";if(e.classList?.contains("em-code"))return"⃠";if(e.tagName==="EM-REPLACE")return"⃡"}};function AE(e,t){if(!e)return"";const n=t(e);return n===void 0?[...e.childNodes].map(r=>AE(r,t)).join(""):n}function n5(e,t,n,r){e.setAttribute("style",n?.getAttribute("style")||t.getAttribute("innerStyle")||t.getAttribute("style")||""),e.style.color=r(e.style.color)??"",e.style.backgroundColor=r(e.style.backgroundColor)??"";const o=t.getAttribute("innerClass");o&&(e.className=o);const i=t.getAttribute("innerHref"),s=t.getAttribute("href"),a=n.getAttribute("href");(i!==null||s!==null||a!==null)&&(t.tagName==="A"||n.tagName==="A")&&e.setAttribute("href",i??s??a??"");const l=t.getAttribute("innerTarget");l&&e.setAttribute("target",l);const c=t.getAttribute("innerAlign");c&&e.setAttribute("align",c);const u=n.hasAttribute("em-edit")?n:n.querySelector("[em-edit]");u&&e.setAttribute("em-edit",u.getAttribute("em-edit")||"")}function r5(e,t=!0){const n=document.createRange(),r=window.getSelection();r&&(n.selectNodeContents(e),n.collapse(t),r.removeAllRanges(),r.addRange(n))}function o5(e){let t=!1;return e&&e.childNodes.forEach(n=>{if(n.nodeType===Node.TEXT_NODE&&n.nodeValue?.trim()!==""){const r=n.nodeValue?.trim()||"";/[a-zA-Zа-яА-Я]/.test(r)&&(t=!0)}}),t}function xs(){return yM()}function i5(e,t=!1){if(e.closest("EDITOR")||!e.isConnected)return!0;let n=!1;if(!t)for(const r of Array.from(e.childNodes))if(r.tagName==="EDITOR"){if(n)return!1;n=!0}else return!1;return n}function kE(e,t){if(e instanceof Text){const n=e.textContent,r=n;n!==r&&e.replaceWith(...t(r||""))}else if(e instanceof Element){const n=[...e.childNodes];if(e.tagName==="EDITOR")e.replaceWith(...n);else if(e.tagName==="SPAN"&&e.classList.contains("mce-nbsp-wrap"))return;for(const r of n)kE(r,t)}}function s5(e=document){e.querySelectorAll('[em-edit="active"]').forEach(t=>t.removeAttribute("em-edit"))}function G(e){if(a5(e))return l5(e)?e.trim():c5(e)}var LE={RGB:/^rgba?\s*\(\s*(?<r>\d+)\s*,\s*(?<g>\d+)\s*,\s*(?<b>\d+)\s*(?:,\s*(?<a>(?:0?\.)?\d+)\s*)?\)/i,HEX:/^\s*#(?:[0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})\s*$/i},a5=e=>typeof e=="string"&&e.trim()!=="",l5=e=>LE.HEX.test(e);function c5(e){const t=LE.RGB.exec(e)?.groups;if(!t)return;const n=u5(t);return f5(n)}var u5=e=>({r:qf(e.r),g:qf(e.g),b:qf(e.b),a:d5(e.a)}),qf=e=>Math.min(255,parseInt(e||"0",10)),d5=e=>parseFloat(e||"1"),f5=e=>`#${zf(e.r)}${zf(e.g)}${zf(e.b)}`,zf=e=>e.toString(16).padStart(2,"0"),m5=0;function mt(e){return e>=48&&e<=57}function Or(e){return mt(e)||e>=65&&e<=70||e>=97&&e<=102}function Uf(e){return e>=65&&e<=90}function h5(e){return e>=97&&e<=122}function p5(e){return Uf(e)||h5(e)}function g5(e){return e>=128}function Vl(e){return p5(e)||g5(e)||e===95}function NE(e){return Vl(e)||mt(e)||e===45}function b5(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Gl(e){return e===10||e===13||e===12}function fo(e){return Gl(e)||e===32||e===9}function Bn(e,t){return!(e!==92||Gl(t)||t===m5)}function Xl(e,t,n){return e===45?Vl(t)||t===45||Bn(t,n):Vl(e)?!0:e===92?Bn(e,t):!1}function jf(e,t,n){return e===43||e===45?mt(t)?2:t===46&&mt(n)?3:0:e===46?mt(t)?2:0:mt(e)?1:0}function xE(e){return e===65279||e===65534?1:0}var Vf=new Array(128),Lne=128,Nne=130,xne=131,One=132,Rne=133;for(let e=0;e<Vf.length;e++)Vf[e]=fo(e)&&130||mt(e)&&131||Vl(e)&&132||b5(e)&&133||e||128;function Gf(e){return e<128?Vf[e]:132}function ei(e,t){return t<e.length?e.charCodeAt(t):0}function Xf(e,t,n){return n===13&&ei(e,t+1)===10?2:1}function ti(e,t,n){let r=e.charCodeAt(t);return Uf(r)&&(r=r|32),r===n}function Os(e,t,n,r){if(n-t!==r.length||t<0||n>e.length)return!1;for(let o=t;o<n;o++){const i=r.charCodeAt(o-t);let s=e.charCodeAt(o);if(Uf(s)&&(s=s|32),s!==i)return!1}return!0}function y5(e,t){for(;t>=0&&fo(e.charCodeAt(t));t--);return t+1}function Kl(e,t){for(;t<e.length&&fo(e.charCodeAt(t));t++);return t}function Kf(e,t){for(;t<e.length&&mt(e.charCodeAt(t));t++);return t}function ni(e,t){if(t+=2,Or(ei(e,t-1))){for(const r=Math.min(e.length,t+5);t<r&&Or(ei(e,t));t++);const n=ei(e,t);fo(n)&&(t+=Xf(e,t,n))}return t}function Yl(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!NE(n)){if(Bn(n,ei(e,t+1))){t=ni(e,t)-1;continue}break}}return t}function Zl(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),mt(n)&&(t=Kf(e,t+1),n=e.charCodeAt(t)),n===46&&mt(e.charCodeAt(t+1))&&(t+=2,t=Kf(e,t)),ti(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),mt(n)&&(t=Kf(e,t+1+r+1))}return t}function Yf(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(n===41){t++;break}Bn(n,ei(e,t+1))&&(t=ni(e,t))}return t}function OE(e){if(e.length===1&&!Or(e.charCodeAt(0)))return e[0];let t=parseInt(e,16);return(t===0||t>=55296&&t<=57343||t>1114111)&&(t=65533),String.fromCodePoint(t)}var RE=["EOF-token","ident-token","function-token","at-keyword-token","hash-token","string-token","bad-string-token","url-token","bad-url-token","delim-token","number-token","percentage-token","dimension-token","whitespace-token","CDO-token","CDC-token","colon-token","semicolon-token","comma-token","[-token","]-token","(-token",")-token","{-token","}-token"],v5=16384;function Ql(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,v5)):e}var ME=10,E5=12,PE=13;function IE(e){const t=e.source,n=t.length,r=t.length>0?xE(t.charCodeAt(0)):0,o=Ql(e.lines,n),i=Ql(e.columns,n);let s=e.startLine,a=e.startColumn;for(let l=r;l<n;l++){const c=t.charCodeAt(l);o[l]=s,i[l]=a++,(c===ME||c===PE||c===E5)&&(c===PE&&l+1<n&&t.charCodeAt(l+1)===ME&&(l++,o[l]=s,i[l]=a),s++,a=1)}o[n]=s,i[n]=a,e.lines=o,e.columns=i,e.computed=!0}var S5=class{constructor(){this.lines=null,this.columns=null,this.computed=!1}setSource(e,t=0,n=1,r=1){this.source=e,this.startOffset=t,this.startLine=n,this.startColumn=r,this.computed=!1}getLocation(e,t){return this.computed||IE(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||IE(this),{source:n,start:{offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]},end:{offset:this.startOffset+t,line:this.lines[t],column:this.columns[t]}}}},on=16777215,Rr=24,w5=new Map([[2,22],[21,22],[19,20],[23,24]]),_5=class{constructor(e,t){this.setSource(e,t)}reset(){this.eof=!1,this.tokenIndex=-1,this.tokenType=0,this.tokenStart=this.firstCharOffset,this.tokenEnd=this.firstCharOffset}setSource(e="",t=()=>{}){e=String(e||"");const n=e.length,r=Ql(this.offsetAndType,e.length+1),o=Ql(this.balance,e.length+1);let i=0,s=0,a=0,l=-1;for(this.offsetAndType=null,this.balance=null,t(e,(c,u,d)=>{switch(c){default:o[i]=n;break;case s:{let f=a&on;for(a=o[f],s=a>>Rr,o[i]=f,o[f++]=i;f<i;f++)o[f]===n&&(o[f]=i);break}case 21:case 2:case 19:case 23:o[i]=a,s=w5.get(c),a=s<<Rr|i}r[i++]=c<<Rr|d,l===-1&&(l=u)}),r[i]=0<<Rr|n,o[i]=n,o[n]=n;a!==0;){const c=a&on;a=o[c],o[c]=n}this.source=e,this.firstCharOffset=l===-1?0:l,this.tokenCount=i,this.offsetAndType=r,this.balance=o,this.reset(),this.next()}lookupType(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e]>>Rr:0}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&on:this.source.length}lookupValue(e,t){return e+=this.tokenIndex,e<this.tokenCount?Os(this.source,this.offsetAndType[e-1]&on,this.offsetAndType[e]&on,t):!1}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&on:this.offsetAndType[this.tokenCount]&on:this.firstCharOffset}substrToCursor(e){return this.source.substring(e,this.tokenStart)}isBalanceEdge(e){return this.balance[this.tokenIndex]<e}isDelim(e,t){return t?this.lookupType(t)===9&&this.source.charCodeAt(this.lookupOffset(t))===e:this.tokenType===9&&this.source.charCodeAt(this.tokenStart)===e}skip(e){let t=this.tokenIndex+e;t<this.tokenCount?(this.tokenIndex=t,this.tokenStart=this.offsetAndType[t-1]&on,t=this.offsetAndType[t],this.tokenType=t>>Rr,this.tokenEnd=t&on):(this.tokenIndex=this.tokenCount,this.next())}next(){let e=this.tokenIndex+1;e<this.tokenCount?(this.tokenIndex=e,this.tokenStart=this.tokenEnd,e=this.offsetAndType[e],this.tokenType=e>>Rr,this.tokenEnd=e&on):(this.eof=!0,this.tokenIndex=this.tokenCount,this.tokenType=0,this.tokenStart=this.tokenEnd=this.source.length)}skipSC(){for(;this.tokenType===13||this.tokenType===25;)this.next()}skipUntilBalanced(e,t){let n=e,r,o;e:for(;n<this.tokenCount;n++){if(r=this.balance[n],r<e)break e;switch(o=n>0?this.offsetAndType[n-1]&on:this.firstCharOffset,t(this.source.charCodeAt(o))){case 1:break e;case 2:n++;break e;default:this.balance[r]===n&&(n=r)}}this.skip(n-this.tokenIndex)}forEachToken(e){for(let t=0,n=this.firstCharOffset;t<this.tokenCount;t++){const r=n,o=this.offsetAndType[t],i=o&on,s=o>>Rr;n=i,e(s,r,i,t)}}dump(){const e=new Array(this.tokenCount);return this.forEachToken((t,n,r,o)=>{e[o]={idx:o,type:RE[t],chunk:this.source.substring(n,r),balance:this.balance[o]}}),e}};function Jl(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=Zl(e,c),Xl(n(c),n(c+1),n(c+2))){u=12,c=Yl(e,c);return}if(n(c)===37){u=11,c++;return}u=10}function o(){const d=c;if(c=Yl(e,c),Os(e,d,c,"url")&&n(c)===40){if(c=Kl(e,c+1),n(c)===34||n(c)===39){u=2,c=d+4;return}s();return}if(n(c)===40){u=2,c++;return}u=1}function i(d){for(d||(d=n(c++)),u=5;c<e.length;c++){const f=e.charCodeAt(c);switch(Gf(f)){case d:c++;return;case 130:if(Gl(f)){c+=Xf(e,c,f),u=6;return}break;case 92:if(c===e.length-1)break;const h=n(c+1);Gl(h)?c+=Xf(e,c+1,h):Bn(f,h)&&(c=ni(e,c)-1)}}}function s(){for(u=7,c=Kl(e,c);c<e.length;c++){const d=e.charCodeAt(c);switch(Gf(d)){case 41:c++;return;case 130:if(c=Kl(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=Yf(e,c),u=8;return;case 34:case 39:case 40:case 133:c=Yf(e,c),u=8;return;case 92:if(Bn(d,n(c+1))){c=ni(e,c)-1;break}c=Yf(e,c),u=8;return}}}e=String(e||"");const a=e.length;let l=xE(n(0)),c=l,u;for(;c<a;){const d=e.charCodeAt(c);switch(Gf(d)){case 130:u=13,c=Kl(e,c+1);break;case 34:i();break;case 35:NE(n(c+1))||Bn(n(c+1),n(c+2))?(u=4,c=Yl(e,c+1)):(u=9,c++);break;case 39:i();break;case 40:u=21,c++;break;case 41:u=22,c++;break;case 43:jf(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 44:u=18,c++;break;case 45:jf(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(u=15,c=c+3):Xl(d,n(c+1),n(c+2))?o():(u=9,c++);break;case 46:jf(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 47:n(c+1)===42?(u=25,c=e.indexOf("*/",c+2),c=c===-1?e.length:c+2):(u=9,c++);break;case 58:u=16,c++;break;case 59:u=17,c++;break;case 60:n(c+1)===33&&n(c+2)===45&&n(c+3)===45?(u=14,c=c+4):(u=9,c++);break;case 64:Xl(n(c+1),n(c+2),n(c+3))?(u=3,c=Yl(e,c+1)):(u=9,c++);break;case 91:u=19,c++;break;case 92:Bn(d,n(c+1))?o():(u=9,c++);break;case 93:u=20,c++;break;case 123:u=23,c++;break;case 125:u=24,c++;break;case 131:r();break;case 132:o();break;default:u=9,c++}t(u,l,l=c)}}var ri=null,je=class Rn{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return Rn.createItem(t)}allocateCursor(t,n){let r;return ri!==null?(r=ri,ri=ri.cursor,r.prev=t,r.next=n,r.cursor=this.cursor):r={prev:t,next:n,cursor:this.cursor},this.cursor=r,r}releaseCursor(){const{cursor:t}=this;this.cursor=t.cursor,t.prev=null,t.next=null,t.cursor=ri,ri=t}updateCursors(t,n,r,o){let{cursor:i}=this;for(;i!==null;)i.prev===t&&(i.prev=n),i.next===r&&(i.next=o),i=i.cursor}*[Symbol.iterator](){for(let t=this.head;t!==null;t=t.next)yield t.data}get size(){let t=0;for(let n=this.head;n!==null;n=n.next)t++;return t}get isEmpty(){return this.head===null}get first(){return this.head&&this.head.data}get last(){return this.tail&&this.tail.data}fromArray(t){let n=null;this.head=null;for(let r of t){const o=Rn.createItem(r);n!==null?n.next=o:this.head=o,o.prev=n,n=o}return this.tail=n,this}toArray(){return[...this]}toJSON(){return[...this]}forEach(t,n=this){const r=this.allocateCursor(null,this.head);for(;r.next!==null;){const o=r.next;r.next=o.next,t.call(n,o.data,o,this)}this.releaseCursor()}forEachRight(t,n=this){const r=this.allocateCursor(this.tail,null);for(;r.prev!==null;){const o=r.prev;r.prev=o.prev,t.call(n,o.data,o,this)}this.releaseCursor()}reduce(t,n,r=this){let o=this.allocateCursor(null,this.head),i=n,s;for(;o.next!==null;)s=o.next,o.next=s.next,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}reduceRight(t,n,r=this){let o=this.allocateCursor(this.tail,null),i=n,s;for(;o.prev!==null;)s=o.prev,o.prev=s.prev,i=t.call(r,i,s.data,s,this);return this.releaseCursor(),i}some(t,n=this){for(let r=this.head;r!==null;r=r.next)if(t.call(n,r.data,r,this))return!0;return!1}map(t,n=this){const r=new Rn;for(let o=this.head;o!==null;o=o.next)r.appendData(t.call(n,o.data,o,this));return r}filter(t,n=this){const r=new Rn;for(let o=this.head;o!==null;o=o.next)t.call(n,o.data,o,this)&&r.appendData(o.data);return r}nextUntil(t,n,r=this){if(t===null)return;const o=this.allocateCursor(null,t);for(;o.next!==null;){const i=o.next;if(o.next=i.next,n.call(r,i.data,i,this))break}this.releaseCursor()}prevUntil(t,n,r=this){if(t===null)return;const o=this.allocateCursor(t,null);for(;o.prev!==null;){const i=o.prev;if(o.prev=i.prev,n.call(r,i.data,i,this))break}this.releaseCursor()}clear(){this.head=null,this.tail=null}copy(){const t=new Rn;for(let n of this)t.appendData(n);return t}prepend(t){return this.updateCursors(null,t,this.head,t),this.head!==null?(this.head.prev=t,t.next=this.head):this.tail=t,this.head=t,this}prependData(t){return this.prepend(Rn.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(Rn.createItem(t))}insert(t,n=null){if(n!==null)if(this.updateCursors(n.prev,t,n,t),n.prev===null){if(this.head!==n)throw new Error("before doesn't belong to list");this.head=t,n.prev=t,t.next=n,this.updateCursors(null,t)}else n.prev.next=t,t.prev=n.prev,n.prev=t,t.next=n;else this.updateCursors(this.tail,t,null,t),this.tail!==null?(this.tail.next=t,t.prev=this.tail):this.head=t,this.tail=t;return this}insertData(t,n){return this.insert(Rn.createItem(t),n)}remove(t){if(this.updateCursors(t,t.prev,t,t.next),t.prev!==null)t.prev.next=t.next;else{if(this.head!==t)throw new Error("item doesn't belong to list");this.head=t.next}if(t.next!==null)t.next.prev=t.prev;else{if(this.tail!==t)throw new Error("item doesn't belong to list");this.tail=t.prev}return t.prev=null,t.next=null,t}push(t){this.insert(Rn.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(Rn.createItem(t))}shift(){return this.head!==null?this.remove(this.head):null}prependList(t){return this.insertList(t,this.head)}appendList(t){return this.insertList(t)}insertList(t,n){return t.head===null?this:(n!=null?(this.updateCursors(n.prev,t.tail,n,t.head),n.prev!==null?(n.prev.next=t.head,t.head.prev=n.prev):this.head=t.head,n.prev=t.tail,t.tail.next=n):(this.updateCursors(this.tail,t.tail,null,t.head),this.tail!==null?(this.tail.next=t.head,t.head.prev=this.tail):this.head=t.head,this.tail=t.tail),t.head=null,t.tail=null,this)}replace(t,n){"head"in n?this.insertList(n,t):this.insert(n,t),this.remove(t)}};function ec(e,t){const n=Object.create(SyntaxError.prototype),r=new Error;return Object.assign(n,{name:e,message:t,get stack(){return(r.stack||"").replace(/^(.+\n){1,3}/,`${e}: ${t}
|
|
33
33
|
`)}})}var DE=100,C5=60,T5=" ";function BE({source:e,line:t,column:n},r){function o(u,d){return i.slice(u,d).map((f,h)=>String(u+h+1).padStart(l)+" |"+f).join(`
|
|
34
34
|
`)}const i=e.split(/\r\n?|\n|\f/),s=Math.max(1,t-r)-1,a=Math.min(t+r,i.length+1),l=Math.max(4,String(a).length)+1;let c=0;n+=3*(i[t-1].substr(0,n-1).match(/\t/g)||[]).length,n>DE&&(c=n-C5+3,n=58);for(let u=s;u<=a;u++)u>=0&&u<i.length&&(i[u]=i[u].replace(/\t/g,T5),i[u]=(c>0&&i[u].length>c?"…":"")+i[u].substr(c,98)+(i[u].length>c+DE-1?"…":""));return[o(s,t),new Array(n+l+2).join("-")+"^",o(t,a)].filter(Boolean).join(`
|
|
35
35
|
`)}function HE(e,t,n,r,o){return Object.assign(ec("SyntaxError",e),{source:t,offset:n,line:r,column:o,sourceFragment(i){return BE({source:t,line:r,column:o},isNaN(i)?0:i)},get formattedMessage(){return`Parse error: ${e}
|
|
@@ -50,7 +50,7 @@ ${o.join("")}
|
|
|
50
50
|
`,s.innerHTML!==a&&(s.textContent=a,r=!0)}}return r}function kw(e,t,n,r,o=new Set){let i=!1,s;try{s=t.cssRules}catch{return!1}for(let a=s.length-1;a>=0;a--){const l=s[a];if(l instanceof CSSStyleRule){let c=l.selectorText;n&&c.includes(".em-")&&(c=`${c}, ${c.replace(/\.em-/g,".noresp-em-")}`),I7(e,c,r)||(t.deleteRule(a),i=!0)}else if(l instanceof CSSGroupingRule)i=kw(e,l,n,r,o)||i,l.cssRules.length||(t.deleteRule(a),i=!0);else if(l instanceof CSSFontFaceRule){const c=l.cssText;o.has(c)?(t.deleteRule(a),i=!0):o.add(c)}}return i}function I7(e,t,n){if(n.has(t))return n.get(t);let r=!1;try{r=!!e.querySelector(t)}catch{r=!0}return n.set(t,r),r}function D7(e){return Array.from(e.cssRules,t=>t.cssText).join(`
|
|
51
51
|
`)}var Lw=/device-width/i,B7="not all",pi=new Map,jm=!1;function H7(e){return"media"in e&&"cssRules"in e}function Nw(e,t){for(const n of Array.from(e))H7(n)&&t(n),"cssRules"in n&&Nw(n.cssRules,t)}function F7(e){try{return e.cssRules}catch{return}}function $7(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n&&!Lw.test(n));return t.length?t.join(", "):B7}function Vm(e){pi.forEach((t,n)=>{n.parentStyleSheet?.ownerNode?.isConnected||pi.delete(n)});for(const t of Array.from(e.styleSheets)){const n=F7(t);n&&Nw(n,r=>{const o=r.media.mediaText;pi.has(r)||!Lw.test(o)||(pi.set(r,o),r.media.mediaText=$7(o))})}}function xw(){pi.forEach((e,t)=>{t.media.mediaText=e}),pi.clear()}function W7(e){if(!jm)return e();xw();try{return e()}finally{Vm(document)}}function q7(e){return e.some(t=>{const n=t.target;return n.nodeName==="STYLE"||n.parentNode?.nodeName==="STYLE"?!0:Array.from(t.addedNodes).some(r=>r.nodeName==="STYLE"||r instanceof Element&&!!r.querySelector("style"))})}function z7(e=window){if(!e.matchMedia("(pointer: coarse)").matches)return()=>{};const t=e.document;jm=!0,Vm(t);const n=new MutationObserver(r=>{q7(r)&&Vm(t)});return n.observe(t.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{n.disconnect(),xw(),jm=!1}}function js(e){return ae(e)}var Vne=ae("extensions.atomsHandlers"),Gne=js("HANDLE_ATOM_INSERT"),Xne=ae("HeadlessMode"),Kne=ae("extensions.sandboxExtensions"),U7="SANDBOX_EXTENSION_SCRIPT_STATUS",Yne=ae("MESSAGE_SERVICE"),Zne=js("SETTINGS_PANEL_EVENT"),Qne=js("MODAL_SHOW_EVENT"),Jne=js("MODAL_CLOSE_EVENT"),ere=js("MODAL_UPDATE_EVENT");function tre(e){return e}var Ow="SandboxApp",Gm="IframePluginRegistry",j7="__sandbox__";function Rw(){return Td(j7)}function V7(e=Rw()){return e.getOrCreateInstance(Gm,()=>new _b)}var Xm=new $N(()=>V7()),Vs=class tL{constructor(){A(this,"container",Rw()),A(this,"pluginCollection",new FN(this,Xm)),this.pluginCollection.activateSync()}static get instance(){return this._instance||(this._instance=new tL)}static registerPlugin(t,n){Xm.add(t,n)}static registerAll(t){for(const n of Object.keys(t)){let r=n;const o=t[r];o&&Xm.add(r,o)}}static use(t){return this.instance.pluginCollection.use(t)}static initFeatures(t){this.instance.initFeatures(t)}static onLifecycle(t){return this.instance.onLifecycle(t)}use(t){return typeof t=="function"?this.pluginCollection.useByCtor(t):this.pluginCollection.useByKey(t)}initFeatures(t){this.pluginCollection.initSync(t)}onLifecycle(t){return this.pluginCollection.onLifecycle(t)}dispose(){this.pluginCollection.dispose()}};A(Vs,"_instance",void 0);var Gs="data-extension";function Xs(e,t,n,r){z.send(U7,{key:e,phase:t,status:n,error:r})}function G7(){if(typeof document>"u")return;const e=document.currentScript;if(e instanceof HTMLScriptElement)return e.getAttribute(Gs)||void 0}function Mw(e){return{key:e,hasSyncPlugins:!1,pendingPlugins:new Set,loadedNotified:!1,readyNotified:!1,readyFailed:!1}}function Km(e){!e.loadedNotified||e.readyNotified||e.readyFailed||(!e.hasSyncPlugins||e.pendingPlugins.size===0)&&(e.readyNotified=!0,Xs(e.key,"ready","success"))}function Pw(e,t){return[...document.querySelectorAll(`${e}[${Gs}]`)].find(n=>n.getAttribute(Gs)===t)}function X7({type:e,attributes:t,key:n,innerHTML:r}){const o=document.createElement(e);if(t)for(const[i,s]of Object.entries(t))s!=null&&o.setAttribute(i,String(s));return o.setAttribute(Gs,n),r&&(o.innerHTML=r),e==="script"?t.type||o.setAttribute("type","text/javascript"):e==="style"&&(t.type||o.setAttribute("type","text/css")),o}function K7(e,t={}){const n=new Ee,r=new Map,o=new Map,i=new Map,s=new WeakMap,a=u=>{let d=i.get(u);return d||(d=Mw(u),i.set(u,d)),d},l=u=>{if(u.type==="created"){const h=G7();if(!h)return;const m=a(h);m.hasSyncPlugins=!0,m.pendingPlugins.add(u.plugin),s.set(u.plugin,h);return}if(u.type==="create:error")return;const d=s.get(u.plugin);if(!d)return;const f=i.get(d);if(f){if(u.type==="afterInit:success"){f.pendingPlugins.delete(u.plugin),Km(f);return}(u.type==="init:error"||u.type==="afterInit:error")&&(f.pendingPlugins.delete(u.plugin),f.readyFailed=!0,Xs(d,"ready","error",`Sandbox plugin "${u.name}" failed during ${u.type==="init:error"?"init":"afterInit"}.`))}};n.addDisposable(Vs.onLifecycle(l)),n.addDisposable(z.addListener(de.SANDBOX_ADD_EXTENSIONS,u=>{for(const d of u){if(t.surface&&d.surfaces&&!d.surfaces.includes(t.surface))continue;let f=r.get(d.key);f&&f.remove(),d.type==="script"&&i.set(d.key,Mw(d.key));const h=d.parent&&document.querySelector(d.parent)||document.head;if(f=X7(d),e.ownership.markService(f),d.type==="script"){const m=f;m.src&&(m.onload=()=>{const p=a(d.key);p.loadedNotified=!0,Xs(d.key,"load","success"),Km(p)},m.onerror=()=>Xs(d.key,"load","error",`Failed to load sandbox script: ${m.src}`))}if(h.appendChild(f),d.type==="script"&&!f.src){const m=a(d.key);m.loadedNotified=!0,Xs(d.key,"load","success"),Km(m)}r.set(d.key,f),o.set(d.key,d)}})),n.addDisposable(z.addListener(de.SANDBOX_REMOVE_EXTENSIONS,u=>{for(const d of u){const f=Pw(o.get(d)?.type,d);f&&f.remove(),r.delete(d),o.delete(d)}})),n.addDisposable(e.onChange(()=>{e.applyHidden(()=>c())}));function c(){for(const[u,d]of r){const f=o.get(u);if(!f)continue;const h=Pw(f.type,u);let m=f.parent?[...document.querySelectorAll(f.parent)]:[];m.length||(m=[document.head]),h?h!==d?r.set(u,h):m.some(p=>h.parentNode===p)||m[0]?.appendChild(h):m[0]?.appendChild(d)}}return n}function Y7(e){e.querySelectorAll(`[${Gs}]`).forEach(t=>t.remove())}var bo="remove-basic-cell",Z7="remove-basic-row",yo="em-active-table-cell",Q7="em-temporary-class",Ir="em-temporary-active-cell-background-color",Dr="temporary-cell-class",Ec=[bo,Z7,yo,Q7,Dr,Ir],J7=["contenteditable","em-edit","em-state","em-hover"],Iw=`<div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5a5a5a;"> </div>`,Ks="em-table-menu",Ys="em_version";function Sc(e){if(!e||!e.includes("em_version"))return e;try{const t=typeof document<"u"?document.baseURI:"http://localhost/",n=new URL(e,t);return n.searchParams.has("em_version")?(n.searchParams.delete(Ys),/^https?:\/\//i.test(e)||e.startsWith("//")?n.href:n.pathname+n.search+n.hash):e}catch{return e}}function eH(e){try{const t=typeof document<"u"?document.baseURI:"http://localhost/",n=new URL(e,t);return n.searchParams.set(Ys,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?n.href:n.pathname+n.search+n.hash}catch{return`${e}${e.includes("?")?"&":"?"}${Ys}=${Date.now()}`}}var tH=/^(chrome-extension|moz-extension|safari-extension):\/\//i,nH=/local\.adguard\.org/i,rH=/^bis_/i,oH=new Set(["data-bis-config"]),gi=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,iH=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,wc=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Dw=/display:\s*none\s*!important/gi,Bw="data-darkreader-",sH=/<(script|style)\b[\s\S]*?<\/\1\s*>|<[a-z][^\s<>]*(?:"[^"]*"|'[^']*'|[^<>"'])*?\sdata-darkreader-(?:"[^"]*"|'[^']*'|[^<>"'])*>/gi,aH=/\sdata-darkreader-[a-z0-9-]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/gi,lH=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"],Hw=new Set(["em","data-theme-varibalse","data-em-localization"]);function cH(e){return Dw.lastIndex=0,(e.match(Dw)||[]).length}function Ym(e){const t=e.trim(),n=cH(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=lH.filter(o=>t.includes(o)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function uH(e){if(Hw.has("em")&&e.getAttribute("em")==="styles")return!1;for(const t of Hw)if(e.hasAttribute(t))return!1;return Ym(e.textContent||"")}function dH(e){return tH.test(e.src)||nH.test(e.src)?!0:e.hasAttribute("bis_use")||e.hasAttribute("data-bis-config")}function Fw(e){let t=!1;for(const n of[...e.attributes])(rH.test(n.name)||oH.has(n.name))&&(e.removeAttribute(n.name),t=!0);return t}function fH(e){wc.lastIndex=0;for(const t of e.matchAll(wc))if(Ym(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function mH(e){let t=!1;return wc.lastIndex=0,{html:e.replace(wc,n=>Ym(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function $w(e){let t=!1;return e instanceof Element&&Fw(e)&&(t=!0),e.querySelectorAll("script").forEach(n=>{dH(n)&&(n.remove(),t=!0)}),e.querySelectorAll("style").forEach(n=>{n.tagName==="STYLE"&&uH(n)&&(n.remove(),t=!0)}),e.querySelectorAll("*").forEach(n=>{Fw(n)&&(t=!0)}),t}function hH(e){return gi.lastIndex=0,gi.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||fH(e)}function pH(e){return e.toLowerCase().startsWith(Bw)}function gH(e){return e.toLowerCase().includes(Bw)?e.replace(sH,(t,n)=>n?t:t.replace(aH,"")):e}function bH(e){const t=gH(e);if(!hH(t))return{html:t,found:!1};let n=!1,r=t;gi.lastIndex=0,gi.test(r)&&(gi.lastIndex=0,r=r.replace(gi,""),n=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(r)||/\sdata-bis-config\s*=/.test(r))&&(r=r.replace(iH,""),n=!0);const o=mH(r);return r=o.html,n=n||o.found,{html:r,found:n}}var yH=class extends Ee{constructor(...e){super(...e),A(this,"_transforms",[]),A(this,"_byAttribute",new Map)}register(e){this._transforms.push(e);for(const t of e.attributes){const n=t.toLowerCase(),r=this._byAttribute.get(n);r?r.push(e):this._byAttribute.set(n,[e])}return{dispose:()=>this._remove(e)}}_remove(e){const t=this._transforms.indexOf(e);if(t!==-1){this._transforms.splice(t,1);for(const n of e.attributes){const r=n.toLowerCase(),o=this._byAttribute.get(r);if(!o)continue;const i=o.indexOf(e);i!==-1&&o.splice(i,1),o.length||this._byAttribute.delete(r)}}}get isEmpty(){return this._transforms.length===0}handles(e){return this._byAttribute.has(e.toLowerCase())}get attributes(){return[...this._byAttribute.keys()]}render(e,t){return this._run("render",e,t)}serialize(e,t){return this._run("serialize",e,t)}_run(e,t,n){const r=this._byAttribute.get(n.attribute.toLowerCase());if(!r?.length)return t;const o=e==="render"?r:[...r].reverse();let i=t;for(const s of o){if(i===null)break;const a=e==="render"?s.render?.(i,n):s.serialize?.(i,n);a!==void 0&&(i=a)}return i}dispose(){this._transforms.length=0,this._byAttribute.clear(),super.dispose()}};function Zm(){return Mt.getInstance(Po)}var _c=new WeakMap;function vH(e,t,n){const r=_c.get(e);r?r.set(t.toLowerCase(),n):_c.set(e,new Map([[t.toLowerCase(),n]]))}function EH(e,t){const n=_c.get(e);n?.size&&_c.set(t,new Map(n))}function Ww(e,t,n){const r=e.tagName.toLowerCase();for(const o of t.attributes){if(!e.hasAttribute(o))continue;const i=e.getAttribute(o)??"",s=t.serialize(i,{element:e,tag:r,attribute:o,stage:n});s===null?e.removeAttribute(o):s!==i&&e.setAttribute(o,s)}}function Cc(e,t={}){const n=t.pipeline??Zm(),r=t.stage??"build";let o=e;if(t.clone&&(o=e.cloneNode(!0),nn(e,o),n&&!n.isEmpty&&qw(e,o)),!n||n.isEmpty)return o;o instanceof Element&&Ww(o,n,r);const i=o.querySelectorAll?.("*");if(i)for(const s of i)Ww(s,n,r);return o}function SH(e,t={}){const n=t.pipeline??Zm(),r=qM(e);if((!n||n.isEmpty)&&!r)return _r(e);const o=Cc(e,{...t,pipeline:n,clone:!0});return Zo(o),Zg(o)}function qw(e,t){EH(e,t);const n=e.childNodes,r=t.childNodes;for(let o=0;o<n.length&&o<r.length;o++)qw(n[o],r[o])}function Ht(e,t,n,r={}){const o=Qm(e,t,n,{stage:"settings",...r});o===null?e.removeAttribute(t):e.setAttribute(t,o)}function Qm(e,t,n,r={}){const o=r.pipeline??Zm();if(!o||!o.handles(t))return n;const i=e?.tagName.toLowerCase()??"",s=o.render(n,{element:e,tag:i,attribute:t,stage:r.stage??"build"});if(s!==n){const a=r.owner??e;a&&vH(a,t,n)}return s}function wH(e){const t=new yH,n=nb((o,i,s)=>t.isEmpty?s:Qm(o,i,s,{pipeline:t})),r=VL((o,i,s)=>t.isEmpty?s:t.serialize(s,{element:o,tag:o.tagName.toLowerCase(),attribute:i,stage:"apply"}));return e.inject(Po,t),{pipeline:t,dispose(){r(),n(),t.dispose(),bn(e,Po)}}}function _H(e){return Sc(e)}function zw(e){const t=(n,r)=>{const o=n.getAttribute(r);if(!o)return;const i=_H(o);i!==o&&n.setAttribute(r,i)};e.querySelectorAll("[src]").forEach(n=>t(n,"src")),e.querySelectorAll("[___src]").forEach(n=>t(n,"___src"))}var Uw=[".em-code",':not(editor)[contenteditable="false"]','.em-vindent[class*="em-vindent-padding"]',"#gtx-anchor",'[data-mce-bogus="1"]','style[data-theme-varibalse="true"]','style[data-em-localization="true"]',".em-element-img-change-group",".em-element-resize-img",".em-element-editor",".em-element-vindent-bg",".em-element-gap",".em-element-gap-marker",".em-element-gap-bg",".em-gap",".em-powered-logo",".em-element-vindent-value"],CH=["contenteditable","em-edit","em-state","em-hover"],TH=["[data-mce-caret=before]","span.em-element-resize-img-container","div.em-element-img-change-group","div.em-element-block-add","meta[http-equiv=Content-Security-Policy]","[class*=mce-]","script[em=initial]",".em-editor-wrapper",".em-element-resize-height",".em-element-vindent-remove",".em-element-vindent",".em-element-vindent-value","div.iframe-resizer-inner"],AH=new Set(["normal","400"]),kH=new Set(["normal"]),LH=new Set(["baseline","unset","initial",""]),jw=new Set(["none",""]),NH=["b","strong","em","i","u","s","strike","sup","sub"],xH="___em-internal",Vw=["em-block-insert-empty","em-atom-insert-empty","em-block-insert-body","em-atom-insert-body","em-resize-start","sortable-chosen","sortable-ghost","em-vindent-table","em-vindent_low","em-vindent","em-relative","em-display-block","em-sandbox-discuss_set-target","em-sandbox-discuss","em-native-img-uploading","em-native-img-drop-target","em-native-img-drop-loading","em-native-file-drag"],OH=["em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document","em-block-insert_bottom","em-block-insert_top","em-blockatom-insert","em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top"],RH=[...Uw,...TH].filter(e=>/\.em-(element-|gap|vindent)/.test(e)&&e!=="span.em-element-resize-img-container").join(", "),MH=CH.filter(e=>!Uw.some(t=>t.includes(`[${e}`))),PH=[...Vw,...OH],IH={isServiceAttribute:e=>MH.includes(e)||pH(e),isServiceClass:e=>PH.includes(e),isServicePanel:e=>e.matches(RH)||e.hasAttribute("data-em-caret")};function Gw(e){Ec.forEach(t=>{e.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function Tc(e){e.querySelectorAll(".em-block-insert").forEach(n=>{n.classList.remove("em-block-insert","em-block-insert_bottom-document","em-block-insert_top-document")}),e.querySelectorAll(".em-block-insert_bottom").forEach(n=>{n.classList.remove("em-block-insert_bottom")}),e.querySelectorAll(".em-block-insert_top").forEach(n=>{n.classList.remove("em-block-insert_top")}),e.querySelectorAll(".em-blockatom-insert").forEach(n=>{n.classList.remove("em-blockatom-insert","em-block-insert_bottom-document","em-block-insert_top-document")}),e.querySelectorAll(".em-atom-insert").forEach(n=>{n.classList.remove("em-atom-insert","em-atom-insert_bottom-document","em-atom-insert_bottom","em-atom-insert_top-document","em-atom-insert_top")}),Vw.forEach(n=>{e.querySelectorAll(`.${n}`).forEach(r=>r.classList.remove(n))}),e.querySelectorAll(".em-powered-logo").forEach(n=>n.remove());for(const n of e.querySelectorAll("[class='']"))n.removeAttribute("class");const t=e instanceof Document?e.documentElement:e;t&&(Lt(t,"[data-mce-caret=before]",!0),Lt(t,"span.em-element-resize-img-container"),Lt(t,"div.em-element-img-change-group",!0),Lt(t,"div.em-element-block-add",!0),Lt(t,"meta[http-equiv=Content-Security-Policy]",!0),Lt(t,"[class*=mce-]"),Lt(t,"script[em=initial]",!0),Lt(t,".em-editor-wrapper",!0),Lt(t,".em-element-resize-height",!0),Lt(t,".em-element-vindent-remove",!0),Lt(t,".em-element-vindent",!0),Lt(t,".em-element-vindent-value",!0),Lt(t,"div.iframe-resizer-inner"))}function DH(e){e.querySelectorAll("tbody").forEach(t=>t.replaceWith(...Array.from(t.childNodes))),e.querySelectorAll(".em-code").forEach(t=>t.remove()),e.querySelectorAll(':not(editor)[contenteditable="false"]').forEach(t=>t.remove()),e.querySelectorAll('.em-vindent[class*="em-vindent-padding"]').forEach(t=>t.remove()),e.querySelectorAll(".em-code").forEach(t=>t.remove()),e.querySelectorAll("[contenteditable]").forEach(t=>t.removeAttribute("contenteditable")),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")),e.querySelectorAll("[em-state]").forEach(t=>t.removeAttribute("em-state")),e.querySelectorAll("[em-hover]").forEach(t=>t.removeAttribute("em-hover")),e.querySelectorAll("#gtx-anchor").forEach(t=>t.remove()),e.querySelectorAll('[data-mce-bogus="1"]').forEach(t=>t.remove()),e.querySelectorAll("strike").forEach(t=>t.removeAttribute("style")),e.querySelectorAll("u").forEach(t=>t.removeAttribute("style")),e.querySelectorAll('style[data-theme-varibalse="true"]').forEach(t=>t.remove()),e.querySelectorAll('style[data-em-localization="true"]').forEach(t=>t.remove()),e.querySelectorAll(".em-element-img-change-group").forEach(t=>t.remove()),e.querySelectorAll(".em-element-resize-img").forEach(t=>t.remove()),e.querySelectorAll(".em-element-editor").forEach(t=>t.remove()),e.querySelectorAll(".em-element-vindent-bg").forEach(t=>t.remove()),e.querySelectorAll(".em-element-vindent-value").forEach(t=>t.remove()),e.querySelectorAll(".em-element-gap").forEach(t=>t.remove()),e.querySelectorAll(".em-element-gap-marker").forEach(t=>t.remove()),e.querySelectorAll(".em-element-gap-bg").forEach(t=>t.remove()),e.querySelectorAll(".em-gap").forEach(t=>t.remove()),e.querySelectorAll(".em-just-inserted").forEach(t=>t.classList.remove("em-just-inserted")),e.querySelectorAll(".em-native-img-uploading").forEach(t=>t.classList.remove("em-native-img-uploading")),e.querySelectorAll(".em-native-img-drop-target").forEach(t=>t.classList.remove("em-native-img-drop-target")),e.querySelectorAll(".em-native-img-upload-spin-overlay").forEach(t=>t.remove()),e.querySelectorAll(".em-element-list-bullet").forEach(t=>t.classList.remove("em-element-list-bullet")),e.querySelectorAll(".remove-new-editor-element").forEach(t=>t.classList.remove("remove-new-editor-element")),Gw(e),Tc(e),Kv(e),Lt(e,"editor",!1),Kw(e),zw(e),$w(e)}function Zs(e){return(e??"").trim().toLowerCase()}function BH(e){const t=Zs(e.style.fontWeight);t&&AH.has(t)&&e.style.removeProperty("font-weight");const n=Zs(e.style.fontStyle);n&&kH.has(n)&&e.style.removeProperty("font-style");const r=Zs(e.style.verticalAlign);r&&LH.has(r)&&e.style.removeProperty("vertical-align");const o=Zs(e.style.textDecorationLine);o&&jw.has(o)&&e.style.removeProperty("text-decoration-line");const i=Zs(e.style.textDecoration);i&&jw.has(i)&&e.style.removeProperty("text-decoration");const s=e.getAttribute("style");s!==null&&s.trim()===""&&e.removeAttribute("style")}function HH(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function Xw(e){if(e.attributes.length===0)return!0;for(const t of Array.from(e.attributes))if(t.name!==xH)return!1;return!0}function Kw(e){const t=Array.from(e.querySelectorAll("span"));for(let n=t.length-1;n>=0;n-=1){const r=t[n];BH(r),Xw(r)&&HH(r)}for(const n of NH){const r=Array.from(e.querySelectorAll(n));for(let o=r.length-1;o>=0;o-=1){const i=r[o];i.childNodes.length===0&&Xw(i)&&i.remove()}}}function FH(e){const t=[],n=UH(e);return e=qH(e,t,n),e=e.replaceAll(/<script[^>]*\bdata-amd-module-id\s*=[^>]*>[\s\S]*?<\/script>/gi,""),e=e.replaceAll(/<script[^>]*\/iframe\/js\/[^>]*>[\s\S]*?<\/script>/gi,""),e=e.replaceAll(/<style\b[^>]*ad-right-container[^>]*>[\s\S]*?<\/style>/gi,""),e=Il.clear(e),e=Jm(e),t.length===0?e:VH(e,t,n)}var Yw=`(<(script|style)\\b[^>]*>)([\\s\\S]*?)(?=<\\/\\2${ja})`,$H=new RegExp(Yw,"gi"),WH=new RegExp(`<!--[\\s\\S]*?-->|${Yw}`,"gi");function qH(e,t,n){const r=(o,i,s,a)=>!a||!jH(s,i)?i+a:(t.push(s.toLowerCase()==="style"?zH(a):a),`${i}${n}${t.length-1}${Qw}`);return e.replaceAll(WH,(o,i,s,a)=>i===void 0?o.replaceAll($H,r):r(o,i,s??"",a??""))}function zH(e){const t=Jm(Il.clear(`>${e}`));return t.startsWith(">")?t.slice(1):Jm(Il.clear(e))}var Zw="",Qw="";function UH(e){let t=Zw;for(;e.includes(t);)t+=Zw;return t}function jH(e,t){const n=document.createElement(e),r=/\btype\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(t);return r&&n.setAttribute("type",r[1]??r[2]??r[3]),yn(n)}function VH(e,t,n){return e.replaceAll(new RegExp(`${n}(\\d+)${Qw}`,"g"),(r,o)=>t[Number(o)]??r)}function Jm(e){e=e.replaceAll(/\uFEFF/gmu,""),e=e.replaceAll(/<link[^>]*?em="css.*?>/gis,""),e=e.replaceAll(/draggable="false"|draggable="true"/gi,""),e=e.replaceAll(/ style="\s*"/gi,""),e=e.replaceAll(/<tbody.*?>/gi,"").replaceAll(/<\/tbody>/gi,""),e=e.replaceAll(/&nbsp;/gi," ").replaceAll(/&zwnj;/gi,"‌"),e=e.replaceAll(/style="transform: translateZ\(0px\);"/gi,""),e=e.replaceAll(/ +>/gi,">"),e=e.replaceAll(/&/gi,"&"),e=e.replaceAll(/"/gi,""),e=e.replaceAll(/^\s*$(?:\r\n?|\n)/gm,""),e=e.replaceAll(/ em-floatblock-width=".*?"/gi,""),e=e.replaceAll(/<div[^>]*?class="jfk-bubble.*?jfk-bubble-arrowimplafter".*?><\/div><\/div><\/div>/gis,""),e=e.replaceAll(/<span[^>]*?style="text-decoration: underline;"[^>]*?>(<a[^>]*?href.*?a>)<\/span>/gis,"$1"),e=e.replaceAll(/ rel="noopener"/gi,""),e=e.replaceAll(/ em-insert-ignore/gi,""),e=e.replaceAll(/ class="\s*"/gi,""),e=e.replaceAll(/<!--<em-root-text>(.*?)-->/gis,"$1"),e=e.replaceAll(/class="em-block.*?"/gi,""),e=e.replaceAll(/data-percent="[^"]*"/g,""),e=e.replaceAll(/em-optimise="[^"]*"/g,""),e=e.replaceAll(/em-optimise-error="[^"]*"/g,"");const t=e.match(/((rgb)\(\d{1,3}(,\s?\d{1,3}){2}\))/gi);return t&&t.forEach(n=>{const r=G(n);r&&(e=e.replaceAll(n,r))}),e=e.replaceAll(/<tbody>/gi,"").replaceAll(/<\/tbody>/gi,""),e}function Jw(e){switch(e.toLowerCase()){case"tr":return document.createElement("table");case"td":return document.createElement("tr");case"head":case"body":return document.createElement("html");default:return document.createElement("div")}}function GH(e,t){if(t.some(l=>l.nodeName==="HTML")){for(const l of t)e.appendChild(l);return}const n=t.find(l=>l.nodeType===Node.DOCUMENT_TYPE_NODE),r=t.find(l=>l.nodeName==="HEAD"),o=t.find(l=>l.nodeName==="BODY");n&&e.appendChild(n);const i=e.createElement("html"),s=r??e.createElement("head"),a=o??e.createElement("body");i.append(s,a);for(const l of t)l===n||l===r||l===o||l.nodeName==="HTML"||l.nodeName==="HEAD"||l.nodeName==="BODY"||a.appendChild(l);e.appendChild(i)}function e_(){const e=Array.from(document.querySelectorAll('style[em="styles"]'));return W7(()=>Aw(document,e,{forceMediaMerge:!0}))}function XH(e){let t=!1;return e.beforeCommit(()=>{try{!t&&e.takeStyleDirty()&&(t=!0,e_(),e.takeStyleDirty())}finally{t=!1}})}function Ac(e){let t=e.html??"";const n=e.node,r=e.isBlock??!1,o=e.isPartial??!1;if(r||o){let i,s="div";if(n){if(s=n.tagName??"div",s==="DOCTYPE"||s==="html")return Ac({node:n});i=Jw(s);const a=n.cloneNode(!0);nn(n,a),i.appendChild(a)}else{const a=t.trim(),l=a.match(/<\!?([a-zA-Z]{1,})[^>]*>/i);if(s=l?l[1]:"div",s==="DOCTYPE"||s==="html")return Ac({html:t});i=Jw(s);const c=Le(a);i.replaceChildren(...c)}Cc(i,{stage:"apply"}),DH(i),t=kt(i),s.toLowerCase()==="head"&&(t=t.replace("<body></body>","")),s.toLowerCase()==="body"&&(t=t.replace("<head></head>",""))}else{const i=document.implementation.createHTMLDocument();for(const s of[...i.childNodes])s.remove();if(t)GH(i,Le(t));else if(n){const s=n.cloneNode(!0);nn(n,s),i.appendChild(s)}i.documentElement&&(i.querySelectorAll("tbody").forEach(s=>s.replaceWith(...Array.from(s.childNodes))),i.querySelectorAll(".em-code").forEach(s=>s.remove()),i.querySelectorAll(':not(editor)[contenteditable="false"]').forEach(s=>s.remove()),i.querySelectorAll(".em-code").forEach(s=>s.remove()),i.querySelectorAll("[contenteditable]").forEach(s=>s.removeAttribute("contenteditable")),i.querySelectorAll("[em-edit]").forEach(s=>s.removeAttribute("em-edit")),i.querySelectorAll("[em-state]").forEach(s=>s.removeAttribute("em-state")),i.querySelectorAll("[em-hover]").forEach(s=>s.removeAttribute("em-hover")),i.querySelectorAll(".em-just-inserted").forEach(s=>s.classList.remove("em-just-inserted")),i.querySelectorAll(".em-native-img-uploading").forEach(s=>s.classList.remove("em-native-img-uploading")),i.querySelectorAll(".em-native-img-drop-target").forEach(s=>s.classList.remove("em-native-img-drop-target")),i.querySelectorAll(".em-native-img-upload-spin-overlay").forEach(s=>s.remove()),i.body?.classList.remove("em-native-img-drop-loading"),i.body?.classList.remove("em-native-file-drag"),i.querySelectorAll("#gtx-anchor").forEach(s=>s.remove()),i.documentElement.removeAttribute("style"),i.querySelectorAll('style[data-theme-varibalse="true"]').forEach(s=>s.remove()),i.querySelectorAll('style[data-em-localization="true"]').forEach(s=>s.remove()),Y7(i),Gw(i),Tc(i),Kv(i),i.documentElement&&Lt(i.documentElement,"editor",!1),i.querySelectorAll("ya-tr-span").forEach(s=>{s.parentNode&&(Array.from(s.childNodes).forEach(a=>s.parentNode.insertBefore(a,s)),s.remove())}),Kw(i)),Cc(i,{stage:"apply"}),zw(i),$w(i),t=Pt(i)}return bH(FH(t)).html}function eh(e,t){const{target:n}=e;setTimeout(()=>{const r=n?.querySelector("a");if(!r)return;const o=r.closest("div, td, h1, h2, h3, h4, h5, h6, li, ul, ol, sup, sub");o&&(o.childNodes.forEach(i=>{if(i.nodeType===Node.COMMENT_NODE&&i.nodeValue?.includes("[if mso]")){const s=r.innerHTML.length*11+40;i.nodeValue=i.nodeValue.replace(/(<center[^>]*>)(.*?)(<\/center>)/s,(a,l,c,u)=>l+r.innerHTML+u).replace(/(width:)(\d+)(px)/,(a,l,c,u)=>`${l}${s}${u}`)}}),t(!1))},0)}var t_="__emOwnEditor";function KH(e){e[t_]=!0,Rv(e)}function n_(e){const t=[e.closest("editor"),...Array.from(e.querySelectorAll("editor"))],n=e.ownerDocument.activeElement;let r=!1;for(const o of t)o&&!o[t_]&&!o.contains(n)&&(o.replaceWith(...Array.from(o.childNodes)),r=!0);return r}var YH=["deleteContentBackward","deleteContentForward","deleteByCut"],ZH={deleteContentBackward:"backward",deleteContentForward:"forward"};function QH(e){const{element:t,getVisibleText:n,setCursorToElement:r,hasOnlyTextNodesDeep:o,isRangeCoveringAllVisibleText:i,isEditorContentOnlyNbsp:s,commit:a,pasteFragment:l}=e,c=g=>Dt(g)?kf(g):e.mapFn(g);function u(g){return!n(g,c).trim()&&!g.querySelector(o_)}const d=g=>n(g,c).trim();function f(g,y){const w=document.createRange();w.selectNodeContents(y);const b=g.cloneRange();return b.compareBoundaryPoints(b.START_TO_START,w)<0&&b.setStart(w.startContainer,w.startOffset),b.compareBoundaryPoints(b.END_TO_END,w)>0&&b.setEnd(w.endContainer,w.endOffset),s_(n(b.cloneContents(),c).trim(),d(y))}function h(g){g.insertAdjacentHTML("beforebegin"," "),g.removeAttribute("em-edit"),g.remove()}function m(g,y,w){if(!y.collapsed)return!1;const b=document.createRange();return w?(b.setStart(y.endContainer,y.endOffset),b.setEnd(g,g.childNodes.length)):(b.setStart(g,0),b.setEnd(y.startContainer,y.startOffset)),!n(b.cloneContents(),c).trim()}function p(g,y){const w=[],b=[],S=document.createTreeWalker(g,NodeFilter.SHOW_COMMENT);for(let _=S.nextNode();_;_=S.nextNode()){const T=y.comparePoint(_,0);T!==0&&(T<0?w:b).push(_)}L(g),g.prepend(...w),g.append(...b)}function v(g,y){const w=window.getSelection(),b=w?.rangeCount?w.getRangeAt(0).cloneRange():void 0,S=[],_=document.createTreeWalker(g,NodeFilter.SHOW_COMMENT);for(let N=_.nextNode();b&&N;N=_.nextNode()){const I=b.comparePoint(N,0);I!==0&&S.push({comment:N,before:I<0})}const T=y(),x=S.filter(({comment:N})=>!g.contains(N));return x.length&&C(g,x.filter(({before:N})=>N).map(({comment:N})=>N),x.filter(({before:N})=>!N).map(({comment:N})=>N)),T}function C(g,y,w){const b=window.getSelection(),S=b?.rangeCount?b.getRangeAt(0):void 0;if(!b||!S||!g.contains(S.startContainer)){g.prepend(...y),g.append(...w);return}const _=S.cloneRange();_.collapse(!0);for(const x of[...y,...w].reverse())_.insertNode(x);const T=document.createRange();y.length?T.setStartAfter(y[y.length-1]):T.setStartBefore(w[0]),T.collapse(!0),b.removeAllRanges(),b.addRange(T)}function k(g,y){return g.inputType.startsWith("delete")?v(y,()=>f_(g)):f_(g)}function L(g,y=kc(g,d)){const[w,...b]=y,S=w??g;if(!w&&(iF(g)||aF(g))){const x=document.createTextNode(" ");g.replaceChildren(x),r(x);return}const _=document.createElement(w&&w.tagName!=="EDITOR"?w.tagName:"div"),T=document.createTextNode(" ");if(w&&S.tagName===_.tagName)for(const{name:x,value:N}of Array.from(S.attributes))_.setAttribute(x,N);n5(_,w?g:mF(g),S,hF),_.getAttribute("style")||_.removeAttribute("style"),b.filter(x=>x.tagName!=="TBODY").reduce((x,N)=>x.appendChild(fF(N)),_).append(T),g.tagName==="A"||g.parentNode&&g.parentNode.tagName==="A"?g.replaceChildren(T):g.replaceChildren(_),r(T)}function E(g,y){if(y.collapsed)return!1;const w=kc(g,d);return Zv(y,void 0,ZP)?(u(g)&&L(g,w),t.setAttribute("em-edit","active"),a(!0),!0):!1}return function(y){const w=y.target,b=window.getSelection();if(!b||b.rangeCount===0)return;if(y.inputType==="insertFromPaste"&&l&&!y.defaultPrevented){l(y);return}const S=ZH[y.inputType];if(S&&XP(b.getRangeAt(0),S)){y.preventDefault();return}if(YH.includes(y.inputType)&&E(w,b.getRangeAt(0))){y.preventDefault();return}const _=n(w,c).trim(),T=n(b.getRangeAt(0)?.cloneContents(),c).trim(),x=b.getRangeAt(0),N=x.startContainer,I=(N.nodeType===Node.TEXT_NODE?N.parentNode:N).closest("sup, sub");if((y.inputType==="deleteContentBackward"||y.inputType==="deleteByCut")&&!b?.isCollapsed&&T){if(I&&f(x,I)&&h(I),i(x)&&s_(T,_)&&!w.querySelector(th)){y.preventDefault(),p(w,x),t.setAttribute("em-edit","active"),a(!0);return}t.setAttribute("em-edit","active"),a(!0)}if(y.inputType==="deleteContentBackward"&&b?.isCollapsed&&!T){N.length===1&&(I&&d(I).length===1&&h(I),t.setAttribute("em-edit","active"),a(!0));const V=()=>{k(y,w)&&a(!0)};if(N.nodeType!==Node.TEXT_NODE&&!i(x))return V();const K=x.startOffset;if(K===0&&!i(x))return V();const se=N.parentNode;if(!se)return V();const te=Array.prototype.indexOf.call(se.childNodes,N);if(se.childNodes[te-1]?.nodeType===Node.COMMENT_NODE){y.preventDefault(),N.deleteData(K-1,1);const Z=document.createRange();Z.setStart(N,K-1),Z.collapse(!0),b.removeAllRanges(),b.addRange(Z),a(!0);return}w&&s(w)&&(y.preventDefault(),y.stopImmediatePropagation())}if(y.inputType==="insertText"&&!b?.isCollapsed){y.preventDefault();let V=y.data||"";const K=b.anchorNode;i(x)&&(K.tagName==="A"||K?.parentNode&&K.parentNode.tagName==="A")&&(V=" "+y.data),x.deleteContents();const se=document.createTextNode(V||" ");x.insertNode(se),x.setStartAfter(se),x.collapse(!0),b.removeAllRanges(),b.addRange(x),$f(se,se,wf),a(!0);return}if(oF.test(y.inputType)){const V=gF(y,b.getRangeAt(0));if(!V||(y.preventDefault(),KP(w,V))||(b.removeAllRanges(),b.addRange(V),E(w,V)))return;const K=kc(w,d);v(w,()=>{d_("delete"),u(w)&&L(w,K)}),a();return}const O=y.inputType==="deleteContentForward",M=()=>tF(w)?x.collapsed&&!m(w,x,O)&&dF(w,d):o(w)&&!(O&&m(w,x,!0));if(y.inputType.includes("deleteContent")&&(Array.from(n(w,c).replace(rF,"")).length<2||_===T)&&!w.querySelector(th)&&M()){y.preventDefault(),p(w,x),a(!0);return}if(y.inputType==="insertText"&&y.data&&i_(b,y.data)){y.preventDefault(),y.stopImmediatePropagation(),a(!0);return}if(y.inputType==="deleteContentBackward"&&!b.isCollapsed&&!T&&w&&s(w)&&(y.preventDefault(),y.stopImmediatePropagation()),k(y,w)){a(!0);return}a()}}var th="em-replace, img, picture, video, audio, svg, canvas, iframe, object, hr, input, button",JH="div, p, ul, ol, table, h1, h2, h3, h4, h5, h6, blockquote, center, pre",eF="em-inline";function tF(e){return!e.hasAttribute("em-inline")&&!!e.querySelector("div, p, ul, ol, table, h1, h2, h3, h4, h5, h6, blockquote, center, pre")}var r_=`${JH}, td, th`,nF="br, ul, ol, li, pre",rF=/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g,o_=`${th}, table`,oF=/^delete(Word|SoftLine|HardLine)/;function i_(e,t){const n=e.anchorNode,r=n;if(r?.tagName==="A"&&!r.textContent?.trim().length){r.insertAdjacentText("beforeend",t);const o=document.createRange();return o.selectNodeContents(r),o.collapse(!1),e.removeAllRanges(),e.addRange(o),!0}if(n?.parentNode?.tagName==="A"||r?.tagName==="A"){const o=e.getRangeAt(0),i=document.createTextNode(t);return o.insertNode(i),o.setStartAfter(i),o.collapse(!0),e.removeAllRanges(),e.addRange(o),$f(i,i,wf),!0}return!1}function s_(e,t){return e.replace(/\s+/g," ")===t.replace(/\s+/g," ")}function iF(e){return[a_(e,"previousSibling"),a_(e,"nextSibling")].some(t=>t?.nodeType===Node.TEXT_NODE?!0:t instanceof HTMLElement&&/^(EM-REPLACE|A|IMG|SUB|SUP|SPAN|B|STRONG|I|EM|U|S|FONT)$/.test(t.tagName))}var sF=/^(A|SPAN|B|STRONG|I|EM|U|S|STRIKE|FONT|SUB|SUP|SMALL|BIG|MARK)$/;function aF(e){return e.parentElement!==null&&sF.test(e.parentElement.tagName)}function a_(e,t){let n=e[t];for(;n?.nodeType===Node.TEXT_NODE&&!n.textContent?.trim();)n=n[t];return n}var lF=/^(AREA|BASE|BR|COL|EMBED|HR|IMG|INPUT|LINK|META|SOURCE|TRACK|WBR)$/,l_=/^(SPAN|B|STRONG|I|EM|U|S|STRIKE|FONT|SMALL|BIG|MARK)$/,cF={TABLE:["THEAD","TBODY","TFOOT","TR"],THEAD:["TR"],TBODY:["TR"],TFOOT:["TR"],TR:["TD","TH"]};function kc(e,t){const n=t(e),r=[];for(let o=c_(e,n,t);o;o=uF(o,n,t))r.push(o);return r}function c_(e,t,n){const r=u_(e,n);if(!(!r||lF.test(r.tagName)||r.tagName!=="TABLE"&&r.matches(o_)))return!(r.tagName==="A"||l_.test(r.tagName))||n(r)===t?r:void 0}function uF(e,t,n){const r=cF[e.tagName];if(r)return Array.from(e.children).find(i=>r.includes(i.tagName));if(e.tagName==="TD"||e.tagName==="TH")return c_(e,t,n);const o=u_(e,n);return o&&l_.test(o.tagName)&&n(o)===t?o:void 0}function u_(e,t){for(const n of Array.from(e.childNodes))if(!(Dt(n)&&!t(n))){if(n.nodeType===Node.ELEMENT_NODE)return n;if(t(n))return}}function dF(e,t){if(e.querySelector(nF))return!1;const n=kc(e,t),r=[...n].reverse().find(o=>o.matches(r_));return r!==void 0&&t(r)===t(e)&&Array.from(e.querySelectorAll("*")).every(o=>n.some(i=>i===o)||r.contains(o)&&!o.matches(r_))}function fF(e){const t=e.cloneNode(!1);return t.removeAttribute("em-edit"),t}function mF(e){const t=e.cloneNode(!1);return t.removeAttribute("innerStyle"),t.removeAttribute("innerClass"),t}var hF=e=>G(e)??e;function pF(e){const[t]=e.getTargetRanges();if(!t||t.collapsed)return;const n=document.createRange();return n.setStart(t.startContainer,t.startOffset),n.setEnd(t.endContainer,t.endOffset),n}function gF(e,t){const n=Nf(t,e.inputType.endsWith("Backward")?"backward":"forward");if(!n)return pF(e);const r=document.createRange();return r.selectNode(n),r}var bF={deleteContentBackward:"delete",deleteContentForward:"forwardDelete",deleteByCut:"delete",deleteContent:"delete",insertText:"insertText",insertReplacementText:"insertText",formatBold:"bold",formatItalic:"italic",formatUnderline:"underline",formatStrikeThrough:"strikeThrough",formatSuperscript:"superscript",formatSubscript:"subscript",formatJustifyLeft:"justifyLeft",formatJustifyCenter:"justifyCenter",formatJustifyRight:"justifyRight",formatJustifyFull:"justifyFull",formatRemove:"removeFormat"},yF=["insertText"],nh=!1;function d_(e,t){nh=!0;try{lr(e,!1,t)}finally{nh=!1}}function vF(e){const t=e.dataTransfer?.getData("text/plain")||e.data||void 0,n=e.getTargetRanges?.()[0],r=window.getSelection();if(!t||!n||!r)return;const o=document.createRange();return o.setStart(n.startContainer,n.startOffset),o.setEnd(n.endContainer,n.endOffset),r.removeAllRanges(),r.addRange(o),t}function f_(e){const t=bF[e.inputType];if(!t||e.defaultPrevented||e.isComposing||nh)return!1;const n=e.inputType==="insertReplacementText"?vF(e):e.data??void 0;return yF.includes(t)&&!n?!1:(e.preventDefault(),d_(t,n),!0)}function EF(e){return function(n,r){if(!n||(n.querySelectorAll("editor")?.forEach(s=>{s.onclick=null,s.onkeyup=null,s.onmousedown=null}),Tc(n),document.querySelectorAll(":not(.em-element-path) .em-element-path").forEach(s=>s.remove()),n_(n),i5(n,r)))return;kE(n,Le);const o=document.createElement("editor");if(KH(o),o.classList.add("em-text"),o.setAttribute("contenteditable","true"),r)SF(n)&&o.setAttribute(eF,""),n.before(o),o.replaceChildren(n),Mv(o);else{const s=[...n.childNodes];n.appendChild(o),o.replaceChildren(...s)}const i=o.parentElement;if(i&&!i.style.fontFamily&&!i.style.fontSize&&o.firstElementChild){const s=o.firstElementChild,a=s.getAttribute("style"),l=s.getAttribute("class"),c=s.getAttribute("href"),u=s.getAttribute("target"),d=s.getAttribute("align");a&&o.setAttribute("innerStyle",a),l&&o.setAttribute("innerClass",l),c!==null&&o.setAttribute("innerHref",c),u&&o.setAttribute("innerTarget",u),d&&o.setAttribute("innerAlign",d)}o.addEventListener("input",pt(()=>e.commit(!0)),!0),o.addEventListener("beforeinput",QH({element:n,getVisibleText:AE,mapFn:t5,setCursorToElement:r5,hasOnlyTextNodesDeep:CE,isRangeCoveringAllVisibleText:qP,isEditorContentOnlyNbsp:WP,commit:e.commit,pasteFragment:s=>{const a=l=>eh({target:l.target},c=>e.commit(c));Wl(s,!1,j.get("commonStyles"),a,e.commit)}}))}}function SF(e){const{display:t,cssFloat:n}=getComputedStyle(e);return t.startsWith("inline")||!!n&&n!=="none"}function wF({commit:e,htmlDocument:t,documentMapping:n}){const r=EF({commit:e});return{now:r,deferred:(i,s)=>{const a=t.getRangeByElement(i,!0);a&&n.hasMappedReplacementRangeInRange(a)||$P(()=>r(i,s),"editor")}}}var m_=e=>t=>t.some(n=>e(n).some(_F)),_F=e=>e instanceof Element&&(e.hasAttribute("em-edit")||e.querySelector("[em-edit]")),CF=m_(({removed:e})=>e),TF=m_(({added:e})=>e),AF=e=>t=>{CF(t)&&!TF(t)&&setTimeout(()=>{if(typeof document<"u"&&document.querySelector("[em-edit]"))return;const n=typeof document<"u"?document.querySelector('table[em-type="social"]'):null;if(n?.isConnected){Lr("em-edit"),n.setAttribute("em-edit","active"),e({elem:n});return}e({elem:null})},0)},kF=200;function LF(e){let t=!1;return()=>{if(t)return;t=!0;let n;const r=()=>{t&&(t=!1,clearTimeout(n),e())};n=setTimeout(r,kF),window.requestAnimationFrame(()=>setTimeout(r,0))}}var Ve={drag:"em-icon-drag",moveUp:"em-icon-move-up",moveDown:"em-icon-move-down",merge:"em-icon-merge",unmerge:"em-icon-unmerge",add:"em-icon-add"},xe="em-icon";function NF(e,t,n){return(t=MF(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function dr(){return dr=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},dr.apply(null,arguments)}function h_(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Wn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?h_(Object(n),!0).forEach(function(r){NF(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h_(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function xF(e,t){if(e==null)return{};var n,r,o=OF(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function OF(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function RF(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function MF(e){var t=RF(e,"string");return typeof t=="symbol"?t:t+""}function rh(e){"@babel/helpers - typeof";return rh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rh(e)}var PF="1.15.7";function fr(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var mr=fr(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Qs=fr(/Edge/i),p_=fr(/firefox/i),Js=fr(/safari/i)&&!fr(/chrome/i)&&!fr(/android/i),oh=fr(/iP(ad|od|hone)/i),g_=fr(/chrome/i)&&fr(/android/i),b_={capture:!1,passive:!1};function be(e,t,n){e.addEventListener(t,n,!mr&&b_)}function pe(e,t,n){e.removeEventListener(t,n,!mr&&b_)}function Lc(e,t){if(t){if(t[0]===">"&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch{return!1}return!1}}function y_(e){return e.host&&e!==document&&e.host.nodeType&&e.host!==e?e.host:e.parentNode}function _n(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&Lc(e,t):Lc(e,t))||r&&e===n)return e;if(e===n)break}while(e=y_(e))}return null}var v_=/\s+/g;function Kt(e,t,n){e&&t&&(e.classList?e.classList[n?"add":"remove"](t):e.className=((" "+e.className+" ").replace(v_," ").replace(" "+t+" "," ")+(n?" "+t:"")).replace(v_," "))}function re(e,t,n){var r=e&&e.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),t===void 0?n:n[t];!(t in r)&&t.indexOf("webkit")===-1&&(t="-webkit-"+t),r[t]=n+(typeof n=="string"?"":"px")}}function bi(e,t){var n="";if(typeof e=="string")n=e;else do{var r=re(e,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function E_(e,t,n){if(e){var r=e.getElementsByTagName(t),o=0,i=r.length;if(n)for(;o<i;o++)n(r[o],o);return r}return[]}function qn(){var e=document.scrollingElement;return e||document.documentElement}function et(e,t,n,r,o){if(!(!e.getBoundingClientRect&&e!==window)){var i,s,a,l,c,u,d;if(e!==window&&e.parentNode&&e!==qn()?(i=e.getBoundingClientRect(),s=i.top,a=i.left,l=i.bottom,c=i.right,u=i.height,d=i.width):(s=0,a=0,l=window.innerHeight,c=window.innerWidth,u=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!mr))do if(o&&o.getBoundingClientRect&&(re(o,"transform")!=="none"||n&&re(o,"position")!=="static")){var f=o.getBoundingClientRect();s-=f.top+parseInt(re(o,"border-top-width")),a-=f.left+parseInt(re(o,"border-left-width")),l=s+i.height,c=a+i.width;break}while(o=o.parentNode);if(r&&e!==window){var h=bi(o||e),m=h&&h.a,p=h&&h.d;h&&(s/=p,a/=m,d/=m,u/=p,l=s+u,c=a+d)}return{top:s,left:a,bottom:l,right:c,width:d,height:u}}}function S_(e,t,n){for(var r=Br(e,!0),o=et(e)[t];r;){var i=et(r)[n],s=void 0;if(n==="top"||n==="left"?s=o>=i:s=o<=i,!s)return r;if(r===qn())break;r=Br(r,!1)}return!1}function yi(e,t,n,r){for(var o=0,i=0,s=e.children;i<s.length;){if(s[i].style.display!=="none"&&s[i]!==Q.ghost&&(r||s[i]!==Q.dragged)&&_n(s[i],n.draggable,e,!1)){if(o===t)return s[i];o++}i++}return null}function ih(e,t){for(var n=e.lastElementChild;n&&(n===Q.ghost||re(n,"display")==="none"||t&&!Lc(n,t));)n=n.previousElementSibling;return n||null}function an(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==Q.clone&&(!t||Lc(e,t))&&n++;return n}function w_(e){var t=0,n=0,r=qn();if(e)do{var o=bi(e),i=o.a,s=o.d;t+=e.scrollLeft*i,n+=e.scrollTop*s}while(e!==r&&(e=e.parentNode));return[t,n]}function IF(e,t){for(var n in e)if(e.hasOwnProperty(n)){for(var r in t)if(t.hasOwnProperty(r)&&t[r]===e[n][r])return Number(n)}return-1}function Br(e,t){if(!e||!e.getBoundingClientRect)return qn();var n=e,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=re(n);if(n.clientWidth<n.scrollWidth&&(o.overflowX=="auto"||o.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(o.overflowY=="auto"||o.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return qn();if(r||t)return n;r=!0}}while(n=n.parentNode);return qn()}function DF(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function sh(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}var ea;function __(e,t){return function(){if(!ea){var n=arguments,r=this;n.length===1?e.call(r,n[0]):e.apply(r,n),ea=setTimeout(function(){ea=void 0},t)}}}function BF(){clearTimeout(ea),ea=void 0}function C_(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function T_(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}function A_(e,t,n){var r={};return Array.from(e.children).forEach(function(o){var i,s,a,l;if(!(!_n(o,t.draggable,e,!1)||o.animated||o===n)){var c=et(o);r.left=Math.min((i=r.left)!==null&&i!==void 0?i:1/0,c.left),r.top=Math.min((s=r.top)!==null&&s!==void 0?s:1/0,c.top),r.right=Math.max((a=r.right)!==null&&a!==void 0?a:-1/0,c.right),r.bottom=Math.max((l=r.bottom)!==null&&l!==void 0?l:-1/0,c.bottom)}}),r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}var Ft="Sortable"+new Date().getTime();function HF(){var e=[],t;return{captureAnimationState:function(){e=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(r){if(!(re(r,"display")==="none"||r===Q.ghost)){e.push({target:r,rect:et(r)});var o=Wn({},e[e.length-1].rect);if(r.thisAnimationDuration){var i=bi(r,!0);i&&(o.top-=i.f,o.left-=i.e)}r.fromRect=o}})},addAnimationState:function(r){e.push(r)},removeAnimationState:function(r){e.splice(IF(e,{target:r}),1)},animateAll:function(r){var o=this;if(!this.options.animation){clearTimeout(t),typeof r=="function"&&r();return}var i=!1,s=0;e.forEach(function(a){var l=0,c=a.target,u=c.fromRect,d=et(c),f=c.prevFromRect,h=c.prevToRect,m=a.rect,p=bi(c,!0);p&&(d.top-=p.f,d.left-=p.e),c.toRect=d,c.thisAnimationDuration&&sh(f,d)&&!sh(u,d)&&(m.top-d.top)/(m.left-d.left)===(u.top-d.top)/(u.left-d.left)&&(l=$F(m,f,h,o.options)),sh(d,u)||(c.prevFromRect=u,c.prevToRect=d,l||(l=o.options.animation),o.animate(c,m,d,l)),l&&(i=!0,s=Math.max(s,l),clearTimeout(c.animationResetTimer),c.animationResetTimer=setTimeout(function(){c.animationTime=0,c.prevFromRect=null,c.fromRect=null,c.prevToRect=null,c.thisAnimationDuration=null},l),c.thisAnimationDuration=l)}),clearTimeout(t),i?t=setTimeout(function(){typeof r=="function"&&r()},s):typeof r=="function"&&r(),e=[]},animate:function(r,o,i,s){if(s){re(r,"transition",""),re(r,"transform","");var a=bi(this.el),l=a&&a.a,c=a&&a.d,u=(o.left-i.left)/(l||1),d=(o.top-i.top)/(c||1);r.animatingX=!!u,r.animatingY=!!d,re(r,"transform","translate3d("+u+"px,"+d+"px,0)"),this.forRepaintDummy=FF(r),re(r,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),re(r,"transform","translate3d(0,0,0)"),typeof r.animated=="number"&&clearTimeout(r.animated),r.animated=setTimeout(function(){re(r,"transition",""),re(r,"transform",""),r.animated=!1,r.animatingX=!1,r.animatingY=!1},s)}}}}function FF(e){return e.offsetWidth}function $F(e,t,n,r){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*r.animation}var vi=[],ah={initializeByDefault:!0},ta={mount:function(t){for(var n in ah)ah.hasOwnProperty(n)&&!(n in t)&&(t[n]=ah[n]);vi.forEach(function(r){if(r.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),vi.push(t)},pluginEvent:function(t,n,r){var o=this;this.eventCanceled=!1,r.cancel=function(){o.eventCanceled=!0};var i=t+"Global";vi.forEach(function(s){n[s.pluginName]&&(n[s.pluginName][i]&&n[s.pluginName][i](Wn({sortable:n},r)),n.options[s.pluginName]&&n[s.pluginName][t]&&n[s.pluginName][t](Wn({sortable:n},r)))})},initializePlugins:function(t,n,r,o){vi.forEach(function(a){var l=a.pluginName;if(!(!t.options[l]&&!a.initializeByDefault)){var c=new a(t,n,t.options);c.sortable=t,c.options=t.options,t[l]=c,dr(r,c.defaults)}});for(var i in t.options)if(t.options.hasOwnProperty(i)){var s=this.modifyOption(t,i,t.options[i]);typeof s<"u"&&(t.options[i]=s)}},getEventProperties:function(t,n){var r={};return vi.forEach(function(o){typeof o.eventProperties=="function"&&dr(r,o.eventProperties.call(n[o.pluginName],t))}),r},modifyOption:function(t,n,r){var o;return vi.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[n]=="function"&&(o=i.optionListeners[n].call(t[i.pluginName],r))}),o}};function WF(e){var t=e.sortable,n=e.rootEl,r=e.name,o=e.targetEl,i=e.cloneEl,s=e.toEl,a=e.fromEl,l=e.oldIndex,c=e.newIndex,u=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,m=e.extraEventProperties;if(t=t||n&&n[Ft],!!t){var p,v=t.options,C="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!mr&&!Qs?p=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(p=document.createEvent("Event"),p.initEvent(r,!0,!0)),p.to=s||n,p.from=a||n,p.item=o||n,p.clone=i,p.oldIndex=l,p.newIndex=c,p.oldDraggableIndex=u,p.newDraggableIndex=d,p.originalEvent=f,p.pullMode=h?h.lastPutMode:void 0;var k=Wn(Wn({},m),ta.getEventProperties(r,t));for(var L in k)p[L]=k[L];n&&n.dispatchEvent(p),v[C]&&v[C].call(t,p)}}var qF=["evt"],$t=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.evt,i=xF(r,qF);ta.pluginEvent.bind(Q)(t,n,Wn({dragEl:H,parentEl:Ge,ghostEl:ce,rootEl:He,nextEl:vo,lastDownEl:Nc,cloneEl:$e,cloneHidden:Hr,dragStarted:ra,putSortable:gt,activeSortable:Q.active,originalEvent:o,oldIndex:Ei,oldDraggableIndex:na,newIndex:Yt,newDraggableIndex:Fr,hideGhostForTarget:M_,unhideGhostForTarget:P_,cloneNowHidden:function(){Hr=!0},cloneNowShown:function(){Hr=!1},dispatchSortableEvent:function(a){Nt({sortable:n,name:a,originalEvent:o})}},i))};function Nt(e){WF(Wn({putSortable:gt,cloneEl:$e,targetEl:H,rootEl:He,oldIndex:Ei,oldDraggableIndex:na,newIndex:Yt,newDraggableIndex:Fr},e))}var H,Ge,ce,He,vo,Nc,$e,Hr,Ei,Yt,na,Fr,xc,gt,Si=!1,Oc=!1,Rc=[],Eo,Cn,lh,ch,k_,L_,ra,wi,oa,ia=!1,Mc=!1,Pc,Et,uh=[],dh=!1,Ic=[],Dc=typeof document<"u",Bc=oh,N_=Qs||mr?"cssFloat":"float",zF=Dc&&!g_&&!oh&&"draggable"in document.createElement("div"),x_=(function(){if(Dc){if(mr)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}})(),O_=function(t,n){var r=re(t),o=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),i=yi(t,0,n),s=yi(t,1,n),a=i&&re(i),l=s&&re(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+et(i).width,u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+et(s).width;if(r.display==="flex")return r.flexDirection==="column"||r.flexDirection==="column-reverse"?"vertical":"horizontal";if(r.display==="grid")return r.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&a.float&&a.float!=="none"){var d=a.float==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return i&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=o&&r[N_]==="none"||s&&r[N_]==="none"&&c+u>o)?"vertical":"horizontal"},UF=function(t,n,r){var o=r?t.left:t.top,i=r?t.right:t.bottom,s=r?t.width:t.height,a=r?n.left:n.top,l=r?n.right:n.bottom,c=r?n.width:n.height;return o===a||i===l||o+s/2===a+c/2},jF=function(t,n){var r;return Rc.some(function(o){var i=o[Ft].options.emptyInsertThreshold;if(!(!i||ih(o))){var s=et(o),a=t>=s.left-i&&t<=s.right+i,l=n>=s.top-i&&n<=s.bottom+i;if(a&&l)return r=o}}),r},R_=function(t){function n(i,s){return function(a,l,c,u){var d=a.options.group.name&&l.options.group.name&&a.options.group.name===l.options.group.name;if(i==null&&(s||d))return!0;if(i==null||i===!1)return!1;if(s&&i==="clone")return i;if(typeof i=="function")return n(i(a,l,c,u),s)(a,l,c,u);var f=(s?a:l).options.group.name;return i===!0||typeof i=="string"&&i===f||i.join&&i.indexOf(f)>-1}}var r={},o=t.group;(!o||rh(o)!="object")&&(o={name:o}),r.name=o.name,r.checkPull=n(o.pull,!0),r.checkPut=n(o.put),r.revertClone=o.revertClone,t.group=r},M_=function(){!x_&&ce&&re(ce,"display","none")},P_=function(){!x_&&ce&&re(ce,"display","")};Dc&&!g_&&document.addEventListener("click",function(e){if(Oc)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Oc=!1,!1},!0);var So=function(t){if(H){t=t.touches?t.touches[0]:t;var n=jF(t.clientX,t.clientY);if(n){var r={};for(var o in t)t.hasOwnProperty(o)&&(r[o]=t[o]);r.target=r.rootEl=n,r.preventDefault=void 0,r.stopPropagation=void 0,n[Ft]._onDragOver(r)}}},VF=function(t){H&&H.parentNode[Ft]._isOutsideThisEl(t.target)};function Q(e,t){if(!(e&&e.nodeType&&e.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=dr({},t),e[Ft]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return O_(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(s,a){s.setData("Text",a.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:Q.supportPointer!==!1&&"PointerEvent"in window&&(!Js||oh),emptyInsertThreshold:5};ta.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);R_(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:zF,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?be(e,"pointerdown",this._onTapStart):(be(e,"mousedown",this._onTapStart),be(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(be(e,"dragover",this),be(e,"dragenter",this)),Rc.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),dr(this,HF())}Q.prototype={constructor:Q,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(wi=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,H):this.options.direction},_onTapStart:function(t){if(t.cancelable){var n=this,r=this.el,o=this.options,i=o.preventOnFilter,s=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,u=o.filter;if(e$(r),!H&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&Js&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=_n(l,o.draggable,r,!1),!(l&&l.animated)&&Nc!==l)){if(Ei=an(l),na=an(l,o.draggable),typeof u=="function"){if(u.call(this,t,l,this)){Nt({sortable:n,rootEl:c,name:"filter",targetEl:l,toEl:r,fromEl:r}),$t("filter",n,{evt:t}),i&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(d){if(d=_n(c,d.trim(),r,!1),d)return Nt({sortable:n,rootEl:d,name:"filter",targetEl:l,fromEl:r,toEl:r}),$t("filter",n,{evt:t}),!0}),u)){i&&t.preventDefault();return}o.handle&&!_n(c,o.handle,r,!1)||this._prepareDragStart(t,a,l)}}},_prepareDragStart:function(t,n,r){var o=this,i=o.el,s=o.options,a=i.ownerDocument,l;if(r&&!H&&r.parentNode===i){var c=et(r);if(He=i,H=r,Ge=H.parentNode,vo=H.nextSibling,Nc=r,xc=s.group,Q.dragged=H,Eo={target:H,clientX:(n||t).clientX,clientY:(n||t).clientY},k_=Eo.clientX-c.left,L_=Eo.clientY-c.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,H.style["will-change"]="all",l=function(){if($t("delayEnded",o,{evt:t}),Q.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!p_&&o.nativeDraggable&&(H.draggable=!0),o._triggerDragStart(t,n),Nt({sortable:o,name:"choose",originalEvent:t}),Kt(H,s.chosenClass,!0)},s.ignore.split(",").forEach(function(u){E_(H,u.trim(),fh)}),be(a,"dragover",So),be(a,"mousemove",So),be(a,"touchmove",So),s.supportPointer?(be(a,"pointerup",o._onDrop),!this.nativeDraggable&&be(a,"pointercancel",o._onDrop)):(be(a,"mouseup",o._onDrop),be(a,"touchend",o._onDrop),be(a,"touchcancel",o._onDrop)),p_&&this.nativeDraggable&&(this.options.touchStartThreshold=4,H.draggable=!0),$t("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Qs||mr))){if(Q.eventCanceled){this._onDrop();return}s.supportPointer?(be(a,"pointerup",o._disableDelayedDrag),be(a,"pointercancel",o._disableDelayedDrag)):(be(a,"mouseup",o._disableDelayedDrag),be(a,"touchend",o._disableDelayedDrag),be(a,"touchcancel",o._disableDelayedDrag)),be(a,"mousemove",o._delayedDragTouchMoveHandler),be(a,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&be(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(l,s.delay)}else l()}},_delayedDragTouchMoveHandler:function(t){var n=t.touches?t.touches[0]:t;Math.max(Math.abs(n.clientX-this._lastX),Math.abs(n.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){H&&fh(H),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;pe(t,"mouseup",this._disableDelayedDrag),pe(t,"touchend",this._disableDelayedDrag),pe(t,"touchcancel",this._disableDelayedDrag),pe(t,"pointerup",this._disableDelayedDrag),pe(t,"pointercancel",this._disableDelayedDrag),pe(t,"mousemove",this._delayedDragTouchMoveHandler),pe(t,"touchmove",this._delayedDragTouchMoveHandler),pe(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?be(document,"pointermove",this._onTouchMove):n?be(document,"touchmove",this._onTouchMove):be(document,"mousemove",this._onTouchMove):(be(H,"dragend",this),be(He,"dragstart",this._onDragStart));try{document.selection?Fc(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(Si=!1,He&&H){$t("dragStarted",this,{evt:n}),this.nativeDraggable&&be(document,"dragover",VF);var r=this.options;!t&&Kt(H,r.dragClass,!1),Kt(H,r.ghostClass,!0),Q.active=this,t&&this._appendGhost(),Nt({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(Cn){this._lastX=Cn.clientX,this._lastY=Cn.clientY,M_();for(var t=document.elementFromPoint(Cn.clientX,Cn.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Cn.clientX,Cn.clientY),t!==n);)n=t;if(H.parentNode[Ft]._isOutsideThisEl(t),n)do{if(n[Ft]){var r=void 0;if(r=n[Ft]._onDragOver({clientX:Cn.clientX,clientY:Cn.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=y_(n));P_()}},_onTouchMove:function(t){if(Eo){var n=this.options,r=n.fallbackTolerance,o=n.fallbackOffset,i=t.touches?t.touches[0]:t,s=ce&&bi(ce,!0),a=ce&&s&&s.a,l=ce&&s&&s.d,c=Bc&&Et&&w_(Et),u=(i.clientX-Eo.clientX+o.x)/(a||1)+(c?c[0]-uh[0]:0)/(a||1),d=(i.clientY-Eo.clientY+o.y)/(l||1)+(c?c[1]-uh[1]:0)/(l||1);if(!Q.active&&!Si){if(r&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<r)return;this._onDragStart(t,!0)}if(ce){s?(s.e+=u-(lh||0),s.f+=d-(ch||0)):s={a:1,b:0,c:0,d:1,e:u,f:d};var f="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");re(ce,"webkitTransform",f),re(ce,"mozTransform",f),re(ce,"msTransform",f),re(ce,"transform",f),lh=u,ch=d,Cn=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ce){var t=this.options.fallbackOnBody?document.body:He,n=et(H,!0,Bc,!0,t),r=this.options;if(Bc){for(Et=t;re(Et,"position")==="static"&&re(Et,"transform")==="none"&&Et!==document;)Et=Et.parentNode;Et!==document.body&&Et!==document.documentElement?(Et===document&&(Et=qn()),n.top+=Et.scrollTop,n.left+=Et.scrollLeft):Et=qn(),uh=w_(Et)}ce=H.cloneNode(!0),Kt(ce,r.ghostClass,!1),Kt(ce,r.fallbackClass,!0),Kt(ce,r.dragClass,!0),re(ce,"transition",""),re(ce,"transform",""),re(ce,"box-sizing","border-box"),re(ce,"margin",0),re(ce,"top",n.top),re(ce,"left",n.left),re(ce,"width",n.width),re(ce,"height",n.height),re(ce,"opacity","0.8"),re(ce,"position",Bc?"absolute":"fixed"),re(ce,"zIndex","100000"),re(ce,"pointerEvents","none"),Q.ghost=ce,t.appendChild(ce),re(ce,"transform-origin",k_/parseInt(ce.style.width)*100+"% "+L_/parseInt(ce.style.height)*100+"%")}},_onDragStart:function(t,n){var r=this,o=t.dataTransfer,i=r.options;if($t("dragStart",this,{evt:t}),Q.eventCanceled){this._onDrop();return}$t("setupClone",this),Q.eventCanceled||($e=T_(H),$e.removeAttribute("id"),$e.draggable=!1,$e.style["will-change"]="",this._hideClone(),Kt($e,this.options.chosenClass,!1),Q.clone=$e),r.cloneId=Fc(function(){$t("clone",r),!Q.eventCanceled&&(r.options.removeCloneOnHide||He.insertBefore($e,H),r._hideClone(),Nt({sortable:r,name:"clone"}))}),!n&&Kt(H,i.dragClass,!0),n?(Oc=!0,r._loopId=setInterval(r._emulateDragOver,50)):(pe(document,"mouseup",r._onDrop),pe(document,"touchend",r._onDrop),pe(document,"touchcancel",r._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(r,o,H)),be(document,"drop",r),re(H,"transform","translateZ(0)")),Si=!0,r._dragStartId=Fc(r._dragStarted.bind(r,n,t)),be(document,"selectstart",r),ra=!0,window.getSelection().removeAllRanges(),Js&&re(document.body,"user-select","none")},_onDragOver:function(t){var n=this.el,r=t.target,o,i,s,a=this.options,l=a.group,c=Q.active,u=xc===l,d=a.sort,f=gt||c,h,m=this,p=!1;if(dh)return;function v(K,se){$t(K,m,Wn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:s,dragRect:o,targetRect:i,canSort:d,fromSortable:f,target:r,completed:k,onMove:function(Z,ve){return Hc(He,n,H,o,Z,et(Z),t,ve)},changed:L},se))}function C(){v("dragOverAnimationCapture"),m.captureAnimationState(),m!==f&&f.captureAnimationState()}function k(K){return v("dragOverCompleted",{insertion:K}),K&&(u?c._hideClone():c._showClone(m),m!==f&&(Kt(H,gt?gt.options.ghostClass:c.options.ghostClass,!1),Kt(H,a.ghostClass,!0)),gt!==m&&m!==Q.active?gt=m:m===Q.active&>&&(gt=null),f===m&&(m._ignoreWhileAnimating=r),m.animateAll(function(){v("dragOverAnimationComplete"),m._ignoreWhileAnimating=null}),m!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(r===H&&!H.animated||r===n&&!r.animated)&&(wi=null),!a.dragoverBubble&&!t.rootEl&&r!==document&&(H.parentNode[Ft]._isOutsideThisEl(t.target),!K&&So(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),p=!0}function L(){Yt=an(H),Fr=an(H,a.draggable),Nt({sortable:m,name:"change",toEl:n,newIndex:Yt,newDraggableIndex:Fr,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),r=_n(r,a.draggable,n,!0),v("dragOver"),Q.eventCanceled)return p;if(H.contains(t.target)||r.animated&&r.animatingX&&r.animatingY||m._ignoreWhileAnimating===r)return k(!1);if(Oc=!1,c&&!a.disabled&&(u?d||(s=Ge!==He):gt===this||(this.lastPutMode=xc.checkPull(this,c,H,t))&&l.checkPut(this,c,H,t))){if(h=this._getDirection(t,r)==="vertical",o=et(H),v("dragOverValid"),Q.eventCanceled)return p;if(s)return Ge=He,C(),this._hideClone(),v("revert"),Q.eventCanceled||(vo?He.insertBefore(H,vo):He.appendChild(H)),k(!0);var E=ih(n,a.draggable);if(!E||YF(t,h,this)&&!E.animated){if(E===H)return k(!1);if(E&&n===t.target&&(r=E),r&&(i=et(r)),Hc(He,n,H,o,r,i,t,!!r)!==!1)return C(),E&&E.nextSibling?n.insertBefore(H,E.nextSibling):n.appendChild(H),Ge=n,L(),k(!0)}else if(E&&KF(t,h,this)){var g=yi(n,0,a,!0);if(g===H)return k(!1);if(r=g,i=et(r),Hc(He,n,H,o,r,i,t,!1)!==!1)return C(),n.insertBefore(H,g),Ge=n,L(),k(!0)}else if(r.parentNode===n){i=et(r);var y=0,w,b=H.parentNode!==n,S=!UF(H.animated&&H.toRect||o,r.animated&&r.toRect||i,h),_=h?"top":"left",T=S_(r,"top","top")||S_(H,"top","top"),x=T?T.scrollTop:void 0;wi!==r&&(w=i[_],ia=!1,Mc=!S&&a.invertSwap||b),y=ZF(t,r,i,h,S?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,Mc,wi===r);var N;if(y!==0){var I=an(H);do I-=y,N=Ge.children[I];while(N&&(re(N,"display")==="none"||N===ce))}if(y===0||N===r)return k(!1);wi=r,oa=y;var O=r.nextElementSibling,M=!1;M=y===1;var V=Hc(He,n,H,o,r,i,t,M);if(V!==!1)return(V===1||V===-1)&&(M=V===1),dh=!0,setTimeout(XF,30),C(),M&&!O?n.appendChild(H):r.parentNode.insertBefore(H,M?O:r),T&&C_(T,0,x-T.scrollTop),Ge=H.parentNode,w!==void 0&&!Mc&&(Pc=Math.abs(w-et(r)[_])),L(),k(!0)}if(n.contains(H))return k(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){pe(document,"mousemove",this._onTouchMove),pe(document,"touchmove",this._onTouchMove),pe(document,"pointermove",this._onTouchMove),pe(document,"dragover",So),pe(document,"mousemove",So),pe(document,"touchmove",So)},_offUpEvents:function(){var t=this.el.ownerDocument;pe(t,"mouseup",this._onDrop),pe(t,"touchend",this._onDrop),pe(t,"pointerup",this._onDrop),pe(t,"pointercancel",this._onDrop),pe(t,"touchcancel",this._onDrop),pe(document,"selectstart",this)},_onDrop:function(t){var n=this.el,r=this.options;if(Yt=an(H),Fr=an(H,r.draggable),$t("drop",this,{evt:t}),Ge=H&&H.parentNode,Yt=an(H),Fr=an(H,r.draggable),Q.eventCanceled){this._nulling();return}Si=!1,Mc=!1,ia=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),mh(this.cloneId),mh(this._dragStartId),this.nativeDraggable&&(pe(document,"drop",this),pe(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Js&&re(document.body,"user-select",""),re(H,"transform",""),t&&(ra&&(t.cancelable&&t.preventDefault(),!r.dropBubble&&t.stopPropagation()),ce&&ce.parentNode&&ce.parentNode.removeChild(ce),(He===Ge||gt&>.lastPutMode!=="clone")&&$e&&$e.parentNode&&$e.parentNode.removeChild($e),H&&(this.nativeDraggable&&pe(H,"dragend",this),fh(H),H.style["will-change"]="",ra&&!Si&&Kt(H,gt?gt.options.ghostClass:this.options.ghostClass,!1),Kt(H,this.options.chosenClass,!1),Nt({sortable:this,name:"unchoose",toEl:Ge,newIndex:null,newDraggableIndex:null,originalEvent:t}),He!==Ge?(Yt>=0&&(Nt({rootEl:Ge,name:"add",toEl:Ge,fromEl:He,originalEvent:t}),Nt({sortable:this,name:"remove",toEl:Ge,originalEvent:t}),Nt({rootEl:Ge,name:"sort",toEl:Ge,fromEl:He,originalEvent:t}),Nt({sortable:this,name:"sort",toEl:Ge,originalEvent:t})),gt&>.save()):Yt!==Ei&&Yt>=0&&(Nt({sortable:this,name:"update",toEl:Ge,originalEvent:t}),Nt({sortable:this,name:"sort",toEl:Ge,originalEvent:t})),Q.active&&((Yt==null||Yt===-1)&&(Yt=Ei,Fr=na),Nt({sortable:this,name:"end",toEl:Ge,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){$t("nulling",this),He=H=Ge=ce=vo=$e=Nc=Hr=Eo=Cn=ra=Yt=Fr=Ei=na=wi=oa=gt=xc=Q.dragged=Q.ghost=Q.clone=Q.active=null;var t=this.el;Ic.forEach(function(n){t.contains(n)&&(n.checked=!0)}),Ic.length=lh=ch=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":H&&(this._onDragOver(t),GF(t));break;case"selectstart":t.preventDefault()}},toArray:function(){for(var t=[],n,r=this.el.children,o=0,i=r.length,s=this.options;o<i;o++)n=r[o],_n(n,s.draggable,this.el,!1)&&t.push(n.getAttribute(s.dataIdAttr)||JF(n));return t},sort:function(t,n){var r={},o=this.el;this.toArray().forEach(function(i,s){var a=o.children[s];_n(a,this.options.draggable,o,!1)&&(r[i]=a)},this),n&&this.captureAnimationState(),t.forEach(function(i){r[i]&&(o.removeChild(r[i]),o.appendChild(r[i]))}),n&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,n){return _n(t,n||this.options.draggable,this.el,!1)},option:function(t,n){var r=this.options;if(n===void 0)return r[t];var o=ta.modifyOption(this,t,n);typeof o<"u"?r[t]=o:r[t]=n,t==="group"&&R_(r)},destroy:function(){$t("destroy",this);var t=this.el;t[Ft]=null,pe(t,"mousedown",this._onTapStart),pe(t,"touchstart",this._onTapStart),pe(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(pe(t,"dragover",this),pe(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Rc.splice(Rc.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Hr){if($t("hideClone",this),Q.eventCanceled)return;re($e,"display","none"),this.options.removeCloneOnHide&&$e.parentNode&&$e.parentNode.removeChild($e),Hr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Hr){if($t("showClone",this),Q.eventCanceled)return;H.parentNode==He&&!this.options.group.revertClone?He.insertBefore($e,H):vo?He.insertBefore($e,vo):He.appendChild($e),this.options.group.revertClone&&this.animate(H,$e),re($e,"display",""),Hr=!1}}};function GF(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function Hc(e,t,n,r,o,i,s,a){var l,c=e[Ft],u=c.options.onMove,d;return window.CustomEvent&&!mr&&!Qs?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=t,l.from=e,l.dragged=n,l.draggedRect=r,l.related=o||t,l.relatedRect=i||et(t),l.willInsertAfter=a,l.originalEvent=s,e.dispatchEvent(l),u&&(d=u.call(c,l,s)),d}function fh(e){e.draggable=!1}function XF(){dh=!1}function KF(e,t,n){var r=et(yi(n.el,0,n.options,!0)),o=A_(n.el,n.options,ce),i=10;return t?e.clientX<o.left-i||e.clientY<r.top&&e.clientX<r.right:e.clientY<o.top-i||e.clientY<r.bottom&&e.clientX<r.left}function YF(e,t,n){var r=et(ih(n.el,n.options.draggable)),o=A_(n.el,n.options,ce),i=10;return t?e.clientX>o.right+i||e.clientY>r.bottom&&e.clientX>r.left:e.clientY>o.bottom+i||e.clientX>r.right&&e.clientY>r.top}function ZF(e,t,n,r,o,i,s,a){var l=r?e.clientY:e.clientX,c=r?n.height:n.width,u=r?n.top:n.left,d=r?n.bottom:n.right,f=!1;if(!s){if(a&&Pc<c*o){if(!ia&&(oa===1?l>u+c*i/2:l<d-c*i/2)&&(ia=!0),ia)f=!0;else if(oa===1?l<u+Pc:l>d-Pc)return-oa}else if(l>u+c*(1-o)/2&&l<d-c*(1-o)/2)return QF(t)}return f=f||s,f&&(l<u+c*i/2||l>d-c*i/2)?l>u+c/2?1:-1:0}function QF(e){return an(H)<an(e)?1:-1}function JF(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,r=0;n--;)r+=t.charCodeAt(n);return r.toString(36)}function e$(e){Ic.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var r=t[n];r.checked&&Ic.push(r)}}function Fc(e){return setTimeout(e,0)}function mh(e){return clearTimeout(e)}Dc&&be(document,"touchmove",function(e){(Q.active||Si)&&e.cancelable&&e.preventDefault()}),Q.utils={on:be,off:pe,css:re,find:E_,is:function(t,n){return!!_n(t,n,t,!1)},extend:DF,throttle:__,closest:_n,toggleClass:Kt,clone:T_,index:an,nextTick:Fc,cancelNextTick:mh,detectDirection:O_,getChild:yi,expando:Ft},Q.get=function(e){return e[Ft]},Q.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(Q.utils=Wn(Wn({},Q.utils),r.utils)),ta.mount(r)})},Q.create=function(e,t){return new Q(e,t)},Q.version=PF;var tt=[],sa,hh,ph=!1,gh,bh,$c,aa;function t$(){function e(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var t in this)t.charAt(0)==="_"&&typeof this[t]=="function"&&(this[t]=this[t].bind(this))}return e.prototype={dragStarted:function(n){var r=n.originalEvent;this.sortable.nativeDraggable?be(document,"dragover",this._handleAutoScroll):this.options.supportPointer?be(document,"pointermove",this._handleFallbackAutoScroll):r.touches?be(document,"touchmove",this._handleFallbackAutoScroll):be(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var r=n.originalEvent;!this.options.dragOverBubble&&!r.rootEl&&this._handleAutoScroll(r)},drop:function(){this.sortable.nativeDraggable?pe(document,"dragover",this._handleAutoScroll):(pe(document,"pointermove",this._handleFallbackAutoScroll),pe(document,"touchmove",this._handleFallbackAutoScroll),pe(document,"mousemove",this._handleFallbackAutoScroll)),I_(),Wc(),BF()},nulling:function(){$c=hh=sa=ph=aa=gh=bh=null,tt.length=0},_handleFallbackAutoScroll:function(n){this._handleAutoScroll(n,!0)},_handleAutoScroll:function(n,r){var o=this,i=(n.touches?n.touches[0]:n).clientX,s=(n.touches?n.touches[0]:n).clientY,a=document.elementFromPoint(i,s);if($c=n,r||this.options.forceAutoScrollFallback||Qs||mr||Js){yh(n,this.options,a,r);var l=Br(a,!0);ph&&(!aa||i!==gh||s!==bh)&&(aa&&I_(),aa=setInterval(function(){var c=Br(document.elementFromPoint(i,s),!0);c!==l&&(l=c,Wc()),yh(n,o.options,c,r)},10),gh=i,bh=s)}else{if(!this.options.bubbleScroll||Br(a,!0)===qn()){Wc();return}yh(n,this.options,Br(a,!1),!1)}}},dr(e,{pluginName:"scroll",initializeByDefault:!0})}function Wc(){tt.forEach(function(e){clearInterval(e.pid)}),tt=[]}function I_(){clearInterval(aa)}var yh=__(function(e,t,n,r){if(t.scroll){var o=(e.touches?e.touches[0]:e).clientX,i=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,a=t.scrollSpeed,l=qn(),c=!1,u;hh!==n&&(hh=n,Wc(),sa=t.scroll,u=t.scrollFn,sa===!0&&(sa=Br(n,!0)));var d=0,f=sa;do{var h=f,m=et(h),p=m.top,v=m.bottom,C=m.left,k=m.right,L=m.width,E=m.height,g=void 0,y=void 0,w=h.scrollWidth,b=h.scrollHeight,S=re(h),_=h.scrollLeft,T=h.scrollTop;h===l?(g=L<w&&(S.overflowX==="auto"||S.overflowX==="scroll"||S.overflowX==="visible"),y=E<b&&(S.overflowY==="auto"||S.overflowY==="scroll"||S.overflowY==="visible")):(g=L<w&&(S.overflowX==="auto"||S.overflowX==="scroll"),y=E<b&&(S.overflowY==="auto"||S.overflowY==="scroll"));var x=g&&(Math.abs(k-o)<=s&&_+L<w)-(Math.abs(C-o)<=s&&!!_),N=y&&(Math.abs(v-i)<=s&&T+E<b)-(Math.abs(p-i)<=s&&!!T);if(!tt[d])for(var I=0;I<=d;I++)tt[I]||(tt[I]={});(tt[d].vx!=x||tt[d].vy!=N||tt[d].el!==h)&&(tt[d].el=h,tt[d].vx=x,tt[d].vy=N,clearInterval(tt[d].pid),(x!=0||N!=0)&&(c=!0,tt[d].pid=setInterval(function(){r&&this.layer===0&&Q.active._onTouchMove($c);var O=tt[this.layer].vy?tt[this.layer].vy*a:0,M=tt[this.layer].vx?tt[this.layer].vx*a:0;typeof u=="function"&&u.call(Q.dragged.parentNode[Ft],M,O,e,$c,tt[this.layer].el)!=="continue"||C_(tt[this.layer].el,M,O)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&f!==l&&(f=Br(f,!1)));ph=c}},30),D_=function(t){var n=t.originalEvent,r=t.putSortable,o=t.dragEl,i=t.activeSortable,s=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(n){var c=r||i;a();var u=n.changedTouches&&n.changedTouches.length?n.changedTouches[0]:n,d=document.elementFromPoint(u.clientX,u.clientY);l(),c&&!c.el.contains(d)&&(s("spill"),this.onSpill({dragEl:o,putSortable:r}))}};function vh(){}vh.prototype={startIndex:null,dragStart:function(t){var n=t.oldDraggableIndex;this.startIndex=n},onSpill:function(t){var n=t.dragEl,r=t.putSortable;this.sortable.captureAnimationState(),r&&r.captureAnimationState();var o=yi(this.sortable.el,this.startIndex,this.options);o?this.sortable.el.insertBefore(n,o):this.sortable.el.appendChild(n),this.sortable.animateAll(),r&&r.animateAll()},drop:D_},dr(vh,{pluginName:"revertOnSpill"});function Eh(){}Eh.prototype={onSpill:function(t){var n=t.dragEl,r=t.putSortable||this.sortable;r.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),r.animateAll()},drop:D_},dr(Eh,{pluginName:"removeOnSpill"}),Q.mount(new t$),Q.mount(Eh,vh);var B_=100,H_=Symbol("EMULATED_DRAG_EVENT");function n$(e,t){return e[H_]===t}var F_=class{constructor(){A(this,"_target",null),A(this,"_interval",0),A(this,"_x",0),A(this,"_y",0)}_fireDragEvent(e,t,n,r,o){const i=new DragEvent(t,{dataTransfer:o,clientX:n,clientY:r,bubbles:!0,cancelable:!0});return i[H_]=this,It(()=>e.dispatchEvent(i)),!i.defaultPrevented}start(e,t,n){const r=document.elementFromPoint(e,t);return r&&!this._target&&this._fireDragEvent(r,"dragstart",e,t,n)?(this._target=r,this._x=e,this._y=t,this._interval=setInterval(()=>{this._fireDragEvent(r,"drag",this._x,this._y,n)},B_),!0):!1}enter(e,t,n){const r=document.elementFromPoint(e,t);r&&r!==this._target&&(this._fireDragEvent(r,"dragenter",e,t,n),this._target=r,this._interval||(this._interval=setInterval(()=>{this._fireDragEvent(r,"drag",this._x,this._y,n)},B_)))}over(e,t,n){this._x=e,this._y=t;const r=document.elementFromPoint(e,t);r&&(r!==this._target&&this._fireDragEvent(r,"dragenter",e,t,n),this._fireDragEvent(r,"dragover",e,t,n)),this._target&&r!==this._target&&this._fireDragEvent(this._target,"dragleave",e,t,n),this._target=r}leave(e,t,n){this._target&&(this._fireDragEvent(this._target,"dragleave",e,t,n),this._target=null),this._target=null}drop(e,t,n){this._target&&(this._fireDragEvent(this._target,"drop",e,t,n),this._target=null),this._target=null,clearInterval(this._interval)}end(e,t,n){this._target&&this._fireDragEvent(this._target,"dragend",e,t,n),this._target=null,clearInterval(this._interval)}};function qc(e){document.querySelector(".noresp-em-narrow-table")&&e.querySelectorAll("img, amp-img").forEach(t=>{const n=t;n.style.removeProperty("width"),n.style.removeProperty("max-width")})}function la(e){const t=getComputedStyle(e);return e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)}function Sh(e){const t=document.createElement("div");t.replaceChildren(...Le(e.atomHTML));const n=t.querySelector("img");if(!n)return kt(t);let r=0;return e.targetAtom.classList.contains("em-block-insert-empty")?r=600:e.targetAtom.classList.contains("em-mob-wrap")||e.targetAtom.classList.contains("noresp-em-mob-wrap")?r=la(e.targetAtom):r=e.targetAtom.parentNode?la(e.targetAtom.parentNode):la(e.targetAtom),n.setAttribute("width",String(r)),document.querySelector(".noresp-em-narrow-table")?qc(t):n.style.maxWidth=r+"px",kt(t)}function $_(e,t,n){const r=e.querySelectorAll("img"),o=r.length===1?r[0]:null,i=o?.getAttribute("width")??"";if(!o||o.classList.contains("em-countdown")||!i||i.endsWith("%"))return!1;const s=parseFloat(i),a=o.style.display;o.style.display="none";const l=la(n);o.style.display=a;const c=s>=la(t)?l:Math.min(s,l);return!c||c===s?!1:(o.setAttribute("width",String(c)),document.querySelector(".noresp-em-narrow-table")?qc(e):o.style.maxWidth=c+"px",!0)}function W_(e,t){const n=e.atomHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");n.replaceChildren(...Le(e.atomHTML));const r=n.querySelector("img");if(!r)return!1;const o=new Image;return o.onload=function(){const i=Math.round(this.width/2);r.setAttribute("width",String(i)),document.querySelector(".noresp-em-narrow-table")?qc(n):(r.style.maxWidth=i+"px",r.style.width="100%"),tr(e.targetElem,e.targetPlace,`
|
|
52
52
|
`+kt(n)+`
|
|
53
|
-
`),t()},o.src=r.getAttribute("src")||"",!1}function wh(e){const t=e.blockHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");t.replaceChildren(...Le(e.blockHTML));const n=t.querySelector("img.em-countdown");if(!n)return kt(t);const r=n.getAttribute("em-cd-settings")||"",o=e.project==="useblocks"?"https://cdt3.useblocks.io/rndt?":"https://cdt3.emcdn.ru/rndt?",i=new URL(o+r),s=new Date;return i.searchParams.set("time",new Date(+s+432e6).toISOString()),Ht(n,"src",i.href),n.setAttribute("em-cd-settings",i.search.substring(1)),kt(t)}function zc(e){const t=e.blockIsTr?document.createElement("table"):document.createElement("div");return t.replaceChildren(...Le(e.blockHTML)),document.querySelector(".noresp-em-narrow-table")?t.querySelectorAll('[class^="em-mob-"], [class*=" em-mob-"]').forEach(n=>{n.className=n.className.split(" ").map(r=>r.startsWith("em-mob-")?"noresp-"+r:r).join(" ")}):t.querySelectorAll('[class^="noresp-"], [class*=" noresp-"]').forEach(n=>{n.className=n.className.split(" ").map(r=>r.startsWith("noresp-")?r.substring(7):r).join(" ")}),qc(t),kt(t)}function r$(e){e&&(e.removeAttribute("em-edit"),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")))}var o$=class{constructor(){A(this,"_items",new Map)}gc(){for(const[e,t]of[...this._items])e.isConnected||(this._items.delete(e),t.destroy())}get(e){return this._items.get(e)}create(e,t){const n=Q.create(e,t);return this._items.set(e,n),n}entries(){return[...this._items]}},$r=new o$,i$=Number.MAX_VALUE,s$=0;function q_(e){return typeof e=="object"?e.name:e}var a$=class{constructor(){A(this,"emulator",new F_),A(this,"x",0),A(this,"y",0),A(this,"_tracked",!1),A(this,"handleMouseMove",e=>{this.x=e.clientX,this.y=e.clientY,this.emulator.over(this.x,this.y)})}track(){this._tracked||(this._tracked=!0,window.addEventListener("mousedown",e=>{this.x=e.clientX,this.y=e.clientY}),window.addEventListener("mouseup",()=>this.emulator.end(this.x,this.y)))}},ln=new a$,z_=Q.prototype,l$=pt(z_._onDragOver);function c$(e){$r.gc(),ln.track(),z_._onDragOver=l$;const t=document.querySelectorAll("[em=group]");Q.prototype._emulateDragOver=function(){};let n;const r=()=>{e.commit(!0)};function o(a,l){let c;function u(m,p){let v=null,C=Number.MAX_VALUE;const k=q_(Q.active?.options.group);for(const[L,E]of $r.entries())if(q_(E.options.group)===k&&(!a||c&&a(L,c)!==!1)){for(const g of L.children)if(!g.classList.contains("sortable-drag")){const y=g.getBoundingClientRect(),w=m<y.left?y.left-m:m>y.right?m-y.right:0,b=p<y.top?y.top-p:p>y.bottom?p-y.bottom:0;if(w<i$||b<s$){const S=Math.sqrt(w*w+b*b);S<C?(v=[E,g],C=S):S===C&&v[1].contains(g)&&(v=[E,g])}}}return v}function d(m){const p="TouchEvent"in window&&m instanceof TouchEvent?m.touches[0]:m,v=u(p.clientX,p.clientY);if(v){const[L,E]=v,g=E.getBoundingClientRect();var C={clientX:g.left+g.width/2,clientY:p.clientY};for(var k in m)m.hasOwnProperty(k)&&(C[k]=m[k]);C.target=E,C.rootEl=E.parentNode,C.preventDefault=void 0,C.stopPropagation=void 0,L._onDragOver(C)}}return{onStart:m=>{c=m.item,Q.ghost&&Ef(Q.ghost),r$(Q.ghost),e.beginTextUpdate(),window.addEventListener("mousemove",d),window.addEventListener("touchmove",d),ln.emulator.start(ln.x,ln.y)?(window.addEventListener("mousemove",ln.handleMouseMove),n&&(n.dispose(),n=void 0)):m.preventDefault()},onEnd:m=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d);let p=!1;m.from===m.to?ln.emulator.end(ln.x,ln.y):(p=!!l?.(m),ln.emulator.drop(ln.x,ln.y)),window.removeEventListener("mousemove",ln.handleMouseMove),e.endTextUpdate(),m.from===m.to&&m.oldIndex!==m.newIndex&&e.commit(!0),p&&e.commit(!0),n&&(n.dispose(),n=void 0),c=void 0}}}if(t.length)for(const a of t){const l=a.parentElement;l&&!$r.get(l)&&$r.create(l,{forceFallback:!0,group:"groups-sorting",handle:`.of-group .${Ve.drag}`,...o(),onMove:r})}const i=[...document.querySelectorAll("[em=block]")],s=[...document.querySelectorAll("[em=atom]")].map(a=>a.parentElement);for(const a of i){const l=a.querySelectorAll("td");for(const c of l)!c.innerHTML&&!c.hasAttribute("height")&&[...c.parentElement?.children||[]].indexOf(c)%2===0&&s.push(c)}if(s.length){const a=new Set;for(const l of s)l&&!a.has(l)&&(a.add(l),$r.get(l)||$r.create(l,{forceFallback:!0,group:"atoms-sorting",handle:`.of-atom .${Ve.drag}`,...o((c,u)=>{if(u.tagName==="TR"){if(c.tagName!=="TABLE"&&c.tagName!=="TBODY")return!1}else if(u.tagName==="TD"){if(c.tagName!=="TR")return!1}else if(u.tagName==="TABLE"){const d=e.getContext(c);if(d&&In(d)&&d.tagName==="AMP-ACCORDION"&&c.tagName==="DIV"&&[...d.querySelectorAll("section > div")].indexOf(c)>=0||e.isInExternal(c)&&c.tagName==="DIV")return!0;if(c.tagName!=="TD")return!1}},c=>$_(c.item,c.from,c.to)),onMove:r,onSort:function(){l.innerHTML.trim()===""&&(l.innerHTML="")}}))}if(i.length){const a=new Set;for(const l of i){const c=l.parentElement;c&&!a.has(c)&&(a.add(c),$r.get(c)||$r.create(c,{forceFallback:!0,group:"blocks-sorting",handle:`.of-block .${Ve.drag}`,...o(),onMove:r}))}}}var u$=class{constructor(){A(this,"_nodes",[])}add(e){const t=this._nodes,n=new Set;for(const r of t){if(r.contains(e))return;e.contains(r)&&n.add(r)}for(const r of n){const o=t.indexOf(r);o>=0&&t.splice(o,1)}t.push(e)}remove(e){const t=new Set;for(const n of this._nodes)(e===n||e.contains(n))&&t.add(n);for(const n of t){const r=this._nodes.indexOf(n);r>=0&&this._nodes.splice(r,1)}}get nodes(){return[...this._nodes]}clear(){this._nodes.splice(0,this._nodes.length)}},_h={get textDocument(){return R(Mt,rs)},commit:ao};function d$(){const e=j.get("applicationTheme")||"light";let t=!1;try{_h.textDocument.beginUpdate();const n=[...document.querySelectorAll('[em="css"]')].map(s=>s.getAttribute("href"));let r=document.getElementsByTagName("head")[0];if(!r)if(document.documentElement)r=document.createElement("head"),document.documentElement.insertBefore(r,document.documentElement.firstChild),t=!0;else return;const o="css/sandbox.css?
|
|
53
|
+
`),t()},o.src=r.getAttribute("src")||"",!1}function wh(e){const t=e.blockHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");t.replaceChildren(...Le(e.blockHTML));const n=t.querySelector("img.em-countdown");if(!n)return kt(t);const r=n.getAttribute("em-cd-settings")||"",o=e.project==="useblocks"?"https://cdt3.useblocks.io/rndt?":"https://cdt3.emcdn.ru/rndt?",i=new URL(o+r),s=new Date;return i.searchParams.set("time",new Date(+s+432e6).toISOString()),Ht(n,"src",i.href),n.setAttribute("em-cd-settings",i.search.substring(1)),kt(t)}function zc(e){const t=e.blockIsTr?document.createElement("table"):document.createElement("div");return t.replaceChildren(...Le(e.blockHTML)),document.querySelector(".noresp-em-narrow-table")?t.querySelectorAll('[class^="em-mob-"], [class*=" em-mob-"]').forEach(n=>{n.className=n.className.split(" ").map(r=>r.startsWith("em-mob-")?"noresp-"+r:r).join(" ")}):t.querySelectorAll('[class^="noresp-"], [class*=" noresp-"]').forEach(n=>{n.className=n.className.split(" ").map(r=>r.startsWith("noresp-")?r.substring(7):r).join(" ")}),qc(t),kt(t)}function r$(e){e&&(e.removeAttribute("em-edit"),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")))}var o$=class{constructor(){A(this,"_items",new Map)}gc(){for(const[e,t]of[...this._items])e.isConnected||(this._items.delete(e),t.destroy())}get(e){return this._items.get(e)}create(e,t){const n=Q.create(e,t);return this._items.set(e,n),n}entries(){return[...this._items]}},$r=new o$,i$=Number.MAX_VALUE,s$=0;function q_(e){return typeof e=="object"?e.name:e}var a$=class{constructor(){A(this,"emulator",new F_),A(this,"x",0),A(this,"y",0),A(this,"_tracked",!1),A(this,"handleMouseMove",e=>{this.x=e.clientX,this.y=e.clientY,this.emulator.over(this.x,this.y)})}track(){this._tracked||(this._tracked=!0,window.addEventListener("mousedown",e=>{this.x=e.clientX,this.y=e.clientY}),window.addEventListener("mouseup",()=>this.emulator.end(this.x,this.y)))}},ln=new a$,z_=Q.prototype,l$=pt(z_._onDragOver);function c$(e){$r.gc(),ln.track(),z_._onDragOver=l$;const t=document.querySelectorAll("[em=group]");Q.prototype._emulateDragOver=function(){};let n;const r=()=>{e.commit(!0)};function o(a,l){let c;function u(m,p){let v=null,C=Number.MAX_VALUE;const k=q_(Q.active?.options.group);for(const[L,E]of $r.entries())if(q_(E.options.group)===k&&(!a||c&&a(L,c)!==!1)){for(const g of L.children)if(!g.classList.contains("sortable-drag")){const y=g.getBoundingClientRect(),w=m<y.left?y.left-m:m>y.right?m-y.right:0,b=p<y.top?y.top-p:p>y.bottom?p-y.bottom:0;if(w<i$||b<s$){const S=Math.sqrt(w*w+b*b);S<C?(v=[E,g],C=S):S===C&&v[1].contains(g)&&(v=[E,g])}}}return v}function d(m){const p="TouchEvent"in window&&m instanceof TouchEvent?m.touches[0]:m,v=u(p.clientX,p.clientY);if(v){const[L,E]=v,g=E.getBoundingClientRect();var C={clientX:g.left+g.width/2,clientY:p.clientY};for(var k in m)m.hasOwnProperty(k)&&(C[k]=m[k]);C.target=E,C.rootEl=E.parentNode,C.preventDefault=void 0,C.stopPropagation=void 0,L._onDragOver(C)}}return{onStart:m=>{c=m.item,Q.ghost&&Ef(Q.ghost),r$(Q.ghost),e.beginTextUpdate(),window.addEventListener("mousemove",d),window.addEventListener("touchmove",d),ln.emulator.start(ln.x,ln.y)?(window.addEventListener("mousemove",ln.handleMouseMove),n&&(n.dispose(),n=void 0)):m.preventDefault()},onEnd:m=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d);let p=!1;m.from===m.to?ln.emulator.end(ln.x,ln.y):(p=!!l?.(m),ln.emulator.drop(ln.x,ln.y)),window.removeEventListener("mousemove",ln.handleMouseMove),e.endTextUpdate(),m.from===m.to&&m.oldIndex!==m.newIndex&&e.commit(!0),p&&e.commit(!0),n&&(n.dispose(),n=void 0),c=void 0}}}if(t.length)for(const a of t){const l=a.parentElement;l&&!$r.get(l)&&$r.create(l,{forceFallback:!0,group:"groups-sorting",handle:`.of-group .${Ve.drag}`,...o(),onMove:r})}const i=[...document.querySelectorAll("[em=block]")],s=[...document.querySelectorAll("[em=atom]")].map(a=>a.parentElement);for(const a of i){const l=a.querySelectorAll("td");for(const c of l)!c.innerHTML&&!c.hasAttribute("height")&&[...c.parentElement?.children||[]].indexOf(c)%2===0&&s.push(c)}if(s.length){const a=new Set;for(const l of s)l&&!a.has(l)&&(a.add(l),$r.get(l)||$r.create(l,{forceFallback:!0,group:"atoms-sorting",handle:`.of-atom .${Ve.drag}`,...o((c,u)=>{if(u.tagName==="TR"){if(c.tagName!=="TABLE"&&c.tagName!=="TBODY")return!1}else if(u.tagName==="TD"){if(c.tagName!=="TR")return!1}else if(u.tagName==="TABLE"){const d=e.getContext(c);if(d&&In(d)&&d.tagName==="AMP-ACCORDION"&&c.tagName==="DIV"&&[...d.querySelectorAll("section > div")].indexOf(c)>=0||e.isInExternal(c)&&c.tagName==="DIV")return!0;if(c.tagName!=="TD")return!1}},c=>$_(c.item,c.from,c.to)),onMove:r,onSort:function(){l.innerHTML.trim()===""&&(l.innerHTML="")}}))}if(i.length){const a=new Set;for(const l of i){const c=l.parentElement;c&&!a.has(c)&&(a.add(c),$r.get(c)||$r.create(c,{forceFallback:!0,group:"blocks-sorting",handle:`.of-block .${Ve.drag}`,...o(),onMove:r}))}}}var u$=class{constructor(){A(this,"_nodes",[])}add(e){const t=this._nodes,n=new Set;for(const r of t){if(r.contains(e))return;e.contains(r)&&n.add(r)}for(const r of n){const o=t.indexOf(r);o>=0&&t.splice(o,1)}t.push(e)}remove(e){const t=new Set;for(const n of this._nodes)(e===n||e.contains(n))&&t.add(n);for(const n of t){const r=this._nodes.indexOf(n);r>=0&&this._nodes.splice(r,1)}}get nodes(){return[...this._nodes]}clear(){this._nodes.splice(0,this._nodes.length)}},_h={get textDocument(){return R(Mt,rs)},commit:ao};function d$(){const e=j.get("applicationTheme")||"light";let t=!1;try{_h.textDocument.beginUpdate();const n=[...document.querySelectorAll('[em="css"]')].map(s=>s.getAttribute("href"));let r=document.getElementsByTagName("head")[0];if(!r)if(document.documentElement)r=document.createElement("head"),document.documentElement.insertBefore(r,document.documentElement.firstChild),t=!0;else return;const o="css/sandbox.css?fd4347fc";if(n.indexOf(o)<0){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",o),r.appendChild(s),t=!0}const i=`css/sandbox-${e}.css?fd4347fc`;if(n.indexOf(i)<0){const s=document.createElement("link");s.setAttribute("rel","stylesheet"),s.setAttribute("type","text/css"),s.setAttribute("em","css"),s.setAttribute("href",i),r.appendChild(s),t=!0}}finally{_h.textDocument.endUpdate()}t&&_h.commit(!1)}var Uc=".em-prevent-action";function f$(e){const{fingerprint:t,applicationElementSettingsSet:n}=e,r=document.querySelector("[em-edit]"),o=t.take(r);if(t.differs(o)){if(document.body?.classList.contains("em-sandbox-discuss")){t.accept(o);return}if(r){r.closest(".em-prevent-action")||(t.accept(o),n({elem:r}));return}setTimeout(()=>{const i=document.querySelector("[em-edit]"),s=t.take(i);i?t.differs(s)&&(t.accept(s),i.closest(".em-prevent-action")||n({elem:i})):(t.accept(s),n({elem:null}))},0)}}function m$(e){const t=document.body;if(!t)return;const n=e.isAppLocked()||e.isIntegratorLocked();(e.isAppLocked()!==t.classList.contains("mceNonEditable")||e.isIntegratorLocked())&&Be(t,!!n,"mceNonEditable"),Be(t,!!j.get("previewPage"),"em-sandbox-preview")}function h$(e){const{htmlDocument:t,commit:n,focusController:r}=e,o=LF(()=>c$(t));t.onChange(a=>{a.some(l=>l.added.length||l.characterDataChanged||l.reordered?.length||l.reparented?.length)&&o()}),t.onChange(()=>{d$()}),t.onRefresh(()=>e.initPreview()),t.onChange(a=>{a.some(l=>l.removed.some(c=>c instanceof HTMLHeadElement||c instanceof HTMLLinkElement&&c.hasAttribute("em")))&&document.querySelector(".em-editor-wrapper")?.remove()});const i=new u$;let s;t.onChange(a=>{for(const l of a)for(const c of l.added)i.add(c.parentElement??c);s||(s=setTimeout(()=>{r.whenEditorLostFocus(()=>{i.clear(),n(!1)}),s=void 0},1e3))}),t.onChange(AF(e.applicationElementSettingsSet)),t.onChange(()=>{e.selectionLock.isLocked()||(f$(e),m$(e.editLock))})}function p$(e,t,n){if(!(e instanceof Element)||!e.closest(".em-prevent-action"))return;const r=document.querySelector(".em-editor-wrapper");if(!document.querySelector("[em-edit]")&&!r)return;const o=n.acquire();try{document.querySelectorAll("[em-edit]").forEach(i=>i.removeAttribute("em-edit")),r&&(r.style.display="none"),It(()=>document.querySelectorAll("editor").forEach(i=>i.blur())),t.forget()}finally{o.releaseLater()}}function g$(e,t){const n=pt(r=>p$(r.target,e,t));return window.addEventListener("mousedown",n,!0),window.addEventListener("click",n,!0),{dispose(){window.removeEventListener("mousedown",n,!0),window.removeEventListener("click",n,!0)}}}var b$={name:"sandbox.fingerprint",provides:[Ho],awaits:{services:[Y,Ne]},setup(e){const t=R(e,Y),n=R(e,Ne),r=DP(o=>t.getOuterHtml(o));BP(r,n),g$(r,n),e.inject(Ho,r)}},y$={name:"sandbox.setCursor",provides:[yt],awaits:{services:[Y,pn,ot]},setup(e){const t={HTMLDocument:R(e,Y),documentMapping:R(e,pn),remoteDocument:R(e,ot),messageService:z};e.inject(yt,n=>FP(n,t))}},v$={name:"sandbox.wrapEditor",provides:[gn],awaits:{services:[Y,pn,Te]},setup:e=>e.inject(gn,wF({commit:dt(e),htmlDocument:R(e,Y),documentMapping:R(e,pn)}))};function E$(e){const{container:t}=e;Vs.registerAll({MessageService:()=>z,FocusState:()=>e.focusController,SyncService:()=>t.getInstance(Y),SyncServiceInternals:()=>t.getInstance(ot),TextDocument:()=>t.getInstance(rs),Mapping:()=>t.getInstance(pn),EditorSurface:()=>({surface:e.surface})}),e.features&&e.features.length>0&&Vs.initFeatures(e.features)}var S$=e=>e,w$=e=>`table:empty::before {
|
|
54
54
|
/*content: 'Paste block here';*/
|
|
55
55
|
}
|
|
56
56
|
|