1import{a as fn,c as vn,m as yn}from"./chunk-A6OESW6W.js";import"./chunk-JDQTM4TK.js";import{b as mn}from"./chunk-X2JJBX2U.js";import"./chunk-2LCN7GIH.js";import{b as Cn,c as Tn}from"./chunk-GMS5YTYV.js";import"./chunk-KJ4QD3SP.js";import{a as pn}from"./chunk-3ORFLDEQ.js";import"./chunk-DR3JU5EU.js";import{a as hn,b as un}from"./chunk-ZRDGGLZM.js";import"./chunk-MELO2MRH.js";import"./chunk-ZUTNCURO.js";import{a as Ee,b as En}from"./chunk-4MJYK4HN.js";import"./chunk-GQIMCUCB.js";import"./chunk-5M4XIZMD.js";import{a as _n,b as gn,c as Zt,g as Jt}from"./chunk-2BFVK5HI.js";import"./chunk-3LVDM64V.js";import{G as Xt,i as dn}from"./chunk-6HN5HIFJ.js";import"./chunk-VTF4T7ID.js";import{d as tn,l as nn,o as on,w as rn,z as sn}from"./chunk-GQC2THZT.js";import{r as en,s as ye}from"./chunk-E7TZAWVT.js";import{b as Qe}from"./chunk-EKVTZPVT.js";import"./chunk-S54BMOKL.js";import"./chunk-3ZR4SHJC.js";import{d as qt}from"./chunk-K75VSEIY.js";import"./chunk-7FRBKRRG.js";import"./chunk-WPWHXKEF.js";import"./chunk-ZWC24XOW.js";import{Ua as Je,kb as Yt,lb as Qt,w as wt}from"./chunk-2U5T7ZRU.js";import"./chunk-HFHRXST3.js";import{D as Ye,H as an,L as ln,P as cn,Q as $t,R as Kt,h as $e,w as Ke,y as Gt,z as Xe}from"./chunk-EHK3LLER.js";import{K as Ze}from"./chunk-UZFNZKCX.js";import{D as Wt,k as Ge,y as qe}from"./chunk-YDFILND7.js";import{Ac as ht,Ad as Ve,Da as X,Ea as Y,Gb as De,Hb as W,Hc as rt,I as xe,Jc as xt,K as we,Kc as $,La as _t,Ob as gt,Oc as Bt,Od as We,Pa as _e,Pb as Ft,Pc as jt,Qb as Ae,Qc as zt,Uc as Nt,Wc as Vt,Xa as Me,Yc as ke,Zc as tt,_c as Et,ad as Oe,dd as He,ed as Ue,f as Se,fd as Pe,gc as Re,ia as Dt,
1ja as Ie,jc as ct,kd as Fe,la as lt,lc as dt,nc as fe,nd as Be,oc as At,od as je,pc as Rt,qb as Le,qc as ft,r as me,ra as mt,rc as K,sa as Pt,sc as q,tc as vt,uc as yt,vb as ge,vc as pt,wa as st,wc as Ne,wd as ve,xb as G,yd as ze}from"./chunk-TROGQXTX.js";import{e as kn,g as On,i as z}from"./chunk-S6MAVN2Q.js";var Nn=kn((Lt,nt)=>{z();(function(){var c;c={},c.Machine=(function(){function m(p){this.context=p,this._stateTransitions={},this._stateTransitionsAny={},this._defaultTransition=null,this._initialState=null,this._currentState=null}return m.prototype.addTransition=function(p,v,y,L){return y||(y=v),this._stateTransitions[[p,v]]=[y,L]},m.prototype.addTransitions=function(p,v,y,L){var S,w,k,l;for(y||(y=v),l=[],w=0,k=p.length;w<k;w++)S=p[w],l.push(this.addTransition(S,v,y,L));return l},m.prototype.addTransitionAny=function(p,v,y){return v||(v=p),this._stateTransitionsAny[p]=[v,y]},m.prototype.setDefaultTransition=function(p,v){return this._defaultTransition=[p,v]},m.prototype.getTransition=function(p,v){if(this._stateTransitions[[p,v]])return this._stateTransitions[[p,v]];if(this._stateTransitionsAny[v])return this._stateTransitionsAny[v];if(this._defaultTransition)return this._defaultTransition;throw new Error("Transition is undefined: ("+p+", "+v+")")},m.prototype.getCurrentState=function(){return this._currentState},m.prototype.setInitialState=function(p){if(this._initialState=p,!this._currentState)return this.reset()},m.prototype.reset=function(){return this._currentState=this._initialState},m.prototype.process=function(p){var v;return v=this.getTransition(p,this._currentState),v[1]&&v[1].call(this.context||(this.context=this),p),this._currentState=v[0]},m})(),typeof window<"u"&&(window.FSM=c),typeof nt<"u"&&nt.exports&&(nt.exports=c)}).call(Lt),function(){var c,m,p,v,y,L,S,w,k,l,e,t,n,i,o,r,s,a,h,_,f,T,x,M,A,R,U=[].slice,H=[].indexOf||function(b){for(var d=0,u=this.length;d<u;d++)if(d in this&&this[d]===b)return d;return-1};a={},typeof window<"u"&&(window.HTMLString=a),typeof nt<"u"&&nt.exports&&(nt.exports=a),a.String=(function(){function b(d,u){u==null&&(u=!1),this._preserveWhitespace=u,d?(a.String._parser===null&&(a.String._parser=new R),this.characters=a.String._parser.parse(d,this._preserveWhitespace).characters):this.characters=[]}return b._parser=null,b.prototype.isWhitespace=function(){var d,u,g,E;for(E=this.characters,u=0,g=E.length;u<g;u++)if(d=E[u],!d.isWhitespace())return!1;return!0},b.prototype.length=function(){return this.characters.length},b.prototype.preserveWhitespace=function(){return this._preserveWhitespace},b.prototype.capitalize=function(){var d,u;return u=this.copy(),u.length()&&(d=u.characters[0]._c.toUpperCase(),u.characters[0]._c=d),u},b.prototype.charAt=function(d){return this.characters[d].copy()},b.prototype.concat=function(){var d,u,g,E,C,I,D,N,O,F,P,j,V,B,Q,Z,J;for(D=2<=arguments.length?U.call(arguments,0,O=arguments.length-1):(O=0,[]),g=arguments[O++],g!==void 0&&typeof g!="boolean"&&(D.push(g),g=!0),C=this.copy(),F=0,V=D.length;F<V;F++)if(I=D[F],I.length!==0){if(N=I,typeof I=="string"&&(N=new a.String(I,this._preserveWhitespace)),g&&C.length())for(u=C.charAt(C.length()-1),E=u.tags(),u.isTag()&&E.shift(),typeof I!="string"&&(N=N.copy()),Z=N.characters,P=0,B=Z.length;P<B;P++)d=Z[P],d.addTags.apply(d,E);for(J=N.characters,j=0,Q=J.length;j<Q;j++)d=J[j],C.characters.push(d)}return C},b.prototype.contains=function(d){var u,g,E,C,I,D,N;if(typeof d=="string")return this.text().indexOf(d)>-1;for(E=0;E<=this.length()-d.length();){for(g=!0,N=d.characters,C=I=0,D=N.length;I<D;C=++I)if(u=N[C],!u.eq(this.characters[C+E])){g=!1;break}if(g)return!0;E++}return!1},b.prototype.endsWith=function(d){var u,g,E,C,I,D;if(typeof d=="string")return d===""||this.text().slice(-d.length)===d;for(g=this.characters.slice().reverse(),D=d.characters.slice().reverse(),E=C=0,I=D.length;C<I;E=++C)if(u=D[E],!u.eq(g[E]))return!1;return!0},b.prototype.format=function(){var d,u,g,E,C,I,D;for(u=arguments[0],I=arguments[1],C=3<=arguments.length?U.call(arguments,2):[],I<0&&(I=this.length()+I+1),u<0&&(u=this.length()+u),E=this.copy(),g=D=u;u<=I?D<I:D>I;g=u<=I?++D:--D)d=E.characters[g],d.addTags.apply(d,C);return E},b.prototype.hasTags=function(){var d,u,g,E,C,I,D,N;for(E=2<=arguments.length?U.call(arguments,0,C=arguments.length-1):(C=0,[]),g=arguments[C++],g!==void 0&&typeof g!="boolean"&&(E.push(g),g=!1),u=!1,N=this.characters,I=0,D=N.length;I<D;I++)if(d=N[I],d.hasTags.apply(d,E))u=!0;else if(g)return!1;return u},b.prototype.html=function(){var d,u,g,E,C,I,D,N,O,F,P,j,V,B,Q,Z,J,it,ot,at,Ct,Tt,bt;for(C="",N=[],I=[],g=[],at=this.characters,F=0,B=at.length;F<B;F++){for(d=at[F],g=[],Ct=N.slice().reverse(),P=0,Q=Ct.length;P<Q;P++)if(D=Ct[P],g.push(D),!d.hasTags(D)){for(j=0,Z=g.length;j<Z;j++)u=g[j],C+=u.tail(),N.pop(),I.pop();g=[]}for(Tt=d._tags,V=0,J=Tt.length;V<J;V++)O=Tt[V],I.indexOf(O.head())===-1&&(O.selfClosing()||(E=O.head(),C+=E,N.push(O),I.push(E)));d._tags.length>0&&d._tags[0].selfClosing()&&(C+=d._tags[0].head()),C+=d.c()}for(bt=N.reverse(),ot=0,it=bt.length;ot<it;ot++)O=bt[ot],C+=O.tail();return C},b.prototype.indexOf=function(d,u){var g,E,C,I,D,N;
1if(u==null&&(u=0),u<0&&(u=0),typeof d=="string")return this.text().indexOf(d,u);for(;u<=this.length()-d.length();){for(E=!0,N=d.characters,C=I=0,D=N.length;I<D;C=++I)if(g=N[C],!g.eq(this.characters[C+u])){E=!1;break}if(E)return u;u++}return-1},b.prototype.insert=function(d,u,g){var E,C,I,D,N,O,F,P,j,V,B,Q,Z,J,it,ot;if(g==null&&(g=!0),C=this.slice(0,d),F=this.slice(d),d<0&&(d=this.length()+d),N=u,typeof u=="string"&&(N=new a.String(u,this._preserveWhitespace)),g&&d>0)for(I=this.charAt(d-1),D=I.tags(),I.isTag()&&D.shift(),typeof u!="string"&&(N=N.copy()),J=N.characters,P=0,B=J.length;P<B;P++)E=J[P],E.addTags.apply(E,D);for(O=C,it=N.characters,j=0,Q=it.length;j<Q;j++)E=it[j],O.characters.push(E);for(ot=F.characters,V=0,Z=ot.length;V<Z;V++)E=ot[V],O.characters.push(E);return O},b.prototype.lastIndexOf=function(d,u){var g,E,C,I,D,N,O,F,P;if(u==null&&(u=0),u<0&&(u=0),E=this.characters.slice(u).reverse(),u=0,typeof d=="string"){if(!this.contains(d))return-1;for(d=d.split("").reverse();u<=E.length-d.length;){for(C=!0,D=0,I=N=0,F=d.length;N<F;I=++N)if(g=d[I],E[I+u].isTag()&&(D+=1),g!==E[D+I+u].c()){C=!1;break}if(C)return u;u++}return-1}for(d=d.characters.slice().reverse();u<=E.length-d.length;){for(C=!0,I=O=0,P=d.length;O<P;I=++O)if(g=d[I],!g.eq(E[I+u])){C=!1;break}if(C)return u;u++}return-1},b.prototype.optimize=function(){var d,u,g,E,C,I,D,N,O,F,P,j,V,B,Q,Z,J,it,ot,at,Ct,Tt,bt,Te,be,kt,Ot,Ht,se,ae,le,ce,de,he,ue;for(N=[],I=[],E=null,se=this.characters.slice().reverse(),Q=0,ot=se.length;Q<ot;Q++){for(d=se[Q],d._runLengthMap={},d._runLengthMapSize=0,u=[],ae=N.slice().reverse(),Z=0,at=ae.length;Z<at;Z++)if(D=ae[Z],u.push(D),!d.hasTags(D)){for(J=0,Ct=u.length;J<Ct;J++)u[J],N.pop(),I.pop();u=[]}for(le=d._tags,it=0,Tt=le.length;it<Tt;it++)B=le[it],I.indexOf(B.head())===-1&&(B.selfClosing()||(N.push(B),I.push(B.head())));for(kt=0,bt=N.length;kt<bt;kt++)B=N[kt],g=B.head(),E?(d._runLengthMap[g]||(d._runLengthMap[g]=[B,0]),j=0,E._runLengthMap[g]&&(j=E._runLengthMap[g][1]),d._runLengthMap[g][1]=j+1):d._runLengthMap[g]=[B,1];E=d}for(F=function(Ut,St){return St[1]-Ut[1]},ce=this.characters,ue=[],Ot=0,Te=ce.length;Ot<Te;Ot++)if(d=ce[Ot],!((C=d._tags.length)>0&&d._tags[0].selfClosing()&&C<3||C<2)){P=[],de=d._runLengthMap;for(B in de)O=de[B],P.push(O);for(P.sort(F),he=d._tags.slice(),Ht=0,be=he.length;Ht<be;Ht++)B=he[Ht],B.selfClosing()||d.removeTags(B);ue.push(d.addTags.apply(d,(function(){var Ut,St,pe;for(pe=[],St=0,Ut=P.length;St<Ut;St++)V=P[St],pe.push(V[0]);return pe})()))}return ue},b.prototype.slice=function(d,u){var g,E;return E=new a.String("",this._preserveWhitespace),E.characters=function(){var C,I,D,N;for(D=this.characters.slice(d,u),N=[],C=0,I=D.length;C<I;C++)g=D[C],N.push(g.copy());return N}.call(this),E},b.prototype.split=function(d,u){var g,E,C,I,D,N,O,F,P,j;for(d==null&&(d=""),u==null&&(u=0),N=0,g=0,D=[0];!(u>0&&g>u||(I=this.indexOf(d,N))===-1);)D.push(I),N=I+1;for(D.push(this.length()),F=[],C=P=0,j=D.length-2;0<=j?P<=j:P>=j;C=0<=j?++P:--P)O=D[C],C>0&&(O+=1),E=D[C+1],F.push(this.slice(O,E));return F},b.prototype.startsWith=function(d){var u,g,E,C,I;if(typeof d=="string")return this.text().slice(0,d.length)===d;for(I=d.characters,g=E=0,C=I.length;E<C;g=++E)if(u=I[g],!u.eq(this.characters[g]))return!1;return!0},b.prototype.substr=function(d,u){return u<=0?new a.String("",this._preserveWhitespace):(d<0&&(d=this.length()+d),u===void 0&&(u=this.length()-d),this.slice(d,d+u))},b.prototype.substring=function(d,u){return u===void 0&&(u=this.length()),this.slice(d,u)},b.prototype.text=function(){var d,u,g,E,C;for(u="",C=this.characters,g=0,E=C.length;g<E;g++)d=C[g],d.isTag()?d.isTag("br")&&(u+=` 2`):(d.c(),u+=d.c());return this.constructor.decode(u)},b.prototype.toLowerCase=function(){var d,u,g,E,C;for(u=this.copy(),C=u.characters,g=0,E=C.length;g<E;g++)d=C[g],d._c.length===1&&(d._c=d._c.toLowerCase());return u},b.prototype.toUpperCase=function(){var d,u,g,E,C;for(u=this.copy(),C=u.characters,g=0,E=C.length;g<E;g++)d=C[g],d._c.length===1&&(d._c=d._c.toUpperCase());return u},b.prototype.trim=function(){var d,u,g,E,C,I,D,N,O,F;for(O=this.characters,u=C=0,D=O.length;C<D&&(d=O[u],d.isWhitespace());u=++C);for(F=this.characters.slice().reverse(),E=I=0,N=F.length;I<N&&(d=F[E],d.isWhitespace());E=++I);return E=this.length()-E-1,g=new a.String("",this._preserveWhitespace),g.characters=function(){var P,j,V,B;for(V=this.characters.slice(u,+E+1||9e9),B=[],P=0,j=V.length;P<j;P++)d=V[P],B.push(d.copy());return B}.call(this),g},b.prototype.trimLeft=function(){var d,u,g,E,C,I,D;for(E=this.length()-1,D=this.characters,u=C=0,I=D.length;C<I&&(d=D[u],d.isWhitespace());u=++C);return g=new a.String("",this._preserveWhitespace),g.characters=function(){var N,O,F,P;for(F=this.characters.slice(u,+E+1||9e9),P=[],N=0,O=F.length;N<O;N++)d=F[N],P.push(d.copy());return P}.call(this),g},b.prototype.trimRight=function(){var d,u,g,E,C,I,D;for(u=0,D=this.characters.slice().reverse(),E=C=0,I=D.length;C<I&&(d=D[E],d.isWhitespace());E=++C);return E=this.length()-E-1,g=new a.String("",this._preserveWhitespace),g.characters=function(){var N,O,F,P;for(F=this.characters.slice(u,+E+1||9e9),P=[],N=0,O=F.length;N<O;N++)d=F[N],P.push(d.copy());return P}.call(this),g},b.prototype.unformat=function(){var d,u,g,E,C,I,D;for(u=arguments[0],I=arguments[1],C=3<=arguments.length?U.call(arguments,2):[],I<0&&(I=this.length()+I+1),u<0&&(u=this.length()+u),E=this.copy(),g=D=u;u<=I?D<I:D>I;g=u<=I?++D:--D)d=E.characters[g],d.removeTags.apply(d,C);return E},b.prototype.copy=function(){var d,u;
2return u=new a.String("",this._preserveWhitespace),u.characters=function(){var g,E,C,I;for(C=this.characters,I=[],g=0,E=C.length;g<E;g++)d=C[g],I.push(d.copy());return I}.call(this),u},b.decode=function(d){var u;return u=document.createElement("textarea"),u.innerHTML=d,u.textContent},b.encode=function(d){var u;return u=document.createElement("textarea"),u.textContent=d,u.innerHTML},b.join=function(d,u){var g,E,C,I;for(g=u.shift(),C=0,I=u.length;C<I;C++)E=u[C],g=g.concat(d,E);return g},b})(),c="AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz-_$".split(""),m=c.concat("1234567890".split("")),w=m.concat([":"]),s=m.concat(["#"]),f=m.concat([":"]),i=1,r=2,_=3,h=4,o=5,M=6,T=7,A=8,x=9,l=10,S=11,k=12,p=13,n=14,e=15,t=16,y=17,L=18,v=19,R=(function(){function b(){this.fsm=new FSM.Machine(this),this.fsm.setInitialState(i),this.fsm.addTransitionAny(i,null,function(d){return this._pushChar(d)}),this.fsm.addTransition("<",i,_),this.fsm.addTransition("&",i,r),this.fsm.addTransitions(s,r,null,function(d){return this.entity+=d}),this.fsm.addTransition(";",r,i,function(){return this._pushChar("&"+this.entity+";"),this.entity=""}),this.fsm.addTransitions([" ",` 3`],_),this.fsm.addTransitions(c,_,h,function(){return this._back()}),this.fsm.addTransition("/",_,o),this.fsm.addTransitions([" ",` 4`],h),this.fsm.addTransitions(c,h,M,function(){return this._back()}),this.fsm.addTransitions([" ",` 5`],o),this.fsm.addTransitions(c,o,T,function(){return this._back()}),this.fsm.addTransitions(f,M,null,function(d){return this.tagName+=d}),this.fsm.addTransitions([" ",` 6`],M,l),this.fsm.addTransition("/",M,A,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",M,i,function(){return this._pushTag()}),this.fsm.addTransitions([" ",` 7`],A),this.fsm.addTransition(">",A,i,function(){return this._pushTag()}),this.fsm.addTransitions([" ",` 8`],l),this.fsm.addTransition("/",l,A,function(){return this.selfClosing=!0}),this.fsm.addTransition(">",l,i,function(){return this._pushTag()}),this.fsm.addTransitions(c,l,S,function(){return this._back()}),this.fsm.addTransitions(f,T,null,function(d){return this.tagName+=d}),this.fsm.addTransitions([" ",` 9`],T,x),this.fsm.addTransition(">",T,i,function(){return this._popTag()}),this.fsm.addTransitions([" ",` 10`],x),this.fsm.addTransition(">",x,i,function(){return this._popTag()}),this.fsm.addTransitions(w,S,null,function(d){return this.attributeName+=d}),this.fsm.addTransitions([" ",` 11`],S,k),this.fsm.addTransition("=",S,p),this.fsm.addTransitions([" ",` 12`],k),this.fsm.addTransition("=",k,p),this.fsm.addTransitions(">",S,l,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitionAny(k,l,function(){return this._pushAttribute(),this._back()}),this.fsm.addTransitions([" ",` 13`],p),this.fsm.addTransition("'",p,n),this.fsm.addTransition('"',p,e),this.fsm.addTransitions(m.concat(["&"],p,t,function(){return this._back()})),this.fsm.addTransition(" ",t,l,function(){return this._pushAttribute()}),this.fsm.addTransitions(["/",">"],t,l,function(){return this._back(),this._pushAttribute()}),this.fsm.addTransition("&",t,y),this.fsm.addTransitionAny(t,null,function(d){return this.attributeValue+=d}),this.fsm.addTransition("'",n,l,function(){return this._pushAttribute()}),this.fsm.addTransition("&",n,L),this.fsm.addTransitionAny(n,null,function(d){return this.attributeValue+=d}),this.fsm.addTransition('"',e,l,function(){return this._pushAttribute()}),this.fsm.addTransition("&",e,v),this.fsm.addTransitionAny(e,null,function(d){return this.attributeValue+=d}),this.fsm.addTransitions(s,y,null,function(d){return this.entity+=d}),this.fsm.addTransitions(s,L,function(d){return this.entity+=d}),this.fsm.addTransitions(s,v,null,function(d){return this.entity+=d}),this.fsm.addTransition(";",y,t,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",L,n,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""}),this.fsm.addTransition(";",v,e,function(){return this.attributeValue+="&"+this.entity+";",this.entity=""})}return b.prototype._back=function(){return this.head--},b.prototype._pushAttribute=function(){return this.attributes[this.attributeName]=this.attributeValue,this.attributeName="",this.attributeValue=""},b.prototype._pushChar=function(d){var u,g;
13return u=new a.Character(d,this.tags),this._preserveWhitespace?void this.string.characters.push(u):!this.string.length()||u.isTag()||u.isEntity()||!u.isWhitespace()||(g=this.string.characters[this.string.length()-1],!g.isWhitespace()||g.isTag()||g.isEntity())?this.string.characters.push(u):void 0},b.prototype._pushTag=function(){var d,u;return d=new a.Tag(this.tagName,this.attributes),this.tags.push(d),d.selfClosing()&&(this._pushChar(""),this.tags.pop(),!this.selfClosed&&(u=this.tagName,H.call(a.Tag.SELF_CLOSING,u)>=0)&&this.fsm.reset()),this.tagName="",this.selfClosed=!1,this.attributes={}},b.prototype._popTag=function(){for(var d,u;u=this.tags.pop(),this.string.length()&&(d=this.string.characters[this.string.length()-1],d.isTag()||d.isEntity()||!d.isWhitespace()||d.removeTags(u)),u.name()!==this.tagName.toLowerCase(););return this.tagName=""},b.prototype.parse=function(d,u){var g,E;for(this._preserveWhitespace=u,this.reset(),d=this.preprocess(d),this.fsm.parser=this;this.head<d.length;){g=d[this.head];try{this.fsm.process(g)}catch(C){throw E=C,new Error("Error at char "+this.head+" >> "+E)}this.head++}return this.string},b.prototype.preprocess=function(d){return d=d.replace(/\r\n/g,` 14`).replace(/\r/g,` 15`),d=d.replace(/<!--[\s\S]*?-->/g,""),this._preserveWhitespace||(d=d.replace(/\s+/g," ")),d},b.prototype.reset=function(){return this.fsm.reset(),this.head=0,this.string=new a.String,this.entity="",this.tags=[],this.tagName="",this.selfClosing=!1,this.attributes={},this.attributeName="",this.attributeValue=""},b})(),a.Tag=(function(){function b(d,u){var g,E;this._name=d.toLowerCase(),this._selfClosing=a.Tag.SELF_CLOSING[this._name]===!0,this._head=null,this._attributes={};for(g in u)E=u[g],this._attributes[g]=E}return b.SELF_CLOSING={area:!0,base:!0,br:!0,hr:!0,img:!0,input:!0,"link meta":!0,wbr:!0},b.prototype.head=function(){var d,u,g,E;if(!this._head){d=[],E=this._attributes;for(u in E)g=E[u],g?d.push(u+'="'+g+'"'):d.push(""+u);d.sort(),d.unshift(this._name),this._head="<"+d.join(" ")+">"}return this._head},b.prototype.name=function(){return this._name},b.prototype.selfClosing=function(){return this._selfClosing},b.prototype.tail=function(){return this._selfClosing?"":"</"+this._name+">"},b.prototype.attr=function(d,u){return u===void 0?this._attributes[d]:(this._attributes[d]=u,this._head=null)},b.prototype.removeAttr=function(d){if(this._attributes[d]!==void 0)return delete this._attributes[d],this._head=null},b.prototype.copy=function(){return new a.Tag(this._name,this._attributes)},b})(),a.Character=(function(){function b(d,u){this._c=d,d.length>1&&(this._c=d.toLowerCase()),this._tags=[],this.addTags.apply(this,u)}return b.prototype.c=function(){return this._c},b.prototype.isEntity=function(){return this._c.length>1},b.prototype.isTag=function(d){return!(this._tags.length===0||!this._tags[0].selfClosing())&&(!d||this._tags[0].name()===d)},b.prototype.isWhitespace=function(){var d;return(d=this._c)===" "||d===` 16`||d===" "||this.isTag("br")},b.prototype.tags=function(){var d;return function(){var u,g,E,C;for(E=this._tags,C=[],u=0,g=E.length;u<g;u++)d=E[u],C.push(d.copy());return C}.call(this)},b.prototype.addTags=function(){var d,u,g,E,C;for(u=1<=arguments.length?U.call(arguments,0):[],C=[],g=0,E=u.length;g<E;g++)d=u[g],Array.isArray(d)||(d.selfClosing()?this.isTag()||this._tags.unshift(d.copy()):C.push(this._tags.push(d.copy())));return C},b.prototype.eq=function(d){var u,g,E,C,I,D,N,O;if(this.c()!==d.c()||this._tags.length!==d._tags.length)return!1;for(g={},N=this._tags,E=0,I=N.length;E<I;E++)u=N[E],g[u.head()]=!0;for(O=d._tags,C=0,D=O.length;C<D;C++)if(u=O[C],!g[u.head()])return!1;return!0},b.prototype.hasTags=function(){var d,u,g,E,C,I,D,N,O;for(E=1<=arguments.length?U.call(arguments,0):[],g={},u={},O=this._tags,C=0,D=O.length;C<D;C++)d=O[C],g[d.name()]=!0,u[d.head()]=!0;for(I=0,N=E.length;I<N;I++)if(typeof(d=E[I])=="string"){if(g[d]===void 0)return!1}else if(u[d.head()]===void 0)return!1;return!0},b.prototype.removeTags=function(){var d,u,g,E,C,I;if(E=1<=arguments.length?U.call(arguments,0):[],E.length===0)return void(this._tags=[]);for(u={},d={},C=0,I=E.length;C<I;C++)g=E[C],typeof g=="string"?u[g]=g:d[g.head()]=g;return this._tags=this._tags.filter(function(D){if(!d[D.head()]&&!u[D.name()])return D})},b.prototype.copy=function(){var d;return new a.Character(this._c,function(){var u,g,E,C;for(E=this._tags,C=[],u=0,g=E.length;u<g;u++)d=E[u],C.push(d.copy());return C}.call(this))},b})()}.call(Lt),function(){var c,m,p,v,y,L,S=[].indexOf||function(w){for(var k=0,l=this.length;k<l;k++)if(k in this&&this[k]===w)return k;return-1};c={},c.Range=(function(){function w(k,l){this.set(k,l)}return w.prototype.isCollapsed=function(){return this._from===this._to},w.prototype.span=function(){return this._to-this._from},w.prototype.collapse=function(){return this._to=this._from},w.prototype.eq=function(k){return this.get()[0]===k.get()[0]&&this.get()[1]===k.get()[1]},w.prototype.get=function(){return[this._from,this._to]},w.prototype.select=function(k){var l,e,t,n,i,o,r,s,a;return c.Range.unselectAll(),l=document.createRange(),s=v(k,this._from),i=s[0],r=s[1],a=v(k,this._to),e=a[0],n=a[1],o=i.length||0,t=e.length||0,l.setStart(i,Math.min(r,o)),l.setEnd(e,Math.min(n,t)),window.getSelection().addRange(l)},w.prototype.set=function(k,l){return k=Math.max(0,k),l=Math.max(0,l),this._from=Math.min(k,l),this._to=Math.max(k,l)},w.prepareElement=function(k){var l,e,t,n,i,o;for(t=k.querySelectorAll(m.join(", ")),o=[],l=n=0,i=t.length;n<i;l=++n)e=t[l],e.parentNode.insertBefore(document.createTextNode(""),e),l<t.length-1?o.push(e.parentNode.insertBefore(document.createTextNode(""),e.nextSibling)):o.push(void 0);return o},w.query=function(k){var l,e,t,n,i,o,r;n=new c.Range(0,0);try{l=window.getSelection().getRangeAt(0)}catch{return n}return k.firstChild===null&&k.lastChild===null||p(l.startContainer,k)&&p(l.endContainer,k)&&(r=y(k,l),i=r[0],o=r[1],e=r[2],t=r[3],n.set(L(k,i)+o,L(k,e)+t)),n},w.rect=function(){var k,l,e;try{k=window.getSelection().getRangeAt(0)}catch{return null}return k.collapsed?(l=document.createElement("span"),k.insertNode(l),e=l.getBoundingClientRect(),l.parentNode.removeChild(l),e):k.getBoundingClientRect()},w.unselectAll=function(){if(window.getSelection())return window.getSelection().removeAllRanges()},w})(),m=["br","img","input"],p=function(w,k){for(;w;){if(w===k)return!0;w=w.parentNode}return!1},v=function(w,k){var l,e,t,n,i;if(w.childNodes.length===0)return[w,k];for(l=null,e=k,t=(function(){var o,r,s,a;for(s=w.childNodes,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n);return a})();t.length>0;)switch(l=t.shift(),l.nodeType){case Node.TEXT_NODE:if(l.textContent.length>=e)return[l,e];e-=l.textContent.length;break;case Node.ELEMENT_NODE:if(i=l.nodeName.toLowerCase(),S.call(m,i)>=0){if(e===0)return[l,0];e=Math.max(0,e-1)}else l.childNodes&&Array.prototype.unshift.apply(t,(function(){var o,r,s,a;for(s=l.childNodes,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n);return a})())}return[l,e]},L=function(w,k){var l,e,t,n,i,o;if(w.childNodes.length===0)return 0;for(t=0,l=(function(){var r,s,a,h;for(a=w.childNodes,h=[],r=0,s=a.length;r<s;r++)e=a[r],h.push(e);return h})();l.length>0;){if((n=l.shift())===k)return i=n.nodeName.toLowerCase(),S.call(m,i)>=0?t+1:t;switch(n.nodeType){case Node.TEXT_NODE:t+=n.textContent.length;break;case Node.ELEMENT_NODE:o=n.nodeName.toLowerCase(),S.call(m,o)>=0?t+=1:n.childNodes&&Array.prototype.unshift.apply(l,(function(){var r,s,a,h;
16for(a=n.childNodes,h=[],r=0,s=a.length;r<s;r++)e=a[r],h.push(e);return h})())}}return t},y=function(w,k){var l,e,t,n,i,o,r,s,a,h,_,f,T,x;if(e=w.childNodes,a=k.cloneRange(),a.collapse(!0),i=k.cloneRange(),i.collapse(!1),r=a.startContainer,s=a.startOffset,t=i.endContainer,n=i.endOffset,!a.comparePoint)return[r,s,t,n];if(r===w){for(r=e[e.length-1],s=r.textContent.length,o=h=0,f=e.length;h<f;o=++h)if(l=e[o],a.comparePoint(l,0)===1){o===0?(r=l,s=0):(r=e[o-1],s=l.textContent.length),x=r.nodeName.toLowerCase,S.call(m,x)>=0&&(s=1);break}}if(k.collapsed)return[r,s,r,s];if(t===w)for(t=e[e.length-1],n=t.textContent.length,o=_=0,T=e.length;_<T;o=++_)l=e[o],i.comparePoint(l,0)===1&&(t=o===0?l:e[o-1],n=l.textContent.length+1);return[r,s,t,n]},typeof window<"u"&&(window.ContentSelect=c),typeof nt<"u"&&nt.exports&&(nt.exports=c)}.call(Lt),function(){var c,m,p,v,y=[].slice,L=[].indexOf||function(l){for(var e=0,t=this.length;e<t;e++)if(e in this&&this[e]===l)return e;return-1},S={}.hasOwnProperty,w=function(l,e){function t(){this.constructor=l}for(var n in e)S.call(e,n)&&(l[n]=e[n]);return t.prototype=e.prototype,l.prototype=new t,l.__super__=e.prototype,l},k=function(l,e){return function(){return l.apply(e,arguments)}};c={ALIGNMENT_CLASS_NAMES:{left:"align-left",right:"align-right"},DEFAULT_MAX_ELEMENT_WIDTH:800,DEFAULT_MIN_ELEMENT_WIDTH:80,DRAG_HOLD_DURATION:500,DROP_EDGE_SIZE:50,ENABLE_DRAG_CLONING:!1,HELPER_CHAR_LIMIT:250,INDENT:" ",LANGUAGE:"en",LINE_ENDINGS:` 17`,PREFER_LINE_BREAKS:!1,RESIZE_CORNER_SIZE:15,TRIM_WHITESPACE:!0,_translations:{},_:function(l){var e;return e=c.LANGUAGE,c._translations[e]&&c._translations[e][l]?c._translations[e][l]:l},addTranslations:function(l,e){return c._translations[l]=e},addCSSClass:function(l,e){var t,n,i;return l.classList?void l.classList.add(e):(n=l.getAttribute("class"),n?(i=(function(){var o,r,s,a;for(s=n.split(" "),a=[],o=0,r=s.length;o<r;o++)t=s[o],a.push(t);return a})(),i.indexOf(e)===-1?l.setAttribute("class",n+" "+e):void 0):l.setAttribute("class",e))},attributesToString:function(l){var e,t,n,i,o,r;if(!l)return"";for(n=(function(){var s;s=[];for(t in l)s.push(t);return s})(),n.sort(),e=[],o=0,r=n.length;o<r;o++)t=n[o],i=l[t],i===""?e.push(t):(i=HTMLString.String.encode(i),i=i.replace(/"/g,"""),e.push(t+'="'+i+'"'));return e.join(" ")},removeCSSClass:function(l,e){var t,n,i,o;return l.classList?(l.classList.remove(e),void(l.classList.length===0&&l.removeAttribute("class"))):(n=l.getAttribute("class"),n&&(o=(function(){var r,s,a,h;for(a=n.split(" "),h=[],r=0,s=a.length;r<s;r++)t=a[r],h.push(t);return h})(),(i=o.indexOf(e))>-1)?(o.splice(i,1),o.length?l.setAttribute("class",o.join(" ")):l.removeAttribute("class")):void 0)}},typeof window<"u"&&(window.ContentEdit=c),typeof nt<"u"&&nt.exports&&(nt.exports=c),p=(function(){function l(){this._tagNames={}}return l.prototype.register=function(){var e,t,n,i,o,r;for(e=arguments[0],n=2<=arguments.length?y.call(arguments,1):[],r=[],i=0,o=n.length;i<o;i++)t=n[i],r.push(this._tagNames[t.toLowerCase()]=e);return r},l.prototype.match=function(e){return e=e.toLowerCase(),this._tagNames[e]?this._tagNames[e]:c.Static},l})(),c.TagNames=(function(){function l(){}var e;return e=null,l.get=function(){return e??(e=new p)},l})(),c.Node=(function(){function l(){this._bindings={},this._parent=null,this._modified=null}return l.prototype.lastModified=function(){return this._modified},l.prototype.parent=function(){return this._parent},l.prototype.parents=function(){var e,t;for(t=[],e=this._parent;e;)t.push(e),e=e._parent;return t},l.prototype.type=function(){return"Node"},l.prototype.html=function(e){throw e==null&&(e=""),new Error("`html` not implemented")},l.prototype.bind=function(e,t){return this._bindings[e]===void 0&&(this._bindings[e]=[]),this._bindings[e].push(t),t},l.prototype.trigger=function(){var e,t,n,i,o,r,s;if(n=arguments[0],e=2<=arguments.length?y.call(arguments,1):[],this._bindings[n]){for(r=this._bindings[n],s=[],i=0,o=r.length;i<o;i++)(t=r[i])&&s.push(t.call.apply(t,[this].concat(y.call(e))));return s}},l.prototype.unbind=function(e,t){var n,i,o,r,s,a;if(!e)return void(this._bindings={});if(!t)return void(this._bindings[e]=void 0);if(this._bindings[e]){for(s=this._bindings[e],a=[],n=o=0,r=s.length;o<r;n=++o)i=s[n],i===t?a.push(this._bindings[e].splice(n,1)):a.push(void 0);return a}},l.prototype.commit=function(){return this._modified=null,c.Root.get().trigger("commit",this)},l.prototype.taint=function(){var e,t,n,i,o,r;for(e=Date.now(),this._modified=e,r=this.parents(),i=0,o=r.length;i<o;i++)t=r[i],t._modified=e;return n=c.Root.get(),n._modified=e,n.trigger("taint",this)},l.prototype.closest=function(e){var t;for(t=this.parent();t&&!e(t);)t=t.parent?t.parent():null;return t},l.prototype.next=function(){var e,t,n,i,o,r;if(this.children&&this.children.length>0)return this.children[0];for(r=[this].concat(this.parents()),i=0,o=r.length;i<o;i++){if(n=r[i],!n.parent())return null;if(e=n.parent().children,(t=e.indexOf(n))<e.length-1)return e[t+1]}},l.prototype.nextContent=function(){return this.nextWithTest(function(e){return e.content!==void 0})},l.prototype.nextSibling=function(){var e;return e=this.parent().children.indexOf(this),e===this.parent().children.length-1?null:this.parent().children[e+1]},l.prototype.nextWithTest=function(e){var t;for(t=this;t;)if((t=t.next())&&e(t))return t},l.prototype.previous=function(){var e,t;if(!this.parent())return null;if(e=this.parent().children,e[0]===this)return this.parent();for(t=e[e.indexOf(this)-1];t.children&&t.children.length;)t=t.children[t.children.length-1];return t},l.prototype.previousContent=function(){return this.previousWithTest(function(e){return e.content!==void 0})},l.prototype.previousSibling=function(){var e;return e=this.parent().children.indexOf(this),e===0?null:this.parent().children[e-1]},l.prototype.previousWithTest=function(e){var t;for(t=this;t;)if((t=t.previous())&&e(t))return t},l.extend=function(e){var t,n,i;i=e.prototype;for(t in i)n=i[t],t!=="constructor"&&(this.prototype[t]=n);for(t in e)n=e[t],L.call("__super__",t)>=0||(this.prototype[t]=n);return this},l.fromDOMElement=function(e){throw new Error("`fromDOMElement` not implemented")},l})(),c.NodeCollection=(function(l){function e(){e.__super__.constructor.call(this),this.children=[]}return w(e,l),e.prototype.descendants=function(){var t,n,i;for(t=[],i=this.children.slice();i.length>0;)n=i.shift(),t.push(n),n.children&&n.children.length>0&&(i=n.children.slice().concat(i));return t},e.prototype.isMounted=function(){return!1},e.prototype.type=function(){return"NodeCollection"},e.prototype.attach=function(t,n){return t.parent()&&t.parent().detach(t),t._parent=this,n!==void 0?this.children.splice(n,0,t):this.children.push(t),t.mount&&this.isMounted()&&t.mount(),this.taint(),c.Root.get().trigger("attach",this,t)},e.prototype.commit=function(){var t,n,i,o;for(o=this.descendants(),n=0,i=o.length;n<i;n++)t=o[n],t._modified=null;return this._modified=null,c.Root.get().trigger("commit",this)},e.prototype.detach=function(t){var n;if((n=this.children.indexOf(t))!==-1)return t.unmount&&this.isMounted()&&t.isMounted()&&t.unmount(),this.children.splice(n,1),t._parent=null,this.taint(),c.Root.get().trigger("detach",this,t)},e})(c.Node),c.Element=(function(l){function e(t,n){e.__super__.constructor.call(this),this._tagName=t.toLowerCase(),this._attributes=n||{},this._domElement=null,this._behaviours={drag:!0,drop:!0,merge:!0,remove:!0,resize:!0,spawn:!0}}return w(e,l),e.prototype.attributes=function(){var t,n,i,o;t={},o=this._attributes;for(n in o)i=o[n],t[n]=i;return t},e.prototype.cssTypeName=function(){return"element"},e.prototype.domElement=function(){return this._domElement},e.prototype.isFixed=function(){return this.parent()&&this.parent().type()==="Fixture"},e.prototype.isFocused=function(){return c.Root.get().focused()===this},e.prototype.isMounted=function(){return this._domElement!==null},e.prototype.type=function(){return"Element"},e.prototype.typeName=function(){return"Element"},e.prototype.addCSSClass=function(t){var n;if(n=!1,this.hasCSSClass(t)||(n=!0,this.attr("class")?this.attr("class",this.attr("class")+" "+t):this.attr("class",t)),this._addCSSClass(t),n)return this.taint()},e.prototype.attr=function(t,n){return t=t.toLowerCase(),n===void 0?this._attributes[t]:(this._attributes[t]=n,this.isMounted()&&t.toLowerCase()!=="class"&&this._domElement.setAttribute(t,n),this.taint())},e.prototype.blur=function(){var t;if(t=c.Root.get(),this.isFocused())return this._removeCSSClass("ce-element--focused"),t._focused=null,t.trigger("blur",this)},e.prototype.can=function(t,n){return n===void 0?!this.isFixed()&&this._behaviours[t]:this._behaviours[t]=n},e.prototype.clone=function(){var t;return t=document.createElement("div"),t.innerHTML=this.html(),this.constructor.fromDOMElement(t.children[0])},e.prototype.createDraggingDOMElement=function(){var t;if(this.isMounted())return t=document.createElement("div"),t.setAttribute("class","ce-drag-helper ce-drag-helper--type-"+this.cssTypeName()),t.setAttribute("data-ce-type",c._(this.t
17ypeName())),t},e.prototype.drag=function(t,n){var i;if(this.isMounted()&&this.can("drag"))return i=c.Root.get(),i.startDragging(this,t,n),i.trigger("drag",this)},e.prototype.drop=function(t,n){var i;if(this.can("drop")){if(i=c.Root.get(),t){if(t._removeCSSClass("ce-element--drop"),t._removeCSSClass("ce-element--drop-"+n[0]),t._removeCSSClass("ce-element--drop-"+n[1]),this.constructor.droppers[t.type()])return this.constructor.droppers[t.type()](this,t,n),void i.trigger("drop",this,t,n);if(t.constructor.droppers[this.type()])return t.constructor.droppers[this.type()](this,t,n),void i.trigger("drop",this,t,n)}return i.trigger("drop",this,null,null)}},e.prototype.focus=function(t){var n;if(n=c.Root.get(),!this.isFocused())return n.focused()&&n.focused().blur(),this._addCSSClass("ce-element--focused"),n._focused=this,this.isMounted()&&!t&&this.domElement().focus(),n.trigger("focus",this)},e.prototype.hasCSSClass=function(t){var n,i;return!!(this.attr("class")&&(i=function(){var o,r,s,a;for(s=this.attr("class").split(" "),a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n);return a}.call(this),i.indexOf(t)>-1))},e.prototype.merge=function(t){return!(!this.can("merge")||!this.can("remove"))&&(this.constructor.mergers[t.type()]?this.constructor.mergers[t.type()](t,this):t.constructor.mergers[this.type()]?t.constructor.mergers[this.type()](t,this):void 0)},e.prototype.mount=function(){var t;return this._domElement||(this._domElement=document.createElement(this.tagName())),t=this.nextSibling(),t?this.parent().domElement().insertBefore(this._domElement,t.domElement()):this.isFixed()?(this.parent().domElement().parentNode.replaceChild(this._domElement,this.parent().domElement()),this.parent()._domElement=this._domElement):this.parent().domElement().appendChild(this._domElement),this._addDOMEventListeners(),this._addCSSClass("ce-element"),this._addCSSClass("ce-element--type-"+this.cssTypeName()),this.isFocused()&&this._addCSSClass("ce-element--focused"),c.Root.get().trigger("mount",this)},e.prototype.removeAttr=function(t){if(t=t.toLowerCase(),this._attributes[t])return delete this._attributes[t],this.isMounted()&&t.toLowerCase()!=="class"&&this._domElement.removeAttribute(t),this.taint()},e.prototype.removeCSSClass=function(t){var n,i,o;if(this.hasCSSClass(t))return o=function(){var r,s,a,h;for(a=this.attr("class").split(" "),h=[],r=0,s=a.length;r<s;r++)n=a[r],h.push(n);return h}.call(this),i=o.indexOf(t),i>-1&&o.splice(i,1),o.length?this.attr("class",o.join(" ")):this.removeAttr("class"),this._removeCSSClass(t),this.taint()},e.prototype.tagName=function(t){return t===void 0?this._tagName:(this._tagName=t.toLowerCase(),this.isMounted()&&(this.unmount(),this.mount()),this.taint())},e.prototype.unmount=function(){return this._removeDOMEventListeners(),this.isFixed()?(this._removeCSSClass("ce-element"),this._removeCSSClass("ce-element--type-"+this.cssTypeName()),void this._removeCSSClass("ce-element--focused")):(this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,c.Root.get().trigger("unmount",this))},e.prototype._addDOMEventListeners=function(){var t,n,i,o;this._domEventHandlers={dragstart:(function(r){return function(s){return s.preventDefault()}})(),focus:(function(r){return function(s){return s.preventDefault()}})(),keydown:(function(r){return function(s){return r._onKeyDown(s)}})(this),keyup:(function(r){return function(s){return r._onKeyUp(s)}})(this),mousedown:(function(r){return function(s){if(s.button===0)return r._onMouseDown(s)}})(this),mousemove:(function(r){return function(s){return r._onMouseMove(s)}})(this),mouseover:(function(r){return function(s){return r._onMouseOver(s)}})(this),mouseout:(function(r){return function(s){return r._onMouseOut(s)}})(this),mouseup:(function(r){return function(s){if(s.button===0)return r._onMouseUp(s)}})(this),dragover:(function(r){return function(s){return s.preventDefault()}})(),drop:(function(r){return function(s){return r._onNativeDrop(s)}})(this),paste:(function(r){return function(s){return r._onPaste(s)}})(this)},i=this._domEventHandlers,o=[];for(n in i)t=i[n],o.push(this._domElement.addEventListener(n,t));return o},e.prototype._onKeyDown=function(t){},e.prototype._onKeyUp=function(t){},e.prototype._onMouseDown=function(t){if(this.focus)return this.focus(!0)},e.prototype._onMouseMove=function(t){return this._onOver(t)},e.prototype._onMouseOver=function(t){return this._onOver(t)},e.prototype._onMouseOut=function(t){var n;if(this._removeCSSClass("ce-element--over"),n=c.Root.get(),n.dragging())return this._removeCSSClass("ce-element--drop"),this._removeCSSClass("ce-element--drop-above"),this._removeCSSClass("ce-element--drop-below"),this._removeCSSClass("ce-element--drop-center"),this._removeCSSClass("ce-element--drop-left"),this._removeCSSClass("ce-element--drop-right"),n._dropTarget=null},e.prototype._onMouseUp=function(t){return this._ieMouseDownEchoed=!1},e.prototype._onNativeDrop=function(t){return t.preventDefault(),t.stopPropagation(),c.Root.get().trigger("native-drop",this,t)},e.prototype._onPaste=function(t){return t.preventDefault(),t.stopPropagation(),c.Root.get().trigger("paste",this,t)},e.prototype._onOver=function(t){var n,i;if(this._addCSSClass("ce-element--over"),i=c.Root.get(),(n=i.dragging())&&n!==this&&!i._dropTarget&&this.can("drop")&&(this.constructor.droppers[n.type()]||n.constructor.droppers[this.type()]))return this._addCSSClass("ce-element--drop"),i._dropTarget=this},e.prototype._removeDOMEventListeners=function(){var t,n,i,o;i=this._domEventHandlers,o=[];for(n in i)t=i[n],o.push(this._domElement.removeEventListener(n,t));return o},e.prototype._addCSSClass=function(t){if(this.isMounted())return c.addCSSClass(this._domElement,t)},e.prototype._attributesToString=function(){return Object.getOwnPropertyNames(this._attributes).length>0?" "+c.attributesToString(this._attributes):""},e.prototype._removeCSSClass=function(t){if(this.isMounted())return c.removeCSSClass(this._domElement,t)},e.droppers={},e.mergers={},e.placements=["above","below"],e.getDOMElementAttributes=function(t){var n,i,o,r,s;if(!t.hasAttributes())return{};for(i={},s=t.attributes,o=0,r=s.length;o<r;o++)n=s[o],i[n.name.toLowerCase()]=n.value;return i},e._dropVert=function(t,n,i){var o;return c.ENABLE_DRAG_CLONING&&window.event.altKey?t=t.clone():t.parent().detach(t),o=n.parent().children.indexOf(n),i[0]==="below"&&(o+=1),n.parent().attach(t,o)},e._dropBoth=function(t,n,i){var o,r,s,a,h,_,f,T;if(c.ENABLE_DRAG_CLONING&&window.event.altKey?t=t.clone():t.parent().detach(t),h=n.parent().children.indexOf(n),i[0]==="below"&&i[1]==="center"&&(h+=1),r=c.ALIGNMENT_CLASS_NAMES.left,s=c.ALIGNMENT_CLASS_NAMES.right,t.a){if(t._removeCSSClass(r),t._removeCSSClass(s),t.a.class){for(o=[],T=t.a.class.split(" "),_=0,f=T.length;_<f;_++)(a=T[_])!==r&&a!==s&&o.push(a);o.length?t.a.class=o.join(" "):delete t.a.class}}else t.removeCSSClass(r),t.removeCSSClass(s);
17return i[1]==="left"&&(t.a?(t.a.class?t.a.class+=" "+r:t.a.class=r,t._addCSSClass(r)):t.addCSSClass(r)),i[1]==="right"&&(t.a?(t.a.class?t.a.class+=" "+s:t.a.class=s,t._addCSSClass(s)):t.addCSSClass(s)),n.parent().attach(t,h)},e})(c.Node),c.ElementCollection=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n),c.NodeCollection.prototype.constructor.call(this)}return w(e,l),e.extend(c.NodeCollection),e.prototype.cssTypeName=function(){return"element-collection"},e.prototype.isMounted=function(){return this._domElement!==null},e.prototype.type=function(){return"ElementCollection"},e.prototype.createDraggingDOMElement=function(){var t,n;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),n=this._domElement.textContent,n.length>c.HELPER_CHAR_LIMIT&&(n=n.substr(0,c.HELPER_CHAR_LIMIT)),t.innerHTML=n,t},e.prototype.detach=function(t){if(c.NodeCollection.prototype.detach.call(this,t),this.children.length===0&&this.parent())return this.parent().detach(this)},e.prototype.html=function(t){var n,i,o,r;return t==null&&(t=""),o=function(){var s,a,h,_;for(h=this.children,_=[],s=0,a=h.length;s<a;s++)i=h[s],_.push(i.html(t+c.INDENT));return _}.call(this),r=c.LINE_ENDINGS,this.isFixed()?o.join(r):(n=this._attributesToString(),t+"<"+this.tagName()+n+">"+r+o.join(r)+r+t+"</"+this.tagName()+">")},e.prototype.mount=function(){var t,n,i,o,r,s,a,h;this._domElement=document.createElement(this._tagName),s=this._attributes;for(n in s)i=s[n],this._domElement.setAttribute(n,i);for(e.__super__.mount.call(this),a=this.children,h=[],o=0,r=a.length;o<r;o++)t=a[o],h.push(t.mount());return h},e.prototype.unmount=function(){var t,n,i,o;for(o=this.children,n=0,i=o.length;n<i;n++)t=o[n],t.unmount();return e.__super__.unmount.call(this)},e.prototype.blur=void 0,e.prototype.focus=void 0,e})(c.Element),c.ResizableElement=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n),this._domSizeInfoElement=null,this._aspectRatio=1}return w(e,l),e.prototype.aspectRatio=function(){return this._aspectRatio},e.prototype.maxSize=function(){var t;return t=parseInt(this.attr("data-ce-max-width")||0),t||(t=c.DEFAULT_MAX_ELEMENT_WIDTH),t=Math.max(t,this.size()[0]),[t,t*this.aspectRatio()]},e.prototype.minSize=function(){var t;return t=parseInt(this.attr("data-ce-min-width")||0),t||(t=c.DEFAULT_MIN_ELEMENT_WIDTH),t=Math.min(t,this.size()[0]),[t,t*this.aspectRatio()]},e.prototype.type=function(){return"ResizableElement"},e.prototype.mount=function(){return e.__super__.mount.call(this),this._domElement.setAttribute("data-ce-size",this._getSizeInfo())},e.prototype.resize=function(t,n,i){if(this.isMounted()&&this.can("resize"))return c.Root.get().startResizing(this,t,n,i,!0)},e.prototype.size=function(t){var n,i,o,r;return t?(t[0]=parseInt(t[0]),t[1]=parseInt(t[1]),o=this.minSize(),t[0]=Math.max(t[0],o[0]),t[1]=Math.max(t[1],o[1]),i=this.maxSize(),t[0]=Math.min(t[0],i[0]),t[1]=Math.min(t[1],i[1]),this.attr("width",parseInt(t[0])),this.attr("height",parseInt(t[1])),this.isMounted()?(this._domElement.style.width=t[0]+"px",this._domElement.style.height=t[1]+"px",this._domElement.setAttribute("data-ce-size",this._getSizeInfo())):void 0):(r=parseInt(this.attr("width")||1),n=parseInt(this.attr("height")||1),[r,n])},e.prototype._onMouseDown=function(t){var n;return e.__super__._onMouseDown.call(this,t),n=this._getResizeCorner(t.clientX,t.clientY),n?this.resize(n,t.clientX,t.clientY):(clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout((function(i){return function(){return i.drag(t.pageX,t.pageY)}})(this),150))},e.prototype._onMouseMove=function(t){var n;if(e.__super__._onMouseMove.call(this),this.can("resize"))return this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right"),n=this._getResizeCorner(t.clientX,t.clientY),n?this._addCSSClass("ce-element--resize-"+n[0]+"-"+n[1]):void 0},e.prototype._onMouseOut=function(t){return e.__super__._onMouseOut.call(this),this._removeCSSClass("ce-element--resize-top-left"),this._removeCSSClass("ce-element--resize-top-right"),this._removeCSSClass("ce-element--resize-bottom-left"),this._removeCSSClass("ce-element--resize-bottom-right")},e.prototype._onMouseUp=function(t){if(e.__super__._onMouseUp.call(this),this._dragTimeout)return clearTimeout(this._dragTimeout)},e.prototype._getResizeCorner=function(t,n){var i,o,r,s,a;return r=this._domElement.getBoundingClientRect(),a=[t-r.left,n-r.top],t=a[0],n=a[1],s=this.size(),o=c.RESIZE_CORNER_SIZE,o=Math.min(o,Math.max(parseInt(s[0]/4),1)),o=Math.min(o,Math.max(parseInt(s[1]/4),1)),i=null,t<o?n<o?i=["top","left"]:n>r.height-o&&(i=["bottom","left"]):t>r.width-o&&(n<o?i=["top","right"]:n>r.height-o&&(i=["bottom","right"])),i},e.prototype._getSizeInfo=function(){var t;return t=this.size(),"w "+t[0]+" \xD7 h "+t[1]},e})(c.Element),c.Region=(function(l){function e(t){e.__super__.constructor.call(this),this._domElement=t,this.setContent(t)}return w(e,l),e.prototype.domElement=function(){return this._domElement},e.prototype.isMounted=function(){return!0},e.prototype.type=function(){return"Region"},e.prototype.html=function(t){var n,i;return t==null&&(t=""),i=c.LINE_ENDINGS,function(){var o,r,s,a;for(s=this.children,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n.html(t));return a}.call(this).join(i).trim()},e.prototype.setContent=function(t){var n,i,o,r,s,a,h,_,f,T,x,M,A,R;for(a=t,t.childNodes===void 0&&(f=document.createElement("div"),f.innerHTML=t,a=f),R=this.children.slice(),T=0,M=R.length;T<M;T++)i=R[T],this.detach(i);for(_=c.TagNames.get(),r=(function(){var U,H,b,d;for(b=a.childNodes,d=[],U=0,H=b.length;U<H;U++)n=b[U],d.push(n);return d})(),x=0,A=r.length;x<A;x++)o=r[x],o.nodeType===1&&(s=o.getAttribute("data-ce-tag")?_.match(o.getAttribute("data-ce-tag")):_.match(o.tagName),h=s.fromDOMElement(o),a.removeChild(o),h&&this.attach(h));return c.Root.get().trigger("ready",this)},e})(c.NodeCollection),c.Fixture=(function(l){function e(t){var n,i,o;e.__super__.constructor.call(this),this._domElement=t,o=c.TagNames.get(),n=this._domElement.getAttribute("data-ce-tag")?o.match(this._domElement.getAttribute("data-ce-tag")):o.match(this._domElement.tagName),i=n.fromDOMElement(this._domElement),this.children=[i],i._parent=this,i.mount(),c.Root.get().trigger("ready",this)}return w(e,l),e.prototype.domElement=function(){return this._domElement},e.prototype.isMounted=function(){return!0},e.prototype.type=function(){return"Fixture"},e.prototype.html=function(t){var n,i;return t==null&&(t=""),i=c.LINE_ENDINGS,function(){var o,r,s,a;for(s=this.children,a=[],o=0,r=s.length;o<r;o++)n=s[o],a.push(n.html(t));return a}.call(this).join(i).trim()},e})(c.NodeCollection),m=(function(l){function e(){this._onStopResizing=k(this._onStopResizing,this),this._onResize=k(this._onResize,this),this._onStopDragging=k(this._onStopDragging,this),this._onDrag=k(this._onDrag,this),e.__super__.constructor.call(this),this._focused=null,this._dragging=null,this._dropTarget=null,this._draggingDOMElement=null,this._resizing=null,this._resizingInit=null}return w(e,l),e.prototype.dragging=function(){return this._dragging},e.prototype.dropTarget=function(){return this._dropTarget}
17,e.prototype.focused=function(){return this._focused},e.prototype.resizing=function(){return this._resizing},e.prototype.type=function(){return"Root"},e.prototype.cancelDragging=function(){if(this._dragging)return document.body.removeChild(this._draggingDOMElement),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._dragging._removeCSSClass("ce-element--dragging"),this._dragging=null,this._dropTarget=null,c.removeCSSClass(document.body,"ce--dragging")},e.prototype.startDragging=function(t,n,i){if(!this._dragging)return this._dragging=t,this._dragging._addCSSClass("ce-element--dragging"),this._draggingDOMElement=this._dragging.createDraggingDOMElement(),document.body.appendChild(this._draggingDOMElement),this._draggingDOMElement.style.left=n+"px",this._draggingDOMElement.style.top=i+"px",document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),c.addCSSClass(document.body,"ce--dragging")},e.prototype._getDropPlacement=function(t,n){var i,o,r,s;return this._dropTarget?(o=this._dropTarget.domElement().getBoundingClientRect(),s=[t-o.left,n-o.top],t=s[0],n=s[1],i="center",t<c.DROP_EDGE_SIZE?i="left":t>o.width-c.DROP_EDGE_SIZE&&(i="right"),r="above",n>o.height/2&&(r="below"),[r,i]):null},e.prototype._onDrag=function(t){var n,i,o;if(ContentSelect.Range.unselectAll(),this._draggingDOMElement.style.left=t.pageX+"px",this._draggingDOMElement.style.top=t.pageY+"px",this._dropTarget&&(n=this._getDropPlacement(t.clientX,t.clientY),this._dropTarget._removeCSSClass("ce-element--drop-above"),this._dropTarget._removeCSSClass("ce-element--drop-below"),this._dropTarget._removeCSSClass("ce-element--drop-center"),this._dropTarget._removeCSSClass("ce-element--drop-left"),this._dropTarget._removeCSSClass("ce-element--drop-right"),i=n[0],L.call(this._dragging.constructor.placements,i)>=0&&this._dropTarget._addCSSClass("ce-element--drop-"+n[0]),o=n[1],L.call(this._dragging.constructor.placements,o)>=0))return this._dropTarget._addCSSClass("ce-element--drop-"+n[1])},e.prototype._onStopDragging=function(t){var n;return n=this._getDropPlacement(t.clientX,t.clientY),this._dragging.drop(this._dropTarget,n),this.cancelDragging()},e.prototype.startResizing=function(t,n,i,o,r){var s,a;if(!this._resizing)return this._resizing=t,this._resizingInit={corner:n,fixed:r,origin:[i,o],size:t.size()},this._resizing._addCSSClass("ce-element--resizing"),a=this._resizing.parent().domElement(),s=document.createElement("div"),s.setAttribute("class","ce-measure"),a.appendChild(s),this._resizingParentWidth=s.getBoundingClientRect().width,a.removeChild(s),document.addEventListener("mousemove",this._onResize),document.addEventListener("mouseup",this._onStopResizing),c.addCSSClass(document.body,"ce--resizing")},e.prototype._onResize=function(t){var n,i,o,r;return ContentSelect.Range.unselectAll(),o=this._resizingInit.origin[0]-t.clientX,this._resizingInit.corner[1]==="right"&&(o=-o),i=this._resizingInit.size[0]+o,i=Math.min(i,this._resizingParentWidth),this._resizingInit.fixed?n=i*this._resizing.aspectRatio():(r=this._resizingInit.origin[1]-t.clientY,this._resizingInit.corner[0]==="bottom"&&(r=-r),n=this._resizingInit.size[1]+r),this._resizing.size([i,n])},e.prototype._onStopResizing=function(t){return document.removeEventListener("mousemove",this._onResize),document.removeEventListener("mouseup",this._onStopResizing),this._resizing._removeCSSClass("ce-element--resizing"),this._resizing=null,this._resizingInit=null,this._resizingParentWidth=null,c.removeCSSClass(document.body,"ce--resizing")},e})(c.Node),c.Root=(function(){function l(){}var e;return e=null,l.get=function(){return e??(e=new m)},l})(),c.Static=(function(l){function e(t,n,i){e.__super__.constructor.call(this,t,n),this._content=i}return w(e,l),e.prototype.cssTypeName=function(){return"static"},e.prototype.type=function(){return"Static"},e.prototype.typeName=function(){return"Static"},e.prototype.createDraggingDOMElement=function(){var t,n;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),n=this._domElement.textContent,n.length>c.HELPER_CHAR_LIMIT&&(n=n.substr(0,c.HELPER_CHAR_LIMIT)),t.innerHTML=n,t},e.prototype.html=function(t){return t==null&&(t=""),HTMLString.Tag.SELF_CLOSING[this._tagName]?t+"<"+this._tagName+this._attributesToString()+">":t+"<"+this._tagName+this._attributesToString()+">"+this._content+t+"</"+this._tagName+">"},e.prototype.mount=function(){var t,n,i;this._domElement=document.createElement(this._tagName),i=this._attributes;for(t in i)n=i[t],this._domElement.setAttribute(t,n);return this._domElement.innerHTML=this._content,e.__super__.mount.call(this)}
17,e.prototype.blur=void 0,e.prototype.focus=void 0,e.prototype._onMouseDown=function(t){if(e.__super__._onMouseDown.call(this,t),this.attr("data-ce-moveable")!==void 0)return clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout((function(n){return function(){return n.drag(t.pageX,t.pageY)}})(this),150)},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._onMouseUp=function(t){if(e.__super__._onMouseUp.call(this,t),this._dragTimeout)return clearTimeout(this._dragTimeout)},e.droppers={Static:c.Element._dropVert},e.fromDOMElement=function(t){return new this(t.tagName,this.getDOMElementAttributes(t),t.innerHTML)},e})(c.Element),c.TagNames.get().register(c.Static,"static"),c.Text=(function(l){function e(t,n,i){e.__super__.constructor.call(this,t,n),i instanceof HTMLString.String?this.content=i:c.TRIM_WHITESPACE?this.content=new HTMLString.String(i).trim():this.content=new HTMLString.String(i,!0)}return w(e,l),e.prototype.cssTypeName=function(){return"text"},e.prototype.type=function(){return"Text"},e.prototype.typeName=function(){return"Text"},e.prototype.blur=function(){return this.isMounted()&&this._syncContent(),this.content.isWhitespace()&&this.can("remove")?this.parent()&&this.parent().detach(this):this.isMounted()&&(document.documentMode||/Edge/.test(navigator.userAgent)||this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),e.__super__.blur.call(this)},e.prototype.createDraggingDOMElement=function(){var t,n;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),n=HTMLString.String.encode(this._domElement.textContent),n.length>c.HELPER_CHAR_LIMIT&&(n=n.substr(0,c.HELPER_CHAR_LIMIT)),t.innerHTML=n,t},e.prototype.drag=function(t,n){return this.storeState(),this._domElement.removeAttribute("contenteditable"),e.__super__.drag.call(this,t,n)},e.prototype.drop=function(t,n){return e.__super__.drop.call(this,t,n),this.restoreState()},e.prototype.focus=function(t){return this.isMounted()&&this._domElement.setAttribute("contenteditable",""),e.__super__.focus.call(this,t)},e.prototype.html=function(t){var n,i,o;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(i=c.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),i.optimize(),this._lastCached=Date.now(),this._cached=i.html()),o=c.LINE_ENDINGS,n=this._attributesToString(),t+"<"+this._tagName+n+">"+o+t+c.INDENT+this._cached+o+t+"</"+this._tagName+">"},e.prototype.mount=function(){var t,n,i;this._domElement=document.createElement(this._tagName),i=this._attributes;for(t in i)n=i[t],this._domElement.setAttribute(t,n);return this.updateInnerHTML(),e.__super__.mount.call(this)},e.prototype.restoreState=function(){if(this._savedSelection)return this.isMounted()&&this.isFocused()?(this._domElement.setAttribute("contenteditable",""),this._addCSSClass("ce-element--focused"),document.activeElement!==this.domElement()&&this.domElement().focus(),this._savedSelection.select(this._domElement),this._savedSelection=void 0):void(this._savedSelection=void 0)},e.prototype.selection=function(t){return t===void 0?this.isMounted()?ContentSelect.Range.query(this._domElement):new ContentSelect.Range(0,0):t.select(this._domElement)},e.prototype.storeState=function(){if(this.isMounted()&&this.isFocused())return this._savedSelection=ContentSelect.Range.query(this._domElement)},e.prototype.unmount=function(){return this._domElement.removeAttribute("contenteditable"),e.__super__.unmount.call(this)},e.prototype.updateInnerHTML=function(){return this._domElement.innerHTML=this.content.html(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},e.prototype._onKeyDown=function(t){switch(t.keyCode){case 40:return this._keyDown(t);case 37:return this._keyLeft(t);case 39:return this._keyRight(t);case 38:return this._keyUp(t);case 9:return this._keyTab(t);case 8:return this._keyBack(t);case 46:return this._keyDelete(t);case 13:return this._keyReturn(t)}},e.prototype._onKeyUp=function(t){return e.__super__._onKeyUp.call(this,t),this._syncContent()},e.prototype._onMouseDown=function(t){if(e.__super__._onMouseDown.call(this,t),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout((function(n){return function(){return n.drag(t.pageX,t.pageY)}})(this),c.DRAG_HOLD_DURATION),this.content.length()===0&&c.Root.get().focused()===this)return t.preventDefault(),document.activeElement!==this._domElement&&this._domElement.focus(),new ContentSelect.Range(0,0).select(this._domElement)},e.prototype._onMouseMove=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),e.__super__._onMouseMove.call(this,t)},e.prototype._onMouseOut=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),e.__super__._onMouseOut.call(this,t)},e.prototype._onMouseUp=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),e.__super__._onMouseUp.call(this,t)},e.prototype._keyBack=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),i.get()[0]===0&&i.isCollapsed())return t.preventDefault(),n=this.previousContent(),this._syncContent(),n?n.merge(this):void 0},e.prototype._keyDelete=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return t.preventDefault(),n=this.nextContent(),n?this.merge
17(n):void 0},e.prototype._keyDown=function(t){return this._keyRight(t)},e.prototype._keyLeft=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),i.get()[0]===0&&i.isCollapsed())return t.preventDefault(),n=this.previousContent(),n?(n.focus(),i=new ContentSelect.Range(n.content.length(),n.content.length()),i.select(n.domElement())):c.Root.get().trigger("previous-region",this.closest(function(o){return o.type()==="Fixture"||o.type()==="Region"}))},e.prototype._keyReturn=function(t){var n,i,o,r,s,a;if(t.preventDefault(),!(this.content.isWhitespace()&&!t.shiftKey^c.PREFER_LINE_BREAKS)){if(r=ContentSelect.Range.query(this._domElement),a=this.content.substring(0,r.get()[0]),s=this.content.substring(r.get()[1]),t.shiftKey^c.PREFER_LINE_BREAKS)return i=r.get()[0],o="<br>",this.content.length()===i&&(this.content.length()!==0&&this.content.characters[i-1].isTag("br")||(o="<br><br>")),this.content=this.content.insert(i,new HTMLString.String(o,!0),!0),this.updateInnerHTML(),i+=1,r=new ContentSelect.Range(i,i),r.select(this.domElement()),void this.taint();if(this.can("spawn"))return this.content=a.trim(),this.updateInnerHTML(),n=new this.constructor("p",{},s.trim()),this.parent().attach(n,this.parent().children.indexOf(this)+1),a.length()?(n.focus(),r=new ContentSelect.Range(0,0),r.select(n.domElement())):(r=new ContentSelect.Range(0,a.length()),r.select(this._domElement)),this.taint()}},e.prototype._keyRight=function(t){var n,i;if(i=ContentSelect.Range.query(this._domElement),this._atEnd(i)&&i.isCollapsed())return t.preventDefault(),n=this.nextContent(),n?(n.focus(),i=new ContentSelect.Range(0,0),i.select(n.domElement())):c.Root.get().trigger("next-region",this.closest(function(o){return o.type()==="Fixture"||o.type()==="Region"}))},e.prototype._keyTab=function(t){if(t.preventDefault(),this.isFixed())return t.shiftKey?c.Root.get().trigger("previous-region",this.closest(function(n){return n.type()==="Fixture"||n.type()==="Region"})):c.Root.get().trigger("next-region",this.closest(function(n){return n.type()==="Fixture"||n.type()==="Region"}))},e.prototype._keyUp=function(t){return this._keyLeft(t)},e.prototype._atEnd=function(t){return t.get()[0]>=this.content.length()},e.prototype._flagIfEmpty=function(){return this.content.length()===0?this._addCSSClass("ce-element--empty"):this._removeCSSClass("ce-element--empty")},e.prototype._syncContent=function(t){var n,i;return i=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML,this.content.preserveWhitespace()),n=this.content.html(),i!==n&&this.taint(),this._flagIfEmpty()},e.droppers={Static:c.Element._dropVert,Text:c.Element._dropVert},e.mergers={Text:function(t,n){var i;return i=n.content.length(),t.content.length()&&(n.content=n.content.concat(t.content)),n.isMounted()&&n.updateInnerHTML(),n.focus(),new ContentSelect.Range(i,i).select(n._domElement),t.parent()&&t.parent().detach(t),n.taint()}},e.fromDOMElement=function(t){return new this(t.tagName,this.getDOMElementAttributes(t),t.innerHTML.replace(/^\s+|\s+$/g,""))},e})(c.Element),c.TagNames.get().register(c.Text,"address","blockquote","h1","h2","h3","h4","h5","h6","p"),c.PreText=(function(l){function e(t,n,i){i instanceof HTMLString.String?this.content=i:this.content=new HTMLString.String(i,!0),c.Element.call(this,t,n)}return w(e,l),e.TAB_INDENT=" ",e.prototype.cssTypeName=function(){return"pre-text"},e.prototype.type=function(){return"PreText"},e.prototype.typeName=function(){return"Preformatted"},e.prototype.blur=function(){return this.isMounted()&&(this._domElement.innerHTML=this.content.html()),e.__super__.blur.call(this)},e.prototype.html=function(t){var n;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(n=this.content.copy(),n.optimize(),this._lastCached=Date.now(),this._cached=n.html()),t+"<"+this._tagName+this._attributesToString()+">"+this._cached+"</"+this._tagName+">"},e.prototype.updateInnerHTML=function(){var t;return t=this.content.html(),this._domElement.innerHTML=t,this._ensureEndZWS(),ContentSelect.Range.prepareElement(this._domElement),this._flagIfEmpty()},e.prototype._keyBack=function(t){var n;return n=ContentSelect.Range.query(this._domElement),n.get()[0]<=this.content.length()?e.__super__._keyBack.call(this,t):(n.set(this.content.length(),this.content.length()),n.select(this._domElement))},e.prototype._keyReturn=function(t){var n,i,o,r;return t.preventDefault(),i=ContentSelect.Range.query(this._domElement),n=i.get()[0]+1,i.get()[0]===0&&i.isCollapsed()?this.content=new HTMLString.String(` 18`,!0).concat(this.content):this._atEnd(i)&&i.isCollapsed()?this.content=this.content.concat(new HTMLString.String(` 19`,!0)):i.get()[0]===0&&i.get()[1]===this.content.length()?(this.content=new HTMLString.String(` 20`,!0),n=0):(r=this.content.substring(0,i.get()[0]),o=this.content.substring(i.get()[1]),this.content=r.concat(new HTMLString.String(` 21`,!0),o)),this.updateInnerHTML(),i.set(n,n),i.select(this._domElement),this.taint()},e.prototype._keyTab=function(t){var n,i,o,r,s,a,h,_,f,T,x,M,A,R,U,H,b,d,u,g,E,C,I,D,N,O;for(t.preventDefault(),n=this.content.length(),f=c.PreText.TAB_INDENT,_=f.length,A=this.content.split(` 22`),R=this.selection().get(),R[0]=Math.min(R[0],n),R[1]=Math.min(R[1],n),o=0,b=-1,r=-1,a=g=0,D=A.length;g<D&&(x=A[a],M=x.length()+1,R[0]<o+M&&b===-1&&(b=a),R[1]<o+M&&r===-1&&(r=a),!(b>-1&&r>-1));a=++g)o+=M;if(b===r)_-=(R[0]-o)%_,h=new HTMLString.String(Array(_+1).join(" "),!0),u=A[b].substring(0,R[0]-o),d=A[b].substring(R[1]-o),A[b]=u.concat(h,d),H=_;else if(t.shiftKey){for(s=0,a=E=b;b<=r?E<=r:E>=r;a=b<=r?++E:--E){for(O=A[a].characters.slice(),T=C=0,N=O.length;C<N&&(i=O[T],!(T>_-1))&&i.isWhitespace();T=++C)A[a].characters.shift();a===b&&(s=T)}
22H=Math.max(-_,-s)}else{for(h=new HTMLString.String(f,!0),a=I=b;b<=r?I<=r:I>=r;a=b<=r?++I:--I)A[a]=h.concat(A[a]);H=_}return this.content=HTMLString.String.join(new HTMLString.String(` 23`,!0),A),this.updateInnerHTML(),U=this.content.length()-n,new ContentSelect.Range(R[0]+H,R[1]+U).select(this._domElement)},e.prototype._syncContent=function(t){var n,i;return this._ensureEndZWS(),i=this.content.html(),this.content=new HTMLString.String(this._domElement.innerHTML.replace(/\u200B$/g,""),this.content.preserveWhitespace()),n=this.content.html(),i!==n&&this.taint(),this._flagIfEmpty()},e.prototype._ensureEndZWS=function(){var t,n;if(this._domElement.lastChild&&(t=this._domElement.innerHTML,!(t[t.length-1]==="\u200B"&&t.indexOf("\u200B")<t.length-1)))return n=(function(i){return function(){return t.indexOf("\u200B")>-1&&(i._domElement.innerHTML=t.replace(/\u200B/g,"")),i._domElement.lastChild.textContent+="\u200B"}})(this),this._savedSelection?n():(this.storeState(),n(),this.restoreState())},e.droppers={PreText:c.Element._dropVert,Static:c.Element._dropVert,Text:c.Element._dropVert},e.mergers={},e.fromDOMElement=function(t){return new this(t.tagName,this.getDOMElementAttributes(t),t.innerHTML)},e})(c.Text),c.TagNames.get().register(c.PreText,"pre"),c.Image=(function(l){function e(t,n){var i;e.__super__.constructor.call(this,"img",t),this.a=n||null,i=this.size(),this._aspectRatio=i[1]/i[0]}return w(e,l),e.prototype.cssTypeName=function(){return"image"},e.prototype.type=function(){return"Image"},e.prototype.typeName=function(){return"Image"},e.prototype.createDraggingDOMElement=function(){var t;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),t.style.backgroundImage="url('"+this._attributes.src+"')",t},e.prototype.html=function(t){var n,i,o;return t==null&&(t=""),i=t+"<img"+this._attributesToString()+">",this.a?(o=c.LINE_ENDINGS,n=c.attributesToString(this.a),n+=' data-ce-tag="img"',t+"<a "+n+">"+o+c.INDENT+i+o+t+"</a>"):i},e.prototype.mount=function(){var t,n;return this._domElement=document.createElement("div"),t="",this.a&&this.a.class&&(t+=" "+this.a.class),this._attributes.class&&(t+=" "+this._attributes.class),this._domElement.setAttribute("class",t),n=this._attributes.style?this._attributes.style:"",n+="background-image:url('"+this._attributes.src+"');",this._attributes.width&&(n+="width:"+this._attributes.width+"px;"),this._attributes.height&&(n+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",n),e.__super__.mount.call(this)},e.prototype.unmount=function(){var t,n;return this.isFixed()&&(n=document.createElement("div"),n.innerHTML=this.html(),t=n.querySelector("a, img"),this._domElement.parentNode.replaceChild(t,this._domElement),this._domElement=t),e.__super__.unmount.call(this)},e.droppers={Image:c.Element._dropBoth,PreText:c.Element._dropBoth,Static:c.Element._dropBoth,Text:c.Element._dropBoth},e.placements=["above","below","left","right","center"],e.fromDOMElement=function(t){var n,i,o,r,s,a,h,_,f;if(n=null,t.tagName.toLowerCase()==="a"){for(n=this.getDOMElementAttributes(t),s=(function(){var T,x,M,A;for(M=t.childNodes,A=[],T=0,x=M.length;T<x;T++)o=M[T],A.push(o);return A})(),_=0,f=s.length;_<f;_++)if(r=s[_],r.nodeType===1&&r.tagName.toLowerCase()==="img"){t=r;break}t.tagName.toLowerCase()==="a"&&(t=document.createElement("img"))}return i=this.getDOMElementAttributes(t),h=i.width,a=i.height,i.width===void 0&&(h=i.height===void 0?t.naturalWidth:t.clientWidth),i.height===void 0&&(a=i.width===void 0?t.naturalHeight:t.clientHeight),i.width=h,i.height=a,new this(i,n)},e})(c.ResizableElement),c.TagNames.get().register(c.Image,"img"),c.ImageFixture=(function(l){function e(t,n,i){e.__super__.constructor.call(this,t,n),this._src=i}return w(e,l),e.prototype.cssTypeName=function(){return"image-fixture"},e.prototype.type=function(){return"ImageFixture"},e.prototype.typeName=function(){return"ImageFixture"},e.prototype.html=function(t){var n,i,o,r;return t==null&&(t=""),r=c.LINE_ENDINGS,i=this._attributesToString(),n="",this._attributes.alt!==void 0&&(n='alt="'+this._attributes.alt+'"'),o=t+'<img src="'+this.src()+'"'+n+">",t+"<"+this.tagName()+" "+i+">"+r+c.INDENT+o+r+t+"</"+this.tagName()+">"},e.prototype.mount=function(){var t,n,i,o,r,s;this._domElement=document.createElement(this.tagName()),s=this._attributes;for(n in s)r=s[n],n!=="alt"&&n!=="style"&&this._domElement.setAttribute(n,r);return t="",this.a&&this.a.class&&(t+=" "+this.a.class),this._attributes.class&&(t+=" "+this._attributes.class),this._domElement.setAttribute("class",t),i=this._attributes.style?this._attributes.style:"",o=document.createElement("div"),o.setAttribute("style",i.trim()),o.style.backgroundImage=null,i=o.getAttribute("style"),i=[i.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._domElement.setAttribute("style",i.trim()),e.__super__.mount.call(this)},e.prototype.src=function(t){return t===void 0?this._src:(this._src=t,this.isMounted()&&(this.unmount(),this.mount()),this.taint())},e.prototype.unmount=function(){var t,n;return this.isFixed()?(n=document.createElement("div"),n.innerHTML=this.html(),t=n.firstElementChild,this._domElement.parentNode.replaceChild(t,this._domElement),this._domElement=t,this.parent()._domElement=this._domElement):e.__super__.unmount.call(this)},e.prototype._attributesToString=function(){var t,n,i,o,r,s;this._attributes.style?(i=this._attributes.style?this._attributes.style:"",o=document.createElement("div"),o.setAttribute("style",i.trim()),o.style.backgroundImage=null,i=o.getAttribute("style"),i=[i.trim(),"background-image:url('"+this.src()+"');"].join(" "),this._attributes.style=i.trim()):this._attributes.style="background-image:url('"+this.src()+"');",t={},s=this._attributes;for(n in s)r=s[n],n!=="alt"&&(t[n]=r);return" "+c.attributesToString(t)},e.droppers={ImageFixture:c.Element._dropVert,Image:c.Element._dropVert,PreText:c.Element._dropVert,Text:c.Element._dropVert},e.fromDOMElement=function(t){var n,i,o,r,s,a,h,_;for(t.tagName,i=this.getDOMElementAttributes(t),a="",n="",s=(function(){var f,T,x,M;for(x=t.childNodes,M=[],f=0,T=x.length;f<T;f++)o=x[f],M.push(o);return M})(),h=0,_=s.length;h<_;h++)if(r=s[h],r.nodeType===1&&r.tagName.toLowerCase()==="img"){a=r.getAttribute("src")||"",n=r.getAttribute("alt")||"";break}return i=this.getDOMElementAttributes(t),i.alt=n,new this(t.tagName,i,a)},e})(c.Element),c.TagNames.get().register(c.ImageFixture,"img-fixture"),c.Video=(function(l){function e(t,n,i){var o;i==null&&(i=[]),e.__super__.constructor.call(this,t,n),this.sources=i,o=this.size(),this._aspectRatio=o[1]/o[0]}return w(e,l),e.prototype.cssTypeName=function(){return"video"},e.prototype.type=function(){return"Video"},e.prototype.typeName=function(){return"Video"},e.prototype._title=function(){var t;return t="",this.attr("src")?t=this.attr("src"):this.sources.length&&(t=this.sources[0].src),t||(t="No video source set"),t.length>80&&(t=t.substr(0,80)+"..."),t},e.prototype.createDraggingDOMElement=function(){var t;if(this.isMounted())return t=e.__super__.createDraggingDOMElement.call(this),t.innerHTML=this._title(),t},e.prototype.html=function(t){var n,i,o,r,s,a,h;if(t==null&&(t=""),i=c.LINE_ENDINGS,this.tagName()==="video"){for(r=[],h=this.sources,s=0,a=h.length;s<a;s++)o=h[s],n=c.attributesToString(o),r.push(""+t+c.INDENT+"<source "+n+">");return t+"<video"+this._attributesToString()+">"+i+r.join(i)+i+t+"</video>"}return t+"<"+this._tagName+this._attributesToString()+"></"+this._tagName+">"},e.prototype.mount=function(){var t;return this._domElement=document.createElement("div"),this.a&&this.a.class?this._domElement.setAttribute("class",this.a.class):this._attributes.class&&this._domElement.setAttribute("class",this._attributes.class),t=this._attributes.style?this._attributes.style:"",this._attributes.width&&(t+="width:"+this._attributes.width+"px;"),this._attributes.height&&(t+="height:"+this._attributes.height+"px;"),this._domElement.setAttribute("style",t),this._domElement.setAttribute("data-ce-title",this._title()),e.__super__.mount.call(this)},e.prototype.unmount=function(){var t,n;return this.isFixed()&&(n=document.createElement("div"),n.innerHTML=this.html(),t=n.querySelector("iframe"),this._domElement.parentNode.replaceChild(t,this._domElement),this._domElement=t),e.__super__.unmount.call(this)},e.droppers={Image:c.Element._dropBoth,PreText:c.Element._dropBoth,Static:c.Element._dropBoth,Text:c.Element._dropBoth,Video:c.Element._dropBoth},e.placements=["above","below","left","right","center"],e.fromDOMElement=function(t){var n,i,o,r,s,a;for(o=(function(){var h,_,f,T;for(f=t.childNodes,T=[],h=0,_=f.length;h<_;h++)n=f[h],T.push(n);return T})(),r=[],s=0,a=o.length;s<a;s++)i=o[s],i.nodeType===1&&i.tagName.toLowerCase()==="source"&&r.push(this.getDOMElementAttributes(i));return new this(t.tagName,this.getDOMElementAttributes(t),r)},e})(c.ResizableElement),c.TagNames.get().register(c.Video,"iframe","video"),c.List=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n)}return w(e,l),e.prototype.cssTypeName=function(){return"list"},e.prototype.type=function(){return"List"},e.prototype.typeName=function(){return"List"},e.prototype._onMouseOver=function(t){if(this.parent().type()!=="ListItem")return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.droppers={Image:c.Element._dropBoth,ImageFixture:c.Element._dropVert,List:c.Element._dropVert,PreText:c.Element._dropVert,Static:c.Element._dropVert,Text:c.Element._dropVert,Video:c.Element._dropBoth},e.fromDOMElement=function(t){var n,i,o,r,s,a;for(r=new this(t.tagName,this.getDOMElementAttributes(t)),o=(function(){var h,_,f,T;for(f=t.childNodes,T=[],h=0,_=f.length;h<_;h++)n=f[h],T.push(n);return T})(),s=0,a=o.length;s<a;s++)i=o[s],i.nodeType===1&&i.tagName.toLowerCase()==="li"&&r.attach(c.ListItem.fromDOMElement(i));return r.children.length===0?null:r},e})(c.ElementCollection),c.TagNames.get().register(c.List,"ol","ul"),c.ListItem=(function(l){function e(t){e.__super__.constructor.call(this,"li",t),this._behaviours.indent=!0}return w(e,l),e.prototype.cssTypeName=function(){return"list-item"},e.prototype.list=function(){return this.children.length===2?this.children[1]:null},e.prototype.listItemText=function(){return this.children.length>0?this.children[0]:null},e.prototype.type=function(){return"ListItem"},e.prototype.html=function(t){var n;return t==null&&(t=""),n=[t+"<li"+this._attributesToString()+">"],this.listItemText()&&n.push(this.listItemText().html(t+c.INDENT)),this.list()&&n.push(this.list().html(t+c.INDENT)),n.push(t+"</li>"),n.join(c.LINE_ENDINGS)},e.prototype.indent=function(){var t;if(this.can("indent")&&this.parent().children.indexOf(this)!==0)return t=this.previousSibling(),t.list()||t.attach(new c.List(t.parent().tagName())),this.listItemText().storeState(),this.parent().detach(this),t.list().attach(this),this.listItemText().restoreState()},e.prototype.remove=function(){var t,n,i,o,r,s;if(this.parent()){if(i=this.parent().children.indexOf(this),this.list())for(s=this.list().children.slice(),n=o=0,r=s.length;o<r;n=++o)t=s[n],t.parent().detach(t),this.parent().attach(t,n+i);return this.parent().detach(this)}},e.prototype.unindent=function(){var t,n,i,o,r,s,a,h,_,f,T,x,M,A,R,U,H,b,d,u,g;if(this.can("indent")){if(s=this.parent(),n=s.parent(),f=s.children.slice(s.children.indexOf(this)+1,s.children.length),n.type()==="ListItem"){for(this.listItemText().storeState(),s.detach(this),n.parent().attach(this,n.parent().children.indexOf(n)+1),f.length&&!this.list()&&this.attach(new c.List(s.tagName())),x=0,U=f.length;x<U;x++)_=f[x],_.parent().detach(_),this.list().attach(_);return this.listItemText().restoreState()}if(T=new c.Text("p",this.attr("class")?{class:this.attr("class")}:{},this.listItemText().content),h=null,this.listItemText().isFocused()&&(h=ContentSelect.Range.query(this.listItemText().domElement())),a=n.children.indexOf(s),(o=s.
23children.indexOf(this))===0){if(r=null,s.children.length===1?(this.list()&&(r=new c.List(s.tagName())),n.detach(s)):s.detach(this),n.attach(T,a),r&&n.attach(r,a+1),this.list())for(u=this.list().children.slice(),i=M=0,H=u.length;M<H;i=++M)t=u[i],t.parent().detach(t),r?r.attach(t):s.attach(t,i)}else if(o===s.children.length-1)s.detach(this),n.attach(T,a+1),this.list()&&n.attach(this.list(),a+2);else{if(s.detach(this),n.attach(T,a+1),r=new c.List(s.tagName()),n.attach(r,a+2),this.list())for(g=this.list().children.slice(),A=0,b=g.length;A<b;A++)t=g[A],t.parent().detach(t),r.attach(t);for(R=0,d=f.length;R<d;R++)_=f[R],_.parent().detach(_),r.attach(_)}return h?(T.focus(),h.select(T.domElement())):void 0}},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._addDOMEventListeners=function(){},e.prototype._removeDOMEventListners=function(){},e.fromDOMElement=function(t){var n,i,o,r,s,a,h,_,f,T;for(s=new this(this.getDOMElementAttributes(t)),i="",o=null,f=t.childNodes,h=0,_=f.length;h<_;h++)n=f[h],n.nodeType===1?(T=n.tagName.toLowerCase())==="ul"||T==="ol"||T==="li"?o||(o=n):i+=n.outerHTML:i+=HTMLString.String.encode(n.textContent);return i=i.replace(/^\s+|\s+$/g,""),a=new c.ListItemText(i),s.attach(a),o&&(r=c.List.fromDOMElement(o),s.attach(r)),s},e})(c.ElementCollection),c.ListItemText=(function(l){function e(t){e.__super__.constructor.call(this,"div",{},t)}return w(e,l),e.prototype.cssTypeName=function(){return"list-item-text"},e.prototype.type=function(){return"ListItemText"},e.prototype.typeName=function(){return"List item"},e.prototype.blur=function(){return this.content.isWhitespace()&&this.can("remove")?this.parent().remove():this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.Element.prototype.blur.call(this)},e.prototype.can=function(t,n){if(n)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(t)},e.prototype.html=function(t){var n;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(n=c.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),n.optimize(),this._lastCached=Date.now(),this._cached=n.html()),""+t+this._cached},e.prototype._onMouseDown=function(t){var n;return c.Element.prototype._onMouseDown.call(this,t),n=(function(i){return function(){var o;return c.Root.get().dragging()===i?(c.Root.get().cancelDragging(),o=i.closest(function(r){return r.parent().type()==="Region"}),o.drag(t.pageX,t.pageY)):(i.drag(t.pageX,t.pageY),i._dragTimeout=setTimeout(n,2*c.DRAG_HOLD_DURATION))}})(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(n,c.DRAG_HOLD_DURATION)},e.prototype._onMouseMove=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.Element.prototype._onMouseMove.call(this,t)},e.prototype._onMouseUp=function(t){return this._dragTimeout&&clearTimeout(this._dragTimeout),c.Element.prototype._onMouseUp.call(this,t)},e.prototype._keyTab=function(t){return t.preventDefault(),t.shiftKey?this.parent().unindent():this.parent().indent()},e.prototype._keyReturn=function(t){var n,i,o,r,s,a;return t.preventDefault(),this.content.isWhitespace()?void this.parent().unindent():this.can("spawn")?(ContentSelect.Range.query(this._domElement),r=ContentSelect.Range.query(this._domElement),a=this.content.substring(0,r.get()[0]),s=this.content.substring(r.get()[1]),a.length()+s.length()===0?void this.parent().unindent():(this.content=a.trim(),this.updateInnerHTML(),n=this.parent().parent(),o=new c.ListItem(this.attr("class")?{class:this.attr("class")}:{}),n.attach(o,n.children.indexOf(this.parent())+1),o.attach(new c.ListItemText(s.trim())),i=this.parent().list(),i&&(this.parent().detach(i),o.attach(i)),a.length()?(o.listItemText().focus(),r=new ContentSelect.Range(0,0),r.select(o.listItemText().domElement())):(r=new ContentSelect.Range(0,a.length()),r.select(this._domElement)),this.taint())):void 0},e.droppers={ListItemText:function(t,n,i){var o,r,s,a;return o=t.parent(),a=n.parent(),o.remove(),o.detach(t),s=new c.ListItem(o._attributes),s.attach(t),a.list()&&i[0]==="below"?void a.list().attach(s,0):(r=a.parent().children.indexOf(a),i[0]==="below"&&(r+=1),a.parent().attach(s,r))},Text:function(t,n,i){var o,r,s,a,h;if(t.type()==="Text"){if(a=n.parent(),t.parent().detach(t),o=t.attr("class"),s=new c.ListItem(o?{class:o}:{}),s.attach(new c.ListItemText(t.content)),a.list()&&i[0]==="below")return void a.list().attach(s,0);if(r=a.parent().children.indexOf(a),i[0]==="below"&&(r+=1),a.parent().attach(s,r),s.listItemText().focus(),t._savedSelection)return t._savedSelection.select(s.listItemText().domElement())}else if(o=t.attr("class"),h=new c.Text("p",o?{class:o}:{},t.content),t.parent().remove(),r=n.parent().children.indexOf(n),i[0]==="below"&&(r+=1),n.parent().attach(h,r),h.focus(),t._savedSelection)return t._savedSelection.select(h.domElement())}},e.mergers={ListItemText:function(t,n){var i;return i=n.content.length(),t.content.length()&&(n.content=n.content.concat(t.content)),n.isMounted()&&(n._domElement.innerHTML=n.content.html()),n.focus(),new ContentSelect.Range(i,i).select(n._domElement),t.type()==="Text"?t.parent()&&t.parent().detach(t):t.parent().remove(),n.taint()}},e})(c.Text),v=c.ListItemText.mergers,v.Text=v.ListItemText,c.Table=(function(l){function e(t){e.__super__.constructor.call(this,"table",t)}return w(e,l),e.prototype.cssTypeName=function(){return"table"},e.prototype.typeName=function(){return"Table"},e.prototype.type=function(){return"Table"},e.prototype.firstSection=function(){var t;
23return(t=this.thead())||(t=this.tbody())||(t=this.tfoot())?t:null},e.prototype.lastSection=function(){var t;return(t=this.tfoot())||(t=this.tbody())||(t=this.thead())?t:null},e.prototype.tbody=function(){return this._getChild("tbody")},e.prototype.tfoot=function(){return this._getChild("tfoot")},e.prototype.thead=function(){return this._getChild("thead")},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._getChild=function(t){var n,i,o,r;for(r=this.children,i=0,o=r.length;i<o;i++)if(n=r[i],n.tagName()===t)return n;return null},e.droppers={Image:c.Element._dropBoth,ImageFixture:c.Element._dropVert,List:c.Element._dropVert,PreText:c.Element._dropVert,Static:c.Element._dropVert,Table:c.Element._dropVert,Text:c.Element._dropVert,Video:c.Element._dropBoth},e.fromDOMElement=function(t){var n,i,o,r,s,a,h,_,f,T,x,M;for(h=new this(this.getDOMElementAttributes(t)),o=(function(){var A,R,U,H;for(U=t.childNodes,H=[],A=0,R=U.length;A<R;A++)n=U[A],H.push(n);return H})(),r=[],f=0,x=o.length;f<x;f++)if(i=o[f],i.nodeType===1&&(_=i.tagName.toLowerCase(),!h._getChild(_)))switch(_){case"tbody":case"tfoot":case"thead":a=c.TableSection.fromDOMElement(i),h.attach(a);break;case"tr":r.push(c.TableRow.fromDOMElement(i))}if(r.length>0)for(h._getChild("tbody")||h.attach(new c.TableSection("tbody")),T=0,M=r.length;T<M;T++)s=r[T],h.tbody().attach(s);return h.children.length===0?null:h},e})(c.ElementCollection),c.TagNames.get().register(c.Table,"table"),c.TableSection=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n)}return w(e,l),e.prototype.cssTypeName=function(){return"table-section"},e.prototype.type=function(){return"TableSection"},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.fromDOMElement=function(t){var n,i,o,r,s,a;for(r=new this(t.tagName,this.getDOMElementAttributes(t)),o=(function(){var h,_,f,T;for(f=t.childNodes,T=[],h=0,_=f.length;h<_;h++)n=f[h],T.push(n);return T})(),s=0,a=o.length;s<a;s++)i=o[s],i.nodeType===1&&i.tagName.toLowerCase()==="tr"&&r.attach(c.TableRow.fromDOMElement(i));return r},e})(c.ElementCollection),c.TableRow=(function(l){function e(t){e.__super__.constructor.call(this,"tr",t)}return w(e,l),e.prototype.cssTypeName=function(){return"table-row"},e.prototype.isEmpty=function(){var t,n,i,o,r;for(r=this.children,i=0,o=r.length;i<o;i++)if(t=r[i],(n=t.tableCellText())&&n.content.length()>0)return!1;return!0},e.prototype.type=function(){return"TableRow"},e.prototype.typeName=function(){return"Table row"},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.droppers={TableRow:c.Element._dropVert},e.fromDOMElement=function(t){var n,i,o,r,s,a,h;for(r=new this(this.getDOMElementAttributes(t)),o=(function(){var _,f,T,x;for(T=t.childNodes,x=[],_=0,f=T.length;_<f;_++)n=T[_],x.push(n);return x})(),a=0,h=o.length;a<h;a++)i=o[a],i.nodeType===1&&((s=i.tagName.toLowerCase())!=="td"&&s!=="th"||r.attach(c.TableCell.fromDOMElement(i)));return r},e})(c.ElementCollection),c.TableCell=(function(l){function e(t,n){e.__super__.constructor.call(this,t,n)}return w(e,l),e.prototype.cssTypeName=function(){return"table-cell"},e.prototype.tableCellText=function(){return this.children.length>0?this.children[0]:null},e.prototype.type=function(){return"TableCell"},e.prototype.html=function(t){var n;return t==null&&(t=""),n=[t+"<"+this.tagName()+this._attributesToString()+">"],this.tableCellText()&&n.push(this.tableCellText().html(t+c.INDENT)),n.push(t+"</"+this.tagName()+">"),n.join(c.LINE_ENDINGS)},e.prototype._onMouseOver=function(t){return e.__super__._onMouseOver.call(this,t),this._removeCSSClass("ce-element--over")},e.prototype._addDOMEventListeners=function(){},e.prototype._removeDOMEventListners=function(){},e.fromDOMElement=function(t){var n,i;return n=new this(t.tagName,this.getDOMElementAttributes(t)),i=new c.TableCellText(t.innerHTML.replace(/^\s+|\s+$/g,"")),n.attach(i),n},e})(c.ElementCollection),c.TableCellText=(function(l){function e(t){e.__super__.constructor.call(this,"div",{},t)}return w(e,l),e.prototype.cssTypeName=function(){return"table-cell-text"},e.prototype.type=function(){return"TableCellText"},e.prototype._isInFirstRow=function(){var t,n,i,o;return t=this.parent(),n=t.parent(),i=n.parent(),o=i.parent(),i===o.firstSection()&&n===i.children[0]},e.prototype._isInLastRow=function(){var t,n,i,o;return t=this.parent(),n=t.parent(),i=n.parent(),o=i.parent(),i===o.lastSection()&&n===i.children[i.children.length-1]},e.prototype._isLastInSection=function(){var t,n,i;return t=this.parent(),n=t.parent(),i=n.parent(),n===i.children[i.children.length-1]&&t===n.children[n.children.length-1]},e.prototype.blur=function(){return this.isMounted()&&(this._domElement.blur(),this._domElement.removeAttribute("contenteditable")),c.Element.prototype.blur.call(this)},e.prototype.can=function(t,n){if(n)throw new Error("Cannot set behaviour for ListItemText");return this.parent().can(t)},e.prototype.html=function(t){var n;return t==null&&(t=""),(!this._lastCached||this._lastCached<this._modified)&&(n=c.TRIM_WHITESPACE?this.content.copy().trim():this.content.copy(),n.optimize(),this._lastCached=Date.now(),this._cached=n.html()),""+t+this._cached},e.prototype._onMouseDown=function(t){var n;return c.Element.prototype._onMouseDown.call(this,t),n=(function(i){return function(){var o,r;return o=i.parent(),c.Root.get().dragging()===o.parent()?(c.Root.get().cancelDragging(),r=o.parent().parent().parent(),r.drag(t.pageX,t.pageY)):(o.parent().drag(t.pageX,t.pageY),i._dragTimeout=setTimeout(n,2*c.DRAG_HOLD_DURATION))}})(this),clearTimeout(this._dragTimeout),this._dragTimeout=setTimeout(n,c.DRAG_HOLD_DURATION)},e.prototype._keyBack=function(t){var n,i,o,r;if(r=ContentSelect.Range.query(this._domElement),r.get()[0]===0&&r.isCollapsed()&&(t.preventDefault(),n=this.parent(),o=n.parent(),o.isEmpty()&&o.can("remove")))return this.content.length()===0&&o.children.indexOf(n)===0?(i=this.previousContent(),i&&(i.focus(),r=new ContentSelect.Range(i.content.length(),i.content.length()),r.select(i.domElement())),o.parent().detach(o)):void 0},e.prototype._keyDelete=function(t){var n,i,o,r;if(o=this.parent().parent(),o.isEmpty()&&o.can("remove"))return t.preventDefault(),n=o.children[o.children.length-1],i=n.tableCellText().nextContent(),i&&(i.focus(),r=new ContentSelect.Range(0,0),r.select(i.domElement())),o.parent().detach(o)}
23,e.prototype._keyDown=function(t){var n,i,o,r,s,a,h;if(h=ContentSelect.Range.query(this._domElement),this._atEnd(h)&&h.isCollapsed())return t.preventDefault(),n=this.parent(),this._isInLastRow()?(a=n.parent(),o=a.children[a.children.length-1].tableCellText(),r=o.nextContent(),r?r.focus():c.Root.get().trigger("next-region",this.closest(function(_){return _.type()==="Fixture"||_.type()==="Region"}))):(s=n.parent().nextWithTest(function(_){return _.type()==="TableRow"}),i=n.parent().children.indexOf(n),i=Math.min(i,s.children.length),s.children[i].tableCellText().focus())},e.prototype._keyReturn=function(t){return t.preventDefault(),this._keyTab({shiftKey:!1,preventDefault:function(){}})},e.prototype._keyTab=function(t){var n,i,o,r,s,a,h,_,f,T;if(t.preventDefault(),n=this.parent(),t.shiftKey)return this._isInFirstRow()&&n.parent().children[0]===n?void 0:this.previousContent().focus();if(this.can("spawn")){if(o=n.parent().parent(),o.tagName()==="tbody"&&this._isLastInSection()){for(a=new c.TableRow,T=n.parent().children,_=0,f=T.length;_<f;_++)i=T[_],r=new c.TableCell(i.tagName(),i._attributes),s=new c.TableCellText(""),r.attach(s),a.attach(r);return h=this.closest(function(x){return x.type()==="TableSection"}),h.attach(a),a.children[0].tableCellText().focus()}return this.nextContent().focus()}},e.prototype._keyUp=function(t){var n,i,o,r,s,a;if(a=ContentSelect.Range.query(this._domElement),a.get()[0]===0&&a.isCollapsed())return t.preventDefault(),n=this.parent(),this._isInFirstRow()?(s=n.parent(),o=s.children[0].previousContent(),o?o.focus():c.Root.get().trigger("previous-region",this.closest(function(h){return h.type()==="Fixture"||h.type()==="Region"}))):(r=n.parent().previousWithTest(function(h){return h.type()==="TableRow"}),i=n.parent().children.indexOf(n),i=Math.min(i,r.children.length),r.children[i].tableCellText().focus())},e.droppers={},e.mergers={},e})(c.Text)}.call(Lt),function(){var c,m,p,v,y,L={}.hasOwnProperty,S=function(l,e){function t(){this.constructor=l}for(var n in e)L.call(e,n)&&(l[n]=e[n]);return t.prototype=e.prototype,l.prototype=new t,l.__super__=e.prototype,l},w=function(l,e){return function(){return l.apply(e,arguments)}},k=[].slice;m={Tools:{},CANCEL_MESSAGE:"Your changes have not been saved, do you really want to lose them?".trim(),DEFAULT_TOOLS:[["bold","italic","link","align-left","align-center","align-right"],["heading","subheading","paragraph","unordered-list","ordered-list","table","indent","unindent","line-break"],["image","video","preformatted"],["undo","redo","remove"]],DEFAULT_VIDEO_HEIGHT:300,DEFAULT_VIDEO_WIDTH:400,HIGHLIGHT_HOLD_DURATION:2e3,IMAGE_UPLOADER:null,INLINE_TAGS:["a","address","b","code","del","em","i","ins","span","strong","sup","u"],INSPECTOR_IGNORED_ELEMENTS:["Fixture","ListItemText","Region","TableCellText"],MIN_CROP:10,RESTRICTED_ATTRIBUTES:{"*":["style"],img:["height","src","width","data-ce-max-width","data-ce-min-width"],iframe:["height","width"]},getEmbedVideoURL:function(l){var e,t,n,i,o,r,s,a,h,_,f,T,x,M,A;for(e={"www.youtube.com":"youtube","youtu.be":"youtube","vimeo.com":"vimeo","player.vimeo.com":"vimeo"},_=document.createElement("a"),_.href=l,r=_.hostname.toLowerCase(),f=_.pathname,f!==null&&f.substr(0,1)!=="/"&&(f="/"+f),a={},h=_.search.slice(1),A=h.split("&"),x=0,M=A.length;x<M;x++)i=A[x],i=i.split("="),i[0]&&(a[i[0]]=i[1]);switch(e[r]){case"youtube":if(f.toLowerCase()==="/watch"){if(!a.v)return null;t=a.v,delete a.v}else{if(!(o=f.match(/\/([A-Za-z0-9_-]+)$/i)))return null;t=o[1]}return l="https://www.youtube.com/embed/"+t,s=(function(){var R;R=[];for(n in a)T=a[n],R.push(n+"="+T);return R})().join("&"),s&&(l+="?"+s),l;case"vimeo":return(o=f.match(/\/(\w+\/\w+\/){0,1}(\d+)/i))?(l="https://player.vimeo.com/video/"+o[2],s=(function(){var R;R=[];for(n in a)T=a[n],R.push(n+"="+T);return R})().join("&"),s&&(l+="?"+s),l):null}return null},getHTMLCleaner:function(){return new m.HTMLCleaner},getRestrictedAtributes:function(l){var e;return e=[],m.RESTRICTED_ATTRIBUTES[l]&&(e=e.concat(m.RESTRICTED_ATTRIBUTES[l])),m.RESTRICTED_ATTRIBUTES["*"]&&(e=e.concat(m.RESTRICTED_ATTRIBUTES["*"])),e},getScrollPosition:function(){var l,e;return e=window.pageXOffset!==void 0,l=(document.compatMode||4)===4,e?[window.pageXOffset,window.pageYOffset]:l?[document.documentElement.scrollLeft,document.documentElement.scrollTop]:[document.body.scrollLeft,document.body.scrollTop]}},typeof window<"u"&&(window.ContentTools=m),typeof nt<"u"&&nt.exports&&(nt.exports=m),m.ComponentUI=(function(){function l(){this._bindings={},this._parent=null,this._children=[],this._domElement=null}return l.prototype.children=function(){return this._children.slice()},l.prototype.domElement=function(){return this._domElement},l.prototype.isMounted=function(){return this._domElement!==null},l.prototype.parent=function(){return this._parent},l.prototype.attach=function(e,t){return e.parent()&&e.parent().detach(e),e._parent=this,t!==void 0?this._children.splice(t,0,e):this._children.push(e)},l.prototype.addCSSClass=function(e){if(this.isMounted())return ContentEdit.addCSSClass(this._domElement,e)},l.prototype.detach=function(e){var t;if((t=this._children.indexOf(e))!==-1)return this._children.splice(t,1)},l.prototype.mount=function(){},l.prototype.removeCSSClass=function(e){if(this.isMounted())return ContentEdit.removeCSSClass(this._domElement,e)},l.prototype.unmount=function(){if(this.isMounted())return this._removeDOMEventListeners(),this._domElement.parentNode&&this._domElement.parentNode.removeChild(this._domElement),this._domElement=null},l.prototype.addEventListener=function(e,t){this._bindings[e]===void 0&&(this._bindings[e]=[]),this._bindings[e].push(t)},l.prototype.createEvent=function(e,t){return new m.Event(e,t)},l.prototype.dispatchEvent=function(e){var t,n,i,o;if(!this._bindings[e.name()])return!e.defaultPrevented();for(o=this._bindings[e.name()],n=0,i=o.length;n<i&&(t=o[n],!e.propagationStopped());n++)t&&t.call(this,e);return!e.defaultPrevented()},l.prototype.removeEventListener=function(e,t){var n,i,o,r,s,a;if(!e)return void(this._bindings={});if(!t)return void(this._bindings[e]=void 0);if(this._bindings[e]){for(s=this._bindings[e],a=[],n=o=0,r=s.length;o<r;n=++o)i=s[n],i===t?a.push(this._bindings[e].splice(n,1)):a.push(void 0);return a}},l.prototype._addDOMEventListeners=function(){},l.prototype._removeDOMEventListeners=function(){},l.createDiv=function(e,t,n){var i,o,r;if(i=document.createElement("div"),e&&e.length>0&&i.setAttribute("class",e.join(" ")),t)for(o in t)r=t[o],i.setAttribute(o,r);return n&&(i.innerHTML=n),i},l})(),m.WidgetUI=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),e.prototype.attach=function(t,n){if(e.__super__.attach.call(this,t,n),!this.isMounted())return t.mount()},e.prototype.detach=function(t){if(e.__super__.detach.call(this,t),this.isMounted())return t.unmount()},e.prototype.detatch=function(t){return console.log("Please call detach, detatch will be removed in release 1.4.x"),this.detach(t)},e.prototype.show=function(){var t;return this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null,this.unmount()),this.isMounted()||this.mount(),t=(function(n){return function(){return n.addCSSClass("ct-widget--active"),n._showTimeout=null}})(this),this._showTimeout=setTimeout(t,100)},e.prototype.hide=function(){var t;if(this._showTimeout&&(clearTimeout(this._showTimeout),this._showTimeout=null),this.removeCSSClass("ct-widget--active"),t=(function(n){return function(){return n._hideTimeout=null,window.getComputedStyle?parseFloat(window.getComputedStyle(n._domElement).opacity)<.01?n.unmount():n._hideTimeout=setTimeout(t,250):void n.unmount()}})(this),this.isMounted())return this._hideTimeout=setTimeout(t,250)},e})(m.ComponentUI),m.AnchoredComponentUI=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),e.prototype.mount=function(t,n){return n==null&&(n=null),t.insertBefore(this._domElement,n),this._addDOMEventListeners()},e})(m.ComponentUI),m.Event=(function(){function l(e,t){this._name=e,this._detail=t,this._timeStamp=Date.now(),this._defaultPrevented=!1,this._propagationStopped=!1}return l.prototype.defaultPrevented=function(){return this._defaultPrevented},l.prototype.detail=function(){return this._detail},l.prototype.name=function(){return this._name},l.prototype.propagationStopped=function(){return this._propagationStopped},l.prototype.timeStamp=function(){return this._timeStamp},l.prototype.preventDefault=function(){return this._defaultPrevented=!0},l.prototype.stopImmediatePropagation=function(){return this._propagationStopped=!0},l})(),m.FlashUI=(function(l){function e(t){e.__super__.constructor.call(this),this.mount(t)}return S(e,l),e.prototype.mount=function(t){var n;return this._domElement=this.constructor.createDiv(["ct-flash","ct-flash--active","ct-flash--"+t,"ct-widget","ct-widget--active"]),e.__super__.mount.call(this,m.EditorApp.get().domElement()),n=(function(i){return function(){return window.getComputedStyle?parseFloat(window.getComputedStyle(i._domElement).opacity)<.01?i.unmount():setTimeout(n,250):void i.unmount()}})(this),setTimeout(n,250)},e})(m.AnchoredComponentUI),m.IgnitionUI=(function(l){function e(){e.__super__.constructor.call(this),this._revertToState="ready",this._state="ready"}return S(e,l),e.prototype.busy=function(t){if(this.dispatchEvent(this.createEvent("busy",{busy:t})))return t===(this._state==="busy")?void 0:t?(this._revertToState=this._state,this.state("busy")):this.state(this._revertToState)},e.prototype.cancel=function(){if(this.dispatchEvent(this.createEvent("cancel")))return this.state("ready")},e.prototype.confirm=function(){if(this.dispatchEvent(this.createEvent("confirm")))return this.state("ready")},e.prototype.edit=function(){if(this.dispatchEvent(this.createEvent("edit")))return this.state("editing")},e.prototype.mount=function(){return e.__super__.mount.call(this),this._domElement=this.constructor.createDiv(["ct-widget","ct-ignition","ct-ignition--ready"]),this.parent().domElement().appendChild(this._domElement),this._domEdit=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--edit"]),this._domElement.appendChild(this._domEdit),this._domConfirm=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--confirm"]),this._domElement.appendChild(this._domConfirm),this._domCancel=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--cancel"]),this._domElement.appendChild(this._domCancel),this._domBusy=this.constructor.createDiv(["ct-ignition__button","ct-ignition__button--busy"]),this._domElement.appendChild(this._domBusy),this._addDOMEventListeners()},e.prototype.state=function(t){if(t===void 0)return this._state;if(this._state!==t&&this.dispatchEvent(this.createEvent("statechange",{state:t})))return this._state=t,this.removeCSSClass("ct-ignition--busy"),this.removeCSSClass("ct-ignition--editing"),this.removeCSSClass("ct-ignition--ready"),this._state==="busy"?this.addCSSClass("ct-ignition--busy"):this._state==="editing"?this.addCSSClass("ct-ignition--editing"):this._state==="ready"?this.addCSSClass("ct-ignition--ready"):void 0},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domEdit=null,this._domConfirm=null,this._domCancel=null},e.prototype._addDOMEventListeners=function(){return this._domEdit.addEventListener("click",(function(t){return function(n){return n.preventDefault(),t.edit()}})(this)),this._domConfirm.addEventListener("click",(function(t){return function(n){return n.preventDefault(),t.confirm()}})(this)),this._domCancel.addEventListener("click",(function(t){return function(n){return n.preventDefault(),t.cancel()}})(this))},e})(m.WidgetUI),m.InspectorUI=(function(l){function e(){e.__super__.constructor.call(this),this._tagUIs=[]}return S(e,l),e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-inspector"]),this.parent().domElement().appendChild(this._domElement),this._domTags=this.constructor.createDiv(["ct-inspector__tags","ct-tags"]),this._domElement.appendChild(this._domTags),this._domCounter=this.constructor.createDiv(["ct-inspector__counter"]),this._domElement.appendChild(this._domCounter),this.updateCounter(),this._addDOMEventListeners(),this._handleFocusChange=(function(t){return function(){return t.updateTags()}})(this),ContentEdit.Root.get().bind("blur",this._handleFocusChange),ContentEdit.Root.get().bind("focus",this._handleFocusChange),ContentEdit.Root.get().bind("mount",this._handleFocusChange)},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domTags=null,ContentEdit.Root.get().unbind("blur",this._handleFocusChange),ContentEdit.Root.get().unbind("focus",this._handleFocusChange),ContentEdit.Root.get().unbind("mount",this._handleFocusChange)},e.prototype.updateCounter=function(){var t,n,i,o,r,s,a,h,_,f,T;if(this.isMounted()){for(n="",T=m.EditorApp.get().orderedRegions(),_=0,f=T.length;_<f;_++)(s=T[_])&&(n+=s.domElement().textContent);return n=n.trim(),n=n.replace(/<\/?[a-z][^>]*>/gi,""),n=n.replace(/[\u200B]+/,""),n=n.replace(/['";:,.?¿\-!¡]+/g,""),h=(n.match(/\S+/g)||[]).length,h=h.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),(i=ContentEdit.Root.get().focused())&&i.type()==="PreText"&&i.selection().isCollapsed()?(o=0,t=1,a=i.content.substring(0,i.selection().get()[0]),r
23=a.text().split(` 24`),o=r.length,t=r[r.length-1].length+1,o=o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),t=t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),this._domCounter.textContent=h+" / "+o+":"+t):void(this._domCounter.textContent=h)}},e.prototype.updateTags=function(){var t,n,i,o,r,s,a,h,_;for(t=ContentEdit.Root.get().focused(),h=this._tagUIs,o=0,s=h.length;o<s;o++)i=h[o],i.unmount();if(this._tagUIs=[],t){for(n=t.parents(),n.reverse(),n.push(t),_=[],r=0,a=n.length;r<a;r++)t=n[r],m.INSPECTOR_IGNORED_ELEMENTS.indexOf(t.type())===-1&&(i=new m.TagUI(t),this._tagUIs.push(i),_.push(i.mount(this._domTags)));return _}},e.prototype._addDOMEventListeners=function(){return this._updateCounterInterval=setInterval((function(t){return function(){return t.updateCounter()}})(this),250)},e.prototype._removeDOMEventListeners=function(){return clearInterval(this._updateCounterInterval)},e})(m.WidgetUI),m.TagUI=(function(l){function e(t){this.element=t,this._onMouseDown=w(this._onMouseDown,this),e.__super__.constructor.call(this)}return S(e,l),e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-tag"]),this._domElement.textContent=this.element.tagName(),e.__super__.mount.call(this,t,n)},e.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown)},e.prototype._onMouseDown=function(t){var n,i,o;return t.preventDefault(),this.element.storeState&&this.element.storeState(),n=m.EditorApp.get(),o=new m.ModalUI,i=new m.PropertiesDialog(this.element),i.addEventListener("cancel",(function(r){return function(){if(o.hide(),i.hide(),r.element.restoreState)return r.element.restoreState()}})(this)),i.addEventListener("save",(function(r){return function(s){var a,h,_,f,T,x,M,A,R,U,H,b,d,u,g,E,C;x=s.detail(),h=x.changedAttributes,U=x.changedStyles,A=x.innerHTML;for(R in h)if(H=h[R],R==="class"){for(H===null&&(H=""),f={},E=H.split(" "),b=0,u=E.length;b<u;b++)_=E[b],(_=_.trim())&&(f[_]=!0,r.element.hasCSSClass(_)||r.element.addCSSClass(_));for(C=r.element.attr("class").split(" "),d=0,g=C.length;d<g;d++)_=C[d],_=_.trim(),f[_]===void 0&&r.element.removeCSSClass(_)}else H===null?r.element.removeAttr(R):r.element.attr(R,H);for(T in U)a=U[T],a?r.element.addCSSClass(T):r.element.removeCSSClass(T);if(A!==null&&A!==i.getElementInnerHTML()&&(M=r.element,M.content||(M=M.children[0]),M.content=new HTMLString.String(A,M.content.preserveWhitespace()),M.updateInnerHTML(),M.taint(),M.selection(new ContentSelect.Range(0,0)),M.storeState()),o.hide(),i.hide(),r.element.restoreState)return r.element.restoreState()}})(this)),n.attach(o),n.attach(i),o.show(),i.show()},e})(m.AnchoredComponentUI),m.ModalUI=(function(l){function e(t,n){e.__super__.constructor.call(this),this._transparent=t,this._allowScrolling=n}return S(e,l),e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-modal"]),this.parent().domElement().appendChild(this._domElement),this._transparent&&this.addCSSClass("ct-modal--transparent"),this._allowScrolling||ContentEdit.addCSSClass(document.body,"ct--no-scroll"),this._addDOMEventListeners()},e.prototype.unmount=function(){return this._allowScrolling||ContentEdit.removeCSSClass(document.body,"ct--no-scroll"),e.__super__.unmount.call(this)},e.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("click",(function(t){return function(n){return t.dispatchEvent(t.createEvent("click"))}})(this))},e})(m.WidgetUI),m.ToolboxUI=(function(l){function e(t){this._onStopDragging=w(this._onStopDragging,this),this._onStartDragging=w(this._onStartDragging,this),this._onDrag=w(this._onDrag,this),e.__super__.constructor.call(this),this._tools=t,this._dragging=!1,this._draggingOffset=null,this._domGrip=null,this._toolUIs={}}return S(e,l),e.prototype.isDragging=function(){return this._dragging},e.prototype.hide=function(){return this._removeDOMEventListeners(),e.__super__.hide.call(this)},e.prototype.mount=function(){var t,n,i;return this._domElement=this.constructor.createDiv(["ct-widget","ct-toolbox"]),this.parent().domElement().appendChild(this._domElement),this._domGrip=this.constructor.createDiv(["ct-toolbox__grip","ct-grip"]),this._domElement.appendChild(this._domGrip),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domGrip.appendChild(this.constructor.createDiv(["ct-grip__bump"])),this._domToolGroups=this.constructor.createDiv(["ct-tool-groups"]),this._domElement.appendChild(this._domToolGroups),this.tools(this._tools),i=window.localStorage.getItem("ct-toolbox-position"),i&&/^\d+,\d+$/.test(i)&&(n=(function(){var o,r,s,a;for(s=i.split(","),a=[],o=0,r=s.length;o<r;o++)t=s[o],a.push(parseInt(t));return a})(),this._domElement.style.left=n[0]+"px",this._domElement.style.top=n[1]+"px",this._contain()),this._addDOMEventListeners()},e.prototype.tools=function(t){var n,i,o,r,s,a,h,_,f,T,x;
24if(t===void 0)return this._tools;if(this._tools=t,this.isMounted()){f=this._toolUIs;for(s in f)a=f[s],a.unmount();for(this._toolUIs={};this._domToolGroups.lastChild;)this._domToolGroups.removeChild(this._domToolGroups.lastChild);for(T=this._tools,x=[],i=h=0,_=T.length;h<_;i=++h)r=T[i],n=this.constructor.createDiv(["ct-tool-group"]),this._domToolGroups.appendChild(n),x.push(function(){var M,A,R;for(R=[],M=0,A=r.length;M<A;M++)s=r[M],o=m.ToolShelf.fetch(s),this._toolUIs[s]=new m.ToolUI(o),this._toolUIs[s].mount(n),this._toolUIs[s].disabled(!0),R.push(this._toolUIs[s].addEventListener("applied",(function(U){return function(){return U.updateTools()}})(this)));return R}.call(this));return x}},e.prototype.updateTools=function(){var t,n,i,o,r,s;t=ContentEdit.Root.get().focused(),i=null,t&&t.selection&&(i=t.selection()),r=this._toolUIs,s=[];for(n in r)o=r[n],s.push(o.update(t,i));return s},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domGrip=null},e.prototype._addDOMEventListeners=function(){return this._domGrip.addEventListener("mousedown",this._onStartDragging),this._handleResize=(function(t){return function(n){var i;return t._resizeTimeout&&clearTimeout(t._resizeTimeout),i=function(){return t._contain()},t._resizeTimeout=setTimeout(i,250)}})(this),window.addEventListener("resize",this._handleResize),this._updateTools=(function(t){return function(){var n,i,o,r,s,a,h,_;if(n=m.EditorApp.get(),a=!1,i=ContentEdit.Root.get().focused(),r=null,i===t._lastUpdateElement?i&&i.selection&&(r=i.selection(),t._lastUpdateSelection&&r.eq(t._lastUpdateSelection)||(a=!0)):a=!0,n.history&&(t._lastUpdateHistoryLength!==n.history.length()&&(a=!0),t._lastUpdateHistoryLength=n.history.length(),t._lastUpdateHistoryIndex!==n.history.index()&&(a=!0),t._lastUpdateHistoryIndex=n.history.index()),t._lastUpdateElement=i,t._lastUpdateSelection=r,a){h=t._toolUIs,_=[];for(o in h)s=h[o],_.push(s.update(i,r));return _}}})(this),this._updateToolsInterval=setInterval(this._updateTools,100),this._handleKeyDown=(function(t){return function(n){var i,o,r,s,a,h;if((o=ContentEdit.Root.get().focused())&&!o.content){if(n.keyCode===46)return n.preventDefault(),m.Tools.Remove.apply(o,null,function(){});if(n.keyCode===13)return n.preventDefault(),i=m.Tools.Paragraph,i.apply(o,null,function(){})}switch(h=navigator.appVersion,r="linux",h.indexOf("Mac")!==-1?r="mac":h.indexOf("Win")!==-1&&(r="windows"),s=!1,a=!1,r){case"linux":n.altKey||n.keyCode===90&&n.ctrlKey&&(s=n.shiftKey,a=!s);break;case"mac":n.altKey||n.ctrlKey||n.keyCode===90&&n.metaKey&&(s=n.shiftKey,a=!s);break;case"windows":n.altKey&&!n.shiftKey||(n.keyCode===89&&n.ctrlKey&&(s=!0),n.keyCode===90&&n.ctrlKey&&(a=!0))}if(a&&m.Tools.Undo.canApply(null,null)&&m.Tools.Undo.apply(null,null,function(){}),s&&m.Tools.Redo.canApply(null,null))return m.Tools.Redo.apply(null,null,function(){})}})(),window.addEventListener("keydown",this._handleKeyDown)},e.prototype._contain=function(){var t;if(this.isMounted())return t=this._domElement.getBoundingClientRect(),t.left+t.width>window.innerWidth&&(this._domElement.style.left=window.innerWidth-t.width+"px"),t.top+t.height>window.innerHeight&&(this._domElement.style.top=window.innerHeight-t.height+"px"),t.left<0&&(this._domElement.style.left="0px"),t.top<0&&(this._domElement.style.top="0px"),t=this._domElement.getBoundingClientRect(),window.localStorage.setItem("ct-toolbox-position",t.left+","+t.top)},e.prototype._removeDOMEventListeners=function(){return this.isMounted()&&this._domGrip.removeEventListener("mousedown",this._onStartDragging),window.removeEventListener("keydown",this._handleKeyDown),window.removeEventListener("resize",this._handleResize),clearInterval(this._updateToolsInterval)},e.prototype._onDrag=function(t){return ContentSelect.Range.unselectAll(),this._domElement.style.left=t.clientX-this._draggingOffset.x+"px",this._domElement.style.top=t.clientY-this._draggingOffset.y+"px"},e.prototype._onStartDragging=function(t){var n;if(t.preventDefault(),!this.isDragging())return this._dragging=!0,this.addCSSClass("ct-toolbox--dragging"),n=this._domElement.getBoundingClientRect(),this._draggingOffset={x:t.clientX-n.left,y:t.clientY-n.top},document.addEventListener("mousemove",this._onDrag),document.addEventListener("mouseup",this._onStopDragging),ContentEdit.addCSSClass(document.body,"ce--dragging")},e.prototype._onStopDragging=function(t){if(this.isDragging())return this._contain(),document.removeEventListener("mousemove",this._onDrag),document.removeEventListener("mouseup",this._onStopDragging),this._draggingOffset=null,this._dragging=!1,this.removeCSSClass("ct-toolbox--dragging"),ContentEdit.removeCSSClass(document.body,"ce--dragging")},e})(m.WidgetUI),m.ToolUI=(function(l){function e(t){this._onMouseUp=w(this._onMouseUp,this),this._onMouseLeave=w(this._onMouseLeave,this),this._onMouseDown=w(this._onMouseDown,this),this._addDOMEventListeners=w(this._addDOMEventListeners,this),e.__super__.constructor.call(this),this.tool=t,this._mouseDown=!1,this._disabled=!1}return S(e,l),e.prototype.apply=function(t,n){var i,o;if(this.tool.canApply(t,n))return o={element:t,selection:n},i=(function(r){return function(s){if(s)return r.dispatchEvent(r.createEvent("applied",o))}})(this),this.dispatchEvent(this.createEvent("apply",o))?this.tool.apply(t,n,i):void 0},e.prototype.disabled=function(t){if(t===void 0)return this._disabled;if(this._disabled!==t)return this._disabled=t,t?(this._mouseDown=!1,this.addCSSClass("ct-tool--disabled"),this.removeCSSClass("ct-tool--applied")):this.removeCSSClass("ct-tool--disabled")},e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-tool","ct-tool--"+this.tool.icon]),this._domElement.setAttribute("data-ct-tooltip",ContentEdit._(this.tool.label)),e.__super__.mount.call(this,t,n)},e.prototype.update=function(t,n){return(!this.tool.requiresElement||t&&t.isMounted())&&this.tool.canApply(t,n)?(this.disabled(!1),this.tool.isApplied(t,n)?this.addCSSClass("ct-tool--applied"):this.removeCSSClass("ct-tool--applied")):void this.disabled(!0)},e.prototype._addDOMEventListeners=function(){return this._domElement.addEventListener("mousedown",this._onMouseDown),this._domElement.addEventListener("mouseleave",this._onMouseLeave),this._domElement.addEventListener("mouseup",this._onMouseUp)},e.prototype._onMouseDown=function(t){if(t.preventDefault(),!this.disabled())return this._mouseDown=!0,this.addCSSClass("ct-tool--down")},e.prototype._onMouseLeave=function(t){return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},e.prototype._onMouseUp=function(t){var n,i;if(this._mouseDown){if(n=ContentEdit.Root.get().focused(),this.tool.requiresElement&&(!n||!n.isMounted()))return;i=null,n&&n.selection&&(i=n.selection()),this.apply(n,i)}return this._mouseDown=!1,this.removeCSSClass("ct-tool--down")},e})(m.AnchoredComponentUI),m.AnchoredDialogUI=(function(l){function e(){e.__super__.constructor.call(this),this._position=[0,0]}return S(e,l),e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-widget","ct-anchored-dialog"]),this.parent().domElement().appendChild(this._domElement),this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"},e.prototype.position=function(t){return t===void 0?this._position.slice():(this._position=t.slice(),this.isMounted()?(this._contain(),this._domElement.style.top=this._position[1]+"px",this._domElement.style.left=this._position[0]+"px"):void 0)},e.prototype._contain=function(){var t,n,i;if(this.isMounted())return i=this._domElement.getBoundingClientRect(),t=i.width/2+5,n=document.documentElement.clientWidth||document.body.clientWidth,this._position[0]+t>n&&(this._position[0]=n-t),this._position[0]<t&&(this._position[0]=t),this._position[1]+i.top<5?this._position[1]=Math.abs(i.top)+5:void 0},e})(m.WidgetUI),m.DialogUI=(function(l){function e(t){t==null&&(t=""),e.__super__.constructor.call(this),this._busy=!1,this._caption=t}return S(e,l),e.prototype.busy=function(t){if(t===void 0)return this._busy;if(this._busy!==t&&(this._busy=t,this.isMounted()))return this._busy?ContentEdit.addCSSClass(this._domElement,"ct-dialog--busy"):ContentEdit.removeCSSClass(this._domElement,"ct-dialog--busy")},e.prototype.caption=function(t){return t===void 0?this._caption:(this._caption=t,this._domCaption.textContent=ContentEdit._(t))},e.prototype.mount=function(){var t,n,i;return document.activeElement&&(document.activeElement.blur(),window.getSelection().removeAllRanges()),t=["ct-widget","ct-dialog"],this._busy&&t.push("ct-dialog--busy"),this._domElement=this.constructor.createDiv(t),this.parent().domElement().appendChild(this._domElement),i=this.constructor.createDiv(["ct-dialog__header"]),this._domElement.appendChild(i),this._domCaption=this.constructor.createDiv(["ct-dialog__caption"]),i.appendChild(this._domCaption),this.caption(this._caption),this._domClose=this.constructor.createDiv(["ct-dialog__close"]),i.appendChild(this._domClose),n=this.constructor.createDiv(["ct-dialog__body"]),this._domElement.appendChild(n),this._domView=this.constructor.createDiv(["ct-dialog__view"]),n.appendChild(this._domView),this._domControls=this.constructor.createDiv(["ct-dialog__controls"]),n.appendChild(this._domControls),this._domBusy=this.constructor.createDiv(["ct-dialog__busy"]),this._domElement.appendChild(this._domBusy)},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domBusy=null,this._domCaption=null,this._domClose=null,this._domControls=null,this._domView=null},e.prototype._addDOMEventListeners=function(){return this._handleEscape=(function(t){return function(n){if(!t._busy)return n.keyCode===27?t.dispatchEvent(t.createEvent("cancel")):void 0}})(this),document.addEventListener("keyup",this._handleEscape),this._domClose.addEventListener("click",(function(t){return function(n){if(n.preventDefault(),!t._busy)return t.dispatchEvent(t.createEvent("cancel"))}})(this))},e.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keyup",this._handleEscape)},e})(m.WidgetUI),m.ImageDialog=(function(l){function e(){e.__super__.constructor.call(this,"Insert image"),this._cropMarks=null,this._imageURL=null,this._imageSize=null,this._progress=0,this._state="empty",m.IMAGE_UPLOADER&&m.IMAGE_UPLOADER(this)}return S(e,l),e.prototype.cropRegion=function(){return this._cropMarks?this._cropMarks.region():[0,0,1,1]},e.prototype.addCropMarks=function(){if(!this._cropMarks)return this._cropMarks=new p(this._imageSize),this._cropMarks.mount(this._domView),ContentEdit.addCSSClass(this._domCrop,"ct-control--active")},e.prototype.clear=function(){return this._domImage&&(this._domImage.parentNode.removeChild(this._domImage),this._domImage=null),this._imageURL=null,this._imageSize=null,this.state("empty")},e.prototype.mount=function(){var t,n,i;return e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog"),ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--empty"),ContentEdit.addCSSClass(this._domView,"ct-image-dialog__view"),i=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(i),this._domRotateCCW=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--rotate-ccw"]),this._domRotateCCW.setAttribute("data-ct-tooltip",ContentEdit._("Rotate")+" -90\xB0"),i.appendChild(this._domRotateCCW),this._domRotateCW=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--rotate-cw"]),this._domRotateCW.setAttribute("data-ct-tooltip",ContentEdit._("Rotate")+" 90\xB0"),i.appendChild(this._domRotateCW),this._domCrop=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--crop"]),this._domCrop.setAttribute("data-ct-tooltip",ContentEdit._("Crop marks")),i.appendChild(this._domCrop),n=this.constructor.createDiv(["ct-progress-bar"]),i.appendChild(n),this._domProgress=this.constructor.createDiv(["ct-progress-bar__progress"]),n.appendChild(this._domProgress),t=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(t),this._domUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--upload"]),this._domUpload.textContent=ContentEdit._("Upload"),t.appendChild(this._domUpload),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-image-dialog__file-upload"),this._domInput.setAttribute("name","file"),this._domInput.setAttribute("type","file"),this._domInput.setAttribute("accept","image/*"),this._domUpload.appendChild(this._domInput),this._domInsert=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert"]),this._domInsert.textContent=ContentEdit._("Insert"),t.appendChild(this._domInsert),this._domCancelUpload=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--cancel"]),this._domCancelUpload.textContent=ContentEdit._("Cancel"),t.appendChild(this._domCancelUpload),this._domClear=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--clear"]),this._domClear.textContent=ContentEdit._("Clear"),t.appendChild(this._domClear),this._addDOMEventListeners(),this.dispatchEvent(this.createEvent("imageuploader.mount"))},e.prototype.populate=function(t,n){return this._imageURL=t,this._imageSize=n,this._domImage||(this._domImage=this.constructor.createDiv(["ct-image-dialog__image"]),this._domView.appendChild(this._domImage)),this._domImage.style["background-image"]="url("+t+")",this.state("populated")},e.prototype.progress=function(t){return t===void 0?this._progress:(this._progress=t,this.isMounted()?this._domProgress.style.width=this._progress+"%":void 0)},e.prototype.removeCropMarks=function(){if(this._cropMarks)return this._cropMarks.unmount(),this._cropMarks=null,ContentEdit.removeCSSClass(this._domCrop,"ct-control--active")},e.prototype.save=function(t,n,i){return this.dispatchEvent(this.createEvent("save",{imageURL:t,imageSize:n,imageAttrs:i}))},e.prototype.state=function(t){var n;if(t===void 0)return this._state;if(this._state!==t&&(n=this._state,this._state=t,this.isMounted()))return ContentEdit.addCSSClass(this._domElement,"ct-image-dialog--"+this._state),ContentEdit.removeCSSClass(this._domElement,"ct-image-dialog--"+n)},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domCancelUpload=null,this._domClear=null,this._domCrop=null,this._domInput=null,this._domInsert=null,this._domProgress=null,this._domRotateCCW=null,this._domRotateCW=null,this._domUpload=null,this.dispatchEvent(this.createEvent("imageuploader.unmount"))},e.prototype._addDOMEventListeners=function(){return e.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("change",(function(t){return function(n){var i;if(i=n.target.files[0])return n.target.value="",n.target.value&&(n.target.type="text",n.target.type="file"),t.dispatchEvent(t.createEvent("imageuploader.fileready",{file:i}))}})(this)),this._domCancelUpload.addEventListener("click",(function(t){return function(n){return t.dispatchEvent(t.createEvent("imageuploader.cancelupload"))}})(this)),this._domClear.addEventListener("click",(function(t){return function(n){return t.removeCropMarks(),t.dispatchEvent(t.createEvent("imageuploader.clear"))}})(this)),this._domRotateCCW.addEventListener("click",(function(t){return function(n){return t.removeCropMarks(),t.dispatchEvent(t.createEvent("imageuploader.rotateccw"))}})(this)),this._domRotateCW.addEventListener("click",(function(t){return function(n){return t.removeCropMarks(),t.dispatchEvent(t.createEvent("imageuploader.rotatecw"))}})(this)),this._domCrop.addEventListener("click",(function(t){return function(n){return t._cropMarks?t.removeCropMarks():t.addCropMarks()}})(this)),this._domInsert.addEventListener("click",(function(t){return function(n){return t.dispatchEvent(t.createEvent("imageuploader.save"))}})(this))},e})(m.DialogUI),p=(function(l){function e(t){e.__super__.constructor.call(this),this._bounds=null,this._dragging=null,this._draggingOrigin=null,this._imageSize=t}return S(e,l),e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-crop-marks"]),this._domClipper=this.constructor.createDiv(["ct-crop-marks__clipper"]),this._domElement.appendChild(this._domClipper),this._domRulers=[this.
24constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--top-left"]),this.constructor.createDiv(["ct-crop-marks__ruler","ct-crop-marks__ruler--bottom-right"])],this._domClipper.appendChild(this._domRulers[0]),this._domClipper.appendChild(this._domRulers[1]),this._domHandles=[this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--top-left"]),this.constructor.createDiv(["ct-crop-marks__handle","ct-crop-marks__handle--bottom-right"])],this._domElement.appendChild(this._domHandles[0]),this._domElement.appendChild(this._domHandles[1]),e.__super__.mount.call(this,t,n),this._fit(t)},e.prototype.region=function(){return[parseFloat(this._domHandles[0].style.top)/this._bounds[1],parseFloat(this._domHandles[0].style.left)/this._bounds[0],parseFloat(this._domHandles[1].style.top)/this._bounds[1],parseFloat(this._domHandles[1].style.left)/this._bounds[0]]},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domClipper=null,this._domHandles=null,this._domRulers=null},e.prototype._addDOMEventListeners=function(){return e.__super__._addDOMEventListeners.call(this),this._domHandles[0].addEventListener("mousedown",(function(t){return function(n){if(n.button===0)return t._startDrag(0,n.clientY,n.clientX)}})(this)),this._domHandles[1].addEventListener("mousedown",(function(t){return function(n){if(n.button===0)return t._startDrag(1,n.clientY,n.clientX)}})(this))},e.prototype._drag=function(t,n){var i,o,r,s,a;if(this._dragging!==null)return ContentSelect.Range.unselectAll(),s=t-this._draggingOrigin[1],r=n-this._draggingOrigin[0],i=this._bounds[1],n=0,t=0,a=this._bounds[0],o=Math.min(Math.min(m.MIN_CROP,i),a),this._dragging===0?(i=parseInt(this._domHandles[1].style.top)-o,a=parseInt(this._domHandles[1].style.left)-o):(n=parseInt(this._domHandles[0].style.left)+o,t=parseInt(this._domHandles[0].style.top)+o),s=Math.min(Math.max(t,s),i),r=Math.min(Math.max(n,r),a),this._domHandles[this._dragging].style.top=s+"px",this._domHandles[this._dragging].style.left=r+"px",this._domRulers[this._dragging].style.top=s+"px",this._domRulers[this._dragging].style.left=r+"px"},e.prototype._fit=function(t){var n,i,o,r,s,a,h,_;return s=t.getBoundingClientRect(),_=s.width/this._imageSize[0],i=s.height/this._imageSize[1],r=Math.min(_,i),h=r*this._imageSize[0],n=r*this._imageSize[1],o=(s.width-h)/2,a=(s.height-n)/2,this._domElement.style.width=h+"px",this._domElement.style.height=n+"px",this._domElement.style.top=a+"px",this._domElement.style.left=o+"px",this._domHandles[0].style.top="0px",this._domHandles[0].style.left="0px",this._domHandles[1].style.top=n+"px",this._domHandles[1].style.left=h+"px",this._domRulers[0].style.top="0px",this._domRulers[0].style.left="0px",this._domRulers[1].style.top=n+"px",this._domRulers[1].style.left=h+"px",this._bounds=[h,n]},e.prototype._startDrag=function(t,n,i){var o;return o=this._domHandles[t],this._dragging=t,this._draggingOrigin=[i-parseInt(o.style.left),n-parseInt(o.style.top)],this._onMouseMove=(function(r){return function(s){return r._drag(s.clientY,s.clientX)}})(this),document.addEventListener("mousemove",this._onMouseMove),this._onMouseUp=(function(r){return function(s){return r._stopDrag(
24)}})(this),document.addEventListener("mouseup",this._onMouseUp)},e.prototype._stopDrag=function(){return document.removeEventListener("mousemove",this._onMouseMove),document.removeEventListener("mouseup",this._onMouseUp),this._dragging=null,this._draggingOrigin=null},e})(m.AnchoredComponentUI),m.LinkDialog=(function(l){function e(n,i){n==null&&(n=""),i==null&&(i=""),e.__super__.constructor.call(this),this._href=n,this._target=i}var t;return S(e,l),t="_blank",e.prototype.mount=function(){return e.__super__.mount.call(this),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-anchored-dialog__input"),this._domInput.setAttribute("name","href"),this._domInput.setAttribute("placeholder",ContentEdit._("Enter a link")+"..."),this._domInput.setAttribute("type","text"),this._domInput.setAttribute("value",this._href),this._domElement.appendChild(this._domInput),this._domTargetButton=this.constructor.createDiv(["ct-anchored-dialog__target-button"]),this._domElement.appendChild(this._domTargetButton),this._target===t&&ContentEdit.addCSSClass(this._domTargetButton,"ct-anchored-dialog__target-button--active"),this._domButton=this.constructor.createDiv(["ct-anchored-dialog__button"]),this._domElement.appendChild(this._domButton),this._addDOMEventListeners()},e.prototype.save=function(){var n;return this.isMounted()?(n={href:this._domInput.value.trim()},this._target&&(n.target=this._target),this.dispatchEvent(this.createEvent("save",n))):void this.dispatchEvent(this.createEvent("save"))},e.prototype.show=function(){if(e.__super__.show.call(this),this._domInput.focus(),this._href)return this._domInput.select()},e.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),e.__super__.unmount.call(this),this._domButton=null,this._domInput=null},e.prototype._addDOMEventListeners=function(){return this._domInput.addEventListener("keypress",(function(n){return function(i){if(i.keyCode===13)return n.save()}})(this)),this._domTargetButton.addEventListener("click",(function(n){return function(i){return i.preventDefault(),n._target===t?(n._target="",ContentEdit.removeCSSClass(n._domTargetButton,"ct-anchored-dialog__target-button--active")):(n._target=t,ContentEdit.addCSSClass(n._domTargetButton,"ct-anchored-dialog__target-button--active"))}})(this)),this._domButton.addEventListener("click",(function(n){return function(i){return i.preventDefault(),n.save()}})(this))},e})(m.AnchoredDialogUI),m.PropertiesDialog=(function(l){function e(t){var n;this.element=t,e.__super__.constructor.call(this,"Properties"),this._attributeUIs=[],this._focusedAttributeUI=null,this._styleUIs=[],this._supportsCoding=this.element.content,(n=this.element.type())!=="ListItem"&&n!=="TableCell"||(this._supportsCoding=!0)}return S(e,l),e.prototype.caption=function(t){return t===void 0?this._caption:(this._caption=t,this._domCaption.textContent=ContentEdit._(t)+": "+this.element.tagName())},e.prototype.changedAttributes=function(){var t,n,i,o,r,s,a,h,_,f;for(n={},i={},_=this._attributeUIs,a=0,h=_.length;a<h;a++)t=_[a],o=t.name(),s=t.value(),o!==""&&(n[o.toLowerCase()]=!0,this.element.attr(o)!==s&&(i[o]=s));r=m.getRestrictedAtributes(this.element.tagName()),f=this.element.attributes();for(o in f)s=f[o],r&&r.indexOf(o.toLowerCase())!==-1||n[o]===void 0&&(i[o]=null);return i},e.prototype.changedStyles=function(){var t,n,i,o,r,s;for(i={},s=this._styleUIs,o=0,r=s.length;o<r;o++)n=s[o],t=n.style.cssClass(),this.element.hasCSSClass(t)!==n.applied()&&(i[t]=n.applied());return i},e.prototype.getElementInnerHTML=function(){return this._supportsCoding?this.element.content?this.element.content.html():this.element.children[0].content.html():null},e.prototype.mount=function(){var t,n,i,o,r,s,a,h,_,f,T,x,M,A,R;for(e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog"),ContentEdit.addCSSClass(this._domView,"ct-properties-dialog__view"),this._domStyles=this.constructor.createDiv(["ct-properties-dialog__styles"]),this._domStyles.setAttribute("data-ct-empty",ContentEdit._("No styles available for this tag")),this._domView.appendChild(this._domStyles),R=m.StylePalette.styles(this.element),T=0,M=R.length;T<M;T++)h=R[T],_=new v(h,this.element.hasCSSClass(h.cssClass())),this._styleUIs.push(_),_.mount(this._domStyles);this._domAttributes=this.constructor.createDiv(["ct-properties-dialog__attributes"]),this._domView.appendChild(this._domAttributes),a=m.getRestrictedAtributes(this.element.tagName()),n=this.element.attributes(),t=[];for(s in n)f=n[s],a&&a.indexOf(s.toLowerCase())!==-1||t.push(s);for(t.sort(),x=0,A=t.length;x<A;x++)s=t[x],f=n[s],this._addAttributeUI(s,f);return this._addAttributeUI("",""),this._domCode=this.constructor.createDiv(["ct-properties-dialog__code"]),this._domView.appendChild(this._domCode),this._domInnerHTML=document.createElement("textarea"),this._domInnerHTML.setAttribute("class","ct-properties-dialog__inner-html"),this._domInnerHTML.setAttribute("name","code"),this._domInnerHTML.value=this.getElementInnerHTML(),this._domCode.appendChild(this._domInnerHTML),o=this.constructor.createDiv(["ct-control-group","ct-control-group--left"]),this._domControls.appendChild(o),this._domStylesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--styles"]),this._domStylesTab.setAttribute("data-ct-tooltip",ContentEdit._("Styles")),o.appendChild(this._domStylesTab),this._domAttributesTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--attributes"]),this._domAttributesTab.setAttribute("data-ct-tooltip",ContentEdit._("Attributes")),o.appendChild(this._domAttributesTab),this._domCodeTab=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--code"]),this._domCodeTab.setAttribute("data-ct-tooltip",ContentEdit._("Code")),o.appendChild(this._domCodeTab),this._supportsCoding||ContentEdit.addCSSClass(this._domCodeTab,"ct-control--muted"),this._domRemoveAttribute=this.constructor.createDiv(["ct-control","ct-control--icon","ct-control--remove","ct-control--muted"]),this._domRemoveAttribute.setAttribute("data-ct-tooltip",ContentEdit._("Remove")),o.appendChild(this._domRemoveAttribute),i=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(i),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent=ContentEdit._("Apply"),i.appendChild(this._domApply),r=window.localStorage.getItem("ct-properties-dialog-tab"),r==="attributes"?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--attributes"),ContentEdit.addCSSClass(this._domAttributesTab,"ct-control--active")):r==="code"&&this._supportsCoding?(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--code"),ContentEdit.addCSSClass(this._domCodeTab,"ct-control--active")):(ContentEdit.addCSSClass(this._domElement,"ct-properties-dialog--styles"),ContentEdit.addCSSClass(this._domStylesTab,"ct-control--active")),this._addDOMEventListeners()},e.prototype.save=function(){var t,n;return n=null,this._supportsCoding&&(n=this._domInnerHTML.value),t={changedAttributes:this.changedAttributes(),changedStyles:this.changedStyles(),innerHTML:n},this.dispatchEvent(this.createEvent("save",t))},e.prototype._addAttributeUI=function(t,n){var i,o;return o=this,i=new c(t,n),this._attributeUIs.push(i),i.addEventListener("blur",function(r){var s,a,h;if(o._focusedAttributeUI=null,ContentEdit.addCSSClass(o._domRemoveAttribute,"ct-control--muted"),s=o._attributeUIs.indexOf(this),h=o._attributeUIs.length,this.name()===""&&s<h-1&&(this.unmount(),o._attributeUIs.splice(s,1)),(a=o._attributeUIs[h-1])&&a.name()&&a.value())return o._addAttributeUI("","")}),i.addEventListener("focus",function(r){return o._focusedAttributeUI=this,ContentEdit.removeCSSClass(o._domRemoveAttribute,"ct-control--muted")}),i.addEventListener("namechange",function(r){var s,a,h,_,f,T,x;for(s=o.element,t=this.name().toLowerCase(),h=m.getRestrictedAtributes(s.tagName()),_=!0,h&&h.indexOf(t)!==-1&&(_=!1),x=o._attributeUIs,f=0,T=x.length;f<T;f++)a=x[f],t!==""&&a!==this&&a.name().toLowerCase()===t&&(_=!1);return this.valid(_),_?ContentEdit.removeCSSClass(o._domApply,"ct-control--muted"):ContentEdit.addCSSClass(o._domApply,"ct-control--muted")}),i.mount(this._domAttributes),i},e.prototype._addDOMEventListeners=function(){var t,n;return e.__super__._addDOMEventListeners.call(this),t=(function(i){return function(o){var r,s,a,h,_,f;for(h=["attributes","code","styles"],_=0,f=h.length;_<f;
24_++)(s=h[_])!==o&&(a=s.charAt(0).toUpperCase()+s.slice(1),ContentEdit.removeCSSClass(i._domElement,"ct-properties-dialog--"+s),ContentEdit.removeCSSClass(i["_dom"+a+"Tab"],"ct-control--active"));return r=o.charAt(0).toUpperCase()+o.slice(1),ContentEdit.addCSSClass(i._domElement,"ct-properties-dialog--"+o),ContentEdit.addCSSClass(i["_dom"+r+"Tab"],"ct-control--active"),window.localStorage.setItem("ct-properties-dialog-tab",o)}})(this),this._domStylesTab.addEventListener("mousedown",(function(i){return function(){return t("styles")}})()),this._domAttributesTab.addEventListener("mousedown",(function(i){return function(){return t("attributes")}})()),this._supportsCoding&&this._domCodeTab.addEventListener("mousedown",(function(i){return function(){return t("code")}})()),this._domRemoveAttribute.addEventListener("mousedown",(function(i){return function(o){var r,s;if(o.preventDefault(),i._focusedAttributeUI&&(r=i._attributeUIs.indexOf(i._focusedAttributeUI),s=r===i._attributeUIs.length-1,i._focusedAttributeUI.unmount(),i._attributeUIs.splice(r,1),s))return i._addAttributeUI("","")}})(this)),n=(function(i){return function(o){try{return new HTMLString.String(i._domInnerHTML.value),ContentEdit.removeCSSClass(i._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.removeCSSClass(i._domApply,"ct-control--muted")}catch{return ContentEdit.addCSSClass(i._domInnerHTML,"ct-properties-dialog__inner-html--invalid"),ContentEdit.addCSSClass(i._domApply,"ct-control--muted")}}})(this),this._domInnerHTML.addEventListener("input",n),this._domInnerHTML.addEventListener("propertychange",n),this._domApply.addEventListener("click",(function(i){return function(o){var r;if(o.preventDefault(),r=i._domApply.getAttribute("class"),r.indexOf("ct-control--muted")===-1)return i.save()}})(this))},e})(m.DialogUI),v=(function(l){function e(t,n){this.style=t,e.__super__.constructor.call(this),this._applied=n}return S(e,l),e.prototype.applied=function(t){if(t===void 0)return this._applied;if(this._applied!==t)return this._applied=t,this._applied?ContentEdit.addCSSClass(this._domElement,"ct-section--applied"):ContentEdit.removeCSSClass(this._domElement,"ct-section--applied")},e.prototype.mount=function(t,n){var i;return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-section"]),this._applied&&ContentEdit.addCSSClass(this._domElement,"ct-section--applied"),i=this.constructor.createDiv(["ct-section__label"]),i.textContent=this.style.name(),this._domElement.appendChild(i),this._domElement.appendChild(this.constructor.createDiv(["ct-section__switch"])),e.__super__.mount.call(this,t,n)},e.prototype._addDOMEventListeners=function(){var t;return t=(function(n){return function(i){return i.preventDefault(),n.applied()?n.applied(!1):n.applied(!0)}})(this),this._domElement.addEventListener("click",t)},e})(m.AnchoredComponentUI),c=(function(l){function e(t,n){e.__super__.constructor.call(this),this._initialName=t,this._initialValue=n}return S(e,l),e.prototype.name=function(){return this._domName.value.trim()},e.prototype.value=function(){return this._domValue.value.trim()},e.prototype.mount=function(t,n){return n==null&&(n=null),this._domElement=this.constructor.createDiv(["ct-attribute"]),this._domName=document.createElement("input"),this._domName.setAttribute("class","ct-attribute__name"),this._domName.setAttribute("name","name"),this._domName.setAttribute("placeholder",ContentEdit._("Name")),this._domName.setAttribute("type","text"),this._domName.setAttribute("value",this._initialName),this._domElement.appendChild(this._domName),this._domValue=document.createElement("input"),this._domValue.setAttribute("class","ct-attribute__value"),this._domValue.setAttribute("name","value"),this._domValue.setAttribute("placeholder",ContentEdit._("Value")),this._domValue.setAttribute("type","text"),this._domValue.setAttribute("value",this._initialValue),this._domElement.appendChild(this._domValue),e.__super__.mount.call(this,t,n)},e.prototype.valid=function(t){return t?ContentEdit.removeCSSClass(this._domName,"ct-attribute__name--invalid"):ContentEdit.addCSSClass(this._domName,"ct-attribute__name--invalid")},e.prototype._addDOMEventListeners=function(){return this._domName.addEventListener("blur",(function(t){return function(){var n,i,o;if(n=t.name(),i=t._domElement.nextSibling,t.dispatchEvent(t.createEvent("blur")),n===""&&i)return o=i.querySelector(".ct-attribute__name"),o.focus()}})(this)),this._domName.addEventListener("focus",(function(t){return function(){return t.dispatchEvent(t.createEvent("focus"))}})(this)),this._domName.addEventListener("input",(function(t){return function(){return t.dispatchEvent(t.createEvent("namechange"))}})(this)),this._domName.addEventListener("keydown",(function(t){return function(n){if(n.keyCode===13)return t._domValue.focus()}})(this)),this._domValue.addEventListener("blur",(function(t){return function(){return t.dispatchEvent(t.createEvent("blur"))}})(this)),this._domValue.addEventListener("focus",(function(t){return function(){return t.dispatchEvent(t.createEvent("focus"))}})(this)),this._domValue.addEventListener("keydown",(function(t){return function(n){var i,o;if(n.keyCode===13||n.keyCode===9&&!n.shiftKey)return n.preventDefault(),i=t._domElement.nextSibling,i||(t._domValue.blur(),i=t._domElement.nextSibling),i?(o=i.querySelector(".ct-attribute__name"),o.focus()):void 0}})(this))},e})(m.AnchoredComponentUI),m.TableDialog=(function(l){function e(t){this.table=t,this.table?e.__super__.constructor.call(this,"Update table"):e.__super__.constructor.call(this,"Insert table")}return S(e,l),e.prototype.mount=function(){var t,n,i,o,r,s,a;return e.__super__.mount.call(this),t={columns:3,foot:!1,head:!0},this.table&&(t={columns:this.table.firstSection().children[0].children.length,foot:this.table.tfoot(),head:this.table.thead()}),ContentEdit.addCSSClass(this._domElement,"ct-table-dialog"),ContentEdit.addCSSClass(this._domView,"ct-table-dialog__view"),a=["ct-section"],t.head&&a.push("ct-section--applied"),this._domHeadSection=this.constructor.createDiv(a),this._domView.appendChild(this._domHeadSection),r=this.constructor.createDiv(["ct-section__label"]),r.textContent=ContentEdit._("Table head"),this._domHeadSection.appendChild(r),this._domHeadSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domHeadSection.appendChild(this._domHeadSwitch),this._domBodySection=this.constructor.createDiv(["ct-section","ct-section--applied","ct-section--contains-input"]),this._domView.appendChild(this._domBodySection),n=this.constructor.createDiv(["ct-section__label"]),n.textContent=ContentEdit._("Table body (columns)"),this._domBodySection.appendChild(n),this._domBodyInput=document.createElement("input"),this._domBodyInput.setAttribute("class","ct-section__input"),this._domBodyInput.setAttribute("maxlength","2"),this._domBodyInput.setAttribute("name","columns"),this._domBodyInput.setAttribute("type","text"),this._domBodyInput.setAttribute("value",t.columns),this._domBodySection.appendChild(this._domBodyInput),s=["ct-section"],t.foot&&s.push("ct-section--applied"),this._domFootSection=this.constructor.createDiv(s),this._domView.appendChild(this._domFootSection),o=this.constructor.createDiv(["ct-section__label"]),o.textContent=ContentEdit._("Table foot"),this._domFootSection.appendChild(o),this._domFootSwitch=this.constructor.createDiv(["ct-section__switch"]),this._domFootSection.appendChild(this._domFootSwitch),i=this.constructor.createDiv(["ct-control-group","ct-control-group--right"]),this._domControls.appendChild(i),this._domApply=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--apply"]),this._domApply.textContent="Apply",i.appendChild(this._domApply),this._addDOMEventListeners()},e.prototype.save=function(){var t,n,i;return n=this._domFootSection.getAttribute("class"),i=this._domHeadSection.getAttribute("class"),t={columns:parseInt(this._domBodyInput.value),foot:n.indexOf("ct-section--applied")>-1,head:i.indexOf("ct-section--applied")>-1},this.dispatchEvent(this.createEvent("save",t))},e.prototype.unmount=function(){return e.__super__.unmount.call(this),this._domBodyInput=null,this._domBodySection=null,this._domApply=null,this._domHeadSection=null,this._domHeadSwitch=null,this._domFootSection=null,this._domFootSwitch=null},e.prototype._addDOMEventListeners=function(){var t;return e.__super__._addDOMEventListeners.call(this),t=function(n){return n.preventDefault(),this.getAttribute("class").indexOf("ct-section--applied")>-1?ContentEdit.removeCSSClass(this,"ct-section--applied"):ContentEdit.addCSSClass(this,"ct-section--applied")},this._domHeadSection.addEventListener("click",t),this._domFootSection.addEventListener("click",t),this._domBodySection.addEventListener("click",(function(n){return function(i){return n._domBodyInput.focus()}})(this)),this._domBodyInput.addEventListener("input",(function(n){return function(i){var o;return o=/^[1-9]\d{0,1}$/.test(i.target.value),o?(ContentEdit.removeCSSClass(n._domBodyInput,"ct-section__input--invalid"),ContentEdit.removeCSSClass(n._domApply,"ct-control--muted")):(ContentEdit.addCSSClass(n._domBodyInput,"ct-section__input--invalid"),ContentEdit.addCSSClass(n._domApply,"ct-control--muted"))}})(this)),this._domApply.addEventListener("click",(function(n){return function(i){var o;if(i.preventDefault(),o=n._domApply.getAttribute("class"),o.indexOf("ct-control--muted")===-1)return n.save()}})(this))},e})(m.DialogUI),m.VideoDialog=(function(l){function e(){e.__super__.constructor.call(this,"Insert video")}return S(e,l),e.prototype.clearPreview=function(){if(this._domPreview)return this._domPreview.parentNode.removeChild(this._domPreview),this._domPreview=void 0},e.prototype.mount=function(){var t;return e.__super__.mount.call(this),ContentEdit.addCSSClass(this._domElement,"ct-video-dialog"),ContentEdit.addCSSClass(this._domView,"ct-video-dialog__preview"),t=this.constructor.createDiv(["ct-control-group"]),this._domControls.appendChild(t),this._domInput=document.createElement("input"),this._domInput.setAttribute("class","ct-video-dialog__input"),this._domInput.setAttribute("name","url"),this._domInput.setAttribute("placeholder",ContentEdit._("Paste YouTube or Vimeo URL")+"..."),this._domInput.setAttribute("type","text"),t.appendChild(this._domInput),this._domButton=this.constructor.createDiv(["ct-control","ct-control--text","ct-control--insert","ct-control--muted"]),this._domButton.textContent=ContentEdit._("Insert"),t.appendChild(this._domButton),this._addDOMEventListeners()},e.prototype.preview=function(t){return this.clearPreview(),this._domPreview=document.createElement("iframe"),this._domPreview.setAttribute("frameborder","0"),this._domPreview.setAttribute("height","100%"),this._domPreview.setAttribute("src",t),this._domPreview.setAttribute("width","100%"),this._domView.appendChild(this._domPreview)},e.prototype.save=function(){var t,n;return n=this._domInput.value.trim(),t=m.getEmbedVideoURL(n),t?this.dispatchEvent(this.createEvent("save",{url:t})):this.dispatchEvent(this.createEvent("save",{url:n}))},e.prototype.show=function(){return e.__super__.show.call(this),this._domInput.focus()},e.prototype.unmount=function(){return this.isMounted()&&this._domInput.blur(),e.__super__.unmount.call(this),this._domButton=null,this._domInput=null,this._domPreview=null},e.prototype._addDOMEventListeners=function(){return e.__super__._addDOMEventListeners.call(this),this._domInput.addEventListener("input",(function(t){return function(n){var i;return n.target.value?ContentEdit.removeCSSClass(t._domButton,"ct-control--muted"):ContentEdit.addCSSClass(t._domButton,"ct-control--muted"),t._updatePreviewTimeout&&clearTimeout(t._updatePreviewTimeout),i=function(){var o,r;return r=t._domInput.value.trim(),o=m.getEmbedVideoURL(r),o?t.preview(o):t.clearPreview()},t._updatePreviewTimeout=setTimeout(i,500)}})(this)),this._domInput.addEventListener("keypress",(function(t){return function(n){if(n.keyCode===13)return t.save()}})(this)),this._domButton.addEventListener("click",(function(t){return function(n){var i;if(n.preventDefault(),i=t._domButton.getAttribute("class"),i.indexOf("ct-control--muted")===-1)return t.save()}})(this))},e})(m.DialogUI),m.HTMLCleaner=(function(){function l(e,t){this.tagWhitelist=e||this.constructor.DEFAULT_TAG_WHITELIST,this.attributeWhitelist=t||this.constructor.DEFAULT_ATTRIBUTE_WHITELIST}return l.DEFAULT_ATTRIBUTE_WHITELIST={a:["href"],td:["colspan"]},l.DEFAULT_TAG_WHITELIST=["a","address","b","blockquote","code","del","em","h1","h2","h3","h4","h5","h6","i","ins","li","ol","p","pre","strong","sup","table","tbody","td","tfoot","th","thead","tr","u","ul","#text"],l.NO_CONTENT_TAGS=["head","meta","style","script","title"],l.prototype.clean=function(e){var t,n,i,o,r,s,a,h,_,f,T,x,M,A,R,U,H;
24for(e=e.replace(/<span( class="Apple-converted-space")?> <\/span>/g," "),_=document.implementation.createHTMLDocument(),x=_.createElement("div"),x.innerHTML=e,f=(function(){var b,d,u,g;for(u=x.childNodes,g=[],b=0,d=u.length;b<d;b++)i=u[b],g.push(i);return g})();f.length>0;)if(r=f.shift(),s=r.nodeName.toLowerCase(),this.tagWhitelist.indexOf(s)<0){if(this.constructor.NO_CONTENT_TAGS.indexOf(s)>-1){r.remove();continue}for(H=r.childNodes,M=0,R=H.length;M<R;M++)(o=H[M])&&(o=o.cloneNode(!0),o.nodeName.toLowerCase(),r.parentNode.insertBefore(o,r),f.push(o));r.remove()}else if(s==="#text"||r.textContent.trim()!==""){if(s!=="td"&&s!=="th"&&s!=="li"||r.querySelector("p")&&(r.innerHTML=r.textContent),r.attributes)for(h=this.attributeWhitelist[s]||[],a=(function(){var b,d,u,g;for(u=r.attributes,g=[],b=0,d=u.length;b<d;b++)t=u[b],g.push(t);return g})(),A=0,U=a.length;A<U;A++)n=a[A],(h.indexOf(n.name.toLowerCase())<0||n.name.toLowerCase()==="href"&&(T=r.getAttribute(n.name),T.startsWith("javascript:")))&&r.removeAttribute(n.name);f.push.apply(f,(function(){var b,d,u,g;for(u=r.childNodes,g=[],b=0,d=u.length;b<d;b++)i=u[b],g.push(i);return g})())}else r.textContent===""||r.parentNode===x?r.remove():r.parentNode.replaceChild(_.createTextNode(" "),r);return x.innerHTML},l})(),y=(function(l){function e(){e.__super__.constructor.call(this),this.history=null,this._state="dormant",this._busy=!1,this._namingProp=null,this._fixtureTest=function(t){return t.hasAttribute("data-fixture")},this._regionQuery=null,this._domRegions=null,this._regions={},this._orderedRegions=[],this._rootLastModified=null,this._regionsLastModified={},this._ignition=null,this._inspector=null,this._toolbox=null,this._emptyRegionsAllowed=!1}return S(e,l),e.prototype.ctrlDown=function(){return this._ctrlDown},e.prototype.domRegions=function(){return this._domRegions},e.prototype.getState=function(){return this._state},e.prototype.ignition=function(){return this._ignition},e.prototype.inspector=function(){return this._inspector},e.prototype.isDormant=function(){return this._state==="dormant"},e.prototype.isReady=function(){return this._state==="ready"},e.prototype.isEditing=function(){return this._state==="editing"},e.prototype.orderedRegions=function(){var t;return function(){var n,i,o,r;for(o=this._orderedRegions,r=[],n=0,i=o.length;n<i;n++)t=o[n],r.push(this._regions[t]);return r}.call(this)},e.prototype.regions=function(){return this._regions},e.prototype.shiftDown=function(){return this._shiftDown},e.prototype.toolbox=function(){return this._toolbox},e.prototype.busy=function(t){return t===void 0?this._busy:(this._busy=t,this._ignition?this._ignition.busy(t):void 0)},e.prototype.createPlaceholderElement=function(t){return new ContentEdit.Text("p",{},"")},e.prototype.init=function(t,n,i,o){return n==null&&(n="id"),i==null&&(i=null),o==null&&(o=!0),this._namingProp=n,i&&(this._fixtureTest=i),this.mount(),o&&(this._ignition=new m.IgnitionUI,this.attach(this._ignition),this._ignition.addEventListener("edit",(function(r){return function(s){return s.preventDefault(),r.start(),r._ignition.state("editing")}})(this)),this._ignition.addEventListener("confirm",(function(r){return function(s){if(s.preventDefault(),r._ignition.state()==="editing")return r._ignition.state("ready"),r.stop(!0)}})(this)),this._ignition.addEventListener("cancel",(function(r){return function(s){if(s.preventDefault(),r._ignition.state()==="editing")return r.stop(!1),r.isEditing()?r._ignition.state("editing"):r._ignition.state("ready")}})(this))),this._toolbox=new m.ToolboxUI(m.DEFAULT_TOOLS),this.attach(this._toolbox),this._inspector=new m.InspectorUI,this.attach(this._inspector),this._state="ready",this._handleDetach=(function(r){return function(s){return r._preventEmptyRegions()}})(this),this._handleClipboardPaste=(function(r){return function(s,a){return a.clipboardData?void(a.clipboardData.getData("text/html")&&s.type()!=="PreText"?r.pasteHTML(s,a.clipboardData.getData("text/html")):r.pasteText(s,a.clipboardData.getData("text/plain"))):window.clipboardData?(window.clipboardData.getData("TEXT"),r.pasteText(s,window.clipboardData.getData("TEXT"))):void 0}})(this),this._handleNextRegionTransition=(function(r){return function(s){var a,h,_,f,T,x,M;if(f=r.orderedRegions(),!((_=f.indexOf(s))>=f.length-1)){for(s=f[_+1],h=null,M=s.descendants(),T=0,x=M.length;T<x;T++)if(a=M[T],a.content!==void 0){h=a;break}return h?(h.focus(),void h.selection(new ContentSelect.Range(0,0))):ContentEdit.Root.get().trigger("next-region",s)}}})(this),this._handlePreviousRegionTransition=(function(r){return function(s){var a,h,_,f,T,x,M,A;if(x=r.orderedRegions(),!((f=x.indexOf(s))<=0)){for(s=x[f-1],_=null,h=s.descendants(),h.reverse(),M=0,A=h.length;M<A;M++)if(a=h[M],a.content!==void 0){_=a;break}return _?(T=_.content.length(),_.focus(),void _.selection(new ContentSelect.Range(T,T))):ContentEdit.Root.get().trigger("previous-region",s)}}})(this),ContentEdit.Root.get().bind("detach",this._handleDetach),ContentEdit.Root.get().bind("paste",this._handleClipboardPaste),ContentEdit.Root.get().bind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().bind("previous-region",this._handlePreviousRegionTransition),this.syncRegions(t)},e.prototype.destroy=function(){return ContentEdit.Root.get().unbind("detach",this._handleDetach),ContentEdit.Root.get().unbind("paste",this._handleClipboardPaste),ContentEdit.Root.get().unbind("next-region",this._handleNextRegionTransition),ContentEdit.Root.get().unbind("previous-region",this._handlePreviousRegionTransition),this.removeEventListener(),this.unmount(),this._children=[]},e.prototype.highlightRegions=function(t){var n,i,o,r,s;for(r=this._domRegions,s=[],i=0,o=r.length;i<o;i++)n=r[i],t?s.push(ContentEdit.addCSSClass(n,"ct--highlight")):s.push(ContentEdit.removeCSSClass(n,"ct--highlight"));return s},e.prototype.mount=function(){return this._domElement=this.constructor.createDiv(["ct-app"]),document.body.insertBefore(this._domElement,null),this._addDOMEventListeners()},e.prototype.unmount=function(){var t,n,i,o;if(this.isMounted()){for(o=this._children,n=0,i=o.length;n<i;n++)t=o[n],t.unmount();return this._domElement.parentNode.removeChild(this._domElement),this._domElement=null,this._removeDOMEventListeners(),this._ignition=null,this._inspector=null,this._toolbox=null}},e.prototype.pasteHTML=function(t,n){var i,o,r,s,a,h,_,f,T,x,M,A,R,U,H,b,d,u,g,E,C,I,D,N,O,F,P,j,V;for(g=ContentEdit.TagNames.get(),d=document.implementation.createHTMLDocument(),D=d.createElement("div"),D.innerHTML=m.getHTMLCleaner().clean(n.trim()),r=[],j=D.childNodes,N=0,F=j.length;N<F;N++)(o=j[N])&&(o.nodeName.toLowerCase()==="#text"&&o.textContent.trim()===""||r.push(o));if(r.length){if(f=m.INLINE_TAGS.slice(),f.push("#text"),h=r[0].nodeName.toLowerCase(),x=r[r.length-1].nodeName.toLowerCase(),t.isFixed()||f.indexOf(h)>-1&&f.indexOf(x)>-1){if(n=f.indexOf(h)>-1&&f.indexOf(x)>-1?new HTMLString.String(D.innerHTML):new HTMLString.String(HTMLString.String.encode(D.textContent)),t.content)return u=t.selection(),s=u.get()[0]+n.length(),I=t.content.substring(0,u.get()[0]),C=t.content.substring(u.get()[1]),b=t.content.substring(u.get()[0],u.get()[1]),b.length()&&(i=b.characters[0],E=i.tags(),i.isTag()&&E.shift(),E.length>=1&&(n=n.format.apply(n,[0,n.length()].concat(k.call(E))))),t.content=I.concat(n),t.content=t.content.concat(C,!1),t.updateInnerHTML(),t.taint(),u.set(s,s),void t.selection(u);D.innerHTML="<p>"+n.html()+"</p>"}if(R=t,t.parent().type()!=="Region"&&(t=t.closest(function(B){return B.parent().type()==="Region"})),H=t.parent(),f.indexOf(h)>-1&&f.indexOf(x)>-1){for(T=D.createElement("p");D.childNodes.length>0;)T.appendChild(D.childNodes[0]);D.appendChild(T)}for(_=0,M=R,V=D.childNodes,O=0,P=V.length;O<P;O++)(A=V[O])&&(A.nodeName==="#text"&&A.textContent.trim()===""||(a=g.match(A.nodeName),a===ContentEdit.Static&&(U=document.createElement("p"),U.appendChild(A),A=U,a=ContentEdit.Text),M=a.fromDOMElement(A),H.attach(M,H.children.indexOf(t)+(1+_)),_+=1));return M.focus?M.focus():M.nextSibling()?(M=M.nextSibling().previousWithTest(function(B){if(B.focus)return B}))?M.focus():void 0:(M=M.nextWithTest(function(B){if(B.focus)return B}),M?M.focus():R.focus())}},e.prototype.pasteText=function(t,n){var i,o,r,s,a,h,_,f,T,x,M,A,R,U,H,b,d,u,g,E,C,I;if(R=t.type()!=="PreText"?n.split(` 25`):[n],R=R.filter(function(D){return D.trim()!==""}
25)){if(r=HTMLString.String.encode,b=!0,E=t.type(),R.length===1&&(b=!1),E==="PreText"&&(b=!1),t.can("spawn")||(b=!1),b){for(E==="ListItemText"?(_=t.parent(),h=t.parent().parent(),a=h.children.indexOf(_)+1):(_=t,_.parent().type()!=="Region"&&(_=t.closest(function(D){return D.parent().type()==="Region"})),h=_.parent(),a=h.children.indexOf(_)+1),s=C=0,I=R.length;C<I;s=++C)M=R[s],M=r(M),E==="ListItemText"?(f=new ContentEdit.ListItem,T=new ContentEdit.ListItemText(M),f.attach(T),x=T):(f=new ContentEdit.Text("p",{},M),x=f),h.attach(f,a+s);return A=x.content.length(),x.focus(),x.selection(new ContentSelect.Range(A,A))}return n=r(n),n=new HTMLString.String(n,E==="PreText"),H=t.selection(),o=H.get()[0]+n.length(),g=t.content.substring(0,H.get()[0]),u=t.content.substring(H.get()[1]),U=t.content.substring(H.get()[0],H.get()[1]),U.length()&&(i=U.characters[0],d=i.tags(),i.isTag()&&d.shift(),d.length>=1&&(n=n.format.apply(n,[0,n.length()].concat(k.call(d))))),t.content=g.concat(n),t.content=t.content.concat(u,!1),t.updateInnerHTML(),t.taint(),H.set(o,o),t.selection(H)}},e.prototype.revert=function(){var t;if(this.dispatchEvent(this.createEvent("revert")))return!(m.CANCEL_MESSAGE&&(t=ContentEdit._(m.CANCEL_MESSAGE),ContentEdit.Root.get().lastModified()>this._rootLastModified&&!window.confirm(t)))&&(this.revertToSnapshot(this.history.goTo(0),!1),!0)},e.prototype.revertToSnapshot=function(t,n){var i,o,r,s,a,h,_,f,T,x;n==null&&(n=!0),o=[],f=this._regions;for(r in f){for(s=f[r],T=s.children,h=0,_=T.length;h<_;h++)i=T[h],i.unmount();t.regions[r]!==void 0?s.children.length===1&&s.children[0].isFixed()?(a=this.constructor.createDiv(),a.innerHTML=t.regions[r],o.push(a.firstElementChild),s.domElement().parentNode.replaceChild(a.firstElementChild,s.domElement())):(o.push(s.domElement()),s.domElement().innerHTML=t.regions[r]):(s.domElement().remove(),delete this._regions[r])}if(this._domRegions=o,n){ContentEdit.Root.get().focused()&&ContentEdit.Root.get().focused().blur(),this._regions={},this.syncRegions(null,!0),ContentEdit.Root.get()._modified=t.rootModified,x=this._regions;for(r in x)s=x[r],t.regionModifieds[r]&&(s._modified=t.regionModifieds[r]);return this.history.replaceRegions(this._regions),this.history.restoreSelection(t),this._inspector.updateTags()}},e.prototype.save=function(t){var n,i,o,r,s,a,h,_,f,T,x,M;if(this.dispatchEvent(this.createEvent("save",{passive:t}))){if(h=ContentEdit.Root.get(),h.focused()&&!t&&h.focused().blur(),h.lastModified()===this._rootLastModified&&t)return void this.dispatchEvent(this.createEvent("saved",{regions:{},passive:t}));i=[],r={},x=this._regions;for(s in x){if(a=x[s],o=a.html(),a.children.length===1&&!a.type()==="Fixture"&&(n=a.children[0],n.content&&!n.content.html()&&(o="")),!t){for(M=a.children,f=0,T=M.length;f<T;f++)n=M[f],n.unmount();a.children.length===1&&a.children[0].isFixed()?(_=this.constructor.createDiv(),_.innerHTML=o,i.push(_.firstElementChild),a.domElement().parentNode.replaceChild(_.firstElementChild,a.domElement())):(i.push(a.domElement()),a.domElement().innerHTML=o)}a.lastModified()!==this._regionsLastModified[s]&&(r[s]=o,this._regionsLastModified[s]=a.lastModified())}return this._domRegions=i,this.dispatchEvent(this.createEvent("saved",{regions:r,passive:t}))}},e.prototype.setRegionOrder=function(t){return this._orderedRegions=t.slice()},e.prototype.start=function(){if(this.dispatchEvent(this.createEvent("start")))return this.busy(!0),this.syncRegions(),this._initRegions(),this._preventEmptyRegions(),this._rootLastModified=ContentEdit.Root.get().lastModified(),this.history=new m.History(this._regions),this.history.watch(),this._state="editing",this._toolbox.show(),this._inspector.show(),this.busy(!1),this.dispatchEvent(this.createEvent("started"))},e.prototype.stop=function(t){var n;if(this.dispatchEvent(this.createEvent("stop",{save:t}))){if(n=ContentEdit.Root.get().focused(),n&&n.isMounted()&&n._syncContent!==void 0&&n._syncContent(),t)this.save();else if(!this.revert())return;return this.history.stopWatching(),this.history=null,this._toolbox.hide(),this._inspector.hide(),this._regions={},this._state="ready",ContentEdit.Root.get().focused()&&this._allowEmptyRegions((function(i){return function(){return ContentEdit.Root.get().focused().blur()}})()),this.dispatchEvent(this.createEvent("stopped"))}},e.prototype.syncRegions=function(t,n){if(t&&(this._regionQuery=t),this._domRegions=[],this._regionQuery&&(typeof this._regionQuery=="string"||this._regionQuery instanceof String?this._domRegions=document.querySelectorAll(this._regionQuery):this._domRegions=this._regionQuery),this._state==="editing"&&(this._initRegions(n),this._preventEmptyRegions()),this._ignition)return this._domRegions.length?this._ignition.show():this._ignition.hide()},e.prototype._addDOMEventListeners=function(){return this._handleHighlightOn=(function(t){return function(n){var i;return(i=n.keyCode)!==17&&i!==224&&i!==91&&i!==93||(t._ctrlDown=!0),n.keyCode===16&&!t._ctrlDown?t._highlightTimeout?void 0:(t._shiftDown=!0,void(t._highlightTimeout=setTimeout(function(){return t.highlightRegions(!0)},m.HIGHLIGHT_HOLD_DURATION))):(clearTimeout(t._highlightTimeout),t.highlightRegions(!1))}})(this),this._handleHighlightOff=(function(t){return function(n){var i;return(i=n.keyCode)===17||i===224||i===91||i===93?void(t._ctrlDown=!1):n.keyCode===16?(t._shiftDown=!1,t._highlightTimeout&&(clearTimeout(t._highlightTimeout),t._highlightTimeout=null),t.highlightRegions(!1)):void 0}})(this),this._handleVisibility=(function(t){return function(n){if(!document.hasFocus())return clearTimeout(t._highlightTimeout),t.highlightRegions(!1)}})(this),document.addEventListener("keydown",this._handleHighlightOn),document.addEventListener("keyup",this._handleHighlightOff),document.addEventListener("visibilitychange",this._handleVisibility),this._handleBeforeUnload=(function(t){return function(n){var i;if(t._state==="editing"&&m.CANCEL_MESSAGE&&t.history&&t.history._snapshotIndex)return i=ContentEdit._(m.CANCEL_MESSAGE),(n||window.event).returnValue=i,i}})(this),window.addEventListener("beforeunload",this._handleBeforeUnload),this._handleUnload=(function(t){return function(n){return t.destroy()}})(this),window.addEventListener("unload",this._handleUnload)},e.prototype._allowEmptyRegions=function(t){return this._emptyRegionsAllowed=!0,t(),this._emptyRegionsAllowed=!1},e.prototype._preventEmptyRegions=function(){var t,n,i,o,r,s,a,h,_,f,T;if(!this._emptyRegionsAllowed){_=this._regions,T=[];for(o in _){for(s=_[o],i=s.lastModified(),n=!1,f=s.children,a=0,h=f.length;a<h;a++)if(t=f[a],t.type()!=="Static"){n=!0;break}n||(r=this.createPlaceholderElement(s),s.attach(r),T.push(s._modified=i))}return T}},e.prototype._removeDOMEventListeners=function(){return document.removeEventListener("keydown",this._handleHighlightOn),document.removeEventListener("keyup",this._handleHighlightOff),window.removeEventListener("beforeunload",this._handleBeforeUnload),window.removeEventListener("unload",this._handleUnload)},e.prototype._initRegions=function(t){var n,i,o,r,s,a,h,_,f,T,x;for(t==null&&(t=!1),o={},i=[],this._orderedRegions=[],f=this._domRegions,r=h=0,_=f.length;h<_;r=++h)n=f[r],a=n.getAttribute(this._namingProp),a||(a=r),o[a]=!0,this._orderedRegions.push(a),this._regions[a]&&this._regions[a].domElement()===n||(this._fixtureTest(n)?this._regions[a]=new ContentEdit.Fixture(n):this._regions[a]=new ContentEdit.Region(n),i.push(this._regions[a].domElement()),t||(this._regionsLastModified[a]=this._regions[a].lastModified()));this._domRegions=i,T=this._regions,x=[];for(a in T)T[a],o[a]||(delete this._regions[a],delete this._regionsLastModified[a],s=this._orderedRegions.indexOf(a),s>-1?x.push(this._orderedRegions.splice(s,1)):x.push(void 0));return x},e})(m.ComponentUI),m.EditorApp=(function(){function l(){}var e;return e=null,l.get=function(){var t;return t=m.EditorApp.getCls(),e??(e=new t)},l.getCls=function(){return y},l})(),m.History=(function(){function l(e){this._lastSnapshotTaken=null,this._regions={},this.replaceRegions(e),this._snapshotIndex=-1,this._snapshots=[],this._store()}return l.prototype.canRedo=function(){return this._snapshotIndex<this._snapshots.length-1},l.prototype.canUndo=function(){return this._snapshotIndex>0},l.prototype.index=function(){return this._snapshotIndex},l.prototype.length=function(){return this._snapshots.length},l.prototype.snapshot=function(){return this._snapshots[this._snapshotIndex]},l.prototype.goTo=function(e){return this._snapshotIndex=Math.min(this._snapshots.length-1,Math.max(0,e)),this.snapshot()},l.prototype.redo=function(){return this.goTo(this._snapshotIndex+1)},l.prototype.replaceRegions=function(e){var t,n,i;this._regions={},i=[];for(t in e)n=e[t],i.push(this._regions[t]=n);return i},l.prototype.restoreSelection=function(e){var t,n;if(e.selected)return n=this._regions[e.selected.region],t=n.descendants()[e.selected.element],t.focu
25s(),t.selection&&e.selected.selection?t.selection(e.selected.selection):void 0},l.prototype.stopWatching=function(){if(this._watchInterval&&clearInterval(this._watchInterval),this._delayedStoreTimeout)return clearTimeout(this._delayedStoreTimeout)},l.prototype.undo=function(){return this.goTo(this._snapshotIndex-1)},l.prototype.watch=function(){var e;return this._lastSnapshotTaken=Date.now(),e=(function(t){return function(){var n,i;if((i=ContentEdit.Root.get().lastModified())!==null&&i>t._lastSnapshotTaken)return t._delayedStoreRequested===i?void 0:(t._delayedStoreTimeout&&clearTimeout(t._delayedStoreTimeout),n=function(){return t._lastSnapshotTaken=i,t._store()},t._delayedStoreRequested=i,t._delayedStoreTimeout=setTimeout(n,500))}})(this),this._watchInterval=setInterval(e,50)},l.prototype._store=function(){var e,t,n,i,o,r,s;o={regions:{},regionModifieds:{},rootModified:ContentEdit.Root.get().lastModified(),selected:null},r=this._regions;for(t in r)i=r[t],o.regions[t]=i.html(),o.regionModifieds[t]=i.lastModified();if(e=ContentEdit.Root.get().focused()){if(o.selected={},!(i=e.closest(function(a){return a.type()==="Region"||a.type()==="Fixture"})))return;s=this._regions;for(t in s)if(n=s[t],i===n){o.selected.region=t;break}o.selected.element=i.descendants().indexOf(e),e.selection&&(o.selected.selection=e.selection())}return this._snapshotIndex<this._snapshots.length-1&&(this._snapshots=this._snapshots.slice(0,this._snapshotIndex+1)),this._snapshotIndex++,this._snapshots.splice(this._snapshotIndex,0,o)},l})(),m.StylePalette=(function(){function l(){}return l._styles=[],l.add=function(e){return this._styles=this._styles.concat(e)},l.styles=function(e){var t;return e===void 0?this._styles.slice():(t=e.tagName(),this._styles.filter(function(n){return!n._applicableTo||n._applicableTo.indexOf(t)!==-1}))},l})(),m.Style=(function(){function l(e,t,n){this._name=e,this._cssClass=t,this._applicableTo=n||null}return l.prototype.applicableTo=function(){return this._applicableTo},l.prototype.cssClass=function(){return this._cssClass},l.prototype.name=function(){return this._name},l})(),m.ToolShelf=(function(){function l(){}return l._tools={},l.stow=function(e,t){return this._tools[t]=e},l.fetch=function(e){if(!this._tools[e])throw new Error("`"+e+"` has not been stowed on the tool shelf");return this._tools[e]},l})(),m.Tool=(function(){function l(){}return l.label="Tool",l.icon="tool",l.requiresElement=!0,l.canApply=function(e,t){return!1},l.isApplied=function(e,t){return!1},l.apply=function(e,t,n){throw new Error("Not implemented")},l.editor=function(){return m.EditorApp.get()},l.dispatchEditorEvent=function(e,t){return this.editor().dispatchEvent(this.editor().createEvent(e,t))},l._insertAt=function(e){var t,n;return n=e,n.parent().type()!=="Region"&&(n=e.closest(function(i){return i.parent().type()==="Region"})),t=n.parent().children.indexOf(n)+1,[n,t]},l})(),m.Tools.Bold=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"bold"),e.label="Bold",e.icon="bold",e.tagName="b",e.canApply=function(t,n){return!!t.content&&n&&!n.isCollapsed()},e.isApplied=function(t,n){var i,o,r;return!(t.content===void 0||!t.content.length())&&(r=n.get(),i=r[0],o=r[1],i===o&&(o+=1),t.content.slice(i,o).hasTags(this.tagName,!0))},e.apply=function(t,n,i){var o,r,s,a;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s))return t.storeState(),a=n.get(),o=a[0],r=a[1],this.isApplied(t,n)?t.content=t.content.unformat(o,r,new HTMLString.Tag(this.tagName)):t.content=t.content.format(o,r,new HTMLString.Tag(this.tagName)),t.content.optimize(),t.updateInnerHTML(),t.taint(),t.restoreState(),i(!0),this.dispatchEditorEvent("tool-applied",s)},e})(m.Tool),m.Tools.Italic=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"italic"),e.label="Italic",e.icon="italic",e.tagName="i",e})(m.Tools.Bold),m.Tools.Link=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"link"),e.label="Link",e.icon="link",e.tagName="a",e.getAttr=function(t,n,i){var o,r,s,a,h,_,f,T,x,M,A,R;if(n.type()==="Image"){if(n.a)return n.a[t]}else{if(n.isFixed()&&n.tagName()==="a")return n.attr(t);for(M=i.get(),r=M[0],h=M[1],s=n.content.slice(r,h),A=s.characters,_=0,T=A.length;_<T;_++)if(o=A[_],o.hasTags("a")){for(R=o.tags(),f=0,x=R.length;f<x;f++)if(a=R[f],a.name()==="a")return a.attr(t)}}return""},e.canApply=function(t,n){var i;return t.type()==="Image"||!(!t.isFixed()||t.tagName()!=="a")||!!t.content&&!!n&&!!(!n.isCollapsed()||(i=t.content.characters[n.get()[0]])&&i.hasTags("a"))}
25,e.isApplied=function(t,n){return t.type()==="Image"?t.a:!(!t.isFixed()||t.tagName()!=="a")||e.__super__.constructor.isApplied.call(this,t,n)},e.apply=function(t,n,i){var o,r,s,a,h,_,f,T,x,M,A,R,U,H,b,d,u,g;if(d={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",d)){if(r=!1,t.type()==="Image")M=t.domElement().getBoundingClientRect();else if(t.isFixed()&&t.tagName()==="a")M=t.domElement().getBoundingClientRect();else{if(n.isCollapsed()){for(s=t.content.characters,H=n.get(0)[0],_=H;H>0&&s[H-1].hasTags("a");)H-=1;for(;_<s.length&&s[_].hasTags("a");)_+=1;n=new ContentSelect.Range(H,_),n.select(t.domElement())}t.storeState(),U=new HTMLString.Tag("span",{class:"ct--pseudo-select"}),u=n.get(),f=u[0],b=u[1],t.content=t.content.format(f,b,U),t.updateInnerHTML(),h=t.domElement(),T=h.getElementsByClassName("ct--pseudo-select"),M=T[0].getBoundingClientRect()}return o=m.EditorApp.get(),x=new m.ModalUI(!0,!0),x.addEventListener("click",function(){if(this.unmount(),a.hide(),t.content&&(t.content=t.content.unformat(f,b,U),t.updateInnerHTML(),t.restoreState()),i(r),r)return m.Tools.Link.dispatchEditorEvent("tool-applied",d)}),a=new m.LinkDialog(this.getAttr("href",t,n),this.getAttr("target",t,n)),g=m.getScrollPosition(),A=g[0],R=g[1],a.position([M.left+M.width/2+A,M.top+M.height/2+R]),a.addEventListener("save",function(E){var C,I,D,N,O,F,P,j,V,B,Q,Z,J,it,ot,at;if(N=E.detail(),r=!0,t.type()==="Image"){if(I=["align-center","align-left","align-right"],N.href){for(t.a={href:N.href},N.target&&(t.a.target=N.target),V=0,J=I.length;V<J;V++)if(D=I[V],t.hasCSSClass(D)){t.removeCSSClass(D),t.a.class=D;break}}else{for(P=[],t.a.class&&(P=t.a.class.split(" ")),B=0,it=I.length;B<it;B++)if(D=I[B],P.indexOf(D)>-1){t.addCSSClass(D);break}t.a=null}t.unmount(),t.mount()}else if(t.isFixed()&&t.tagName()==="a")t.attr("href",N.href);else{for(O=null,F=Q=f;f<=b?Q<b:Q>b;F=f<=b?++Q:--Q){for(at=t.content.characters[F].tags(),Z=0,ot=at.length;Z<ot;Z++)if(j=at[Z],j.name()==="a"){O=j;break}if(O)break}t.content=t.content.unformat(f,b,"a"),N.href&&(C=O?O.copy():new HTMLString.Tag("a"),C.attr("href",N.href),N.target?C.attr("target",N.target):C.removeAttr("target"),console.log(C),t.content=t.content.format(f,b,C),t.content.optimize()),t.updateInnerHTML()}return t.taint(),x.dispatchEvent(x.createEvent("click"))}),o.attach(x),o.attach(a),x.show(),a.show()}},e})(m.Tools.Bold),m.Tools.Heading=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"heading"),e.label="Heading",e.icon="heading",e.tagName="h1",e.canApply=function(t,n){return!t.isFixed()&&t.content!==void 0&&["Text","PreText"].indexOf(t.type())!==-1},e.isApplied=function(t,n){return!!t.content&&["Text","PreText"].indexOf(t.type())!==-1&&t.tagName()===this.tagName},e.apply=function(t,n,i){var o,r,s,a,h;if(h={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",h))return t.storeState(),t.type()==="PreText"?(o=t.content.html().replace(/ /g," "),a=new ContentEdit.Text(this.tagName,{},o),s=t.parent(),r=s.children.indexOf(t),s.detach(t),s.attach(a,r),t.blur(),a.focus(),a.selection(n)):(t.removeAttr("class"),t.tagName()===this.tagName?t.tagName("p"):t.tagName(this.tagName),t.restoreState()),this.dispatchEditorEvent("tool-applied",h),i(!0)},e})(m.Tool),m.Tools.Subheading=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"subheading"),e.label="Subheading",e.icon="subheading",e.tagName="h2",e})(m.Tools.Heading),m.Tools.Paragraph=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"paragraph"),e.label="Paragraph",e.icon="paragraph",e.tagName="p",e.canApply=function(t,n){return!t.isFixed()&&t!==void 0},e.apply=function(t,n,i){var o,r,s,a;return o=this.editor().ctrlDown(),m.Tools.Heading.canApply(t)&&!o?e.__super__.constructor.apply.call(this,t,n,i):(a={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",a)?(t.parent().type()!=="Region"&&(t=t.closest(function(h){return h.parent().type()==="Region"})),s=t.parent(),r=new ContentEdit.Text("p"),s.attach(r,s.children.indexOf(t)+1),r.focus(),i(!0),this.dispatchEditorEvent("tool-applied",a)):void 0)},e})(m.Tools.Heading),m.Tools.Preformatted=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"preformatted"),e.label="Preformatted",e.icon="preformatted",e.tagName="pre",e.apply=function(t,n,i){var o,r,s,a,h;if(h={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",h))return t.type()==="PreText"?void m.Tools.Paragraph.apply(t,n,i):(a=t.content.text(),s=new ContentEdit.PreText("pre",{},HTMLString.String.encode(a)),r=t.parent(),o=r.children.indexOf(t),r.detach(t),r.attach(s,o),t.blur(),s.focus(),s.selection(n),i(!0),this.dispatchEditorEvent("tool-applied",h))},e})(m.Tools.Heading),m.Tools.AlignLeft=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"align-left"),e.label="Align left",e.icon="align-left",e.className="text-left",e.canApply=function(t,n){return t.content!==void 0},e.isApplied=function(t,n){var i;return!!this.canApply(t)&&((i=t.type())!=="ListItemText"&&i!=="TableCellText"||(t=t.parent()),t.hasCSSClass(this.className))},e.apply=function(t,n,i){var o,r,s,a,h,_;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s)){for((_=t.type())!=="ListItemText"&&_!=="TableCellText"||(t=t.parent()),o=[m.Tools.AlignLeft.className,m.Tools.AlignCenter.className,m.Tools.AlignRight.className],a=0,h=o.length;a<h;a++)if(r=o[a],t.hasCSSClass(r)&&(t.removeCSSClass(r),r===this.className))return i(!0);return t.addCSSClass(this.className),i(!0),this.dispatchEditorEvent("tool-applied",s)}},e})(m.Tool),m.Tools.AlignCenter=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"align-center"),e.label="Align center",e.icon="align-center",e.className="text-center",e})(m.Tools.AlignLeft),m.Tools.AlignRight=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"align-right"),e.label="Align right",e.icon="align-right",e.className="text-right",e})(m.Tools.AlignLeft),m.Tools.UnorderedList=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"unordered-list"),e.label="Bullet list",e.icon="unordered-list",e.listTag="ul",e.canApply=function(t,n){var i;return!t.isFixed()&&t.content!==void 0&&((i=t.parent().type())==="Region"||i==="ListItem")},e.apply=function(t,n,i){var o,r,s,a,h,_;if(_={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",_))return t.parent().type()==="ListItem"?(t.storeState(),r=t.closest(function(f){return f.type()==="List"}),r.tagName(this.listTag),t.restoreState()):(a=new ContentEdit.ListItemText(t.content.copy()),s=new ContentEdit.ListItem,s.attach(a),r=new ContentEdit.List(this.listTag,{}),r.attach(s),h=t.parent(),o=h.children.indexOf(t),h.detach(t),h.attach(r,o),a.focus(),a.selection(n)),i(!0),this.dispatchEditorEvent("tool-applied",_)},e})(m.Tool),m.Tools.OrderedList=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"ordered-list"),e.label="Numbers list",e.icon="ordered-list",e.listTag="ol",e})(m.Tools.UnorderedList),m.Tools.Table=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"table"),e.label="Table",e.icon="table",e.canApply=function(t,n){return!t.isFixed()&&t!==void 0},e.apply=function(t,n,i){var o,r,s,a,h;if(h={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",h))return t.storeState&&t.storeState(),o=m.EditorApp.get(),s=new m.ModalUI,a=t.closest(function(_){return _&&_.type()==="Table"}),r=new m.TableDialog(a),r.addEventListener("cancel",(function(_){return function(){return s.hide(),r.hide(),t.restoreState&&t.restoreState(),i(!1)}})()),r.addEventListener("save",(function(_){return function(f){var T,x,M,A,R;return A=f.detail(),x=!0,a?(_._updateTable(A,a),x=t.closest(function(U){return U&&U.type()==="Table"})):(a=_._createTable(A),R=_._insertAt(t),M=R[0],T=R[1],M.parent().attach(a,T),x=!1),x?t.restoreState():a.firstSection().children[0].children[0].children[0].focus(),s.hide(),r.hide(),i(!0),_.dispatchEditorEvent("tool-applied",h)}})(this)),o.attach(s),o.attach(r),s.show(),r.show()},e._adjustColumns=function(t,n){var i,o,r,s,a,h,_,f,T,x,M;for(x=t.children,M=[],f=0,T=x.length;f<T;f++)_=x[f],o=_.children[0].tagName(),s=_.children.length,a=n-s,a<0?M.push((function(){var A,R;for(R=[],h=A=a;a<=0?A<0:A>0;h=a<=0?++A:--A)i=_.children[_.children.length-1],R.push(_.detach(i));return R})()):a>0?M.push((function(){var A,R;for(R=[],h=A=0;0<=a?A<a:A>a;h=0<=a?++A:--A)i=new ContentEdit.TableCell(o),_.attach(i),r=new ContentEdit.TableCellText(""),R.push(i.attach(r));return R})()):M.push(void 0);return M},e._createTable=function(t){var n,i,o,r;return r=new ContentEdit.Table,t.head&&(o=this._createTableSection("thead","th",t.columns),r.attach(o)),n=this._createTableSection("tbody","td",t.columns),r.attach(n),t.foot&&(i=this._createTableSection("tfoot","td",t.columns),r.attach(i)),r},e._createTableSection=function(t,n,i){var o,r,s,a,h;for(a=new ContentEdit.TableSection(t),s=new ContentEdit.TableRow,a.attach(s),h=0;0<=i?h<i:h>i;0<=i?++h:--h)o=new ContentEdit.TableCell(n),s.attach(o),r=new ContentEdit.TableCellText(""),o.attach(r);return a},e._updateTable=function(t,n){var i,o,r,s,a,h,_;if(!t.head&&n.thead()&&n.detach(n.thead()),!t.foot&&n.tfoot()&&n.detach(n.tfoot()),i=n.firstSection().children[0].children.length,t.columns!==i)for(_=n.children,a=0,h=_.length;a<h;a++)s=_[a],this._adjustColumns(s,t.columns);if(t.head&&!n.thead()&&(r=this._createTableSection("thead","th",t.columns),n.attach(r,0)),t.foot&&!n.tfoot())return o=this._createTableSection("tfoot","td",t.columns),n.attach(o)},e})(m.Tool),m.Tools.Indent=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"indent"),e.label="Indent",e.icon="indent",e.canApply=function(t,n){return t.parent().type()==="ListItem"&&t.parent().parent().children.indexOf(t.parent())>0},e.apply=function(t,n,i){var o;if(o={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",o))return t.parent().indent(),i(!0),this.dispatchEditorEvent("tool-applied",o)},e})(m.Tool),m.Tools.Unindent=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"unindent"),e.label="Unindent",e.icon="unindent",e.canApply=function(t,n){return t.parent().type()==="ListItem"},e.apply=function(t,n,i){var o;if(o={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",o))return t.parent().unindent(),i(!0),this.dispatchEditorEvent("tool-applied",o)},e})(m.Tool),m.Tools.LineBreak=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"line-break"),e.label="Line break",e.icon="line-break",e.canApply=function(t,n){return t.content},e.apply=function(t,n,i){var o,r,s,a,h;if(h={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",h))return r=n.get()[0]+1,a=t.content.substring(0,n.get()[0]),s=t.content.substring(n.get()[1]),o=new HTMLString.String("<br>",t.content.preserveWhitespace()),t.content=a.concat(o,s),t.updateInnerHTML(),t.taint(),n.set(r,r),t.selection(n),i(!0),this.dispatchEditorEvent("tool-applied",h)},e})(m.Tool),m.Tools.Image=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"image"),e.label="Image",e.icon="image",e.canApply=function(t,n){return!t.isFixed()||t.type()==="ImageFixture"}
25,e.apply=function(t,n,i){var o,r,s,a;if(a={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",a))return t.storeState&&t.storeState(),o=m.EditorApp.get(),s=new m.ModalUI,r=new m.ImageDialog,r.addEventListener("cancel",(function(h){return function(){return s.hide(),r.hide(),t.restoreState&&t.restoreState(),i(!1)}})()),r.addEventListener("save",(function(h){return function(_){var f,T,x,M,A,R,U,H;return f=_.detail(),A=f.imageURL,M=f.imageSize,x=f.imageAttrs,x||(x={}),x.height=M[1],x.src=A,x.width=M[0],t.type()==="ImageFixture"?t.src(A):(T=new ContentEdit.Image(x),H=h._insertAt(t),U=H[0],R=H[1],U.parent().attach(T,R),T.focus()),s.hide(),r.hide(),i(!0),h.dispatchEditorEvent("tool-applied",a)}})(this)),o.attach(s),o.attach(r),s.show(),r.show()},e})(m.Tool),m.Tools.Video=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"video"),e.label="Video",e.icon="video",e.canApply=function(t,n){return!t.isFixed()},e.apply=function(t,n,i){var o,r,s,a;if(a={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",a))return t.storeState&&t.storeState(),o=m.EditorApp.get(),s=new m.ModalUI,r=new m.VideoDialog,r.addEventListener("cancel",(function(h){return function(){return s.hide(),r.hide(),t.restoreState&&t.restoreState(),i(!1)}})()),r.addEventListener("save",(function(h){return function(_){var f,T,x,M,A,R;if(M=_.detail().url,M?(A=new ContentEdit.Video("iframe",{frameborder:0,height:m.DEFAULT_VIDEO_HEIGHT,src:M,width:m.DEFAULT_VIDEO_WIDTH}),R=h._insertAt(t),x=R[0],T=R[1],x.parent().attach(A,T),A.focus()):t.restoreState&&t.restoreState(),s.hide(),r.hide(),f=M!=="",i(f),f)return h.dispatchEditorEvent("tool-applied",a)}})(this)),o.attach(s),o.attach(r),s.show(),r.show()},e})(m.Tool),m.Tools.Undo=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"undo"),e.label="Undo",e.icon="undo",e.requiresElement=!1,e.canApply=function(t,n){var i;return i=m.EditorApp.get(),i.history&&i.history.canUndo()},e.apply=function(t,n,i){var o,r,s;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s))return o=this.editor(),o.history.stopWatching(),r=o.history.undo(),o.revertToSnapshot(r),o.history.watch(),this.dispatchEditorEvent("tool-applied",s)},e})(m.Tool),m.Tools.Redo=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"redo"),e.label="Redo",e.icon="redo",e.requiresElement=!1,e.canApply=function(t,n){var i;return i=m.EditorApp.get(),i.history&&i.history.canRedo()},e.apply=function(t,n,i){var o,r,s;if(s={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",s))return o=m.EditorApp.get(),o.history.stopWatching(),r=o.history.redo(),o.revertToSnapshot(r),o.history.watch(),this.dispatchEditorEvent("tool-applied",s)},e})(m.Tool),m.Tools.Remove=(function(l){function e(){return e.__super__.constructor.apply(this,arguments)}return S(e,l),m.ToolShelf.stow(e,"remove"),e.label="Remove",e.icon="remove",e.canApply=function(t,n){return!t.isFixed()},e.apply=function(t,n,i){var o,r,s,a,h;if(h={tool:this,element:t,selection:n},this.dispatchEditorEvent("tool-apply",h)){if(o=this.editor(),t.blur(),t.nextContent()?t.nextContent().focus():t.previousContent()&&t.previousContent().focus(),!t.isMounted())return i(!0),void this.dispatchEditorEvent("tool-applied",h);switch(t.type()){case"ListItemText":o.ctrlDown()?(r=t.closest(function(_){return _.parent().type()==="Region"}),r.parent().detach(r)):t.parent().parent().detach(t.parent());break;case"TableCellText":o.ctrlDown()?(a=t.closest(function(_){return _.type()==="Table"}),a.parent().detach(a)):(s=t.parent().parent(),s.parent().detach(s));break;default:t.parent().detach(t)}return i(!0),this.dispatchEditorEvent("tool-applied",h)}},e})(m.Tool)}.call(Lt)});z();z();z();var Pn=["Cropping"],Fn=()=>({autoCrop:!1,fill:"#FFF",extraZoomOut:!0});function Bn(c,m){c&1&&(K(0,"div",8)(1,"p",13),tt(2,"images.text-2"),q()())}function jn(c,m){c&1&&vt(0,"td-loader")}function zn(c,m){if(c&1){let p=ht();K(0,"div",9)(1,"div",14)(2,"em",15),rt("click",function(){X(p),$();let y=Nt(8);return Y(y.zoomOut())}),q(),K(3,"em",16),rt("click",function(){X(p),$();let y=Nt(8);return Y(y.zoomIn())}),q()(),K(4,"div",17)(5,"em",18),rt("click",function(){X(p),$();let y=Nt(8);return Y(y.clean())}),q()()()}}var Sn=(()=>{class c{constructor(p,v,y){this._dialogRef=y,this.scale=.2;let L=v.isMatched([ye.XSmall,ye.HandsetPortrait]);this.title=p&&p.title?p.title:"images.text-1",this.width=p&&p.width?p.width:L?window.innerWidth*.67:600,this.height=p&&p.height?p.height:L?250:337.5}close(p){this._dialogRef.close(p)}submit(){this.cropAndClose=!0,this.cropping.crop()}onCropped(p){this.cropAndClose&&this.close(p.dataURL)}onError(p){console.log(p)}static{this.\u0275fac=function(v){return new(v||c)(W(gn),W(en),W(_n))}}static{this.\u0275cmp=gt({type:c,selectors:[["ng-component"]],viewQuery:function(v,y){if(v&1&&Bt(Pn,5),v&2){let L;jt(L=zt())&&(y.cropping=L.first)}},standalone:!1,decls:17,vars:9,consts:[["Cropping","tdImageCropper"],[1,"container","mx-auto","h-full","flex","flex-col","justify-between","bg-white","rounded-lg"],[1,"flex","justify-between","items-center","px-3","md:px-4","pb-2","text-blue-grey","border-b","pt-4"],["l10nTranslate","",1,"text-xl"],[1,"ai","ai-close","text-xl","cursor-pointer",3,"click"],[1,"mt-3"],[1,"td-image-dialog-cropper-container","relative","mx-auto","mb-3"],["type","image/jpeg",1,"td-image-dialog-cropper","block","overflow-hidden","rounded",3,"scaleChange","cropped","loaded","error","width","height","config","scale"],[1,"w-full","h-full","border","border-dashed","border-cyan","flex","justify-center","items-center","rounded","border-2"],[1,"td-image-dialog-cropper-options","absolute"],[1,"flex","flex-wrap","justify-center"],["l10nTranslate","",1,"btn","btn-flat-blue-black","btn-md","btn-100","mx-3","my-2",3,"click"],["l10nTranslate","",1,"btn","btn-contained-deep-purple","btn-md","btn-100","mx-3","my-2",3,"click","disabled"],["l10nTranslate","",1,"m-0","font-bold","text-blue-grey","text-center"],[1,"td-image-dialog-cropper-option","rounded","bg-white","flex","flex-col","p-1","mb-2"],[1,"ai","ai-square-minus","cursor-pointer","text-xl","text-blue-grey","mb-2",3,"click"],[1,"ai","ai-square-plus","cursor-pointer","text-xl","text-blue-grey",3,"click"],[1,"td-image-dialog-cropper-option","rounded","bg-white","flex","flex-col","p-1"],[1,"ai","ai-tras
25h","cursor-pointer","text-xl","text-blue-grey",3,"click"]],template:function(v,y){if(v&1){let L=ht();K(0,"div",1)(1,"div",2)(2,"h5",3),tt(3),q(),K(4,"em",4),rt("click",function(){return X(L),Y(y.close())}),q()(),K(5,"div",5)(6,"div",6)(7,"td-image-cropper",7,0),Pe("scaleChange",function(w){return X(L),Ue(y.scale,w)||(y.scale=w),Y(w)}),rt("cropped",function(w){return X(L),Y(y.onCropped(w))})("loaded",function(){return X(L),Y(y.loadImage=!0)})("error",function(w){return X(L),Y(y.onError(w))}),ct(9,Bn,3,0,"div",8)(10,jn,1,0,"td-loader"),q(),ct(11,zn,6,0,"div",9),q()(),K(12,"div",10)(13,"button",11),rt("click",function(){return X(L),Y(y.close())}),tt(14,"actions.cancel"),q(),K(15,"button",12),rt("click",function(){return X(L),Y(y.submit())}),tt(16,"actions.accept"),q()()()}if(v&2){let L=Nt(8);G(3),Et(y.title),G(4),ft("width",y.width)("height",y.height)("config",Be(8,Fn)),He("scale",y.scale),G(2),dt(y.loadImage?10:9),G(2),dt(L.isLoaded?11:-1),G(4),ft("disabled",!y.loadImage)}},dependencies:[$t,Yt,Cn],styles:[".td-image-dialog-cropper-container[_ngcontent-%COMP%], .td-image-dialog-cropper[_ngcontent-%COMP%]{max-width:560px;height:260px}@media(min-width:768px){.td-image-dialog-cropper-container[_ngcontent-%COMP%], .td-image-dialog-cropper[_ngcontent-%COMP%]{max-width:660px;height:360px}}.td-image-dialog-cropper-options[_ngcontent-%COMP%]{bottom:25px;right:30px}.td-image-dialog-cropper-option[_ngcontent-%COMP%]{background-color:#fffc;-webkit-box-shadow:0px 3px 6px 0px rgba(0,0,0,.16);-moz-box-shadow:0px 3px 6px 0px rgba(0,0,0,.16);box-shadow:0 3px 6px #00000029}"]})}}return c})();z();var xn=(()=>{class c{static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275mod=Ft({type:c})}static{this.\u0275inj=Pt({imports:[Wt,Jt,Kt,Qt,Tn]})}}return c})();z();z();z();z();var te=(()=>{class c{constructor(){this.id="td-image",this.label="Image",this.icon="image",this._dialog=st(Zt)}register(){ContentTools.ToolShelf.stow(this,this.id)}canApply(){return!0}apply(p,v,y){this._dialog.open(Sn,{width:"700px",height:"520px"}).afterClosed().subscribe(S=>{if(!S)y(!1);else{let w=new Image;w.onload=()=>{let k=w.naturalWidth,l=w.naturalHeight;w.setAttribute("width",`${k}`),w.setAttribute("height",`${l}`);let e=ContentEdit.Image.fromDOMElement(w),t=ContentTools.EditorApp.get().regions().region_2_body,n,i=t?t.children.length:0;if(p){for(let o=0;o<i;o++)if(t.children[o].domElement()===p.domElement()){n=o+1;break}}if(t.attach(e,n),typeof n>"u"||n===i){let o=new ContentEdit.Text("p");t.attach(o,typeof n=="number"?n+1:void 0),o.focus()}},w.src=S,y(!0)}})}isApplied(){}static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275prov=mt({token:c,factory:c.\u0275fac})}}return c})();z();z();function Wn(c,m){if(c&1){let p=ht();yt(0,"button",5),xt("mouseenter",function(){let y=X(p).$implicit,L=$().$implicit,S=$();return Y(S.hover(y,L))})("click",function(){let y=X(p).$implicit,L=$().$implicit,S=$();return Y(S.picked.emit({columns:y,rows:L}))}),pt()}if(c&2){let p=m.$implicit,v=$().$implicit,y=$();Vt("is-active",p<=y.columns()&&v<=y.rows())}}function Gn(c,m){if(c&1&&At(0,Wn,1,2,"button",4,fe),c&2){let p=$();Rt(p.range)}}function qn(c,m){if(c&1){let p=ht();yt(0,"button",6),xt("click",function(){X(p);let y=$();return Y(y.deleted.emit())}),Ne(1,"em",7),pt()}}var wn=(()=>{class c{constructor(){this.canDelete=!1,this.picked=new _t,this.deleted=new _t,this.range=[1,2,3,4,5,6,7,8],this.columns=_e(1),this.rows=_e(1)}hover(p,v){this.columns.set(p),this.rows.set(v)}static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275cmp=gt({type:c,selectors:[["td-table-grid"]],inputs:{canDelete:"canDelete"},outputs:{picked:"picked",deleted:"deleted"},decls:7,vars:3,consts:[[1,"td-table-grid"],[1,"td-table-grid__cells",3,"mouseleave"],[1,"td-table-grid__label"],["type","button",1,"td-table-grid__delete"],["type","button",1,"td-table-grid__cell",3,"is-active"],["type","button",1,"td-table-grid__cell",3,"mouseenter","click"],["type","button",1,"td-table-grid__delete",3,"click"],[1,"ai","ai-trash"]],template:function(v,y){v&1&&(yt(0,"div",0)(1,"div",1),xt("mouseleave",function(){return y.hover(1,1)}),At(2,Gn,2,0,null,null,fe),pt(),yt(4,"div",2),tt(5),pt(),ct(6,qn,2,0,"button",3),pt()),v&2&&(G(2),Rt(y.range),G(3),Oe("",y.columns()," x ",y.rows()),G(),dt(y.canDelete?6:-1))},styles:[".td-table-grid[_ngcontent-%COMP%]{padding:12px}.td-table-grid__cells[_ngcontent-%COMP%]{display:grid;grid-template-columns:repeat(8,18px);gap:4px}.td-table-grid__cell[_ngcontent-%COMP%]{width:18px;height:18px;padding:0;border-radius:3px;border:1px solid #E3E8EA;background:#f5f7f8;cursor:pointer}.td-table-grid__cell.is-active[_ngcontent-%COMP%]{border-color:#5f5afa;background:#e4e3fe}.td-table-grid__label[_ngcontent-%COMP%]{margin-top:8px;text-align:center;color:#0f3e4d}
25.td-table-grid__delete[_ngcontent-%COMP%]{display:flex;align-items:center;justify-content:center;width:100%;margin-top:8px;padding:6px;border-radius:3px;border-top:1px solid #E3E8EA;color:#0f3e4d;cursor:pointer}.td-table-grid__delete[_ngcontent-%COMP%]:hover{color:#e53935;background:#fdecea}"],changeDetection:0})}}return c})();z();function ee(c,m,p,v){let y=document.querySelector(`.ct-toolbox .ct-tool--${m}`),L=c.create({hasBackdrop:!0,backdropClass:"cdk-overlay-transparent-backdrop",panelClass:"td-tool-popover",positionStrategy:c.position().flexibleConnectedTo(y).withPositions([{originX:"end",originY:"top",overlayX:"start",overlayY:"top",offsetX:8},{originX:"start",originY:"top",overlayX:"end",overlayY:"top",offsetX:-8}]),scrollStrategy:c.scrollStrategies.reposition()}),S=!1,w=k=>{S||(S=!0,L.dispose(),v(k))};return L.backdropClick().subscribe(()=>w(!1)),L.keydownEvents().pipe(xe(k=>k.key==="Escape")).subscribe(()=>w(!1)),{picker:L.attach(new dn(p)),close:w}}var ne=(()=>{class c{constructor(){this.id="td-table",this.label="Table",this.icon="table",this._overlay=st(Xt)}register(){ContentTools.ToolShelf.stow(this,this.id)}canApply(p){return p&&!p.isFixed()}isApplied(){return!1}apply(p,v,y){let{picker:L,close:S}=ee(this._overlay,this.icon,wn,y);L.instance.picked.subscribe(({columns:k,rows:l})=>{this._insertTable(p,k,l),S(!0)});let w=p.closest(k=>k&&k.type()==="Table");w&&(L.setInput("canDelete",!0),L.instance.deleted.subscribe(()=>{this._removeTable(p,w),S(!0)}))}_insertTable(p,v,y){let L=new ContentEdit.Table;y>1?(L.attach(this._createSection("thead","th",v,1)),L.attach(this._createSection("tbody","td",v,y-1))):L.attach(this._createSection("tbody","td",v,1));let[S,w]=ContentTools.Tools.Table._insertAt(p);S.parent().attach(L,w),L.firstSection().children[0].children[0].children[0].focus()}_removeTable(p,v){p.blur();let y=v.parent(),L=y.children.indexOf(v);y.detach(v);let S=y.children[L]||y.children[L-1];S&&S.content!==void 0&&S.focus()}_createSection(p,v,y,L){let S=new ContentEdit.TableSection(p);for(let w=0;w<L;w++){let k=new ContentEdit.TableRow;S.attach(k);for(let l=0;l<y;l++){let e=new ContentEdit.TableCell(v);k.attach(e),e.attach(new ContentEdit.TableCellText(""))}}return S}static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275prov=mt({token:c,factory:c.\u0275fac})}}return c})();z();z();z();var It=[{id:"key",emoji:"\u{1F4A1}"},{id:"tip",emoji:"\u2728"},{id:"warning",emoji:"\u26A0\uFE0F"},{id:"example",emoji:"\u{1F4DD}"}],ie={key:{es:"Idea clave",en:"Key idea",pt:"Ideia-chave",fr:"Id\xE9e cl\xE9",it:"Idea chiave",de:"Kernidee"},tip:{es:"Tip",en:"Tip",pt:"Dica",fr:"Astuce",it:"Consiglio",de:"Tipp"},warning:{es:"Cuidado",en:"Careful",pt:"Aten\xE7\xE3o",fr:"Attention",it:"Attenzione",de:"Achtung"},example:{es:"Ejemplo",en:"Example",pt:"Exemplo",fr:"Exemple",it:"Esempio",de:"Beispiel"}},In=new Set(Object.values(ie).flatMap(c=>Object.values(c)));var Kn=(c,m)=>m.id;function Xn(c,m){if(c&1){let p=ht();yt(0,"button",2),xt("click",function(){let y=X(p).$implicit,L=$();return Y(L.picked.emit(y.id))}),tt(1),pt()}if(c&2){let p=m.$implicit,v=$();ke(Fe("td-note-palette__swatch td-note-palette__swatch--",p.id)),Vt("is-active",p.id===v.current),G(),Et(p.emoji)}}var Mn=(()=>{class c{constructor(){this.current=null,this.picked=new _t,this.types=It}static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275cmp=gt({type:c,selectors:[["td-note-palette"]],inputs:{current:"current"},outputs:{picked:"picked"},decls:3,vars:0,consts:[[1,"td-note-palette"],["type","button",3,"class","is-active"],["type","button",3,"click"]],template:function(v,y){v&1&&(yt(0,"div",0),At(1,Xn,2,6,"button",1,Kn),pt()),v&2&&(G(),Rt(y.types))},styles:[".td-note-palette[_ngcontent-%COMP%]{display:flex;gap:6px;padding:8px}.td-note-palette__swatch[_ngcontent-%COMP%]{width:36px;height:36px;padding:0;font-size:18px;border-left:4px solid var(--note-accent);border-radius:0 8px 8px 0;background:var(--note-tint);cursor:pointer}.td-note-palette__swatch.is-active[_ngcontent-%COMP%]{outline:2px solid var(--note-accent);outline-offset:2px}.td-note-palette__swatch--key[_ngcontent-%COMP%]{--note-tint: #E4E3FE;--note-accent: #5F5AFA}.td-note-palette__swatch--tip[_ngcontent-%COMP%]{--note-tint: #DFF4FF;--note-accent: #00B5FF}.td-note-palette__swatch--warning[_ngcontent-%COMP%]{--note-tint: #FFF8DF;--note-accent: #FFCE0A}.td-note-palette__swatch--example[_ngcontent-%COMP%]{--note-tint: #DFF6E6;--note-accent: #00C82F}"],changeDetection:0})}}return c})();var Mt=(()=>{class c{constructor(){this.id="td-note",this.label="Note",this.icon="td-note",this._overlay=st(Xt)}register(){ContentTools.ToolShelf.stow(this,this.id)}canApply(p){return p&&!p.isFixed()}isApplied(p){return!!this._noteType(p)}apply(p,v,y){let{picker:L,close:S}=ee(this._overlay,this.icon,Mn,y),w=this._noteType(p);L.setInput("current",w),L.instance.picked.subscribe(k=>{w?this._retypeNote(p,k):this._insertNote(p,k),S(!0)})}
25_insertNote(p,v){let y=new ContentEdit.Text("blockquote",{class:`note--${v}`},new HTMLString.String(`${this._opening(v)} `,!0));if(p.type()==="Text"&&p.tagName()==="p"&&p.content.length()===0){let L=p.parent();L.attach(y,L.children.indexOf(p)),L.detach(p)}else{let[L,S]=ContentTools.Tools.Table._insertAt(p);L.parent().attach(y,S)}this._focusEnd(y)}_retypeNote(p,v){It.forEach(({id:S})=>p.removeCSSClass(`note--${S}`)),p.addCSSClass(`note--${v}`);let y=p.content.html(),L=y.match(/^\s*(?:\S+\s+)?<strong>([^<]*?):<\/strong>/);if(L&&In.has(L[1].trim())){let S=y.slice(L[0].length).replace(/^\s*/," ");p.content=new HTMLString.String(`${this._opening(v)}${S}`,!0),p.updateInnerHTML(),p.taint()}this._focusEnd(p)}_noteType(p){if(!p||p.type()!=="Text"||p.tagName()!=="blockquote")return null;let v=It.find(({id:y})=>p.hasCSSClass(`note--${y}`));return v?v.id:"key"}_opening(p){let v=It.find(({id:S})=>S===p).emoji,y=(this.language||"").slice(0,2).toLowerCase(),L=ie[p][y]||ie[p].es;return`${v} <strong>${L}:</strong>`}_focusEnd(p){let v=p.content.length();p.focus(),p.selection(new ContentSelect.Range(v,v))}static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275prov=mt({token:c,factory:c.\u0275fac})}}return c})();z();var oe="td-mark";function Dn(){let c=class extends ContentTools.Tools.Bold{};Object.assign(c,{label:"Highlight",icon:oe,tagName:"mark"}),ContentTools.ToolShelf.stow(c,oe);for(let m of[ContentTools.HTMLCleaner.DEFAULT_TAG_WHITELIST,ContentTools.INLINE_TAGS])m.includes("mark")||m.push("mark")}var re=(()=>{class c{set autosave(p){this._setAutoSave(p)}constructor(p,v,y,L,S,w,k){this._el=p,this._renderer=v,this._translate=y,this._imageTool=L,this._tableTool=S,this._noteTool=w,this._platform=k,this.saved=new _t,this.changed=new _t}ngAfterViewInit(){this._platform.isBrowser&&(this._init("*[data-editable]","data-name",p=>p.hasAttribute("data-fixture"),!1),this._setInitialContent(this.tdTextEditor),this._setTitleMaxLength())}ngOnDestroy(){this._stopAutoSave(),this.stop(!!this.autosave),this._translationSubs&&this._translationSubs.unsubscribe(),ContentEdit.Root.get().unbind("taint"),ContentEdit.Root.get().unbind("paste")}start(p){this._editor.syncRegions(p||this._defaultQuerySelector),this._editor.start(),this._editor.ignition()&&this._editor.ignition().state("editing")}stop(p=!0){this._editor.getState()==="editing"&&(this._editor.stop(p),this._editor.syncRegions(this._defaultQuerySelector),this._editor.ignition()&&this._editor.ignition().state("ready"))}save(p=!0){return this._editor.save(p)}focusNextRegion(p){let v=ContentTools.EditorApp.get().orderedRegions(),y=p?v.indexOf(p):v.length-2;if(y>=v.length-1)return;let L=v[y+1],S=null;for(let w of L.descendants())if(w.content!==void 0){S=w;break}if(S){S.focus(),S.selection(new ContentSelect.Range(0,0));return}ContentEdit.Root.get().trigger("next-region",L)}_init(p,v,y,L){this._imageTool.register(),this._tableTool.register(),this._noteTool.register(),Dn(),this._editor=ContentTools.EditorApp.get(),ContentTools.Tools.Bold.tagName="strong",ContentTools.DEFAULT_TOOLS=[["bold","italic",oe],["unordered-list","ordered-list",this._tableTool.id],["align-left","align-center","align-right"],["heading","subheading",this._imageTool.id],[this._noteTool.id],["undo","redo","remove"]],ContentEdit.TRIM_WHITESPACE=!0,ContentEdit.DEFAULT_MAX_ELEMENT_WIDTH=1200,ContentTools.CANCEL_MESSAGE=null,this._defaultQuerySelector=p,this._editor.init(p,v,y,L),this._overrideClipboardPasteHandler(),this._overrideCreatePlaceholderElement(),this._editor.addEventListener("saved",S=>this.saved.emit(S.detail().regions))}_refresh(){this._editor.syncRegions()}_setAutoSave(p){this._stopAutoSave(),this._autosaveInterval=setInterval(()=>!this.saving&&this._editor.save(!0),p)}_stopAutoSave(){this._autosaveInterval&&(clearInterval(this._autosaveInterval),this._autosaveInterval=null)}_setInitialContent(p){if(this.start(),p){let v=this._editor.regions();for(let y in v)this._editor._emptyRegionsAllowed=!0,y==="region_2_body"&&v[y].setContent(p),this._editor._emptyRegionsAllowed=!1}this._taintBinded||(this._taintBinded=!0,ContentEdit.Root.get().bind("taint",v=>this.changed.emit()))}_overrideCreatePlaceholderElement(){this._translationSubs=this._translate.onChange().subscribe(p=>{this._editor.createPlaceholderElement=L=>{if(L.domElement().getAttribute("data-name")==="region_2_body"){let S=this._translate.translate("classes.text-editor.hint-body",null);return new ContentEdit.Text("p",{"data-ce-placeholder":S},"")}};let v=this._el.nativeElement.querySelector('h1[data-name="region_1_title"]');if(v){let L=this._translate.translate("classes.text-editor.hint-title",null);v.setAttribute("data-ce-placeholder",L)}let y=this._el.nativeElement.querySelector('div[data-name="region_2_body"]');if(y){let L=y.querySelector("p[data-ce-placeholder]");if(L){let S=this._translate.translate("classes.text-editor.hint-body",null);L.setAttribute("data-ce-placeholder",S)}}})}_overrideClipboardPasteHandler(){ContentEdit.Root.get().unbind("paste",this._editor._handleClipboardPaste),ContentEdit.Root.get().bind("paste",(p,v)=>{if(!(!p||!p.domElement())){if(p.attr("data-max-length")){let y=v.clipboardData.getData("text/plain");this._editor.pasteText(p,y.substring(0,+p.attr("data-max-length")-p.content.characters.length));return}if(v.clipboardData){if(v.clipboardData){if(p.type()!=="PreText"&&v.clipboardData.getData("text/html")){let y=v.clipboardData.getData("text/html");y=y.replace(/<a([^>]*)>
25([^<]*)<\/a>/gim,"$2"),this._editor.pasteHTML(p,y)}else this._editor.pasteText(p,v.clipboardData.getData("text/plain"));return}window.clipboardData&&this._editor.pasteText(p,window.clipboardData.getData("TEXT"))}}})}_setTitleMaxLength(){let p=this._el.nativeElement.querySelector('h1[data-name="region_1_title"]');if(p){let v=[8,37,38,39,40];this._renderer.listen(p,"keydown",y=>{if(y.keyCode===13){y.preventDefault(),this.focusNextRegion();return}v.indexOf(y.keyCode)===-1&&y.target.innerText.length>+y.target.getAttribute("data-max-length")&&y.preventDefault()})}}static{this.\u0275fac=function(v){return new(v||c)(W(Me),W(De),W(ln),W(te),W(ne),W(Mt),W(wt))}}static{this.\u0275dir=Ae({type:c,selectors:[["","tdTextEditor",""]],inputs:{tdTextEditor:"tdTextEditor",saving:"saving",autosave:"autosave"},outputs:{saved:"saved",changed:"changed"},standalone:!1})}}return c})();var Zn=c=>["/teacher",c,"edit"];function Jn(c,m){c&1&&(K(0,"em",9),tt(1,"classes.edit.0056"),q())}function ti(c,m){if(c&1&&(K(0,"em",10),tt(1),q()),c&2){let p=$();G(),Et(p.errorMsg)}}function ei(c,m){if(c&1&&(K(0,"em",9),tt(1,"classes.edit.0057 "),K(2,"span"),tt(3),ve(4,"date"),q()()),c&2){let p=$();G(3),Et(Ve(4,1,p.resource.updated_at,"MMM d, yyyy h:mm a",null,p.locale.language))}}function ni(c,m){c&1&&vt(0,"td-loader",14)}function ii(c,m){if(c&1){let p=ht();K(0,"div",15)(1,"div",16)(2,"div",17),rt("saved",function(y){X(p);let L=$();return Y(L.saved(y))})("changed",function(){X(p);let y=$();return Y(y.askConfirmation=!0)}),vt(3,"h1",18),ve(4,"translate"),vt(5,"div",19),q()()()}if(c&2){let p=$();G(2),ft("saving",p.isCreatingResource||p.isUpdatingResource)("tdTextEditor",p.contentBody),G(),ft("innerHTML",p.contentTitle,Le)("ngClass",p.alignTitle),Re("data-ce-placeholder",ze(4,5,"classes.text-editor.hint-title",p.locale.language))}}var Ce=(()=>{class c{constructor(p,v,y,L,S,w,k,l,e,t,n,i,o){this.locale=p,this._store=v,this._actions=y,this._router=L,this._dialog=S,this._activeRoure=w,this._changeDetector=k,this._httpClient=l,this._lessonService=e,this._resourceService=t,this._assetsService=n,this._noteTool=i,this._platform=o,this._titleRegExp=/<h1[^>]*td-title[^>]*>([\w|\W]*?(?=<\/h1))<\/h1>/gim,this._saveTitleInDocument=!0,this.isCreatingResource=!1,this.isUpdatingResource=!1,this._destroyed$=new Se}ngOnInit(){if(this._platform.isBrowser){this.loading=!0;let{id:p,resourceId:v}=this._activeRoure.snapshot.params;this._lessonId=p,this._resourceId=v,this._noteTool.language=this.locale.language,this._lessonService.getById(this._lessonId).pipe(Ie(this._destroyed$)).subscribe({next:y=>this._noteTool.language=y.language||this.locale.language,error:()=>{}}),v&&!this.resource&&this._loadResource(),this.resource={},this.confirmDialogConfig={type:Ee.Warning,icon:!0,title:"alerts.exit-unsaved.title",message:"alerts.exit-unsaved.message",close:{enabled:!0,label:"alerts.exit-unsaved.action-ok"},action:{enabled:!0,label:"alerts.exit-unsaved.action-cancel"}}}}ngAfterViewInit(){this._resourceId||(this.loading=!1,this._changeDetector.detectChanges())}ngOnDestroy(){this._destroyed$.next(!0),this._destroyed$.complete()}beforeUnload(p){this.askConfirmation&&(p.returnValue=!0)}close(){history.back()}saved(p){if(!this.askConfirmation)return;p.region_1_title&&(this._titleHtml=p.region_1_title),p.region_2_body&&(this._bodyHtml=p.region_2_body);let v=this._titleHtml?this._titleHtml.replace(/<h1[^>]*>([\w|\W]*)<\/h1>/gim,(S,w)=>w.replace(/<[^>]+>/g,"")).trim():void 0,y=` 26 ${this._saveTitleInDocument?this._prepareTitleToSave(this._titleHtml):""} 27 ${this._bodyHtml?this._bodyHtml:""} 28 `.replace(/[ \n\r\t\f\xA0]+/g,S=>S===" "?" ":S.replace(/(^|\xA0+)[^\xA0]+/g,"$1 ")).replace(/<(?!t[dh][\s>])[^\/>][^>]*>[\s]*<\/[^>]+>/gim,"").replace(/<(\w+)[^>]*data-[^>]*>([^<]*)<\/[^>]+>/gim,"<$1>$2</$1>").trim();this.errorMsg=null;let L=this.resource.id>0;if(!(v||y)){this.errorMsg="classes.text-editor.errors.empty-doc";return}if(this.saving=!0,!L){this.isCreatingResource=!0,this._assetsService.uploadHTML(y).pipe(Dt(({uri:S})=>this._lessonService.addResource(this._lessonId,{title:v,resource_type_id:6,time:20,asset_url:S}).pipe(lt(w=>this.askConfirmation=!1),lt(w=>this._resourceId=w.id),lt(w=>this.resource=w),lt(()=>this.isCreatingResource=!1),lt(w=>this._router.navigate(["/",this._lessonId,"document",w.id],{skipLocationChange:!0}))))).subscribe();return}this.isUpdatingResource=!0,this._assetsService.uploadHTML(y).pipe(Dt(({uri:S})=>this._lessonService.updateResource(this._lessonId,this._resourceId,{title:v,time:20,asset_url:S}).pipe(lt(w=>this.askConfirmation=!1),lt(w=>this.resource=w),lt(()=>this.isUpdatingResource=!1),lt(w=>this._changeDetector.detectChanges())))).subscribe()}_loadResource(){this.loading=!0,this._resourceService.getById(this._resourceId).subscribe(p=>{this.resource=p,this._httpClient.get(p.asset_url,{responseType:"text"}).toPromise().then(v=>{this._prepareDisplayContent(p,v),this.loading=!1}
28).catch(()=>this._showLoadError()).finally(()=>this._changeDetector.detectChanges())})}_prepareDisplayContent(p,v){this._titleRegExp.lastIndex=0;let y=this._titleRegExp.exec(v);if(y)this._titleHtml=y[0],this.alignTitle=this._getCSSAlignmentClass(this._titleHtml),this.contentTitle=y[1];else{let L=p.title?p.title:"";this._titleHtml=`<h1 class="td-title">${L}</h1>`}this._bodyHtml=v.replace(this._titleRegExp,"").replace(/<(\/?)b(\s[^>]*)?>/gi,"<$1strong$2>"),this.contentBody=this._bodyHtml,this._saveTitleInDocument=!!y&&!this._bodyHtml.includes("cover-title")}_getCSSAlignmentClass(p){return p.includes("text-center")?" text-center":p.includes("text-left")?" text-left":p.includes("text-right")?" text-right":""}_prepareTitleToSave(p){let v=`${p||""}`,y=this._getCSSAlignmentClass(v);this._titleRegExp.lastIndex=0;let L=this._titleRegExp.exec(v);return L?`<h1 class="td-title${y}">${L[1]}</h1>`:""}_showLoadError(){this._dialog.open(En,{width:"520px",height:"300px",disableClose:!0,data:{type:Ee.Error,icon:!0,title:"classes.text-editor.errors.loading.title",message:"classes.text-editor.errors.loading.message",close:{enabled:!0,label:"classes.text-editor.errors.loading.action-cancel"},action:{enabled:!0,label:"classes.text-editor.errors.loading.action-ok"}}}).afterClosed().subscribe(v=>{typeof v<"u"&&(v?this._loadResource():this._router.navigate(["../../"],{relativeTo:this._activeRoure}))})}static{this.\u0275fac=function(v){return new(v||c)(W(an),W(qt),W(Qe),W(Gt),W(Zt),W(Ke),W(We),W($e),W(rn),W(sn),W(on),W(Mt),W(wt))}}static{this.\u0275cmp=gt({type:c,selectors:[["ng-component"]],viewQuery:function(v,y){if(v&1&&Bt(re,5),v&2){let L;jt(L=zt())&&(y.textEditor=L.first)}},hostBindings:function(v,y){v&1&&rt("beforeunload",function(S){return y.beforeUnload(S)},ge)("pagehide",function(S){return y.beforeUnload(S)},ge)},standalone:!1,decls:21,vars:8,consts:[[1,"bg-white","shadow"],[1,"btn-icon","btn-md","btn-flat-blue-black","mr-4","md:mr-0",3,"routerLink"],[1,"ai","ai-arrow-left","text-lg"],["l10nTranslate","",1,"text-xl","text-blue-grey","ml-4"],["src","assets/images/tomi-grey.png","alt","TOMi Digital",1,"hidden","md:block","mx-auto"],[1,"ml-4","md:ml-10"],[1,"w-full","md:py-10","bg-blue-grey-light-1","td-text-editor"],[1,"container","mx-auto","h-full","px-3","md:px-10","relative","md:rounded","md:border","bg-white"],[1,"flex","justify-between","items-center","py-4","text-blue-grey"],["l10nTranslate",""],["l10nTranslate","",1,"text-red"],[1,"flex","items-center"],["l10nTranslate","",1,"btn","btn-flat-blue-black",3,"click","disabled"],[1,"ai","ai-circle-close","text-xl","cursor-pointer","p-2","ml-2","text-blue-grey","hover:font-bold","focus:outline-none",3,"click"],["color","#3ea6df",1,"flex","h-full","absolute","inset-0"],[1,"flex","overflow-auto","td-text-editor-content"],[1,"w-full","h-pull"],["autosave","30000",1,"h-full",3,"saved","changed","saving","tdTextEditor"],["data-editable","","data-fixture","","data-name","region_1_title","data-max-length","60",1,"td-title","text-5xl","mb-10","border-b","text-break",3,"innerHTML","ngClass"],["data-editable","","data-name","region_2_body",1,"td-text-editor-body","td-html-viewer","td-html-viewer-document"]],template:function(v,y){v&1&&(K(0,"td-toolbar",0)(1,"a",1),vt(2,"em",2),q(),K(3,"strong",3),tt(4,"classes.edit.0015"),q(),vt(5,"img",4)(6,"td-apps-menu",5)(7,"td-avatar",5),q(),K(8,"div",6)(9,"div",7)(10,"div",8)(11,"div"),ct(12,Jn,2,0,"em",9),ct(13,ti,2,1,"em",10),ct(14,ei,5,6,"em",9),q(),K(15,"div",11)(16,"button",12),rt("click",function(){return y.textEditor.save()}),tt(17,"actions.save"),q(),K(18,"em",13),rt("click",function(){return y.close()}),q()()(),ct(19,ni,1,0,"td-loader",14)(20,ii,6,8,"div",15),q()()),v&2&&(G(),ft("routerLink",je(6,Zn,y._lessonId)),G(11),dt(y.isCreatingResource||y.isUpdatingResource?12:-1),G(),dt(!y.isCreatingResource&&!y.isUpdatingResource&&y.errorMsg?13:-1),G(),dt(!y.isCreatingResource&&!y.isUpdatingResource&&!y.errorMsg&&y.resource.updated_at?14:-1),G(2),ft("disabled",!y.askConfirmation),G(3),dt(y.loading?19:20))},dependencies:[Ge,$t,Xe,Yt,hn,fn,vn,re,qe,cn],styles:[`.ce-element--focused,.ce-element--over{background-color:#9fddf333}.ce-element--drop{position:relative}.ce-element--drop:before{background:#f0f3f4;border-top:2px dashed #9FB2B8}.ce-element--type-image{margin-top:16px;margin-bottom:16px;max-width:100%;max-height:500px}.ce-element--type-image.align-left,.ce-element--type-image.align-right{float:none}.ce-element--type-list{padding-left:16px;margin-bottom:16px;list-style-type:disc;list-style-position:inside}.ce-element--type-list-item-text{display:inline}.ce-element--type-pre-text{white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word}.ce-element--empty[data-td-title]:after{font-style:normal}.ct-inspector{display:none}.ct-widget.ct-toolbox{width:auto;padding:0;z-index:999;border-radius:5px;border:1px solid #9FB2B8;background:#ffffffe6;-webkit-box-shadow:0px 3px 6px 1px rgba(211,107,107,.16);-moz-box-shadow:0px 3px 6px 1px rgba(0,0,0,.16);box-shadow:0 3px 6px 1px #00000029}.ct-widget.ct-toolbox .ct-toolbox__grip{padding-bottom:0;margin-bottom:8px;background-color:#e3e8ea;border-top-left-radius:5px;border-top-right-radius:5px}.ct-widget.ct-toolbox .ct-toolbox__grip .ct-grip__bump{background:#9fb2b8}
28.ct-widget.ct-toolbox .ct-tool-group{display:flex;justify-content:center}.ct-widget .ct-tool{color:#0f3e4d;margin:0 4px}.ct-widget .ct-tool--time:before{content:"\\e94e"}.ct-widget .ct-tool--td-note:before{font-family:tomi-icons;content:"\\e9ba"}.ct-widget .ct-tool--td-mark{display:flex;align-items:center;justify-content:center}.ct-widget .ct-tool--td-mark:before{content:"ab";font-family:Lato,sans-serif;font-weight:900;padding:1px 5px;font-size:13px;line-height:20px;border-radius:4px;background:#e4e3fe}.ct-widget .ct-tool--disabled{color:#9fb2b8}.ct-widget.ct-anchored-dialog{display:flex;align-items:center;border-radius:18px;background-color:#fff;border:1px solid #9FB2B8;-webkit-box-shadow:0px 3px 6px 1px rgba(211,107,107,.16);-moz-box-shadow:0px 3px 6px 1px rgba(0,0,0,.16);box-shadow:0 3px 6px 1px #00000029}.ct-widget.ct-anchored-dialog:after{display:none}.ct-widget .ct-anchored-dialog__input{flex:1;color:#333;padding-right:0;border-top-left-radius:18px;border-bottom-left-radius:18px}.ct-widget .ct-anchored-dialog__target-button{display:none}.ct-widget .ct-anchored-dialog__button{width:20px;height:20px;margin:0 12px;line-height:20px;font-size:12px;background:#fff;border:2px solid #0f3e4d;border-radius:50%;display:flex;justify-content:center;align-items:center}.ct-widget .ct-anchored-dialog__button:before{color:#0f3e4d}.ct-widget .ct-anchored-dialog__button:hover{font-size:13px;background:#fff;border-color:#071c22}.ct-widget.ct-dialog{border-radius:10px}.ct-widget.ct-image-dialog .ct-dialog__header{color:#395469}.ct-widget.ct-image-dialog .ct-dialog__caption{font-size:20px;font-family:Lato,sans-serif}.ct-widget.ct-image-dialog .ct-dialog__close{border:none}.ct-widget.ct-image-dialog .ct-dialog__controls{display:flex;justify-content:center}.ct-widget.ct-image-dialog .ct-control-group--left{display:none}.ct-widget.ct-image-dialog .ct-control--text{width:150px;height:38px;font-size:15px;line-height:38px;font-weight:400;border-radius:25px;font-family:Lato,sans-serif}.ct-widget.ct-image-dialog .ct-control--upload,.ct-widget.ct-image-dialog .ct-control--insert{margin-left:0;cursor:pointer;background-color:#a9d42d}.ct-widget.ct-image-dialog .ct-control--upload:hover,.ct-widget.ct-image-dialog .ct-control--insert:hover{background-color:#88ab23}.ct-widget.ct-image-dialog .ct-control--cancel,.ct-widget.ct-image-dialog .ct-control--clear{color:#0f3e4d;border:1px solid #0f3e4d;background-color:transparent}.ct-widget.ct-image-dialog .ct-control--cancel:hover,.ct-widget.ct-image-dialog .ct-control--clear:hover{color:#fff;border:1px solid #0f3e4d;background-color:#0f3e4d}.ce-drag-helper{width:auto;height:80px;max-width:500px;border:4px solid rgba(15,170,224,.4);-webkit-box-shadow:0px 3px 10px 1px rgba(211,107,107,.16);-moz-box-shadow:0px 3px 10px 1px rgba(0,0,0,.16);box-shadow:0 3px 10px 1px #00000029}.ce-drag-helper:before{display:none}.td-tool-popover{border-radius:5px;border:1px solid #9FB2B8;background:#fff;box-shadow:0 3px 6px 1px #00000029}.td-text-editor{height:calc(100vh - 60px)}.td-text-editor-content{height:calc(100% - 83px)}.td-text-editor-body h1.ce-element--focused,.td-text-editor-body h1.ce-element--over,.td-text-editor-body h2.ce-element--focused,.td-text-editor-body h2.ce-element--over{background-image:none;background-clip:border-box;-webkit-background-clip:border-box;-webkit-text-fill-color:currentColor} 29`],encapsulation:2,changeDetection:0})}}return c})();z();var oi="navigate_after_login",An=(()=>{class c{constructor(){this._localStorage=st(tn),this._authService=st(nn),this._platform=st(wt),this._router=st(Gt),this._store=st(qt)}canActivate(p,v){let y=p.data.redirectTo||"/auth/login",L=p.data.profileTypes;return this._authService.ping().pipe(Dt(S=>me(!0)),we(S=>(this._platform.isBrowser&&S?.status===401&&this._authService.getAccessToken()&&this._authService.logout(),this._localStorage.setItem(oi,v.url),this._router.navigate([y],{queryParamsHandling:"preserve"}),me(!1))))}static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275prov=mt({token:c,factory:c.\u0275fac,providedIn:"root"})}}return c})();var ri=[{path:"",canActivate:[An],data:{profileTypes:[Je.Teacher]},children:[{path:"",component:Ce},{path:":resourceId",component:Ce}]}],Rn=Ye.forChild(ri);var Dr=On(Nn());var Ar=(()=>{class c{static{this.\u0275fac=function(v){return new(v||c)}}static{this.\u0275mod=Ft({type:c})}static{this.\u0275inj=Pt({providers:[te,ne,Mt],imports:[Ze,Wt,pn,Jt,Kt,Rn,Qt,un,xn,yn,mn]})}}return c})();export{Ar as TdTextEditorModule};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.