@emailmaker/emailmaker 1.3.4 → 1.3.5
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/CHANGELOG.md +43 -0
- package/{emailmaker-core.87ebe001.js → emailmaker-core.33f5584d.js} +8 -8
- package/emailmaker-esm.js +6 -6
- package/{emailmaker-po.87ebe001.js → emailmaker-po.33f5584d.js} +1 -1
- package/emailmaker.js +6 -6
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/css/sandbox-dark.css +2 -9
- package/iframe/css/sandbox-light.css +2 -9
- package/iframe/css/sandbox.css +7 -23
- package/iframe/{iframe-eblock.87ebe001.html → iframe-eblock.33f5584d.html} +2 -2
- package/iframe/{iframe.87ebe001.html → iframe.33f5584d.html} +2 -2
- package/iframe/js/{elMarkupHelper.CO37NCd9.js → elMarkupHelper.B6dyF9UI.js} +3 -3
- package/iframe/js/{iframe-eblock.body.87ebe001.js → iframe-eblock.body.33f5584d.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.87ebe001.js → iframe.body.33f5584d.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/{78916fed.js → 19f19adb.js} +1 -1
- package/static/core/{81cc5690.js → 239be344.js} +1 -1
- package/static/core/{d833a29f.js → 294defd8.js} +1 -1
- package/static/core/{27599903.js → 2cee0217.js} +1 -1
- package/static/core/{8cebeef2.js → 2fbd0ef8.js} +1 -1
- package/static/core/{122c5ed9.js → 3320a3fd.js} +1 -1
- package/static/core/{7601732d.js → 3a0fc0cb.js} +1 -1
- package/static/core/{75a2537a.js → 423efc66.js} +1 -1
- package/static/core/{67cc6cb2.js → 42f18479.js} +1 -1
- package/static/core/{5afad425.js → 4a259bd9.js} +1 -1
- package/static/core/{5ebf9f1e.js → 4ee64f35.js} +1 -1
- package/static/core/{87c47034.js → 4fd85bc9.js} +2 -2
- package/static/core/{afb0d556.js → 5150fae0.js} +2 -2
- package/static/core/{489390a3.js → 5913ff80.js} +1 -1
- package/static/core/{79e13595.js → 64c425bf.js} +1 -1
- package/static/core/{81a16991.js → 65db94be.js} +1 -1
- package/static/core/{a15ab3fe.js → 78663aeb.js} +1 -1
- package/static/core/{27986c36.js → 89df46ff.js} +1 -1
- package/static/core/{9a7e933e.js → 90aedd7b.js} +1 -1
- package/static/core/{76163cc7.js → 97ab9fc2.js} +1 -1
- package/static/core/{4cdd6e6c.js → 99be02b7.js} +1 -1
- package/static/core/{d8175c7f.js → a74cc07c.js} +1 -1
- package/static/core/{32e15918.js → c2fc9f27.js} +1 -1
- package/static/core/{2269bf04.js → d4b8f1e0.js} +1 -1
- package/static/core/{81c0d133.js → d7e61b4c.js} +1 -1
- package/static/core/{312fb954.js → e21f8693.js} +1 -1
- package/static/core/{b8941eda.js → f52ad95a.js} +5 -5
- package/static/umd-runtime/{runtime.BHEKxbjr.js → runtime.ylG9Pc4W.js} +1 -1
- package/vendor/@emailmaker/ui-kit/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
__emailmaker__.define("js/elMarkupHelper.CO37NCd9.js",["require","exports","module"],function(Iu,H,HJ){var zp=Object.defineProperty,yr=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),oe=(e,t)=>{let n={};for(var r in e)zp(n,r,{get:e[r],enumerable:!0});return t||zp(n,Symbol.toStringTag,{value:"Module"}),n};function Bi(e){"@babel/helpers - typeof";return Bi=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},Bi(e)}function yA(e,t){if(Bi(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Bi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vA(e){var t=yA(e,"string");return Bi(t)=="symbol"?t:t+""}function A(e,t,n){return(t=vA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Up;Up=Symbol.toStringTag;var Du=class{constructor(){A(this,"_valuesMap",new Map),A(this,Up,"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 jp(){const e=new Du;return new Proxy(e,{set:function(t,n,r){return typeof n=="string"&&Du.prototype.hasOwnProperty(n)?e[n]=r:typeof n=="string"&&e.setItem(n,String(r)),!0},get:function(t,n){if(typeof n=="string"){if(Du.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 Vp(){const e=jp(),t=jp();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)})}Vp();var Gp=Symbol.for("emailmaker.commandInputPause");function Xp(){const e=window,t=e[Gp];if(t)return t;const n=new Set;return e[Gp]=n,window.addEventListener("input",r=>n.forEach(o=>o(r)),!0),n}function EA(){Xp()}function SA(e){const t=Xp();return t.add(e),()=>{t.delete(e)}}EA();var Kp=class{constructor(e){A(this,"_voidElements",void 0),this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},St=(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})({}),wA=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===kA||e===LA||e===CA||e===AA||e===TA)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},Bu=33,_o=45,Hi=60,Jt=62,Fi=47,_A=61,Yp=34,Zp=39,CA=10,TA=13,AA=12,kA=32,LA=9,Qp=63,NA=65,xA=90,OA=97,RA=122;function Jp(e){return e>=OA&&e<=RA||e>=NA&&e<=xA}function eg(e){return Jp(e)||e===Fi||e===Bu||e===Qp}var Na="(?=[\\s/>])",MA=new RegExp(`<!--|-->|<\\/?script${Na}\\s*\\/?>?`,"i"),PA=new RegExp(`<\\/style${Na}`,"i"),IA={"text/x-handlebars-template":!0,"text/html":!0};function DA(e,t=0,n=0,r=!1){const o=new wA(e,t);let i=n,s=0,a=18,l,c,u=!1,d,m,h;function f(){return o.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function g(){const v=o.pos();for(;!o.eos();){const C=o.nextChar();if(C===Jt)return!0;if(C===Hi)break;if(C===Yp||C===Zp){if(!o.advanceUntilChar(C))break;o.advance(1)}}return o.goBackTo(v),!1}function E(){for(;o.advanceUntilChar(Hi)&&!eg(o.peekChar(1));)o.advance(1)}function w(v){return o.advanceUntilChar(Jt)&&o.advance(1),L(v,22)}function T(){return o.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function L(v,C,b){return a=C,s=v,l=b,C}function y(){const v=o.pos(),C=i,b=p();return b!==21&&v===o.pos()&&!(r&&(b===4||b===8))?(o.advance(1),L(v,18)):b}function p(){const v=o.pos();if(o.eos())return L(v,21);let C;switch(i){case 6:return o.advanceIfChars([_o,_o,Jt])?(i=0,L(v,2)):(o.advanceUntilChars([_o,_o,Jt]),L(v,1));case 3:return o.advanceIfChar(Jt)?(i=0,L(v,15)):(o.advanceUntilChar(Jt),L(v,14));case 0:return o.peekChar()===Hi&&eg(o.peekChar(1))?(o.advance(1),o.peekChar()===Bu?o.advanceIfChars([Bu,_o,_o])?(i=6,L(v,0)):o.advanceIfRegExp(/^!doctype/i)?(i=3,L(v,13)):w(v):o.peekChar()===Qp?w(v):o.advanceIfChar(Fi)?Jp(o.peekChar())?(i=2,L(v,7)):w(v):(i=1,L(v,3))):(E(),L(v,16));case 2:return f().length>0?(i=5,u=!1,L(v,9)):o.skipWhitespace()?L(v,17,"Tag name must directly follow the open bracket."):(i=5,o.advanceUntilChar(Jt),v<o.pos()?L(v,18,"End tag name expected."):p());case 5:if(o.skipWhitespace())return u=!0,L(v,17);if(o.advanceIfChar(Jt))return i=0,L(v,8);if(r&&o.peekChar()===Hi)return i=0,L(v,8,"Closing bracket missing.");if((u||o.peekChar()===Fi)&&g())return i=0,L(v,8);C="Closing bracket expected.";break;case 1:return d=f(),h=void 0,m=void 0,d.length>0?(c=!1,i=4,L(v,6)):o.skipWhitespace()?L(v,17,"Tag name must directly follow the open bracket."):(i=4,o.advanceUntilChar(Jt),v<o.pos()?L(v,18,"Start tag name expected."):p());case 4:return o.skipWhitespace()?(c=!0,L(v,17)):c&&(m=T(),m.length>0)?(i=9,c=!1,L(v,11)):o.advanceIfChars([Fi,Jt])?(i=0,L(v,5)):o.advanceIfChar(Jt)?(d==="script"?h&&IA[h]?i=0:i=7:d==="style"?i=8:i=0,L(v,4)):r&&o.peekChar()===Hi?(i=0,L(v,4,"Closing bracket missing.")):(o.advance(1),L(v,18,"Unexpected character in tag."));case 9:return o.skipWhitespace()?(c=!0,L(v,17)):o.advanceIfChar(_A)?(i=10,L(v,10)):(i=4,p());case 10:if(o.skipWhitespace())return L(v,17);let b=o.advanceIfRegExp(/^[^\s"'`=<>]+/);if(b.length>0)return o.peekChar()===Jt&&o.peekChar(-1)===Fi&&(o.goBack(1),b=b.substr(0,b.length-1)),m==="type"&&(h=b),i=4,c=!1,L(v,12);const S=o.peekChar();return S===Zp||S===Yp?(o.advance(1),o.advanceUntilChar(S)&&o.advance(1),m==="type"&&(h=o.getSource().substring(v+1,o.pos()-1)),i=4,c=!1,L(v,12)):(i=4,c=!1,p());case 7:let _=1;for(;!o.eos();){const k=o.advanceIfRegExp(MA);if(k.length===0)return o.goToEnd(),L(v,19);if(k==="<!--")_===1&&(_=2);else if(k==="-->")_=1;else if(k[1]!=="/")_===2&&(_=3);else if(_===3)_=2;else{o.goBack(k.length);break}}return i=0,v<o.pos()?L(v,19):p();case 8:return o.advanceUntilRegExp(PA),i=0,v<o.pos()?L(v,20):p()}return o.advance(1),i=0,L(v,18,C)}return{scan:y,getTokenType:()=>a,getTokenOffset:()=>s,getTokenLength:()=>o.pos()-s,getTokenEnd:()=>o.pos(),getTokenText:()=>o.getSource().substring(s,o.pos()),getScannerState:()=>i,getTokenError:()=>l}}function BA(e,t){return t||e.start!==e.end?`<!DOCTYPE${e.content}>`:""}function HA(e,t){const n=`<!DOCTYPE${e.content}>`;return e.start=t,e.endTagStart=e.startTagEnd=e.end=t+n.length,n}function FA(e,t){return t||e.start!==e.end?`<!--${e.content}-->`:""}function $A(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 Hu=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function WA(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}var tg=Object.create(null);function qA(e,t){const n=tg[e]||(tg[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[WA(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function Fu(e,t){if(e.start===e.end||t)return"";switch(e.type){case I.ELEMENT:return Wu(e,t);case I.ROOT:return[...e.children].map(n=>Fu(n,t)).join("");case I.DOCTYPE:return BA(e,t);case I.COMMENT:return FA(e,t);default:return e.content||""}}function $u(){return{exact:new WeakMap,collapsed:new WeakMap}}function Zn(e,t=!1,n){if(e.start===e.end&&e.type!==I.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=>Zn(a,t,n)).join("");let s;switch(e.type){case I.ELEMENT:{const a=e.tag?.toLowerCase();s=`<${a}${e.attributeNames.map(l=>` ${l}=${JSON.stringify(e.attributes?.[l]??null)}`).join("")}>${i()}</${a}>`;break}case I.ROOT:s=i();break;case I.COMMENT:s=`<!--${e.content??""}-->`;break;case I.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 xa(e,t=0){if(e.start===e.end)return"";switch(e.type){case I.ELEMENT:return UA(e,t);case I.ROOT:return rg(e,t);case I.DOCTYPE:return HA(e,t);case I.COMMENT:return $A(e,t);default:return e.start=e.startTagEnd=t,e.end=e.endTagStart=t+(e.content?.length||0),e.content||""}}function ng(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"&&!qA(t,i)?` ${i}`:` ${i}="${s.replaceAll('"',"'")}"`)}}}return n}function zA(e,t){let n="";if(e.startTagEnd!==e.endTagStart||t)for(const r of e.children)n+=Fu(r);return n}function rg(e,t){let n="";if(e.startTagEnd!==e.endTagStart)for(const r of e.children)n+=xa(r,t+n.length);return n}function og(e,t){if(e.start!==e.startTagEnd||t){const n=e.tag?.toLowerCase()||"div",r=ng(e);return n==="vk-snippet-end"?`<${n}${r}/>`:`<${n}${r}>`}return""}function ig(e,t){return t||e.endTagStart!==e.end?`</${e.tag?.toLowerCase()||"div"}>`:""}function Wu(e,t,n=!0){const r=e.tag?.toLowerCase()||"div",o=og(e,t);if(Hu.has(r))return o;{const i=ig(e,t);return`${o}${n?zA(e,t):""}${i}`}}function UA(e,t){const n=e.tag?.toLowerCase()||"div",r=og(e);if(e.start=t,e.startTagEnd=t+r.length,Hu.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=rg(e,e.startTagEnd);e.endTagStart=e.startTagEnd+o.length;const i=ig(e);return e.end=e.endTagStart+i.length,`${r}${o}${i}`}}function qu(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 I=(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})({}),Oa=e=>e.type===0?e.start-1:e.start,jA=e=>e.type===0?e.end+1:e.end,wt=class mA{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=qu(this.children,r=>t<=Oa(r))-1;if(n>=0){const r=this.children[n];if(t>Oa(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=qu(this.children,r=>t<=Oa(r))-1;if(n>=0){const r=this.children[n];if(t>=Oa(r)&&t<=jA(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 mA(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 VA(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 sg=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 wt(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}}},ag=class{constructor(e){A(this,"dataManager",void 0),this.dataManager=e}parse(e,t=[]){const n=DA(e,void 0,void 0,!0),r=new wt(0,e.length,[],void 0);r.type=I.ROOT;let o=r,i=-1,s,a=null,l=n.scan();const c=()=>{if(!o.tag){const g=o.parent.children,E=g[g.length-2],w=e.substring(o.start,o.end);E?.type===I.HTML?(E.content=(E.content||"")+w,E.end=o.end,g.splice(g.length-1,1)):(o.type=I.HTML,o.content=w,o.children=[]),o.type=I.HTML}o=o.parent},u=new sg(e,I.COMMENT),d=new sg(e,I.DOCTYPE),m=g=>{o.children.push(g)},h=(g,E)=>{const w=new wt(g,E,[],o);w.type=I.HTML,w.content=e.substring(g,E),m(w)};for(;l!==St.EOS;){switch(l){case St.StartDoctypeTag:d.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case St.EndDoctypeTag:{const L=o.lastChild,y=d.node;if(!y)throw new Error("");const p=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(p!==y.start){const v=e.substring(p,y.start);if(v){const C=new wt(p,y.start,[],o);C.type=I.HTML,C.content=v,m(C)}}d.finish(n.getTokenOffset(),n.getTokenLength());break}case St.StartCommentTag:u.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case St.EndCommentTag:{const L=o.lastChild,y=u.node;if(!y)throw new Error("");const p=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(p!==y.start){const v=e.substring(p,y.start);if(v){const C=new wt(p,y.start,[],o);C.type=I.HTML,C.content=v,m(C)}}u.finish(n.getTokenOffset(),n.getTokenLength());break}case St.StartTagOpen:const g=o.lastChild,E=new wt(n.getTokenOffset(),e.length,[],o),w=g?g.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(w!==E.start){const L=e.substring(w,E.start);if(L){const y=new wt(w,E.start,[],o);y.type=I.HTML,y.content=L,m(y)}}m(E),o=E;break;case St.BogusComment:{const L=o.lastChild?.end??o.startTagEnd??o.start;L<n.getTokenOffset()&&h(L,n.getTokenOffset()),h(n.getTokenOffset(),n.getTokenEnd());break}case St.StartTag:o.tag=n.getTokenText();break;case St.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 St.StartTagSelfClose:o.parent&&(o.closed=!0,o.end=n.getTokenEnd(),o.startTagEnd=n.getTokenEnd(),c());break;case St.EndTagOpen:i=n.getTokenOffset(),s=void 0;break;case St.EndTag:s=n.getTokenText().toLowerCase();break;case St.EndTagClose:let T=o;for(;!T.isSameTag(s)&&T.parent;)T=T.parent;if(T.parent){const L=o.lastChild,y=L?L.end:o.startTagEnd===void 0?o.start:o.startTagEnd;if(y!==i){const p=e.substring(y,i);if(p){const v=new wt(y,i,[],o);v.type=I.HTML,v.content=p,m(v)}}for(;o!==T;)o.end=i,o.closed=!1,c();o.closed=!0,o.endTagStart=i,o.end=n.getTokenEnd(),c()}break;case St.AttributeName:{a=n.getTokenText();let L=o.attributes;L||(o.attributes=L={}),L[a]=null;break}case St.AttributeValue:{const L=n.getTokenText(),y=o.attributes;y&&a&&(y[a]=VA(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 f=r.lastChild?.end||0;if(f<e.length){const g=e.substring(f);if(g){const E=new wt(f,e.length,[],r);E.type=I.HTML,E.content=g,m(E)}}return{roots:r.children,findNodeBefore:r.findNodeBefore.bind(r),findNodeAt:r.findNodeAt.bind(r)}}},FJ=new ag(new Kp(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),GA=new Kp(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),XA=new ag(GA);function fn(e){return XA.parse(e)}var zu=Symbol("bogusCommentSource");function vr(e){if(e){const t=document.createElement("div");t.insertAdjacentHTML("afterbegin",e);const n=t.firstChild??document.createTextNode("");return n.nodeType===Node.COMMENT_NODE&&KA(n,e),n}else return document.createTextNode("")}function KA(e,t){const n={source:t,data:e.data};Object.defineProperty(e,zu,{value:n,configurable:!0})}function $i(e){const t=e[zu];return t&&t.data===e.data?t:void 0}function Ra(e){return $i(e)?.source}function lg(e,t){if(e.nodeType===Node.COMMENT_NODE){t.push(e);return}(e.nodeName==="TEMPLATE"?e.content:e).childNodes.forEach(n=>lg(n,t))}function Ma(...e){const t=[];return e.forEach(n=>lg(n,t)),t}function YA(e,t){return e.data===t.data&&(e.parent===void 0||t.parent===void 0||e.parent===t.parent)}function cg(e,t){$i(e)||Object.defineProperty(e,zu,{value:t,configurable:!0})}function ZA(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 QA(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)=>YA(e[o+s],i))&&r.push(o);if(!r.length){const o=ZA(e);t.forEach(i=>{const s=o.get(i.data);s&&cg(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)&&cg(o,a)})}function ug(e,t){const n=e.parentNode,r=n&&n.nodeType===Node.ELEMENT_NODE&&!t.includes(n);return{data:e.data,mark:$i(e),parent:r?n.nodeName.toLowerCase():void 0}}function dg(e,t,n){const r=Ma(...t),o=n?[...t,n]:t;QA(e,r,r.map(i=>ug(i,o)))}function en(e,t){dg(Ma(e).map(n=>ug(n,[e])),[t],null)}var JA=/<[!?]|<\/[^a-zA-Z]/,ek=/^<[!?/]/;function tk(e){const t=[],n=r=>{const o=r.parent?.tag?.toLowerCase();if(r.type===I.COMMENT)t.push({data:r.content??"",mark:void 0,parent:o});else if(r.type===I.HTML&&r.content&&ek.test(r.content)){const i=vr(r.content);i.nodeType===Node.COMMENT_NODE&&t.push({data:i.data,mark:$i(i),parent:o})}r.children.forEach(n)};try{fn(e).roots.forEach(n)}catch{return[]}return t}function fg(e,t,n=null){JA.test(t)&&dg(tk(t),e,n)}function Uu(e,t){fg([e],t)}var Wi="",nk=4,mg=0;function rk(){return mg+=1,`${Math.random().toString(36).slice(2)}${mg.toString(36)}`}function ok(e,t,n){if(e.split(`${Wi}${t}:`).length-1!==n.length)return;const r=e.split(new RegExp(`<!--${Wi}${t}:(\\d+)${Wi}-->`)),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 Pa(e,t,n){const r=Ma(e),o=r.map(l=>$i(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:Ma(i),a=r.map(l=>l.data);for(let l=0;l<nk;l++){const c=rk(),u=[];s.forEach((m,h)=>{const f=o[h];f!==void 0&&(m.data=`${Wi}${c}:${u.length}${Wi}`,u.push(f))});const d=ok(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 Er(e){return Pa(e,!0,!1)}function Xe(e){return Pa(e,!1,!1)}function hg(e){return Pa(e,!0,!0)}function ik(e){return Pa(e,!1,!0)}function Ce(e,t){e.innerHTML=t,Uu(e,t)}function zt(e,t){Ce(e,Xe(t))}function ju(e){qi(e,Xe(e))}function qi(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);fg(i,t,n)}var pg=new Set(["text/x-handlebars-template","text/html"]);function Ia(e,t){if(e.type!==I.HTML||!t)return!1;const n=t.tag?.toLowerCase(),r=t.attributes?.type;return n==="style"||n==="script"&&!pg.has(typeof r=="string"?r:"")}var sk={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function Vu(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,n)=>sk[n])}var gg=Symbol("rawTextSource");function Gu(e){const t=document.createTextNode(Vu(e));return bg(t,e),t}function bg(e,t){Object.defineProperty(e,gg,{value:t,configurable:!0})}function ak(e,t){e.data=Vu(t),bg(e,t)}function yg(e){const t=e[gg];return t!==void 0&&Vu(t)===e.textContent?t:void 0}var Co,Xr;function vg(e){const t=Co;return Co=e,()=>{Co===e&&(Co=t)}}function lk(e){const t=Xr;return Xr=e,()=>{Xr===e&&(Xr=t)}}function Eg(e,t,n){return Co?Co(e,t,n):n}function ck(){return Xr!==void 0}function Sg(e,t,n){return Xr?Xr(e,t,n):n}var Xu;function uk(){return Xu||(Xu=document.implementation.createHTMLDocument("")),Xu}function dk(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 fk=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),mk=new Set(["script","style","xmp"]);function hk(e,t){return!(t&&mk.has(t.toLowerCase())||fk.has(e.toLowerCase()))}var pk=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},gk=new Set(["head","body"]);function wg(e,t,n){let r=e.tagName.toLowerCase();r==="html"&&(r="div");const o=`<${r} ${t}="${n}"/>`,i=uk(),s=gk.has(r)?dk(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 Qn(e,t,n){try{hk(t,e.tagName)&&!pk(n)?e.setAttribute(t,n):wg(e,t,n)}catch{wg(e,t,n)}}function _g(){return vr("<script><\/script>")}var bk="text/x-em-dormant",zi=Symbol("dormantScriptType");function Ku(e){e[zi]=e.getAttribute("type"),e.setAttribute("type",bk)}function Da(e){return zi in e}function yk(e){const t=[...e].filter(n=>!Da(n));return t.forEach(Ku),t}function vk(e,t){return Da(e)?(e[zi]=t,!0):!1}function Cg(e){const t=new Set;for(const n of e){const r="querySelectorAll"in n?n.querySelectorAll("script"):[];for(const o of[n,...r])Da(o)&&t.add(o)}return[...t]}function Tg(e){if(!Da(e))return;const t=e[zi];delete e[zi],typeof t=="string"?e.setAttribute("type",t):e.removeAttribute("type")}var Ek=["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 Sk(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 Ag(e){const t=Sk(e);return Ek.includes(t)?"classic":t==="module"||t==="importmap"||t==="speculationrules"?t:void 0}function wk(e){return Ag(e)==="classic"}function _k(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 Ck(e){const t=Ag(e);return!t||t==="speculationrules"||Ba(e)?!1:t!=="classic"||!e.hasAttribute("nomodule")&&_k(e)}function Tk(e){return e.hasAttribute("src")&&!["async","defer","nomodule"].some(t=>e.hasAttribute(t))&&wk(e)}function Ba(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 kg(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 Lg(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 Ng(e,t,n){e.replaceWith(t),t.append(...e.childNodes),n.substitute?.(e,t)}function xg(e,t){const n=_g();return Lg(e,n),t.quiet(()=>Ng(e,n,t)),n}function Ak(e,t,n){const r=xg(t,n),o=()=>{e.removeEventListener("load",o),e.removeEventListener("error",o),r.isConnected&&(n.quiet(()=>{Lg(r,t),Ku(t),Ng(r,t,n),Tg(t)}),kg(t,n))};e.addEventListener("load",o),e.addEventListener("error",o)}function Og(e,t){e.forEach(Tg);const n=e.filter(Ba),r=e.filter(i=>i.isConnected&&!Ba(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=>xg(i,t));let o;for(const i of r)o&&!i.hasAttribute("src")?Ak(o,i,t):(kg(i,t),o=Tk(i)?i:o)}function Kr(e,t=!0,n=!1){const r=e.content;switch(e.type){case I.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(Kr(i,!0,n));return o}case I.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case I.COMMENT:return document.createComment(r||"");case I.ELEMENT:if(e.tag){const o=e.tag.toLowerCase()==="script",i=n===!0&&o?_g():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=Eg(i,s,typeof a=="string"?a:"");l!==null&&Qn(i,s,l)}catch{}}if(n==="dormant"&&o&&Ku(i),t){const s=e.tag.toLowerCase()==="template"?!0:n;for(const a of e.children)i.appendChild(Ia(a,e)?Gu(a.content||""):Kr(a,!0,s))}return i}return document.createTextNode("<");case I.HTML:return vr(r||"");default:throw new Error("unsupported node")}}function Re(e,t=!1){return fn(e).roots.map(n=>Kr(n,!0,t))}function Ha(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 kk(e,t){e.replaceChildren(...Re(t,!0))}function Jn(e,t,n){Ha(e,t,Re(n,!0))}var Rg=Symbol.for("emailmaker.documentWriteGuard"),Ui=Symbol.for("emailmaker.documentWriteSink");function Lk(e,t=document){const n=t,r=n[Ui];return n[Ui]=e,()=>{n[Ui]===e&&(n[Ui]=r)}}function $J(e){}function Yu(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0})}function Nk(e,t,n){for(let r=e.writerOf.get(t);r;r=e.writerOf.get(r))if(r===n)return!0;return!1}function xk(e,t){let n=t;for(;n.nextSibling&&Nk(e,n.nextSibling,t);)n=n.nextSibling;return n}function Mg(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,xk(e,t).nextSibling)}},o=e.doc[Ui];o?o(n,r,t):r()}function Pg(e,t){return!!e&&e.type===I.ELEMENT&&!e.closed&&e.end===t}function Ok(e,t){let n="";for(let r=e;Pg(r,t);r=r.lastChild)n=`</${r.tag}>${n}`;return n}function Rk(e){const t=fn(e).roots,n=t[t.length-1],r=Pg(n,e.length);return{nodes:(r?t.slice(0,-1):t).map(o=>Kr(o)),rest:r?e.slice(n.start):""}}function Mk(e){const t=[...e.pending];e.pending.clear();for(const[n,r]of t){const o=fn(r).roots,i=r+Ok(o[o.length-1],r.length);Mg(e,n,fn(i).roots.map(s=>Kr(s)))}}function Ig(e,t,n){const r=e.doc.currentScript;if(!r?.parentNode){return}const{nodes:o,rest:i}=Rk((e.pending.get(r)??"")+n);i?(e.pending.size||queueMicrotask(()=>Mk(e)),e.pending.set(r,i)):e.pending.delete(r),Mg(e,r,o)}function Pk(e=document){const t=e;if(t[Rg])return;t[Rg]=!0;const n={doc:t,writerOf:new WeakMap,pending:new Map};Yu(e,"write",(...r)=>Ig(n,"write",r.join(""))),Yu(e,"writeln",(...r)=>Ig(n,"writeln",`${r.join("")}
|
|
1
|
+
__emailmaker__.define("js/elMarkupHelper.B6dyF9UI.js",["require","exports","module"],function(Iu,H,HJ){var zp=Object.defineProperty,yr=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),oe=(e,t)=>{let n={};for(var r in e)zp(n,r,{get:e[r],enumerable:!0});return t||zp(n,Symbol.toStringTag,{value:"Module"}),n};function Bi(e){"@babel/helpers - typeof";return Bi=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},Bi(e)}function yA(e,t){if(Bi(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||"default");if(Bi(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function vA(e){var t=yA(e,"string");return Bi(t)=="symbol"?t:t+""}function A(e,t,n){return(t=vA(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Up;Up=Symbol.toStringTag;var Du=class{constructor(){A(this,"_valuesMap",new Map),A(this,Up,"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 jp(){const e=new Du;return new Proxy(e,{set:function(t,n,r){return typeof n=="string"&&Du.prototype.hasOwnProperty(n)?e[n]=r:typeof n=="string"&&e.setItem(n,String(r)),!0},get:function(t,n){if(typeof n=="string"){if(Du.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 Vp(){const e=jp(),t=jp();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)})}Vp();var Gp=Symbol.for("emailmaker.commandInputPause");function Xp(){const e=window,t=e[Gp];if(t)return t;const n=new Set;return e[Gp]=n,window.addEventListener("input",r=>n.forEach(o=>o(r)),!0),n}function EA(){Xp()}function SA(e){const t=Xp();return t.add(e),()=>{t.delete(e)}}EA();var Kp=class{constructor(e){A(this,"_voidElements",void 0),this._voidElements=new Set(e)}isVoidElement(e){return this._voidElements.has(e.toLowerCase())}},St=(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})({}),wA=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===kA||e===LA||e===CA||e===AA||e===TA)>0}advanceWhileChar(e){const t=this.position;for(;this.position<this.len&&e(this.source.charCodeAt(this.position));)this.position++;return this.position-t}},Bu=33,_o=45,Hi=60,Jt=62,Fi=47,_A=61,Yp=34,Zp=39,CA=10,TA=13,AA=12,kA=32,LA=9,Qp=63,NA=65,xA=90,OA=97,RA=122;function Jp(e){return e>=OA&&e<=RA||e>=NA&&e<=xA}function eg(e){return Jp(e)||e===Fi||e===Bu||e===Qp}var Na="(?=[\\s/>])",MA=new RegExp(`<!--|-->|<\\/?script${Na}\\s*\\/?>?`,"i"),PA=new RegExp(`<\\/style${Na}`,"i"),IA={"text/x-handlebars-template":!0,"text/html":!0};function DA(e,t=0,n=0,r=!1){const o=new wA(e,t);let i=n,s=0,a=18,l,c,u=!1,d,m,h;function f(){return o.advanceIfRegExp(/^[_:a-zA-Z][_:\w-.\d]*/).toLowerCase()}function g(){const v=o.pos();for(;!o.eos();){const C=o.nextChar();if(C===Jt)return!0;if(C===Hi)break;if(C===Yp||C===Zp){if(!o.advanceUntilChar(C))break;o.advance(1)}}return o.goBackTo(v),!1}function E(){for(;o.advanceUntilChar(Hi)&&!eg(o.peekChar(1));)o.advance(1)}function w(v){return o.advanceUntilChar(Jt)&&o.advance(1),L(v,22)}function T(){return o.advanceIfRegExp(/^[^\s"'></=\x00-\x0F\x7F\x80-\x9F]*/).toLowerCase()}function L(v,C,b){return a=C,s=v,l=b,C}function y(){const v=o.pos(),C=i,b=p();return b!==21&&v===o.pos()&&!(r&&(b===4||b===8))?(o.advance(1),L(v,18)):b}function p(){const v=o.pos();if(o.eos())return L(v,21);let C;switch(i){case 6:return o.advanceIfChars([_o,_o,Jt])?(i=0,L(v,2)):(o.advanceUntilChars([_o,_o,Jt]),L(v,1));case 3:return o.advanceIfChar(Jt)?(i=0,L(v,15)):(o.advanceUntilChar(Jt),L(v,14));case 0:return o.peekChar()===Hi&&eg(o.peekChar(1))?(o.advance(1),o.peekChar()===Bu?o.advanceIfChars([Bu,_o,_o])?(i=6,L(v,0)):o.advanceIfRegExp(/^!doctype/i)?(i=3,L(v,13)):w(v):o.peekChar()===Qp?w(v):o.advanceIfChar(Fi)?Jp(o.peekChar())?(i=2,L(v,7)):w(v):(i=1,L(v,3))):(E(),L(v,16));case 2:return f().length>0?(i=5,u=!1,L(v,9)):o.skipWhitespace()?L(v,17,"Tag name must directly follow the open bracket."):(i=5,o.advanceUntilChar(Jt),v<o.pos()?L(v,18,"End tag name expected."):p());case 5:if(o.skipWhitespace())return u=!0,L(v,17);if(o.advanceIfChar(Jt))return i=0,L(v,8);if(r&&o.peekChar()===Hi)return i=0,L(v,8,"Closing bracket missing.");if((u||o.peekChar()===Fi)&&g())return i=0,L(v,8);C="Closing bracket expected.";break;case 1:return d=f(),h=void 0,m=void 0,d.length>0?(c=!1,i=4,L(v,6)):o.skipWhitespace()?L(v,17,"Tag name must directly follow the open bracket."):(i=4,o.advanceUntilChar(Jt),v<o.pos()?L(v,18,"Start tag name expected."):p());case 4:return o.skipWhitespace()?(c=!0,L(v,17)):c&&(m=T(),m.length>0)?(i=9,c=!1,L(v,11)):o.advanceIfChars([Fi,Jt])?(i=0,L(v,5)):o.advanceIfChar(Jt)?(d==="script"?h&&IA[h]?i=0:i=7:d==="style"?i=8:i=0,L(v,4)):r&&o.peekChar()===Hi?(i=0,L(v,4,"Closing bracket missing.")):(o.advance(1),L(v,18,"Unexpected character in tag."));case 9:return o.skipWhitespace()?(c=!0,L(v,17)):o.advanceIfChar(_A)?(i=10,L(v,10)):(i=4,p());case 10:if(o.skipWhitespace())return L(v,17);let b=o.advanceIfRegExp(/^[^\s"'`=<>]+/);if(b.length>0)return o.peekChar()===Jt&&o.peekChar(-1)===Fi&&(o.goBack(1),b=b.substr(0,b.length-1)),m==="type"&&(h=b),i=4,c=!1,L(v,12);const S=o.peekChar();return S===Zp||S===Yp?(o.advance(1),o.advanceUntilChar(S)&&o.advance(1),m==="type"&&(h=o.getSource().substring(v+1,o.pos()-1)),i=4,c=!1,L(v,12)):(i=4,c=!1,p());case 7:let _=1;for(;!o.eos();){const k=o.advanceIfRegExp(MA);if(k.length===0)return o.goToEnd(),L(v,19);if(k==="<!--")_===1&&(_=2);else if(k==="-->")_=1;else if(k[1]!=="/")_===2&&(_=3);else if(_===3)_=2;else{o.goBack(k.length);break}}return i=0,v<o.pos()?L(v,19):p();case 8:return o.advanceUntilRegExp(PA),i=0,v<o.pos()?L(v,20):p()}return o.advance(1),i=0,L(v,18,C)}return{scan:y,getTokenType:()=>a,getTokenOffset:()=>s,getTokenLength:()=>o.pos()-s,getTokenEnd:()=>o.pos(),getTokenText:()=>o.getSource().substring(s,o.pos()),getScannerState:()=>i,getTokenError:()=>l}}function BA(e,t){return t||e.start!==e.end?`<!DOCTYPE${e.content}>`:""}function HA(e,t){const n=`<!DOCTYPE${e.content}>`;return e.start=t,e.endTagStart=e.startTagEnd=e.end=t+n.length,n}function FA(e,t){return t||e.start!==e.end?`<!--${e.content}-->`:""}function $A(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 Hu=new Set(["area","br","col","embed","hr","img","input","link","meta","param","vk-snippet-end"]);function WA(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}var tg=Object.create(null);function qA(e,t){const n=tg[e]||(tg[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[WA(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function Fu(e,t){if(e.start===e.end||t)return"";switch(e.type){case I.ELEMENT:return Wu(e,t);case I.ROOT:return[...e.children].map(n=>Fu(n,t)).join("");case I.DOCTYPE:return BA(e,t);case I.COMMENT:return FA(e,t);default:return e.content||""}}function $u(){return{exact:new WeakMap,collapsed:new WeakMap}}function Zn(e,t=!1,n){if(e.start===e.end&&e.type!==I.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=>Zn(a,t,n)).join("");let s;switch(e.type){case I.ELEMENT:{const a=e.tag?.toLowerCase();s=`<${a}${e.attributeNames.map(l=>` ${l}=${JSON.stringify(e.attributes?.[l]??null)}`).join("")}>${i()}</${a}>`;break}case I.ROOT:s=i();break;case I.COMMENT:s=`<!--${e.content??""}-->`;break;case I.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 xa(e,t=0){if(e.start===e.end)return"";switch(e.type){case I.ELEMENT:return UA(e,t);case I.ROOT:return rg(e,t);case I.DOCTYPE:return HA(e,t);case I.COMMENT:return $A(e,t);default:return e.start=e.startTagEnd=t,e.end=e.endTagStart=t+(e.content?.length||0),e.content||""}}function ng(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"&&!qA(t,i)?` ${i}`:` ${i}="${s.replaceAll('"',"'")}"`)}}}return n}function zA(e,t){let n="";if(e.startTagEnd!==e.endTagStart||t)for(const r of e.children)n+=Fu(r);return n}function rg(e,t){let n="";if(e.startTagEnd!==e.endTagStart)for(const r of e.children)n+=xa(r,t+n.length);return n}function og(e,t){if(e.start!==e.startTagEnd||t){const n=e.tag?.toLowerCase()||"div",r=ng(e);return n==="vk-snippet-end"?`<${n}${r}/>`:`<${n}${r}>`}return""}function ig(e,t){return t||e.endTagStart!==e.end?`</${e.tag?.toLowerCase()||"div"}>`:""}function Wu(e,t,n=!0){const r=e.tag?.toLowerCase()||"div",o=og(e,t);if(Hu.has(r))return o;{const i=ig(e,t);return`${o}${n?zA(e,t):""}${i}`}}function UA(e,t){const n=e.tag?.toLowerCase()||"div",r=og(e);if(e.start=t,e.startTagEnd=t+r.length,Hu.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=rg(e,e.startTagEnd);e.endTagStart=e.startTagEnd+o.length;const i=ig(e);return e.end=e.endTagStart+i.length,`${r}${o}${i}`}}function qu(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 I=(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})({}),Oa=e=>e.type===0?e.start-1:e.start,jA=e=>e.type===0?e.end+1:e.end,wt=class mA{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=qu(this.children,r=>t<=Oa(r))-1;if(n>=0){const r=this.children[n];if(t>Oa(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=qu(this.children,r=>t<=Oa(r))-1;if(n>=0){const r=this.children[n];if(t>=Oa(r)&&t<=jA(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 mA(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 VA(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 sg=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 wt(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}}},ag=class{constructor(e){A(this,"dataManager",void 0),this.dataManager=e}parse(e,t=[]){const n=DA(e,void 0,void 0,!0),r=new wt(0,e.length,[],void 0);r.type=I.ROOT;let o=r,i=-1,s,a=null,l=n.scan();const c=()=>{if(!o.tag){const g=o.parent.children,E=g[g.length-2],w=e.substring(o.start,o.end);E?.type===I.HTML?(E.content=(E.content||"")+w,E.end=o.end,g.splice(g.length-1,1)):(o.type=I.HTML,o.content=w,o.children=[]),o.type=I.HTML}o=o.parent},u=new sg(e,I.COMMENT),d=new sg(e,I.DOCTYPE),m=g=>{o.children.push(g)},h=(g,E)=>{const w=new wt(g,E,[],o);w.type=I.HTML,w.content=e.substring(g,E),m(w)};for(;l!==St.EOS;){switch(l){case St.StartDoctypeTag:d.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case St.EndDoctypeTag:{const L=o.lastChild,y=d.node;if(!y)throw new Error("");const p=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(p!==y.start){const v=e.substring(p,y.start);if(v){const C=new wt(p,y.start,[],o);C.type=I.HTML,C.content=v,m(C)}}d.finish(n.getTokenOffset(),n.getTokenLength());break}case St.StartCommentTag:u.start(n.getTokenOffset(),n.getTokenEnd(),o);break;case St.EndCommentTag:{const L=o.lastChild,y=u.node;if(!y)throw new Error("");const p=L?L.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(p!==y.start){const v=e.substring(p,y.start);if(v){const C=new wt(p,y.start,[],o);C.type=I.HTML,C.content=v,m(C)}}u.finish(n.getTokenOffset(),n.getTokenLength());break}case St.StartTagOpen:const g=o.lastChild,E=new wt(n.getTokenOffset(),e.length,[],o),w=g?g.end:o.startTagEnd!==void 0?o.startTagEnd:o.start;if(w!==E.start){const L=e.substring(w,E.start);if(L){const y=new wt(w,E.start,[],o);y.type=I.HTML,y.content=L,m(y)}}m(E),o=E;break;case St.BogusComment:{const L=o.lastChild?.end??o.startTagEnd??o.start;L<n.getTokenOffset()&&h(L,n.getTokenOffset()),h(n.getTokenOffset(),n.getTokenEnd());break}case St.StartTag:o.tag=n.getTokenText();break;case St.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 St.StartTagSelfClose:o.parent&&(o.closed=!0,o.end=n.getTokenEnd(),o.startTagEnd=n.getTokenEnd(),c());break;case St.EndTagOpen:i=n.getTokenOffset(),s=void 0;break;case St.EndTag:s=n.getTokenText().toLowerCase();break;case St.EndTagClose:let T=o;for(;!T.isSameTag(s)&&T.parent;)T=T.parent;if(T.parent){const L=o.lastChild,y=L?L.end:o.startTagEnd===void 0?o.start:o.startTagEnd;if(y!==i){const p=e.substring(y,i);if(p){const v=new wt(y,i,[],o);v.type=I.HTML,v.content=p,m(v)}}for(;o!==T;)o.end=i,o.closed=!1,c();o.closed=!0,o.endTagStart=i,o.end=n.getTokenEnd(),c()}break;case St.AttributeName:{a=n.getTokenText();let L=o.attributes;L||(o.attributes=L={}),L[a]=null;break}case St.AttributeValue:{const L=n.getTokenText(),y=o.attributes;y&&a&&(y[a]=VA(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 f=r.lastChild?.end||0;if(f<e.length){const g=e.substring(f);if(g){const E=new wt(f,e.length,[],r);E.type=I.HTML,E.content=g,m(E)}}return{roots:r.children,findNodeBefore:r.findNodeBefore.bind(r),findNodeAt:r.findNodeAt.bind(r)}}},FJ=new ag(new Kp(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"])),GA=new Kp(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr","vk-snippet-end"]),XA=new ag(GA);function fn(e){return XA.parse(e)}var zu=Symbol("bogusCommentSource");function vr(e){if(e){const t=document.createElement("div");t.insertAdjacentHTML("afterbegin",e);const n=t.firstChild??document.createTextNode("");return n.nodeType===Node.COMMENT_NODE&&KA(n,e),n}else return document.createTextNode("")}function KA(e,t){const n={source:t,data:e.data};Object.defineProperty(e,zu,{value:n,configurable:!0})}function $i(e){const t=e[zu];return t&&t.data===e.data?t:void 0}function Ra(e){return $i(e)?.source}function lg(e,t){if(e.nodeType===Node.COMMENT_NODE){t.push(e);return}(e.nodeName==="TEMPLATE"?e.content:e).childNodes.forEach(n=>lg(n,t))}function Ma(...e){const t=[];return e.forEach(n=>lg(n,t)),t}function YA(e,t){return e.data===t.data&&(e.parent===void 0||t.parent===void 0||e.parent===t.parent)}function cg(e,t){$i(e)||Object.defineProperty(e,zu,{value:t,configurable:!0})}function ZA(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 QA(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)=>YA(e[o+s],i))&&r.push(o);if(!r.length){const o=ZA(e);t.forEach(i=>{const s=o.get(i.data);s&&cg(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)&&cg(o,a)})}function ug(e,t){const n=e.parentNode,r=n&&n.nodeType===Node.ELEMENT_NODE&&!t.includes(n);return{data:e.data,mark:$i(e),parent:r?n.nodeName.toLowerCase():void 0}}function dg(e,t,n){const r=Ma(...t),o=n?[...t,n]:t;QA(e,r,r.map(i=>ug(i,o)))}function en(e,t){dg(Ma(e).map(n=>ug(n,[e])),[t],null)}var JA=/<[!?]|<\/[^a-zA-Z]/,ek=/^<[!?/]/;function tk(e){const t=[],n=r=>{const o=r.parent?.tag?.toLowerCase();if(r.type===I.COMMENT)t.push({data:r.content??"",mark:void 0,parent:o});else if(r.type===I.HTML&&r.content&&ek.test(r.content)){const i=vr(r.content);i.nodeType===Node.COMMENT_NODE&&t.push({data:i.data,mark:$i(i),parent:o})}r.children.forEach(n)};try{fn(e).roots.forEach(n)}catch{return[]}return t}function fg(e,t,n=null){JA.test(t)&&dg(tk(t),e,n)}function Uu(e,t){fg([e],t)}var Wi="",nk=4,mg=0;function rk(){return mg+=1,`${Math.random().toString(36).slice(2)}${mg.toString(36)}`}function ok(e,t,n){if(e.split(`${Wi}${t}:`).length-1!==n.length)return;const r=e.split(new RegExp(`<!--${Wi}${t}:(\\d+)${Wi}-->`)),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 Pa(e,t,n){const r=Ma(e),o=r.map(l=>$i(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:Ma(i),a=r.map(l=>l.data);for(let l=0;l<nk;l++){const c=rk(),u=[];s.forEach((m,h)=>{const f=o[h];f!==void 0&&(m.data=`${Wi}${c}:${u.length}${Wi}`,u.push(f))});const d=ok(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 Er(e){return Pa(e,!0,!1)}function Xe(e){return Pa(e,!1,!1)}function hg(e){return Pa(e,!0,!0)}function ik(e){return Pa(e,!1,!0)}function Ce(e,t){e.innerHTML=t,Uu(e,t)}function zt(e,t){Ce(e,Xe(t))}function ju(e){qi(e,Xe(e))}function qi(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);fg(i,t,n)}var pg=new Set(["text/x-handlebars-template","text/html"]);function Ia(e,t){if(e.type!==I.HTML||!t)return!1;const n=t.tag?.toLowerCase(),r=t.attributes?.type;return n==="style"||n==="script"&&!pg.has(typeof r=="string"?r:"")}var sk={amp:"&",lt:"<",gt:">",nbsp:String.fromCodePoint(160),quot:'"'};function Vu(e){return e.replaceAll(/&(amp|lt|gt|nbsp|quot);/g,(t,n)=>sk[n])}var gg=Symbol("rawTextSource");function Gu(e){const t=document.createTextNode(Vu(e));return bg(t,e),t}function bg(e,t){Object.defineProperty(e,gg,{value:t,configurable:!0})}function ak(e,t){e.data=Vu(t),bg(e,t)}function yg(e){const t=e[gg];return t!==void 0&&Vu(t)===e.textContent?t:void 0}var Co,Xr;function vg(e){const t=Co;return Co=e,()=>{Co===e&&(Co=t)}}function lk(e){const t=Xr;return Xr=e,()=>{Xr===e&&(Xr=t)}}function Eg(e,t,n){return Co?Co(e,t,n):n}function ck(){return Xr!==void 0}function Sg(e,t,n){return Xr?Xr(e,t,n):n}var Xu;function uk(){return Xu||(Xu=document.implementation.createHTMLDocument("")),Xu}function dk(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 fk=new Set(["onclick","onload","onchange","onsubmit","onmouseover","onkeydown","onerror"]),mk=new Set(["script","style","xmp"]);function hk(e,t){return!(t&&mk.has(t.toLowerCase())||fk.has(e.toLowerCase()))}var pk=e=>{let t=e.indexOf("&");for(;t!==-1;){if(e.indexOf(";",t)!==-1)return!0;t=e.indexOf("&",t+1)}return!1},gk=new Set(["head","body"]);function wg(e,t,n){let r=e.tagName.toLowerCase();r==="html"&&(r="div");const o=`<${r} ${t}="${n}"/>`,i=uk(),s=gk.has(r)?dk(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 Qn(e,t,n){try{hk(t,e.tagName)&&!pk(n)?e.setAttribute(t,n):wg(e,t,n)}catch{wg(e,t,n)}}function _g(){return vr("<script><\/script>")}var bk="text/x-em-dormant",zi=Symbol("dormantScriptType");function Ku(e){e[zi]=e.getAttribute("type"),e.setAttribute("type",bk)}function Da(e){return zi in e}function yk(e){const t=[...e].filter(n=>!Da(n));return t.forEach(Ku),t}function vk(e,t){return Da(e)?(e[zi]=t,!0):!1}function Cg(e){const t=new Set;for(const n of e){const r="querySelectorAll"in n?n.querySelectorAll("script"):[];for(const o of[n,...r])Da(o)&&t.add(o)}return[...t]}function Tg(e){if(!Da(e))return;const t=e[zi];delete e[zi],typeof t=="string"?e.setAttribute("type",t):e.removeAttribute("type")}var Ek=["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 Sk(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 Ag(e){const t=Sk(e);return Ek.includes(t)?"classic":t==="module"||t==="importmap"||t==="speculationrules"?t:void 0}function wk(e){return Ag(e)==="classic"}function _k(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 Ck(e){const t=Ag(e);return!t||t==="speculationrules"||Ba(e)?!1:t!=="classic"||!e.hasAttribute("nomodule")&&_k(e)}function Tk(e){return e.hasAttribute("src")&&!["async","defer","nomodule"].some(t=>e.hasAttribute(t))&&wk(e)}function Ba(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 kg(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 Lg(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 Ng(e,t,n){e.replaceWith(t),t.append(...e.childNodes),n.substitute?.(e,t)}function xg(e,t){const n=_g();return Lg(e,n),t.quiet(()=>Ng(e,n,t)),n}function Ak(e,t,n){const r=xg(t,n),o=()=>{e.removeEventListener("load",o),e.removeEventListener("error",o),r.isConnected&&(n.quiet(()=>{Lg(r,t),Ku(t),Ng(r,t,n),Tg(t)}),kg(t,n))};e.addEventListener("load",o),e.addEventListener("error",o)}function Og(e,t){e.forEach(Tg);const n=e.filter(Ba),r=e.filter(i=>i.isConnected&&!Ba(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=>xg(i,t));let o;for(const i of r)o&&!i.hasAttribute("src")?Ak(o,i,t):(kg(i,t),o=Tk(i)?i:o)}function Kr(e,t=!0,n=!1){const r=e.content;switch(e.type){case I.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(Kr(i,!0,n));return o}case I.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case I.COMMENT:return document.createComment(r||"");case I.ELEMENT:if(e.tag){const o=e.tag.toLowerCase()==="script",i=n===!0&&o?_g():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=Eg(i,s,typeof a=="string"?a:"");l!==null&&Qn(i,s,l)}catch{}}if(n==="dormant"&&o&&Ku(i),t){const s=e.tag.toLowerCase()==="template"?!0:n;for(const a of e.children)i.appendChild(Ia(a,e)?Gu(a.content||""):Kr(a,!0,s))}return i}return document.createTextNode("<");case I.HTML:return vr(r||"");default:throw new Error("unsupported node")}}function Re(e,t=!1){return fn(e).roots.map(n=>Kr(n,!0,t))}function Ha(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 kk(e,t){e.replaceChildren(...Re(t,!0))}function Jn(e,t,n){Ha(e,t,Re(n,!0))}var Rg=Symbol.for("emailmaker.documentWriteGuard"),Ui=Symbol.for("emailmaker.documentWriteSink");function Lk(e,t=document){const n=t,r=n[Ui];return n[Ui]=e,()=>{n[Ui]===e&&(n[Ui]=r)}}function $J(e){}function Yu(e,t,n){Object.defineProperty(e,t,{value:n,configurable:!0,writable:!0})}function Nk(e,t,n){for(let r=e.writerOf.get(t);r;r=e.writerOf.get(r))if(r===n)return!0;return!1}function xk(e,t){let n=t;for(;n.nextSibling&&Nk(e,n.nextSibling,t);)n=n.nextSibling;return n}function Mg(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,xk(e,t).nextSibling)}},o=e.doc[Ui];o?o(n,r,t):r()}function Pg(e,t){return!!e&&e.type===I.ELEMENT&&!e.closed&&e.end===t}function Ok(e,t){let n="";for(let r=e;Pg(r,t);r=r.lastChild)n=`</${r.tag}>${n}`;return n}function Rk(e){const t=fn(e).roots,n=t[t.length-1],r=Pg(n,e.length);return{nodes:(r?t.slice(0,-1):t).map(o=>Kr(o)),rest:r?e.slice(n.start):""}}function Mk(e){const t=[...e.pending];e.pending.clear();for(const[n,r]of t){const o=fn(r).roots,i=r+Ok(o[o.length-1],r.length);Mg(e,n,fn(i).roots.map(s=>Kr(s)))}}function Ig(e,t,n){const r=e.doc.currentScript;if(!r?.parentNode){return}const{nodes:o,rest:i}=Rk((e.pending.get(r)??"")+n);i?(e.pending.size||queueMicrotask(()=>Mk(e)),e.pending.set(r,i)):e.pending.delete(r),Mg(e,r,o)}function Pk(e=document){const t=e;if(t[Rg])return;t[Rg]=!0;const n={doc:t,writerOf:new WeakMap,pending:new Map};Yu(e,"write",(...r)=>Ig(n,"write",r.join(""))),Yu(e,"writeln",(...r)=>Ig(n,"writeln",`${r.join("")}
|
|
2
2
|
`)),Yu(e,"open",(...r)=>r.length>=3?e.defaultView?.open(r[0],r[1],r[2])??null:e)}Pk();function Ik(e){return e}var Dk=class extends Error{constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),A(this,"cycle",void 0),this.cycle=e}};function Bk(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 Hk(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 Fk(e){const t=Bk(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 Dk([...o.slice(l),a].map(c=>c.name))}i.add(a),o.push(a);for(const l of Hk(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 ve=class hA{constructor(t=[]){A(this,"_inner",void 0),A(this,"_isDisposed",!1),this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof hA&&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 Zu(e){return`service_container_${e}`}var ji=new Set,Qu;function $k(){if(!Qu)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,Dg.prototype.getInstanceAsync),e.stack}function Ju(e){ji.delete(e)&&Qu?.end(e)}var Dg=class qp extends ve{_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 ve){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=$k();return new Promise((o,i)=>{const s={id:String(t),startedAt:Date.now(),origin:r,container:this,reject:i};ji.add(s),Qu?.start(s),this._onInject(t,()=>{Ju(s),o(this.getInstance(t))})})}failPendingWaits(t){for(const n of Array.from(ji))n.container===this&&(Ju(n),n.reject(t))}pendingWaits(){return[...ji].filter(t=>t.container===this)}addService(t,n){const r=Zu(t);this.injectFactory(r,(i,s=[])=>s.indexOf(n)<0?[...s,n]:s);const o=new ve;return o.addDispose(()=>{this.injectFactory(r,(i,s=[])=>s.filter(a=>a!==n))}),o}addServiceFactory(t,n,r){const o=Zu(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 ve;return s.addDispose(()=>{this.injectFactory(o,(a,l=[])=>i===void 0?l:l.filter(c=>c!==i))}),s}getServices(t){const n=Zu(t);return[...this.getInstance(n,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new qp(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const n=this._parent?.getOrCreateIsolatedContainer(t);return new qp(n)})}remove(t){const n=this._injections;delete n[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(ji))t.container===this&&Ju(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function ed(e){return e.startsWith("__")?e:`__${e}__`}function Wk(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=ed(e),n=globalThis;return n[t]??(n[t]={})}function qk(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function zk(e){if(e)return ed(e);const t="emailmaker".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return ed(t)}function td(e){const t=zk(e),n=Wk(t);if(qk(n.container))return n.container;const r=new Dg(null);return n.container=r,r}function Uk(){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 jk(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Uk()}function le(e=jk()){return e}function Bg(){return"iframe".trim()||"unknown"}function Vk(e){if(typeof globalThis>"u")return;const t=Bg(),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 Gk(){const e="emailmaker".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Xk(e,t){if(Vk(t),typeof globalThis>"u")return e;const n=Bg(),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 Fa;function Kk(){if(Fa)return Fa;const e=Gk();return Fa=Xk(td(e),e),Fa}var WJ=new Proxy({},{get(e,t,n){const r=Kk(),o=Reflect.get(r,t,n);return typeof o=="function"?o.bind(r):o}}),Yk=new Function("url","return import(url)");function Zk(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function nd(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Hg(e){return e.type==="umd"||e.resolve==="registry"}var Qk="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 Jk(e){const t=Array.isArray(e)?e[0]:e;return nd(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function eL(e,t){const n=Jk(e),r=nd(e)?e:void 0,o=t instanceof Error?t.message:String(t),i=r&&Hg(r)&&!/compat/iu.test(o)?` ${Qk}`:"",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 tL(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function qJ(e){return e}var nL=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(nd(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(Hg(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Yk(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):tL(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=eL(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 Zk(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)}))}},Fg=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)}}}},rL=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()}},K=le("SandboxHtmlDocument"),_t=le("SandboxRemoteDocument"),Vi=le("SandboxTextDocument"),mn=le("SandboxDocumentMapping"),Te=le("SandboxSyncCommit"),Gi=le("SandboxLayoutProfile"),$g=le("SandboxState"),Me=le("SandboxSelectionLock"),nt=le("SandboxEditLock"),To=le("SandboxAttributePipeline"),rd=le("SandboxAmpService"),od=le("SandboxImageReload"),$a=le("SandboxImageCache"),ft=le("SandboxFocus"),id=le("SandboxLocalization"),He=le("SandboxElementSettings"),Ot=le("SandboxSetCursor"),Wg=le("SandboxStyleRoot"),qg=le("SandboxVmlWidthResolver"),Wa=le("SandboxPrepareHtml"),Xi=le("SandboxSurfaceName"),Ao=le("SandboxDocumentSync"),ko=le("SandboxMapObj"),Lo=le("SandboxActiveElementFingerprint"),qa=le("SandboxToggleTextStyle"),hn=le("SandboxWrapEditor"),No=le("SandboxInsertServices"),Ki=le("SandboxInitPreview"),sd=le("SandboxInsertPolicy"),xo=le("SandboxTableSelections"),zg=le("SandboxNarrowTableTextAtom"),Ug=le("SandboxSettingsExtras"),jg=le("SandboxViewportHandlers"),Vg=le("SandboxOperations"),za=le("SandboxApplyElementSettings"),Sr=le("SandboxOperationEnvironment"),Oo=le("SandboxHostFacts"),oL="__sandbox__",Rt=td(oL);function iL(e){return e}function sL(e,t=Rt){t.inject(Xi,e.name),t.inject(Gi,e.profile);for(const n of Fk(e.units))n.setup(t);return t}function pn(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 Gg=class extends ve{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()}},aL=class extends Gg{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}}},he=class extends aL{execute([e],t){for(const n of t)try{n(e)}catch{}}},lL=class extends Gg{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 cL(e,t,n){let r;const o=new he({onFirstListenerAdd(){r=o.addDisposable(new ve),r.addDisposable(e(i=>{t(i)!==!1&&o.fire(i)}))},onLastListenerRemove(){r?.dispose(),r=void 0}});return n?.addDisposable(o),o.event}function uL(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 dL(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 zJ(e){return e}function fL(e){return e&&typeof e=="object"}function Xg(e,t){return e&&typeof e=="object"&&e.operationId===t}var On="INIT_MESSAGE",mL="em:port-ready",hL="em:window-drained",ad="";function Kg(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var pL=class extends ve{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))}},gL=class extends ve{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 pL)),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)&&Xg(o,On)){this._greeted.delete(i),this._handshaken.add(i),this._postMessage(i,{operationId:On,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),fL(o)&&l||this._singleton&&Xg(o,On)){if(s&&l){const m=this._target;Promise.resolve().then(()=>this.usePort(s,!0,m))}const c=this._emitter.fireAsync(o.operationId||ad,o.operationId===void 0?r:o.data),u=o.result,d=o.error;u&&d&&Promise.resolve(c).then(m=>this._sendMessage(u,m),m=>this._sendMessage(d,m))}}),this._singleton=t,this._transport=uL({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(On,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(On))}),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(On,void 0);return}this._inited=!1,this._postMessage(e,{operationId:On,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:On,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:On,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=dL(e),o=r.subscribe(this._onTransportMessage);this._ports.set(n,{transport:r,subscription:o}),t&&(r.send({operationId:mL,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:hL,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(ad,e,t)}sendAsync(e,t,n=!0){if(!n&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const r=Kg(),o=Kg();return new Promise((i,s)=>{const a=this.addDisposable(new ve);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(ad,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 ve);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(On,()=>{e(this._target)},n)),r}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function Yg(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 Zg(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 bL=/<\/?[a-zA-Z][a-zA-Z0-9:_.-]*(?:\s[^<>]*)?\/?>/g;function yL(e){return e.replace(bL,t=>/^<br\b/i.test(t)?" ":"")}var vL={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"},EL=15e3,ld=3e3,SL="fonts.googleapis.com",wL=e=>{try{const t=new URL(String(e??"").trim());return t.protocol==="https:"?t:null}catch{return null}},_L=e=>{const t=wL(String(e??""));return t?t.hostname===SL&&t.pathname.startsWith("/css")&&!!t.searchParams.get("family"):!1},Ae={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"},CL=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")}),G=new gL(window.parent,!0),Ua,Yi,Qg=Math.random().toString(36).slice(2,8),TL=0,ja;function Jg(e,t){const n=Ua;Ua=e;try{return t()}finally{Ua=n}}function Va(e,t){const n=Yi;Yi=e;try{return t()}finally{Yi=n}}function AL(){return Yi}function kL(){try{return Ua?.()}catch{return}}function LL(){return ja||(ja=`${Qg}:${++TL}`,Promise.resolve().then(()=>{ja=void 0})),ja}function rt(e,t){const n=kL();return G.send(Ae.APPLICATION_DOMPARSER_ERROR,{message:e,stack:new Error().stack,...n?{mutation:n}:{},source:Yi??"other",batch:LL(),instance:Qg}),t}function cd(e,t){let n=t.children,r=e(t)||0;if(r!=0||!n)return r!==1;for(const o of n)if(cd(e,o)===!1)return!1;return!0}function eb(e,t,n=[t]){for(;t=t.parent;)if(e(n=[t,...n])===!1)return!1;return!0}function NL(e,t){return eb(([n,r])=>{const{children:o}=n;if(o){for(let i=o.indexOf(r)+1,s=o.length;i<s;i++)if(cd(e,o[i])===!1)return!1}},t)}function er(e,t,n){cd(r=>{r.start+=t,r.startTagEnd!==void 0&&(r.startTagEnd+=t),r.end+=t,r.endTagStart!==void 0&&(r.endTagStart+=t)},e),n&&(eb(([r])=>{r.end+=n,r.endTagStart!==void 0&&(r.endTagStart+=n)},e),NL(r=>{r.start+=n,r.startTagEnd!==void 0&&(r.startTagEnd+=n),r.end+=n,r.endTagStart!==void 0&&(r.endTagStart+=n)},e))}var xL=e=>e.type===I.HTML?e.start-1:e.start,OL=e=>e.type===I.HTML?e.end+1:e.end;function RL(e,t){const{start:n,end:r}=e;let o=t.findNodeAt(n);for(;o&&(xL(o)>=n||OL(o)<=r||o.start===o.startTagEnd);)o=o.parent;return o}function ML(e){return{start:e.start+(e.tag?.length||0)+1,end:(e.startTagEnd!==void 0?e.startTagEnd:e.start)-1}}function tb(e){const t=e.parent?.children;if(t){const n=t.indexOf(e);if(n>0)return t[n-1]}}function wr(e){let t=e;do t=PL(t);while(t&&t.type===I.HTML&&!t.content);return t}function PL(e){const t=e.parent?.children;if(t){const n=t.indexOf(e);if(n<0)return rt("parent and child not sync",e);if(n<t.length-1)return t[n+1]||null}return null}var Yr=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 nb(e,t){return(t<<5)-t+e|0}function IL(e,t){t=nb(149417,t);for(let n=0,r=e.length;n<r;n++)t=nb(e.charCodeAt(n),t);return t}var rb=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 ob(e,t,n){return new DL(new rb(e),new rb(t)).ComputeDiff(n).changes}var Ro=class{static Assert(e,t){if(!e)throw new Error(t)}},Mo=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]}},ib=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 Yr(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}},DL=class Di{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]=Di._getElements(t),[a,l,c]=Di._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(Di._isStringArray(n)){const r=new Int32Array(n.length);for(let o=0,i=n.length;o<i;o++)r[o]=IL(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)?Di._getStrictElement(this._originalSequence,t)===Di._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?(Ro.Assert(t===n+1,"originalStart should only be one more than originalEnd"),c=[new Yr(t,0,r,o-r+1)]):t<=n?(Ro.Assert(r===o+1,"modifiedStart should only be one more than modifiedEnd"),c=[new Yr(t,n-t+1,r,0)]):(Ro.Assert(t===n+1,"originalStart should only be one more than originalEnd"),Ro.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 Yr(t,n-t+1,r,o-r+1)]}WALKTRACE(t,n,r,o,i,s,a,l,c,u,d,m,h,f,g,E,w,T){let L=null,y=null,p=new ib,v=n,C=r,b=h[0]-E[0]-o,S=-1073741824,_=this.m_forwardHistory.length-1;do{const k=b+t;k===v||k<C&&c[k-1]<c[k+1]?(d=c[k+1],f=d-b-o,d<S&&p.MarkNextChange(),S=d,p.AddModifiedElement(d+1,f),b=k+1-t):(d=c[k-1]+1,f=d-b-o,d<S&&p.MarkNextChange(),S=d-1,p.AddOriginalElement(d,f+1),b=k-1-t),_>=0&&(c=this.m_forwardHistory[_],t=c[0],v=1,C=c.length-1)}while(--_>=-1);if(L=p.getReverseChanges(),T[0]){let k=h[0]+1,x=E[0]+1;if(L!==null&&L.length>0){const N=L[L.length-1];k=Math.max(k,N.getOriginalEnd()),x=Math.max(x,N.getModifiedEnd())}y=[new Yr(k,m-k+1,x,g-x+1)]}else{p=new ib,v=s,C=a,b=h[0]-E[0]-l,S=1073741824,_=w?this.m_reverseHistory.length-1:this.m_reverseHistory.length-2;do{const k=b+i;k===v||k<C&&u[k-1]>=u[k+1]?(d=u[k+1]-1,f=d-b-l,d>S&&p.MarkNextChange(),S=d+1,p.AddOriginalElement(d+1,f+1),b=k+1-i):(d=u[k-1],f=d-b-l,d>S&&p.MarkNextChange(),S=d,p.AddModifiedElement(d+1,f+1),b=k-1-i),_>=0&&(u=this.m_reverseHistory[_],i=u[0],v=1,C=u.length-1)}while(--_>=-1);y=p.getChanges()}return this.ConcatenateChanges(L,y)}ComputeRecursionPoint(t,n,r,o,i,s,a){let l=0,c=0,u=0,d=0,m=0,h=0;t--,r--,i[0]=0,s[0]=0,this.m_forwardHistory=[],this.m_reverseHistory=[];const f=n-t+(o-r),g=f+1,E=new Int32Array(g),w=new Int32Array(g),T=o-r,L=n-t,y=t-r,p=n-o,v=(L-T)%2===0;E[T]=t,w[L]=n,a[0]=!1;for(let C=1;C<=f/2+1;C++){let b=0,S=0;if(C>100)return null;u=this.ClipDiagonalBound(T-C,C,T,g),d=this.ClipDiagonalBound(T+C,C,T,g);for(let k=u;k<=d;k+=2){k===u||k<d&&E[k-1]<E[k+1]?l=E[k+1]:l=E[k-1]+1,c=l-(k-T)-y;const x=l;for(;l<n&&c<o&&this.ElementsAreEqual(l+1,c+1);)l++,c++;if(E[k]=l,l+c>b+S&&(b=l,S=c),!v&&Math.abs(k-L)<=C-1&&l>=w[k])return i[0]=l,s[0]=c,x<=w[k]&&C<=1448?this.WALKTRACE(T,u,d,y,L,m,h,p,E,w,l,n,i,c,o,s,v,a):null}const _=(b-t+(S-r)-C)/2;if(this.ContinueProcessingPredicate!==null&&!this.ContinueProcessingPredicate(b,_))return a[0]=!0,i[0]=b,s[0]=S,_>0&&C<=1448?this.WALKTRACE(T,u,d,y,L,m,h,p,E,w,l,n,i,c,o,s,v,a):(t++,r++,[new Yr(t,n-t+1,r,o-r+1)]);m=this.ClipDiagonalBound(L-C,C,L,g),h=this.ClipDiagonalBound(L+C,C,L,g);for(let k=m;k<=h;k+=2){k===m||k<h&&w[k-1]>=w[k+1]?l=w[k+1]-1:l=w[k-1],c=l-(k-L)-p;const x=l;for(;l>t&&c>r&&this.ElementsAreEqual(l,c);)l--,c--;if(w[k]=l,v&&Math.abs(k-T)<=C&&l<=E[k])return i[0]=l,s[0]=c,x>=E[k]&&C<=1448?this.WALKTRACE(T,u,d,y,L,m,h,p,E,w,l,n,i,c,o,s,v,a):null}if(C<=1447){let k=new Int32Array(d-u+2);k[0]=T-u+1,Mo.Copy2(E,u,k,1,d-u+1),this.m_forwardHistory.push(k),k=new Int32Array(h-m+2),k[0]=L-m+1,Mo.Copy2(w,m,k,1,h-m+1),this.m_reverseHistory.push(k)}}return this.WALKTRACE(T,u,d,y,L,m,h,p,E,w,l,n,i,c,o,s,v,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 m=r.originalStart-d,h=r.modifiedStart-d;if(m<o||h<i||s&&!this.OriginalElementsAreEqual(m,m+r.originalLength)||a&&!this.ModifiedElementsAreEqual(h,h+r.modifiedLength))break;const f=(m===o&&h===i?5:0)+this._boundaryScore(m,r.originalLength,h,r.modifiedLength);f>c&&(c=f,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,m=d-u;if(s<5&&c<20&&m<20){const h=this._findBetterContiguousSequence(a,c,u,m,s);if(h){const[f,g]=h;(f!==o.originalStart+o.originalLength||g!==o.modifiedStart+o.modifiedLength)&&(o.originalLength=f-o.originalStart,o.modifiedLength=g-o.modifiedStart,i.originalStart=f+s,i.modifiedStart=g+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 m=r;m<a;m++){const h=this._contiguousSequenceScore(d,m,i);h>0&&h>l&&(l=h,c=d,u=m)}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 Mo.Copy(t,0,o,0,t.length-1),o[t.length-1]=r[0],Mo.Copy(n,1,o,t.length,n.length-1),o}else{const o=new Array(t.length+n.length);return Mo.Copy(t,0,o,0,t.length),Mo.Copy(n,0,o,t.length,n.length),o}}ChangesOverlap(t,n,r){if(Ro.Assert(t.originalStart<=n.originalStart,"Left change is not less than or equal to right change"),Ro.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 Yr(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 Ga(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var Ut=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} "${Ga(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Ga(this.oldText)}")`:`(replace@${this.oldPosition} "${Ga(this.oldText)}" with "${Ga(this.newText)}")`}};function Ct(e,t){return e===null||e.length===0?t:new BL(e,t).compress()}var BL=class br{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]=br._splitCurr(o,r.newPosition-o.oldPosition);this._acceptCurr(l),o=c;continue}if(r.newPosition<o.oldPosition){const[l,c]=br._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]=br._splitPrev(r,o.oldLength);s=l,a=o,r=c,o=this._getCurr(++n)}else{const[l,c]=br._splitCurr(o,r.newLength);s=r,a=l,r=this._getPrev(++t),o=c}this._result[this._resultLen++]=new Ut(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const i=br._merge(this._result);return br._removeNoOps(i)}_acceptCurr(t){this._result[this._resultLen++]=br._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++]=br._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 Ut(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new Ut(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 Ut(t.oldPosition,t.oldText,t.newPosition,r),new Ut(t.oldEnd,"",t.newPosition+n,o)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),o=t.oldText.substr(n);return[new Ut(t.oldPosition,r,t.newPosition,t.newText),new Ut(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 Ut(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 sb(e){return new Ut(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Rn(e){return e.map(sb)}function HL(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 FL(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 Xa(e,t,n){if(!t.length)return[...e];const r=[];let o=0;for(const i of e){const s=FL({start:i.oldPosition,end:i.oldEnd},t,n);if(!s)return null;r.push(new Ut(s.start,i.oldText,s.start+o,i.newText)),o+=i.newLength-i.oldLength}return r}function ab(e,t,n=0){const r=e.range;return new Ut(e.range.start,typeof t=="string"?t.substring(r.start,r.end):t.getText(r),r.start+n,e.text)}function Po(e,t){let n=0;return e.map(({text:r,range:{start:o,end:i}})=>{let s=n;return n+=r.length-(i-o),ab({text:r,range:{start:o,end:i}},t,s)})}function $L(e){return{range:{start:e.oldPosition,end:e.oldEnd},text:e.newText}}function Zr(e){return e.map(t=>$L(t))}function WL(e,t=Zi(e)){const n=e.getLength(),{start:r,end:o}=t;return r>n||o<0?null:{start:r,end:o}}var UJ=RegExp("["+["-","[","]","/","{","}","(",")","*","+","?",".","\\","^","$","|"].join("\\")+"]","g");function qL(e,{start:t,end:n}){return{start:t,end:n+(e.newLength-e.oldLength)}}function Zi(e){return{start:0,end:e.getLength()}}function zL(e,t,n){return`${e.substring(0,n.start)}${t}${e.substring(n.end)}`}function Qi(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 UL(e,t){return t=Ka(t).sort(({range:n},{range:r})=>n.start-r.start),Qi(e,t)}function Ji(e,t){return e>=t.start&&e<=t.end}function Ka(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(Ji(i.start,l)&&Ji(i.start,l))c=l;else if(Ji(l.start,i))Ji(l.end,i)?c=i:c={start:i.start,end:l.end};else if(Ji(l.end,i))c={start:l.start,end:i.end};else continue;const u=o.text;let d=l.start-i.start+u.length,m=l.end-i.start+u.length;const h=zL(u,a.text,{start:d,end:m});e[r]=o={range:i=c,text:h},e.splice(s--,1),n--}}return e}function jL(e,t){if(e.length<=1)return e[0]||null;e=Ka(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:Qi(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 VL(e,t){const n=Rn(e),r=jL(Zr(n),t);if(r){const o=ab(r,t);return sb(o)}return null}function GL(e,{range:t,text:n}){const r=e.getText(t);return ob(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 lb({oldText:e,newText:t,oldPosition:n,newPosition:r}){return ob(e,t,!0).map(o=>new Ut(n+o.originalStart,e.substring(o.originalStart,o.originalStart+o.originalLength),r+o.modifiedStart,t.substring(o.modifiedStart,o.modifiedStart+o.modifiedLength)))}var XL=class{constructor(e,t){A(this,"index",void 0),A(this,"values",void 0),A(this,"type","insert"),this.index=e,this.values=t}},KL=class{constructor(e,t){A(this,"index",void 0),A(this,"howMany",void 0),A(this,"type","remove"),this.index=e,this.howMany=t}},YL=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 ZL(e,t){return e===t}function QL(e,t,n=ZL){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,m=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 YL(d,m,h)),l--;break}var f=[];for(l=0;l<r;){if(s[l]){l++;continue}for(var g=l,h=0;l<r&&!s[l++];)h++;f.push(new KL(g,h))}for(var E=[],u=0;u<o;){if(a[u]){u++;continue}for(var g=u,h=0;u<o&&!a[u++];)h++;var w=t.slice(g,g+h);E.push(new XL(g,w))}var T=E.length,L=f.length,y=i.length,p,v,C=0;for(p=0;p<L;p++){var b=f[p];for(b.index-=C,C+=b.howMany,v=0;v<y;v++){var S=i[v];S.from>=b.index&&(S.from-=b.howMany)}}for(p=T;p--;){var _=E[p],h=_.values.length;for(v=y;v--;){var S=i[v];S.to>=_.index&&(S.to-=h)}}for(p=y;p-- >1;){var S=i[p];if(S.to!==S.from)for(v=p;v--;){var k=i[v];k.to>=S.to&&(k.to-=S.howMany),k.to>=S.from&&(k.to+=S.howMany)}}var x=[];for(p=0;p<y;p++){var S=i[p];if(S.to!==S.from)for(x.push(S),v=p+1;v<y;v++){var N=i[v];N.from>=S.from&&(N.from-=S.howMany),N.from>=S.to&&(N.from+=S.howMany)}}return[...f,...x,...E]}var cb=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}},ie;(function(e){function t(d,m,h){return{type:"Add",node:m,nextSibling:h,parent:d}}e.add=t;function n(d){return{type:"Remove",node:d}}e.remove=n;function r(d,m,h){return{type:"Attribute",node:d,name:m,value:h}}e.attribute=r;function o(d,m,h){return h?{type:"Update",prev:d,next:m,soft:h}:{type:"Update",prev:d,next:m}}e.update=o;function i(d,m,h,f){return[{type:"Remove",node:d},{type:"Add",node:h,nextSibling:f,parent:m,replaces:d}]}e.recreate=i;function s(d,m,h){return{type:"Move",node:m,nextSibling:h,parent:d}}e.move=s;function a(d,m){return{type:"Set",node:d,data:m}}e.set=a;function l(d,m,h){return{type:"ClassList",node:d,addedClasses:m,removedClasses:h}}e.classList=l;function c(d,m){return{type:"Style",node:d,value:m}}e.style=c;function u(d,m){return{type:"Hidden",node:d,value:m}}e.hidden=u})(ie||(ie={}));function ub(e,t){return e.push(t),{dispose:()=>{const n=e.indexOf(t);n!==-1&&e.splice(n,1)}}}var db=[],fb=[];function JL(e){return ub(db,e)}function ud(e){return e?db.some(t=>t(e)):!1}function eN(e){return ub(fb,e)}function tN(e){return fb.some(t=>t(e))}function nN(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 m=o[d];l.push(ie.attribute(t,m,void 0))}break}else r[u]!==n[u]&&l.push(ie.attribute(t,u,r[u]))}for(;c<a;c++){const u=i[c];l.push(ie.attribute(t,u,r[u]))}return l}function rN(e){let t=[];const n=e.children.filter(o=>o.type!==I.HTML||!!o.content);let r;for(let o=n.length-1;o>=0;o--)t.push(ie.add(e,n[o],r)),r=n[o];return t}function oN(e){return ie.remove(e)}var iN=new Set(["head","body","html"]),sN=e=>e.type===I.ROOT||e.type===I.DOCTYPE||e.type===I.ELEMENT&&e.tag&&iN.has(e.tag.toLowerCase()),aN=/^<[!?/]/;function dd(e){return e.type===I.ELEMENT?String(e.tag):e.type===I.HTML&&aN.test(e.content??"")?"bogus":String(e.type)}function Ya(e){const t=new cb,n=Object.create(null);for(const r of e){const o=dd(r)+(!sN(r)&&r.start===r.end?"_hidden":"");let i="";r.type===I.ELEMENT&&r.attributes?.id?i=`id_${r.attributes.id}`:i=n[o]=(n[o]||0)+1,t.set(`${o}_${i}`,r)}return t}function mb(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 Za(e,t){const n=e[t-1];return t<e.length?e[t].shift:n.shift+n.delta}function fd(e,t){return(e.type===I.HTML?e.end+1:e.end)<=t.oldPosition}function lN(e,t){return(e.type===I.HTML?e.start-1:e.start)>=t.oldEnd}function md(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&&dd(t)===dd(e)&&t.attributes?.id===e.attributes?.id}function es(e,t,n){return Zn(e,!1,n)===Zn(t,!1,n)}function pd(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 Qa(e,t,n=0){return pd(t.length,n,r=>!lN(e,t[r]))}function gd(e,t){const n=Qa(e,t);return t.slice(n,gb(e,t,n))}function hb(e,t){const n=Qa(e,t);return n<t.length&&!fd(e,t[n])?void 0:e.start+Za(t,n)}function Ja(e){return e.type===I.ELEMENT?e.attributes?.id:void 0}function pb(e){const t=new Set,n=new Set;for(const r of e){const o=Ja(r);o&&(t.has(o)?n:t).add(o)}return n}function cN(e,t,n){const r=new Set([...pb(t),...pb(n)]),o=new Map;e.forEach((s,a)=>{for(let l=s.prevFrom;l<s.prevTo;l++){const c=Ja(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=Ja(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 uN(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=Qa(u,n,s),s<n.length&&!fd(u,n[s]))continue;const d=u.start+Za(n,s),m=pd(t.length,a,h=>t[h].start>=d);md(u,t[m],d)&&(a=m,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 gb(e,t,n){return pd(t.length,n,r=>fd(e,t[r]))}function bb(e,t,n,r,o,i,s){const a=Qa(e,o),l=gb(e,o,a),c=(g,E=()=>!0)=>g?.find(w=>w>=n&&w<r&&hd(e,t[w])&&E(t[w]))??-1,u=e.start+Za(o,a),d=e.end+Za(o,l),m=a===o.length||e.start<o[a].oldPosition,h=m?c(s.byStart.get(u)):-1,f=l>a&&e.end>o[l-1].oldEnd?c(s.byEnd.get(d),g=>!(m&&fN(e,g,u))):-1;return h>=0&&f>=0&&h!==f?es(e,t[h],i)||es(e,t[f],i)?es(e,t[h],i)?h:f:vb(e,t[f],o)>vb(e,t[h],o)?f:h:h>=0?h:f}function yb(e,t,n){const r=e.get(t);r?r.push(n):e.set(t,[n])}function dN(e,t,n){const r={byStart:new Map,byEnd:new Map};for(let o=t;o<n;o++)yb(r.byStart,e[o].start,o),yb(r.byEnd,e[o].end,o);return r}function fN(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 vb(e,t,n){const r=new Map(t.children.map(o=>[o.start,o]));return e.children.filter(o=>{const i=hb(o,n);return i!==void 0&&md(o,r.get(i),i)}).length}function Eb(e,t){return gd(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 mN(e,t,n,r,o,i){const s=es(e,t,i),a=es(n,r,i);return s!==a?a:Eb(n,o)>Eb(e,o)}function hN(e,t,n,r){const o=n.edits??[],i=[],s=[];let{prevFrom:a,prevTo:l,nextFrom:c,nextTo:u}=n;const d=dN(t,c,u);for(;o.length&&a<l&&c<u;){const m=bb(e[l-1],t,c,u,o,r,d);if(l-1===a){m>=0&&s.unshift([a,m]);break}const h=bb(e[a],t,c,u,o,r,d);let f=h>=0,g=m>=0;if(f&&g&&h>=m&&(g=mN(e[a],t[h],e[l-1],t[m],o,r),f=!g),!f&&!g)break;f&&(i.push([a,h]),a++,c=h+1),g&&(s.unshift([l-1,m]),l--,u=m)}return[...i,...s]}function pN(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 gN(e,t,n,r,o){const i=o?.length?hb(e,o):void 0;return(i===void 0?void 0:t.children.find(s=>md(e,s,i)))??r.getByKey(n.getByValue(e)??"")}function ts(e,t){for(const n of t)e.push(n)}function Sb(e,t,n,r,o,i,s,a,l=new Map){const c=[],u=r.prevFrom,d=t.slice(u,r.prevTo),m=n.slice(r.nextFrom,r.nextTo),[h,f]=o??[Ya(d),Ya(m)],g=QL(d,m,(w,T)=>h.getByValue(w)===f.getByValue(T)),E=w=>{const T=Ja(w);return T?l.get(T):void 0};for(const w of g)switch(w.type){case"insert":{const T=u+w.index;let L=t[T];for(const y of w.values.reverse()){t.splice(T,0,y),i.add(y);const p=E(y);p?(ts(c,el(p,y,s,a)),c.push(ie.move(e,y,L))):c.push(ie.add(e,y,L)),L=y}break}case"remove":{const T=t.splice(u+w.index,w.howMany);for(const L of T)E(L)!==L&&c.push(ie.remove(L));break}case"move":{const T=t.splice(u+w.from,w.howMany);let L=t[u+w.to];t.splice(u+w.to,0,...T);for(const y of T.reverse()){const p=f.getByKey(h.getByValue(y)??"");if(!p)return rt("error while sync",c);i.add(p),ts(c,el(y,p,s,a,r.edits&&gd(y,r.edits))),c.push(ie.move(e,p,L)),L=y}break}}return c}function bd(e,t,n=!1,r=$u(),o){const i=[],s=Ya(e.children),a=Ya(t.children);for(let g=e.children.length-1;g>=0;g--){const E=e.children[g];if(E.type===I.ELEMENT&&E.start===E.end){const w=s.getByValue(E);if(!a.getByKey(w)){let T=!1;for(let L=g+1;L<e.children.length;L++){const y=e.children[L];if(y){const p=gN(y,t,s,a,o);if(p){const v=p.start,C=E.clone();t.children.splice(t.children.indexOf(p),0,C),er(C,v-E.start),C.parent=t,a.set(w,C),T=!0;break}}}if(!T){const L=t.endTagStart===void 0?t.end:t.endTagStart,y=E.clone();t.children.push(y),a.set(w,y),er(y,L-E.start),y.parent=t}}}}const l=e.children.filter(g=>g.type!==I.HTML||!!g.content),c=t.children.filter(g=>g.type!==I.HTML||!!g.content),u=o?.length?uN(l,c,o):null,d=u?cN(u,l,c):new Map,m=new Set;for(const g of u?[...u].reverse():[]){const E=pN(g,hN(l,c,g,r)).reverse();for(const w of E)ts(i,Sb(t,l,c,w,void 0,m,n,r,d))}const h={prevFrom:0,prevTo:l.length,nextFrom:0,nextTo:c.length,edits:o};u||ts(i,Sb(t,l,c,h,[s,a],m,n,r)),c.length!==l.length&&rt("error while sync");const f=new Map;for(const g of u??[h])for(let E=g.nextFrom;E<g.nextTo;E++)f.set(E,g.edits);for(let g=c.length-1;g>=0;g--){const E=c[g];if(!m.has(E)){const w=f.get(g);ts(i,el(l[g],E,n,r,w&&gd(l[g],w)))}}return i}function yd(e){return e.type===I.ELEMENT&&ud(e.tag)}function el(e,t,n=!1,r=$u(),o){if(e.type===t.type&&!(e.isDirty||t.isDirty)){if(yd(e)&&e.tag===t.tag){if(Zn(e,!1,r)===Zn(t,!1,r))return[ie.update(e,t,n),...bd(e,t,!0,r)]}else if((e.type===I.ELEMENT||e.type===I.ROOT)&&e.tag===t.tag)return[ie.update(e,t,n),...nN(e,t),...bd(e,t,n,r,o)];if(e.type===I.HTML||e.type===I.COMMENT)return e.content===t.content?[ie.update(e,t,n)]:[ie.update(e,t,n),ie.set(t,t.content)]}return!e.parent||!t.parent?rt("cannot replace document",[]):yd(e)&&e.tag===t.tag?ie.recreate(e,t.parent,t,wr(t)||void 0):[ie.remove(e),ie.add(t.parent,t,wr(t)||void 0)]}var tr="FROM_DOM",nr="FROM_REMOTE",bN=/<\/.*>/i;function yN(e){return bN.test(e)}var vN=/^<[!?/][^>]*$/,EN=class extends ve{constructor(e,t){super(),A(this,"_baseDocument",void 0),A(this,"_createRoot",void 0),A(this,"_beforeTextChangeEmitter",this.addDisposable(new he)),A(this,"_onTextChangeEmitter",this.addDisposable(new he)),A(this,"_onMutateEmitter",this.addDisposable(new he)),A(this,"_beforeRefreshEmitter",this.addDisposable(new he)),A(this,"_onRefreshEmitter",this.addDisposable(new he)),A(this,"_root",new wt(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 wt(0,0,[]);n.type=I.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}=fn(e),i=this._root=this._createRoot?this._createRoot(o,e):new wt(0,e.length,o);if(i.type=I.ROOT,this._createRoot||o.forEach(s=>s.parent=i),!t){const s=n&&mb(n);this._onRefreshEmitter.fire(r?bd(r,i,!1,void 0,s):rN(i))}}_onTextChange({source:e,changes:t}){if(e==="FROM_REMOTE"){const n=VL(t,this._baseDocument.getText());if(n)try{this._beforeTextChangeEmitter.fire(),Va("text",()=>this.replaceWithHtml(n,nr,t))}finally{this._onTextChangeEmitter.fire()}}}insertBefore(e,t,n,r){if(t.parent){if(t.parent===e&&wr(t)===n)return t;this.remove(t,r)}const o=this.contains(e),i=xa(t),s=e.children,a=n?s.indexOf(n):s.length;if(a<0)return rt("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,er(t,l-t.start,i.length),o&&(r!=="FROM_DOM"&&this._onMutateEmitter.fire([ie.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=xa(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)er(r,n-r.start),n+=o.length;er(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=>ud(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!==I.HTML){if(!u.closed)return!1}else return!u.content||!yN(u.content)&&!vN.test(u.content);return!0};if(!this._root)return this.initialize(r.getText(),!1,n);let i={start:e.oldPosition,end:e.oldEnd},s=RL(i,this._root);if(!s)return this.initialize(r.getText(),!1,n);let a,l,c;do{const u=qL(e,s);a=this._baseDocument.getText(u),[l,...c]=fn(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 rt("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,er(s,n.start-s.start,c),this._baseDocument.getText(s)!==i?(rt("Error while sync"),s):(r!=="FROM_DOM"&&this._onMutateEmitter.fire(el(n,s,!1,void 0,o&&mb(o))),n.parent=void 0,s)}remove(e,t){const n=this.contains(e),r=e.parent;if(!r)return rt("node is not in tree");const o=r.children,i=o.indexOf(e);if(i<0)return rt("referenced node is not a child of parent node");const s=e.end-e.start;er(e,0,-s),o.splice(i,1),n&&(t!=="FROM_DOM"&&this._onMutateEmitter.fire([oN(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=ng(e),a=e.startTagEnd===void 0?0:e.startTagEnd-e.start-(e.tag?.length||0)-2,l=ML(e),c=s.length-a,u=e.start;er(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=xa(e,o),l=a.length-s;er(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=wr(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=fn(t).roots;i.length!==1&&rt("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(tr),this.insertBefore(n,t.node,r,tr));continue}switch(this._flushInsertRun(tr),t.type){case"Remove":this.remove(t.node,tr);break;case"Set":this.setContent(t.node,t.data,tr);break;case"Hidden":this.setHidden(t.node,t.value,tr);break;case"Attribute":this.setAttribute(t.node,t.name,t.value===void 0?null:t.value,tr)}}}finally{try{this._flushInsertRun(tr)}finally{this._applyingMutation=void 0,this._baseDocument.endUpdate()}}}getNodeByPosition(e){return this._root?.findNodeAt(e)}};function SN(e,t){return e.replace(new RegExp(`<(?=/${t.tagName}${Na})`,"gi"),"<")}function wb(e,t){return yg(e)??SN(e.textContent??"",t)}function gn(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return!1;const t=e.tagName.toUpperCase();return t==="STYLE"||t==="SCRIPT"&&!pg.has(e.getAttribute("type")??"")}var wN=4,_N=3,CN=80,_b={Add:"insertBefore",Remove:"remove",Set:"set",Hidden:"hidden",Attribute:"attribute",Update:"update",Move:"move"},TN={[I.HTML]:"text",[I.ELEMENT]:"element",[I.ROOT]:"root",[I.COMMENT]:"comment",[I.DOCTYPE]:"doctype",[I.ADVANCED]:"advanced"},AN=new Set(["head","body"]);function vd(e){return(e??"").replace(/^(['"])(.*)\1$/s,"$2")}function Cb(e,t,n,r){const o=n.split(/\s+/).filter(Boolean).slice(0,_N);return(e+(t?`#${t}`:"")+o.map(i=>`.${i}`).join("")+(r?`[em=${r}]`:"")).slice(0,CN)}function kN(e){if(!e.tag)return`#${e.type}`;const t=e.attributes??{};return Cb(e.tag,vd(t.id),vd(t.class),vd(t.em))}function Tb(e){return e instanceof Element?Cb(e.localName,e.id,e.getAttribute("class")??"",e.getAttribute("em")??""):e.nodeName.toLowerCase()}function Ed(e,t,n){const r=[];let o=e;for(;o&&r.length<wN;)r.unshift(n(o)),o=t(o);return r.join(" > ")}function LN(e){let t,n=e;for(;;){const r=n.tag?.toLowerCase();if(!t&&r&&AN.has(r)?t=r:r==="html"&&(t??(t="html")),!n.parent)break;n=n.parent}return n.type!==I.ROOT?"outside":t??"top"}function Sd(e,t,n){const r=t(e);return{path:Ed(e,o=>o.parent,kN),inTree:n(e),inDom:!!r?.isConnected,...r?{domPath:Ed(r,o=>o.parentNode,Tb)}:{},inMap:!!r,hasParent:!!e.parent,kind:TN[e.type]??String(e.type),root:LN(e)}}function Ab(e,t,n){if(!e)return;const r=i=>Sd(i,t,n);if(e.type==="Update")return{type:_b.Update,node:r(e.prev),...e.next.parent?{parent:r(e.next.parent)}:{}};if(!("node"in e))return;const o={type:_b[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 wd(e){let t=e;for(;t.parent;){if(!t.parent.children.includes(t))return!1;t=t.parent}return t.type===I.ROOT}function NN(e,t,n,r){const o=s=>Sd(s,a=>r.getByNode(a),wd),i=Ed(e,s=>s.parentNode,Tb);return{type:"insertBefore",node:{path:i,inTree:!1,inDom:e.isConnected,domPath:i},parent:o(t),reference:o(n)}}function xN(e,t){const n=r=>Sd(r,o=>t.getByNode(o),wd);return{type:"remove",node:n(e),...e.parent?{parent:n(e.parent)}:{}}}function ON(e){return e.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,n)=>n.toUpperCase())}function kb(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}var Lb=Object.create(null);function Nb(e,t){const n=Lb[e]||(Lb[e]=Object.create(null));let r=n[t];if(typeof r!="boolean"){const o=document.createElement(e)[ON(t)];r=n[t]=typeof o<"u"&&typeof o!="boolean"}return r}function Mn(e){return e.nodeType===Node.ELEMENT_NODE}function xb(e){return Mn(e)?e.tagName==="AMP-IMG"?!0:Nb(e.tagName.toLowerCase(),"src"):!1}function _d(e){return Mn(e)&&!e.ownerSVGElement}function RN(e){return e.tagName==="IMG"}function MN(e){return e.tagName==="FORM"}function PN(e){return e.tagName==="SCRIPT"}function IN(e){return e.tagName==="STYLE"}function Cd(e){return e.nodeType===Node.DOCUMENT_NODE}function Ob(e){return e.nodeType===Node.DOCUMENT_TYPE_NODE}var ns;(function(e){function t(m){return m.constructor.name==="CSSStyleRule"}e.isStyleRule=t;function n(m){return m.constructor.name==="CSSImportRule"}e.isImportRule=n;function r(m){return m.constructor.name==="CSSMediaRule"}e.isMediaRule=r;function o(m){return m.constructor.name==="CSSFontFaceRule"}e.isFontFaceRule=o;function i(m){return m.constructor.name==="CSSPageRule"}e.isPageRule=i;function s(m){return m.constructor.name==="CSSKeyframesRule"}e.isKeyframesRule=s;function a(m){return m.constructor.name==="CSSKeyframeRule"}e.isKeyframeRuleRule=a;function l(m){return m.constructor.name==="CSSNamespaceRule"}e.isNamespaceRule=l;function c(m){return m.constructor.name==="CSSCounterStyleRule"}e.isCounterStyleRule=c;function u(m){return m.constructor.name==="CSSSupportsRule"}e.isSupportsRule=u;function d(m){return m.constructor.name==="CSSFontFeatureValuesRule"}e.isFontFeatureValuesRuleRule=d})(ns||(ns={}));function Td(e){return e.nodeType===Node.COMMENT_NODE}function Io(e){return e.nodeType===Node.TEXT_NODE}function DN(e){return e.tagName==="TABLE"}async function BN(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 tn(e){if(Mn(e))return Rb(e);if(Cd(e))return[...e.childNodes].map(r=>tn(r)).join("");if(Ob(e))return kb(e);const t=Ra(e);if(t!==void 0)return t;const n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),n.innerHTML}function HN(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"&&!Nb(t,o)?` ${o}`:` ${o}="${i.replaceAll('"',"'")}"`}return n}function Tt(e){let t="";for(const n of e.childNodes)t+=yg(n)??tn(n);return t}function Rb(e){const t=Object.getOwnPropertyDescriptor(e,"$$tagName")?.value||e.tagName.toLowerCase(),n=HN(e);return Hu.has(t.toLowerCase())?t==="vk-snippet-end"?`<${t}${n}/>`:`<${t}${n}>`:IN(e)?`<${t}${n}>${e.innerHTML}</${t}>`:`<${t}${n}>${Tt(e)}</${t}>`}function FN(e){return typeof e=="string"?e:""}function Mb(e,t,n){if(n&&e.type===I.DOCTYPE&&n?.type!==I.ROOT){const o=document.createTextNode(e.content||"");return t.set(e,o),o}const r=Ia(e,n)?Gu(e.content||""):Kr(e,!1,"dormant");t.set(e,r);for(const o of e.children){const i=Mb(o,t,e);r.appendChild(i)}return r}function Do(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 $N(e,t,n=wd,r=()=>!1,o=()=>!1){let i,s;const a=new Map,l=()=>{const u=Ab(i,d=>t.getByNode(d)||a.get(d),n);return u&&{...u,stage:"dom",...s?{cause:s}:{}}},c=u=>{s=u;try{rt("Element node not in tree")}finally{s=void 0}};return Jg(l,()=>WN(e,t,a,u=>i=u,c,r,o))}function WN(e,t,n,r,o,i,s){const a=[],l=new Map,c=g=>t.getByNode(g)||n.get(g),u=g=>{if(g){const E=g.lastChild;let w=(E?c(E)?.nextSibling:c(g)?.firstChild)||void 0;for(;w&&l.has(w);)w=w.nextSibling||void 0;return w?.parentNode===c(g)?w:void 0}},d=new Map(e.flatMap(g=>g.type==="Update"?[[g.next,g.prev]]:[])),m=(g,E)=>{for(let w=tb(g);w;w=tb(w)){const T=d.get(w),L=c(w)??(T&&c(T));if(L&&!l.has(L)&&E.contains(L)){const y=Do(L,E,i,s);if(y)return y;let p=L;for(;p.parentNode&&p.parentNode!==E;)p=p.parentNode;return{host:E,before:p}}}},h=g=>!!t.getByElement(g)||i(g)||s(g),f=(g,E,w)=>{const T=m(g,w);if(!T)return{host:w,before:u(E)};let L=T.before.nextSibling??void 0;for(;L&&(l.has(L)||!h(L));)L=L.nextSibling??void 0;return{host:T.host,before:L}};for(const g of e)switch(r(g),g.type){case"Add":{let{node:E,nextSibling:w}=g;const T=E.parent;if(T){const L=Mb(E,n,T);if(T.type===I.ROOT)a.push(ie.add(null,L,w&&c(w)));else{const y=c(T);if(y){let p,v=y;for(;w;){const C=n.get(w);if(C){const S=Do(C,y,i,s);p=S?.before??C,v=S?.host??y;break}let b=t.getByNode(w);if(b&&!l.has(b)&&y.contains(b)){p=b;const S=Do(b,y,i,s);if(S){v=S.host,p=S.before;break}for(;b.parentNode!==y&&b.parentNode;)b=b.parentNode,Mn(b)&&b.replaceWith(...b.childNodes);break}w=wr(w)||void 0}p||({host:v,before:p}=f(E,T,y)),a.push(ie.add(v,L,p))}else o("parent-not-mapped")}}else o("no-parent");break}case"Move":{let{node:E,nextSibling:w}=g;const T=E.parent,L=c(E);if(T&&L)if(T.type===I.ROOT)a.push(ie.move(null,L,w&&c(w)));else{const y=c(T);if(y){let p,v=y;for(;w;){const C=n.get(w);if(C){const S=Do(C,y,i,s);p=S?.before??C,v=S?.host??y;break}let b=t.getByNode(w);if(b&&!l.has(b)&&y.contains(b)){const S=Do(b,y,i,s);if(S)v=S.host,b=S.before;else for(;b.parentNode!==y&&b.parentNode;)b=b.parentNode;b||rt("error while calculating next sibling"),p=b;break}w=wr(w)||void 0}p||({host:v,before:p}=f(E,T,y)),a.push(ie.move(v,L,p))}else o("parent-not-mapped")}else o(T?"node-not-mapped":"no-parent");break}case"Remove":{const E=g.node,w=c(E);if(E.type===I.HTML&&!E.content)continue;w?(l.set(w,E),a.push(ie.remove(w))):o("node-not-mapped");break}case"Update":{const E=g.prev,w=c(E);w?n.set(g.next,w):g.soft||o("node-not-mapped");break}case"Attribute":{const E=c(g.node);E?a.push(ie.attribute(E,g.name,g.value)):o("node-not-mapped");break}case"Set":{const E=g.node,w=c(E);w?E.type===I.HTML&&qN(w,String(g.data??""))||Ob(w)&&E.type===I.DOCTYPE?a.push(ie.set(w,g.data||"")):e.push(ie.remove(E),ie.add(E.parent||null,E,wr(E)||void 0)):o("node-not-mapped");break}}return{mutations:a,toAdd:n,toRemove:l,isService:i}}function qN(e,t){return Io(e)?!t.includes("<")||gn(e.parentNode)||Io(vr(t)):!1}function zN({mutations:e}){return Cg(e.flatMap(t=>t.type==="Add"?[t.node]:[]))}var UN=["src","type"];function jN({mutations:e}){const t=new Set,n=r=>{r instanceof HTMLScriptElement&&r.isConnected&&!Ba(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"&&UN.includes(r.name.toLowerCase())&&n(r.node);return[...t]}function VN(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,m=d&&n.get(e)===i.anchorOffset;e.replaceData(a,c,u),u&&i?.anchorNode!==e&&n.set(e,a),d&&i.collapse(e,m?a:a+u.length)}function Pb(e){const t=e.ownerDocument?.getSelection();return t?.anchorNode&&e.contains(t.anchorNode)?t:null}function GN(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 XN(e,t,n){const r=Pb(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 KN(e){return!!e&&e.prev!==e.next&&e.prev.at(-1)!==e.next.at(-1)}function YN(e){return!!e&&e.next.length>e.prev.length&&e.next.endsWith(e.prev)}function Ad(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=GN(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&&KN(r?.get(s))))break;return a&&i.contains(a)?{beside:a}:{text:s}}return o?{beside:o}:null}function Ib(e,t,n){const r=t.parentNode;r&&e.collapse(r,[...r.childNodes].indexOf(t)+(n?1:0))}function ZN(e,t,{removed:n,rewrites:r}){const o=Pb(e),i=o&&Ad(e,!0,n,r),s=o&&!i?Ad(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 Ib(o,i.beside,!0),i.beside.nodeName==="BR"?i.beside:void 0;s?.text?o.collapse(s.text,0):s&&Ib(o,s.beside,!1)}}catch{}}function QN(e){const t=e.ownerDocument?.getSelection(),{anchorNode:n,anchorOffset:r}=t??{};return!!t?.isCollapsed&&n===e.parentNode&&n?.childNodes[(r??0)-1]===e}function Db(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)||YN(i.get(a)))&&(!n.has(a)||Ad(a,!0,n,i)?.text)?{node:a,offset:0}:{node:e,offset:t}}function JN(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=Db(r,o??0,t),l=Db(i,s??0,t);(a.node!==r||l.node!==i)&&n.setBaseAndExtent(a.node,a.offset,l.node,l.offset)}catch{}}function Bb(e,t,n){if(t?.parentNode===e)return[e,t];const r=t&&n?Do(t,e,n):void 0;return r&&e.contains(r.host)?[r.host,r.before]:[e,null]}function e2(e){const t=new Map;for(const n of e)n.type==="Set"&&n.node instanceof Text&&!gn(n.node.parentNode)&&t.set(n.node,{prev:n.node.data,next:vr(String(n.data??"")).textContent??""});return t}function t2({mutations:e,toAdd:t,toRemove:n,isService:r},o,i){const s=m=>new Set(e.flatMap(h=>h.type===m?[h.node]:[])),a=s("Remove"),l={removed:a,moved:s("Move"),edited:s("Set"),rewrites:e2(e)};JN([...a].find(m=>m.ownerDocument)?.ownerDocument,l);const c=(m,h,f)=>{if(!m)return rt("Element node not in tree");if(!(m instanceof Element))return rt("node is not HTMLEement");const g=f===void 0?void 0:Eg(m,h,FN(f));if(!(h.toLowerCase()==="type"&&vk(m,g??null)))try{g!=null?Qn(m,h,g):m.removeAttribute(h)}catch{}},u=new Map;let d;for(const m of e)switch(m.type){case"Add":{const{node:h,nextSibling:f,parent:g}=m;if(g){const[E,w]=Bb(g,f,r);E.insertBefore(h,w)}break}case"Move":{const{node:h,nextSibling:f,parent:g}=m;if(g){const[E,w]=Bb(g,f,r);XN(E,h,w)}break}case"Remove":{const{node:h}=m;if(h instanceof Document)for(const f of[...h.childNodes])f.parentNode?.removeChild(f);else d=ZN(h,u,l)??d;break}case"Attribute":c(m.node,m.name,m.value);break;case"Set":{const{node:h,data:f}=m;if(h instanceof Comment)h.data=f;else if(h instanceof Text){const g=String(f??"");gn(h.parentNode)?ak(h,g):VN(h,vr(g).textContent??"",u)}break}}for(const[m,h]of n)o.remove(h);for(const[m,h]of t){const f=o.getByElement(h);f&&o.remove(f),o.set(m,h)}if(i&&d?.isConnected&&QN(d))try{i(d)}catch{}}var n2=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))}},r2=class{constructor(){A(this,"_map",new n2)}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 Hb(e,t){for(let n=e;n;n=n.parent)if(n===t)return!0;return!1}function o2(e){let t;for(let n=e;n;n=n.parent)yd(n)&&(t=n);return t}function i2(e){return e.type==="Update"?e.prev:e.node}function s2(e,t){const n=new Map;for(const o of e){if(o.type!=="Update"||!o.soft)continue;const i=o2(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=i2(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(Hb(i,l)||Hb(i,c)||s&&u?.contains(s)){a=!0,o.type==="Update"&&o.next===l&&l.parent&&r.push(...ie.recreate(c,l.parent,l,wr(l)||void 0));break}}a||r.push(o)}return r}var kd;(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})(kd||(kd={}));var tl=new Set;function _r(e,t){tl.has(e)||(tl.size||Promise.resolve().then(()=>tl.clear()),tl.add(e),G.send(Ae.APPLICATION_SYNC_DRIFT,{reason:e,...t()}))}var Fb=new WeakMap;function a2(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 l2(e){return{added:e,removed:[],reparented:[],reordered:[]}}function c2(e,t){let n=Fb.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=a2(o),n={added:o,removed:i},Fb.set(e,n)}return n}function $b(e,t){const n={};for(const[r,o]of Object.entries(t))n[r]={value:o,enumerable:!0};return Object.create(e,n)}function Wb(e){return new Set((e??"").split(/\s+/).filter(Boolean))}function u2(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))),$b(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:d2(i,t,r)})}),service:o}}function d2(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"&&f2(e,a,t)));s.length&&(r[o]=s)}return r}function f2(e,t,n){const r=Wb(e.getOldAttribute(t,"class")),o=Wb(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 qb=Object.getPrototypeOf(customElements),m2=Reflect.get(qb,"define"),Ld=new he,Nd=new he,h2=Ld.event,p2=Nd.event,g2=["connectedCallback","disconnectedCallback","adoptedCallback","attributeChangedCallback","connectedMoveCallback","formAssociatedCallback","formResetCallback","formDisabledCallback","formStateRestoreCallback"];function b2(e){Ld.fire();try{return e()}finally{Nd.fire()}}qb.define=function(e,t,n){const r=t.prototype,o=class extends t{constructor(...i){Ld.fire();try{super(...i)}finally{Nd.fire()}}};Object.defineProperty(o,"name",{configurable:!0,value:t.name});for(const i of g2){const s=r[i];typeof s=="function"&&Object.defineProperty(o.prototype,i,{configurable:!0,writable:!0,value:function(...a){return b2(()=>s.call(this,...a))}})}m2.call(this,e,o,n)};function zb(e,t,n,r){const o=[...e.childNodes],i=t(e,r);for(const s of o)n(i,zb(s,t,n,i));return i}function Bo(e,t,n){if(t(e,n)!==!1)for(const r of[...e.childNodes])Bo(r,t,e)}var rr="___em-internal";function xd(e,t=!0,n=!1){let r=e.content;switch(e.type){case I.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(xd(i,t,n));return o}case I.DOCTYPE:return new DOMParser().parseFromString(`<!DOCTYPE${e.content}>`,"text/html").doctype;case I.COMMENT:return document.createComment(r||"");case I.ELEMENT:if(e.tag){if(n&&customElements.get(e.tag)){const i=document.createElement("div");return i.innerHTML=Fu(e),i.firstChild}const o=document.createElement(e.tag);if(e.attributes)for(const i of e.attributeNames){const s=e.attributes[i];try{Qn(o,i,typeof s=="string"?s:"")}catch{}}if(t)for(const i of e.children)o.appendChild(Ia(i,e)?Gu(i.content||""):xd(i,t,n));return o}return document.createTextNode("<");case I.HTML:return vr(r||"");default:throw new Error("unsupported node")}}function y2(e){return fn(e).roots.map(t=>xd(t,!0,!0))}function Ub(){const e=document.implementation.createHTMLDocument();for(const t of[...e.childNodes])t.remove();return e}function v2(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 Ub();default:t=document.createElement("div")}return t}function E2(e){return"<!DOCTYPE "+e.name+(e.publicId?' PUBLIC "'+e.publicId+'"':"")+(!e.publicId&&e.systemId?" SYSTEM":"")+(e.systemId?' "'+e.systemId+'"':"")+">"}function nl(e){if(e instanceof Element)return Rb(e);if(e instanceof Document)return[...e.childNodes].map(r=>nl(r)).join("");if(e instanceof DocumentType)return E2(e);if(e instanceof DocumentFragment)return[...e.childNodes].map(r=>nl(r)).join("");const t=Ra(e);if(t!==void 0)return t;const n=document.createElement("div");return n.appendChild(e.cloneNode(!0)),n.innerHTML}function jb(e,t=e.parentNode){return gn(t)?wb(e,t):nl(e)}function S2(e,t,n){let r=1;const o=new cb,i=new Map,s=new Map,a=new Map;let l=!1;const c=zb(e,h=>{const f=String(r++);let g;if(xb(h)||h instanceof Element&&h.hasAttribute("src")){const E=document.createElement(h.tagName);for(const{name:w,value:T}of h.attributes){const L=Sg(h,w,T);L!==null&&Qn(E,w==="src"?"___src":w,L)}g=E}else g=h.cloneNode(),O2(h,g);if(g)g instanceof DocumentType&&(l=!0),a.set(g,f),i.set(h,f);else return document.createDocumentFragment();return g},(h,f)=>h&&f&&h.appendChild(f));let u=l?Ub():document.createDocumentFragment();u.appendChild(c),Bo(u,(h,f)=>{if(f){const g=a.get(h);if(gn(f))return;if(!g)return rt("Error while mapping: not found element");h instanceof Element?h.setAttribute(rr,g):f.insertBefore(document.createComment(`${rr}${g}`),h)}});let d=y2(t(u)).filter(h=>!!h),m;if(!d.length)return o;if(u instanceof Document){const h=v2("html");for(const f of d)h.appendChild(f);m=h}else{m=document.createDocumentFragment();for(const h of d)m.appendChild(h)}return Bo(m,(h,f)=>{let g=null;if(h instanceof HTMLHtmlElement)s.set("1",h);else{if(h instanceof Element&&h.hasAttribute(rr)){g=h.getAttribute(rr),g&&s.set(g,h);return}const E=h.previousSibling;if(E instanceof Comment&&(!(h instanceof Comment)||h.data.indexOf(rr)<0)){const w=E.data,T=w.indexOf(rr);T>=0&&(g=w.substring(T+14),g&&s.set(g,h))}}}),Bo(m,h=>{if(h instanceof Element&&h.hasAttribute(rr)){h.removeAttribute(rr);return}h instanceof Comment&&h.data.indexOf(rr)>=0&&h.remove()}),Bo(e,h=>{const f=i.get(h),g=s.get(f);g&&(o.set(h,g),gn(h)&&h.firstChild&&g.firstChild&&o.set(h.firstChild,g.firstChild))}),o}function w2(e){const t=Vb(e.cloneNode()),n=Wu(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=I.ELEMENT,t}var Ho;(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})({})})(Ho||(Ho={}));function Vb(e){if(Io(e)&&gn(e.parentNode))return Gb(wb(e,e.parentNode));const t=Ra(e);if(t!==void 0)return Gb(t);let n=fn(nl(e.cloneNode())).roots[0];return n||(n=new wt(0,0,[]),n.type=I.HTML,n.content=""),n}function Gb(e){const t=new wt(0,e.length,[]);return t.type=I.HTML,t.content=e,t}function Xb(e,t=Ho.HiddenResult.node){if(t&Ho.HiddenResult.node&&(e.end=e.start=e.startTagEnd=e.endTagStart=e.end=0),t&Ho.HiddenResult.children)for(const n of e.children)Xb(n,Ho.HiddenResult.all)}function _2(e,t=[],n){let r;return e instanceof Element?r=w2(e):r=Vb(e),r.children=t,r.parent=void 0,n&&Xb(r,n(r)),r}function Od(e,t,n){let r=t.getByElement(e);if(r)return n?.(e)?void 0:r;for(const o of e.childNodes)if(r=Od(o,t,n),r)return r}function Kb(e,t,n,r){_r("tree-node-out-of-place",()=>({mutation:n()}))}function Yb(e,t,n,r,o){let i=e.parentNode,s=e.nextSibling,a;const l=(c,u)=>!o||o(c,u)?!0:(Kb("insertBefore",c,()=>NN(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=Od(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=Od(s,t,r);if(u){a=u,s=s.nextSibling;break}s=s.nextSibling}s||(s=i.nextSibling),i=i.parentNode}}function C2(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(ie.attribute(a,o,typeof l=="string"?l:void 0))}}}return n}function Zb(e,t){return e.type===I.HTML?Ra(t)??`<!--${t.data}-->`:t.data}function T2(e,t){const n=[],r=e.characterDataChanged;if(r)for(const o of r){const i=t.getByElement(o);i&&n.push(ie.set(i,Td(o)?Zb(i,o):jb(o)))}return n}function A2(e){return(e instanceof Element?e:e.parentElement)?.closest(".sortable-fallback")??null}function k2(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 L2(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 F2(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}=Yb(s,t,n)||{};u===a.parent&&d===l[c+1]&&i.add(s)}return i}function N2(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}=c2(l,d=>!!t.getByElement(d));for(const d of u)if(!i.has(d)&&!r.has(d)){const m=t.getByElement(d);if(m){const h=s.get(m)??m.parent;!h||!a(m,h)?Kb("remove",m,()=>xN(m,t)):o.push(ie.remove(m)),s.delete(m),i.add(d)}}for(const d of c){if(r.has(d)||k2(d))continue;const m=A2(d);if(m&&!t.getByElement(m))continue;const{parentTreeNode:h,nextSiblingTreeNode:f}=Yb(d,t,n,g=>i.has(g),a)||{};if(h){let g=t.getByElement(d);g||(g=_2(d),t.set(g,d)),o.push(ie.add(h,g,f)),s.set(g,h),i.delete(d)}}o.push(...C2(l,t)),o.push(...T2(l,t))}return o}function x2(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(ie.attribute(e,a,c))}else r.push(ie.attribute(e,a,void 0))}for(const s of i){const a=s.name==="___src"?"src":s.name;o.getNamedItem(a)||r.push(ie.attribute(e,a,s.value))}return r}function O2(e,t){if(!(!ck()||!(e instanceof Element)||!(t instanceof Element)))for(const{name:n,value:r}of Array.from(e.attributes)){const o=Sg(e,n,r);o===null?t.removeAttribute(n):o!==r&&Qn(t,n,o)}}function R2(e,t,n,r=()=>!1){const o=[],i=S2(e,n,t);return Bo(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 rt("CharacterData mapped to Element");o.push(...x2(a,s,l))}else if(l instanceof CharacterData){if(!(s instanceof CharacterData))return rt("Element mapped to CharacterData");const c=gn(s.parentNode)&&(s.parentNode?.nodeName==="SCRIPT"||!r(s));l.data!==s.data&&!c&&o.push(ie.set(a,Td(l)?Zb(a,l):jb(l,s.parentNode)))}else if(l instanceof Document&&!(s instanceof Document))return rt("Node mapped to Document")}else{const c=d=>{for(const m of d.childNodes)if(i.getByKey(m)||!c(m))return!1;return!0};let u;return c(s)?(o.push(ie.hidden(a,!0)),u=!1):o.push(ie.hidden(a,!1)),u}}),o}function M2(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 P2(e){return[...new Set(e)]}function I2(e,t){return P2([...e.added,...e.reparented||[],...e.reordered||[],...Object.values(e.characterDataChanged||{}),...Object.values(e.attributeChanged||{})].flat().map(n=>M2(n,t)||n))}function D2(e,t){let n=[];for(const r of e){const o=I2(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 B2(e,t,n){const r=D2(e,t),o=H2(e);return r.flatMap(i=>R2(i,t,n,o))}function H2(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 F2(e){return e.flatMap(t=>[...t.reparented??[],...t.reordered??[]])}function $2(e,t){return $b(e,{reparented:e.reparented?.filter(n=>!t.has(n)),reordered:e.reordered?.filter(n=>!t.has(n))})}function W2(e,t,n,r,o=()=>!1){const i=L2(e,t,r,o),s=i.size?e.map(a=>$2(a,i)):e;return[...N2(e,t,r,i),...B2(s,t,n)]}function q2(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 z2=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))}},Qb=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}},Jb=new Qb(1e3);function Fo(e){if(e=e?.trim(),e){let t=Jb.get(e);return t||(t=new Set(e.split(" ").filter(n=>!!n).map(n=>n)),Jb.put(e,t)),t}else return new Set}function rl(e){e||(e="");const t=document.createElement("div");return t.setAttribute("style",e),t.style}var ey=new Qb(1e3);function rs(e){e||(e="");let t=ey.get(e);return t||(t=rl(e),ey.put(e,t)),t}function U2(e,t,n){const r=e?e.split(" "):[],o=Fo(n),i=Fo(t),s=r.filter(a=>(a=a.trim(),o.has(a)?i.has(a):!0));return s.length===r.length?e:s.join(" ")}function j2(e,t,n){const r=rl(e),o=rs(n),i=rs(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 ty(e,t,n,r){return typeof r!="string"?t:e==="class"?U2(t,n,r)||null:e==="style"?j2(t,n,r)||null:n!==t&&t===r?null:t}function V2(e,t){const n=Fo(e),r=Fo(t);for(const o of r)n.has(o)||(e=e?`${e.trimEnd()} ${o}`:o);return e}function G2(e,t){const n=rl(e),r=rs(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 X2(e,t,n){return typeof n!="string"?t:e==="class"?V2(t,n)||null:e==="style"?G2(t,n)||null:t}function K2(e,t,n){if(!t)return t;const r=Fo(e),o=Fo(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 Y2(e,t,n){if(!t)return t;const r=rs(e),o=rl(t),i=rs(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 ny(e){return e.type===I.ELEMENT&&e.start!==e.end}function ry(e){return e.filter(t=>t.type===I.ELEMENT)}function Z2(e,t,n){const r=ry(e),o=ry(t),i=[],s=new Set,a=new Set,l=u=>{const d=(h,f)=>{const g=new Map;for(const E of h){const w=f.has(E)?void 0:u(E);w!==void 0&&g.set(w,g.has(w)?null:E)}return g},m=d(r,s);for(const[h,f]of d(o,a)){const g=m.get(h);f&&g&&(i.push([g,f,!0]),s.add(g),a.add(f))}};l(u=>typeof u.attributes?.id=="string"?`${u.tag}#${u.attributes.id}`:void 0),l(u=>Zn(u,!1,n)),l(u=>Zn(u,!0,n));const c=new Set(o.map(u=>u.tag));for(const u of c){const d=f=>f.filter(g=>g.tag===u),m=d(r).filter(f=>!s.has(f)),h=d(o).filter(f=>!a.has(f));if(m.length===h.length&&d(r).length===d(o).length){const f=m.length===1&&!m[0].attributes?.id&&!h[0].attributes?.id;h.forEach((g,E)=>i.push([m[E],g,f]))}}return i}var Q2=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}},J2=class{constructor(e){A(this,"_nodeMap",void 0),A(this,"_map",new z2),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=K2(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=Y2(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 Q2(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=ty(r,i,o.attributes?.[r]||null,this._map.getAttribute(o,r));if(s!==i){t.push(ie.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=ty(i,s,null,a);l!==s&&t.push(ie.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=X2(r,i,this._map.getAttribute(o,r));if(s!==i){t.push(ie.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,$u());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&&!ud(t.tag)&&o){const i=[];for(const[s,a]of Object.entries(o))tN(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&&Zn(e,!1,r)===Zn(t,!1,r)){const i=t.children.filter(ny);e.children.filter(ny).forEach((s,a)=>{i[a]&&this._carryHidden(s,i[a],!0,r)});return}for(const[i,s,a]of Z2(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)}}}},ex=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)}},oy="foreign-structure-in-commit";function tx(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 ol(e){if(!(e instanceof Element))return{tag:e.nodeName.toLowerCase()};const t=e.getAttribute("class");return{tag:e.tagName.toLowerCase(),...t?{class:t}:{}}}var iy="implicit-tbody-in-canvas";function nx(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 rx(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:ol(n),parent:n.parentNode?ol(n.parentNode):void 0};t.add(iy),_r(iy,()=>({foreign:r}))}function ox(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:ol(n.node),parent:n.node.parentNode?ol(n.node.parentNode):void 0};t.has("foreign-structure-in-commit")||(t.add(oy),_r(oy,()=>({foreign:o})))}var Rd="unaccounted-node";function sy(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 ay(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 sy(e,t,n,r||t.roots.has(e))}function ly(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=sy(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 ix(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 sx(e,t){const n=new Set;for(const r of e)r.isConnected&&ay(r,t)==="unaccounted"&&n.add(r);return[...n].filter(r=>!r.parentNode||!n.has(r.parentNode))}function ax(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 cy(e){const t=[];for(let o=e;o&&o.nodeType!==Node.DOCUMENT_NODE;o=o.parentNode)t.unshift(ax(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 uy(e,t){if(!e.length)return;const n={count:e.length,node:cy(e[0])};t.has(Rd)||(t.add(Rd),_r(Rd,()=>({unaccounted:n})))}var lx=yr(((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 y(){this._nodes=[],this._values=[]}return y._isIndex=function(p){return+p===p>>>0},y._nodeId=function(p){var v=p[y._ID_PROP];return v||(v=p[y._ID_PROP]=y._NEXT_ID++),v},y.prototype.set=function(p,v){var C=y._nodeId(p);this._nodes[C]=p,this._values[C]=v},y.prototype.get=function(p){var v=y._nodeId(p);return v!==void 0?this._values[v]:void 0},y.prototype.has=function(p){return y._nodeId(p)in this._nodes},y.prototype.delete=function(p){var v=y._nodeId(p);delete this._nodes[v],this._values[v]=void 0},y.prototype.keys=function(){var p=[];for(var v in this._nodes)y._isIndex(v)&&p.push(this._nodes[v]);return p},y._ID_PROP="__mutation_summary_node_map_id__",y._NEXT_ID=1,y})(),o=(function(){function y(){this.added=new r,this.removed=new r,this.maybeMoved=new r,this.oldPrevious=new r,this.moved=void 0}return y})();n.Movement=void 0,(function(y){y[y.STAYED_OUT=0]="STAYED_OUT",y[y.ENTERED=1]="ENTERED",y[y.STAYED_IN=2]="STAYED_IN",y[y.REPARENTED=3]="REPARENTED",y[y.REORDERED=4]="REORDERED",y[y.EXITED=5]="EXITED"})(n.Movement||(n.Movement={}));var i=function(y,p){return i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(v,C){v.__proto__=C}||function(v,C){for(var b in C)Object.prototype.hasOwnProperty.call(C,b)&&(v[b]=C[b])},i(y,p)};function s(y,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");i(y,p);function v(){this.constructor=y}y.prototype=p===null?Object.create(p):(v.prototype=p.prototype,new v)}var a=(function(){function y(p,v,C,b,S,_,k,x){v===void 0&&(v=!1),C===void 0&&(C=!1),b===void 0&&(b=!1),S===void 0&&(S=null),_===void 0&&(_=!1),k===void 0&&(k=null),x===void 0&&(x=null),this.node=p,this.childList=v,this.attributes=C,this.characterData=b,this.oldParentNode=S,this.added=_,this.attributeOldValues=k,this.characterDataOldValue=x,this.isCaseInsensitive=this.node.nodeType===Node.ELEMENT_NODE&&this.node instanceof HTMLElement&&this.node.ownerDocument instanceof HTMLDocument}return y.prototype.getAttributeOldValue=function(p){if(this.attributeOldValues)return this.isCaseInsensitive&&(p=p.toLowerCase()),this.attributeOldValues[p]},y.prototype.getAttributeNamesMutated=function(){var p=[];if(!this.attributeOldValues)return p;for(var v in this.attributeOldValues)this.attributeOldValues.hasOwnProperty(v)&&p.push(v);return p},y.prototype.attributeMutated=function(p,v){this.attributes=!0,this.attributeOldValues=this.attributeOldValues||{},!(p in this.attributeOldValues)&&(this.attributeOldValues[p]=v)},y.prototype.characterDataMutated=function(p){this.characterData||(this.characterData=!0,this.characterDataOldValue=p)},y.prototype.removedFromParent=function(p){this.childList=!0,this.added||this.oldParentNode?this.added=!1:this.oldParentNode=p},y.prototype.insertedIntoParent=function(){this.childList=!0,this.added=!0},y.prototype.getOldParent=function(){if(this.childList){if(this.oldParentNode)return this.oldParentNode;if(this.added)return null}return this.node.parentNode},y})(),l=(function(y){s(p,y);function p(v,C){var b=y.call(this)||this;b.rootNode=v,b.reachableCache=void 0,b.wasReachableCache=void 0,b.anyParentsChanged=!1,b.anyAttributesChanged=!1,b.anyCharacterDataChanged=!1;for(var S=0;S<C.length;S++){var _=C[S];switch(_.type){case"childList":b.anyParentsChanged=!0;for(var k=0;k<_.removedNodes.length;k++){var x=_.removedNodes[k];b.getChange(x).removedFromParent(_.target)}for(var k=0;k<_.addedNodes.length;k++){var x=_.addedNodes[k];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 p.prototype.getChange=function(v){var C=this.get(v);return C||(C=new a(v),this.set(v,C)),C},p.prototype.getOldParent=function(v){var C=this.get(v);return C?C.getOldParent():v.parentNode},p.prototype.getIsReachable=function(v){if(v===this.rootNode)return!0;if(!v)return!1;this.reachableCache=this.reachableCache||new r;var C=this.reachableCache.get(v);return C===void 0&&(C=this.getIsReachable(v.parentNode),this.reachableCache.set(v,C)),C},p.prototype.getWasReachable=function(v){if(v===this.rootNode)return!0;if(!v)return!1;this.wasReachableCache=this.wasReachableCache||new r;var C=this.wasReachableCache.get(v);return C===void 0&&(C=this.getWasReachable(this.getOldParent(v)),this.wasReachableCache.set(v,C)),C},p.prototype.reachabilityChange=function(v){return this.getIsReachable(v)?this.getWasReachable(v)?n.Movement.STAYED_IN:n.Movement.ENTERED:this.getWasReachable(v)?n.Movement.EXITED:n.Movement.STAYED_OUT},p})(r),c=(function(){function y(p,v,C,b,S){this.rootNode=p,this.mutations=v,this.selectors=C,this.calcReordered=b,this.calcOldPreviousSibling=S,this.treeChanges=new l(p,v),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 y.prototype.processMutations=function(){if(!(!this.treeChanges.anyParentsChanged&&!this.treeChanges.anyAttributesChanged))for(var p=this.treeChanges.keys(),v=0;v<p.length;v++)this.visitNode(p[v],void 0)},y.prototype.visitNode=function(p,v){if(!this.visited.has(p)){this.visited.set(p,!0);var C=this.treeChanges.get(p),b=v;if((C&&C.childList||b==null)&&(b=this.treeChanges.reachabilityChange(p)),b!==n.Movement.STAYED_OUT){if(this.matchabilityChange(p),b===n.Movement.ENTERED)this.entered.push(p);else if(b===n.Movement.EXITED)this.exited.push(p),this.ensureHasOldPreviousSiblingIfNeeded(p);else if(b===n.Movement.STAYED_IN){var S=n.Movement.STAYED_IN;C&&C.childList&&(C.oldParentNode!==p.parentNode?(S=n.Movement.REPARENTED,this.ensureHasOldPreviousSiblingIfNeeded(p)):this.calcReordered&&this.wasReordered(p)&&(S=n.Movement.REORDERED)),this.stayedIn.set(p,S)}if(b!==n.Movement.STAYED_IN)for(var _=p.firstChild;_;_=_.nextSibling)this.visitNode(_,b)}}},y.prototype.ensureHasOldPreviousSiblingIfNeeded=function(p){if(this.calcOldPreviousSibling){this.processChildlistChanges();var v=p.parentNode,C=this.treeChanges.get(p);C&&C.oldParentNode&&(v=C.oldParentNode);var b=this.childListChangeMap.get(v);b||(b=new o,this.childListChangeMap.set(v,b)),b.oldPrevious.has(p)||b.oldPrevious.set(p,p.previousSibling)}},y.prototype.getChanged=function(p,v,C){this.selectors=v,this.characterDataOnly=C;for(var b=0;b<this.entered.length;b++){var S=this.entered[b],_=this.matchabilityChange(S);(_===n.Movement.ENTERED||_===n.Movement.STAYED_IN)&&p.added.push(S)}for(var k=this.stayedIn.keys(),b=0;b<k.length;b++){var S=k[b],_=this.matchabilityChange(S);if(_===n.Movement.ENTERED)p.added.push(S);else if(_===n.Movement.EXITED)p.removed.push(S);else if(_===n.Movement.STAYED_IN&&(p.reparented||p.reordered)){var x=this.stayedIn.get(S);p.reparented&&x===n.Movement.REPARENTED?p.reparented.push(S):p.reordered&&x===n.Movement.REORDERED&&p.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)&&p.removed.push(S)}},y.prototype.getOldParentNode=function(p){var v=this.treeChanges.get(p);if(v&&v.childList)return v.oldParentNode?v.oldParentNode:null;var C=this.treeChanges.reachabilityChange(p);if(C===n.Movement.STAYED_OUT||C===n.Movement.ENTERED)throw Error("getOldParentNode requested on invalid node.");return p.parentNode},y.prototype.getOldPreviousSibling=function(p){var v=p.parentNode,C=this.treeChanges.get(p);C&&C.oldParentNode&&(v=C.oldParentNode);var b=this.childListChangeMap.get(v);if(!b)throw Error("getOldPreviousSibling requested on invalid node.");return b.oldPrevious.get(p)},y.prototype.getOldAttribute=function(p,v){var C=this.treeChanges.get(p);if(!C||!C.attributes)throw Error("getOldAttribute requested on invalid node.");var b=C.getAttributeOldValue(v);if(b===void 0)throw Error("getOldAttribute requested for unchanged attribute name.");return b},y.prototype.attributeChangedNodes=function(p){if(!this.treeChanges.anyAttributesChanged)return{};var v,C;if(p){v={},C={};for(var b=0;b<p.length;b++){var S=p[b];v[S]=!0,C[S.toLowerCase()]=S}}for(var _={},k=this.treeChanges.keys(),b=0;b<k.length;b++){var x=k[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 W=x,O=N.getAttributeNamesMutated(),P=0;P<O.length;P++){var S=O[P];v&&!v[S]&&!(N.isCaseInsensitive&&C[S])||N.getAttributeOldValue(S)!==W.getAttribute(S)&&(C&&N.isCaseInsensitive&&(S=C[S]),_[S]=_[S]||[],_[S].push(W))}}return _},y.prototype.getOldCharacterData=function(p){var v=this.treeChanges.get(p);if(!v||!v.characterData)throw Error("getOldCharacterData requested on invalid node.");return v.characterDataOldValue},y.prototype.getCharacterDataChanged=function(){if(!this.treeChanges.anyCharacterDataChanged)return[];for(var p=this.treeChanges.keys(),v=[],C=0;C<p.length;C++){var b=p[C];if(n.Movement.STAYED_IN===this.treeChanges.reachabilityChange(b)){var S=this.treeChanges.get(b);!S.characterData||b.textContent==S.characterDataOldValue||v.push(b)}}return v},y.prototype.computeMatchabilityChange=function(p,v){this.matchCache||(this.matchCache=[]),this.matchCache[p.uid]||(this.matchCache[p.uid]=new r);var C=this.matchCache[p.uid],b=C.get(v);return b===void 0&&(b=p.matchabilityChange(v,this.treeChanges.get(v)),C.set(v,b)),b},y.prototype.matchabilityChange=function(p){var v=this;if(this.characterDataOnly)switch(p.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(p.nodeType!==Node.ELEMENT_NODE)return n.Movement.STAYED_OUT;for(var C=p,b=this.selectors.map(function(k){return v.computeMatchabilityChange(k,C)}),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},y.prototype.getChildlistChange=function(p){var v=this.childListChangeMap.get(p);return v||(v=new o,this.childListChangeMap.set(p,v)),v},y.prototype.processChildlistChanges=function(){if(!this.childListChangeMap){this.childListChangeMap=new r;for(var p=function(b){var S=v.mutations[b];if(S.type!="childList"||v.treeChanges.reachabilityChange(S.target)!==n.Movement.STAYED_IN&&!v.calcOldPreviousSibling)return"continue";for(var _=v.getChildlistChange(S.target),k=S.previousSibling,x=function(O,P){!O||_.oldPrevious.has(O)||_.added.has(O)||_.maybeMoved.has(O)||P&&(_.added.has(P)||_.maybeMoved.has(P))||_.oldPrevious.set(O,P)},N=0;N<S.removedNodes.length;N++){var W=S.removedNodes[N];x(W,k),_.added.has(W)?_.added.delete(W):(_.removed.set(W,!0),_.maybeMoved.delete(W)),k=W}x(S.nextSibling,k);for(var N=0;N<S.addedNodes.length;N++){var W=S.addedNodes[N];_.removed.has(W)?(_.removed.delete(W),_.maybeMoved.set(W,!0)):_.added.set(W,!0)}},v=this,C=0;C<this.mutations.length;C++)p(C)}},y.prototype.wasReordered=function(p){if(!this.treeChanges.anyParentsChanged)return!1;this.processChildlistChanges();var v=p.parentNode,C=this.treeChanges.get(p);C&&C.oldParentNode&&(v=C.oldParentNode);var b=this.childListChangeMap.get(v);if(!b)return!1;if(b.moved)return b.moved.get(p);b.moved=new r;var S=new r;function _(O){if(!O||!b.maybeMoved.has(O))return!1;var P=b.moved.get(O);return P!==void 0||(S.has(O)?P=!0:(S.set(O,!0),P=W(O)!==x(O)),S.has(O)?(S.delete(O),b.moved.set(O,P)):P=b.moved.get(O)),P}var k=new r;function x(O){var P=k.get(O);if(P!==void 0)return P;for(P=b.oldPrevious.get(O);P&&(b.removed.has(P)||_(P));)P=x(P);return P===void 0&&(P=O.previousSibling),k.set(O,P),P}var N=new r;function W(O){if(N.has(O))return N.get(O);for(var P=O.previousSibling;P&&(b.added.has(P)||_(P));)P=P.previousSibling;return N.set(O,P),P}return b.maybeMoved.keys().forEach(_),b.moved.get(p)},y})(),u=(function(){function y(p,v){var C=this;if(this.projection=p,this.added=[],this.removed=[],this.reparented=v.all||v.element||v.characterData?[]:void 0,this.reordered=v.all?[]:void 0,p.getChanged(this,v.elementFilter,v.characterData),v.all||v.attribute||v.attributeList){var b=v.attribute?[v.attribute]:v.attributeList,S=p.attributeChangedNodes(b);v.attribute?this.valueChanged=S[v.attribute]||[]:(this.attributeChanged=S,v.attributeList&&v.attributeList.forEach(function(k){C.attributeChanged.hasOwnProperty(k)||(C.attributeChanged[k]=[])}))}if(v.all||v.characterData){var _=p.getCharacterDataChanged();v.characterData?this.valueChanged=_:this.characterDataChanged=_}this.reordered&&(this.getOldPreviousSibling=p.getOldPreviousSibling.bind(p))}return y.prototype.getOldParentNode=function(p){return this.projection.getOldParentNode(p)},y.prototype.getOldAttribute=function(p,v){return this.projection.getOldAttribute(p,v)},y.prototype.getOldCharacterData=function(p){return this.projection.getOldCharacterData(p)},y.prototype.getOldPreviousSibling=function(p){return this.projection.getOldPreviousSibling(p)},y})(),d=(function(){function y(){}return y.prototype.matches=function(p){if(p===null)return!1;if(this.attrValue===void 0)return!0;if(!this.contains)return this.attrValue==p;for(var v=p.split(" "),C=0;C<v.length;C++)if(this.attrValue===v[C])return!0;return!1},y.prototype.toString=function(){return this.attrName==="class"&&this.contains?"."+this.attrValue:this.attrName==="id"&&!this.contains?"#"+this.attrValue:this.contains?"["+this.attrName+"~="+m(this.attrValue)+"]":"attrValue"in this?"["+this.attrName+"="+m(this.attrValue)+"]":"["+this.attrName+"]"},y})();function m(y){return'"'+y.replace(/"/,'\\"')+'"'}var h=/[a-zA-Z_]+/,f=/[a-zA-Z0-9_\-]+/,g=(function(){function y(){this.uid=y.nextUid++,this.qualifiers=[]}return Object.defineProperty(y.prototype,"caseInsensitiveTagName",{get:function(){return this.tagName.toUpperCase()},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"selectorString",{get:function(){return this.tagName+this.qualifiers.join("")},enumerable:!1,configurable:!0}),y.prototype.isMatching=function(p){return p[y.matchesSelector](this.selectorString)},y.prototype.wasMatching=function(p,v,C){if(!v||!v.attributes)return C;var b=v.isCaseInsensitive?this.caseInsensitiveTagName:this.tagName;if(b!=="*"&&b!==p.tagName)return!1;for(var S=[],_=!1,k=0;k<this.qualifiers.length;k++){var x=this.qualifiers[k],N=v.getAttributeOldValue(x.attrName);S.push(N),_=_||N!==void 0}if(!_)return C;for(var k=0;k<this.qualifiers.length;k++){var x=this.qualifiers[k],N=S[k];if(N===void 0&&(N=p.getAttribute(x.attrName)),!x.matches(N))return!1}return!0},y.prototype.matchabilityChange=function(p,v){var C=this.isMatching(p);return C?this.wasMatching(p,v,C)?n.Movement.STAYED_IN:n.Movement.ENTERED:this.wasMatching(p,v,C)?n.Movement.EXITED:n.Movement.STAYED_OUT},y.parseSelectors=function(p){var v=[],C,b;function S(){C&&(b&&(C.qualifiers.push(b),b=void 0),v.push(C)),C=new y}function _(){b&&C.qualifiers.push(b),b=new d}for(var k=/\s/,x=void 0,N="Invalid or unsupported selector syntax.",W=1,O=2,P=3,Q=4,te=5,fe=6,ne=7,Y=8,be=9,ce=10,Se=11,st=12,J=13,q=14,re=W,Ft=0;Ft<p.length;){var z=p[Ft++];switch(re){case W:if(z.match(h)){S(),C.tagName=z,re=O;break}if(z=="*"){S(),C.tagName="*",re=P;break}if(z=="."){S(),_(),C.tagName="*",b.attrName="class",b.contains=!0,re=Q;break}if(z=="#"){S(),_(),C.tagName="*",b.attrName="id",re=Q;break}if(z=="["){S(),_(),C.tagName="*",b.attrName="",re=fe;break}if(z.match(k))break;throw Error(N);case O:if(z.match(f)){C.tagName+=z;break}if(z=="."){_(),b.attrName="class",b.contains=!0,re=Q;break}if(z=="#"){_(),b.attrName="id",re=Q;break}if(z=="["){_(),b.attrName="",re=fe;break}if(z.match(k)){re=q;break}if(z==","){re=W;break}throw Error(N);case P:if(z=="."){_(),b.attrName="class",b.contains=!0,re=Q;break}if(z=="#"){_(),b.attrName="id",re=Q;break}if(z=="["){_(),b.attrName="",re=fe;break}if(z.match(k)){re=q;break}if(z==","){re=W;break}throw Error(N);case Q:if(z.match(h)){b.attrValue=z,re=te;break}throw Error(N);case te:if(z.match(f)){b.attrValue+=z;break}if(z=="."){_(),b.attrName="class",b.contains=!0,re=Q;break}if(z=="#"){_(),b.attrName="id",re=Q;break}if(z=="["){_(),re=fe;break}if(z.match(k)){re=q;break}if(z==","){re=W;break}throw Error(N);case fe:if(z.match(h)){b.attrName=z,re=ne;break}if(z.match(k))break;throw Error(N);case ne:if(z.match(f)){b.attrName+=z;break}if(z.match(k)){re=Y;break}if(z=="~"){b.contains=!0,re=be;break}if(z=="="){b.attrValue="",re=Se;break}if(z=="]"){re=P;break}throw Error(N);case Y:if(z=="~"){b.contains=!0,re=be;break}if(z=="="){b.attrValue="",re=Se;break}if(z=="]"){re=P;break}if(z.match(k))break;throw Error(N);case be:if(z=="="){b.attrValue="",re=Se;break}throw Error(N);case ce:if(z=="]"){re=P;break}if(z.match(k))break;throw Error(N);case Se:if(z.match(k))break;if(z=='"'||z=="'"){x=z,re=J;break}b.attrValue+=z,re=st;break;case st:if(z.match(k)){re=ce;break}if(z=="]"){re=P;break}if(z=="'"||z=='"')throw Error(N);b.attrValue+=z;break;case J:if(z==x){re=ce;break}b.attrValue+=z;break;case q:if(z.match(k))break;if(z==","){re=W;break}throw Error(N)}}switch(re){case W:case O:case P:case te:case q:S();break;default:throw Error(N)}if(!v.length)throw Error(N);return v},y.nextUid=1,y.matchesSelector="matches",y})(),E=(function(){function y(){}return y.createObserverOptions=function(p){var v={childList:!0,subtree:!0},C;function b(S){if(!(v.attributes&&!C)){if(v.attributes=!0,v.attributeOldValue=!0,!S){C=void 0;return}C=C||{},S.forEach(function(_){C[_]=!0,C[_.toLowerCase()]=!0})}}return p.forEach(function(S){if(S.characterData){v.characterData=!0,v.characterDataOldValue=!0;return}if(S.all){b(),v.characterData=!0,v.characterDataOldValue=!0;return}if(S.attribute){b([S.attribute.trim()]);return}var _=y._elementFilterAttributes(S.elementFilter).concat(S.attributeList||[]);_.length&&b(_)}),C&&(v.attributeFilter=Object.keys(C)),v},y.validateOptions=function(p){for(var v in p)if(!(v in y._optionKeys))throw Error("Invalid option: "+v);if(typeof p.callback!="function")throw Error("Invalid options: callback is required and must be a function");if(!p.queries||!p.queries.length)throw Error("Invalid options: queries must contain at least one query request object.");for(var C={callback:p.callback,rootNode:p.rootNode||document,observeOwnChanges:!!p.observeOwnChanges,oldPreviousSibling:!!p.oldPreviousSibling,queries:[]},b=0;b<p.queries.length;b++){var S=p.queries[b];if(S.all){if(Object.keys(S).length>1)throw Error("Invalid request option. all has no options.");C.queries.push({all:!0});continue}if("attribute"in S){var _={attribute:y._validateAttribute(S.attribute)};if(_.elementFilter=g.parseSelectors("*["+_.attribute+"]"),Object.keys(S).length>1)throw Error("Invalid request option. attribute has no options.");C.queries.push(_);continue}if("element"in S){var k=Object.keys(S).length,_={element:S.element,elementFilter:g.parseSelectors(S.element)};if(S.hasOwnProperty("elementAttributes")&&(_.attributeList=y._validateElementAttributes(S.elementAttributes),k--),k>1)throw Error("Invalid request option. element only allows elementAttributes option.");C.queries.push(_);continue}if(S.characterData){if(Object.keys(S).length>1)throw Error("Invalid request option. characterData has no options.");C.queries.push({characterData:!0});continue}throw Error("Invalid request option. Unknown query request.")}return C},y._validateElementAttributes=function(p){if(!p.trim().length)throw Error("Invalid request option: elementAttributes must contain at least one attribute.");for(var v={},C={},b=p.split(/\s+/),S=0;S<b.length;S++){var _=b[S];if(_){_=y._validateAttribute(_);var k=_.toLowerCase();if(v[k])throw Error("Invalid request option: observing multiple case variations of the same attribute is not supported.");C[_]=!0,v[k]=!0}}return Object.keys(C)},y._elementFilterAttributes=function(p){var v={};return p.forEach(function(C){C.qualifiers.forEach(function(b){v[b.attrName]=!0})}),Object.keys(v)},y._validateAttribute=function(p){if(typeof p!="string"||(p=p.trim(),!p))throw Error("Invalid request option. attribute must be a non-zero length string.");if(!p.match(y._attributeFilterPattern))throw Error("Invalid request option. invalid attribute name: "+p);return p},y._attributeFilterPattern=/^([a-zA-Z:_]+[a-zA-Z0-9_\-:.]*)$/,y._optionKeys={callback:!0,queries:!0,rootNode:!0,oldPreviousSibling:!0,observeOwnChanges:!0},y})(),w=(function(){function y(p){var v=this;this._connected=!1,this._options=E.validateOptions(p),this._observerOptions=E.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(C){return C.elementFilter?C.elementFilter:[]})),this._elementFilter.length||(this._elementFilter=void 0),this._calcReordered=this._options.queries.some(function(C){return C.all}),this._queryValidators=[],y.createQueryValidator&&(this._queryValidators=this._options.queries.map(function(C){return y.createQueryValidator(v._root,C)})),this._observer=new MutationObserver(function(C){v._observerCallback(C)}),this.reconnect()}return y.prototype.reconnect=function(){if(this._connected)throw Error("Already connected");this._observer.observe(this._root,this._observerOptions),this._connected=!0,this._checkpointQueryValidators()},y.prototype.takeSummaries=function(){if(!this._connected)throw Error("Not connected");var p=this._createSummaries(this._observer.takeRecords());return this._changesToReport(p)?p:void 0},y.prototype.disconnect=function(){var p=this.takeSummaries();return this._observer.disconnect(),this._connected=!1,p},y.prototype._observerCallback=function(p){this._options.observeOwnChanges||this._observer.disconnect();var v=this._createSummaries(p);this._runQueryValidators(v),this._options.observeOwnChanges&&this._checkpointQueryValidators(),this._changesToReport(v)&&this._callback(v),!this._options.observeOwnChanges&&this._connected&&(this._checkpointQueryValidators(),this._observer.observe(this._root,this._observerOptions))},y.prototype._createSummaries=function(p){if(!p||!p.length)return[];for(var v=new c(this._root,p,this._elementFilter,this._calcReordered,this._options.oldPreviousSibling),C=[],b=0;b<this._options.queries.length;b++)C.push(new u(v,this._options.queries[b]));return C},y.prototype._checkpointQueryValidators=function(){this._queryValidators.forEach(function(p){p&&p.recordPreviousState()})},y.prototype._runQueryValidators=function(p){this._queryValidators.forEach(function(v,C){v&&v.validate(p[C])})},y.prototype._changesToReport=function(p){return p.some(function(v){return!!(["added","removed","reordered","reparented","valueChanged","characterDataChanged"].some(function(C){return v[C]&&v[C].length})||v.attributeChanged&&Object.keys(v.attributeChanged).some(function(C){return!!v.attributeChanged[C].length}))})},y})(),T=(function(){function y(p,v){this.root=p,this.delegate=v,this.idMap={}}return y.prototype.initialize=function(p,v){this.idMap[p]=this.root;for(var C=0;C<v.length;C++)this.deserializeNode(v[C],this.root)},y.prototype.applyChanged=function(p,v,C,b){var S=this;v.forEach(function(_){var k=S.deserializeNode(_);S.deserializeNode(_.parentNode),S.deserializeNode(_.previousSibling),k.parentNode&&k.parentNode.removeChild(k)}),p.forEach(function(_){var k=S.deserializeNode(_);k.parentNode&&k.parentNode.removeChild(k)}),v.forEach(function(_){var k=S.deserializeNode(_),x=S.deserializeNode(_.parentNode),N=S.deserializeNode(_.previousSibling);x.insertBefore(k,N?N.nextSibling:x.firstChild)}),C.forEach(function(_){var k=S.deserializeNode(_);Object.keys(_.attributes).forEach(function(x){var N=_.attributes[x];N===null?k.removeAttribute(x):(!S.delegate||!S.delegate.setAttribute||!S.delegate.setAttribute(k,x,N))&&k.setAttribute(x,N)})}),b.forEach(function(_){var k=S.deserializeNode(_);k.textContent=_.textContent}),p.forEach(function(_){delete S.idMap[_.id]})},y.prototype.deserializeNode=function(p,v){var C=this;if(p===null)return null;var b=this.idMap[p.id];if(b)return b;var S=this.root.ownerDocument;switch(S===null&&(S=this.root),p.nodeType){case Node.COMMENT_NODE:b=S.createComment(p.textContent);break;case Node.TEXT_NODE:b=S.createTextNode(p.textContent);break;case Node.DOCUMENT_TYPE_NODE:b=S.implementation.createDocumentType(p.name,p.publicId,p.systemId);break;case Node.ELEMENT_NODE:this.delegate&&this.delegate.createElement&&(b=this.delegate.createElement(p.tagName)),b||(b=S.createElement(p.tagName)),Object.keys(p.attributes).forEach(function(k){(!C.delegate||!C.delegate.setAttribute||!C.delegate.setAttribute(b,k,p.attributes[k]))&&b.setAttribute(k,p.attributes[k])});break;default:throw"Unsupported node type: "+p.nodeType}if(this.idMap[p.id]=b,v&&v.appendChild(b),p.childNodes)for(var _=0;_<p.childNodes.length;_++)this.deserializeNode(p.childNodes[_],b);return b},y})(),L=(function(){function y(p,v,C){var b=this;this.target=p,this.mirror=v,this.nextId=1,this.knownNodes=new r;for(var S=this.serializeNode(p).id,_=[],k=p.firstChild;k;k=k.nextSibling)_.push(this.serializeNode(k,!0));this.mirror.initialize(S,_);var x=[{all:!0}];C&&(x=x.concat(C)),this.mutationSummary=new w({rootNode:p,callback:function(N){b.applyChanged(N)},queries:x})}return y.prototype.disconnect=function(){this.mutationSummary&&(this.mutationSummary.disconnect(),this.mutationSummary=void 0)},y.prototype.rememberNode=function(p){var v=this.nextId++;return this.knownNodes.set(p,v),v},y.prototype.forgetNode=function(p){this.knownNodes.delete(p)},y.prototype.serializeNode=function(p,v){if(p===null)return null;var C=this.knownNodes.get(p);if(C!==void 0)return{id:C};var b={nodeType:p.nodeType,id:this.rememberNode(p)};switch(b.nodeType){case Node.DOCUMENT_TYPE_NODE:var S=p;b.name=S.name,b.publicId=S.publicId,b.systemId=S.systemId;break;case Node.COMMENT_NODE:case Node.TEXT_NODE:b.textContent=p.textContent;break;case Node.ELEMENT_NODE:var _=p;b.tagName=_.tagName,b.attributes={};for(var k=0;k<_.attributes.length;k++){var x=_.attributes[k];b.attributes[x.name]=x.value}if(v&&_.childNodes.length){b.childNodes=[];for(var N=_.firstChild;N;N=N.nextSibling)b.childNodes.push(this.serializeNode(N,!0))}}return b},y.prototype.serializeAddedAndMoved=function(p,v,C){var b=this,S=p.concat(v).concat(C),_=new r;S.forEach(function(x){var N=x.parentNode,W=_.get(N);W||(W=new r,_.set(N,W)),W.set(x,!0)});var k=[];return _.keys().forEach(function(x){for(var N=_.get(x),W=N.keys();W.length;){for(var O=W[0];O.previousSibling&&N.has(O.previousSibling);)O=O.previousSibling;for(;O&&N.has(O);){var P=b.serializeNode(O);P.previousSibling=b.serializeNode(O.previousSibling),P.parentNode=b.serializeNode(O.parentNode),k.push(P),N.delete(O),O=O.nextSibling}W=N.keys()}}),k},y.prototype.serializeAttributeChanges=function(p){var v=this,C=new r;return Object.keys(p).forEach(function(b){p[b].forEach(function(S){var _=C.get(S);_||(_=v.serializeNode(S),_.attributes={},C.set(S,_)),_.attributes[b]=S.getAttribute(b)})}),C.keys().map(function(b){return C.get(b)})},y.prototype.applyChanged=function(p){var v=this,C=p[0],b=C.removed.map(function(x){return v.serializeNode(x)}),S=this.serializeAddedAndMoved(C.added,C.reparented,C.reordered),_=this.serializeAttributeChanges(C.attributeChanged),k=C.characterDataChanged.map(function(x){var N=v.serializeNode(x);return N.textContent=x.textContent,N});this.mirror.applyChanged(b,S,_,k),C.removed.forEach(function(x){v.forgetNode(x)})},y})();if(MutationObserver===void 0)throw Error("DOM Mutation Observers are required");n.ChildListChange=o,n.MutationProjection=c,n.MutationSummary=w,n.NodeChange=a,n.NodeMap=r,n.Qualifier=d,n.Selector=g,n.Summary=u,n.TreeChanges=l,n.TreeMirror=T,n.TreeMirrorClient=L,Object.defineProperty(n,"__esModule",{value:!0})}))})),cx=lx(),$o=0,Wo=new Array(1e3);function ux(){for(let e=0;e<$o;e+=2){const t=Wo[e],n=Wo[e+1];t(...n),Wo[e]=void 0,Wo[e+1]=void 0}$o=0}function dx(e,...t){Wo[$o]=e,Wo[$o+1]=t,$o+=2,$o===2&&mx()}function fx(){let e=0;const t=new MutationObserver(ux),n=document.createTextNode("");return t.observe(n,{characterData:!0}),()=>{n.data=String(e=++e%2)}}var mx=fx();function dy(){dx(()=>{Md.hasListeners()&&(Md.fire(),dy())})}var Md=new he({onFirstListenerAdd:dy}),il=Md.once;function hx(e,t,n){const r=new he;let o=[];return r.addDisposable(e(i=>{il(()=>{r.fire(t(o)),o=[]}),o.push(i)})),n?.addDisposable(r),r.event}var px=class extends he{constructor(e={}){super(),A(this,"_mutationSummary",void 0),this._mutationSummary=new cx.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}},gx=class extends ve{_nextTickHandler(){il(()=>{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 he({onFirstListenerAdd:()=>{this._nextTickHandler()}}))),A(this,"_lostEmitter",this.addDisposable(new he)),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 px(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),il(()=>{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)}}},bx=1,fy=e=>e.nodeType===bx,Pd=e=>e?.nodeName==="STYLE";function yx(e){return e.some(t=>t.attributeChanged&&Object.keys(t.attributeChanged).length||t.reparented?.length||t.reordered?.length||t.added?.some(n=>fy(n)||Pd(n.parentNode))||t.removed?.some(n=>fy(n)||Pd(t.getOldParentNode(n)))?!0:!!t.characterDataChanged?.some(n=>Pd(n.parentNode)))}var vx=il;function Ex(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 my=/&(?:#\d+|#x[\da-f]+|[a-z][a-z\d]*);/iy;function hy(e,t){my.lastIndex=t;const n=my.exec(e);return n?n[0].length:e.startsWith(`\r
|
|
3
3
|
`,t)?2:1}function py(e){return e.length===1?1:(vr(e).textContent??"").length}function Sx(e,t,n){if(n)return Math.min(t,e.length);let r=0,o=0;for(;o<e.length&&r<t;){const i=hy(e,o);r+=py(e.slice(o,o+i)),o+=i}return o}function wx(e,t,n){if(n)return Math.min(t,e.length);let r=0;for(let o=0;o<e.length;){const i=hy(e,o);if(o+i>t)break;r+=py(e.slice(o,o+i)),o+=i}return r}function os(e,t){const n=t.nodeMap.getByElement(e);return n&&t.isAttached(n)?n:void 0}var _x='[contenteditable="true"], editor';function gy(e,t,n){const r=e.childNodes;for(let i=t;i<r.length;i++){const s=os(r[i],n);if(s)return s.start}for(let i=Math.min(t,r.length)-1;i>=0;i--){const s=os(r[i],n);if(s)return s.end}const o=os(e,n);return o&&(o.startTagEnd??o.start)}function by(e,t){if((e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest(_x))for(let n=e,r=e.parentNode;r;n=r,r=r.parentNode){const o=gy(r,Array.from(r.childNodes).indexOf(n),t);if(o!==void 0)return o}}function Cx({node:e,offset:t},n){if(e.nodeType===Node.TEXT_NODE){const r=os(e,n);if(r?.type!==I.HTML)return by(e,n);const o=n.textAt(r.start,r.end);return r.start+Sx(o,t,gn(e.parentNode))}return gy(e,t,n)??(os(e,n)?void 0:by(e,n))}function Id(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 Tx(e,t){const n=t.nodeAt(e);if(!n)return;if(n.type===I.HTML){const s=t.nodeMap.getByNode(n);return s?.nodeType!==Node.TEXT_NODE?void 0:{node:s,offset:wx(t.textAt(n.start,n.end),Math.max(0,Math.min(e,n.end)-n.start),gn(s.parentNode))}}if(e<=n.start||e>=n.end)return Id(n,e>=n.end&&e>n.start,t);const r=n.children.find(s=>s.start>=e);if(r)return Id(r,!1,t);const o=n.children[n.children.length-1];if(o)return Id(o,!0,t);const i=t.nodeMap.getByNode(n);return i&&{node:i,offset:0}}var jJ=400,yy=3e3,Ax=class extends ve{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(yy)}_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=[]}},vy=2e3,kx=3;function Lx(e,t,n){const r=e.data.indexOf(n,Math.max(0,t-n.length));return n.trim().length>=kx&&r>=0&&r<=t}function Ey(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 Nx(e,t){if(e.nodeType===Node.TEXT_NODE)return{text:e,offset:t};const n=Ey(e.childNodes[t-1],!0),r=n?void 0:Ey(e.childNodes[t],!1);return n?{text:n,offset:n.length}:r&&{text:r,offset:0}}var xx=class extends ve{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 he)),A(this,"_beforeCommitEmitter",this.addDisposable(new he)),A(this,"_beforeTextCommitEmitter",this.addDisposable(new he)),A(this,"_onTextCommitEmitter",this.addDisposable(new he)),A(this,"_onRefreshEmitter",this.addDisposable(new he)),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 gx)),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",ix(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",cL(hx(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 EN(e,n.createRoot);this._nodeMap=new r2,this.addDisposable(r.onRefresh(this._onRefresh.bind(this))),this.addDisposable(r.onMutate(this._onRemoteMutate.bind(this))),this._attributeMapper=new J2(this._nodeMap),this.addDisposable(h2(()=>this._mutationCollector.pauseForForeignCode())),this.addDisposable(p2(()=>this._mutationCollector.resumeAfterForeignCode())),this.addDisposable(this._mutationCollector.onNativeMutate(o=>{this._styleDirty||(this._styleDirty=yx(o))})),this.addDisposable(this._mutationCollector.onLost(o=>this._attributeMapper.onHiddenMutate(o))),this.ownership=new ex(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(SA(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 Ax(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:Ex(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?Nx(n,t?.anchorOffset??0):void 0;l&&l.text!==e.node&&!Lx(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?[l2(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);ox(tx(e,this.ownership,t),this._reportedDrifts),rx(nx(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 ay(e,this._accountingRules())}auditNodes(){return ly(document,this._accountingRules()).map(cy)}checkAccounting(){this._reportSafely(()=>uy(ly(document,this._accountingRules()),this._reportedDrifts))}_checkCommitted(e){this._reportSafely(()=>{const t=e.flatMap(n=>[...n.added,...n.reparented??[],...n.reordered??[]]);uy(sx(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+vy-Date.now());this._accountingTimer=setTimeout(()=>{const n=window.requestIdleCallback;n?n(e,{timeout:vy}):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=u2(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),Va("commit",()=>{const r=W2(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())});vx(()=>{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 Cx(e,this._textPoints())}offsetToPoint(e){return Tx(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)}}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=q2(e);try{this._baseDocument.beginUpdate();const t=this._parsedDocument;Jg(()=>{const n=Ab(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===I.ELEMENT){const r=Wu(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,tr),i=this._nodeMap.getByNode(n);i&&(this._nodeMap.remove(n),this._nodeMap.set(o,i))}}finally{this._baseDocument.endUpdate()}}_onRefresh(e){try{Va("refresh",()=>this._onRemoteMutate(e,!0))}finally{this._onRefreshEmitter.fire()}}_onRemoteMutate(e,t){if(this._treeMutations.push([e,t,AL()??"other"]),!(this._remoteDocument.hasChanges()&&!this._remoteDocument.isApplyingRemote()))for(const[n,r,o]of this._treeMutations)Va(o,()=>this._doOnRemoteMutate(n,r))}_doOnRemoteMutate(e,t){try{if(this._mutationCollector.stop(),e=s2(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=$N(e,this._nodeMap,o=>this._parsedDocument.isAttached(o),o=>this.ownership.markOf(o)==="service",o=>this.ownership.isOuterWrapper(o)),r=zN(n);this._beforeChangeEmitter.fire({domMutations:n.mutations,treeMutations:e}),r.push(...yk(jN(n)));try{if(t2(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);kd.isEqual(i,s)}}}finally{Og(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(ie.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){rt("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}}}},VJ=1500,GJ=2,Ox=100,Rx=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,Ox))}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)}},Dd=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=Ct(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)}}},Sy=60;function Mx(e,t){const n=Yg(e,t);if(!n)return;const r=n.start;return{offset:r,ownLength:e.length,cachedLength:t.length,own:e.substring(r,r+Sy),cached:t.substring(r,r+Sy)}}var Px=64,Ix=class extends ve{constructor(...e){super(...e),A(this,"_onApplyEmitter",this.addDisposable(new he)),A(this,"_onEmptyEmitter",this.addDisposable(new he)),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>Px&&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=Xa(i.textChanges,o,"after"),a=s&&Xa(o,i.textChanges,"before");if(!s||!a)return!1;i.textChanges=s,o=a}n=Ct(n,o)}return this._dispatched=t.reverse(),this._emit(n),!0}_confirmEcho(e,t){const[n]=this._dispatched.splice(e,1);this._emit(Ct(Rn(n.textChanges),t))}_applyExternal(e){let t=[];for(const n of this._dispatched)t=Ct(t,Rn(n.textChanges)),n.changeId!==void 0&&this._revertedAwaiting.add(n.changeId);this._dispatched=[],this._emit(Ct(t,e))}clear(){const e=this.hasDispatched();this._dispatched=[],this._revertedAwaiting.clear(),e&&this._onEmptyEmitter.fire()}},Dx=class pA extends ve{constructor(t=""){super(),A(this,"_text",void 0),this._text=t}getText(t){const n=WL(this,t);return n?this._text.substring(n.start,n.end):""}getLength(){return this._text.length}clone(){return new pA(this._text)}},sl=class gA extends Dx{constructor(t=""){super(t),A(this,"_eventQueue",void 0),A(this,"_lockCounter",0),A(this,"_onChangeEmitter",this.addDisposable(new he)),A(this,"_onChangedEmitter",this.addDisposable(new he)),A(this,"onChanged",this._onChangedEmitter.event)}applyEdits(t,n){if(n=n.flatMap(r=>GL(this,r)),n.length){const r=Po(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=UL(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=Ct(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 gA(this._text)}};function wy(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function al(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 Bx(e){return(t,n,r)=>al(t)?e(t,n,r):!1}function Hx(e){return t=>al(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Fx(e){return(t,n,r)=>al(t)?wy(t)?e(t,n,r):t:!1}function $x(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return al(n)?wy(n)?e(t):t:!1}}function Wx(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Bd(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 qx(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 zx=8,Ux=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=qx(zx),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},ll=new Ux;function _y(e,t){return t!==void 0&&!Bd(e,t)?`%|{${ll.getOrCreateByKey(e)}}|%`:e}function jx(e){const t=ll.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function Ke(e,t,n){return t!==void 0?Bd(e,t)?e:`%|{${ll.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function Vx(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function qe(e){return e.startsWith("<!--")&&e.endsWith("-->")?Vx(e.slice(4,-3)):e}function Gx(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 Xx(e,t,n){return t!==void 0?Bd(e,t)?e:`%|{${ll.getOrCreateByKey(e)}}|%`:n||Wx(e)||Gx(e)?`<!--${e}-->`:e}var Qr=Bx(Ke),Jr=Hx(qe),Kx=Fx(Ke),Yx=$x(qe),Zx=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",jx),e.escape("@{","}",Ke,!0).unescape("<!--@{","}-->",qe,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",_y,!0),e.escape("{{","}}",_y,!0),e.createSyntax("brace-percent").escape("{%","%}",Ke).unescape("<!--{%","%}-->",qe),e.createSyntax("brace-hash").escape("{#","#}",Ke).unescape("<!--{#","#}-->",qe),e.createSyntax("proscript").escape("[%","%]",Xx,!0).unescape("<!--[%","%]-->",qe,!0),e.createSyntax("getresponse").escape("[[IF","]]",Ke).escape("[[if","]]",Ke).escape("[[ELSE]]","",Ke).escape("[[else]]","",Ke).escape("[[ENDIF]]","",Ke).escape("[[endif]]","",Ke).unescape("<!--[[IF","]]-->",qe).unescape("<!--[[if","]]-->",qe).unescape("<!--[[ELSE]]","-->",qe).unescape("<!--[[else]]","-->",qe).unescape("<!--[[ENDIF]]","-->",qe).unescape("<!--[[endif]]","-->",qe),e.createSyntax("expert-sender").escape("<if",">",Ke).escape("</if",">",Ke).escape("<else",">",Ke).escape("</else",">",Ke).escape("<var ",">",Ke,!0).unescape("<!--<if ",">-->",qe).unescape("<!--</if",">-->",qe).unescape("<!--<else ",">-->",qe).unescape("<!--</else",">-->",qe).unescape("<!--<var",">-->",qe,!0),e.createSyntax("velocity").escape("#if",")",Qr).escape("#elseif",")",Qr).escape("#else","",Ke).escape("#foreach",")",Qr).escape("#macro",")",Qr).escape("#set",")",Kx,!0).escape("#parse",")",Qr).escape("#include",")",Qr).escape("#evaluate",")",Qr).escape("#end","",Ke).escape("#break","",Ke).escape("#stop","",Ke).unescape("<!--#macro","-->",Jr).unescape("<!--#if","-->",Jr).unescape("<!--#elseif","-->",Jr).unescape("<!--#else","-->",qe).unescape("<!--#foreach","-->",Jr).unescape("<!--#parse","-->",Jr).unescape("<!--#include","-->",Jr).unescape("<!--#evaluate","-->",Jr).unescape("<!--#end","-->",qe).unescape("<!--#break","-->",qe).unescape("<!--#stop","-->",qe).unescape("<!--#set","-->",Yx,!0),e.createSyntax("mailchimp").escape("*|","|*",Ke).unescape("<!--*|","|*-->",qe)},Cy="bare",Hd=new Map;function Qx(e){for(const t of Object.keys(e)){const n=e[t];n&&Hd.set(t,n)}}function Jx(e){return e?Hd.get(e)??Cy:Cy}function eO(){Hd.clear()}function Ty(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 is(e,t){return e.start<t.end&&t.start<e.end}function Ay(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:m,syntax:h,isVariable:f}of i){if(r?(l.insideAttributeValue=!0,l.attributeQuoteChar='"'):Ty(e,c,u.start,l),c=u.end,a.some(T=>is(T,u)))continue;const g=l.insideAttributeValue?l.attributeQuoteChar??"":void 0,E=e.substring(u.start,u.end),w=d(E,g,l.insideTag);w!==!1&&w!==E&&(s.push({range:u,text:w,overrideBuiltins:m,syntax:h,isVariable:f}),a.push(u))}return s.sort((u,d)=>u.range.start-d.range.start||u.range.end-d.range.end)}function tO(e,t){const n=t.reduce((a,{mapFn:l,start:c,end:u,syntax:d,isVariable:m})=>(a[c]||(a[c]=[]),a[c].push({value:u,mapFn:l,syntax:d,isVariable:m}),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 Fd(e,t,n,r,o=!1){const i=[];if(n&&(t=t.filter(c=>c.isVariable)),!t.length)return i;const s=tO(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:m}=s[c];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Ty(e,l,u,a),l=u;const h=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let f=!1;for(const{mapFn:g,value:E,syntax:w,isVariable:T}of m){let L=u+d.length,y=e.indexOf(E,L);for(;y!==-1;){let p=y,v=u+d.length,C=0;for(;p!==-1;){const x=e.indexOf(d,v);if(x!==-1&&x<p)C++,v=x+d.length,p=e.indexOf(E,v);else if(C>0)C--,v=p+E.length,p=e.indexOf(E,v);else break}if(p<0)break;const b=p+E.length,S=e.substring(u,b),_=g(S,h,a.insideTag);if(_===!1){L=y+Math.max(E.length,1),y=e.indexOf(E,L);continue}(o||_!==S)&&i.push({range:{start:u,end:b},text:o?S:_,syntax:w,isVariable:T});const k=s.findIndex(({start:x})=>x>=b);k>c?c=k-1:c=s.length,f=!0;break}if(f)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 ky=class{constructor(e=Zx){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=Fd(e,this._escapes,t,n),o=Ay(e,this._escapeMatchers,t,n),i=o.filter(l=>l.overrideBuiltins).map(l=>l.range),s=r.filter(l=>!i.some(c=>is(c,l.range))),a=o.filter(l=>l.overrideBuiltins||!s.some(c=>is(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=Fd(e,this._unescapes,t),r=Ay(e,this._unescapeMatchers,t,!1),o=r.filter(a=>a.overrideBuiltins).map(a=>a.range),i=n.filter(a=>!o.some(l=>is(l,a.range))),s=r.filter(a=>a.overrideBuiltins||!i.some(l=>is(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=>Jx(o)==="html-comment";return this._collectRevertMappings(e,t).filter(o=>o.isVariable||!r(o.syntax))}getDetectedMappings(e,t,n){return Fd(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()}},nO=1e4,Ly=3,rO=EL+ld;function oO(e){return(e??[]).reduce((t,n)=>t+n.oldLength,0)}function iO(e,t){return e.stack.closesStep()?!1:e.undoStop===t.undoStop||e.serviceRemoval+t.serviceRemoval<=200}var sO=class extends sl{constructor(){super(),A(this,"_editStack",new Dd),A(this,"_frozenStack",new Dd),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 Ix)),A(this,"_beforeSaveEmitter",this.addDisposable(new lL)),A(this,"_onReadyEmitter",this.addDisposable(new he)),A(this,"_onEntitySetEmitter",this.addDisposable(new he)),A(this,"_onPendingSentEmitter",this.addDisposable(new he)),A(this,"_onHistoryAnswerEmitter",this.addDisposable(new he)),A(this,"_onHistoryActionEmitter",this.addDisposable(new he)),A(this,"_onHistoryActionSentEmitter",this.addDisposable(new he)),A(this,"_onHistoryActionAnsweredEmitter",this.addDisposable(new he)),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 he)),A(this,"_onEchoRecoveredEmitter",this.addDisposable(new he)),A(this,"_echoWatchdog",this.addDisposable(new Rx({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"),eO(),Qx(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)=>Ct(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(G.addListenerAsync(Ae.SANDBOX_SET_ENTITY,this._handleSetEntity)),this.addDisposable(G.addListenerAsync(Ae.SANDBOX_UPDATE_ENTITY,this._handleUpdateEntity)),this.addDisposable(G.addListenerAsync(Ae.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:Zi(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(nr,Zr(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=Xa(a,n,"after"),c=l&&Xa(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(nr,Zr(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)=>Ct(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(nr,Zr(Ct(Rn(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)=>Ct(e,t.get()??[]),[])}_textWithoutUnsent(){return HL(this.getText(),Rn(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:oO(this._editStack.get()),n=new Dd;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||!iO(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=>lb(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,_r("echo-timeout",()=>({guid:this._entityId,at:"update-entity",unsent:n,textFingerprint:Zg(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 he;let n=!1;const r=setTimeout(()=>{n=!0,t.fire()},rO),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++<Ly&&(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<Ly)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),ld),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)},ld)}_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(nr,[{range:Zi(this._cache),text:r}]),this._rev=t??null,this._applyToCache(e),this._versionController.apply(this._changesToCache())}catch{}finally{this._resyncing=!1}const o=Zg(this._cache.getText());if(o.length!==n.length||o.hash!==n.hash){this._awaitingRefill=!0,this._finishBarrier(!1),_r("resync-failed",()=>({guid:this._entityId,textFingerprint:o}));return}this._coveredRev=this._rev,this._clearEchoLost(),this._flushPendingSave(),this._onReadyEmitter.fire()}_replaceText(e){this._cache.applyEdits(nr,[{range:Zi(this._cache),text:e}]),super.applyEdits(nr,[{range:Zi(this),text:e}])}_reportSyncDrift(e){if(this.hasChanges()||this._versionController.hasDispatched())return;const t=Mx(this.getText(),this._cache.getText());if(t){const{offset:n,ownLength:r,cachedLength:o}=t;_r("host-copy-drift",()=>({at:e,text:{offset:n,ownLength:r,cachedLength:o}}))}}_changesToCache(){const e=this._textWithoutUnsent(),t=this._cache.getText(),n=Yg(e,t);if(!n)return[];const{start:r,fromEnd:o,toEnd:i}=n;return[new Ut(r,e.slice(r,o),r,t.slice(r,i))]}_applyToCache(e){return this._applyGroupsToCache(e).reduce((t,n)=>Ct(t,n),[])}_applyGroupsToCache(e){const t=[];for(const n of e){const r=n.reverse();t.push(Po(r,this._cache)),this._cache.applyEdits(nr,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=Po(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:Zr(t),changeId:s,originId:this._originId,...this._rev!==null?{baseRev:this._rev}:{},...r?{typedAt:r}:{},...o?{selection:o}:{},...i?{closesStep:i}:{}},l=()=>G.send(Ae.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=>lb(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()},nO),r=this.onReady(()=>{r.dispose(),clearTimeout(n),t()})})}_reportSaveTimeout(){_r("save-timeout",()=>({}))}hasChanges(){return this._editStack.hasChanges()||this._frozenStack.hasChanges()||this._sealed.length>0}},aO=class extends ky{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=Po(this.getMappings(n),this._baseDocument),o=Rn(this._mappings);if(t=Ct(o,t),t=Ct(t,r),this._mappings=r,t.length){const i=Zr(t);this._mappedDocument.applyEdits(e,Ka(i))}}}correctOffset(e,t){const n=t?this._mappings:Rn(this._mappings),r=qu(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=Rn(this._mappings).find(({oldPosition:n,oldEnd:r})=>e>=n&&e<r);return t?{start:t.oldPosition,end:t.oldEnd}:null}hasMappedReplacementRangeInRange(e){return Rn(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 Qi(e,n)}unescape(e){const t=this.getRevertMappings(e);return Qi(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=nr){const t=this._baseDocument.getText(),n=this.getMappings(t),r=Qi(t,n);this._mappings=Po(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=Po(this.getRevertMappings(n),this._mappedDocument),o=this._mappings;if(t=Ct(o,t),t=Ct(t,r),this._mappings=Rn(r),t.length){const i=Zr(t);this._baseDocument.applyEdits(e,Ka(i))}}}},lO="input, textarea, select, .monaco-editor",cO=/^(Arrow(Left|Right|Up|Down)|Home|End|PageUp|PageDown|Tab)$/;function Ny(e,t){return e?.node===t?.node&&e?.offset===t?.offset}function uO(e,t){return Ny(e?.anchor,t?.anchor)&&Ny(e?.focus,t?.focus)}function ul(){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 dO=class extends ve{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=!uO(this._mark,this._actionMark))}),this._listen(window,"pointerdown",!0,()=>{this._moved=!0}),this._listen(window,"keydown",!1,r=>{this._moved||(this._moved=!r.defaultPrevented&&cO.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=ul(),this._moved=!1}))}_listen(e,t,n,r){const o=i=>{this._mark=ul(),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=ul(),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(lO))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=ul())}};function fO(e){let t=e.documentElement;return t||(t=e.createElement("html"),e.appendChild(t)),t}function ss(e){let t=e.head;if(!t){t=e.createElement("head");const n=fO(e);n.insertBefore(t,n.firstChild)}return t}function mO(e){const t=Object.create(null),n=e.getAttributeNames();for(const r of n)t[r]=e.getAttribute(r);return t}function hO(e){for(const t of document.querySelectorAll("iframe"))if(t.contentDocument===e.ownerDocument)return t}function pO(e){const t=ss(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 xy="amp-custom";function gO(e,t){return`em-${e.replaceAll("-","_")}-${t.toLowerCase()}`}function Oy(e,t,n){for(const r of t)if(ns.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(_d(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 ns.isMediaRule(r)&&Oy(e,r.cssRules,n)}function Ry(e,t){const n=t.sheet;if(n){const i=new Set;Oy(e,n.cssRules,(s,a)=>{const l=gO(s,a),c=[...n.cssRules],u=`.${l} { ${s}: ${a} }`;return!c.find(d=>ns.isStyleRule(d)&&d.selectorText===`.${l}`)&&!i.has(u)&&(i.add(u),t.innerHTML=`
|
|
4
4
|
.${l} { ${s}: ${a} };
|
|
@@ -27,7 +27,7 @@ ${o.join("")}
|
|
|
27
27
|
`){a=T(a),a+=`
|
|
28
28
|
`;continue}if(!L(l)){a=T(a),a+=`
|
|
29
29
|
`,v(),a+=l,d=m.Property;continue}a+=l;continue}if(d===m.Property){if(l===":"){a=T(a),a+=": ",d=m.Expression,L(c)&&(d=m.Separator);continue}if(l==="}"){b(),d=m.Start,h>0&&(d=m.Block);continue}a+=l;continue}if(d===m.Separator){if(!L(l)){a+=l,d=m.Expression;continue}y(c)&&(d=m.Expression);continue}if(d===m.Expression){if(l==="}"){b(),d=m.Start,h>0&&(d=m.Block);continue}if(l===";"){a=T(a),a+=`;
|
|
30
|
-
`,d=m.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=m.URL;continue}continue}if(d===m.URL&&l===")"&&a.charAt(a.length-1!=="\\")){a+=l,d=m.Expression;continue}a+=l}return a=s.join("")+a,a}window.cssbeautify=e})();function VO(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 GO=["transform","transform-origin","overflow-x","height"];function XO(e,t){return!(e>0)||!(t>0)||e<=t?1:t/e}function ls(e,t){const n=t<1?`scale(${t})`:"";if(e.style.transform===n)return!1;for(const r of GO)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 KO(e,t){const n=e,r=n?.querySelector("table:first-child"),o=Math.max(n?.offsetWidth??0,r?.offsetWidth??0);return o>0?o:(ls(t,1),t.scrollWidth)}function YO(e,t=window){const n=t.document.documentElement,r=n.style.transform,o=XO(KO(e,n),t.innerWidth);return ls(n,o),n.style.transform!==r&&t.parentIFrame?.size?.(),o}function ZO(e,t){ls(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;ls(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 lt(e){const t=R(e,Te);return n=>{t.commit(n)}}function ot(){return R(Rt,K)}function QO(){return R(Rt,_t)}function JO(){return R(Rt,mn)}function ct(){return Rt.getInstance(K)!==void 0}function qo(e){R(Rt,Te).commit(e)}function eR(e){if(!ct())return e(),Promise.resolve(!0);const t=ot();return t.commit(!1),t.flushCommit(),t.sendAfterCurrentEdits(e)}function tR(){if(!ct())return!1;const e=ot();return e.commit(!1),e.flushCommit(),e.hasEditsAfterBoundary()}function nR(){return ct()?ot().markHistoryAction():void 0}function rR(e){ct()&&ot().noteHistoryActionSent(e)}function Gd(e){return ct()&&ot().holdInput(e)}function zy(e){return ct()&&ot().holdInputBehindQueued(e)}function Uy(){ct()&&ot().closeUndoStep()}function Xd(){return ct()&&ot().isHoldingInput()}function jy(){return ct()&&ot().hasHeldInput()}function Vy(){ct()&&ot().releaseHeldInput()}function Gy(){return ct()&&ot().holdsTypedEdits()}function cs(e){return ct()?ot().renderOnly(e):e()}function hl(e){return e.nodeType===1&&e.localName==="template"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function Kd(e){return[...e.querySelectorAll?.("template")??[]].filter(hl)}function oR(e){return hl(e)||Kd(e).length>0}function nn(e){const t=[...hl(e)?[e]:[],...Kd(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)nn(r)}}function zo(e){const t=[...hl(e)?[e]:[],...Kd(e)];for(const n of t)for(;n.firstChild;)n.content.appendChild(n.firstChild)}function jt(){return ct()?ot():void 0}function Mt(e){const t=jt();return t?t.applyHidden(e):e()}function Ie(e,t,...n){e&&Mt(()=>t?e.classList.add(...n):e.classList.remove(...n))}function eo(e){const t=document.activeElement;t instanceof HTMLElement&&t!==document.body&&e.contains(t)&&Mt(()=>t.blur())}function Yd(e){jt()?.ownership.markService(e)}function Xy(e){jt()?.ownership.markWrapper(e)}function iR(e){jt()?.ownership.markOuterWrapper(e)}function us(e,t){e.removeAllRanges(),Mt(()=>e.addRange(t))}function pl(e){const t=document.implementation.createHTMLDocument("").importNode(e,!0);en(e,t);const n=new Map([[e,t]]),r=jt()?.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 gl(e){return hg(pl(e).copy)}function ze(e){return ik(pl(e).copy)}function ds(e){const t=jt();return t?(t.flushCommit(),t.getOuterHtml(e)):e.outerHTML}function Zd(e){return Ky(e)}function Ky(e){const t=jt();return!t||t.isInLetter(e)||!t.isUntracked(e)&&!t.ownership.isService(e)}function Qd(e){const t=jt();return t?t.ownership.markOf(e)?"foreign":t.isInLetter(e)?"letter":t.isBehindHidden(e)?"foreign":"new":"letter"}function Jd(e,t){const n=[...e.querySelectorAll(t)].filter(Zd);return n[n.length-1]??null}function Yy(e,t){const n=o=>t==="next"?o.nextElementSibling:o.previousElementSibling;let r=n(e);for(;r&&!Zd(r);)r=n(r);return r}function Zy(e,t){return[...e.childNodes].flatMap(n=>t.isInLetter(n)?[n]:Zy(n,t))}function ef(e){eo(e);const t=jt();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(...Zy(r,t))}function sR(e){const t=[...e.childNodes],n=jt();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 aR(){const e=jt();return e?{...e.scriptRunner,awake:()=>e.recordNow()}:{run:(t,n)=>n(),quiet:t=>t()}}function or(e,t){const n=Re(e,"dormant"),r=Cg(n);try{return t(n)}finally{Og(r,aR())}}function Qy(e,t,n){or(n,r=>Ha(e,t,r))}function fs(e,t,n){return e==="new"?or(t,n):n(Re(t,!0))}function ir(e,t,n,r){fs(e,r,o=>Ha(t,n,o))}function mt(e){return function(...t){const n=jt(),r=()=>Reflect.apply(e,this,t);return n?n.applyOwn(r):r()}}function sr(e,t=!1,n){const r=()=>document.execCommand(e,t,n),o=jt();return o?o.applyCommand(r):r()}function Jy(e){const t=()=>{Ie(document.body,e,"mceNonEditable"),document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable",e?"false":"true")})};ct()?ot().applyHidden(t):t()}function lR(){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=lR();function cR(e){return{dispose:e.onIntegratorChange(()=>Jy(e.isTextLocked()))}}function uR(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 nf(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)=>nf(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)&&nf(e[i],t[i]))}function ev(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&nf(o,a)||(o=a,i=!0,r(a))})},select(r){return ev(n,r)}};return n}function tv(...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 ev(o,i)}};return o}var bl={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},ms=tv({...bl});function Pn(){return ms.get()}var yl=new he,Uo=new Map,U={source:ms,get(e){return Pn()[e]},getState(){return{...Pn()}},getStateRef(){return Pn()},set(e,t){if(Pn()[e]===t)return;ms.set({...Pn(),[e]:t}),yl.fire({[e]:t});const n=Uo.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(Pn()[r]!==o){ms.set({...Pn(),[r]:o}),n[r]=o,t=!0;const i=Uo.get(r);i&&i.forEach(s=>s(o))}}t&&yl.fire(n)},increment(e,t=1){const n=Pn()[e];typeof n=="number"&&U.set(e,n+t)},decrement(e,t=1){const n=Pn()[e];typeof n=="number"&&U.set(e,n-t)},subscribe(e){return yl.event(e)},subscribeToKey(e,t){Uo.has(e)||Uo.set(e,new Set);const n=Uo.get(e),r=t;return n.add(r),()=>{n.delete(r),n.size===0&&Uo.delete(e)}},reset(){ms.set({...bl}),yl.fire(Pn())},resetKey(e){this.set(e,bl[e])},getInitialState(){return bl}};function dR(e,t){const n=tv(),r=e.addListener(t,o=>n.set(o));return{source:n,dispose:()=>r.dispose()}}var fR=["copyPasteEnabled","saveBlockEnabled","editImageControlEnabled","elementAIimageEnabled","imageCenterStockEnabled","imageCenterGifEnabled","imageCenterEditorEnabled","blocksAddPanelEnabled"];function mR(e){const t="87ebe001";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 hR={name:"sandbox.hostFacts",provides:[Oo],setup(e){const t=Object.fromEntries(Object.entries(vL).map(([n,r])=>[n,dR(G,r).source]));e.inject(Oo,t)}},pR={name:"sandbox.hostFactsToState",awaits:{services:[Oo,Te,K,nt]},setup(e){const t=R(e,Oo),n=lt(e),r=R(e,nt);t.theme.watch(o=>{U.set("applicationTheme",o),mR(o),n(!1)}),t.commonStyles.watch(o=>{o&&U.set("commonStyles",o)}),t.flags.watch(o=>{for(const i of fR)typeof o[i]<"u"&&U.set(i,o[i])}),cR(r),uR(R(e,K),r),t.lockEditor.watch(o=>r.setIntegrator(o)),t.codeMode.watch(o=>U.set("codeMode",o)),t.appName.watch(o=>U.set("appName",o)),t.previewPage.watch(o=>{U.set("previewPage",o),Ie(document.body,!!o,"em-sandbox-preview")})}},gR={name:"sandbox.viewport",awaits:{services:[Oo]},setup(e){R(e,Oo).viewport.watch(t=>VO(t,void 0,{state:U,previewHeight:t.previewHeight,iframeOffsetTop:t.iframeOffsetTop,scrollTop:t.scrollTop,globalHolder:U.get("globalHolder"),setBlockGroupControlsPosition:()=>e.getServices(jg).forEach(n=>n()),messageService:G}))}};function Cr(e){for(const t of document.querySelectorAll(`[${e}]`))t.removeAttribute(e)}function At(e,t,n=!1){for(const r of e.querySelectorAll(t))n||!r.childNodes.length?r.remove():r.replaceWith(...r.childNodes)}function bR(e,t){if(e.data.value)document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable","false")}),Ie(document.body,!0,"em-sandbox-discuss");else{const n=t.editLock.isTextLocked()?"false":"true";document.querySelectorAll("editor").forEach(r=>{r.setAttribute("contenteditable",n)}),Ie(document.body,!1,"em-sandbox-discuss","em-sandbox-discuss_set-target")}}function yR(e,t){Ie(document.body,!!e.data.value,"em-sandbox-discuss_set-target")}function vR(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}}),Ie(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 ER(e,t){Ie(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 SR(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 wR={sandbox_lock_discuss:bR,sandbox_discuss_set_target:yR,sandbox_discuss_remove_target:vR,sandbox_discuss_reset:ER,sandbox_discuss_get_target:SR};function _R(e,t){t.editLock.setApp(!!e.data.data),Jy(t.editLock.isTextLocked())}function CR(e,t){t.setEditorFocus(e.data.data)}function TR(e,t){let n=e.data.data;if(typeof n!="number")return;n=QO().correctOffset(n,!0),n=JO().correctOffset(n,!0);let r=ot().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-U.get("previewHeight")/2+i.height/2;t.messageService.send({operation:"application_scroll-to",settings:{value:U.get("applicationMode")==="default"?s+U.get("iframeOffsetTop"):s}})}var AR={sandbox_lock_edit:_R,editor_change_focus:CR,update_position_from_editor:TR};function kR(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 LR(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 NR(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 xR(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 OR={sandbox_set_attr_to_images:kR,sandbox_set_attr_to_links:LR,sandbox_set_position_to_img:NR,sandbox_set_position_to_link:xR},RR={brightness:100,contrast:100,sepia:0},vl={DARK:"dark",LIGHT:"light"},nv=!1;function MR(e){nv||(e.setFetchMethod(t=>window.fetch(t)),nv=!0)}function PR(){let e=null,t=vl.LIGHT;return{set(n){if(t=n,n===vl.DARK){e??(e=Wd(()=>Promise.resolve().then(()=>Iu("./darkreader.CLd5EML2.js")),void 0,{}.url)),e.then(r=>{t===vl.DARK&&(MR(r),r.enable(RR))}).catch(r=>{e=null});return}e?.then(r=>{t===vl.LIGHT&&r.disable()})},clear(n){return n.replaceAll(/\s*?--darkreader.+?: .*?;/g,"")}}}var El=PR();function IR(e,t){t.initPreview(!0)}function DR(e){const t=e.data?.data?.theme;(t==="light"||t==="dark")&&El.set(t)}var BR={init_preview:IR,sandbox_switch_theme:DR};function bn(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(Vg,{owner:e,handlers:s})}}}var HR={name:"sandbox.operationEnvironment",provides:[Sr],setup(e){const t={iframeOffsetTop:0,previewHeight:0,elementPath:[]};U.subscribe(n=>{for(const r of["iframeOffsetTop","previewHeight","elementPath"])r in n&&n[r]!==void 0&&Object.assign(t,{[r]:n[r]})}),e.inject(Sr,t)}},FR=bn("discuss",wR,{services:[Te,Sr,nt]},e=>{const t=lt(e),n=R(e,Sr),r=R(e,nt);return()=>({commit:t,editLock:r,iframeOffsetTop:n.iframeOffsetTop,previewHeight:n.previewHeight,messageService:G,removeAllAttributes:Cr})}),$R=bn("editor",AR,{services:[He,ft,nt]},e=>{const t=R(e,He),n=R(e,ft),r=R(e,nt);return()=>({applicationElementSettingsSet:t,editLock:r,messageService:G,setEditorFocus:o=>n.setEditorFocus(o)})}),WR=bn("images",OR,{services:[He,Ot,Te,Sr]},e=>{const t=R(e,He),n=R(e,Ot),r=lt(e),o=R(e,Sr);return()=>({applicationElementSettingsSet:t,commit:r,iframeOffsetTop:o.iframeOffsetTop,previewHeight:o.previewHeight,messageService:G,setCursorPosition:i=>n(i)})}),qR=bn("preview",BR,{services:[Ki]},e=>()=>({initPreview:t=>R(e,Ki)(t)})),zR={name:"sandbox.operationsDispatcher",setup(e){G.addListener(t=>{const n=t.data?.operation;if(!n)return;const r=e.getServices(Vg).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)}})}},UR=[HR,FR,$R,WR,qR,zR],jR=["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"],VR=["style","class","align","href"],GR=new Set([...jR,"em-element-path_img"]);function XR(e){return e.split(/\s+/).filter(t=>t&&!GR.has(t)).join(" ")}var KR=32;function YR(e){return!!(e.tagName==="BODY"||e.getAttribute("em")==="atom"||e.tagName==="TABLE"&&e.hasAttribute("em"))}function ZR(e){const t=[e.tagName];for(const n of VR){const r=e.getAttribute(n),o=n==="class"&&r!==null?XR(r):r;o!==null&&o!==""&&t.push(`${n}=${o}`)}return t.join("|")}function QR(e){if(!e||!e.isConnected)return"";const t=[];let n=e,r=0;for(;n&&r<KR&&(t.push(ZR(n)),!YR(n));)n=n.parentElement,r++;return t.join("||")}function JR(e){let t={text:"",ancestors:""};const n=r=>({text:r?e(r):"",ancestors:QR(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 eM(e,t){t.onReleased(()=>{Promise.resolve().then(()=>{t.isLocked()||e.remember(document.querySelector("[em-edit]"))})})}var rv=Promise.resolve(),ov=null;function tM(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 nM(e,t){ov=e,rv=rv.finally(()=>{ov===e&&tM(e,t)})}function rM(e,t="unknown"){const n=Rt.getInstance(ft);if(!n){e();return}n.controller.whenEditorLostFocus(e,t)}function oM(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 iM(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 ZJ="br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object",hs="data-em-caret",QJ="",ar=e=>e();function Pt(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("data-em-caret")}function to(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.tagName==="EM-REPLACE"&&!e.hasAttribute("src")}function Tr(e){return(e??"").replaceAll("","")}function rf(e){return Tr(e.textContent)}function sM(e){return(e.nodeType===Node.TEXT_NODE||Pt(e))&&Tr(e.textContent)===""}function of(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=window.getSelection();r&&us(r,n)}function iv(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(!to(r))return null;const o=document.createRange();if(o.selectNodeContents(r),o.setEnd(t,n),Tr(o.toString())==="")return{em:r,side:"before"};const i=document.createRange();return i.selectNodeContents(r),i.setStart(t,n),Tr(i.toString())===""?{em:r,side:"after"}:null}function sf(e,t){if(!e.collapsed)return null;const n=iv(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(Tr(t==="backward"?s.slice(0,o):s.slice(o))!=="")return null;const a=r.parentNode,l=Pt(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&&sM(i);)i=t==="backward"?i.previousSibling:i.nextSibling;return to(i)?i:null}function Sl(e,t,n=ar){return af(e,t,n)}function af(e,t,n=ar){const r=t==="after"?e.nextSibling:e.previousSibling;let o;if(Pt(r))o=r;else{const s=document.createElement("span");s.setAttribute(hs,""),Yd(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 of(i,i.length),o}var aM="p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";function lf(e,t=ar,n=e.parentElement?.closest('[contenteditable="true"]')){sv(e,n)&&af(e,"after",t)}function sv(e,t){if(!t)return!1;const n=e.parentElement?.closest(aM),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(`[${hs}]`).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 av(e){const t=Pt(e)&&rf(e)===""?e.previousSibling:null;return t?.nodeName==="BR"&&sv(t,t.parentElement?.closest('[contenteditable="true"]'))}function cf(e,t=ar){if(!av(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&&of(i,Array.prototype.indexOf.call(i.childNodes,o)),o}function lv(){const e=window.getSelection(),t=e?.rangeCount?e.getRangeAt(0):null,n=t?.collapsed?t.startContainer:null,r=Pt(n)?n:n?.parentNode;return av(r)?r:null}function lM(e,t=ar,n){return Array.from(e.querySelectorAll(`[${hs}]`)).filter(r=>r!==n).map(r=>cf(r,t)).some(Boolean)}function cM(e,t=ar,n){const r=Array.from(e.querySelectorAll(`[${hs}]`)).filter(o=>o!==n&&Tr(o.textContent)==="");r.length&&t(()=>r.forEach(o=>o.remove()))}function uM(e,t=ar){const n=Tr(e.textContent);if(n==="")return null;const r=document.createTextNode(n);return e.before(r),t(()=>e.remove()),of(r,r.length),r}function cv(e){if(!e.collapsed)return;const{startContainer:t}=e,n=Pt(t)?t:t.parentNode;Pt(n)&&(to(n.previousSibling)?e.setStartAfter(n):e.setStartBefore(n),e.collapse(!0))}function uv(e){e.querySelectorAll(`[${hs}]`).forEach(t=>{const n=Tr(t.textContent);n===""?t.remove():t.replaceWith(t.ownerDocument.createTextNode(n))})}function dM(e,t){const n=sf(e,t);if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o&&us(o,r),n}function fM(e,t){const n=Array.from(e.querySelectorAll("em-replace")).find(i=>to(i)&&t.intersectsNode(i)&&!dv(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 dv(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 mM(){document.execCommand("delete")}function hM(){const e=window.getSelection()?.getRangeAt(0);e?.deleteContents(),e?.collapse(!0)}function fv(e,t=ar,n=mM){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=>to(l)&&dv(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;to(l)?Sl(l,"after",t):!l&&to(c)&&Sl(c,"before",t)}return!0}function mv(){const e=window.getSelection();return e?.rangeCount?sf(e.getRangeAt(0),"backward"):null}function pM(e,t=ar){const n=e.isConnected?e:mv();if(!n)return;const r=n.closest('[contenteditable="true"]');Mt(()=>r?.focus({preventScroll:!0})),Sl(n,"after",t)}var hv=Symbol("held-input-replay"),pv={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"},gv={deleteWordBackward:["backward","word"],deleteWordForward:["forward","word"],deleteSoftLineBackward:["backward","lineboundary"],deleteSoftLineForward:["forward","lineboundary"],deleteHardLineBackward:["backward","paragraphboundary"],deleteHardLineForward:["forward","paragraphboundary"]};function gM(e){return e in pv||e in gv}var bM={Backspace:["deleteContentBackward","deleteWordBackward","deleteSoftLineBackward"],Delete:["deleteContentForward","deleteWordForward","deleteSoftLineForward"]},bv={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 uf(){return/Mac/.test(window.navigator.platform)}function yv(e){return uf()?e.altKey:e.ctrlKey}function yM(e){const t=e.ctrlKey||e.metaKey;return t&&/^[cxv]$/i.test(e.key)||e.key==="Insert"&&(t||e.shiftKey)}function vM(e){return e.key in bv||(e.ctrlKey||e.metaKey)&&e.key.length===1&&!yM(e)}function df(e){return hv in e}function ff(e){return e.target?.closest?.('[contenteditable="true"], editor')??void 0}function vv(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=bM[e.key];if(t)return uf()&&e.metaKey?t[2]:yv(e)?t[1]:t[0]}function EM(e){const t=bv[e.key];if(!t)return;const n=uf()&&e.metaKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")?"lineboundary":yv(e)?t[2]:t[1];document.getSelection()?.modify?.(e.shiftKey?"extend":"move",t[0],n)}function mf(e){return Object.defineProperty(e,hv,{value:!0}),e}function Ev(e,t){return e.isConnected&&t<=(e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length)}function Sv(e){if(!Ev(e.startContainer,e.startOffset)||!Ev(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 SM(e,t){return t===void 0||Sv(e)!==t?!1:(document.getSelection()?.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),!0)}function wM({inputType:e,data:t}){const n=gv[e];if(n){const o=document.getSelection();o?.isCollapsed&&o.modify?.("extend",n[0],n[1]),sr(n[0]==="backward"?"delete":"forwardDelete");return}const r=pv[e];r&&sr(r,!1,t??void 0)}function wv(e,t){if(t.target&&!SM(t.target,t.targetText))return;const{inputType:n,data:r}=t,o=mf(new window.InputEvent("beforeinput",{inputType:n,data:r,bubbles:!0,cancelable:!0}));e.dispatchEvent(o)&&wM(t)}function _M(e,t){const n=mf(new window.KeyboardEvent("keydown",{...t,bubbles:!0,cancelable:!0}));if(Object.defineProperty(n,"keyCode",{value:t.keyCode}),!e.dispatchEvent(n))return;const r=vv(t);r?wv(e,{inputType:r,data:r==="insertText"?t.key:null}):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a"?sr("selectAll"):EM(t)}var CM='[contenteditable="true"], editor';function hf(e){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement)?.closest(CM)??void 0}function TM(){const e=document.getSelection();if(!e?.rangeCount||!e.anchorNode||!e.focusNode||!ct())return;const t=ot(),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 _v(e){e?.anchor.release(),e?.focus.release()}function Cv({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&&!!hf(e)&&!n&&!t?.closest("em-replace, [data-em-caret]")}function Tv(e){const t=e.current(),n=t===void 0||!ct()?void 0:ot().offsetToPoint(t);return n&&Cv(n)?n:void 0}function AM(e){const t=e&&Tv(e.anchor),n=e&&Tv(e.focus);if(!(!t||!n))return document.getSelection()?.setBaseAndExtent(t.node,t.offset,n.node,n.offset),hf(t.node)}function kM(){const e=document.getSelection(),t=e?.rangeCount?e.anchorNode:null;return t&&Cv({node:t})?hf(t):void 0}function LM(e){const t=AM(e)??kM();return t}function wl(e,t){const n=TM(),r=e(()=>{ct()&&ot().flushCommit();const o=LM(n);_v(n),o&&t(o)});return r||_v(n),r}function pf(e){e.preventDefault(),e.stopImmediatePropagation()}function NM(e){return/^(Tab|Escape|PageUp|PageDown|F\d{1,2})$/.test(e.key)||e.key==="Enter"&&(e.ctrlKey||e.metaKey)}var Av=e=>{if(!ff(e)||df(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=>_M(u,l);vv(l)?Xd()&&wl(Gd,c)&&pf(e):vM(l)?jy()&&wl(zy,c)&&pf(e):NM(l)&&jy()&&Vy()},kv=()=>{Vy()},Lv=e=>{if(!ff(e)||!gM(e.inputType)||e.isComposing||df(e)||!Xd())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&&Sv(n)};wl(Gd,o=>wv(o,r))&&pf(e)};function xM(e){return"clipboardData"in e?e.clipboardData:e.dataTransfer}var OM=["text/html","text/plain"];function RM(e,t){const n=Array.from(t.types??[]),r=Object.fromEntries(OM.filter(o=>n.includes(o)).map(o=>[o,t.getData(o)]));return mf({target:e.target,clipboardData:{types:Object.keys(r),files:[],getData:o=>r[o]??""},preventDefault:()=>{},stopPropagation:()=>{}})}function MM(e,t){if(df(e)||!Xd()||!ff(e))return!1;try{const n=xM(e);if(!n||n.files?.length)return!1;const r=RM(e,n);if(!wl(Gd,()=>t(r)))return!1}catch{return e.preventDefault(),!1}return e.preventDefault(),e.stopPropagation(),!0}function PM(){return window.addEventListener("keydown",Av,!0),window.addEventListener("beforeinput",Lv,!0),window.addEventListener("pointerdown",kv,!0),{dispose(){window.removeEventListener("keydown",Av,!0),window.removeEventListener("beforeinput",Lv,!0),window.removeEventListener("pointerdown",kv,!0)}}}function IM(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 Nv(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 DM(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 BM(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 HM(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 FM(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 $M(e,t=10){const n=e.length;return n===0?!1:(e.match(/[а-яА-ЯёЁ]/g)||[]).length/n*100>t}var WM={bold:"strong|s|b",italic:"em|i",strike:"strike",underline:"u",strikeUnderline:"strike|u"};function ps(e,t){const n=WM[t]||t,r=new RegExp(`<\\/?(${n})>`,"gi");return e.replaceAll(r,"")}var qM=["strong","em","strike","sub","sup","b","i","s","u"];function zM(e,t){if(t)for(const n of qM)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 UM(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 JJ="#1C52DC",eee="#1C52DC",tee="#1C52DC";function jM(e){if(typeof e.isContentEditable=="boolean")return e.isContentEditable;const t=e.closest("[contenteditable]");return!!t&&t.getAttribute("contenteditable")!=="false"}function xv(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 VM(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||!jM(o))return;const{display:i}=getComputedStyle(r);if(!(i&&i!=="inline")){if(!xv(r,t,n,!0))e.setStartAfter(r);else if(!xv(r,t,n,!1))e.setStartBefore(r);else return;e.collapse(!0)}}var GM="./js/sanitize-html/sanitize-html.js",Ov="data-sanitize-html-loader",_l=null,gs=null;function Rv(){return typeof __emailmaker__<"u"?__emailmaker__:void 0}function XM(e){const t=Rv();if(typeof t?.moduleTransport!="function"||t.blobBlocked)return null;try{return t.moduleTransport(e)}catch{return null}}function KM(){const e=Rv();e&&(e.blobBlocked=!0)}function YM(){return new URL(GM,document.baseURI||window.location.href).href}function gf(){const e=globalThis.sanitizeHtml;return typeof e!="function"||!("defaults"in e)?null:e}function ZM(){if(gf())return Promise.resolve();const e=YM();return document.querySelector(`script[${Ov}]`)?gs??Promise.resolve():(gs||(gs=QM(e).catch(t=>{throw gs=null,t})),gs)}async function QM(e){const t=XM(e);if(!t)return Cl(e);const n=await t.catch(()=>null);if(!n)return Cl(e);const r=URL.createObjectURL(n),o=await Cl(r).then(()=>!0,()=>!1);URL.revokeObjectURL(r),o||(KM(),await Cl(e))}function Cl(e){return new Promise((t,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,r.setAttribute(Ov,"true"),r.onload=()=>t(),r.onerror=()=>{r.remove(),n(new Error(`Failed to load sanitize-html script: ${e}`))},document.head.appendChild(r)})}async function Mv(){const e=gf();return e||(_l||(_l=(async()=>{await ZM();const t=gf();if(t)return t;throw new Error("sanitizeHtml not available after script load")})().catch(t=>{throw _l=null,t})),_l)}function Tl(e){return e?.nodeType===Node.TEXT_NODE}function JM(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 Pv(e,t,n,r){const o=JM(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 Iv(e,t,n,r){return e.node===t&&e.offset>n?{...e,offset:e.offset-r}:e}function bf(e,t,n=()=>"letter"){const r=e?.previousSibling,o=t?.nextSibling,i=Tl(r)&&n(r)==="letter",s=i&&Tl(e),a=Tl(t)&&Tl(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 y=c;y;y=y===u?null:y.nextSibling)d.push(y);const m=c.parentNode,h=Array.prototype.indexOf.call(m?.childNodes??[],u),f={node:l?.anchorNode??null,offset:l?.anchorOffset??0},g={node:l?.focusNode??null,offset:l?.focusOffset??0},E=Pv(d,c,f.node,f.offset),w=Pv(d,c,g.node,g.offset);let T=null,L=0;for(let y=c;y;){const p=y===u?null:y.nextSibling;y.nodeType!==Node.TEXT_NODE?T=null:T?(T.appendData(y.data),y.parentNode?.removeChild(y),L++):T=y,y=p}if(l&&(E||w)){const y=E?{node:E.head,offset:E.offset}:Iv(f,m,h,L),p=w?{node:w.head,offset:w.offset}:Iv(g,m,h,L);y.node&&p.node&&l.setBaseAndExtent(y.node,y.offset,p.node,p.offset)}}var eP=["strong","em","i","a","br","span","ul","ol","li","strike","sub","sup","s"],tP={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 nP(e){const t=/^\s*(\d+(?:\.\d+)?)(px|pt|em)?\s*$/i.exec(e??"");return t?`${t[1]}${(t[2]||"px").toLowerCase()}`:null}var rP=/<span\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,oP=/\sdata-(?:buffer|metadata)=(?:"[^"]*"|'[^']*')/gi;function iP(e){return e.replace(rP,t=>t.replace(oP,""))}function sP(e){const t=window.clipboardData;return("clipboardData"in e?e.clipboardData:e.dataTransfer)||t}function aP(e){return lP(e.replace(/\r\n?/g,`
|
|
30
|
+
`,d=m.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=m.URL;continue}continue}if(d===m.URL&&l===")"&&a.charAt(a.length-1!=="\\")){a+=l,d=m.Expression;continue}a+=l}return a=s.join("")+a,a}window.cssbeautify=e})();function VO(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 GO=["transform","transform-origin","overflow-x","height"];function XO(e,t){return!(e>0)||!(t>0)||e<=t?1:t/e}function ls(e,t){const n=t<1?`scale(${t})`:"";if(e.style.transform===n)return!1;for(const r of GO)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 KO(e,t){const n=e,r=n?.querySelector("table:first-child"),o=Math.max(n?.offsetWidth??0,r?.offsetWidth??0);return o>0?o:(ls(t,1),t.scrollWidth)}function YO(e,t=window){const n=t.document.documentElement,r=n.style.transform,o=XO(KO(e,n),t.innerWidth);return ls(n,o),n.style.transform!==r&&t.parentIFrame?.size?.(),o}function ZO(e,t){ls(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;ls(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 lt(e){const t=R(e,Te);return n=>{t.commit(n)}}function ot(){return R(Rt,K)}function QO(){return R(Rt,_t)}function JO(){return R(Rt,mn)}function ct(){return Rt.getInstance(K)!==void 0}function qo(e){R(Rt,Te).commit(e)}function eR(e){if(!ct())return e(),Promise.resolve(!0);const t=ot();return t.commit(!1),t.flushCommit(),t.sendAfterCurrentEdits(e)}function tR(){if(!ct())return!1;const e=ot();return e.commit(!1),e.flushCommit(),e.hasEditsAfterBoundary()}function nR(){return ct()?ot().markHistoryAction():void 0}function rR(e){ct()&&ot().noteHistoryActionSent(e)}function Gd(e){return ct()&&ot().holdInput(e)}function zy(e){return ct()&&ot().holdInputBehindQueued(e)}function Uy(){ct()&&ot().closeUndoStep()}function Xd(){return ct()&&ot().isHoldingInput()}function jy(){return ct()&&ot().hasHeldInput()}function Vy(){ct()&&ot().releaseHeldInput()}function Gy(){return ct()&&ot().holdsTypedEdits()}function cs(e){return ct()?ot().renderOnly(e):e()}function hl(e){return e.nodeType===1&&e.localName==="template"&&e.namespaceURI==="http://www.w3.org/1999/xhtml"}function Kd(e){return[...e.querySelectorAll?.("template")??[]].filter(hl)}function oR(e){return hl(e)||Kd(e).length>0}function nn(e){const t=[...hl(e)?[e]:[],...Kd(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)nn(r)}}function zo(e){const t=[...hl(e)?[e]:[],...Kd(e)];for(const n of t)for(;n.firstChild;)n.content.appendChild(n.firstChild)}function jt(){return ct()?ot():void 0}function Mt(e){const t=jt();return t?t.applyHidden(e):e()}function Ie(e,t,...n){e&&Mt(()=>t?e.classList.add(...n):e.classList.remove(...n))}function eo(e){const t=document.activeElement;t instanceof HTMLElement&&t!==document.body&&e.contains(t)&&Mt(()=>t.blur())}function Yd(e){jt()?.ownership.markService(e)}function Xy(e){jt()?.ownership.markWrapper(e)}function iR(e){jt()?.ownership.markOuterWrapper(e)}function us(e,t){e.removeAllRanges(),Mt(()=>e.addRange(t))}function pl(e){const t=document.implementation.createHTMLDocument("").importNode(e,!0);en(e,t);const n=new Map([[e,t]]),r=jt()?.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 gl(e){return hg(pl(e).copy)}function ze(e){return ik(pl(e).copy)}function ds(e){const t=jt();return t?(t.flushCommit(),t.getOuterHtml(e)):e.outerHTML}function Zd(e){return Ky(e)}function Ky(e){const t=jt();return!t||t.isInLetter(e)||!t.isUntracked(e)&&!t.ownership.isService(e)}function Qd(e){const t=jt();return t?t.ownership.markOf(e)?"foreign":t.isInLetter(e)?"letter":t.isBehindHidden(e)?"foreign":"new":"letter"}function Jd(e,t){const n=[...e.querySelectorAll(t)].filter(Zd);return n[n.length-1]??null}function Yy(e,t){const n=o=>t==="next"?o.nextElementSibling:o.previousElementSibling;let r=n(e);for(;r&&!Zd(r);)r=n(r);return r}function Zy(e,t){return[...e.childNodes].flatMap(n=>t.isInLetter(n)?[n]:Zy(n,t))}function ef(e){eo(e);const t=jt();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(...Zy(r,t))}function sR(e){const t=[...e.childNodes],n=jt();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 aR(){const e=jt();return e?{...e.scriptRunner,awake:()=>e.recordNow()}:{run:(t,n)=>n(),quiet:t=>t()}}function or(e,t){const n=Re(e,"dormant"),r=Cg(n);try{return t(n)}finally{Og(r,aR())}}function Qy(e,t,n){or(n,r=>Ha(e,t,r))}function fs(e,t,n){return e==="new"?or(t,n):n(Re(t,!0))}function ir(e,t,n,r){fs(e,r,o=>Ha(t,n,o))}function mt(e){return function(...t){const n=jt(),r=()=>Reflect.apply(e,this,t);return n?n.applyOwn(r):r()}}function sr(e,t=!1,n){const r=()=>document.execCommand(e,t,n),o=jt();return o?o.applyCommand(r):r()}function Jy(e){const t=()=>{Ie(document.body,e,"mceNonEditable"),document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable",e?"false":"true")})};ct()?ot().applyHidden(t):t()}function lR(){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=lR();function cR(e){return{dispose:e.onIntegratorChange(()=>Jy(e.isTextLocked()))}}function uR(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 nf(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)=>nf(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)&&nf(e[i],t[i]))}function ev(e,t){const n={watch(r){let o,i=!1;return e.watch(s=>{const a=t(s);i&&nf(o,a)||(o=a,i=!0,r(a))})},select(r){return ev(n,r)}};return n}function tv(...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 ev(o,i)}};return o}var bl={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},ms=tv({...bl});function Pn(){return ms.get()}var yl=new he,Uo=new Map,U={source:ms,get(e){return Pn()[e]},getState(){return{...Pn()}},getStateRef(){return Pn()},set(e,t){if(Pn()[e]===t)return;ms.set({...Pn(),[e]:t}),yl.fire({[e]:t});const n=Uo.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(Pn()[r]!==o){ms.set({...Pn(),[r]:o}),n[r]=o,t=!0;const i=Uo.get(r);i&&i.forEach(s=>s(o))}}t&&yl.fire(n)},increment(e,t=1){const n=Pn()[e];typeof n=="number"&&U.set(e,n+t)},decrement(e,t=1){const n=Pn()[e];typeof n=="number"&&U.set(e,n-t)},subscribe(e){return yl.event(e)},subscribeToKey(e,t){Uo.has(e)||Uo.set(e,new Set);const n=Uo.get(e),r=t;return n.add(r),()=>{n.delete(r),n.size===0&&Uo.delete(e)}},reset(){ms.set({...bl}),yl.fire(Pn())},resetKey(e){this.set(e,bl[e])},getInitialState(){return bl}};function dR(e,t){const n=tv(),r=e.addListener(t,o=>n.set(o));return{source:n,dispose:()=>r.dispose()}}var fR=["copyPasteEnabled","saveBlockEnabled","editImageControlEnabled","elementAIimageEnabled","imageCenterStockEnabled","imageCenterGifEnabled","imageCenterEditorEnabled","blocksAddPanelEnabled"];function mR(e){const t="33f5584d";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 hR={name:"sandbox.hostFacts",provides:[Oo],setup(e){const t=Object.fromEntries(Object.entries(vL).map(([n,r])=>[n,dR(G,r).source]));e.inject(Oo,t)}},pR={name:"sandbox.hostFactsToState",awaits:{services:[Oo,Te,K,nt]},setup(e){const t=R(e,Oo),n=lt(e),r=R(e,nt);t.theme.watch(o=>{U.set("applicationTheme",o),mR(o),n(!1)}),t.commonStyles.watch(o=>{o&&U.set("commonStyles",o)}),t.flags.watch(o=>{for(const i of fR)typeof o[i]<"u"&&U.set(i,o[i])}),cR(r),uR(R(e,K),r),t.lockEditor.watch(o=>r.setIntegrator(o)),t.codeMode.watch(o=>U.set("codeMode",o)),t.appName.watch(o=>U.set("appName",o)),t.previewPage.watch(o=>{U.set("previewPage",o),Ie(document.body,!!o,"em-sandbox-preview")})}},gR={name:"sandbox.viewport",awaits:{services:[Oo]},setup(e){R(e,Oo).viewport.watch(t=>VO(t,void 0,{state:U,previewHeight:t.previewHeight,iframeOffsetTop:t.iframeOffsetTop,scrollTop:t.scrollTop,globalHolder:U.get("globalHolder"),setBlockGroupControlsPosition:()=>e.getServices(jg).forEach(n=>n()),messageService:G}))}};function Cr(e){for(const t of document.querySelectorAll(`[${e}]`))t.removeAttribute(e)}function At(e,t,n=!1){for(const r of e.querySelectorAll(t))n||!r.childNodes.length?r.remove():r.replaceWith(...r.childNodes)}function bR(e,t){if(e.data.value)document.querySelectorAll("editor").forEach(n=>{n.setAttribute("contenteditable","false")}),Ie(document.body,!0,"em-sandbox-discuss");else{const n=t.editLock.isTextLocked()?"false":"true";document.querySelectorAll("editor").forEach(r=>{r.setAttribute("contenteditable",n)}),Ie(document.body,!1,"em-sandbox-discuss","em-sandbox-discuss_set-target")}}function yR(e,t){Ie(document.body,!!e.data.value,"em-sandbox-discuss_set-target")}function vR(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}}),Ie(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 ER(e,t){Ie(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 SR(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 wR={sandbox_lock_discuss:bR,sandbox_discuss_set_target:yR,sandbox_discuss_remove_target:vR,sandbox_discuss_reset:ER,sandbox_discuss_get_target:SR};function _R(e,t){t.editLock.setApp(!!e.data.data),Jy(t.editLock.isTextLocked())}function CR(e,t){t.setEditorFocus(e.data.data)}function TR(e,t){let n=e.data.data;if(typeof n!="number")return;n=QO().correctOffset(n,!0),n=JO().correctOffset(n,!0);let r=ot().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-U.get("previewHeight")/2+i.height/2;t.messageService.send({operation:"application_scroll-to",settings:{value:U.get("applicationMode")==="default"?s+U.get("iframeOffsetTop"):s}})}var AR={sandbox_lock_edit:_R,editor_change_focus:CR,update_position_from_editor:TR};function kR(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 LR(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 NR(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 xR(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 OR={sandbox_set_attr_to_images:kR,sandbox_set_attr_to_links:LR,sandbox_set_position_to_img:NR,sandbox_set_position_to_link:xR},RR={brightness:100,contrast:100,sepia:0},vl={DARK:"dark",LIGHT:"light"},nv=!1;function MR(e){nv||(e.setFetchMethod(t=>window.fetch(t)),nv=!0)}function PR(){let e=null,t=vl.LIGHT;return{set(n){if(t=n,n===vl.DARK){e??(e=Wd(()=>Promise.resolve().then(()=>Iu("./darkreader.CLd5EML2.js")),void 0,{}.url)),e.then(r=>{t===vl.DARK&&(MR(r),r.enable(RR))}).catch(r=>{e=null});return}e?.then(r=>{t===vl.LIGHT&&r.disable()})},clear(n){return n.replaceAll(/\s*?--darkreader.+?: .*?;/g,"")}}}var El=PR();function IR(e,t){t.initPreview(!0)}function DR(e){const t=e.data?.data?.theme;(t==="light"||t==="dark")&&El.set(t)}var BR={init_preview:IR,sandbox_switch_theme:DR};function bn(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(Vg,{owner:e,handlers:s})}}}var HR={name:"sandbox.operationEnvironment",provides:[Sr],setup(e){const t={iframeOffsetTop:0,previewHeight:0,elementPath:[]};U.subscribe(n=>{for(const r of["iframeOffsetTop","previewHeight","elementPath"])r in n&&n[r]!==void 0&&Object.assign(t,{[r]:n[r]})}),e.inject(Sr,t)}},FR=bn("discuss",wR,{services:[Te,Sr,nt]},e=>{const t=lt(e),n=R(e,Sr),r=R(e,nt);return()=>({commit:t,editLock:r,iframeOffsetTop:n.iframeOffsetTop,previewHeight:n.previewHeight,messageService:G,removeAllAttributes:Cr})}),$R=bn("editor",AR,{services:[He,ft,nt]},e=>{const t=R(e,He),n=R(e,ft),r=R(e,nt);return()=>({applicationElementSettingsSet:t,editLock:r,messageService:G,setEditorFocus:o=>n.setEditorFocus(o)})}),WR=bn("images",OR,{services:[He,Ot,Te,Sr]},e=>{const t=R(e,He),n=R(e,Ot),r=lt(e),o=R(e,Sr);return()=>({applicationElementSettingsSet:t,commit:r,iframeOffsetTop:o.iframeOffsetTop,previewHeight:o.previewHeight,messageService:G,setCursorPosition:i=>n(i)})}),qR=bn("preview",BR,{services:[Ki]},e=>()=>({initPreview:t=>R(e,Ki)(t)})),zR={name:"sandbox.operationsDispatcher",setup(e){G.addListener(t=>{const n=t.data?.operation;if(!n)return;const r=e.getServices(Vg).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)}})}},UR=[HR,FR,$R,WR,qR,zR],jR=["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"],VR=["style","class","align","href"],GR=new Set([...jR,"em-element-path_img"]);function XR(e){return e.split(/\s+/).filter(t=>t&&!GR.has(t)).join(" ")}var KR=32;function YR(e){return!!(e.tagName==="BODY"||e.getAttribute("em")==="atom"||e.tagName==="TABLE"&&e.hasAttribute("em"))}function ZR(e){const t=[e.tagName];for(const n of VR){const r=e.getAttribute(n),o=n==="class"&&r!==null?XR(r):r;o!==null&&o!==""&&t.push(`${n}=${o}`)}return t.join("|")}function QR(e){if(!e||!e.isConnected)return"";const t=[];let n=e,r=0;for(;n&&r<KR&&(t.push(ZR(n)),!YR(n));)n=n.parentElement,r++;return t.join("||")}function JR(e){let t={text:"",ancestors:""};const n=r=>({text:r?e(r):"",ancestors:QR(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 eM(e,t){t.onReleased(()=>{Promise.resolve().then(()=>{t.isLocked()||e.remember(document.querySelector("[em-edit]"))})})}var rv=Promise.resolve(),ov=null;function tM(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 nM(e,t){ov=e,rv=rv.finally(()=>{ov===e&&tM(e,t)})}function rM(e,t="unknown"){const n=Rt.getInstance(ft);if(!n){e();return}n.controller.whenEditorLostFocus(e,t)}function oM(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 iM(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 ZJ="br, img, em-replace, table, hr, input, button, video, audio, svg, picture, canvas, iframe, object",hs="data-em-caret",QJ="",ar=e=>e();function Pt(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.hasAttribute("data-em-caret")}function to(e){return!!e&&e.nodeType===Node.ELEMENT_NODE&&e.tagName==="EM-REPLACE"&&!e.hasAttribute("src")}function Tr(e){return(e??"").replaceAll("","")}function rf(e){return Tr(e.textContent)}function sM(e){return(e.nodeType===Node.TEXT_NODE||Pt(e))&&Tr(e.textContent)===""}function of(e,t){const n=document.createRange();n.setStart(e,t),n.collapse(!0);const r=window.getSelection();r&&us(r,n)}function iv(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(!to(r))return null;const o=document.createRange();if(o.selectNodeContents(r),o.setEnd(t,n),Tr(o.toString())==="")return{em:r,side:"before"};const i=document.createRange();return i.selectNodeContents(r),i.setStart(t,n),Tr(i.toString())===""?{em:r,side:"after"}:null}function sf(e,t){if(!e.collapsed)return null;const n=iv(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(Tr(t==="backward"?s.slice(0,o):s.slice(o))!=="")return null;const a=r.parentNode,l=Pt(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&&sM(i);)i=t==="backward"?i.previousSibling:i.nextSibling;return to(i)?i:null}function Sl(e,t,n=ar){return af(e,t,n)}function af(e,t,n=ar){const r=t==="after"?e.nextSibling:e.previousSibling;let o;if(Pt(r))o=r;else{const s=document.createElement("span");s.setAttribute(hs,""),Yd(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 of(i,i.length),o}var aM="p, div, li, td, th, h1, h2, h3, h4, h5, h6, blockquote";function lf(e,t=ar,n=e.parentElement?.closest('[contenteditable="true"]')){sv(e,n)&&af(e,"after",t)}function sv(e,t){if(!t)return!1;const n=e.parentElement?.closest(aM),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(`[${hs}]`).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 av(e){const t=Pt(e)&&rf(e)===""?e.previousSibling:null;return t?.nodeName==="BR"&&sv(t,t.parentElement?.closest('[contenteditable="true"]'))}function cf(e,t=ar){if(!av(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&&of(i,Array.prototype.indexOf.call(i.childNodes,o)),o}function lv(){const e=window.getSelection(),t=e?.rangeCount?e.getRangeAt(0):null,n=t?.collapsed?t.startContainer:null,r=Pt(n)?n:n?.parentNode;return av(r)?r:null}function lM(e,t=ar,n){return Array.from(e.querySelectorAll(`[${hs}]`)).filter(r=>r!==n).map(r=>cf(r,t)).some(Boolean)}function cM(e,t=ar,n){const r=Array.from(e.querySelectorAll(`[${hs}]`)).filter(o=>o!==n&&Tr(o.textContent)==="");r.length&&t(()=>r.forEach(o=>o.remove()))}function uM(e,t=ar){const n=Tr(e.textContent);if(n==="")return null;const r=document.createTextNode(n);return e.before(r),t(()=>e.remove()),of(r,r.length),r}function cv(e){if(!e.collapsed)return;const{startContainer:t}=e,n=Pt(t)?t:t.parentNode;Pt(n)&&(to(n.previousSibling)?e.setStartAfter(n):e.setStartBefore(n),e.collapse(!0))}function uv(e){e.querySelectorAll(`[${hs}]`).forEach(t=>{const n=Tr(t.textContent);n===""?t.remove():t.replaceWith(t.ownerDocument.createTextNode(n))})}function dM(e,t){const n=sf(e,t);if(!n)return null;const r=document.createRange();r.selectNode(n);const o=window.getSelection();return o&&us(o,r),n}function fM(e,t){const n=Array.from(e.querySelectorAll("em-replace")).find(i=>to(i)&&t.intersectsNode(i)&&!dv(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 dv(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 mM(){document.execCommand("delete")}function hM(){const e=window.getSelection()?.getRangeAt(0);e?.deleteContents(),e?.collapse(!0)}function fv(e,t=ar,n=mM){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=>to(l)&&dv(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;to(l)?Sl(l,"after",t):!l&&to(c)&&Sl(c,"before",t)}return!0}function mv(){const e=window.getSelection();return e?.rangeCount?sf(e.getRangeAt(0),"backward"):null}function pM(e,t=ar){const n=e.isConnected?e:mv();if(!n)return;const r=n.closest('[contenteditable="true"]');Mt(()=>r?.focus({preventScroll:!0})),Sl(n,"after",t)}var hv=Symbol("held-input-replay"),pv={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"},gv={deleteWordBackward:["backward","word"],deleteWordForward:["forward","word"],deleteSoftLineBackward:["backward","lineboundary"],deleteSoftLineForward:["forward","lineboundary"],deleteHardLineBackward:["backward","paragraphboundary"],deleteHardLineForward:["forward","paragraphboundary"]};function gM(e){return e in pv||e in gv}var bM={Backspace:["deleteContentBackward","deleteWordBackward","deleteSoftLineBackward"],Delete:["deleteContentForward","deleteWordForward","deleteSoftLineForward"]},bv={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 uf(){return/Mac/.test(window.navigator.platform)}function yv(e){return uf()?e.altKey:e.ctrlKey}function yM(e){const t=e.ctrlKey||e.metaKey;return t&&/^[cxv]$/i.test(e.key)||e.key==="Insert"&&(t||e.shiftKey)}function vM(e){return e.key in bv||(e.ctrlKey||e.metaKey)&&e.key.length===1&&!yM(e)}function df(e){return hv in e}function ff(e){return e.target?.closest?.('[contenteditable="true"], editor')??void 0}function vv(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=bM[e.key];if(t)return uf()&&e.metaKey?t[2]:yv(e)?t[1]:t[0]}function EM(e){const t=bv[e.key];if(!t)return;const n=uf()&&e.metaKey&&(e.key==="ArrowLeft"||e.key==="ArrowRight")?"lineboundary":yv(e)?t[2]:t[1];document.getSelection()?.modify?.(e.shiftKey?"extend":"move",t[0],n)}function mf(e){return Object.defineProperty(e,hv,{value:!0}),e}function Ev(e,t){return e.isConnected&&t<=(e.nodeType===Node.TEXT_NODE?e.length:e.childNodes.length)}function Sv(e){if(!Ev(e.startContainer,e.startOffset)||!Ev(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 SM(e,t){return t===void 0||Sv(e)!==t?!1:(document.getSelection()?.setBaseAndExtent(e.startContainer,e.startOffset,e.endContainer,e.endOffset),!0)}function wM({inputType:e,data:t}){const n=gv[e];if(n){const o=document.getSelection();o?.isCollapsed&&o.modify?.("extend",n[0],n[1]),sr(n[0]==="backward"?"delete":"forwardDelete");return}const r=pv[e];r&&sr(r,!1,t??void 0)}function wv(e,t){if(t.target&&!SM(t.target,t.targetText))return;const{inputType:n,data:r}=t,o=mf(new window.InputEvent("beforeinput",{inputType:n,data:r,bubbles:!0,cancelable:!0}));e.dispatchEvent(o)&&wM(t)}function _M(e,t){const n=mf(new window.KeyboardEvent("keydown",{...t,bubbles:!0,cancelable:!0}));if(Object.defineProperty(n,"keyCode",{value:t.keyCode}),!e.dispatchEvent(n))return;const r=vv(t);r?wv(e,{inputType:r,data:r==="insertText"?t.key:null}):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()==="a"?sr("selectAll"):EM(t)}var CM='[contenteditable="true"], editor';function hf(e){return(e?.nodeType===Node.ELEMENT_NODE?e:e?.parentElement)?.closest(CM)??void 0}function TM(){const e=document.getSelection();if(!e?.rangeCount||!e.anchorNode||!e.focusNode||!ct())return;const t=ot(),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 _v(e){e?.anchor.release(),e?.focus.release()}function Cv({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&&!!hf(e)&&!n&&!t?.closest("em-replace, [data-em-caret]")}function Tv(e){const t=e.current(),n=t===void 0||!ct()?void 0:ot().offsetToPoint(t);return n&&Cv(n)?n:void 0}function AM(e){const t=e&&Tv(e.anchor),n=e&&Tv(e.focus);if(!(!t||!n))return document.getSelection()?.setBaseAndExtent(t.node,t.offset,n.node,n.offset),hf(t.node)}function kM(){const e=document.getSelection(),t=e?.rangeCount?e.anchorNode:null;return t&&Cv({node:t})?hf(t):void 0}function LM(e){const t=AM(e)??kM();return t}function wl(e,t){const n=TM(),r=e(()=>{ct()&&ot().flushCommit();const o=LM(n);_v(n),o&&t(o)});return r||_v(n),r}function pf(e){e.preventDefault(),e.stopImmediatePropagation()}function NM(e){return/^(Tab|Escape|PageUp|PageDown|F\d{1,2})$/.test(e.key)||e.key==="Enter"&&(e.ctrlKey||e.metaKey)}var Av=e=>{if(!ff(e)||df(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=>_M(u,l);vv(l)?Xd()&&wl(Gd,c)&&pf(e):vM(l)?jy()&&wl(zy,c)&&pf(e):NM(l)&&jy()&&Vy()},kv=()=>{Vy()},Lv=e=>{if(!ff(e)||!gM(e.inputType)||e.isComposing||df(e)||!Xd())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&&Sv(n)};wl(Gd,o=>wv(o,r))&&pf(e)};function xM(e){return"clipboardData"in e?e.clipboardData:e.dataTransfer}var OM=["text/html","text/plain"];function RM(e,t){const n=Array.from(t.types??[]),r=Object.fromEntries(OM.filter(o=>n.includes(o)).map(o=>[o,t.getData(o)]));return mf({target:e.target,clipboardData:{types:Object.keys(r),files:[],getData:o=>r[o]??""},preventDefault:()=>{},stopPropagation:()=>{}})}function MM(e,t){if(df(e)||!Xd()||!ff(e))return!1;try{const n=xM(e);if(!n||n.files?.length)return!1;const r=RM(e,n);if(!wl(Gd,()=>t(r)))return!1}catch{return e.preventDefault(),!1}return e.preventDefault(),e.stopPropagation(),!0}function PM(){return window.addEventListener("keydown",Av,!0),window.addEventListener("beforeinput",Lv,!0),window.addEventListener("pointerdown",kv,!0),{dispose(){window.removeEventListener("keydown",Av,!0),window.removeEventListener("beforeinput",Lv,!0),window.removeEventListener("pointerdown",kv,!0)}}}function IM(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 Nv(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 DM(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 BM(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 HM(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 FM(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 $M(e,t=10){const n=e.length;return n===0?!1:(e.match(/[а-яА-ЯёЁ]/g)||[]).length/n*100>t}var WM={bold:"strong|s|b",italic:"em|i",strike:"strike",underline:"u",strikeUnderline:"strike|u"};function ps(e,t){const n=WM[t]||t,r=new RegExp(`<\\/?(${n})>`,"gi");return e.replaceAll(r,"")}var qM=["strong","em","strike","sub","sup","b","i","s","u"];function zM(e,t){if(t)for(const n of qM)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 UM(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 JJ="#1C52DC",eee="#1C52DC",tee="#1C52DC";function jM(e){if(typeof e.isContentEditable=="boolean")return e.isContentEditable;const t=e.closest("[contenteditable]");return!!t&&t.getAttribute("contenteditable")!=="false"}function xv(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 VM(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||!jM(o))return;const{display:i}=getComputedStyle(r);if(!(i&&i!=="inline")){if(!xv(r,t,n,!0))e.setStartAfter(r);else if(!xv(r,t,n,!1))e.setStartBefore(r);else return;e.collapse(!0)}}var GM="./js/sanitize-html/sanitize-html.js",Ov="data-sanitize-html-loader",_l=null,gs=null;function Rv(){return typeof __emailmaker__<"u"?__emailmaker__:void 0}function XM(e){const t=Rv();if(typeof t?.moduleTransport!="function"||t.blobBlocked)return null;try{return t.moduleTransport(e)}catch{return null}}function KM(){const e=Rv();e&&(e.blobBlocked=!0)}function YM(){return new URL(GM,document.baseURI||window.location.href).href}function gf(){const e=globalThis.sanitizeHtml;return typeof e!="function"||!("defaults"in e)?null:e}function ZM(){if(gf())return Promise.resolve();const e=YM();return document.querySelector(`script[${Ov}]`)?gs??Promise.resolve():(gs||(gs=QM(e).catch(t=>{throw gs=null,t})),gs)}async function QM(e){const t=XM(e);if(!t)return Cl(e);const n=await t.catch(()=>null);if(!n)return Cl(e);const r=URL.createObjectURL(n),o=await Cl(r).then(()=>!0,()=>!1);URL.revokeObjectURL(r),o||(KM(),await Cl(e))}function Cl(e){return new Promise((t,n)=>{const r=document.createElement("script");r.src=e,r.async=!0,r.setAttribute(Ov,"true"),r.onload=()=>t(),r.onerror=()=>{r.remove(),n(new Error(`Failed to load sanitize-html script: ${e}`))},document.head.appendChild(r)})}async function Mv(){const e=gf();return e||(_l||(_l=(async()=>{await ZM();const t=gf();if(t)return t;throw new Error("sanitizeHtml not available after script load")})().catch(t=>{throw _l=null,t})),_l)}function Tl(e){return e?.nodeType===Node.TEXT_NODE}function JM(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 Pv(e,t,n,r){const o=JM(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 Iv(e,t,n,r){return e.node===t&&e.offset>n?{...e,offset:e.offset-r}:e}function bf(e,t,n=()=>"letter"){const r=e?.previousSibling,o=t?.nextSibling,i=Tl(r)&&n(r)==="letter",s=i&&Tl(e),a=Tl(t)&&Tl(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 y=c;y;y=y===u?null:y.nextSibling)d.push(y);const m=c.parentNode,h=Array.prototype.indexOf.call(m?.childNodes??[],u),f={node:l?.anchorNode??null,offset:l?.anchorOffset??0},g={node:l?.focusNode??null,offset:l?.focusOffset??0},E=Pv(d,c,f.node,f.offset),w=Pv(d,c,g.node,g.offset);let T=null,L=0;for(let y=c;y;){const p=y===u?null:y.nextSibling;y.nodeType!==Node.TEXT_NODE?T=null:T?(T.appendData(y.data),y.parentNode?.removeChild(y),L++):T=y,y=p}if(l&&(E||w)){const y=E?{node:E.head,offset:E.offset}:Iv(f,m,h,L),p=w?{node:w.head,offset:w.offset}:Iv(g,m,h,L);y.node&&p.node&&l.setBaseAndExtent(y.node,y.offset,p.node,p.offset)}}var eP=["strong","em","i","a","br","span","ul","ol","li","strike","sub","sup","s"],tP={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 nP(e){const t=/^\s*(\d+(?:\.\d+)?)(px|pt|em)?\s*$/i.exec(e??"");return t?`${t[1]}${(t[2]||"px").toLowerCase()}`:null}var rP=/<span\b(?:[^>"']|"[^"]*"|'[^']*')*>/gi,oP=/\sdata-(?:buffer|metadata)=(?:"[^"]*"|'[^']*')/gi;function iP(e){return e.replace(rP,t=>t.replace(oP,""))}function sP(e){const t=window.clipboardData;return("clipboardData"in e?e.clipboardData:e.dataTransfer)||t}function aP(e){return lP(e.replace(/\r\n?/g,`
|
|
31
31
|
`).replace(/\n$/,"").replace(/&/g,"&").replace(/\n/g,"<br>"))}function lP(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 Ar=new Map,cP=3e3,uP=1e4;function dP(){const e=performance.now();return[...Ar.values()].some(t=>t.waiting&&e-t.startedAt<uP)}function fP(){for(const[e,t]of Ar)t.waiting&&(t.superseded=!0,Ar.delete(e))}function mP(){return Ar.size>0}async function hP(){let e;const t=new Promise(r=>{e=setTimeout(()=>{r()},cP)}),n=(async()=>{for(;Ar.size;)await Promise.allSettled(Ar.keys())})();await Promise.race([n,t]),clearTimeout(e)}function Al(e,t=!1,n,r,o){if(MM(e,a=>{Al(a,t,n,r,o)}))return Promise.resolve();if(dP())return e.preventDefault(),e.stopPropagation(),Promise.resolve();fP();const i={startedAt:performance.now(),waiting:!0,superseded:!1},s=pP(e,t,n,r,o,i);return Ar.set(s,i),s.finally(()=>Ar.delete(s))}function Dv(){const e=window.getSelection();e?.rangeCount&&VM(e.getRangeAt(0))}async function pP(e,t,n,r,o,i){e.preventDefault(),e.stopPropagation();const s=sP(e);if(!s)return;const a=s.getData("text/html"),l=s.getData("text/plain");try{let c=a;if(!c||t)Dv(),c=aP(l);else{const d=await Mv();if(i.superseded)return;Dv();const m=n?.text?.fontSize||16;let h=d(iP(c),{allowedTags:eP,allowedAttributes:tP,allowedStyles:{},transformTags:{span:function(y,p){let v="",C=!1,b=!1;if(p.style){const S=p.style.toLowerCase();(S.includes("font-weight: bold")||S.includes("font-weight:bold")||S.includes("font-weight: 700")||S.includes("font-weight:700"))&&(C=!0),(S.includes("font-style: italic")||S.includes("font-style:italic"))&&(b=!0),S.includes("text-decoration: underline")||S.includes("text-decoration:underline"),C&&b?(v="strong",p["data-italic"]="true"):C?v="strong":b&&(v="em")}return{tagName:v||"",attribs:p}},h1:function(y,p){return p["data-font-size"]=Math.round(1.5*m).toString(),p.style&&(p.style.toLowerCase().includes("font-style: italic")||p.style.toLowerCase().includes("font-style:italic"))&&(p["data-italic"]="true"),{tagName:"span",attribs:p}},h2:function(y,p){return p["data-font-size"]=Math.round(1.25*m).toString(),p.style&&(p.style.toLowerCase().includes("font-style: italic")||p.style.toLowerCase().includes("font-style:italic"))&&(p["data-italic"]="true"),{tagName:"span",attribs:p}},h3:function(y,p){return p["data-font-size"]=Math.round(1.125*m).toString(),p.style&&(p.style.toLowerCase().includes("font-style: italic")||p.style.toLowerCase().includes("font-style:italic"))&&(p["data-italic"]="true"),{tagName:"span",attribs:p}},h4:function(y,p){return p["data-font-size"]=m.toString(),p["data-bold"]="true",p.style&&(p.style.toLowerCase().includes("font-style: italic")||p.style.toLowerCase().includes("font-style:italic"))&&(p["data-italic"]="true"),{tagName:"span",attribs:p}},h5:function(y,p){return p["data-font-size"]=Math.round(.875*m).toString(),p.style&&(p.style.toLowerCase().includes("font-style: italic")||p.style.toLowerCase().includes("font-style:italic"))&&(p["data-italic"]="true"),{tagName:"span",attribs:p}},ul:function(y,p){return p["data-list-type"]="unordered",delete p.style,delete p["margin-top"],delete p["margin-bottom"],delete p["padding-inline-start"],{tagName:"ul",attribs:p}},ol:function(y,p){return p["data-list-type"]="ordered",p.start&&(p["data-list-start"]=p.start),delete p.style,delete p.start,{tagName:"ol",attribs:p}},li:function(y,p){return p["data-list-item"]="true",delete p.style,delete p.dir,delete p["aria-level"],delete p["list-style-type"],{tagName:"li",attribs:p}},p:function(y,p){return{tagName:"br",attribs:{}}},div:"br",b:function(y,p){if(p.style){const v=p.style.toLowerCase();return v.includes("font-weight: bold")||v.includes("font-weight:bold")||v.includes("font-weight: 700")||v.includes("font-weight:700")?{tagName:"strong"}:!1}return{tagName:"strong"}},i:function(y,p){if(p.style){const v=p.style.toLowerCase();return v.includes("font-style: italic")||v.includes("font-style:italic")?{tagName:"em"}:!1}return{tagName:"em"}},s:function(y,p){return{tagName:"strike",attribs:p}}},textFilter:function(y){return y.replace(/\s+/g," ")}});h=h.replace(/<[^\/>][^>]*>\s*<\/[^>]+>/g,"").replace(/(<br\s*\/?>){2,}/g,"<br>").trim();const f=document.createElement("div");f.innerHTML=h,(y=>{y.querySelectorAll("ul[data-list-type], ol[data-list-type]").forEach((p,v)=>{const C=p.getAttribute("data-list-type")==="ordered",b=p.querySelectorAll("li[data-list-item]");let S=1;C&&p.getAttribute("data-list-start")&&(S=parseInt(p.getAttribute("data-list-start"),10)||1);const _=document.createDocumentFragment(),k=p.previousSibling;k&&(k.nodeType===Node.TEXT_NODE&&k.textContent.trim()!==""||k.nodeType===Node.ELEMENT_NODE&&k.tagName!=="BR")&&_.appendChild(document.createElement("br")),b.forEach((x,N)=>{const W=document.createElement("span");W.innerHTML=C?`${S}. `:"• ",_.appendChild(W),(P=>{const Q=document.createElement("div");Q.innerHTML=P.innerHTML;let te=Q.firstChild;for(;te&&te.nodeType===1&&te.tagName==="BR";)Q.removeChild(te),te=Q.firstChild;if(!Q.hasChildNodes()){const fe=document.createTextNode("");Q.appendChild(fe)}for(;Q.firstChild;)_.appendChild(Q.firstChild)})(x),N<b.length-1&&_.appendChild(document.createElement("br")),S++}),p.parentNode.replaceChild(_,p)}),y.querySelectorAll("[data-list-type], [data-list-item], [data-list-start]").forEach(p=>{p.removeAttribute("data-list-type"),p.removeAttribute("data-list-item"),p.removeAttribute("data-list-start")})})(f),f.firstChild&&f.firstChild.nodeType===Node.ELEMENT_NODE&&f.firstChild.tagName==="BR"&&f.removeChild(f.firstChild),f.querySelectorAll("[data-font-size]").forEach(y=>{const p=nP(y.getAttribute("data-font-size"));let v=p?`font-size: ${p};`:"";y.getAttribute("data-bold")==="true"&&(v+=" font-weight: bold;"),y.getAttribute("data-italic")==="true"&&(v+=" font-style: italic;"),v&&y.setAttribute("style",v.trim()),y.removeAttribute("data-font-size"),y.removeAttribute("data-bold"),y.removeAttribute("data-italic")}),f.querySelectorAll("[data-italic]").forEach(y=>{const p=document.createElement("em");p.innerHTML=y.innerHTML,y.innerHTML="",y.appendChild(p),y.removeAttribute("data-italic")}),f.querySelectorAll("a").forEach(y=>{const p=y.getAttribute("href");if(!p||p.trim()==="")y.replaceWith(...y.childNodes);else{y.setAttribute("target","_blank");const v=n?.links?.color??"#1C52DC",C=n?.links?.underline??!0?"underline":"none";y.setAttribute("style",`color: ${v}; text-decoration: ${C};`)}});const E=f.querySelectorAll("*");let w=0;E.forEach(y=>{y.tagName!=="BR"&&y.tagName!=="SPAN"&&y.textContent.replace(/[\u200B-\u200F\uFEFF\u2000-\u200A\u2028\u2029\u2060\u00A0\u1680\u180E]/g,"").trim()===""&&(y.parentNode.removeChild(y),w++)}),f.querySelectorAll("span").forEach(y=>{y.innerHTML==="• "||/^\d+\. $/.test(y.innerHTML)||y.textContent.replace(/[\u200B-\u200F\uFEFF\u2000-\u200A\u2028\u2029\u2060\u00A0\u1680\u180E]/g,"").trim()===""&&y.children.length===0&&(y.parentNode.removeChild(y),w++)});const T=window.getSelection(),L=T?.anchorNode?.nodeType===Node.ELEMENT_NODE?T.anchorNode:T?.anchorNode?.parentElement||null;zM(f,L),UM(f,L),c=f.innerHTML}const u=window.getSelection();if(u&&u.rangeCount>0){const d=u.getRangeAt(0);cv(d),d.deleteContents();const m=document.createRange().createContextualFragment(c),h=m.firstChild,f=m.lastChild;d.insertNode(m),f?.nodeType===Node.TEXT_NODE&&d.setEnd(f,f.length),d.collapse(!1),bf(h,f,Qd)}}catch{if(i.superseded)return;sr("insertText",!1,l)}i.waiting=!1,r(e),o(),await new Promise(c=>setTimeout(c,0))}var kl=e=>e?.trim().replaceAll(/[\s\u00A0]+/g," ").replaceAll(/\n/g,"");function Bv(e){let t=e;for(;t;){if(t.tagName==="TR")return t;t=t.parentElement}return null}function no(e,t){return Array.from(e.classList).find(n=>n.includes(t))}function Hv(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?Hv(t):!1)}function D(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 gP(e){try{return JSON.parse(e),!0}catch{return!1}}function Fv(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 bP(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 Ll(){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 yf(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 bs(e,t=Ll()){e=kl(e)??"";const n=i=>kl(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=bs(e,s),o))break}return o}function vf(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 Nl(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&&Nl({elem:e.elem.previousSibling,width:e.width})}function yP(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 vP=e=>{if(e instanceof Text)return e.textContent||"";if(e instanceof Element){if(e.tagName==="BR")return`
|
|
32
32
|
`;if(e.classList?.contains(".em-element-path"))return"";if(e.classList?.contains("em-code"))return"⃠";if(e.tagName==="EM-REPLACE")return"⃡"}};function $v(e,t){if(!e)return"";const n=t(e);return n===void 0?[...e.childNodes].map(r=>$v(r,t)).join(""):n}function EP(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 SP(e,t=!0){const n=document.createRange(),r=window.getSelection();r&&(n.selectNodeContents(e),n.collapse(t),r.removeAllRanges(),r.addRange(n))}function wP(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 Ef(){return PO()}function _P(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 Wv(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)Wv(r,t)}}function CP(e=document){e.querySelectorAll('[em-edit="active"]').forEach(t=>t.removeAttribute("em-edit"))}function j(e){if(TP(e))return AP(e)?e.trim():kP(e)}var qv={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},TP=e=>typeof e=="string"&&e.trim()!=="",AP=e=>qv.HEX.test(e);function kP(e){const t=qv.RGB.exec(e)?.groups;if(!t)return;const n=LP(t);return xP(n)}var LP=e=>({r:Sf(e.r),g:Sf(e.g),b:Sf(e.b),a:NP(e.a)}),Sf=e=>parseInt(e||"0",10),NP=e=>parseFloat(e||"1"),xP=e=>`#${wf(e.r)}${wf(e.g)}${wf(e.b)}`,wf=e=>e.toString(16).padStart(2,"0"),OP=0;function ut(e){return e>=48&&e<=57}function kr(e){return ut(e)||e>=65&&e<=70||e>=97&&e<=102}function _f(e){return e>=65&&e<=90}function RP(e){return e>=97&&e<=122}function MP(e){return _f(e)||RP(e)}function PP(e){return e>=128}function xl(e){return MP(e)||PP(e)||e===95}function zv(e){return xl(e)||ut(e)||e===45}function IP(e){return e>=0&&e<=8||e===11||e>=14&&e<=31||e===127}function Ol(e){return e===10||e===13||e===12}function ro(e){return Ol(e)||e===32||e===9}function In(e,t){return!(e!==92||Ol(t)||t===OP)}function Rl(e,t,n){return e===45?xl(t)||t===45||In(t,n):xl(e)?!0:e===92?In(e,t):!1}function Cf(e,t,n){return e===43||e===45?ut(t)?2:t===46&&ut(n)?3:0:e===46?ut(t)?2:0:ut(e)?1:0}function Uv(e){return e===65279||e===65534?1:0}var Tf=new Array(128),nee=128,ree=130,oee=131,iee=132,see=133;for(let e=0;e<Tf.length;e++)Tf[e]=ro(e)&&130||ut(e)&&131||xl(e)&&132||IP(e)&&133||e||128;function Af(e){return e<128?Tf[e]:132}function Vo(e,t){return t<e.length?e.charCodeAt(t):0}function kf(e,t,n){return n===13&&Vo(e,t+1)===10?2:1}function Go(e,t,n){let r=e.charCodeAt(t);return _f(r)&&(r=r|32),r===n}function ys(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(_f(s)&&(s=s|32),s!==i)return!1}return!0}function DP(e,t){for(;t>=0&&ro(e.charCodeAt(t));t--);return t+1}function Ml(e,t){for(;t<e.length&&ro(e.charCodeAt(t));t++);return t}function Lf(e,t){for(;t<e.length&&ut(e.charCodeAt(t));t++);return t}function Xo(e,t){if(t+=2,kr(Vo(e,t-1))){for(const r=Math.min(e.length,t+5);t<r&&kr(Vo(e,t));t++);const n=Vo(e,t);ro(n)&&(t+=kf(e,t,n))}return t}function Pl(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(!zv(n)){if(In(n,Vo(e,t+1))){t=Xo(e,t)-1;continue}break}}return t}function Il(e,t){let n=e.charCodeAt(t);if((n===43||n===45)&&(n=e.charCodeAt(t+=1)),ut(n)&&(t=Lf(e,t+1),n=e.charCodeAt(t)),n===46&&ut(e.charCodeAt(t+1))&&(t+=2,t=Lf(e,t)),Go(e,t,101)){let r=0;n=e.charCodeAt(t+1),(n===45||n===43)&&(r=1,n=e.charCodeAt(t+2)),ut(n)&&(t=Lf(e,t+1+r+1))}return t}function Nf(e,t){for(;t<e.length;t++){const n=e.charCodeAt(t);if(n===41){t++;break}In(n,Vo(e,t+1))&&(t=Xo(e,t))}return t}function jv(e){if(e.length===1&&!kr(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 Vv=["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"],BP=16384;function Dl(e=null,t){return e===null||e.length<t?new Uint32Array(Math.max(t+1024,BP)):e}var Gv=10,HP=12,Xv=13;function Kv(e){const t=e.source,n=t.length,r=t.length>0?Uv(t.charCodeAt(0)):0,o=Dl(e.lines,n),i=Dl(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===Gv||c===Xv||c===HP)&&(c===Xv&&l+1<n&&t.charCodeAt(l+1)===Gv&&(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 FP=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||Kv(this),{source:t,offset:this.startOffset+e,line:this.lines[e],column:this.columns[e]}}getLocationRange(e,t,n){return this.computed||Kv(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]}}}},rn=16777215,Lr=24,$P=new Map([[2,22],[21,22],[19,20],[23,24]]),WP=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=Dl(this.offsetAndType,e.length+1),o=Dl(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 m=a&rn;for(a=o[m],s=a>>Lr,o[i]=m,o[m++]=i;m<i;m++)o[m]===n&&(o[m]=i);break}case 21:case 2:case 19:case 23:o[i]=a,s=$P.get(c),a=s<<Lr|i}r[i++]=c<<Lr|d,l===-1&&(l=u)}),r[i]=0<<Lr|n,o[i]=n,o[n]=n;a!==0;){const c=a&rn;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]>>Lr:0}lookupOffset(e){return e+=this.tokenIndex,e<this.tokenCount?this.offsetAndType[e-1]&rn:this.source.length}lookupValue(e,t){return e+=this.tokenIndex,e<this.tokenCount?ys(this.source,this.offsetAndType[e-1]&rn,this.offsetAndType[e]&rn,t):!1}getTokenStart(e){return e===this.tokenIndex?this.tokenStart:e>0?e<this.tokenCount?this.offsetAndType[e-1]&rn:this.offsetAndType[this.tokenCount]&rn: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]&rn,t=this.offsetAndType[t],this.tokenType=t>>Lr,this.tokenEnd=t&rn):(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>>Lr,this.tokenEnd=e&rn):(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]&rn: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&rn,s=o>>Lr;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:Vv[t],chunk:this.source.substring(n,r),balance:this.balance[o]}}),e}};function Bl(e,t){function n(d){return d<a?e.charCodeAt(d):0}function r(){if(c=Il(e,c),Rl(n(c),n(c+1),n(c+2))){u=12,c=Pl(e,c);return}if(n(c)===37){u=11,c++;return}u=10}function o(){const d=c;if(c=Pl(e,c),ys(e,d,c,"url")&&n(c)===40){if(c=Ml(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 m=e.charCodeAt(c);switch(Af(m)){case d:c++;return;case 130:if(Ol(m)){c+=kf(e,c,m),u=6;return}break;case 92:if(c===e.length-1)break;const h=n(c+1);Ol(h)?c+=kf(e,c+1,h):In(m,h)&&(c=Xo(e,c)-1)}}}function s(){for(u=7,c=Ml(e,c);c<e.length;c++){const d=e.charCodeAt(c);switch(Af(d)){case 41:c++;return;case 130:if(c=Ml(e,c),n(c)===41||c>=e.length){c<e.length&&c++;return}c=Nf(e,c),u=8;return;case 34:case 39:case 40:case 133:c=Nf(e,c),u=8;return;case 92:if(In(d,n(c+1))){c=Xo(e,c)-1;break}c=Nf(e,c),u=8;return}}}e=String(e||"");const a=e.length;let l=Uv(n(0)),c=l,u;for(;c<a;){const d=e.charCodeAt(c);switch(Af(d)){case 130:u=13,c=Ml(e,c+1);break;case 34:i();break;case 35:zv(n(c+1))||In(n(c+1),n(c+2))?(u=4,c=Pl(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:Cf(d,n(c+1),n(c+2))?r():(u=9,c++);break;case 44:u=18,c++;break;case 45:Cf(d,n(c+1),n(c+2))?r():n(c+1)===45&&n(c+2)===62?(u=15,c=c+3):Rl(d,n(c+1),n(c+2))?o():(u=9,c++);break;case 46:Cf(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:Rl(n(c+1),n(c+2),n(c+3))?(u=3,c=Pl(e,c+1)):(u=9,c++);break;case 91:u=19,c++;break;case 92:In(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 Ko=null,Ue=class xn{static createItem(t){return{prev:null,next:null,data:t}}constructor(){this.head=null,this.tail=null,this.cursor=null}createItem(t){return xn.createItem(t)}allocateCursor(t,n){let r;return Ko!==null?(r=Ko,Ko=Ko.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=Ko,Ko=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=xn.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 xn;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 xn;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 xn;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(xn.createItem(t))}append(t){return this.insert(t)}appendData(t){return this.insert(xn.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(xn.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(xn.createItem(t))}pop(){return this.tail!==null?this.remove(this.tail):null}unshift(t){this.prepend(xn.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 Hl(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 Yv=100,qP=60,zP=" ";function Zv({source:e,line:t,column:n},r){function o(u,d){return i.slice(u,d).map((m,h)=>String(u+h+1).padStart(l)+" |"+m).join(`
|
|
@@ -50,7 +50,7 @@ ${o.join("")}
|
|
|
50
50
|
`,s.innerHTML!==a&&(s.textContent=a,r=!0)}}return r}function W1(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-")}`),J9(e,c,r)||(t.deleteRule(a),i=!0)}else if(l instanceof CSSGroupingRule)i=W1(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 J9(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 e6(e){return Array.from(e.cssRules,t=>t.cssText).join(`
|
|
51
51
|
`)}var q1=/device-width/i,t6="not all",ai=new Map,Cm=!1;function n6(e){return"media"in e&&"cssRules"in e}function z1(e,t){for(const n of Array.from(e))n6(n)&&t(n),"cssRules"in n&&z1(n.cssRules,t)}function r6(e){try{return e.cssRules}catch{return}}function o6(e){const t=e.split(",").map(n=>n.trim()).filter(n=>n&&!q1.test(n));return t.length?t.join(", "):t6}function Tm(e){ai.forEach((t,n)=>{n.parentStyleSheet?.ownerNode?.isConnected||ai.delete(n)});for(const t of Array.from(e.styleSheets)){const n=r6(t);n&&z1(n,r=>{const o=r.media.mediaText;ai.has(r)||!q1.test(o)||(ai.set(r,o),r.media.mediaText=o6(o))})}}function U1(){ai.forEach((e,t)=>{t.media.mediaText=e}),ai.clear()}function i6(e){if(!Cm)return e();U1();try{return e()}finally{Tm(document)}}function s6(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 a6(e=window){if(!e.matchMedia("(pointer: coarse)").matches)return()=>{};const t=e.document;Cm=!0,Tm(t);const n=new MutationObserver(r=>{s6(r)&&Tm(t)});return n.observe(t.documentElement,{childList:!0,characterData:!0,subtree:!0}),()=>{n.disconnect(),U1(),Cm=!1}}function Rs(e){return le(e)}var Eee=le("extensions.atomsHandlers"),See=Rs("HANDLE_ATOM_INSERT"),wee=le("HeadlessMode"),_ee=le("extensions.sandboxExtensions"),l6="SANDBOX_EXTENSION_SCRIPT_STATUS",Cee=le("MESSAGE_SERVICE"),Tee=Rs("SETTINGS_PANEL_EVENT"),Aee=Rs("MODAL_SHOW_EVENT"),kee=Rs("MODAL_CLOSE_EVENT"),Lee=Rs("MODAL_UPDATE_EVENT");function Nee(e){return e}var j1="SandboxApp",Am="IframePluginRegistry",c6="__sandbox__";function V1(){return td(c6)}function u6(e=V1()){return e.getOrCreateInstance(Am,()=>new Fg)}var km=new rL(()=>u6()),Ms=class bA{constructor(){A(this,"container",V1()),A(this,"pluginCollection",new nL(this,km)),this.pluginCollection.activateSync()}static get instance(){return this._instance||(this._instance=new bA)}static registerPlugin(t,n){km.add(t,n)}static registerAll(t){for(const n of Object.keys(t)){let r=n;const o=t[r];o&&km.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(Ms,"_instance",void 0);var Ps="data-extension";function Is(e,t,n,r){G.send(l6,{key:e,phase:t,status:n,error:r})}function d6(){if(typeof document>"u")return;const e=document.currentScript;if(e instanceof HTMLScriptElement)return e.getAttribute(Ps)||void 0}function G1(e){return{key:e,hasSyncPlugins:!1,pendingPlugins:new Set,loadedNotified:!1,readyNotified:!1,readyFailed:!1}}function Lm(e){!e.loadedNotified||e.readyNotified||e.readyFailed||(!e.hasSyncPlugins||e.pendingPlugins.size===0)&&(e.readyNotified=!0,Is(e.key,"ready","success"))}function X1(e,t){return[...document.querySelectorAll(`${e}[${Ps}]`)].find(n=>n.getAttribute(Ps)===t)}function f6({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(Ps,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 m6(e,t={}){const n=new ve,r=new Map,o=new Map,i=new Map,s=new WeakMap,a=u=>{let d=i.get(u);return d||(d=G1(u),i.set(u,d)),d},l=u=>{if(u.type==="created"){const h=d6();if(!h)return;const f=a(h);f.hasSyncPlugins=!0,f.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 m=i.get(d);if(m){if(u.type==="afterInit:success"){m.pendingPlugins.delete(u.plugin),Lm(m);return}(u.type==="init:error"||u.type==="afterInit:error")&&(m.pendingPlugins.delete(u.plugin),m.readyFailed=!0,Is(d,"ready","error",`Sandbox plugin "${u.name}" failed during ${u.type==="init:error"?"init":"afterInit"}.`))}};n.addDisposable(Ms.onLifecycle(l)),n.addDisposable(G.addListener(Ae.SANDBOX_ADD_EXTENSIONS,u=>{for(const d of u){if(t.surface&&d.surfaces&&!d.surfaces.includes(t.surface))continue;let m=r.get(d.key);m&&m.remove(),d.type==="script"&&i.set(d.key,G1(d.key));const h=d.parent&&document.querySelector(d.parent)||document.head;if(m=f6(d),e.ownership.markService(m),d.type==="script"){const f=m;f.src&&(f.onload=()=>{const g=a(d.key);g.loadedNotified=!0,Is(d.key,"load","success"),Lm(g)},f.onerror=()=>Is(d.key,"load","error",`Failed to load sandbox script: ${f.src}`))}if(h.appendChild(m),d.type==="script"&&!m.src){const f=a(d.key);f.loadedNotified=!0,Is(d.key,"load","success"),Lm(f)}r.set(d.key,m),o.set(d.key,d)}})),n.addDisposable(G.addListener(Ae.SANDBOX_REMOVE_EXTENSIONS,u=>{for(const d of u){const m=X1(o.get(d)?.type,d);m&&m.remove(),r.delete(d),o.delete(d)}})),n.addDisposable(e.onChange(()=>{e.applyHidden(()=>c())}));function c(){for(const[u,d]of r){const m=o.get(u);if(!m)continue;const h=X1(m.type,u);let f=m.parent?[...document.querySelectorAll(m.parent)]:[];f.length||(f=[document.head]),h?h!==d?r.set(u,h):f.some(g=>h.parentNode===g)||f[0]?.appendChild(h):f[0]?.appendChild(d)}}return n}function h6(e){e.querySelectorAll(`[${Ps}]`).forEach(t=>t.remove())}var lo="remove-basic-cell",p6="remove-basic-row",co="em-active-table-cell",g6="em-temporary-class",Or="em-temporary-active-cell-background-color",Rr="temporary-cell-class",oc=[lo,p6,co,g6,Rr,Or],b6=["contenteditable","em-edit","em-state","em-hover"],K1=`<div style="font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 16px; line-height: 21px; color: #5a5a5a;"> </div>`,Ds="em-table-menu",Bs="em_version";function ic(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(Bs),/^https?:\/\//i.test(e)||e.startsWith("//")?n.href:n.pathname+n.search+n.hash):e}catch{return e}}function y6(e){try{const t=typeof document<"u"?document.baseURI:"http://localhost/",n=new URL(e,t);return n.searchParams.set(Bs,String(Date.now())),/^https?:\/\//i.test(e)||e.startsWith("//")?n.href:n.pathname+n.search+n.hash}catch{return`${e}${e.includes("?")?"&":"?"}${Bs}=${Date.now()}`}}var v6=/^(chrome-extension|moz-extension|safari-extension):\/\//i,E6=/local\.adguard\.org/i,S6=/^bis_/i,w6=new Set(["data-bis-config"]),li=/<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,_6=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,sc=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Y1=/display:\s*none\s*!important/gi,C6=[".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; }"],Z1=new Set(["em","data-theme-varibalse","data-em-localization"]);function T6(e){return Y1.lastIndex=0,(e.match(Y1)||[]).length}function Nm(e){const t=e.trim(),n=T6(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=C6.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 A6(e){if(Z1.has("em")&&e.getAttribute("em")==="styles")return!1;for(const t of Z1)if(e.hasAttribute(t))return!1;return Nm(e.textContent||"")}function k6(e){return v6.test(e.src)||E6.test(e.src)?!0:e.hasAttribute("bis_use")||e.hasAttribute("data-bis-config")}function Q1(e){let t=!1;for(const n of[...e.attributes])(S6.test(n.name)||w6.has(n.name))&&(e.removeAttribute(n.name),t=!0);return t}function L6(e){sc.lastIndex=0;for(const t of e.matchAll(sc))if(Nm(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function N6(e){let t=!1;return sc.lastIndex=0,{html:e.replace(sc,n=>Nm(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function J1(e){let t=!1;return e instanceof Element&&Q1(e)&&(t=!0),e.querySelectorAll("script").forEach(n=>{k6(n)&&(n.remove(),t=!0)}),e.querySelectorAll("style").forEach(n=>{n.tagName==="STYLE"&&A6(n)&&(n.remove(),t=!0)}),e.querySelectorAll("*").forEach(n=>{Q1(n)&&(t=!0)}),t}function x6(e){return li.lastIndex=0,li.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||L6(e)}function O6(e){if(!x6(e))return{html:e,found:!1};let t=!1,n=e;li.lastIndex=0,li.test(n)&&(li.lastIndex=0,n=n.replace(li,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(_6,""),t=!0);const r=N6(n);return n=r.html,t=t||r.found,{html:n,found:t}}var R6=class extends ve{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 xm(){return Rt.getInstance(To)}var ac=new WeakMap;function M6(e,t,n){const r=ac.get(e);r?r.set(t.toLowerCase(),n):ac.set(e,new Map([[t.toLowerCase(),n]]))}function P6(e,t){const n=ac.get(e);n?.size&&ac.set(t,new Map(n))}function ew(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 Om(e,t={}){const n=t.pipeline??xm(),r=t.stage??"build";let o=e;if(t.clone&&(o=e.cloneNode(!0),en(e,o),n&&!n.isEmpty&&tw(e,o)),!n||n.isEmpty)return o;o instanceof Element&&ew(o,n,r);const i=o.querySelectorAll?.("*");if(i)for(const s of i)ew(s,n,r);return o}function I6(e,t={}){const n=t.pipeline??xm(),r=oR(e);if((!n||n.isEmpty)&&!r)return Er(e);const o=Om(e,{...t,pipeline:n,clone:!0});return zo(o),hg(o)}function tw(e,t){P6(e,t);const n=e.childNodes,r=t.childNodes;for(let o=0;o<n.length&&o<r.length;o++)tw(n[o],r[o])}function Dt(e,t,n,r={}){const o=Rm(e,t,n,{stage:"settings",...r});o===null?e.removeAttribute(t):e.setAttribute(t,o)}function Rm(e,t,n,r={}){const o=r.pipeline??xm();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&&M6(a,t,n)}return s}function D6(e){const t=new R6,n=vg((o,i,s)=>t.isEmpty?s:Rm(o,i,s,{pipeline:t})),r=lk((o,i,s)=>t.isEmpty?s:t.serialize(s,{element:o,tag:o.tagName.toLowerCase(),attribute:i,stage:"apply"}));return e.inject(To,t),{pipeline:t,dispose(){r(),n(),t.dispose(),pn(e,To)}}}function B6(e){return ic(e)}function nw(e){const t=(n,r)=>{const o=n.getAttribute(r);if(!o)return;const i=B6(o);i!==o&&n.setAttribute(r,i)};e.querySelectorAll("[src]").forEach(n=>t(n,"src")),e.querySelectorAll("[___src]").forEach(n=>t(n,"___src"))}var rw=[".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"],H6=["contenteditable","em-edit","em-state","em-hover"],F6=["[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"],$6=new Set(["normal","400"]),W6=new Set(["normal"]),q6=new Set(["baseline","unset","initial",""]),ow=new Set(["none",""]),z6=["b","strong","em","i","u","s","strike","sup","sub"],U6="___em-internal",iw=["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"],j6=["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"],V6=[...rw,...F6].filter(e=>/\.em-(element-|gap|vindent)/.test(e)&&e!=="span.em-element-resize-img-container").join(", "),G6=H6.filter(e=>!rw.some(t=>t.includes(`[${e}`))),X6=[...iw,...j6],K6={isServiceAttribute:e=>G6.includes(e),isServiceClass:e=>X6.includes(e),isServicePanel:e=>e.matches(V6)||e.hasAttribute("data-em-caret")};function sw(e){oc.forEach(t=>{e.querySelectorAll(`.${t}`).forEach(n=>n.classList.remove(t))})}function lc(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")}),iw.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&&(At(t,"[data-mce-caret=before]",!0),At(t,"span.em-element-resize-img-container"),At(t,"div.em-element-img-change-group",!0),At(t,"div.em-element-block-add",!0),At(t,"meta[http-equiv=Content-Security-Policy]",!0),At(t,"[class*=mce-]"),At(t,"script[em=initial]",!0),At(t,".em-editor-wrapper",!0),At(t,".em-element-resize-height",!0),At(t,".em-element-vindent-remove",!0),At(t,".em-element-vindent",!0),At(t,".em-element-vindent-value",!0),At(t,"div.iframe-resizer-inner"))}function Y6(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")),sw(e),lc(e),uv(e),At(e,"editor",!1),lw(e),nw(e),J1(e)}function Hs(e){return(e??"").trim().toLowerCase()}function Z6(e){const t=Hs(e.style.fontWeight);t&&$6.has(t)&&e.style.removeProperty("font-weight");const n=Hs(e.style.fontStyle);n&&W6.has(n)&&e.style.removeProperty("font-style");const r=Hs(e.style.verticalAlign);r&&q6.has(r)&&e.style.removeProperty("vertical-align");const o=Hs(e.style.textDecorationLine);o&&ow.has(o)&&e.style.removeProperty("text-decoration-line");const i=Hs(e.style.textDecoration);i&&ow.has(i)&&e.style.removeProperty("text-decoration");const s=e.getAttribute("style");s!==null&&s.trim()===""&&e.removeAttribute("style")}function Q6(e){const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function aw(e){if(e.attributes.length===0)return!0;for(const t of Array.from(e.attributes))if(t.name!==U6)return!1;return!0}function lw(e){const t=Array.from(e.querySelectorAll("span"));for(let n=t.length-1;n>=0;n-=1){const r=t[n];Z6(r),aw(r)&&Q6(r)}for(const n of z6){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&&aw(i)&&i.remove()}}}function J6(e){const t=[],n=o7(e);return e=n7(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=El.clear(e),e=Mm(e),t.length===0?e:s7(e,t,n)}var cw=`(<(script|style)\\b[^>]*>)([\\s\\S]*?)(?=<\\/\\2${Na})`,e7=new RegExp(cw,"gi"),t7=new RegExp(`<!--[\\s\\S]*?-->|${cw}`,"gi");function n7(e,t,n){const r=(o,i,s,a)=>!a||!i7(s,i)?i+a:(t.push(s.toLowerCase()==="style"?r7(a):a),`${i}${n}${t.length-1}${dw}`);return e.replaceAll(t7,(o,i,s,a)=>i===void 0?o.replaceAll(e7,r):r(o,i,s??"",a??""))}function r7(e){const t=Mm(El.clear(`>${e}`));return t.startsWith(">")?t.slice(1):Mm(El.clear(e))}var uw="",dw="";function o7(e){let t=uw;for(;e.includes(t);)t+=uw;return t}function i7(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]),gn(n)}function s7(e,t,n){return e.replaceAll(new RegExp(`${n}(\\d+)${dw}`,"g"),(r,o)=>t[Number(o)]??r)}function Mm(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=j(n);r&&(e=e.replaceAll(n,r))}),e=e.replaceAll(/<tbody>/gi,"").replaceAll(/<\/tbody>/gi,""),e}function fw(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 a7(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 mw(){const e=Array.from(document.querySelectorAll('style[em="styles"]'));return i6(()=>$1(document,e,{forceMediaMerge:!0}))}function l7(e){let t=!1;return e.beforeCommit(()=>{try{!t&&e.takeStyleDirty()&&(t=!0,mw(),e.takeStyleDirty())}finally{t=!1}})}function cc(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 cc({node:n});i=fw(s);const a=n.cloneNode(!0);en(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 cc({html:t});i=fw(s);const c=Re(a);i.replaceChildren(...c)}Om(i,{stage:"apply"}),Y6(i),t=Tt(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)a7(i,Re(t));else if(n){const s=n.cloneNode(!0);en(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()),h6(i),sw(i),lc(i),uv(i),i.documentElement&&At(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())}),lw(i)),Om(i,{stage:"apply"}),nw(i),J1(i),t=tn(i)}return O6(J6(t)).html}function Pm(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 hw="__emOwnEditor";function c7(e){e[hw]=!0,Xy(e)}function pw(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[hw]&&!o.contains(n)&&(o.replaceWith(...Array.from(o.childNodes)),r=!0);return r}var u7=["deleteContentBackward","deleteContentForward","deleteByCut"],d7={deleteContentBackward:"backward",deleteContentForward:"forward"};function f7(e){const{element:t,getVisibleText:n,setCursorToElement:r,hasOnlyTextNodesDeep:o,isRangeCoveringAllVisibleText:i,isEditorContentOnlyNbsp:s,commit:a,pasteFragment:l}=e,c=w=>Pt(w)?rf(w):e.mapFn(w);function u(w){return!n(w,c).trim()&&!w.querySelector(gw)}const d=w=>n(w,c).trim();function m(w,T){const L=document.createRange();L.selectNodeContents(T);const y=w.cloneRange();return y.compareBoundaryPoints(y.START_TO_START,L)<0&&y.setStart(L.startContainer,L.startOffset),y.compareBoundaryPoints(y.END_TO_END,L)>0&&y.setEnd(L.endContainer,L.endOffset),bw(n(y.cloneContents(),c).trim(),d(T))}function h(w){w.insertAdjacentHTML("beforebegin"," "),w.removeAttribute("em-edit"),w.remove()}function f(w,T){if(!T.collapsed)return!1;const L=document.createRange();return L.setStart(T.endContainer,T.endOffset),L.setEnd(w,w.childNodes.length),!n(L.cloneContents(),c).trim()}function g(w,T=Dm(w,d)){const[L,...y]=T,p=L??w;if(!L&&h7(w)){const b=document.createTextNode(" ");w.replaceChildren(b),r(b);return}const v=document.createElement(L&&L.tagName!=="EDITOR"?L.tagName:"div"),C=document.createTextNode(" ");if(L&&p.tagName===v.tagName)for(const{name:b,value:S}of Array.from(p.attributes))v.setAttribute(b,S);EP(v,L?w:v7(w),p,E7),v.getAttribute("style")||v.removeAttribute("style"),y.filter(b=>b.tagName!=="TBODY").reduce((b,S)=>b.appendChild(y7(S)),v).append(C),w.tagName==="A"||w.parentNode&&w.parentNode.tagName==="A"?w.replaceChildren(C):w.replaceChildren(v),r(C)}function E(w,T){if(T.collapsed)return!1;const L=Dm(w,d);return fv(T,void 0,hM)?(u(w)&&g(w,L),t.setAttribute("em-edit","active"),a(!0),!0):!1}return function(T){const L=T.target,y=window.getSelection();if(!y||y.rangeCount===0)return;if(T.inputType==="insertFromPaste"&&l&&!T.defaultPrevented){l(T);return}const p=d7[T.inputType];if(p&&dM(y.getRangeAt(0),p)){T.preventDefault();return}if(u7.includes(T.inputType)&&E(L,y.getRangeAt(0))){T.preventDefault();return}const v=n(L,c).trim(),C=n(y.getRangeAt(0)?.cloneContents(),c).trim(),b=y.getRangeAt(0),S=b.startContainer,_=(S.nodeType===Node.TEXT_NODE?S.parentNode:S).closest("sup, sub");if((T.inputType==="deleteContentBackward"||T.inputType==="deleteByCut")&&!y?.isCollapsed&&C){if(_&&m(b,_)&&h(_),i(b)&&bw(C,v)&&!L.querySelector(Im)){T.preventDefault(),g(L),t.setAttribute("em-edit","active"),a(!0);return}t.setAttribute("em-edit","active"),a(!0)}if(T.inputType==="deleteContentBackward"&&y?.isCollapsed&&!C){S.length===1&&(_&&d(_).length===1&&h(_),t.setAttribute("em-edit","active"),a(!0));const k=()=>{_w(T)&&a(!0)};if(S.nodeType!==Node.TEXT_NODE&&!i(b))return k();const x=b.startOffset;if(x===0&&!i(b))return k();const N=S.parentNode;if(!N)return k();const W=Array.prototype.indexOf.call(N.childNodes,S);if(N.childNodes[W-1]?.nodeType===Node.COMMENT_NODE){T.preventDefault(),S.deleteData(x-1,1);const O=document.createRange();O.setStart(S,x-1),O.collapse(!0),y.removeAllRanges(),y.addRange(O),a(!0);return}L&&s(L)&&(T.preventDefault(),T.stopImmediatePropagation())}if(T.inputType==="insertText"&&!y?.isCollapsed){T.preventDefault();let k=T.data||"";const x=y.anchorNode;i(b)&&(x.tagName==="A"||x?.parentNode&&x.parentNode.tagName==="A")&&(k=" "+T.data),b.deleteContents();const N=document.createTextNode(k||" ");b.insertNode(N),b.setStartAfter(N),b.collapse(!0),y.removeAllRanges(),y.addRange(b),bf(N,N,Qd),a(!0);return}if(m7.test(T.inputType)){const k=w7(T,y.getRangeAt(0));if(!k||(T.preventDefault(),fM(L,k))||(y.removeAllRanges(),y.addRange(k),E(L,k)))return;const x=Dm(L,d);ww("delete"),u(L)&&g(L,x),a();return}if(T.inputType.includes("deleteContent")&&(v.length<2||v===C)&&o(L)&&!L.querySelector(Im)&&!(T.inputType==="deleteContentForward"&&f(L,b))){T.preventDefault(),g(L),a(!0);return}if(T.inputType==="insertText"&&T.data){const k=y.anchorNode;if(k?.tagName==="A"&&!k.textContent?.trim().length){T.preventDefault(),T.stopImmediatePropagation(),k.insertAdjacentText("beforeend",T.data);const x=document.createRange();x.selectNodeContents(k),x.collapse(!1),y.removeAllRanges(),y.addRange(x),a(!0);return}if(k?.parentNode&&k.parentNode.tagName==="A"||k?.tagName==="A"){T.preventDefault(),T.stopImmediatePropagation();const x=y.getRangeAt(0),N=document.createTextNode(T.data||"");x.insertNode(N),x.setStartAfter(N),x.collapse(!0),y.removeAllRanges(),y.addRange(x),bf(N,N,Qd),a(!0);return}}if(T.inputType==="deleteContentBackward"&&!y.isCollapsed&&!C&&L&&s(L)&&(T.preventDefault(),T.stopImmediatePropagation()),_w(T)){a(!0);return}a()}}var Im="em-replace, img, picture, video, audio, svg, canvas, iframe, object, hr, input, button",gw=`${Im}, table`,m7=/^delete(Word|SoftLine|HardLine)/;function bw(e,t){return e.replace(/\s+/g," ")===t.replace(/\s+/g," ")}function h7(e){return[yw(e,"previousSibling"),yw(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))}function yw(e,t){let n=e[t];for(;n?.nodeType===Node.TEXT_NODE&&!n.textContent?.trim();)n=n[t];return n}var p7=/^(AREA|BASE|BR|COL|EMBED|HR|IMG|INPUT|LINK|META|SOURCE|TRACK|WBR)$/,vw=/^(SPAN|B|STRONG|I|EM|U|S|STRIKE|FONT|SMALL|BIG|MARK)$/,g7={TABLE:["THEAD","TBODY","TFOOT","TR"],THEAD:["TR"],TBODY:["TR"],TFOOT:["TR"],TR:["TD","TH"]};function Dm(e,t){const n=t(e),r=[];for(let o=Ew(e,n,t);o;o=b7(o,n,t))r.push(o);return r}function Ew(e,t,n){const r=Sw(e,n);if(!(!r||p7.test(r.tagName)||r.tagName!=="TABLE"&&r.matches(gw)))return!(r.tagName==="A"||vw.test(r.tagName))||n(r)===t?r:void 0}function b7(e,t,n){const r=g7[e.tagName];if(r)return Array.from(e.children).find(i=>r.includes(i.tagName));if(e.tagName==="TD"||e.tagName==="TH")return Ew(e,t,n);const o=Sw(e,n);return o&&vw.test(o.tagName)&&n(o)===t?o:void 0}function Sw(e,t){for(const n of Array.from(e.childNodes))if(!(Pt(n)&&!t(n))){if(n.nodeType===Node.ELEMENT_NODE)return n;if(t(n))return}}function y7(e){const t=e.cloneNode(!1);return t.removeAttribute("em-edit"),t}function v7(e){const t=e.cloneNode(!1);return t.removeAttribute("innerStyle"),t.removeAttribute("innerClass"),t}var E7=e=>j(e)??e;function S7(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 w7(e,t){const n=sf(t,e.inputType.endsWith("Backward")?"backward":"forward");if(!n)return S7(e);const r=document.createRange();return r.selectNode(n),r}var _7={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"},C7=["insertText"],Bm=!1;function ww(e,t){Bm=!0;try{sr(e,!1,t)}finally{Bm=!1}}function T7(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 _w(e){const t=_7[e.inputType];if(!t||e.defaultPrevented||e.isComposing||Bm)return!1;const n=e.inputType==="insertReplacementText"?T7(e):e.data??void 0;return C7.includes(t)&&!n?!1:(e.preventDefault(),ww(t,n),!0)}function A7(e){return function(n,r){if(!n||(n.querySelectorAll("editor")?.forEach(s=>{s.onclick=null,s.onkeyup=null,s.onmousedown=null}),lc(n),document.querySelectorAll(":not(.em-element-path) .em-element-path").forEach(s=>s.remove()),pw(n),_P(n,r)))return;Wv(n,Re);const o=document.createElement("editor");if(c7(o),o.classList.add("em-text"),o.setAttribute("contenteditable","true"),r)n.before(o),o.replaceChildren(n),iR(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",mt(()=>e.commit(!0)),!0),o.addEventListener("beforeinput",f7({element:n,getVisibleText:$v,mapFn:vP,setCursorToElement:SP,hasOnlyTextNodesDeep:Hv,isRangeCoveringAllVisibleText:iM,isEditorContentOnlyNbsp:oM,commit:e.commit,pasteFragment:s=>{const a=l=>Pm({target:l.target},c=>e.commit(c));Al(s,!1,U.get("commonStyles"),a,e.commit)}}))}}function k7({commit:e,htmlDocument:t,documentMapping:n}){const r=A7({commit:e});return{now:r,deferred:(i,s)=>{const a=t.getRangeByElement(i,!0);a&&n.hasMappedReplacementRangeInRange(a)||rM(()=>r(i,s),"editor")}}}var Cw=e=>t=>t.some(n=>e(n).some(L7)),L7=e=>e instanceof Element&&(e.hasAttribute("em-edit")||e.querySelector("[em-edit]")),N7=Cw(({removed:e})=>e),x7=Cw(({added:e})=>e),O7=e=>t=>{N7(t)&&!x7(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){Cr("em-edit"),n.setAttribute("em-edit","active"),e({elem:n});return}e({elem:null})},0)},R7=200;function M7(e){let t=!1;return()=>{if(t)return;t=!0;let n;const r=()=>{t&&(t=!1,clearTimeout(n),e())};n=setTimeout(r,R7),window.requestAnimationFrame(()=>setTimeout(r,0))}}var je={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"},ke="em-icon";function P7(e,t,n){return(t=H7(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function cr(){return cr=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},cr.apply(null,arguments)}function Tw(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 Fn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Tw(Object(n),!0).forEach(function(r){P7(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Tw(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function I7(e,t){if(e==null)return{};var n,r,o=D7(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 D7(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 B7(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 H7(e){var t=B7(e,"string");return typeof t=="symbol"?t:t+""}function Hm(e){"@babel/helpers - typeof";return Hm=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},Hm(e)}var F7="1.15.7";function ur(e){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(e)}var dr=ur(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Fs=ur(/Edge/i),Aw=ur(/firefox/i),$s=ur(/safari/i)&&!ur(/chrome/i)&&!ur(/android/i),Fm=ur(/iP(ad|od|hone)/i),kw=ur(/chrome/i)&&ur(/android/i),Lw={capture:!1,passive:!1};function pe(e,t,n){e.addEventListener(t,n,!dr&&Lw)}function me(e,t,n){e.removeEventListener(t,n,!dr&&Lw)}function uc(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 Nw(e){return e.host&&e!==document&&e.host.nodeType&&e.host!==e?e.host:e.parentNode}function Sn(e,t,n,r){if(e){n=n||document;do{if(t!=null&&(t[0]===">"?e.parentNode===n&&uc(e,t):uc(e,t))||r&&e===n)return e;if(e===n)break}while(e=Nw(e))}return null}var xw=/\s+/g;function Gt(e,t,n){e&&t&&(e.classList?e.classList[n?"add":"remove"](t):e.className=((" "+e.className+" ").replace(xw," ").replace(" "+t+" "," ")+(n?" "+t:"")).replace(xw," "))}function ee(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 ci(e,t){var n="";if(typeof e=="string")n=e;else do{var r=ee(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 Ow(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 $n(){var e=document.scrollingElement;return e||document.documentElement}function Qe(e,t,n,r,o){if(!(!e.getBoundingClientRect&&e!==window)){var i,s,a,l,c,u,d;if(e!==window&&e.parentNode&&e!==$n()?(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,!dr))do if(o&&o.getBoundingClientRect&&(ee(o,"transform")!=="none"||n&&ee(o,"position")!=="static")){var m=o.getBoundingClientRect();s-=m.top+parseInt(ee(o,"border-top-width")),a-=m.left+parseInt(ee(o,"border-left-width")),l=s+i.height,c=a+i.width;break}while(o=o.parentNode);if(r&&e!==window){var h=ci(o||e),f=h&&h.a,g=h&&h.d;h&&(s/=g,a/=f,d/=f,u/=g,l=s+u,c=a+d)}return{top:s,left:a,bottom:l,right:c,width:d,height:u}}}function Rw(e,t,n){for(var r=Mr(e,!0),o=Qe(e)[t];r;){var i=Qe(r)[n],s=void 0;if(n==="top"||n==="left"?s=o>=i:s=o<=i,!s)return r;if(r===$n())break;r=Mr(r,!1)}return!1}function ui(e,t,n,r){for(var o=0,i=0,s=e.children;i<s.length;){if(s[i].style.display!=="none"&&s[i]!==X.ghost&&(r||s[i]!==X.dragged)&&Sn(s[i],n.draggable,e,!1)){if(o===t)return s[i];o++}i++}return null}function $m(e,t){for(var n=e.lastElementChild;n&&(n===X.ghost||ee(n,"display")==="none"||t&&!uc(n,t));)n=n.previousElementSibling;return n||null}function sn(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==X.clone&&(!t||uc(e,t))&&n++;return n}function Mw(e){var t=0,n=0,r=$n();if(e)do{var o=ci(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 $7(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 Mr(e,t){if(!e||!e.getBoundingClientRect)return $n();var n=e,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=ee(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 $n();if(r||t)return n;r=!0}}while(n=n.parentNode);return $n()}function W7(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function Wm(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 Ws;function Pw(e,t){return function(){if(!Ws){var n=arguments,r=this;n.length===1?e.call(r,n[0]):e.apply(r,n),Ws=setTimeout(function(){Ws=void 0},t)}}}function q7(){clearTimeout(Ws),Ws=void 0}function Iw(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function Dw(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 Bw(e,t,n){var r={};return Array.from(e.children).forEach(function(o){var i,s,a,l;if(!(!Sn(o,t.draggable,e,!1)||o.animated||o===n)){var c=Qe(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 Bt="Sortable"+new Date().getTime();function z7(){var e=[],t;return{captureAnimationState:function(){e=[],this.options.animation&&[].slice.call(this.el.children).forEach(function(r){if(!(ee(r,"display")==="none"||r===X.ghost)){e.push({target:r,rect:Qe(r)});var o=Fn({},e[e.length-1].rect);if(r.thisAnimationDuration){var i=ci(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($7(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=Qe(c),m=c.prevFromRect,h=c.prevToRect,f=a.rect,g=ci(c,!0);g&&(d.top-=g.f,d.left-=g.e),c.toRect=d,c.thisAnimationDuration&&Wm(m,d)&&!Wm(u,d)&&(f.top-d.top)/(f.left-d.left)===(u.top-d.top)/(u.left-d.left)&&(l=j7(f,m,h,o.options)),Wm(d,u)||(c.prevFromRect=u,c.prevToRect=d,l||(l=o.options.animation),o.animate(c,f,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){ee(r,"transition",""),ee(r,"transform","");var a=ci(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,ee(r,"transform","translate3d("+u+"px,"+d+"px,0)"),this.forRepaintDummy=U7(r),ee(r,"transition","transform "+s+"ms"+(this.options.easing?" "+this.options.easing:"")),ee(r,"transform","translate3d(0,0,0)"),typeof r.animated=="number"&&clearTimeout(r.animated),r.animated=setTimeout(function(){ee(r,"transition",""),ee(r,"transform",""),r.animated=!1,r.animatingX=!1,r.animatingY=!1},s)}}}}function U7(e){return e.offsetWidth}function j7(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 di=[],qm={initializeByDefault:!0},qs={mount:function(t){for(var n in qm)qm.hasOwnProperty(n)&&!(n in t)&&(t[n]=qm[n]);di.forEach(function(r){if(r.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),di.push(t)},pluginEvent:function(t,n,r){var o=this;this.eventCanceled=!1,r.cancel=function(){o.eventCanceled=!0};var i=t+"Global";di.forEach(function(s){n[s.pluginName]&&(n[s.pluginName][i]&&n[s.pluginName][i](Fn({sortable:n},r)),n.options[s.pluginName]&&n[s.pluginName][t]&&n[s.pluginName][t](Fn({sortable:n},r)))})},initializePlugins:function(t,n,r,o){di.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,cr(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 di.forEach(function(o){typeof o.eventProperties=="function"&&cr(r,o.eventProperties.call(n[o.pluginName],t))}),r},modifyOption:function(t,n,r){var o;return di.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[n]=="function"&&(o=i.optionListeners[n].call(t[i.pluginName],r))}),o}};function V7(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,m=e.originalEvent,h=e.putSortable,f=e.extraEventProperties;if(t=t||n&&n[Bt],!!t){var g,E=t.options,w="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!dr&&!Fs?g=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(g=document.createEvent("Event"),g.initEvent(r,!0,!0)),g.to=s||n,g.from=a||n,g.item=o||n,g.clone=i,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=u,g.newDraggableIndex=d,g.originalEvent=m,g.pullMode=h?h.lastPutMode:void 0;var T=Fn(Fn({},f),qs.getEventProperties(r,t));for(var L in T)g[L]=T[L];n&&n.dispatchEvent(g),E[w]&&E[w].call(t,g)}}var G7=["evt"],Ht=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.evt,i=I7(r,G7);qs.pluginEvent.bind(X)(t,n,Fn({dragEl:B,parentEl:Ve,ghostEl:se,rootEl:De,nextEl:uo,lastDownEl:dc,cloneEl:Fe,cloneHidden:Pr,dragStarted:Us,putSortable:ht,activeSortable:X.active,originalEvent:o,oldIndex:fi,oldDraggableIndex:zs,newIndex:Xt,newDraggableIndex:Ir,hideGhostForTarget:Uw,unhideGhostForTarget:jw,cloneNowHidden:function(){Pr=!0},cloneNowShown:function(){Pr=!1},dispatchSortableEvent:function(a){kt({sortable:n,name:a,originalEvent:o})}},i))};function kt(e){V7(Fn({putSortable:ht,cloneEl:Fe,targetEl:B,rootEl:De,oldIndex:fi,oldDraggableIndex:zs,newIndex:Xt,newDraggableIndex:Ir},e))}var B,Ve,se,De,uo,dc,Fe,Pr,fi,Xt,zs,Ir,fc,ht,mi=!1,mc=!1,hc=[],fo,wn,zm,Um,Hw,Fw,Us,hi,js,Vs=!1,pc=!1,gc,bt,jm=[],Vm=!1,bc=[],yc=typeof document<"u",vc=Fm,$w=Fs||dr?"cssFloat":"float",X7=yc&&!kw&&!Fm&&"draggable"in document.createElement("div"),Ww=(function(){if(yc){if(dr)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto",e.style.pointerEvents==="auto"}})(),qw=function(t,n){var r=ee(t),o=parseInt(r.width)-parseInt(r.paddingLeft)-parseInt(r.paddingRight)-parseInt(r.borderLeftWidth)-parseInt(r.borderRightWidth),i=ui(t,0,n),s=ui(t,1,n),a=i&&ee(i),l=s&&ee(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Qe(i).width,u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Qe(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[$w]==="none"||s&&r[$w]==="none"&&c+u>o)?"vertical":"horizontal"},K7=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},Y7=function(t,n){var r;return hc.some(function(o){var i=o[Bt].options.emptyInsertThreshold;if(!(!i||$m(o))){var s=Qe(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},zw=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 m=(s?a:l).options.group.name;return i===!0||typeof i=="string"&&i===m||i.join&&i.indexOf(m)>-1}}var r={},o=t.group;(!o||Hm(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},Uw=function(){!Ww&&se&&ee(se,"display","none")},jw=function(){!Ww&&se&&ee(se,"display","")};yc&&!kw&&document.addEventListener("click",function(e){if(mc)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),mc=!1,!1},!0);var mo=function(t){if(B){t=t.touches?t.touches[0]:t;var n=Y7(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[Bt]._onDragOver(r)}}},Z7=function(t){B&&B.parentNode[Bt]._isOutsideThisEl(t.target)};function X(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=cr({},t),e[Bt]=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 qw(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:X.supportPointer!==!1&&"PointerEvent"in window&&(!$s||Fm),emptyInsertThreshold:5};qs.initializePlugins(this,e,n);for(var r in n)!(r in t)&&(t[r]=n[r]);zw(t);for(var o in this)o.charAt(0)==="_"&&typeof this[o]=="function"&&(this[o]=this[o].bind(this));this.nativeDraggable=t.forceFallback?!1:X7,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?pe(e,"pointerdown",this._onTapStart):(pe(e,"mousedown",this._onTapStart),pe(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(pe(e,"dragover",this),pe(e,"dragenter",this)),hc.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),cr(this,z7())}X.prototype={constructor:X,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(hi=null)},_getDirection:function(t,n){return typeof this.options.direction=="function"?this.options.direction.call(this,t,n,B):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(iH(r),!B&&!(/mousedown|pointerdown/.test(s)&&t.button!==0||o.disabled)&&!c.isContentEditable&&!(!this.nativeDraggable&&$s&&l&&l.tagName.toUpperCase()==="SELECT")&&(l=Sn(l,o.draggable,r,!1),!(l&&l.animated)&&dc!==l)){if(fi=sn(l),zs=sn(l,o.draggable),typeof u=="function"){if(u.call(this,t,l,this)){kt({sortable:n,rootEl:c,name:"filter",targetEl:l,toEl:r,fromEl:r}),Ht("filter",n,{evt:t}),i&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(d){if(d=Sn(c,d.trim(),r,!1),d)return kt({sortable:n,rootEl:d,name:"filter",targetEl:l,fromEl:r,toEl:r}),Ht("filter",n,{evt:t}),!0}),u)){i&&t.preventDefault();return}o.handle&&!Sn(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&&!B&&r.parentNode===i){var c=Qe(r);if(De=i,B=r,Ve=B.parentNode,uo=B.nextSibling,dc=r,fc=s.group,X.dragged=B,fo={target:B,clientX:(n||t).clientX,clientY:(n||t).clientY},Hw=fo.clientX-c.left,Fw=fo.clientY-c.top,this._lastX=(n||t).clientX,this._lastY=(n||t).clientY,B.style["will-change"]="all",l=function(){if(Ht("delayEnded",o,{evt:t}),X.eventCanceled){o._onDrop();return}o._disableDelayedDragEvents(),!Aw&&o.nativeDraggable&&(B.draggable=!0),o._triggerDragStart(t,n),kt({sortable:o,name:"choose",originalEvent:t}),Gt(B,s.chosenClass,!0)},s.ignore.split(",").forEach(function(u){Ow(B,u.trim(),Gm)}),pe(a,"dragover",mo),pe(a,"mousemove",mo),pe(a,"touchmove",mo),s.supportPointer?(pe(a,"pointerup",o._onDrop),!this.nativeDraggable&&pe(a,"pointercancel",o._onDrop)):(pe(a,"mouseup",o._onDrop),pe(a,"touchend",o._onDrop),pe(a,"touchcancel",o._onDrop)),Aw&&this.nativeDraggable&&(this.options.touchStartThreshold=4,B.draggable=!0),Ht("delayStart",this,{evt:t}),s.delay&&(!s.delayOnTouchOnly||n)&&(!this.nativeDraggable||!(Fs||dr))){if(X.eventCanceled){this._onDrop();return}s.supportPointer?(pe(a,"pointerup",o._disableDelayedDrag),pe(a,"pointercancel",o._disableDelayedDrag)):(pe(a,"mouseup",o._disableDelayedDrag),pe(a,"touchend",o._disableDelayedDrag),pe(a,"touchcancel",o._disableDelayedDrag)),pe(a,"mousemove",o._delayedDragTouchMoveHandler),pe(a,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&pe(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(){B&&Gm(B),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._disableDelayedDrag),me(t,"touchend",this._disableDelayedDrag),me(t,"touchcancel",this._disableDelayedDrag),me(t,"pointerup",this._disableDelayedDrag),me(t,"pointercancel",this._disableDelayedDrag),me(t,"mousemove",this._delayedDragTouchMoveHandler),me(t,"touchmove",this._delayedDragTouchMoveHandler),me(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,n){n=n||t.pointerType=="touch"&&t,!this.nativeDraggable||n?this.options.supportPointer?pe(document,"pointermove",this._onTouchMove):n?pe(document,"touchmove",this._onTouchMove):pe(document,"mousemove",this._onTouchMove):(pe(B,"dragend",this),pe(De,"dragstart",this._onDragStart));try{document.selection?Sc(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,n){if(mi=!1,De&&B){Ht("dragStarted",this,{evt:n}),this.nativeDraggable&&pe(document,"dragover",Z7);var r=this.options;!t&&Gt(B,r.dragClass,!1),Gt(B,r.ghostClass,!0),X.active=this,t&&this._appendGhost(),kt({sortable:this,name:"start",originalEvent:n})}else this._nulling()},_emulateDragOver:function(){if(wn){this._lastX=wn.clientX,this._lastY=wn.clientY,Uw();for(var t=document.elementFromPoint(wn.clientX,wn.clientY),n=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(wn.clientX,wn.clientY),t!==n);)n=t;if(B.parentNode[Bt]._isOutsideThisEl(t),n)do{if(n[Bt]){var r=void 0;if(r=n[Bt]._onDragOver({clientX:wn.clientX,clientY:wn.clientY,target:t,rootEl:n}),r&&!this.options.dragoverBubble)break}t=n}while(n=Nw(n));jw()}},_onTouchMove:function(t){if(fo){var n=this.options,r=n.fallbackTolerance,o=n.fallbackOffset,i=t.touches?t.touches[0]:t,s=se&&ci(se,!0),a=se&&s&&s.a,l=se&&s&&s.d,c=vc&&bt&&Mw(bt),u=(i.clientX-fo.clientX+o.x)/(a||1)+(c?c[0]-jm[0]:0)/(a||1),d=(i.clientY-fo.clientY+o.y)/(l||1)+(c?c[1]-jm[1]:0)/(l||1);if(!X.active&&!mi){if(r&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<r)return;this._onDragStart(t,!0)}if(se){s?(s.e+=u-(zm||0),s.f+=d-(Um||0)):s={a:1,b:0,c:0,d:1,e:u,f:d};var m="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");ee(se,"webkitTransform",m),ee(se,"mozTransform",m),ee(se,"msTransform",m),ee(se,"transform",m),zm=u,Um=d,wn=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!se){var t=this.options.fallbackOnBody?document.body:De,n=Qe(B,!0,vc,!0,t),r=this.options;if(vc){for(bt=t;ee(bt,"position")==="static"&&ee(bt,"transform")==="none"&&bt!==document;)bt=bt.parentNode;bt!==document.body&&bt!==document.documentElement?(bt===document&&(bt=$n()),n.top+=bt.scrollTop,n.left+=bt.scrollLeft):bt=$n(),jm=Mw(bt)}se=B.cloneNode(!0),Gt(se,r.ghostClass,!1),Gt(se,r.fallbackClass,!0),Gt(se,r.dragClass,!0),ee(se,"transition",""),ee(se,"transform",""),ee(se,"box-sizing","border-box"),ee(se,"margin",0),ee(se,"top",n.top),ee(se,"left",n.left),ee(se,"width",n.width),ee(se,"height",n.height),ee(se,"opacity","0.8"),ee(se,"position",vc?"absolute":"fixed"),ee(se,"zIndex","100000"),ee(se,"pointerEvents","none"),X.ghost=se,t.appendChild(se),ee(se,"transform-origin",Hw/parseInt(se.style.width)*100+"% "+Fw/parseInt(se.style.height)*100+"%")}},_onDragStart:function(t,n){var r=this,o=t.dataTransfer,i=r.options;if(Ht("dragStart",this,{evt:t}),X.eventCanceled){this._onDrop();return}Ht("setupClone",this),X.eventCanceled||(Fe=Dw(B),Fe.removeAttribute("id"),Fe.draggable=!1,Fe.style["will-change"]="",this._hideClone(),Gt(Fe,this.options.chosenClass,!1),X.clone=Fe),r.cloneId=Sc(function(){Ht("clone",r),!X.eventCanceled&&(r.options.removeCloneOnHide||De.insertBefore(Fe,B),r._hideClone(),kt({sortable:r,name:"clone"}))}),!n&&Gt(B,i.dragClass,!0),n?(mc=!0,r._loopId=setInterval(r._emulateDragOver,50)):(me(document,"mouseup",r._onDrop),me(document,"touchend",r._onDrop),me(document,"touchcancel",r._onDrop),o&&(o.effectAllowed="move",i.setData&&i.setData.call(r,o,B)),pe(document,"drop",r),ee(B,"transform","translateZ(0)")),mi=!0,r._dragStartId=Sc(r._dragStarted.bind(r,n,t)),pe(document,"selectstart",r),Us=!0,window.getSelection().removeAllRanges(),$s&&ee(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=X.active,u=fc===l,d=a.sort,m=ht||c,h,f=this,g=!1;if(Vm)return;function E(te,fe){Ht(te,f,Fn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:s,dragRect:o,targetRect:i,canSort:d,fromSortable:m,target:r,completed:T,onMove:function(Y,be){return Ec(De,n,B,o,Y,Qe(Y),t,be)},changed:L},fe))}function w(){E("dragOverAnimationCapture"),f.captureAnimationState(),f!==m&&m.captureAnimationState()}function T(te){return E("dragOverCompleted",{insertion:te}),te&&(u?c._hideClone():c._showClone(f),f!==m&&(Gt(B,ht?ht.options.ghostClass:c.options.ghostClass,!1),Gt(B,a.ghostClass,!0)),ht!==f&&f!==X.active?ht=f:f===X.active&&ht&&(ht=null),m===f&&(f._ignoreWhileAnimating=r),f.animateAll(function(){E("dragOverAnimationComplete"),f._ignoreWhileAnimating=null}),f!==m&&(m.animateAll(),m._ignoreWhileAnimating=null)),(r===B&&!B.animated||r===n&&!r.animated)&&(hi=null),!a.dragoverBubble&&!t.rootEl&&r!==document&&(B.parentNode[Bt]._isOutsideThisEl(t.target),!te&&mo(t)),!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),g=!0}function L(){Xt=sn(B),Ir=sn(B,a.draggable),kt({sortable:f,name:"change",toEl:n,newIndex:Xt,newDraggableIndex:Ir,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),r=Sn(r,a.draggable,n,!0),E("dragOver"),X.eventCanceled)return g;if(B.contains(t.target)||r.animated&&r.animatingX&&r.animatingY||f._ignoreWhileAnimating===r)return T(!1);if(mc=!1,c&&!a.disabled&&(u?d||(s=Ve!==De):ht===this||(this.lastPutMode=fc.checkPull(this,c,B,t))&&l.checkPut(this,c,B,t))){if(h=this._getDirection(t,r)==="vertical",o=Qe(B),E("dragOverValid"),X.eventCanceled)return g;if(s)return Ve=De,w(),this._hideClone(),E("revert"),X.eventCanceled||(uo?De.insertBefore(B,uo):De.appendChild(B)),T(!0);var y=$m(n,a.draggable);if(!y||tH(t,h,this)&&!y.animated){if(y===B)return T(!1);if(y&&n===t.target&&(r=y),r&&(i=Qe(r)),Ec(De,n,B,o,r,i,t,!!r)!==!1)return w(),y&&y.nextSibling?n.insertBefore(B,y.nextSibling):n.appendChild(B),Ve=n,L(),T(!0)}else if(y&&eH(t,h,this)){var p=ui(n,0,a,!0);if(p===B)return T(!1);if(r=p,i=Qe(r),Ec(De,n,B,o,r,i,t,!1)!==!1)return w(),n.insertBefore(B,p),Ve=n,L(),T(!0)}else if(r.parentNode===n){i=Qe(r);var v=0,C,b=B.parentNode!==n,S=!K7(B.animated&&B.toRect||o,r.animated&&r.toRect||i,h),_=h?"top":"left",k=Rw(r,"top","top")||Rw(B,"top","top"),x=k?k.scrollTop:void 0;hi!==r&&(C=i[_],Vs=!1,pc=!S&&a.invertSwap||b),v=nH(t,r,i,h,S?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,pc,hi===r);var N;if(v!==0){var W=sn(B);do W-=v,N=Ve.children[W];while(N&&(ee(N,"display")==="none"||N===se))}if(v===0||N===r)return T(!1);hi=r,js=v;var O=r.nextElementSibling,P=!1;P=v===1;var Q=Ec(De,n,B,o,r,i,t,P);if(Q!==!1)return(Q===1||Q===-1)&&(P=Q===1),Vm=!0,setTimeout(J7,30),w(),P&&!O?n.appendChild(B):r.parentNode.insertBefore(B,P?O:r),k&&Iw(k,0,x-k.scrollTop),Ve=B.parentNode,C!==void 0&&!pc&&(gc=Math.abs(C-Qe(r)[_])),L(),T(!0)}if(n.contains(B))return T(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){me(document,"mousemove",this._onTouchMove),me(document,"touchmove",this._onTouchMove),me(document,"pointermove",this._onTouchMove),me(document,"dragover",mo),me(document,"mousemove",mo),me(document,"touchmove",mo)},_offUpEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._onDrop),me(t,"touchend",this._onDrop),me(t,"pointerup",this._onDrop),me(t,"pointercancel",this._onDrop),me(t,"touchcancel",this._onDrop),me(document,"selectstart",this)},_onDrop:function(t){var n=this.el,r=this.options;if(Xt=sn(B),Ir=sn(B,r.draggable),Ht("drop",this,{evt:t}),Ve=B&&B.parentNode,Xt=sn(B),Ir=sn(B,r.draggable),X.eventCanceled){this._nulling();return}mi=!1,pc=!1,Vs=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Xm(this.cloneId),Xm(this._dragStartId),this.nativeDraggable&&(me(document,"drop",this),me(n,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),$s&&ee(document.body,"user-select",""),ee(B,"transform",""),t&&(Us&&(t.cancelable&&t.preventDefault(),!r.dropBubble&&t.stopPropagation()),se&&se.parentNode&&se.parentNode.removeChild(se),(De===Ve||ht&&ht.lastPutMode!=="clone")&&Fe&&Fe.parentNode&&Fe.parentNode.removeChild(Fe),B&&(this.nativeDraggable&&me(B,"dragend",this),Gm(B),B.style["will-change"]="",Us&&!mi&&Gt(B,ht?ht.options.ghostClass:this.options.ghostClass,!1),Gt(B,this.options.chosenClass,!1),kt({sortable:this,name:"unchoose",toEl:Ve,newIndex:null,newDraggableIndex:null,originalEvent:t}),De!==Ve?(Xt>=0&&(kt({rootEl:Ve,name:"add",toEl:Ve,fromEl:De,originalEvent:t}),kt({sortable:this,name:"remove",toEl:Ve,originalEvent:t}),kt({rootEl:Ve,name:"sort",toEl:Ve,fromEl:De,originalEvent:t}),kt({sortable:this,name:"sort",toEl:Ve,originalEvent:t})),ht&&ht.save()):Xt!==fi&&Xt>=0&&(kt({sortable:this,name:"update",toEl:Ve,originalEvent:t}),kt({sortable:this,name:"sort",toEl:Ve,originalEvent:t})),X.active&&((Xt==null||Xt===-1)&&(Xt=fi,Ir=zs),kt({sortable:this,name:"end",toEl:Ve,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){Ht("nulling",this),De=B=Ve=se=uo=Fe=dc=Pr=fo=wn=Us=Xt=Ir=fi=zs=hi=js=ht=fc=X.dragged=X.ghost=X.clone=X.active=null;var t=this.el;bc.forEach(function(n){t.contains(n)&&(n.checked=!0)}),bc.length=zm=Um=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":B&&(this._onDragOver(t),Q7(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],Sn(n,s.draggable,this.el,!1)&&t.push(n.getAttribute(s.dataIdAttr)||oH(n));return t},sort:function(t,n){var r={},o=this.el;this.toArray().forEach(function(i,s){var a=o.children[s];Sn(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 Sn(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=qs.modifyOption(this,t,n);typeof o<"u"?r[t]=o:r[t]=n,t==="group"&&zw(r)},destroy:function(){Ht("destroy",this);var t=this.el;t[Bt]=null,me(t,"mousedown",this._onTapStart),me(t,"touchstart",this._onTapStart),me(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(me(t,"dragover",this),me(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(n){n.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),hc.splice(hc.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!Pr){if(Ht("hideClone",this),X.eventCanceled)return;ee(Fe,"display","none"),this.options.removeCloneOnHide&&Fe.parentNode&&Fe.parentNode.removeChild(Fe),Pr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Pr){if(Ht("showClone",this),X.eventCanceled)return;B.parentNode==De&&!this.options.group.revertClone?De.insertBefore(Fe,B):uo?De.insertBefore(Fe,uo):De.appendChild(Fe),this.options.group.revertClone&&this.animate(B,Fe),ee(Fe,"display",""),Pr=!1}}};function Q7(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}function Ec(e,t,n,r,o,i,s,a){var l,c=e[Bt],u=c.options.onMove,d;return window.CustomEvent&&!dr&&!Fs?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||Qe(t),l.willInsertAfter=a,l.originalEvent=s,e.dispatchEvent(l),u&&(d=u.call(c,l,s)),d}function Gm(e){e.draggable=!1}function J7(){Vm=!1}function eH(e,t,n){var r=Qe(ui(n.el,0,n.options,!0)),o=Bw(n.el,n.options,se),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 tH(e,t,n){var r=Qe($m(n.el,n.options.draggable)),o=Bw(n.el,n.options,se),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 nH(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,m=!1;if(!s){if(a&&gc<c*o){if(!Vs&&(js===1?l>u+c*i/2:l<d-c*i/2)&&(Vs=!0),Vs)m=!0;else if(js===1?l<u+gc:l>d-gc)return-js}else if(l>u+c*(1-o)/2&&l<d-c*(1-o)/2)return rH(t)}return m=m||s,m&&(l<u+c*i/2||l>d-c*i/2)?l>u+c/2?1:-1:0}function rH(e){return sn(B)<sn(e)?1:-1}function oH(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 iH(e){bc.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var r=t[n];r.checked&&bc.push(r)}}function Sc(e){return setTimeout(e,0)}function Xm(e){return clearTimeout(e)}yc&&pe(document,"touchmove",function(e){(X.active||mi)&&e.cancelable&&e.preventDefault()}),X.utils={on:pe,off:me,css:ee,find:Ow,is:function(t,n){return!!Sn(t,n,t,!1)},extend:W7,throttle:Pw,closest:Sn,toggleClass:Gt,clone:Dw,index:sn,nextTick:Sc,cancelNextTick:Xm,detectDirection:qw,getChild:ui,expando:Bt},X.get=function(e){return e[Bt]},X.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&&(X.utils=Fn(Fn({},X.utils),r.utils)),qs.mount(r)})},X.create=function(e,t){return new X(e,t)},X.version=F7;var Je=[],Gs,Km,Ym=!1,Zm,Qm,wc,Xs;function sH(){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?pe(document,"dragover",this._handleAutoScroll):this.options.supportPointer?pe(document,"pointermove",this._handleFallbackAutoScroll):r.touches?pe(document,"touchmove",this._handleFallbackAutoScroll):pe(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(n){var r=n.originalEvent;!this.options.dragOverBubble&&!r.rootEl&&this._handleAutoScroll(r)},drop:function(){this.sortable.nativeDraggable?me(document,"dragover",this._handleAutoScroll):(me(document,"pointermove",this._handleFallbackAutoScroll),me(document,"touchmove",this._handleFallbackAutoScroll),me(document,"mousemove",this._handleFallbackAutoScroll)),Vw(),_c(),q7()},nulling:function(){wc=Km=Gs=Ym=Xs=Zm=Qm=null,Je.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(wc=n,r||this.options.forceAutoScrollFallback||Fs||dr||$s){Jm(n,this.options,a,r);var l=Mr(a,!0);Ym&&(!Xs||i!==Zm||s!==Qm)&&(Xs&&Vw(),Xs=setInterval(function(){var c=Mr(document.elementFromPoint(i,s),!0);c!==l&&(l=c,_c()),Jm(n,o.options,c,r)},10),Zm=i,Qm=s)}else{if(!this.options.bubbleScroll||Mr(a,!0)===$n()){_c();return}Jm(n,this.options,Mr(a,!1),!1)}}},cr(e,{pluginName:"scroll",initializeByDefault:!0})}function _c(){Je.forEach(function(e){clearInterval(e.pid)}),Je=[]}function Vw(){clearInterval(Xs)}var Jm=Pw(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=$n(),c=!1,u;Km!==n&&(Km=n,_c(),Gs=t.scroll,u=t.scrollFn,Gs===!0&&(Gs=Mr(n,!0)));var d=0,m=Gs;do{var h=m,f=Qe(h),g=f.top,E=f.bottom,w=f.left,T=f.right,L=f.width,y=f.height,p=void 0,v=void 0,C=h.scrollWidth,b=h.scrollHeight,S=ee(h),_=h.scrollLeft,k=h.scrollTop;h===l?(p=L<C&&(S.overflowX==="auto"||S.overflowX==="scroll"||S.overflowX==="visible"),v=y<b&&(S.overflowY==="auto"||S.overflowY==="scroll"||S.overflowY==="visible")):(p=L<C&&(S.overflowX==="auto"||S.overflowX==="scroll"),v=y<b&&(S.overflowY==="auto"||S.overflowY==="scroll"));var x=p&&(Math.abs(T-o)<=s&&_+L<C)-(Math.abs(w-o)<=s&&!!_),N=v&&(Math.abs(E-i)<=s&&k+y<b)-(Math.abs(g-i)<=s&&!!k);if(!Je[d])for(var W=0;W<=d;W++)Je[W]||(Je[W]={});(Je[d].vx!=x||Je[d].vy!=N||Je[d].el!==h)&&(Je[d].el=h,Je[d].vx=x,Je[d].vy=N,clearInterval(Je[d].pid),(x!=0||N!=0)&&(c=!0,Je[d].pid=setInterval(function(){r&&this.layer===0&&X.active._onTouchMove(wc);var O=Je[this.layer].vy?Je[this.layer].vy*a:0,P=Je[this.layer].vx?Je[this.layer].vx*a:0;typeof u=="function"&&u.call(X.dragged.parentNode[Bt],P,O,e,wc,Je[this.layer].el)!=="continue"||Iw(Je[this.layer].el,P,O)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&m!==l&&(m=Mr(m,!1)));Ym=c}},30),Gw=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 eh(){}eh.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=ui(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:Gw},cr(eh,{pluginName:"revertOnSpill"});function th(){}th.prototype={onSpill:function(t){var n=t.dragEl,r=t.putSortable||this.sortable;r.captureAnimationState(),n.parentNode&&n.parentNode.removeChild(n),r.animateAll()},drop:Gw},cr(th,{pluginName:"removeOnSpill"}),X.mount(new sH),X.mount(th,eh);var Xw=100,Kw=Symbol("EMULATED_DRAG_EVENT");function aH(e,t){return e[Kw]===t}var Yw=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[Kw]=this,Mt(()=>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)},Xw),!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)},Xw)))}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 Cc(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 Ks(e){const t=getComputedStyle(e);return e.clientWidth-(parseFloat(t.paddingLeft)||0)-(parseFloat(t.paddingRight)||0)}function nh(e){const t=document.createElement("div");t.replaceChildren(...Re(e.atomHTML));const n=t.querySelector("img");if(!n)return Tt(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=Ks(e.targetAtom):r=e.targetAtom.parentNode?Ks(e.targetAtom.parentNode):Ks(e.targetAtom),n.setAttribute("width",String(r)),document.querySelector(".noresp-em-narrow-table")?Cc(t):n.style.maxWidth=r+"px",Tt(t)}function Zw(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=Ks(n);o.style.display=a;const c=s>=Ks(t)?l:Math.min(s,l);return!c||c===s?!1:(o.setAttribute("width",String(c)),document.querySelector(".noresp-em-narrow-table")?Cc(e):o.style.maxWidth=c+"px",!0)}function Qw(e,t){const n=e.atomHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");n.replaceChildren(...Re(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")?Cc(n):(r.style.maxWidth=i+"px",r.style.width="100%"),Jn(e.targetElem,e.targetPlace,`
|
|
52
52
|
`+Tt(n)+`
|
|
53
|
-
`),t()},o.src=r.getAttribute("src")||"",!1}function rh(e){const t=e.blockHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");t.replaceChildren(...Re(e.blockHTML));const n=t.querySelector("img.em-countdown");if(!n)return Tt(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()),Dt(n,"src",i.href),n.setAttribute("em-cd-settings",i.search.substring(1)),Tt(t)}function Tc(e){const t=e.blockIsTr?document.createElement("table"):document.createElement("div");return t.replaceChildren(...Re(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(" ")}),Cc(t),Tt(t)}function lH(e){e&&(e.removeAttribute("em-edit"),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")))}var cH=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=X.create(e,t);return this._items.set(e,n),n}entries(){return[...this._items]}},Dr=new cH,uH=Number.MAX_VALUE,dH=0;function Jw(e){return typeof e=="object"?e.name:e}var fH=class{constructor(){A(this,"emulator",new Yw),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)))}},an=new fH,e_=X.prototype,mH=mt(e_._onDragOver);function hH(e){Dr.gc(),an.track(),e_._onDragOver=mH;const t=document.querySelectorAll("[em=group]");X.prototype._emulateDragOver=function(){};let n;const r=()=>{e.commit(!0)};function o(a,l){let c;function u(f,g){let E=null,w=Number.MAX_VALUE;const T=Jw(X.active?.options.group);for(const[L,y]of Dr.entries())if(Jw(y.options.group)===T&&(!a||c&&a(L,c)!==!1)){for(const p of L.children)if(!p.classList.contains("sortable-drag")){const v=p.getBoundingClientRect(),C=f<v.left?v.left-f:f>v.right?f-v.right:0,b=g<v.top?v.top-g:g>v.bottom?g-v.bottom:0;if(C<uH||b<dH){const S=Math.sqrt(C*C+b*b);S<w?(E=[y,p],w=S):S===w&&E[1].contains(p)&&(E=[y,p])}}}return E}function d(f){const g="TouchEvent"in window&&f instanceof TouchEvent?f.touches[0]:f,E=u(g.clientX,g.clientY);if(E){const[L,y]=E,p=y.getBoundingClientRect();var w={clientX:p.left+p.width/2,clientY:g.clientY};for(var T in f)f.hasOwnProperty(T)&&(w[T]=f[T]);w.target=y,w.rootEl=y.parentNode,w.preventDefault=void 0,w.stopPropagation=void 0,L._onDragOver(w)}}return{onStart:f=>{c=f.item,X.ghost&&Yd(X.ghost),lH(X.ghost),e.beginTextUpdate(),window.addEventListener("mousemove",d),window.addEventListener("touchmove",d),an.emulator.start(an.x,an.y)?(window.addEventListener("mousemove",an.handleMouseMove),n&&(n.dispose(),n=void 0)):f.preventDefault()},onEnd:f=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d);let g=!1;f.from===f.to?an.emulator.end(an.x,an.y):(g=!!l?.(f),an.emulator.drop(an.x,an.y)),window.removeEventListener("mousemove",an.handleMouseMove),e.endTextUpdate(),f.from===f.to&&f.oldIndex!==f.newIndex&&e.commit(!0),g&&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&&!Dr.get(l)&&Dr.create(l,{forceFallback:!0,group:"groups-sorting",handle:`.of-group .${je.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),Dr.get(l)||Dr.create(l,{forceFallback:!0,group:"atoms-sorting",handle:`.of-atom .${je.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&&Mn(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=>Zw(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),Dr.get(c)||Dr.create(c,{forceFallback:!0,group:"blocks-sorting",handle:`.of-block .${je.drag}`,...o(),onMove:r}))}}}var pH=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)}},oh={get textDocument(){return R(Rt,Vi)},commit:qo};function gH(){const e=U.get("applicationTheme")||"light";let t=!1;try{oh.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 rh(e){const t=e.blockHTML.substring(0,3)==="<tr"?document.createElement("table"):document.createElement("div");t.replaceChildren(...Re(e.blockHTML));const n=t.querySelector("img.em-countdown");if(!n)return Tt(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()),Dt(n,"src",i.href),n.setAttribute("em-cd-settings",i.search.substring(1)),Tt(t)}function Tc(e){const t=e.blockIsTr?document.createElement("table"):document.createElement("div");return t.replaceChildren(...Re(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(" ")}),Cc(t),Tt(t)}function lH(e){e&&(e.removeAttribute("em-edit"),e.querySelectorAll("[em-edit]").forEach(t=>t.removeAttribute("em-edit")))}var cH=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=X.create(e,t);return this._items.set(e,n),n}entries(){return[...this._items]}},Dr=new cH,uH=Number.MAX_VALUE,dH=0;function Jw(e){return typeof e=="object"?e.name:e}var fH=class{constructor(){A(this,"emulator",new Yw),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)))}},an=new fH,e_=X.prototype,mH=mt(e_._onDragOver);function hH(e){Dr.gc(),an.track(),e_._onDragOver=mH;const t=document.querySelectorAll("[em=group]");X.prototype._emulateDragOver=function(){};let n;const r=()=>{e.commit(!0)};function o(a,l){let c;function u(f,g){let E=null,w=Number.MAX_VALUE;const T=Jw(X.active?.options.group);for(const[L,y]of Dr.entries())if(Jw(y.options.group)===T&&(!a||c&&a(L,c)!==!1)){for(const p of L.children)if(!p.classList.contains("sortable-drag")){const v=p.getBoundingClientRect(),C=f<v.left?v.left-f:f>v.right?f-v.right:0,b=g<v.top?v.top-g:g>v.bottom?g-v.bottom:0;if(C<uH||b<dH){const S=Math.sqrt(C*C+b*b);S<w?(E=[y,p],w=S):S===w&&E[1].contains(p)&&(E=[y,p])}}}return E}function d(f){const g="TouchEvent"in window&&f instanceof TouchEvent?f.touches[0]:f,E=u(g.clientX,g.clientY);if(E){const[L,y]=E,p=y.getBoundingClientRect();var w={clientX:p.left+p.width/2,clientY:g.clientY};for(var T in f)f.hasOwnProperty(T)&&(w[T]=f[T]);w.target=y,w.rootEl=y.parentNode,w.preventDefault=void 0,w.stopPropagation=void 0,L._onDragOver(w)}}return{onStart:f=>{c=f.item,X.ghost&&Yd(X.ghost),lH(X.ghost),e.beginTextUpdate(),window.addEventListener("mousemove",d),window.addEventListener("touchmove",d),an.emulator.start(an.x,an.y)?(window.addEventListener("mousemove",an.handleMouseMove),n&&(n.dispose(),n=void 0)):f.preventDefault()},onEnd:f=>{window.removeEventListener("mousemove",d),window.removeEventListener("touchmove",d);let g=!1;f.from===f.to?an.emulator.end(an.x,an.y):(g=!!l?.(f),an.emulator.drop(an.x,an.y)),window.removeEventListener("mousemove",an.handleMouseMove),e.endTextUpdate(),f.from===f.to&&f.oldIndex!==f.newIndex&&e.commit(!0),g&&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&&!Dr.get(l)&&Dr.create(l,{forceFallback:!0,group:"groups-sorting",handle:`.of-group .${je.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),Dr.get(l)||Dr.create(l,{forceFallback:!0,group:"atoms-sorting",handle:`.of-atom .${je.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&&Mn(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=>Zw(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),Dr.get(c)||Dr.create(c,{forceFallback:!0,group:"blocks-sorting",handle:`.of-block .${je.drag}`,...o(),onMove:r}))}}}var pH=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)}},oh={get textDocument(){return R(Rt,Vi)},commit:qo};function gH(){const e=U.get("applicationTheme")||"light";let t=!1;try{oh.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?33f5584d";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?33f5584d`;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{oh.textDocument.endUpdate()}t&&oh.commit(!1)}var xee=".em-prevent-action";function bH(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 yH(e){const t=document.body;if(!t)return;const n=e.isAppLocked()||e.isIntegratorLocked();(e.isAppLocked()!==t.classList.contains("mceNonEditable")||e.isIntegratorLocked())&&Ie(t,!!n,"mceNonEditable"),Ie(t,!!U.get("previewPage"),"em-sandbox-preview")}function vH(e){const{htmlDocument:t,commit:n,focusController:r}=e,o=M7(()=>hH(t));t.onChange(a=>{a.some(l=>l.added.length||l.characterDataChanged||l.reordered?.length||l.reparented?.length)&&o()}),t.onChange(()=>{gH()}),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 pH;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(O7(e.applicationElementSettingsSet)),t.onChange(()=>{e.selectionLock.isLocked()||(bH(e),yH(e.editLock))})}function EH(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"),Mt(()=>document.querySelectorAll("editor").forEach(i=>i.blur())),t.forget()}finally{o.releaseLater()}}function SH(e,t){const n=mt(r=>EH(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 wH={name:"sandbox.fingerprint",provides:[Lo],awaits:{services:[K,Me]},setup(e){const t=R(e,K),n=R(e,Me),r=JR(o=>t.getOuterHtml(o));eM(r,n),SH(r,n),e.inject(Lo,r)}},_H={name:"sandbox.setCursor",provides:[Ot],awaits:{services:[K,mn,_t]},setup(e){const t={HTMLDocument:R(e,K),documentMapping:R(e,mn),remoteDocument:R(e,_t),messageService:G};e.inject(Ot,n=>nM(n,t))}},CH={name:"sandbox.wrapEditor",provides:[hn],awaits:{services:[K,mn,Te]},setup:e=>e.inject(hn,k7({commit:lt(e),htmlDocument:R(e,K),documentMapping:R(e,mn)}))};function TH(e){const{container:t}=e;Ms.registerAll({MessageService:()=>G,FocusState:()=>e.focusController,SyncService:()=>t.getInstance(K),SyncServiceInternals:()=>t.getInstance(_t),TextDocument:()=>t.getInstance(Vi),Mapping:()=>t.getInstance(mn),EditorSurface:()=>({surface:e.surface})}),e.features&&e.features.length>0&&Ms.initFeatures(e.features)}var AH=e=>e,kH=e=>`table:empty::before {
|
|
54
54
|
/*content: 'Paste block here';*/
|
|
55
55
|
}
|
|
56
56
|
|