/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.10.7 (2022-12-06) */ !function(){"use strict";function e(r){return function(e){return t=typeof(n=e),(null===n?"null":"object"==t&&(Array.prototype.isPrototypeOf(n)||n.constructor&&"Array"===n.constructor.name)?"array":"object"==t&&(String.prototype.isPrototypeOf(n)||n.constructor&&"String"===n.constructor.name)?"string":t)===r;var n,t}}function n(n){return function(e){return typeof e===n}}function t(n){return function(e){return n===e}}function l(e){return!(null==e)}function E(){}function C(e){return function(){return e}}function S(e){return e}function r(e,n){return e===n}var T=e("string"),g=e("object"),a=e("array"),h=t(null),o=n("boolean"),u=t(void 0),c=n("function"),f=n("number");function P(r){for(var o=[],e=1;e=n.length&&e.substr(t,t+n.length)===n}function Z(e,n){return-1!==e.indexOf(n)}function ee(e,n){return Q(e,n,e.length-n.length)}function ne(e){return 0=e.startCol&&o<=e.finishRow&&u>=e.startRow}function yt(e,n){return n.column>=e.startCol&&n.column+n.colspan-1<=e.finishCol&&n.row>=e.startRow&&n.row+n.rowspan-1<=e.finishRow}function Ct(e,n,t){var r=$t.findItem(e,n,ce),o=$t.findItem(e,t,ce);return r.bind(function(r){return o.map(function(e){return n=r,t=e,{startRow:Math.min(n.row,t.row),startCol:Math.min(n.column,t.column),finishRow:Math.max(n.row+n.rowspan-1,t.row+t.rowspan-1),finishCol:Math.max(n.column+n.colspan-1,t.column+t.colspan-1)};var n,t})})}function St(n,e,t){return Ct(n,e,t).map(function(e){return O($t.filterItems(n,P(wt,e)),function(e){return e.element})})}function Tt(e,n){return $t.findItem(e,n,function(e,n){return le(n,e)}).map(function(e){return e.element})}function xt(e,n,t,r,o){var u=Kt(e),i=ce(e,t)?q.some(n):Tt(u,n),c=ce(e,o)?q.some(r):Tt(u,r);return i.bind(function(n){return c.bind(function(e){return St(u,n,e)})})}function Rt(n,t){rn(n).each(function(e){e.dom.insertBefore(t.dom,n.dom)})}function Dt(e,n){cn(e).fold(function(){rn(e).each(function(e){Xt(e,n)})},function(e){Rt(e,n)})}function Ot(n,t){an(n,0).fold(function(){Xt(n,t)},function(e){n.dom.insertBefore(t.dom,e.dom)})}function At(e,n){Rt(e,n),Xt(n,e)}function kt(t,r){A(r,function(e,n){Dt(0===n?t:r[n-1],e)})}function It(n,e){A(e,function(e){Xt(n,e)})}function Bt(e){e.dom.textContent="",A(ln(e),function(e){Yt(e)})}function Mt(e){var n,t=ln(e);0=t.length-1)return q.none();var e=t[r].fold(function(){var e,n;return H((e=t.slice(0,r),(n=U.call(e,0)).reverse(),n),function(e,n){return e.map(function(e){return{value:e,delta:n+1}})})},function(e){return q.some({value:e,delta:0})}),n=t[r+1].fold(function(){return H(t.slice(r+1),function(e,n){return e.map(function(e){return{value:e,delta:n+1}})})},function(e){return q.some({value:e,delta:1})});return e.bind(function(t){return n.map(function(e){var n=e.delta+t.delta;return Math.abs(e.value-t.value)/n})})}(t,n))},function(e){return o(e)})}function ko(e,n,i,c){var l=yr(e),t=$t.hasColumns(e)?O($t.justColumns(e),function(e){return q.from(e.element)}):l,a=[q.some(ao.edge(n))].concat(O(ao.positions(l,n),function(e){return e.map(function(e){return e.x})})),f=p(Yn);return O(t,function(e,u){return Ao(e,u,a,f,function(e){return t=e,o=(r=He().browser).isChrome()||r.isFirefox(),!Hl(t)||o?i(e):Ao(null!=(n=l[u])?S(n):q.none(),u,a,f,function(e){return c(q.some(vr(e)))},c);var n,t,r,o},c)})}function Io(e){return e.map(function(e){return e+"px"}).getOr("")}function Bo(e,n,t){return ko(e,n,So,function(e){return e.getOrThunk(t.minCellWidth)})}function Mo(e,n,t,r,o){var u=Cr(e),i=[q.some(t.edge(n))].concat(O(t.positions(u,n),function(e){return e.map(function(e){return e.y})}));return O(u,function(e,n){return Ao(e,n,i,p(Jn),r,o)})}function Eo(e,n){return function(){return Sn(e)?n(e):parseFloat(Gn(e,"width").getOr("0"))}}function Po(r){var t=Eo(r,function(e){return parseFloat(Ro(e))}),n=Eo(r,vr);return{width:t,pixelWidth:n,getWidths:function(e,n){return t=n,ko(e,r,Co,function(e){return e.fold(function(){return t.minCellWidth()},function(e){return e/t.pixelWidth()*100})});var t},getCellDelta:function(e){return e/n()*100},singleColumnWidth:function(e,n){return[100-e]},minCellWidth:function(){return Ft()/n()*100},setElementWidth:bo,adjustTableWidth:function(e){var n=t();bo(r,n+e/100*n)},isRelative:!0,label:"percent"}}function No(t){var r=Eo(t,vr);return{width:r,pixelWidth:r,getWidths:function(e,n){return Bo(e,t,n)},getCellDelta:S,singleColumnWidth:function(e,n){return[Math.max(Ft(),e+n)-e]},minCellWidth:Ft,setElementWidth:po,adjustTableWidth:function(e){var n=r()+e;po(t,n)},isRelative:!1,label:"pixel"}}function zo(e,n){function t(e){return oe(e.element,n)}var u,r,i,c,l,a,f,s,o,m,d,g,p=fr(e),b=ct(p),h=Vl(e),v=$t.generate(b),w=(u=t,r=v.grid.columns,i=v.grid.rows,c=r,a=l=0,f=[],s=[],ae(v.access,function(e){var n,t,r,o;f.push(e),u(e)&&(s.push(e),t=(n=e.row)+e.rowspan-1,o=(r=e.column)+e.colspan-1,nt.maxRow||st.maxCol||($t.getAt(n,a,s).filter(r).isNone()?(o=f,0,u=e[a].element,i=Ve.fromTag("td"),Xt(i,Ve.fromTag("br")),(o?Xt:Ot)(u,i)):f=!0)}(b,v,w,t),o=p,m=w,d=v,g=function(e,n,t,r){if(0===r.minCol&&n.grid.columns===r.maxCol+1)return 0;var o=Bo(n,e,t),u=B(o,function(e,n){return e+n},0),i=B(o.slice(r.minCol,r.maxCol+1),function(e,n){return e+n},0)/u*t.pixelWidth()-t.pixelWidth();return t.getCellDelta(i)}(e,$t.fromTable(e),h,w),ae(d.columns,function(e){(e.columnm.maxCol)&&Yt(e.element)}),A(k(Zn(o,"tr"),function(e){return 0===e.dom.childElementCount}),Yt),m.minCol!==m.maxCol&&m.minRow!==m.maxRow||A(Zn(o,"th,td"),function(e){Wt(e,"rowspan"),Wt(e,"colspan")}),Wt(o,Gt),Wt(o,"data-snooker-col-series"),Vl(o).adjustTableWidth(g),p}function Lo(e){return"img"===Ye(e)?1:Pt(e).fold(function(){return ln(e).length},function(e){return e.length})}function _o(e){return Pt(e).filter(function(e){return 0!==e.trim().length||-1=n.column&&e<=dt(t[0])+n.column})}function Qi(e,u,n,i,c){var t,r,o,l=ht(u),a=(t=e,r=l,o=dt(u[0]),{row:gt(u).cols.length+t.row,column:w(D(o-t.column,function(e){return e+t.column}),function(n){return z(r,function(e){return e!==n})}).getOr(o-1)}),f=gt(n).rows,s=Ji(a,f,l);return function(e,n,t){if(e.row>=n.length||e.column>dt(n[0]))return Ga.error("invalid start address out of table bounds, row: "+e.row+", column: "+e.column);var r=n.slice(e.row),o=r[0].cells.slice(e.column),u=dt(t[0]),i=t.length;return Ga.value({rowDelta:r.length-i,colDelta:o.length-u})}(a,u,f).map(function(e){var n=K(K({},e),{colDelta:e.colDelta-s.length}),t=Yi(u,n,i),r=ht(t),o=Ji(a,f,r);return function(e,n,t,r,o,u){for(var i,c,l,a,f,s=e.row,m=e.column,d=s+t.length,g=m+dt(t[0])+u.length,p=L(u,x),b=s;b=n.grid.columns&&e.isLocked})}function Ac(e,n){var t=yr(e);return B(fc(n),function(e,n){return e+t[n.column].map(wr).getOr(0)},0)}function kc(t){return function(n,e){return _i(n,e).filter(function(e){return!(t?Dc:Oc)(n,e)}).map(function(e){return{details:e,pixelDelta:Ac(n,e)}})}}function Ic(t){return function(n,e){return Li(n,e).filter(function(e){return!(t?Dc:Oc)(n,e.cells)})}}function Bc(e,n){var u=$t.fromTable(e);return _i(u,n).bind(function(e){var n=e[e.length-1],t=e[0].column,r=n.column+n.colspan,o=M(O(u.all,function(e){return k(e.cells,function(e){return e.column>=t&&e.column=t&&e.column=r&&e.column=e.length-1)return qf.last(e[e.length-1]);var i=t+r,c=e[i];return o(c)?qf.middle(n,c):Uf(e,n,i,r,o)},Gf=function(e,n,t,r){return{start:e,soffset:n,finish:t,foffset:r}},$f=Lr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Kf={before:$f.before,on:$f.on,after:$f.after,cata:function(e,n,t,r){return e.fold(n,t,r)},getStart:function(e){return e.fold(S,S,S)}},Xf=Lr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Yf={domRange:Xf.domRange,relative:Xf.relative,exact:Xf.exact,exactFromRange:function(e){return Xf.exact(e.start,e.soffset,e.finish,e.foffset)},getWin:function(e){var n=e.match({domRange:function(e){return Ve.fromDom(e.startContainer)},relative:function(e,n){return Kf.getStart(e)},exact:function(e,n,t,r){return e}});return Ve.fromDom(tn(n).dom.defaultView)},range:Gf},Jf=function(e,n){return e.selectNodeContents(n.dom)},Qf=Lr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]);function Zf(e,n,t){return n>=e.left&&n<=e.right&&t>=e.top&&t<=e.bottom}function es(t,r,e,n,o){function l(e){var n=t.dom.createRange();return n.setStart(r.dom,e),n.collapse(!0),n}var u=Et(r).length,i=function(e,n,t,r){if(0===r)return 0;if(e===t)return r-1;for(var o=t,u=1;ut.right;var n,t})})}function zs(n,t,e){var r,o=n.move(e,5),u=vm(t,n,e,o,100).getOr(o),i=u,c=t;return((r=n).point(i)>c.getInnerHeight()?q.some(r.point(i)-c.getInnerHeight()):r.point(i)<0?q.some(-r.point(i)):q.none()).fold(function(){return t.situsFromPoint(u.left,n.point(u))},function(e){return t.scrollBy(0,e),t.situsFromPoint(u.left,n.point(u)-e)})}function Ls(a,f,s,e,m){return In(e,"td,th",f).bind(function(l){return In(l,"table",f).bind(function(e){return n=e,Dn(m,function(e){return rn(e).exists(function(e){return ce(e,n)})},void 0).isSome()?(o=t=a,u=r=f,i=c=s,o.getSelection().bind(function(r){return Os(u,r.finish,r.foffset,i).fold(function(){return q.some(hi(r.finish,r.foffset))},function(e){var n=o.fromSitus(e),t=dm.verify(o,r.finish,r.foffset,n.finish,n.foffset,i.failure,u);return dm.cata(t,function(e){return q.none()},function(){return q.none()},function(e){return q.some(hi(e,0))},function(e){return q.some(hi(e,Lo(e)))})})}).bind(function(e){return ym(t,r,e.element,e.offset,c,20).map(t.fromSitus)}).bind(function(n){return In(n.finish,"td,th",f).map(function(e){return{start:l,finish:e,range:n}})})):q.none();var o,u,i,n,t,r,c})})}function _s(e,n,t,r,o,u){return He().browser.isIE()?q.none():u(r,n).orThunk(function(){return Ls(e,n,t,r,o).map(function(e){var n=e.range;return nm(q.some(rm(n.start,n.soffset,n.finish,n.foffset)),!0)})})}function Ws(e,r){return In(e,"tr",r).bind(function(t){return In(t,"table",r).bind(function(e){var n=dn(e,"tr");return ce(t,n[0])?am(sm,e,function(e){return jo(e).isSome()},r).map(function(e){var n=Lo(e);return nm(q.some(rm(e,n,e,n)),!0)}):q.none()})})}function js(e,r){return In(e,"tr",r).bind(function(t){return In(t,"table",r).bind(function(e){var n=dn(e,"tr");return ce(t,n[n.length-1])?fm(sm,e,function(e){return Wo(e).isSome()},r).map(function(e){return nm(q.some(rm(e,0,e,0)),!0)}):q.none()})})}function Fs(e,n,t,r,o,u,i){return Ls(e,t,r,o,u).bind(function(e){return om(n,t,e.start,e.finish,i)})}function Hs(e,n){return In(e,"td,th",n)}function Vs(n){return function(e){return e===n}}function qs(e){return 37<=e&&e<=40}function Us(l){return{elementFromPoint:function(e,n){return Ve.fromPoint(Ve.fromDom(l.document),e,n)},getRect:function(e){return e.dom.getBoundingClientRect()},getRangedRect:function(e,n,t,r){var o,u,i,c=Yf.exact(e,n,t,r);return i=(o=kl(l,c)).getClientRects(),0<(u=0t.left&&r.lefto.bottom?bm.retry(u):t.top===o.bottom?bm.retry(As(o,1)):Ns(e,n,o)?bm.retry(Is(u,5,0)):bm.none()},move:As,gather:xs},vm=function(t,r,o,u,i){return 0===i?q.some(u):(n=t,c=u.left,l=r.point(u),n.elementFromPoint(c,l).filter(function(e){return"table"===Ye(e)}).isSome()?(e=i-1,vm(t,r,o,r.move(u,5),e)):t.situsFromPoint(u.left,r.point(u)).bind(function(e){return e.start.fold(q.none,function(n){return Ps(t,n).bind(function(e){return r.adjuster(t,n,e,o,u).fold(q.none,function(e){return vm(t,r,o,e,i-1)})}).orThunk(function(){return q.some(u)})},q.none)}));var e,n,c,l},wm={tryUp:P(zs,{point:function(e){return e.top},adjuster:function(e,n,t,r,o){var u=ks(o,5);return Math.abs(t.top-r.top)<1||t.bottom=t.grid.columns&&(e.onLast=!0)),e},{onAny:!1,onFirst:!1,onLast:!1});return{mergeable:Fi(t,r).isSome(),unmergeable:Hi(t,r).isSome(),locked:n}})}function r(){s.set(Y(e)()),d=s.get().bind(t),A(m.get(),function(e){return e()})}function i(n){return n(),m.set(m.get().concat([n])),function(){m.set(k(m.get(),function(e){return e!==n}))}}function c(n,t){return i(function(){return s.get().fold(function(){n.setDisabled(!0)},function(e){n.setDisabled(t(e))})})}function l(n,t,r){return i(function(){return s.get().fold(function(){n.setDisabled(!0),n.setActive(!1)},function(e){n.setDisabled(t(e)),n.setActive(r(e))})})}function a(n){return d.exists(function(e){return e.locked[n]})}function f(n,t){return function(e){return l(e,function(e){return g(e.element)},function(){return o.queryCommandValue(n)===t})}}var s=Xc(q.none()),m=Xc([]),d=q.none(),g=en("caption"),p=f("mceTableRowType","header"),b=f("mceTableColType","th");return o.on("NodeChange ExecCommand TableSelectorChange",r),{onSetupTable:function(e){return c(e,function(e){return!1})},onSetupCellOrRow:function(e){return c(e,function(e){return g(e.element)})},onSetupColumn:function(n){return function(e){return c(e,function(e){return g(e.element)||a(n)})}},onSetupPasteable:function(n){return function(e){return c(e,function(e){return g(e.element)||n().isNone()})}},onSetupPasteableColumn:function(n,t){return function(e){return c(e,function(e){return g(e.element)||n().isNone()||a(t)})}},onSetupMergeable:function(e){return c(e,function(e){return n("mergeable")})},onSetupUnmergeable:function(e){return c(e,function(e){return n("unmergeable")})},resetTargets:r,onSetupTableWithCaption:function(e){return l(e,v,function(e){return rt(e.element,Zo(o)).exists(function(e){return An(e,"caption").isSome()})})},onSetupTableRowHeaders:p,onSetupTableColumnHeaders:b,targets:s.get}}Yr.add("table",function(c){var e,n,t,r,o,u,i,l,a,f,s,m,d=(e=function(){return Yo(c)},n=function(){return Jl(tu(c),Zo(c))},t=Xl.selectedSelector,{get:function(){return Ur(e(),t).fold(function(){return n().fold($r,Xr)},function(e){return Kr(e)})}}),g=Mm(c,d),p=bi(c),b=Bm(c,p.lazyResize,g),h=Ec(c,b,p.lazyWire),v=(r=Jc(),o=Jc(),{getRows:r.get,setRows:function(e){e.fold(r.clear,r.set),o.clear()},clearRows:r.clear,getColumns:o.get,setColumns:function(e){e.fold(o.clear,o.set),r.clear()},clearColumns:o.clear});return yl(c,h,0,d,v),f=h,s=d,m=Zo(a=c),ae({mceTableRowType:function(){return w(f.getTableRowType)},mceTableCellType:function(){return w(f.getTableCellType)},mceTableColType:function(){return w(f.getTableColType)}},function(e,n){return a.addQueryValueHandler(n,e)}),iu(c,d,h),function(n,e,t,r){function o(e){return function(){return n.execCommand(e)}}function u(e){n.execCommand("mceInsertTable",!1,{rows:e.numRows,columns:e.numColumns})}var i={text:"Table properties",onSetup:t.onSetupTable,onAction:o("mceTableProps")},c={text:"Delete table",icon:"table-delete-table",onSetup:t.onSetupTable,onAction:o("mceTableDelete")};n.ui.registry.addMenuItem("tableinsertrowbefore",{text:"Insert row before",icon:"table-insert-row-above",onAction:o("mceTableInsertRowBefore"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tableinsertrowafter",{text:"Insert row after",icon:"table-insert-row-after",onAction:o("mceTableInsertRowAfter"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tabledeleterow",{text:"Delete row",icon:"table-delete-row",onAction:o("mceTableDeleteRow"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tablerowprops",{text:"Row properties",icon:"table-row-properties",onAction:o("mceTableRowProps"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tablecutrow",{text:"Cut row",icon:"cut-row",onAction:o("mceTableCutRow"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tablecopyrow",{text:"Copy row",icon:"duplicate-row",onAction:o("mceTableCopyRow"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tablepasterowbefore",{text:"Paste row before",icon:"paste-row-before",onAction:o("mceTablePasteRowBefore"),onSetup:t.onSetupPasteable(r.getRows)}),n.ui.registry.addMenuItem("tablepasterowafter",{text:"Paste row after",icon:"paste-row-after",onAction:o("mceTablePasteRowAfter"),onSetup:t.onSetupPasteable(r.getRows)});var l={type:"nestedmenuitem",text:"Row",getSubmenuItems:C("tableinsertrowbefore tableinsertrowafter tabledeleterow tablerowprops | tablecutrow tablecopyrow tablepasterowbefore tablepasterowafter")};n.ui.registry.addMenuItem("tableinsertcolumnbefore",{text:"Insert column before",icon:"table-insert-column-before",onAction:o("mceTableInsertColBefore"),onSetup:t.onSetupColumn("onFirst")}),n.ui.registry.addMenuItem("tableinsertcolumnafter",{text:"Insert column after",icon:"table-insert-column-after",onAction:o("mceTableInsertColAfter"),onSetup:t.onSetupColumn("onLast")}),n.ui.registry.addMenuItem("tabledeletecolumn",{text:"Delete column",icon:"table-delete-column",onAction:o("mceTableDeleteCol"),onSetup:t.onSetupColumn("onAny")}),n.ui.registry.addMenuItem("tablecutcolumn",{text:"Cut column",icon:"cut-column",onAction:o("mceTableCutCol"),onSetup:t.onSetupColumn("onAny")}),n.ui.registry.addMenuItem("tablecopycolumn",{text:"Copy column",icon:"duplicate-column",onAction:o("mceTableCopyCol"),onSetup:t.onSetupColumn("onAny")}),n.ui.registry.addMenuItem("tablepastecolumnbefore",{text:"Paste column before",icon:"paste-column-before",onAction:o("mceTablePasteColBefore"),onSetup:t.onSetupPasteableColumn(r.getColumns,"onFirst")}),n.ui.registry.addMenuItem("tablepastecolumnafter",{text:"Paste column after",icon:"paste-column-after",onAction:o("mceTablePasteColAfter"),onSetup:t.onSetupPasteableColumn(r.getColumns,"onLast")});var a={type:"nestedmenuitem",text:"Column",getSubmenuItems:C("tableinsertcolumnbefore tableinsertcolumnafter tabledeletecolumn | tablecutcolumn tablecopycolumn tablepastecolumnbefore tablepastecolumnafter")};n.ui.registry.addMenuItem("tablecellprops",{text:"Cell properties",icon:"table-cell-properties",onAction:o("mceTableCellProps"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuItem("tablemergecells",{text:"Merge cells",icon:"table-merge-cells",onAction:o("mceTableMergeCells"),onSetup:t.onSetupMergeable}),n.ui.registry.addMenuItem("tablesplitcells",{text:"Split cell",icon:"table-split-cells",onAction:o("mceTableSplitCells"),onSetup:t.onSetupUnmergeable});var f={type:"nestedmenuitem",text:"Cell",getSubmenuItems:C("tablecellprops tablemergecells tablesplitcells")};!1===n.getParam("table_grid",!0,"boolean")?n.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:o("mceInsertTable")}):n.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"inserttable",onAction:u}]}}),n.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:o("mceInsertTable")}),n.ui.registry.addMenuItem("tableprops",i),n.ui.registry.addMenuItem("deletetable",c),n.ui.registry.addNestedMenuItem("row",l),n.ui.registry.addNestedMenuItem("column",a),n.ui.registry.addNestedMenuItem("cell",f),n.ui.registry.addContextMenu("table",{update:function(){return t.resetTargets(),t.targets().fold(C(""),function(e){return"caption"===Ye(e.element)?"tableprops deletetable":"cell row column | advtablesort | tableprops deletetable"})}});var s=Ef(oi(n));0!==s.length&&n.ui.registry.addNestedMenuItem("tableclass",{icon:"table-classes",text:"Table styles",getSubmenuItems:function(){return Mf(n,e,s,"tableclass",function(e){return n.execCommand("mceTableToggleClass",!1,e)})},onSetup:t.onSetupTable});var m=Ef(ri(n));0!==m.length&&n.ui.registry.addNestedMenuItem("tablecellclass",{icon:"table-cell-classes",text:"Cell styles",getSubmenuItems:function(){return Mf(n,e,m,"tablecellclass",function(e){return n.execCommand("mceTableCellToggleClass",!1,e)})},onSetup:t.onSetupCellOrRow}),n.ui.registry.addNestedMenuItem("tablecellvalign",{icon:"vertical-align",text:"Vertical align",getSubmenuItems:function(){return Mf(n,e,Df,"tablecellverticalalign",Zc(n,"vertical-align"))},onSetup:t.onSetupCellOrRow}),n.ui.registry.addNestedMenuItem("tablecellborderwidth",{icon:"border-width",text:"Border width",getSubmenuItems:function(){return Mf(n,e,Xu(n),"tablecellborderwidth",Zc(n,"border-width"))},onSetup:t.onSetupCellOrRow}),n.ui.registry.addNestedMenuItem("tablecellborderstyle",{icon:"border-style",text:"Border style",getSubmenuItems:function(){return Mf(n,e,Yu(n),"tablecellborderstyle",Zc(n,"border-style"))},onSetup:t.onSetupCellOrRow}),n.ui.registry.addToggleMenuItem("tablecaption",{icon:"table-caption",text:"Table caption",onAction:o("mceTableToggleCaption"),onSetup:t.onSetupTableWithCaption}),n.ui.registry.addNestedMenuItem("tablecellbackgroundcolor",{icon:"cell-background-color",text:"Background color",getSubmenuItems:function(){return nl(n,si(n),"background-color")},onSetup:t.onSetupCellOrRow}),n.ui.registry.addNestedMenuItem("tablecellbordercolor",{icon:"cell-border-color",text:"Border color",getSubmenuItems:function(){return nl(n,mi(n),"border-color")},onSetup:t.onSetupCellOrRow}),n.ui.registry.addToggleMenuItem("tablerowheader",{text:"Row header",icon:"table-top-header",onAction:tl(n),onSetup:t.onSetupTableRowHeaders}),n.ui.registry.addToggleMenuItem("tablecolheader",{text:"Column header",icon:"table-left-header",onAction:rl(n),onSetup:t.onSetupTableColumnHeaders})}(c,d,g,v),function(n,e,t,r){function o(e){return function(){return n.execCommand(e)}}n.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",fetch:function(e){return e("inserttable | cell row column | advtablesort | tableprops deletetable")}}),n.ui.registry.addButton("tableprops",{tooltip:"Table properties",onAction:o("mceTableProps"),icon:"table",onSetup:t.onSetupTable}),n.ui.registry.addButton("tabledelete",{tooltip:"Delete table",onAction:o("mceTableDelete"),icon:"table-delete-table",onSetup:t.onSetupTable}),n.ui.registry.addButton("tablecellprops",{tooltip:"Cell properties",onAction:o("mceTableCellProps"),icon:"table-cell-properties",onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tablemergecells",{tooltip:"Merge cells",onAction:o("mceTableMergeCells"),icon:"table-merge-cells",onSetup:t.onSetupMergeable}),n.ui.registry.addButton("tablesplitcells",{tooltip:"Split cell",onAction:o("mceTableSplitCells"),icon:"table-split-cells",onSetup:t.onSetupUnmergeable}),n.ui.registry.addButton("tableinsertrowbefore",{tooltip:"Insert row before",onAction:o("mceTableInsertRowBefore"),icon:"table-insert-row-above",onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tableinsertrowafter",{tooltip:"Insert row after",onAction:o("mceTableInsertRowAfter"),icon:"table-insert-row-after",onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tabledeleterow",{tooltip:"Delete row",onAction:o("mceTableDeleteRow"),icon:"table-delete-row",onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tablerowprops",{tooltip:"Row properties",onAction:o("mceTableRowProps"),icon:"table-row-properties",onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tableinsertcolbefore",{tooltip:"Insert column before",onAction:o("mceTableInsertColBefore"),icon:"table-insert-column-before",onSetup:t.onSetupColumn("onFirst")}),n.ui.registry.addButton("tableinsertcolafter",{tooltip:"Insert column after",onAction:o("mceTableInsertColAfter"),icon:"table-insert-column-after",onSetup:t.onSetupColumn("onLast")}),n.ui.registry.addButton("tabledeletecol",{tooltip:"Delete column",onAction:o("mceTableDeleteCol"),icon:"table-delete-column",onSetup:t.onSetupColumn("onAny")}),n.ui.registry.addButton("tablecutrow",{tooltip:"Cut row",icon:"cut-row",onAction:o("mceTableCutRow"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tablecopyrow",{tooltip:"Copy row",icon:"duplicate-row",onAction:o("mceTableCopyRow"),onSetup:t.onSetupCellOrRow}),n.ui.registry.addButton("tablepasterowbefore",{tooltip:"Paste row before",icon:"paste-row-before",onAction:o("mceTablePasteRowBefore"),onSetup:t.onSetupPasteable(r.getRows)}),n.ui.registry.addButton("tablepasterowafter",{tooltip:"Paste row after",icon:"paste-row-after",onAction:o("mceTablePasteRowAfter"),onSetup:t.onSetupPasteable(r.getRows)}),n.ui.registry.addButton("tablecutcol",{tooltip:"Cut column",icon:"cut-column",onAction:o("mceTableCutCol"),onSetup:t.onSetupColumn("onAny")}),n.ui.registry.addButton("tablecopycol",{tooltip:"Copy column",icon:"duplicate-column",onAction:o("mceTableCopyCol"),onSetup:t.onSetupColumn("onAny")}),n.ui.registry.addButton("tablepastecolbefore",{tooltip:"Paste column before",icon:"paste-column-before",onAction:o("mceTablePasteColBefore"),onSetup:t.onSetupPasteableColumn(r.getColumns,"onFirst")}),n.ui.registry.addButton("tablepastecolafter",{tooltip:"Paste column after",icon:"paste-column-after",onAction:o("mceTablePasteColAfter"),onSetup:t.onSetupPasteableColumn(r.getColumns,"onLast")}),n.ui.registry.addButton("tableinsertdialog",{tooltip:"Insert table",onAction:o("mceInsertTable"),icon:"table"});var u=Ef(oi(n));0!==u.length&&n.ui.registry.addMenuButton("tableclass",{icon:"table-classes",tooltip:"Table styles",fetch:el(n,e,u,"tableclass",function(e){return n.execCommand("mceTableToggleClass",!1,e)}),onSetup:t.onSetupTable});var i=Ef(ri(n));0!==i.length&&n.ui.registry.addMenuButton("tablecellclass",{icon:"table-cell-classes",tooltip:"Cell styles",fetch:el(n,e,i,"tablecellclass",function(e){return n.execCommand("mceTableCellToggleClass",!1,e)}),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuButton("tablecellvalign",{icon:"vertical-align",tooltip:"Vertical align",fetch:el(n,e,Df,"tablecellverticalalign",Zc(n,"vertical-align")),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuButton("tablecellborderwidth",{icon:"border-width",tooltip:"Border width",fetch:el(n,e,Xu(n),"tablecellborderwidth",Zc(n,"border-width")),onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuButton("tablecellborderstyle",{icon:"border-style",tooltip:"Border style",fetch:el(n,e,Yu(n),"tablecellborderstyle",Zc(n,"border-style")),onSetup:t.onSetupCellOrRow}),n.ui.registry.addToggleButton("tablecaption",{tooltip:"Table caption",onAction:o("mceTableToggleCaption"),icon:"table-caption",onSetup:t.onSetupTableWithCaption}),n.ui.registry.addMenuButton("tablecellbackgroundcolor",{icon:"cell-background-color",tooltip:"Background color",fetch:function(e){return e(nl(n,si(n),"background-color"))},onSetup:t.onSetupCellOrRow}),n.ui.registry.addMenuButton("tablecellbordercolor",{icon:"cell-border-color",tooltip:"Border color",fetch:function(e){return e(nl(n,mi(n),"border-color"))},onSetup:t.onSetupCellOrRow}),n.ui.registry.addToggleButton("tablerowheader",{tooltip:"Row header",icon:"table-top-header",onAction:tl(n),onSetup:t.onSetupTableRowHeaders}),n.ui.registry.addToggleButton("tablecolheader",{tooltip:"Column header",icon:"table-left-header",onAction:rl(n),onSetup:t.onSetupTableColumnHeaders})}(c,d,g,v),0<(l=(i=c).getParam("table_toolbar","tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol")).length&&i.ui.registry.addContextToolbar("table",{predicate:function(e){return i.dom.is(e,"table")&&i.getBody().contains(e)},items:l,scope:"node",position:"node"}),c.on("PreInit",function(){c.serializer.addTempAttr(Xl.firstSelected),c.serializer.addTempAttr(Xl.lastSelected),c.formatter.register(Hf)}),c.getParam("table_tab_navigation",!0,"boolean")&&c.on("keydown",function(e){var n,t,r,o,u=c,i=b;(n=e).keyCode===Qs.TAB&&(t=Yo(u),r=function(e){var n=Ye(e);return ce(e,t)||y(em,n)},o=u.selection.getRng(),et(Ve.fromDom(n.shiftKey?o.startContainer:o.endContainer),r).each(function(e){n.preventDefault(),rt(e,r).each(i.clear),u.selection.collapse(n.shiftKey),(n.shiftKey?function(e,n,t){return Zs(e,n,(o=Nu,Cl(r=t,void 0).fold(function(){return qf.none()},function(e){return Uf(e.all,r,e.index,-1,o)})));var r,o}:vs)(u,r,e).each(function(e){u.selection.setRng(e)})}))}),c.on("remove",function(){p.destroy()}),{insertTable:(u=c,function(e,n,t){var r=Lc(u,n,e,t=void 0===t?{}:t,"Invalid values for insertTable - rows and columns values are required to insert a table.");return u.undoManager.add(),r}),setClipboardRows:Wc(v.setRows),getClipboardRows:_c(v.getRows),setClipboardCols:Wc(v.setColumns),getClipboardCols:_c(v.getColumns),resizeHandler:p,selectionTargets:g};function w(r){return Jl(tu(a)).bind(function(t){return rt(t,m).map(function(e){var n=ou(s,e,t);return r(e,n)})}).getOr("")}})}();