2 lines
132 KiB
JavaScript
2 lines
132 KiB
JavaScript
!function(){"use strict";var e,t,n,r,o,i,u=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=function(e){return function(){return e}},c={noop:function(){},noarg:function(e){return function(){return e()}},compose:function(e,t){return function(){return e(t.apply(null,arguments))}},constant:a,identity:function(e){return e},tripleEquals:function(e,t){return e===t},curry:function(e){for(var t=new Array(arguments.length-1),n=1;n<arguments.length;n++)t[n-1]=arguments[n];return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];var o=t.concat(n);return e.apply(null,o)}},not:function(e){return function(){return!e.apply(null,arguments)}},die:function(e){return function(){throw new Error(e)}},apply:function(e){return e()},call:function(e){e()},never:a(!1),always:a(!0)},l=c.never,s=c.always,f=function(){return d},d=(r={fold:function(e,t){return e()},is:l,isSome:l,isNone:s,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},or:n,orThunk:t,map:f,ap:f,each:function(){},bind:f,flatten:f,exists:l,forall:s,filter:f,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:c.constant("none()")},Object.freeze&&Object.freeze(r),r),m=function(e){var t=function(){return e},n=function(){return o},r=function(t){return t(e)},o={fold:function(t,n){return n(e)},is:function(t){return e===t},isSome:s,isNone:l,getOr:t,getOrThunk:t,getOrDie:t,or:n,orThunk:n,map:function(t){return m(t(e))},ap:function(t){return t.fold(f,function(t){return m(t(e))})},each:function(t){t(e)},bind:r,flatten:t,exists:r,forall:r,filter:function(t){return t(e)?o:d},equals:function(t){return t.is(e)},equals_:function(t,n){return t.fold(l,function(t){return n(e,t)})},toArray:function(){return[e]},toString:function(){return"some("+e+")"}};return o},g={some:m,none:f,from:function(e){return null===e||e===undefined?d:m(e)}},p=(o=Array.prototype.indexOf)===undefined?function(e,t){return S(e,t)}:function(e,t){return o.call(e,t)},h=function(e,t){return p(e,t)>-1},v=function(e,t){for(var n=e.length,r=new Array(n),o=0;o<n;o++){var i=e[o];r[o]=t(i,o,e)}return r},b=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},w=function(e,t){for(var n=e.length-1;n>=0;n--)t(e[n],n,e)},y=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r,e)&&n.push(i)}return n},x=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return g.some(n);return g.none()},S=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},C=Array.prototype.push,R=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!Array.prototype.isPrototypeOf(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);C.apply(t,e[n])}return t},T=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},D=Array.prototype.slice,A={map:v,each:b,eachr:w,partition:function(e,t){for(var n=[],r=[],o=0,i=e.length;o<i;o++){var u=e[o];(t(u,o,e)?n:r).push(u)}return{pass:n,fail:r}},filter:y,groupBy:function(e,t){if(0===e.length)return[];for(var n=t(e[0]),r=[],o=[],i=0,u=e.length;i<u;i++){var a=e[i],c=t(a);c!==n&&(r.push(o),o=[]),n=c,o.push(a)}return 0!==o.length&&r.push(o),r},indexOf:function(e,t){var n=p(e,t);return-1===n?g.none():g.some(n)},foldr:function(e,t,n){return w(e,function(e){n=t(n,e)}),n},foldl:function(e,t,n){return b(e,function(e){n=t(n,e)}),n},find:function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return g.some(o)}return g.none()},findIndex:x,flatten:R,bind:function(e,t){var n=v(e,t);return R(n)},forall:T,exists:function(e,t){return x(e,t).isSome()},contains:h,equal:function(e,t){return e.length===t.length&&T(e,function(e,n){return e===t[n]})},reverse:function(e){var t=D.call(e,0);return t.reverse(),t},chunk:function(e,t){for(var n=[],r=0;r<e.length;r+=t){var o=e.slice(r,r+t);n.push(o)}return n},difference:function(e,t){return y(e,function(e){return!h(t,e)})},mapToObject:function(e,t){for(var n={},r=0,o=e.length;r<o;r++){var i=e[r];n[String(i)]=t(i,r)}return n},pure:function(e){return[e]},sort:function(e,t){var n=D.call(e,0);return n.sort(t),n},range:function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},head:function(e){return 0===e.length?g.none():g.some(e[0])},last:function(e){return 0===e.length?g.none():g.some(e[e.length-1])}},k=(i=Object.keys)===undefined?function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}:i,N=function(e,t){for(var n=k(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},O=function(e,t){var n={};return N(e,function(r,o){var i=t(r,o,e);n[i.k]=i.v}),n},E=function(e,t){var n=[];return N(e,function(e,r){n.push(t(e,r))}),n},B=function(e){return E(e,function(e){return e})},I={bifilter:function(e,t){var n={},r={};return N(e,function(e,o){(t(e,o)?n:r)[o]=e}),{t:n,f:r}},each:N,map:function(e,t){return O(e,function(e,n,r){return{k:n,v:t(e,n,r)}})},mapToArray:E,tupleMap:O,find:function(e,t){for(var n=k(e),r=0,o=n.length;r<o;r++){var i=n[r],u=e[i];if(t(u,i,e))return g.some(u)}return g.none()},keys:k,values:B,size:function(e){return B(e).length}},P=function(e){return function(t){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&Array.prototype.isPrototypeOf(e)?"array":"object"===t&&String.prototype.isPrototypeOf(e)?"string":t}(t)===e}},W={isString:P("string"),isObject:P("object"),isArray:P("array"),isNull:P("null"),isBoolean:P("boolean"),isUndefined:P("undefined"),isFunction:P("function"),isNumber:P("number")},_=function(e){return e.slice(0).sort()},M={sort:_,reqMessage:function(e,t){throw new Error("All required keys ("+_(e).join(", ")+") were not specified. Specified keys were: "+_(t).join(", ")+".")},unsuppMessage:function(e){throw new Error("Unsupported keys for object: "+_(e).join(", "))},validateStrArr:function(e,t){if(!W.isArray(t))throw new Error("The "+e+" fields must be an array. Was: "+t+".");A.each(t,function(t){if(!W.isString(t))throw new Error("The value "+t+" in the "+e+" fields was not a string.")})},invalidTypeMessage:function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+_(e).join(", ")+") were not.")},checkDupes:function(e){var t=_(e);A.find(t,function(e,n){return n<t.length-1&&e===t[n+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+t.join(", ")+"].")})}},L={immutable:function(){var e=arguments;return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(e.length!==t.length)throw new Error('Wrong number of arguments to struct. Expected "['+e.length+']", got '+t.length+" arguments");var r={};return A.each(e,function(e,n){r[e]=c.constant(t[n])}),r}},immutableBag:function(e,t){var n=e.concat(t);if(0===n.length)throw new Error("You must specify at least one required or optional field.");return M.validateStrArr("required",e),M.validateStrArr("optional",t),M.checkDupes(n),function(r){var o=I.keys(r);A.forall(e,function(e){return A.contains(o,e)})||M.reqMessage(e,o);var i=A.filter(o,function(e){return!A.contains(n,e)});i.length>0&&M.unsuppMessage(i);var u={};return A.each(e,function(e){u[e]=c.constant(r[e])}),A.each(t,function(e){u[e]=c.constant(Object.prototype.hasOwnProperty.call(r,e)?g.some(r[e]):g.none())}),u}}},q=L.immutable("width","height"),z=L.immutable("rows","columns"),F=L.immutable("row","column"),j=L.immutable("x","y"),H=L.immutable("element","rowspan","colspan"),V=L.immutable("element","rowspan","colspan","isNew"),U={dimensions:q,grid:z,address:F,coords:j,extended:L.immutable("element","rowspan","colspan","row","column"),detail:H,detailnew:V,rowdata:L.immutable("element","cells","section"),elementnew:L.immutable("element","isNew"),rowdatanew:L.immutable("element","cells","section","isNew"),rowcells:L.immutable("cells","section"),rowdetails:L.immutable("details","section"),bounds:L.immutable("startRow","startCol","finishRow","finishCol")},G=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:c.constant(e)}},X={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||n.childNodes.length>1)throw console.error("HTML does not have a single root node",e),"HTML must have a single root node";return G(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return G(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return G(n)},fromDom:G,fromPoint:function(e,t,n){return g.from(e.dom().elementFromPoint(t,n)).map(G)}},Y=8,$=9,K=1,J=3,Q=K,Z=$,ee=function(e){return e.nodeType!==Q&&e.nodeType!==Z||0===e.childElementCount},te={all:function(e,t){var n=t===undefined?document:t.dom();return ee(n)?[]:A.map(n.querySelectorAll(e),X.fromDom)},is:function(e,t){var n=e.dom();if(n.nodeType!==Q)return!1;if(n.matches!==undefined)return n.matches(t);if(n.msMatchesSelector!==undefined)return n.msMatchesSelector(t);if(n.webkitMatchesSelector!==undefined)return n.webkitMatchesSelector(t);if(n.mozMatchesSelector!==undefined)return n.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},one:function(e,t){var n=t===undefined?document:t.dom();return ee(n)?g.none():g.from(n.querySelector(e)).map(X.fromDom)}},ne=function(e,t){var n=[],r=function(e){return n.push(e),t(e)},o=t(e);do{o=o.bind(r)}while(o.isSome());return n},re="undefined"!=typeof window?window:Function("return this;")(),oe=function(e,t){for(var n=t!==undefined&&null!==t?t:re,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n},ie=function(e,t){var n=e.split(".");return oe(n,t)},ue=function(e,t){var n=ie(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},ae=function(){return ue("Node")},ce=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},le=function(e,t){return ce(e,t,ae().DOCUMENT_POSITION_CONTAINED_BY)},se=function(e){var t,n=!1;return function(){return n||(n=!0,t=e.apply(null,arguments)),t}},fe=function(e,t){var n=function(e,t){for(var n=0;n<e.length;n++){var r=e[n];if(r.test(t))return r}return undefined}(e,t);if(!n)return{major:0,minor:0};var r=function(e){return Number(t.replace(n,"$"+e))};return me(r(1),r(2))},de=function(){return me(0,0)},me=function(e,t){return{major:e,minor:t}},ge={nu:me,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?de():fe(e,n)},unknown:de},pe="Firefox",he=function(e,t){return function(){return t===e}},ve=function(e){var t=e.current;return{current:t,version:e.version,isEdge:he("Edge",t),isChrome:he("Chrome",t),isIE:he("IE",t),isOpera:he("Opera",t),isFirefox:he(pe,t),isSafari:he("Safari",t)}},be={unknown:function(){return ve({current:undefined,version:ge.unknown()})},nu:ve,edge:c.constant("Edge"),chrome:c.constant("Chrome"),ie:c.constant("IE"),opera:c.constant("Opera"),firefox:c.constant(pe),safari:c.constant("Safari")},we="Windows",ye="Android",xe="Solaris",Se="FreeBSD",Ce=function(e,t){return function(){return t===e}},Re=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Ce(we,t),isiOS:Ce("iOS",t),isAndroid:Ce(ye,t),isOSX:Ce("OSX",t),isLinux:Ce("Linux",t),isSolaris:Ce(xe,t),isFreeBSD:Ce(Se,t)}},Te={unknown:function(){return Re({current:undefined,version:ge.unknown()})},nu:Re,windows:c.constant(we),ios:c.constant("iOS"),android:c.constant(ye),linux:c.constant("Linux"),osx:c.constant("OSX"),solaris:c.constant(xe),freebsd:c.constant(Se)},De=function(e,t){var n=String(t).toLowerCase();return A.find(e,function(e){return e.search(n)})},Ae=function(e,t){return De(e,t).map(function(e){var n=ge.detect(e.versionRegexes,t);return{current:e.name,version:n}})},ke=function(e,t){return De(e,t).map(function(e){var n=ge.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Ne=function(e,t){return t+e},Oe=function(e,t){return e+t},Ee=function(e,t){return e.substring(t)},Be=function(e,t){return e.substring(0,e.length-t)},Ie=function(e){return""===e?g.none():g.some(e.substr(0,1))},Pe=function(e){return""===e?g.none():g.some(e.substring(1))},We=function(e,t,n){return""===t||!(e.length<t.length)&&e.substr(n,n+t.length)===t},_e=function(e,t){return We(e,t,0)},Me=function(e,t){return We(e,t,e.length-t.length)},Le={supplant:function(e,t){return e.replace(/\${([^{}]*)}/g,function(e,n){var r,o=t[n];return"string"==(r=typeof o)||"number"===r?o:e})},startsWith:_e,removeLeading:function(e,t){return _e(e,t)?Ee(e,t.length):e},removeTrailing:function(e,t){return Me(e,t)?Be(e,t.length):e},ensureLeading:function(e,t){return _e(e,t)?e:Ne(e,t)},ensureTrailing:function(e,t){return Me(e,t)?e:Oe(e,t)},endsWith:Me,contains:function(e,t){return-1!==e.indexOf(t)},trim:function(e){return e.replace(/^\s+|\s+$/g,"")},lTrim:function(e){return e.replace(/^\s+/g,"")},rTrim:function(e){return e.replace(/\s+$/g,"")},capitalize:function(e){return Ie(e).bind(function(t){return Pe(e).map(function(e){return t.toUpperCase()+e})}).getOr(e)}},qe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,ze=function(e){return function(t){return Le.contains(t,e)}},Fe=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Le.contains(e,"edge/")&&Le.contains(e,"chrome")&&Le.contains(e,"safari")&&Le.contains(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,qe],search:function(e){return Le.contains(e,"chrome")&&!Le.contains(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Le.contains(e,"msie")||Le.contains(e,"trident")}},{name:"Opera",versionRegexes:[qe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:ze("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:ze("firefox")},{name:"Safari",versionRegexes:[qe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Le.contains(e,"safari")||Le.contains(e,"mobile/"))&&Le.contains(e,"applewebkit")}}],je=[{name:"Windows",search:ze("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Le.contains(e,"iphone")||Le.contains(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:ze("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:ze("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:ze("linux"),versionRegexes:[]},{name:"Solaris",search:ze("sunos"),versionRegexes:[]},{name:"FreeBSD",search:ze("freebsd"),versionRegexes:[]}],He={browsers:c.constant(Fe),oses:c.constant(je)},Ve=function(e){var t,n,r,o,i,u,a,l,s,f,d,m=He.browsers(),g=He.oses(),p=Ae(m,e).fold(be.unknown,be.nu),h=ke(g,e).fold(Te.unknown,Te.nu);return{browser:p,os:h,deviceType:(n=p,r=e,o=(t=h).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,l=o||u||a&&!0===/mobile/i.test(r),s=t.isiOS()||t.isAndroid(),f=s&&!l,d=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:c.constant(o),isiPhone:c.constant(i),isTablet:c.constant(l),isPhone:c.constant(f),isTouch:c.constant(s),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:c.constant(d)})}},Ue={detect:se(function(){var e=navigator.userAgent;return Ve(e)})},Ge=function(e,t){return e.dom()===t.dom()},Xe=Ue.detect().browser.isIE()?function(e,t){return le(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},Ye={eq:Ge,isEqualNode:function(e,t){return e.dom().isEqualNode(t.dom())},member:function(e,t){return A.exists(t,c.curry(Ge,e))},contains:Xe,is:te.is},$e=function(e){return X.fromDom(e.dom().ownerDocument)},Ke=function(e){var t=e.dom();return g.from(t.parentNode).map(X.fromDom)},Je=function(e){var t=e.dom();return g.from(t.previousSibling).map(X.fromDom)},Qe=function(e){var t=e.dom();return g.from(t.nextSibling).map(X.fromDom)},Ze=function(e){var t=e.dom();return A.map(t.childNodes,X.fromDom)},et=function(e,t){var n=e.dom().childNodes;return g.from(n[t]).map(X.fromDom)},tt=L.immutable("element","offset"),nt={owner:$e,defaultView:function(e){var t=e.dom().ownerDocument.defaultView;return X.fromDom(t)},documentElement:function(e){var t=$e(e);return X.fromDom(t.dom().documentElement)},parent:Ke,findIndex:function(e){return Ke(e).bind(function(t){var n=Ze(t);return A.findIndex(n,function(t){return Ye.eq(e,t)})})},parents:function(e,t){for(var n=W.isFunction(t)?t:c.constant(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=X.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},siblings:function(e){return Ke(e).map(Ze).map(function(t){return A.filter(t,function(t){return!Ye.eq(e,t)})}).getOr([])},prevSibling:Je,offsetParent:function(e){var t=e.dom();return g.from(t.offsetParent).map(X.fromDom)},prevSiblings:function(e){return A.reverse(ne(e,Je))},nextSibling:Qe,nextSiblings:function(e){return ne(e,Qe)},children:Ze,child:et,firstChild:function(e){return et(e,0)},lastChild:function(e){return et(e,e.dom().childNodes.length-1)},childNodesCount:function(e){return e.dom().childNodes.length},hasChildNodes:function(e){return e.dom().hasChildNodes()},leaf:function(e,t){var n=Ze(e);return n.length>0&&t<n.length?tt(n[t],0):tt(e,t)}},rt=function(e,t,n){return A.bind(nt.children(e),function(e){return te.is(e,t)?n(e)?[e]:[]:rt(e,t,n)})},ot={firstLayer:function(e,t){return rt(e,t,c.constant(!0))},filterFirstLayer:rt},it=function(e){return e.dom().nodeName.toLowerCase()},ut=function(e){return e.dom().nodeType},at=function(e){return function(t){return ut(t)===e}},ct=at(K),lt=at(J),st=at($),ft={name:it,type:ut,value:function(e){return e.dom().nodeValue},isElement:ct,isText:lt,isDocument:st,isComment:function(e){return ut(e)===Y||"#comment"===it(e)}},dt=function(e,t,n){if(!(W.isString(n)||W.isBoolean(n)||W.isNumber(n)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},mt=function(e,t,n){dt(e.dom(),t,n)},gt=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},pt=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},ht={clone:function(e){return A.foldl(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},set:mt,setAll:function(e,t){var n=e.dom();I.each(t,function(e,t){dt(n,t,e)})},get:gt,has:pt,remove:function(e,t){e.dom().removeAttribute(t)},hasNone:function(e){var t=e.dom().attributes;return t===undefined||null===t||0===t.length},transfer:function(e,t,n){ft.isElement(e)&&ft.isElement(t)&&A.each(n,function(n){var r,o,i;o=t,pt(r=e,i=n)&&!pt(o,i)&&mt(o,i,gt(r,i))})}},vt=se(function(){return bt(X.fromDom(document))}),bt=function(e){var t=e.dom().body;if(null===t||t===undefined)throw"Body is not available yet";return X.fromDom(t)},wt={body:vt,getBody:bt,inBody:function(e){var t=ft.isText(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)}},yt=function(e,t){var n=[];return A.each(nt.children(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(yt(e,t))}),n},xt={all:function(e){return yt(wt.body(),e)},ancestors:function(e,t,n){return A.filter(nt.parents(e,n),t)},siblings:function(e,t){return A.filter(nt.siblings(e),t)},children:function(e,t){return A.filter(nt.children(e),t)},descendants:yt},St={all:function(e){return te.all(e)},ancestors:function(e,t,n){return xt.ancestors(e,function(e){return te.is(e,t)},n)},siblings:function(e,t){return xt.siblings(e,function(e){return te.is(e,t)})},children:function(e,t){return xt.children(e,function(e){return te.is(e,t)})},descendants:function(e,t){return te.all(t,e)}};function Ct(e,t,n,r,o){return e(n,r)?g.some(n):W.isFunction(o)&&o(n)?g.none():t(n,r,o)}var Rt,Tt,Dt,At,kt,Nt=function(e,t,n){for(var r=e.dom(),o=W.isFunction(n)?n:c.constant(!1);r.parentNode;){r=r.parentNode;var i=X.fromDom(r);if(t(i))return g.some(i);if(o(i))break}return g.none()},Ot=function(e,t){return A.find(e.dom().childNodes,c.compose(t,X.fromDom)).map(X.fromDom)},Et=function(e,t){var n=function(e){for(var r=0;r<e.childNodes.length;r++){if(t(X.fromDom(e.childNodes[r])))return g.some(X.fromDom(e.childNodes[r]));var o=n(e.childNodes[r]);if(o.isSome())return o}return g.none()};return n(e.dom())},Bt={first:function(e){return Et(wt.body(),e)},ancestor:Nt,closest:function(e,t,n){return Ct(function(e){return t(e)},Nt,e,t,n)},sibling:function(e,t){var n=e.dom();return n.parentNode?Ot(X.fromDom(n.parentNode),function(n){return!Ye.eq(e,n)&&t(n)}):g.none()},child:Ot,descendant:Et},It=function(e,t,n){return Bt.ancestor(e,function(e){return te.is(e,t)},n)},Pt={first:function(e){return te.one(e)},ancestor:It,sibling:function(e,t){return Bt.sibling(e,function(e){return te.is(e,t)})},child:function(e,t){return Bt.child(e,function(e){return te.is(e,t)})},descendant:function(e,t){return te.one(t,e)},closest:function(e,t,n){return Ct(te.is,It,e,t,n)}},Wt=function(e,t,n){var r=n!==undefined?n:c.constant(!1);return r(t)?g.none():A.contains(e,ft.name(t))?g.some(t):Pt.ancestor(t,e.join(","),function(e){return te.is(e,"table")||r(e)})},_t=function(e,t){return nt.parent(t).map(function(t){return St.children(t,e)})},Mt=function(e,t){return parseInt(ht.get(e,t),10)},Lt={cell:function(e,t){return Wt(["td","th"],e,t)},firstCell:function(e){return Pt.descendant(e,"th,td")},cells:function(e){return ot.firstLayer(e,"th,td")},neighbourCells:c.curry(_t,"th,td"),table:function(e,t){return Pt.closest(e,"table",t)},row:function(e,t){return Wt(["tr"],e,t)},rows:function(e){return ot.firstLayer(e,"tr")},notCell:function(e,t){return Wt(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:c.curry(_t,"tr"),attr:Mt,grid:function(e,t,n){var r=Mt(e,t),o=Mt(e,n);return U.grid(r,o)}},qt=function(e){var t=Lt.rows(e);return A.map(t,function(e){var t=e,n=nt.parent(t).bind(function(e){var t=ft.name(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}),r=A.map(Lt.cells(e),function(e){var t=ht.has(e,"rowspan")?parseInt(ht.get(e,"rowspan"),10):1,n=ht.has(e,"colspan")?parseInt(ht.get(e,"colspan"),10):1;return U.detail(e,t,n)});return U.rowdata(t,r,n)})},zt=function(e,t){return A.map(e,function(e){var n=A.map(Lt.cells(e),function(e){var t=ht.has(e,"rowspan")?parseInt(ht.get(e,"rowspan"),10):1,n=ht.has(e,"colspan")?parseInt(ht.get(e,"colspan"),10):1;return U.detail(e,t,n)});return U.rowdata(e,n,t.section())})},Ft=function(e,t){return e+","+t},jt=function(e,t){var n=A.bind(e.all(),function(e){return e.cells()});return A.filter(n,t)},Ht={generate:function(e){var t={},n=[],r=e.length,o=0;A.each(e,function(e,r){var i=[];A.each(e.cells(),function(e,n){for(var u=0;t[Ft(r,u)]!==undefined;)u++;for(var a=U.extended(e.element(),e.rowspan(),e.colspan(),r,u),c=0;c<e.colspan();c++)for(var l=0;l<e.rowspan();l++){var s=u+c,f=Ft(r+l,s);t[f]=a,o=Math.max(o,s+1)}i.push(a)}),n.push(U.rowdata(e.element(),i,e.section()))});var i=U.grid(r,o);return{grid:c.constant(i),access:c.constant(t),all:c.constant(n)}},getAt:function(e,t,n){var r=e.access()[Ft(t,n)];return r!==undefined?g.some(r):g.none()},findItem:function(e,t,n){var r=jt(e,function(e){return n(t,e.element())});return r.length>0?g.some(r[0]):g.none()},filterItems:jt,justCells:function(e){var t=A.map(e.all(),function(e){return e.cells()});return A.flatten(t)}},Vt={isSupported:function(e){return e.style!==undefined}},Ut=function(e,t,n){if(!W.isString(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);Vt.isSupported(e)&&e.style.setProperty(t,n)},Gt=function(e,t){Vt.isSupported(e)&&e.style.removeProperty(t)},Xt=function(e,t,n){var r=e.dom();Ut(r,t,n)},Yt=function(e,t){return Vt.isSupported(e)?e.style.getPropertyValue(t):""},$t=function(e,t){var n=e.dom(),r=Yt(n,t);return g.from(r).filter(function(e){return e.length>0})},Kt={copy:function(e,t){var n=e.dom(),r=t.dom();Vt.isSupported(n)&&Vt.isSupported(r)&&(r.style.cssText=n.style.cssText)},set:Xt,preserve:function(e,t){var n=ht.get(e,"style"),r=t(e);return(n===undefined?ht.remove:ht.set)(e,"style",n),r},setAll:function(e,t){var n=e.dom();I.each(t,function(e,t){Ut(n,t,e)})},setOptions:function(e,t){var n=e.dom();I.each(t,function(e,t){e.fold(function(){Gt(n,t)},function(e){Ut(n,t,e)})})},remove:function(e,t){var n=e.dom();Gt(n,t),ht.has(e,"style")&&""===Le.trim(ht.get(e,"style"))&&ht.remove(e,"style")},get:function(e,t){var n=e.dom(),r=window.getComputedStyle(n).getPropertyValue(t),o=""!==r||wt.inBody(e)?r:Yt(n,t);return null===o?undefined:o},getRaw:$t,getAllRaw:function(e){var t={},n=e.dom();if(Vt.isSupported(n))for(var r=0;r<n.style.length;r++){var o=n.style.item(r);t[o]=n.style[o]}return t},isValidValue:function(e,t,n){var r=X.fromTag(e);return Xt(r,t,n),$t(r,t).isSome()},reflow:function(e){return e.dom().offsetWidth},transfer:function(e,t,n){ft.isElement(e)&&ft.isElement(t)&&A.each(n,function(n){var r,o;r=t,$t(e,o=n).each(function(e){$t(r,o).isNone()&&Xt(r,o,e)})})}},Jt=function(e,t){nt.parent(e).each(function(n){n.dom().insertBefore(t.dom(),e.dom())})},Qt=function(e,t){e.dom().appendChild(t.dom())},Zt={before:Jt,after:function(e,t){nt.nextSibling(e).fold(function(){nt.parent(e).each(function(e){Qt(e,t)})},function(e){Jt(e,t)})},prepend:function(e,t){nt.firstChild(e).fold(function(){Qt(e,t)},function(n){e.dom().insertBefore(t.dom(),n.dom())})},append:Qt,appendAt:function(e,t,n){nt.child(e,n).fold(function(){Qt(e,t)},function(e){Jt(e,t)})},wrap:function(e,t){Jt(e,t),Qt(t,e)}},en={before:function(e,t){A.each(t,function(t){Zt.before(e,t)})},after:function(e,t){A.each(t,function(n,r){var o=0===r?e:t[r-1];Zt.after(o,n)})},prepend:function(e,t){A.each(t.slice().reverse(),function(t){Zt.prepend(e,t)})},append:function(e,t){A.each(t,function(t){Zt.append(e,t)})}},tn=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},nn={empty:function(e){e.dom().textContent="",A.each(nt.children(e),function(e){tn(e)})},remove:tn,unwrap:function(e){var t=nt.children(e);t.length>0&&en.before(e,t),tn(e)}},rn=L.immutable("minRow","minCol","maxRow","maxCol"),on=function(e,t){var n,r,o,i,u,a,c,l,s,f,d=function(e){return te.is(e.element(),t)},m=qt(e),g=Ht.generate(m),p=(r=d,o=(n=g).grid().columns(),i=n.grid().rows(),u=o,a=0,c=0,I.each(n.access(),function(e){if(r(e)){var t=e.row(),n=t+e.rowspan()-1,o=e.column(),l=o+e.colspan()-1;t<i?i=t:n>a&&(a=n),o<u?u=o:l>c&&(c=l)}}),rn(i,u,a,c)),h="th:not("+t+"),td:not("+t+")",v=ot.filterFirstLayer(e,"th,td",function(e){return te.is(e,h)});return A.each(v,nn.remove),function(e,t,n,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var s=!1,f=0;f<a;f++)l<n.minRow()||l>n.maxRow()||f<n.minCol()||f>n.maxCol()||(Ht.getAt(t,l,f).filter(r).isNone()?(o=s,i=e[l].element(),u=X.fromTag("td"),Zt.append(u,X.fromTag("br")),(o?Zt.append:Zt.prepend)(i,u)):s=!0)}(m,g,p,d),l=e,s=p,f=A.filter(ot.firstLayer(l,"tr"),function(e){return 0===e.dom().childElementCount}),A.each(f,nn.remove),s.minCol()!==s.maxCol()&&s.minRow()!==s.maxRow()||A.each(ot.firstLayer(l,"th,td"),function(e){ht.remove(e,"rowspan"),ht.remove(e,"colspan")}),ht.remove(l,"width"),ht.remove(l,"height"),Kt.remove(l,"width"),Kt.remove(l,"height"),e},un=function(e,t){return X.fromDom(e.dom().cloneNode(t))},an=function(e){return un(e,!0)},cn=function(e,t){var n=X.fromTag(t),r=ht.clone(e);return ht.setAll(n,r),n},ln=function(e){return un(e,!1)},sn=an,fn=function(e,t){var n=cn(e,t),r=nt.children(an(e));return en.append(n,r),n},dn=(Rt=ft.isText,Tt="text",Dt=function(e){return Rt(e)?g.from(e.dom().nodeValue):g.none()},At=Ue.detect().browser,{get:function(e){if(!Rt(e))throw new Error("Can only get "+Tt+" value of a "+Tt+" node");return kt(e).getOr("")},getOption:kt=At.isIE()&&10===At.version.major?function(e){try{return Dt(e)}catch(t){return g.none()}}:Dt,set:function(e,t){if(!Rt(e))throw new Error("Can only set raw "+Tt+" value of a "+Tt+" node");e.dom().nodeValue=t}}),mn={get:function(e){return dn.get(e)},getOption:function(e){return dn.getOption(e)},set:function(e,t){dn.set(e,t)}},gn=function(e){return"img"===ft.name(e)?1:mn.getOption(e).fold(function(){return nt.children(e).length},function(e){return e.length})},pn=["img","br"],hn=gn,vn=function(e){var t;return t=e,mn.getOption(t).filter(function(e){return 0!==e.trim().length||e.indexOf("\xa0")>-1}).isSome()||A.contains(pn,ft.name(e))},bn=function(e,t){var n=function(e){for(var r=nt.children(e),o=r.length-1;o>=0;o--){var i=r[o];if(t(i))return g.some(i);var u=n(i);if(u.isSome())return u}return g.none()};return n(e)},wn={first:function(e){return Bt.descendant(e,vn)},last:function(e){return bn(e,vn)}},yn=function(){var e=X.fromTag("td");return Zt.append(e,X.fromTag("br")),e},xn=function(e,t,n){var r=fn(e,t);return I.each(n,function(e,t){null===e?ht.remove(r,t):ht.set(r,t,e)}),r},Sn=function(e){return e},Cn=function(e){return function(){return X.fromTag("tr",e.dom())}},Rn={cellOperations:function(e,t,n){return{row:Cn(t),cell:function(t){var r,o,i,u=nt.owner(t.element()),a=X.fromTag(ft.name(t.element()),u.dom()),c=n.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),l=c.length>0?(r=t.element(),o=a,i=c,wn.first(r).map(function(e){var t=i.join(","),n=St.ancestors(e,t,function(e){return Ye.eq(e,r)});return A.foldr(n,function(e,t){var n=ln(t);return Zt.append(e,n),n},o)}).getOr(o)):a;return Zt.append(l,X.fromTag("br")),Kt.copy(t.element(),a),Kt.remove(a,"height"),1!==t.colspan()&&Kt.remove(t.element(),"width"),e(t.element(),a),a},replace:xn,gap:yn}},paste:function(e){return{row:Cn(e),cell:yn,replace:Sn,gap:yn}}},Tn=function(e,t){var n=(t||document).createElement("div");return n.innerHTML=e,nt.children(X.fromDom(n))},Dn=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","li","table","thead","tbody","tfoot","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"];function An(){return{up:c.constant({selector:Pt.ancestor,closest:Pt.closest,predicate:Bt.ancestor,all:nt.parents}),down:c.constant({selector:St.descendants,predicate:xt.descendants}),styles:c.constant({get:Kt.get,getRaw:Kt.getRaw,set:Kt.set,remove:Kt.remove}),attrs:c.constant({get:ht.get,set:ht.set,remove:ht.remove,copyTo:function(e,t){var n=ht.clone(e);ht.setAll(t,n)}}),insert:c.constant({before:Zt.before,after:Zt.after,afterAll:en.after,append:Zt.append,appendAll:en.append,prepend:Zt.prepend,wrap:Zt.wrap}),remove:c.constant({unwrap:nn.unwrap,remove:nn.remove}),create:c.constant({nu:X.fromTag,clone:function(e){return X.fromDom(e.dom().cloneNode(!1))},text:X.fromText}),query:c.constant({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:nt.prevSibling,nextSibling:nt.nextSibling}),property:c.constant({children:nt.children,name:ft.name,parent:nt.parent,isText:ft.isText,isComment:ft.isComment,isElement:ft.isElement,getText:mn.get,setText:mn.set,isBoundary:function(e){return!!ft.isElement(e)&&("body"===ft.name(e)||A.contains(Dn,ft.name(e)))},isEmptyTag:function(e){return!!ft.isElement(e)&&A.contains(["br","img","hr","input"],ft.name(e))}}),eq:Ye.eq,is:Ye.is}}L.immutable("left","right");var kn=function(e,t,n,r){var o=t(e,n);return A.foldr(r,function(n,r){var o=t(e,r);return Nn(e,n,o)},o)},Nn=function(e,t,n){return t.bind(function(t){return n.filter(c.curry(e.eq,t))})},On=function(e,t,n){return n.length>0?kn(e,t,(r=n)[0],r.slice(1)):g.none();var r},En=function(e,t){return c.curry(e.eq,t)},Bn=function(e,t,n,r){var o=r!==undefined?r:c.constant(!1),i=[t].concat(e.up().all(t)),u=[n].concat(e.up().all(n)),a=function(e){return A.findIndex(e,o).fold(function(){return e},function(t){return e.slice(0,t+1)})},l=a(i),s=a(u),f=A.find(l,function(t){return A.exists(s,En(e,t))});return{firstpath:c.constant(l),secondpath:c.constant(s),shared:c.constant(f)}},In=Bn,Pn=function(e,t,n){return On(e,t,n)},Wn=function(e,t,n,r){return In(e,t,n,r)},_n=An(),Mn=function(e,t){return Pn(_n,function(t,n){return e(n)},t)},Ln=function(e,t,n){return Wn(_n,e,t,n)},qn=function(e,t){return t.column()>=e.startCol()&&t.column()+t.colspan()-1<=e.finishCol()&&t.row()>=e.startRow()&&t.row()+t.rowspan()-1<=e.finishRow()},zn=function(e,t){var n=t.column(),r=t.column()+t.colspan()-1,o=t.row(),i=t.row()+t.rowspan()-1;return n<=e.finishCol()&&r>=e.startCol()&&o<=e.finishRow()&&i>=e.startRow()},Fn=function(e,t){for(var n=!0,r=c.curry(qn,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&Ht.getAt(e,o,i).exists(r);return n?g.some(t):g.none()},jn=function(e,t,n){var r=Ht.findItem(e,t,Ye.eq),o=Ht.findItem(e,n,Ye.eq);return r.bind(function(e){return o.map(function(t){return n=e,r=t,U.bounds(Math.min(n.row(),r.row()),Math.min(n.column(),r.column()),Math.max(n.row()+n.rowspan()-1,r.row()+r.rowspan()-1),Math.max(n.column()+n.colspan()-1,r.column()+r.colspan()-1));var n,r})})},Hn=jn,Vn=function(e,t,n){return jn(e,t,n).bind(function(t){return Fn(e,t)})},Un=function(e,t,n,r){return Ht.findItem(e,t,Ye.eq).bind(function(t){var o=n>0?t.row()+t.rowspan()-1:t.row(),i=r>0?t.column()+t.colspan()-1:t.column();return Ht.getAt(e,o+n,i+r).map(function(e){return e.element()})})},Gn=function(e,t,n){return Hn(e,t,n).map(function(t){var n=Ht.filterItems(e,c.curry(zn,t));return A.map(n,function(e){return e.element()})})},Xn=function(e,t){return Ht.findItem(e,t,function(e,t){return Ye.contains(t,e)}).bind(function(e){return e.element()})},Yn=function(e){var t=qt(e);return Ht.generate(t)},$n=function(e,t,n){return Lt.table(e).bind(function(r){var o=Yn(r);return Un(o,e,t,n)})},Kn=function(e,t,n){var r=Yn(e);return Gn(r,t,n)},Jn=function(e,t,n,r,o){var i=Yn(e),u=Ye.eq(e,n)?t:Xn(i,t),a=Ye.eq(e,o)?r:Xn(i,r);return Gn(i,u,a)},Qn=function(e,t,n){var r=Yn(e);return Vn(r,t,n)},Zn=function(e,t){return Pt.ancestor(e,"table")},er=L.immutableBag(["boxes","start","finish"],[]),tr=function(e,t,n){var r=function(e){return function(t){return n(t)||Ye.eq(t,e)}};return Ye.eq(e,t)?g.some(er({boxes:g.some([e]),start:e,finish:t})):Zn(e).bind(function(o){return Zn(t).bind(function(i){if(Ye.eq(o,i))return g.some(er({boxes:Kn(o,e,t),start:e,finish:t}));if(Ye.contains(o,i)){var u=(a=St.ancestors(t,"td,th",r(o))).length>0?a[a.length-1]:t;return g.some(er({boxes:Jn(o,e,o,t,i),start:e,finish:u}))}if(Ye.contains(i,o)){var a,c=(a=St.ancestors(e,"td,th",r(i))).length>0?a[a.length-1]:e;return g.some(er({boxes:Jn(i,e,o,t,i),start:e,finish:c}))}return Ln(e,t).shared().bind(function(u){return Pt.closest(u,"table",n).bind(function(n){var u=St.ancestors(t,"td,th",r(n)),a=u.length>0?u[u.length-1]:t,c=St.ancestors(e,"td,th",r(n)),l=c.length>0?c[c.length-1]:e;return g.some(er({boxes:Jn(n,e,o,t,i),start:l,finish:a}))})})})})},nr={identify:tr,retrieve:function(e,t){var n=St.descendants(e,t);return n.length>0?g.some(n):g.none()},shiftSelection:function(e,t,n,r,o){return(i=e,u=o,A.find(i,function(e){return te.is(e,u)})).bind(function(e){return $n(e,t,n).bind(function(e){return t=e,n=r,Pt.ancestor(t,"table").bind(function(e){return Pt.descendant(e,n).bind(function(e){return tr(e,t).bind(function(e){return e.boxes().map(function(t){return{boxes:c.constant(t),start:c.constant(e.start()),finish:c.constant(e.finish())}})})})});var t,n})});var i,u},getEdges:function(e,t,n){return Pt.descendant(e,t).bind(function(t){return Pt.descendant(e,n).bind(function(e){return Mn(Zn,[t,e]).map(function(n){return{first:c.constant(t),last:c.constant(e),table:c.constant(n)}})})})}},rr={retrieve:function(e,t){return nr.retrieve(e,t)},retrieveBox:function(e,t,n){return nr.getEdges(e,t,n).bind(function(t){var n=function(t){return Ye.eq(e,t)},r=Pt.ancestor(t.first(),"thead,tfoot,tbody,table",n),o=Pt.ancestor(t.last(),"thead,tfoot,tbody,table",n);return r.bind(function(e){return o.bind(function(n){return Ye.eq(e,n)?Qn(t.table(),t.first(),t.last()):g.none()})})})}},or="data-mce-selected",ir="data-mce-first-selected",ur="data-mce-last-selected",ar={selected:c.constant(or),selectedSelector:c.constant("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:c.constant("[data-mce-selected]"),firstSelected:c.constant(ir),firstSelectedSelector:c.constant("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:c.constant(ur),lastSelectedSelector:c.constant("td[data-mce-last-selected],th[data-mce-last-selected]")},cr=function(e){if(!W.isArray(e))throw new Error("cases must be an array");if(0===e.length)throw new Error("there must be at least one case");var t=[],n={};return A.each(e,function(r,o){var i=I.keys(r);if(1!==i.length)throw new Error("one and only one name per case");var u=i[0],a=r[u];if(n[u]!==undefined)throw new Error("duplicate key detected:"+u);if("cata"===u)throw new Error("cannot have a case named cata (sorry)");if(!W.isArray(a))throw new Error("case arguments must be an array");t.push(u),n[u]=function(){var n=arguments.length;if(n!==a.length)throw new Error("Wrong number of arguments to case "+u+". Expected "+a.length+" ("+a+"), got "+n);for(var r=new Array(n),i=0;i<r.length;i++)r[i]=arguments[i];return{fold:function(){if(arguments.length!==e.length)throw new Error("Wrong number of arguments to fold. Expected "+e.length+", got "+arguments.length);return arguments[o].apply(null,r)},match:function(e){var n=I.keys(e);if(t.length!==n.length)throw new Error("Wrong number of arguments to match. Expected: "+t.join(",")+"\nActual: "+n.join(","));if(!A.forall(t,function(e){return A.contains(n,e)}))throw new Error("Not all branches were specified when using match. Specified: "+n.join(", ")+"\nRequired: "+t.join(", "));return e[u].apply(null,r)},log:function(e){console.log(e,{constructors:t,constructor:u,params:r})}}}}),n},lr=cr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),sr={cata:function(e,t,n,r){return e.fold(t,n,r)},none:lr.none,multiple:lr.multiple,single:lr.single},fr=function(e,t){return sr.cata(t.get(),c.constant([]),c.identity,c.constant([e]))},dr=function(e,t){return sr.cata(t.get(),g.none,function(t,n){return 0===t.length?g.none():rr.retrieveBox(e,ar.firstSelectedSelector(),ar.lastSelectedSelector()).bind(function(e){return t.length>1?g.some({bounds:c.constant(e),cells:c.constant(t)}):g.none()})},g.none)},mr=function(e,t){var n=fr(e,t);return n.length>0&&A.forall(n,function(e){return ht.has(e,"rowspan")&&parseInt(ht.get(e,"rowspan"),10)>1||ht.has(e,"colspan")&&parseInt(ht.get(e,"colspan"),10)>1})?g.some(n):g.none()},gr=fr,pr=function(e){return{element:c.constant(e),mergable:g.none,unmergable:g.none,selection:c.constant([e])}},hr=L.immutable("element","clipboard","generators"),vr={noMenu:pr,forMenu:function(e,t,n){return{element:c.constant(n),mergable:c.constant(dr(t,e)),unmergable:c.constant(mr(n,e)),selection:c.constant(gr(n,e))}},notCell:function(e){return pr(e)},paste:hr,pasteRows:function(e,t,n,r,o){return{element:c.constant(n),mergable:g.none,unmergable:g.none,selection:c.constant(gr(n,e)),clipboard:c.constant(r),generators:c.constant(o)}}},br={registerEvents:function(e,t,n,r){e.on("BeforeGetContent",function(n){!0===n.selection&&sr.cata(t.get(),c.noop,function(t){var r;n.preventDefault(),(r=t,Lt.table(r[0]).map(sn).map(function(e){return[on(e,ar.attributeSelector())]})).each(function(t){n.content=A.map(t,function(t){return n=t,e.selection.serializer.serialize(n.dom(),{});var n}).join("")})},c.noop)}),e.on("BeforeSetContent",function(t){!0===t.selection&&!0===t.paste&&g.from(e.dom.getParent(e.selection.getStart(),"th,td")).each(function(o){var i=X.fromDom(o);Lt.table(i).bind(function(o){var u=A.filter(Tn(t.content),function(e){return"meta"!==ft.name(e)});if(1===u.length&&"table"===ft.name(u[0])){t.preventDefault();var a=X.fromDom(e.getDoc()),c=Rn.paste(a),l=vr.paste(i,u[0],c);n.pasteCells(o,l).each(function(t){e.selection.setRng(t),e.focus(),r.clear(o)})}})})})}},wr={render:function(e,t,n,r){var o=X.fromTag("table");Kt.setAll(o,{"border-collapse":"collapse",width:"100%"}),ht.set(o,"border","1");var i=X.fromTag("tbody");Zt.append(o,i);for(var u=[],a=0;a<e;a++){for(var c=X.fromTag("tr"),l=0;l<t;l++){var s=a<n||l<r?X.fromTag("th"):X.fromTag("td");l<r&&ht.set(s,"scope","row"),a<n&&ht.set(s,"scope","col"),Zt.append(s,X.fromTag("br")),Kt.set(s,"width",100/t+"%"),Zt.append(c,s)}u.push(c)}return en.append(i,u),o}},yr=function(e){return e.dom().innerHTML},xr=function(e){var t=X.fromTag("div"),n=X.fromDom(e.dom().cloneNode(!0));return Zt.append(t,n),yr(t)},Sr=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},Cr={insert:function(e,t,n){var r,o=wr.render(n,t,0,0);ht.set(o,"id","__mce");var i,u,a=xr(o);return e.insertContent(a),r=e.dom.get("__mce"),e.dom.setAttrib(r,"id",null),e.$("tr",r).each(function(t,n){e.fire("newrow",{node:n}),e.$("th,td",n).each(function(t,n){e.fire("newcell",{node:n})})}),e.dom.setAttribs(r,e.settings.table_default_attributes||{}),e.dom.setStyles(r,e.settings.table_default_styles||{}),i=e,u=X.fromDom(r),Pt.descendant(u,"td,th").each(c.curry(Sr,i)),r}};function Rr(e,t){var n=function(n){var r=t(n);if(r<=0||null===r){var o=Kt.get(n,e);return parseFloat(o)||0}return r},r=function(e,t){return A.foldl(t,function(t,n){var r=Kt.get(e,n),o=r===undefined?0:parseInt(r,10);return isNaN(o)?t:t+o},0)};return{set:function(t,n){if(!W.isNumber(n)&&!n.match(/^[0-9]+$/))throw e+".set accepts only positive integer values. Value was "+n;var r=t.dom();Vt.isSupported(r)&&(r.style[e]=n+"px")},get:n,getOuter:n,aggregate:r,max:function(e,t,n){var o=r(e,n);return t>o?t-o:0}}}var Tr=Rr("height",function(e){return wt.inBody(e)?e.dom().getBoundingClientRect().height:e.dom().offsetHeight}),Dr=function(e){return Tr.get(e)},Ar=function(e){return Tr.getOuter(e)},kr=Rr("width",function(e){return e.dom().offsetWidth}),Nr=function(e){return kr.get(e)},Or=function(e){return kr.getOuter(e)},Er=Ue.detect(),Br=function(e,t,n){return r=Kt.get(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},Ir=function(e){return Er.browser.isIE()||Er.browser.isEdge()?(n=Br(t=e,"padding-top",0),r=Br(t,"padding-bottom",0),o=Br(t,"border-top-width",0),i=Br(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===Kt.get(t,"box-sizing")?u:u-n-r-(o+i)):Br(e,"height",Dr(e));var t,n,r,o,i,u},Pr=/(\d+(\.\d+)?)(\w|%)*/,Wr=/(\d+(\.\d+)?)%/,_r=/(\d+(\.\d+)?)px|em/,Mr=function(e,t){Kt.set(e,"height",t+"px")},Lr=function(e,t,n,r){var o,i,u,a,c,l=parseInt(e,10);return Le.endsWith(e,"%")&&"table"!==ft.name(t)?(o=t,i=l,u=n,a=r,c=Lt.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),a(o,c),c):l},qr=function(e){var t,n=(t=e,Kt.getRaw(t,"height").getOrThunk(function(){return Ir(t)+"px"}));return n?Lr(n,e,Dr,Mr):Dr(e)},zr=function(e,t){return ht.has(e,t)?parseInt(ht.get(e,t),10):1},Fr=function(e){return Kt.getRaw(e,"width").fold(function(){return g.from(ht.get(e,"width"))},function(e){return g.some(e)})},jr=function(e,t){return e/t.pixelWidth()*100},Hr={percentageBasedSizeRegex:c.constant(Wr),pixelBasedSizeRegex:c.constant(_r),setPixelWidth:function(e,t){Kt.set(e,"width",t+"px")},setPercentageWidth:function(e,t){Kt.set(e,"width",t+"%")},setHeight:Mr,getPixelWidth:function(e,t){return Fr(e).fold(function(){var t=Nr(e);return parseInt(t,10)},function(n){return function(e,t,n){if(_r.test(t)){var r=_r.exec(t);return parseInt(r[1],10)}if(Wr.test(t)){var o=Wr.exec(t),i=parseFloat(o[1]);return i/100*n.pixelWidth()}var u=Nr(e);return parseInt(u,10)}(e,n,t)})},getPercentageWidth:function(e,t){return Fr(e).fold(function(){var n=Nr(e),r=parseInt(n,10);return jr(r,t)},function(n){return function(e,t,n){if(Wr.test(t)){var r=Wr.exec(t);return parseFloat(r[1])}var o=Nr(e),i=parseInt(o,10);return jr(i,n)}(e,n,t)})},getGenericWidth:function(e){return Fr(e).bind(function(e){if(Pr.test(e)){var t=Pr.exec(e);return g.some({width:c.constant(t[1]),unit:c.constant(t[3])})}return g.none()})},setGenericWidth:function(e,t,n){Kt.set(e,"width",t+n)},getHeight:function(e){return n="rowspan",qr(t=e)/zr(t,n);var t,n},getRawWidth:Fr},Vr={halve:function(e,t){Hr.getGenericWidth(e).each(function(n){var r=n.width()/2;Hr.setGenericWidth(e,r,n.unit()),Hr.setGenericWidth(t,r,n.unit())})}},Ur=function(e,t){var n=t||X.fromDom(document.documentElement);return Bt.ancestor(e,c.curry(Ye.eq,n)).isSome()},Gr=function(e){var t=e.dom();return t===t.window?e:ft.isDocument(e)?t.defaultView||t.parentWindow:null},Xr=function(e,t){return{left:c.constant(e),top:c.constant(t),translate:function(n,r){return Xr(e+n,t+r)}}},Yr=function(e,t){return e!==undefined?e:t!==undefined?t:0},$r=function(e){var t,n=e.dom(),r=n.ownerDocument,o=r.body,i=X.fromDom(r.documentElement);return o===n?Xr(o.offsetLeft,o.offsetTop):Ur(e,i)?(t=n.getBoundingClientRect(),Xr(t.left,t.top)):Xr(0,0)},Kr=function(e){var t=e.dom().ownerDocument,n=t.body,r=Gr(X.fromDom(t)),o=t.documentElement,i=Yr(r.pageYOffset,o.scrollTop),u=Yr(r.pageXOffset,o.scrollLeft),a=Yr(o.clientTop,n.clientTop),c=Yr(o.clientLeft,n.clientLeft);return $r(e).translate(u-c,i-a)},Jr=L.immutable("row","y"),Qr=L.immutable("col","x"),Zr=function(e){return Kr(e).left()+Or(e)},eo=function(e){return Kr(e).left()},to=function(e,t){return Qr(e,eo(t))},no=function(e,t){return Qr(e,Zr(t))},ro=function(e){return Kr(e).top()},oo=function(e,t,n){if(0===n.length)return[];var r=A.map(n.slice(1),function(t,n){return t.map(function(t){return e(n,t)})}),o=n[n.length-1].map(function(e){return t(n.length-1,e)});return r.concat([o])},io={delta:c.identity,positions:c.curry(oo,function(e,t){return Jr(e,ro(t))},function(e,t){return Jr(e,ro(t)+Ar(t))}),edge:ro},uo={delta:c.identity,edge:eo,positions:c.curry(oo,to,no)},ao={height:io,rtl:{delta:function(e,t){return-e},edge:Zr,positions:c.curry(oo,no,to)},ltr:uo},co={ltr:ao.ltr,rtl:ao.rtl};function lo(e){var t=function(t){return e(t).isRtl()?co.rtl:co.ltr};return{delta:function(e,n){return t(n).delta(e,n)},edge:function(e){return t(e).edge(e)},positions:function(e,n){return t(n).positions(e,n)}}}var so={getGridSize:function(e){var t=qt(e);return Ht.generate(t).grid()}},fo=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return fo(n())}}},mo=function(e,t){return go(e,t,{validate:W.isFunction,label:"function"})},go=function(e,t,n){if(0===t.length)throw new Error("You must specify at least one required field.");return M.validateStrArr("required",t),M.checkDupes(t),function(r){var o=I.keys(r);A.forall(t,function(e){return A.contains(o,e)})||M.reqMessage(t,o),e(t,o);var i=A.filter(t,function(e){return!n.validate(r[e],e)});return i.length>0&&M.invalidTypeMessage(i,n.label),r}},po=c.noop,ho={exactly:c.curry(mo,function(e,t){var n=A.filter(t,function(t){return!A.contains(e,t)});n.length>0&&M.unsuppMessage(n)}),ensure:c.curry(mo,po),ensureWith:c.curry(go,po)},vo=function(e){var t=ht.has(e,"colspan")?parseInt(ht.get(e,"colspan"),10):1,n=ht.has(e,"rowspan")?parseInt(ht.get(e,"rowspan"),10):1;return{element:c.constant(e),colspan:c.constant(t),rowspan:c.constant(n)}},bo=ho.exactly(["cell","row","replace","gap"]),wo=function(e,t){bo(e);var n=fo(g.none()),r=t!==undefined?t:vo,o=function(t){var n,o=r(t);return n=o,e.cell(n)},i=function(e){var t=o(e);return n.get().isNone()&&n.set(g.some(t)),u=g.some({item:e,replacement:t}),t},u=g.none();return{getOrInit:function(e,t){return u.fold(function(){return i(e)},function(n){return t(e,n.item)?n.replacement:i(e)})},cursor:n.get}},yo=function(e,t){return function(n){var r=fo(g.none());bo(n);var o=[],i=function(i){var u=n.replace(i,t,{scope:e});return o.push({item:i,sub:u}),r.get().isNone()&&r.set(g.some(u)),u};return{replaceOrInit:function(e,t){return(n=e,r=t,A.find(o,function(e){return r(e.item,n)})).fold(function(){return i(e)},function(n){return t(e,n.item)?n.sub:i(e)});var n,r},cursor:r.get}}},xo=function(e){bo(e);var t=fo(g.none());return{combine:function(n){return t.get().isNone()&&t.set(g.some(n)),function(){var t=e.cell({element:c.constant(n),colspan:c.constant(1),rowspan:c.constant(1)});return Kt.remove(t,"width"),Kt.remove(n,"width"),t}},cursor:t.get}},So=["body","p","div","article","aside","figcaption","figure","footer","header","nav","section","ol","ul","table","thead","tfoot","tbody","caption","tr","td","th","h1","h2","h3","h4","h5","h6","blockquote","pre","address"],Co=function(e,t){var n=e.property().name(t);return A.contains(So,n)},Ro=function(e,t){return A.contains(["br","img","hr","input"],e.property().name(t))},To=Co,Do=function(e,t){var n=e.property().name(t);return A.contains(["ol","ul"],n)},Ao=Ro,ko=An(),No=function(e){return To(ko,e)},Oo=function(e){return Do(ko,e)},Eo=function(e){return Ao(ko,e)},Bo=function(e){var t,n=function(e){return"br"===ft.name(e)},r=function(e){return wn.last(e).bind(function(t){var r,o=(r=t,nt.nextSibling(r).map(function(e){return!!No(e)||(Eo(e)?"img"!==ft.name(e):void 0)}).getOr(!1));return nt.parent(t).map(function(r){return!0===o||(i=r,"li"===ft.name(i)||Bt.ancestor(i,Oo).isSome())||n(t)||No(r)&&!Ye.eq(e,r)?[]:[X.fromTag("br")];var i})}).getOr([])},o=0===(t=A.bind(e,function(e){var t,o=nt.children(e);return t=o,A.forall(t,function(e){return n(e)||ft.isText(e)&&0===mn.get(e).trim().length})?[]:o.concat(r(e))})).length?[X.fromTag("br")]:t;nn.empty(e[0]),en.append(e[0],o)},Io=function(e){return function(){for(var t=new Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];if(0===t.length)throw new Error("Can't merge zero objects");for(var r={},o=0;o<t.length;o++){var i=t[o];for(var u in i)i.hasOwnProperty(u)&&(r[u]=e(r[u],i[u]))}return r}},Po=Io(function(e,t){return W.isObject(e)&&W.isObject(t)?Po(e,t):t}),Wo=Io(function(e,t){return t}),_o={deepMerge:Po,merge:Wo},Mo=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},Lo=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return g.none()},qo=function(e,t){return U.rowcells(t,e.section())},zo=function(e,t){return e.cells()[t]},Fo={addCell:function(e,t,n){var r=e.cells(),o=r.slice(0,t),i=r.slice(t),u=o.concat([n]).concat(i);return qo(e,u)},setCells:qo,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:zo,getCellElement:function(e,t){return zo(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=A.map(n,t);return U.rowcells(r,e.section())},cellLength:function(e){return e.cells().length}},jo=function(e,t){if(0===e.length)return 0;var n=e[0];return A.findIndex(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},Ho=function(e,t,n,r){var o,i,u,a,l=(o=e,i=t,o[i]).cells().slice(n),s=jo(l,r),f=(u=e,a=n,A.map(u,function(e){return Fo.getCell(e,a)})).slice(t),d=jo(f,r);return{colspan:c.constant(s),rowspan:c.constant(d)}},Vo=function(e,t){var n=A.map(e,function(e,t){return A.map(e.cells(),function(e,t){return!1})});return A.map(e,function(r,o){var i=A.bind(r.cells(),function(r,i){if(!1===n[o][i]){var u=Ho(e,o,i,t);return function(e,t,r,o){for(var i=e;i<e+r;i++)for(var u=t;u<t+o;u++)n[i][u]=!0}(o,i,u.rowspan(),u.colspan()),[U.detailnew(r.element(),u.rowspan(),u.colspan(),r.isNew())]}return[]});return U.rowdetails(i,r.section())})},Uo=function(e,t,n){for(var r=[],o=0;o<e.grid().rows();o++){for(var i=[],u=0;u<e.grid().columns();u++){var a=Ht.getAt(e,o,u).map(function(e){return U.elementnew(e.element(),n)}).getOrThunk(function(){return U.elementnew(t.gap(),!0)});i.push(a)}var c=U.rowcells(i,e.all()[o].section());r.push(c)}return r},Go=function(e,t,n,r){n===r?ht.remove(e,t):ht.set(e,t,n)},Xo=function(e,t){var n=[],r=[],o=function(t,o){var i;t.length>0?function(t,o){var i=Pt.child(e,o).getOrThunk(function(){var t=X.fromTag(o,nt.owner(e).dom());return Zt.append(e,t),t});nn.empty(i);var u=A.map(t,function(e){e.isNew()&&n.push(e.element());var t=e.element();return nn.empty(t),A.each(e.cells(),function(e){e.isNew()&&r.push(e.element()),Go(e.element(),"colspan",e.colspan(),1),Go(e.element(),"rowspan",e.rowspan(),1),Zt.append(t,e.element())}),t});en.append(i,u)}(t,o):(i=o,Pt.child(e,i).bind(nn.remove))},i=[],u=[],a=[];return A.each(t,function(e){switch(e.section()){case"thead":i.push(e);break;case"tbody":u.push(e);break;case"tfoot":a.push(e)}}),o(i,"thead"),o(u,"tbody"),o(a,"tfoot"),{newRows:c.constant(n),newCells:c.constant(r)}},Yo=function(e){return A.map(e,function(e){var t=ln(e.element());return A.each(e.cells(),function(e){var n=sn(e.element());Go(n,"colspan",e.colspan(),1),Go(n,"rowspan",e.rowspan(),1),Zt.append(t,n)}),t})},$o=function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},Ko=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},Jo=function(e,t){if(t<0||t>=e.length-1)return g.none();var n=e[t].fold(function(){var n=A.reverse(e.slice(0,t));return Lo(n,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return g.some({value:e,delta:0})}),r=e[t+1].fold(function(){var n=e.slice(t+1);return Lo(n,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return g.some({value:e,delta:1})});return n.bind(function(e){return r.map(function(t){var n=t.delta+e.delta;return Math.abs(t.value-e.value)/n})})},Qo=function(e,t,n){var r=e();return A.find(r,t).orThunk(function(){return g.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},Zo=function(e){var t=e.grid(),n=Ko(0,t.columns()),r=Ko(0,t.rows());return A.map(n,function(t){return Qo(function(){return A.bind(r,function(n){return Ht.getAt(e,n,t).filter(function(e){return e.column()===t}).fold(c.constant([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return Ht.getAt(e,0,t)})})},ei=function(e){var t=e.grid(),n=Ko(0,t.rows()),r=Ko(0,t.columns());return A.map(n,function(t){return Qo(function(){return A.bind(r,function(n){return Ht.getAt(e,t,n).filter(function(e){return e.row()===t}).fold(c.constant([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return Ht.getAt(e,t,0)})})},ti=function(e,t,n,r,o){var i=X.fromTag("div");return Kt.setAll(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),ht.setAll(i,{"data-column":e,role:"presentation"}),i},ni=function(e,t,n,r,o){var i=X.fromTag("div");return Kt.setAll(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),ht.setAll(i,{"data-row":e,role:"presentation"}),i},ri=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},oi={resolve:ri("ephox-snooker").resolve},ii=function(e,t){var n=ht.get(e,t);return n===undefined||""===n?[]:n.split(" ")},ui=ii,ai=function(e,t,n){var r=ii(e,t).concat([n]);ht.set(e,t,r.join(" "))},ci=function(e,t,n){var r=A.filter(ii(e,t),function(e){return e!==n});r.length>0?ht.set(e,t,r.join(" ")):ht.remove(e,t)},li=function(e){return ui(e,"class")},si=function(e,t){return ai(e,"class",t)},fi=function(e,t){return ci(e,"class",t)},di=li,mi=si,gi=fi,pi=function(e,t){A.contains(li(e),t)?fi(e,t):si(e,t)},hi=function(e){return e.dom().classList!==undefined},vi=function(e,t){return hi(e)&&e.dom().classList.contains(t)},bi={add:function(e,t){hi(e)?e.dom().classList.add(t):mi(e,t)},remove:function(e,t){var n;hi(e)?e.dom().classList.remove(t):gi(e,t),0===(hi(n=e)?n.dom().classList:di(n)).length&&ht.remove(n,"class")},toggle:function(e,t){return hi(e)?e.dom().classList.toggle(t):pi(e,t)},toggler:function(e,t){var n,r,o,i,u,a,c=hi(e),l=e.dom().classList;return n=function(){c?l.remove(t):gi(e,t)},r=function(){c?l.add(t):mi(e,t)},o=vi(e,t),i=o||!1,{on:u=function(){r(),i=!0},off:a=function(){n(),i=!1},toggle:function(){(i?a:u)()},isOn:function(){return i}}},has:vi},wi=oi.resolve("resizer-bar"),yi=oi.resolve("resizer-rows"),xi=oi.resolve("resizer-cols"),Si=function(e){var t=St.descendants(e.parent(),"."+wi);A.each(t,nn.remove)},Ci=function(e,t,n){var r=e.origin();A.each(t,function(t,o){t.each(function(t){var o=n(r,t);bi.add(o,wi),Zt.append(e.parent(),o)})})},Ri=function(e,t,n,r,o,i){var u,a,c,l,s=Kr(t),f=n.length>0?o.positions(n,t):[];u=e,a=f,c=s,l=Or(t),Ci(u,a,function(e,t){var n=ni(t.row(),c.left()-e.left(),t.y()-e.top(),l,7);return bi.add(n,yi),n});var d,m,g,p,h=r.length>0?i.positions(r,t):[];d=e,m=h,g=s,p=Ar(t),Ci(d,m,function(e,t){var n=ti(t.col(),t.x()-e.left(),g.top()-e.top(),7,p);return bi.add(n,xi),n})},Ti=function(e,t){var n=St.descendants(e.parent(),"."+wi);A.each(n,t)},Di={refresh:function(e,t,n,r){Si(e);var o=qt(t),i=Ht.generate(o),u=ei(i),a=Zo(i);Ri(e,t,u,a,n,r)},hide:function(e){Ti(e,function(e){Kt.set(e,"display","none")})},show:function(e){Ti(e,function(e){Kt.set(e,"display","block")})},destroy:Si,isRowBar:function(e){return bi.has(e,yi)},isColBar:function(e){return bi.has(e,xi)}},Ai=function(e,t){return A.map(e,function(e){var n,r=(n=e.details(),Lo(n,function(e){return nt.parent(e.element()).map(function(e){var t=nt.parent(e).isNone();return U.elementnew(e,t)})}).getOrThunk(function(){return U.elementnew(t.row(),!0)}));return U.rowdatanew(r.element(),e.details(),e.section(),r.isNew())})},ki=function(e,t){var n=Vo(e,Ye.eq);return Ai(n,t)},Ni=function(e,t){var n=A.flatten(A.map(e.all(),function(e){return e.cells()}));return A.find(n,function(e){return Ye.eq(t,e.element())})},Oi=function(e,t,n,r,o){return function(i,u,a,l,s){var f=qt(u),d=Ht.generate(f);return t(d,a).map(function(t){var n=Uo(d,l,!1),r=e(n,t,Ye.eq,o(l)),i=ki(r.grid(),l);return{grid:c.constant(i),cursor:r.cursor}}).fold(function(){return g.none()},function(e){var t=Xo(u,e.grid());return n(u,e.grid(),s),r(u),Di.refresh(i,u,ao.height,s),g.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},Ei=ki,Bi=function(e,t){return Lt.cell(t.element()).bind(function(t){return Ni(e,t)})},Ii=function(e,t){var n=A.map(t.selection(),function(t){return Lt.cell(t).bind(function(t){return Ni(e,t)})}),r=Mo(n);return r.length>0?g.some(r):g.none()},Pi=function(e,t){return Lt.cell(t.element()).bind(function(n){return Ni(e,n).map(function(e){return _o.merge(e,{generators:t.generators,clipboard:t.clipboard})})})},Wi=function(e,t){var n=A.map(t.selection(),function(t){return Lt.cell(t).bind(function(t){return Ni(e,t)})}),r=Mo(n);return r.length>0?g.some(_o.merge({cells:r},{generators:t.generators,clipboard:t.clipboard})):g.none()},_i=function(e,t){return t.mergable()},Mi=function(e,t){return t.unmergable()},Li=function(e){return{is:function(t){return e===t},isValue:c.constant(!0),isError:c.constant(!1),getOr:c.constant(e),getOrThunk:c.constant(e),getOrDie:c.constant(e),or:function(t){return Li(e)},orThunk:function(t){return Li(e)},fold:function(t,n){return n(e)},map:function(t){return Li(t(e))},each:function(t){t(e)},bind:function(t){return t(e)},exists:function(t){return t(e)},forall:function(t){return t(e)},toOption:function(){return g.some(e)}}},qi=function(e){return{is:c.constant(!1),isValue:c.constant(!1),isError:c.constant(!0),getOr:c.identity,getOrThunk:function(e){return e()},getOrDie:function(){return c.die(e)()},or:function(e){return e},orThunk:function(e){return e()},fold:function(t,n){return t(e)},map:function(t){return qi(e)},each:c.noop,bind:function(t){return qi(e)},exists:c.constant(!1),forall:c.constant(!0),toOption:g.none}},zi={value:Li,error:qi},Fi=function(e,t){return A.map(e,function(){return U.elementnew(t.cell(),!0)})},ji=function(e,t,n){return e.concat($o(t,function(t){return Fo.setCells(e[e.length-1],Fi(e[e.length-1].cells(),n))}))},Hi=function(e,t,n){return A.map(e,function(e){return Fo.setCells(e,e.cells().concat(Fi(Ko(0,t),n)))})},Vi=function(e,t,n){if(e.row()>=t.length||e.column()>Fo.cellLength(t[0]))return zi.error("invalid start address out of table bounds, row: "+e.row()+", column: "+e.column());var r=t.slice(e.row()),o=r[0].cells().slice(e.column()),i=Fo.cellLength(n[0]),u=n.length;return zi.value({rowDelta:c.constant(r.length-u),colDelta:c.constant(o.length-i)})},Ui=function(e,t){var n=Fo.cellLength(e[0]),r=Fo.cellLength(t[0]);return{rowDelta:c.constant(0),colDelta:c.constant(n-r)}},Gi=function(e,t,n){var r=t.colDelta()<0?Hi:c.identity;return(t.rowDelta()<0?ji:c.identity)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},Xi=function(e,t,n,r){if(0===e.length)return e;for(var o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)Fo.mutateCell(e[o],i,U.elementnew(r(),!1));return e},Yi=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<Fo.cellLength(e[0]);u++){var a=n(Fo.getCellElement(e[i],u),t);!0===a&&!1===o?Fo.mutateCell(e[i],u,U.elementnew(r(),!0)):!0===a&&(o=!1)}return e},$i=function(e,t,n,r){if(t>0&&t<e.length){var o=e[t-1].cells(),i=(u=o,a=n,A.foldl(u,function(e,t){return A.exists(e,function(e){return a(e.element(),t.element())})?e:e.concat([t])},[]));A.each(i,function(o){for(var i=g.none(),u=t;u<e.length;u++)for(var a=0;a<Fo.cellLength(e[0]);a++){var c=e[u].cells()[a];n(c.element(),o.element())&&(i.isNone()&&(i=g.some(r())),i.each(function(t){Fo.mutateCell(e[u],a,U.elementnew(t,!0))}))}})}var u,a;return e},Ki=function(e,t,n,r,o){return Vi(e,t,n).map(function(i){var u=Gi(t,i,r);return function(e,t,n,r,o){for(var i,u,a,l,s,f,d,m=e.row(),g=e.column(),p=m+n.length,h=g+Fo.cellLength(n[0]),v=m;v<p;v++)for(var b=g;b<h;b++){i=t,u=v,a=b,l=o,s=void 0,f=void 0,s=Fo.getCell(i[u],a),f=c.curry(l,s.element()),d=i[u],i.length>1&&Fo.cellLength(d)>1&&(a>0&&f(Fo.getCellElement(d,a-1))||a<d.length-1&&f(Fo.getCellElement(d,a+1))||u>0&&f(Fo.getCellElement(i[u-1],a))||u<i.length-1&&f(Fo.getCellElement(i[u+1],a)))&&Yi(t,Fo.getCellElement(t[v],b),o,r.cell);var w=Fo.getCellElement(n[v-m],b-g),y=r.replace(w);Fo.mutateCell(t[v],b,U.elementnew(y,!0))}return t}(e,u,n,r,o)})},Ji=function(e,t,n,r,o){$i(t,e,o,r.cell);var i=Ui(n,t),u=Gi(n,i,r),a=Ui(t,u),c=Gi(t,a,r);return c.slice(0,e).concat(u).concat(c.slice(e,c.length))},Qi=function(e,t,n,r,o){var i=e.slice(0,t),u=e.slice(t),a=Fo.mapCells(e[n],function(n,i){return t>0&&t<e.length&&r(Fo.getCellElement(e[t-1],i),Fo.getCellElement(e[t],i))?Fo.getCell(e[t],i):U.elementnew(o(n.element(),r),!0)});return i.concat([a]).concat(u)},Zi=function(e,t,n,r,o){return A.map(e,function(e){var i=t>0&&t<Fo.cellLength(e)&&r(Fo.getCellElement(e,t-1),Fo.getCellElement(e,t))?Fo.getCell(e,t):U.elementnew(o(Fo.getCellElement(e,n),r),!0);return Fo.addCell(e,t,i)})},eu=function(e,t,n,r,o){var i=n+1;return A.map(e,function(e,u){var a=u===t?U.elementnew(o(Fo.getCellElement(e,n),r),!0):Fo.getCell(e,n);return Fo.addCell(e,i,a)})},tu=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),a=e.slice(i),c=Fo.mapCells(e[t],function(e,t){return t===n?U.elementnew(o(e.element(),r),!0):e});return u.concat([c]).concat(a)},nu=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},ru=function(e,t,n){var r=A.map(e,function(e){var r=e.cells().slice(0,t).concat(e.cells().slice(n+1));return U.rowcells(r,e.section())});return A.filter(r,function(e){return e.cells().length>0})},ou=function(e,t,n,r){return A.map(e,function(e){return Fo.mapCells(e,function(e){return o=e,A.exists(t,function(e){return n(o.element(),e.element())})?U.elementnew(r(e.element(),n),!0):e;var o})})},iu=function(e,t,n,r){return Fo.getCellElement(e[t],n)!==undefined&&t>0&&r(Fo.getCellElement(e[t-1],n),Fo.getCellElement(e[t],n))},uu=function(e,t,n){return t>0&&n(Fo.getCellElement(e,t-1),Fo.getCellElement(e,t))},au=function(e,t,n,r){var o=A.bind(e,function(r,o){return iu(e,o,t,n)||uu(r,t,n)?[]:[Fo.getCell(r,t)]});return ou(e,o,n,r)},cu=function(e,t,n,r){var o=e[t],i=A.bind(o.cells(),function(r,i){return iu(e,t,i,n)||uu(o,i,n)?[]:[r]});return ou(e,i,n,r)},lu=function(e){return{fold:e}},su=function(){return lu(function(e,t,n,r,o){return e()})},fu=function(e){return lu(function(t,n,r,o,i){return n(e)})},du=function(e,t){return lu(function(n,r,o,i,u){return o(e,t)})},mu=function(e,t,n){return lu(function(r,o,i,u,a){return u(e,t,n)})},gu=function(e,t){return lu(function(n,r,o,i,u){return u(e,t)})},pu=function(e,t,n,r){var o,i,u=e.slice(0),a=(i=t,0===(o=e).length?su():1===o.length?fu(0):0===i?du(0,1):i===o.length-1?gu(i-1,i):i>0&&i<o.length-1?mu(i-1,i,i+1):su()),l=function(e){return A.map(e,c.constant(0))},s=c.constant(l(u)),f=function(e,t){if(n>=0){var o=Math.max(r.minCellWidth(),u[t]-n);return l(u.slice(0,e)).concat([n,o-u[t]]).concat(l(u.slice(t+1)))}var i=Math.max(r.minCellWidth(),u[e]+n),a=u[e]-i;return l(u.slice(0,e)).concat([i-u[e],a]).concat(l(u.slice(t+1)))},d=f;return a.fold(s,function(e){return r.singleColumnWidth(u[e],n)},d,function(e,t,n){return f(t,n)},function(e,t){if(n>=0)return l(u.slice(0,t)).concat([n]);var o=Math.max(r.minCellWidth(),u[t]+n);return l(u.slice(0,t)).concat([o-u[t]])})},hu=function(e,t){return ht.has(e,t)&&parseInt(ht.get(e,t),10)>1},vu={hasColspan:function(e){return hu(e,"colspan")},hasRowspan:function(e){return hu(e,"rowspan")},minWidth:c.constant(10),minHeight:c.constant(10),getInt:function(e,t){return parseInt(Kt.get(e,t),10)}},bu=function(e,t,n){return Kt.getRaw(e,t).fold(function(){return n(e)+"px"},function(e){return e})},wu=function(e){return bu(e,"width",Hr.getPixelWidth)},yu=function(e){return bu(e,"height",Hr.getHeight)},xu=function(e,t,n,r,o){var i=Zo(e),u=A.map(i,function(e){return e.map(t.edge)});return A.map(i,function(e,t){return e.filter(c.not(vu.hasColspan)).fold(function(){var e=Jo(u,t);return r(e)},function(e){return n(e,o)})})},Su=function(e){return e.map(function(e){return e+"px"}).getOr("")},Cu=function(e,t,n,r){var o=ei(e),i=A.map(o,function(e){return e.map(t.edge)});return A.map(o,function(e,t){return e.filter(c.not(vu.hasRowspan)).fold(function(){var e=Jo(i,t);return r(e)},function(e){return n(e)})})},Ru={getRawWidths:function(e,t){return xu(e,t,wu,Su)},getPixelWidths:function(e,t,n){return xu(e,t,Hr.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return xu(e,t,Hr.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Cu(e,t,Hr.getHeight,function(e){return e.getOrThunk(vu.minHeight)})},getRawHeights:function(e,t){return Cu(e,t,yu,Su)}},Tu=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},Du=function(e,t){var n=Ht.justCells(e);return A.map(n,function(e){var n=Tu(e.column(),e.column()+e.colspan(),t);return{element:e.element,width:c.constant(n),colspan:e.colspan}})},Au=function(e,t){var n=Ht.justCells(e);return A.map(n,function(e){var n=Tu(e.row(),e.row()+e.rowspan(),t);return{element:e.element,height:c.constant(n),rowspan:e.rowspan}})},ku=function(e,t){return A.map(e.all(),function(e,n){return{element:e.element,height:c.constant(t[n])}})},Nu=function(e){var t=parseInt(e,10),n=c.identity;return{width:c.constant(t),pixelWidth:c.constant(t),getWidths:Ru.getPixelWidths,getCellDelta:n,singleColumnWidth:function(e,t){return[Math.max(vu.minWidth(),e+t)-e]},minCellWidth:vu.minWidth,setElementWidth:Hr.setPixelWidth,setTableWidth:function(e,t,n){var r=A.foldr(t,function(e,t){return e+t},0);Hr.setPixelWidth(e,r)}}},Ou=function(e,t){if(Hr.percentageBasedSizeRegex().test(t)){var n=Hr.percentageBasedSizeRegex().exec(t);return o=n[1],i=e,u=parseFloat(o),a=Nr(i),{width:c.constant(u),pixelWidth:c.constant(a),getWidths:Ru.getPercentageWidths,getCellDelta:function(e){return e/a*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return vu.minWidth()/a*100},setElementWidth:Hr.setPercentageWidth,setTableWidth:function(e,t,n){var r=u+n;Hr.setPercentageWidth(e,r)}}}if(Hr.pixelBasedSizeRegex().test(t)){var r=Hr.pixelBasedSizeRegex().exec(t);return Nu(r[1])}var o,i,u,a,l=Nr(e);return Nu(l)},Eu=function(e){return Hr.getRawWidth(e).fold(function(){var t=Nr(e);return Nu(t)},function(t){return Ou(e,t)})},Bu=function(e){return Ht.generate(e)},Iu=function(e){var t=qt(e);return Bu(t)},Pu={adjustWidth:function(e,t,n,r){var o=Eu(e),i=o.getCellDelta(t),u=Iu(e),a=o.getWidths(u,r,o),c=pu(a,n,i,o),l=A.map(c,function(e,t){return e+a[t]}),s=Du(u,l);A.each(s,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},adjustHeight:function(e,t,n,r){var o=Iu(e),i=Ru.getPixelHeights(o,r),u=A.map(i,function(e,r){return n===r?Math.max(t+e,vu.minHeight()):e}),a=Au(o,u),c=ku(o,u);A.each(c,function(e){Hr.setHeight(e.element(),e.height())}),A.each(a,function(e){Hr.setHeight(e.element(),e.height())});var l,s=(l=u,A.foldr(l,function(e,t){return e+t},0));Hr.setHeight(e,s)},adjustWidthTo:function(e,t,n){var r=Eu(e),o=Bu(t),i=r.getWidths(o,n,r),u=Du(o,i);A.each(u,function(e){r.setElementWidth(e.element(),e.width())});var a=A.foldr(i,function(e,t){return t+e},0);u.length>0&&r.setElementWidth(e,a)}},Wu=function(e){0===Lt.cells(e).length&&nn.remove(e)},_u=L.immutable("grid","cursor"),Mu=function(e,t,n){return Lu(e,t,n).orThunk(function(){return Lu(e,0,0)})},Lu=function(e,t,n){return g.from(e[t]).bind(function(e){return g.from(e.cells()[n]).bind(function(e){return g.from(e.element())})})},qu=function(e,t,n){return _u(e,Lu(e,t,n))},zu=function(e){return A.foldl(e,function(e,t){return A.exists(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},Fu=function(e){return A.foldl(e,function(e,t){return A.exists(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},ju=function(e,t,n){var r=zt(e,n),o=Ht.generate(r);return Uo(o,t,!0)},Hu=Pu.adjustWidthTo,Vu={insertRowBefore:Oi(function(e,t,n,r){var o=t.row(),i=t.row(),u=Qi(e,i,o,n,r.getOrInit);return qu(u,i,t.column())},Bi,c.noop,c.noop,wo),insertRowsBefore:Oi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=zu(t),a=A.foldl(u,function(e,t){return Qi(e,i,o,n,r.getOrInit)},e);return qu(a,i,t[0].column())},Ii,c.noop,c.noop,wo),insertRowAfter:Oi(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=Qi(e,i,o,n,r.getOrInit);return qu(u,i,t.column())},Bi,c.noop,c.noop,wo),insertRowsAfter:Oi(function(e,t,n,r){var o=zu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=A.foldl(o,function(e,t){return Qi(e,u,i,n,r.getOrInit)},e);return qu(a,u,t[0].column())},Ii,c.noop,c.noop,wo),insertColumnBefore:Oi(function(e,t,n,r){var o=t.column(),i=t.column(),u=Zi(e,i,o,n,r.getOrInit);return qu(u,t.row(),i)},Bi,Hu,c.noop,wo),insertColumnsBefore:Oi(function(e,t,n,r){var o=Fu(t),i=o[0].column(),u=o[0].column(),a=A.foldl(o,function(e,t){return Zi(e,u,i,n,r.getOrInit)},e);return qu(a,t[0].row(),u)},Ii,Hu,c.noop,wo),insertColumnAfter:Oi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=Zi(e,i,o,n,r.getOrInit);return qu(u,t.row(),i)},Bi,Hu,c.noop,wo),insertColumnsAfter:Oi(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=Fu(t),a=A.foldl(u,function(e,t){return Zi(e,i,o,n,r.getOrInit)},e);return qu(a,t[0].row(),i)},Ii,Hu,c.noop,wo),splitCellIntoColumns:Oi(function(e,t,n,r){var o=eu(e,t.row(),t.column(),n,r.getOrInit);return qu(o,t.row(),t.column())},Bi,Hu,c.noop,wo),splitCellIntoRows:Oi(function(e,t,n,r){var o=tu(e,t.row(),t.column(),n,r.getOrInit);return qu(o,t.row(),t.column())},Bi,c.noop,c.noop,wo),eraseColumns:Oi(function(e,t,n,r){var o=Fu(t),i=ru(e,o[0].column(),o[o.length-1].column()),u=Mu(i,t[0].row(),t[0].column());return _u(i,u)},Ii,Hu,Wu,wo),eraseRows:Oi(function(e,t,n,r){var o=zu(t),i=nu(e,o[0].row(),o[o.length-1].row()),u=Mu(i,t[0].row(),t[0].column());return _u(i,u)},Ii,c.noop,Wu,wo),makeColumnHeader:Oi(function(e,t,n,r){var o=au(e,t.column(),n,r.replaceOrInit);return qu(o,t.row(),t.column())},Bi,c.noop,c.noop,yo("row","th")),unmakeColumnHeader:Oi(function(e,t,n,r){var o=au(e,t.column(),n,r.replaceOrInit);return qu(o,t.row(),t.column())},Bi,c.noop,c.noop,yo(null,"td")),makeRowHeader:Oi(function(e,t,n,r){var o=cu(e,t.row(),n,r.replaceOrInit);return qu(o,t.row(),t.column())},Bi,c.noop,c.noop,yo("col","th")),unmakeRowHeader:Oi(function(e,t,n,r){var o=cu(e,t.row(),n,r.replaceOrInit);return qu(o,t.row(),t.column())},Bi,c.noop,c.noop,yo(null,"td")),mergeCells:Oi(function(e,t,n,r){var o=t.cells();Bo(o);var i=Xi(e,t.bounds(),n,c.constant(o[0]));return _u(i,g.from(o[0]))},_i,c.noop,c.noop,xo),unmergeCells:Oi(function(e,t,n,r){var o=A.foldr(t,function(e,t){return Yi(e,t,n,r.combine(t))},e);return _u(o,g.from(t[0]))},Mi,Hu,c.noop,xo),pasteCells:Oi(function(e,t,n,r){var o,i,u,a,c=(o=t.clipboard(),i=t.generators(),u=qt(o),a=Ht.generate(u),Uo(a,i,!0)),l=U.address(t.row(),t.column());return Ki(l,e,c,t.generators(),n).fold(function(){return _u(e,g.some(t.element()))},function(e){var n=Mu(e,t.row(),t.column());return _u(e,n)})},Pi,Hu,c.noop,wo),pasteRowsBefore:Oi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=ju(t.clipboard(),t.generators(),o),a=Ji(i,e,u,t.generators(),n),c=Mu(a,t.cells[0].row(),t.cells[0].column());return _u(a,c)},Wi,c.noop,c.noop,wo),pasteRowsAfter:Oi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[t.cells.length-1].row()+t.cells[t.cells.length-1].rowspan(),u=ju(t.clipboard(),t.generators(),o),a=Ji(i,e,u,t.generators(),n),c=Mu(a,t.cells[0].row(),t.cells[0].column());return _u(a,c)},Wi,c.noop,c.noop,wo)},Uu=function(e){return X.fromDom(e.getBody())},Gu={getBody:Uu,getIsRoot:function(e){return function(t){return Ye.eq(t,Uu(e))}},addSizeSuffix:function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},removePxSuffix:function(e){return e?e.replace(/px$/,""):""}},Xu=function(e){return"rtl"===Kt.get(e,"direction")?"rtl":"ltr"},Yu={onDirection:function(e,t){return function(n){return"rtl"===Xu(n)?t:e}},getDirection:Xu},$u={isRtl:c.constant(!1)},Ku={isRtl:c.constant(!0)},Ju={directionAt:function(e){return"rtl"===Yu.getDirection(e)?Ku:$u}};function Qu(e,t){var n,r=function(e){return"table"===ft.name(Gu.getBody(e))};!1!==e.settings.table_clone_elements&&("string"==typeof e.settings.table_clone_elements?n=e.settings.table_clone_elements.split(/[ ,]/):Array.isArray(e.settings.table_clone_elements)&&(n=e.settings.table_clone_elements));var o=g.from(n),i=function(t,n,r,i){return function(u,a){var c=St.descendants(u,"td[data-mce-style],th[data-mce-style]");A.each(c,function(e){ht.remove(e,"data-mce-style")});var l=i(),s=X.fromDom(e.getDoc()),f=lo(Ju.directionAt),d=Rn.cellOperations(r,s,o);return n(u)?t(l,u,a,d,f).bind(function(t){return A.each(t.newRows(),function(t){var n;n=t,e.fire("newrow",{node:n.dom()}),n.dom()}),A.each(t.newCells(),function(t){var n;n=t,e.fire("newcell",{node:n.dom()}),n.dom()}),t.cursor().map(function(t){var n=e.dom.createRng();return n.setStart(t.dom(),0),n.setEnd(t.dom(),0),n})}):g.none()}};return{deleteRow:i(Vu.eraseRows,function(t){var n=so.getGridSize(t);return!1===r(e)||n.rows()>1},c.noop,t),deleteColumn:i(Vu.eraseColumns,function(t){var n=so.getGridSize(t);return!1===r(e)||n.columns()>1},c.noop,t),insertRowsBefore:i(Vu.insertRowsBefore,c.always,c.noop,t),insertRowsAfter:i(Vu.insertRowsAfter,c.always,c.noop,t),insertColumnsBefore:i(Vu.insertColumnsBefore,c.always,Vr.halve,t),insertColumnsAfter:i(Vu.insertColumnsAfter,c.always,Vr.halve,t),mergeCells:i(Vu.mergeCells,c.always,c.noop,t),unmergeCells:i(Vu.unmergeCells,c.always,c.noop,t),pasteRowsBefore:i(Vu.pasteRowsBefore,c.always,c.noop,t),pasteRowsAfter:i(Vu.pasteRowsAfter,c.always,c.noop,t),pasteCells:i(Vu.pasteCells,c.always,c.noop,t)}}var Zu=function(e,t,n){var r=qt(e),o=Ht.generate(r);return Ii(o,t).map(function(e){var t=Uo(o,n,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),r=Ei(t,n);return Yo(r)})},ea=tinymce.util.Tools.resolve("tinymce.util.Tools"),ta=tinymce.util.Tools.resolve("tinymce.Env"),na={applyAlign:function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},applyVAlign:function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},unApplyAlign:function(e,t){ea.each("left center right".split(" "),function(n){e.formatter.remove("align"+n,{},t)})},unApplyVAlign:function(e,t){ea.each("top middle bottom".split(" "),function(n){e.formatter.remove("valign"+n,{},t)})},getTDTHOverallStyle:function(e,t,n){var r;return r=function(t,r){for(var o=0;o<r.length;o++){var i=e.getStyle(r[o],n);if(void 0===t&&(t=i),t!==i)return""}return t}(r,e.select("td,th",t))}},ra=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);"style"===t.control.name()?(r.find("#borderStyle").value(i["border-style"]||"")[0].fire("select"),r.find("#borderColor").value(i["border-color"]||"")[0].fire("change"),r.find("#backgroundColor").value(i["background-color"]||"")[0].fire("change"),r.find("#width").value(i.width||"").fire("change"),r.find("#height").value(i.height||"").fire("change")):(i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?Gu.addSizeSuffix(o.width):"",i.height=o.height?Gu.addSizeSuffix(o.height):""),r.find("#style").value(n.serializeStyle(n.parseStyle(n.serializeStyle(i))))},oa={createStyleForm:function(e){var t=function(){var t=e.settings.color_picker_callback;if(t)return function(n){return t.call(e,function(e){n.control.value(e).fire("change")},n.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:c.curry(ra,e)},items:[{label:"Style",name:"style",type:"textbox"},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:c.curry(ra,e),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:t()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:t()}]}]}},buildListItems:function(e,t,n){var r=function(e,n){return n=n||[],ea.each(e,function(e){var o={text:e.text||e.title};e.menu?o.menu=r(e.menu):(o.value=e.value,t&&t(o)),n.push(o)}),n};return r(e,n||[])},updateStyleField:ra,extractAdvancedStyles:function(e,t){var n=e.parseStyle(e.getAttrib(t,"style")),r={};return n["border-style"]&&(r.borderStyle=n["border-style"]),n["border-color"]&&(r.borderColor=n["border-color"]),n["background-color"]&&(r.backgroundColor=n["background-color"]),r.style=e.serializeStyle(n),r}};function ia(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)ia(e,t.children[o],n,r)}var ua=function(e,t,n){var r,o,i=e.dom;oa.updateStyleField(e,n),!1===(o=n.control.rootControl.toJSON())["class"]&&delete o["class"],e.undoManager.transact(function(){t||(t=Cr.insert(e,o.cols||1,o.rows||1)),function(e,t,n){var r=e.dom,o={},i={};if(o["class"]=n["class"],i.height=Gu.addSizeSuffix(n.height),r.getAttrib(t,"width")&&!e.settings.table_style_by_css?o.width=Gu.removePxSuffix(n.width):i.width=Gu.addSizeSuffix(n.width),e.settings.table_style_by_css?(i["border-width"]=Gu.addSizeSuffix(n.border),i["border-spacing"]=Gu.addSizeSuffix(n.cellspacing),ea.extend(o,{"data-mce-border-color":n.borderColor,"data-mce-cell-padding":n.cellpadding,"data-mce-border":n.border})):ea.extend(o,{border:n.border,cellpadding:n.cellpadding,cellspacing:n.cellspacing}),e.settings.table_style_by_css&&t.children)for(var u=0;u<t.children.length;u++)ia(r,t.children[u],{"border-width":Gu.addSizeSuffix(n.border),"border-color":n.borderColor,padding:Gu.addSizeSuffix(n.cellpadding)});n.style?ea.extend(i,r.parseStyle(n.style)):i=ea.extend({},r.parseStyle(r.getAttrib(t,"style")),i),o.style=r.serializeStyle(i),r.setAttribs(t,o)}(e,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=ta.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),na.unApplyAlign(e,t),o.align&&na.applyAlign(e,t,o.align),e.focus(),e.addVisual()})},aa=function(e,t){var n,r,o,i,u,a,l,s,f,d=e.dom,m={};!0===t?(n=d.getParent(e.selection.getStart(),"table"))&&(l=n,s=(a=e).dom,f={width:s.getStyle(l,"width")||s.getAttrib(l,"width"),height:s.getStyle(l,"height")||s.getAttrib(l,"height"),cellspacing:s.getStyle(l,"border-spacing")||s.getAttrib(l,"cellspacing"),cellpadding:s.getAttrib(l,"data-mce-cell-padding")||s.getAttrib(l,"cellpadding")||na.getTDTHOverallStyle(a.dom,l,"padding"),border:s.getAttrib(l,"data-mce-border")||s.getAttrib(l,"border")||na.getTDTHOverallStyle(a.dom,l,"border"),borderColor:s.getAttrib(l,"data-mce-border-color"),caption:!!s.select("caption",l)[0],"class":s.getAttrib(l,"class")},ea.each("left center right".split(" "),function(e){a.formatter.matchNode(l,"align"+e)&&(f.align=e)}),!1!==a.settings.table_advtab&&ea.extend(f,oa.extractAdvancedStyles(s,l)),m=f):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),e.settings.table_class_list&&(m["class"]&&(m["class"]=m["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:oa.buildListItems(e.settings.table_class_list,function(t){t.value&&(t.textStyle=function(){return e.formatter.getCssText({block:"table",classes:[t.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:!1!==e.settings.table_appearance_options?[r,o,{label:"Width",name:"width",onchange:c.curry(oa.updateStyleField,e)},{label:"Height",name:"height",onchange:c.curry(oa.updateStyleField,e)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:c.curry(oa.updateStyleField,e)},{label:"Height",name:"height",onchange:c.curry(oa.updateStyleField,e)}]},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},!1!==e.settings.table_advtab?e.windowManager.open({title:"Table properties",data:m,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},oa.createStyleForm(e)],onsubmit:c.curry(ua,e,n)}):e.windowManager.open({title:"Table properties",data:m,body:u,onsubmit:c.curry(ua,e,n)})},ca=function(e,t,n){var r=e.getParent(t,"table"),o=t.parentNode,i=e.select(n,r)[0];i||(i=e.create(n),r.firstChild?"CAPTION"===r.firstChild.nodeName?e.insertAfter(i,r.firstChild):r.insertBefore(i,r.firstChild):r.appendChild(i)),i.appendChild(t),o.hasChildNodes()||e.remove(o)};function la(e,t,n){var r,o=e.dom;function i(e,t,n){n&&o.setAttrib(e,t,n)}oa.updateStyleField(e,n),r=n.control.rootControl.toJSON(),e.undoManager.transact(function(){ea.each(t,function(n){var u,a,c;i(n,"scope",r.scope),i(n,"style",r.style),i(n,"class",r["class"]),u=n,a="height",(c=Gu.addSizeSuffix(r.height))&&o.setStyle(u,a,c),r.type!==n.parentNode.nodeName.toLowerCase()&&ca(e.dom,n,r.type),1===t.length&&na.unApplyAlign(e,n),r.align&&na.applyAlign(e,n,r.align)}),e.focus()})}var sa=function(e){var t,n,r,o,i,u,a,l,s,f,d=e.dom,m=[];t=d.getParent(e.selection.getStart(),"table"),n=d.getParent(e.selection.getStart(),"td,th"),ea.each(t.rows,function(e){ea.each(e.cells,function(t){if(d.getAttrib(t,"data-mce-selected")||t===n)return m.push(e),!1})}),(r=m[0])&&(m.length>1?i={height:"",scope:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(l=r,s=(a=e).dom,(f={height:s.getStyle(l,"height")||s.getAttrib(l,"height"),scope:s.getAttrib(l,"scope"),"class":s.getAttrib(l,"class")}).type=l.parentNode.nodeName.toLowerCase(),ea.each("left center right".split(" "),function(e){a.formatter.matchNode(l,"align"+e)&&(f.align=e)}),!1!==a.settings.table_row_advtab&&ea.extend(f,oa.extractAdvancedStyles(s,l)),i=f),e.settings.table_row_class_list&&(o={name:"class",type:"listbox",label:"Class",values:oa.buildListItems(e.settings.table_row_class_list,function(t){t.value&&(t.textStyle=function(){return e.formatter.getCssText({block:"tr",classes:[t.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},!1!==e.settings.table_row_advtab?e.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},oa.createStyleForm(e)],onsubmit:c.curry(la,e,m)}):e.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:c.curry(la,e,m)}))},fa=function(e,t,n){var r,o=e.dom;function i(e,t,n){n&&o.setAttrib(e,t,n)}function u(e,t,n){n&&o.setStyle(e,t,n)}oa.updateStyleField(e,n),r=n.control.rootControl.toJSON(),e.undoManager.transact(function(){ea.each(t,function(n){var a,c;i(n,"scope",r.scope),1===t.length?i(n,"style",r.style):(a=n,c=r.style,a.style.cssText+=";"+c),i(n,"class",r["class"]),u(n,"width",Gu.addSizeSuffix(r.width)),u(n,"height",Gu.addSizeSuffix(r.height)),r.type&&n.nodeName.toLowerCase()!==r.type&&(n=o.rename(n,r.type)),1===t.length&&(na.unApplyAlign(e,n),na.unApplyVAlign(e,n)),r.align&&na.applyAlign(e,n,r.align),r.valign&&na.applyVAlign(e,n,r.valign)}),e.focus()})},da=function(e){var t,n,r,o=[];if(o=e.dom.select("td[data-mce-selected],th[data-mce-selected]"),t=e.dom.getParent(e.selection.getStart(),"td,th"),!o.length&&t&&o.push(t),t=t||o[0]){var i,u,a,l;o.length>1?n={width:"",height:"",scope:"","class":"",align:"",style:"",type:t.nodeName.toLowerCase()}:(u=t,a=(i=e).dom,(l={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class")}).type=u.nodeName.toLowerCase(),ea.each("left center right".split(" "),function(e){i.formatter.matchNode(u,"align"+e)&&(l.align=e)}),ea.each("top middle bottom".split(" "),function(e){i.formatter.matchNode(u,"valign"+e)&&(l.valign=e)}),!1!==i.settings.table_cell_advtab&&ea.extend(l,oa.extractAdvancedStyles(a,u)),n=l),e.settings.table_cell_class_list&&(r={name:"class",type:"listbox",label:"Class",values:oa.buildListItems(e.settings.table_cell_class_list,function(t){t.value&&(t.textStyle=function(){return e.formatter.getCssText({block:"td",classes:[t.value]})})})});var s={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:c.curry(oa.updateStyleField,e)},{label:"Height",name:"height",onchange:c.curry(oa.updateStyleField,e)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};!1!==e.settings.table_cell_advtab?e.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:n,body:[{title:"General",type:"form",items:s},oa.createStyleForm(e)],onsubmit:c.curry(fa,e,o)}):e.windowManager.open({title:"Cell properties",data:n,body:s,onsubmit:c.curry(fa,e,o)})}},ma=ea.each,ga=g.none(),pa={registerCommands:function(e,t,n,r){var o=Gu.getIsRoot(e),i=function(){return X.fromDom(e.dom.getParent(e.selection.getStart(),"th,td"))},u=function(e){return Lt.table(e,o)},a=function(t){var o=i();u(o).each(function(i){var u=vr.forMenu(r,i,o);t(i,u).each(function(t){e.selection.setRng(t),e.focus(),n.clear(i)})})},l=function(t){var n=i();return u(n).bind(function(t){var o=X.fromDom(e.getDoc()),i=vr.forMenu(r,t,n),u=Rn.cellOperations(c.noop,o,g.none());return Zu(t,i,u)})},s=function(t){ga.each(function(o){var a=A.map(o,function(e){return sn(e)}),c=i();u(c).bind(function(o){var i=X.fromDom(e.getDoc()),u=Rn.paste(i),l=vr.pasteRows(r,o,c,a,u);t(o,l).each(function(t){e.selection.setRng(t),e.focus(),n.clear(o)})})})};ma({mceTableSplitCells:function(){a(t.unmergeCells)},mceTableMergeCells:function(){a(t.mergeCells)},mceTableInsertRowBefore:function(){a(t.insertRowsBefore)},mceTableInsertRowAfter:function(){a(t.insertRowsAfter)},mceTableInsertColBefore:function(){a(t.insertColumnsBefore)},mceTableInsertColAfter:function(){a(t.insertColumnsAfter)},mceTableDeleteCol:function(){a(t.deleteColumn)},mceTableDeleteRow:function(){a(t.deleteRow)},mceTableCutRow:function(e){ga=l(),a(t.deleteRow)},mceTableCopyRow:function(e){ga=l()},mceTablePasteRowBefore:function(e){s(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){s(t.pasteRowsAfter)},mceTableDelete:function(){var t=X.fromDom(e.dom.getParent(e.selection.getStart(),"th,td"));Lt.table(t,o).filter(c.not(o)).each(function(t){var n=X.fromText("");Zt.after(t,n),nn.remove(t);var r=e.dom.createRng();r.setStart(n.dom(),0),r.setEnd(n.dom(),0),e.selection.setRng(r)})}},function(t,n){e.addCommand(n,t)}),ma({mceInsertTable:c.curry(aa,e),mceTableProps:c.curry(aa,e,!0),mceTableRowProps:c.curry(sa,e),mceTableCellProps:c.curry(da,e)},function(t,n){e.addCommand(n,function(e,n){t(n)})})},getClipboardRows:function(){return ga.fold(function(){},function(e){return A.map(e,function(e){return e.dom()})})},setClipboardRows:function(e){var t=A.map(e,X.fromDom);ga=g.from(t)}},ha={only:function(e){var t=g.from(e.dom().documentElement).map(X.fromDom).getOr(e);return{parent:c.constant(t),view:c.constant(e),origin:c.constant(Xr(0,0))}},detached:function(e,t){var n=c.curry(Kr,t);return{parent:c.constant(t),view:c.constant(e),origin:n}},body:function(e,t){return{parent:c.constant(t),view:c.constant(e),origin:c.constant(Xr(0,0))}}};function va(e){var t=L.immutable.apply(null,e),n=[];return{bind:function(e){if(e===undefined)throw"Event bind error: undefined handler";n.push(e)},unbind:function(e){n=A.filter(n,function(t){return t!==e})},trigger:function(){var e=t.apply(null,arguments);A.each(n,function(t){t(e)})}}}var ba={create:function(e){return{registry:I.map(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:I.map(e,function(e){return e.trigger})}}},wa={mode:ho.exactly(["compare","extract","mutate","sink"]),sink:ho.exactly(["element","start","stop","destroy"]),api:ho.exactly(["forceDrop","drop","move","delayDrop"])},ya={resolve:ri("ephox-dragster").resolve},xa=function(e,t){return function(n){if(e(n)){var r,o,i,u,a,l,s,f=X.fromDom(n.target),d=function(){n.stopPropagation()},m=function(){n.preventDefault()},g=c.compose(m,d),p=(r=f,o=n.clientX,i=n.clientY,u=d,a=m,l=g,s=n,{target:c.constant(r),x:c.constant(o),y:c.constant(i),stop:u,prevent:a,kill:l,raw:c.constant(s)});t(p)}}},Sa=function(e,t,n,r,o){var i=xa(n,r);return e.dom().addEventListener(t,i,o),{unbind:c.curry(Ca,e,t,i,o)}},Ca=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},Ra=function(e,t,n,r){return Sa(e,t,n,r,!1)},Ta=function(e,t,n,r){return Sa(e,t,n,r,!0)},Da=c.constant(!0),Aa={bind:function(e,t,n){return Ra(e,t,Da,n)},capture:function(e,t,n){return Ta(e,t,Da,n)}},ka=wa.mode({compare:function(e,t){return Xr(t.left()-e.left(),t.top()-e.top())},extract:function(e){return g.some(Xr(e.x(),e.y()))},sink:function(e,t){var n,r,o,i=(n=t,r=_o.merge({layerClass:ya.resolve("blocker")},n),o=X.fromTag("div"),ht.set(o,"role","presentation"),Kt.setAll(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),bi.add(o,ya.resolve("blocker")),bi.add(o,r.layerClass),{element:function(){return o},destroy:function(){nn.remove(o)}}),u=Aa.bind(i.element(),"mousedown",e.forceDrop),a=Aa.bind(i.element(),"mouseup",e.drop),c=Aa.bind(i.element(),"mousemove",e.move),l=Aa.bind(i.element(),"mouseout",e.delayDrop);return wa.sink({element:i.element,start:function(e){Zt.append(e,i.element())},stop:function(){nn.remove(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function Na(){var e=g.none(),t=ba.create({move:va(["info"])});return{onEvent:function(n,r){r.extract(n).each(function(n){var o,i,u;(o=r,i=n,u=e.map(function(e){return o.compare(e,i)}),e=g.some(i),u).each(function(e){t.trigger.move(e)})})},reset:function(){e=g.none()},events:t.registry}}function Oa(){var e={onEvent:function(e,t){},reset:c.noop},t=Na(),n=e;return{on:function(){n.reset(),n=t},off:function(){n.reset(),n=e},isOn:function(){return n===t},onEvent:function(e,t){n.onEvent(e,t)},events:t.events}}var Ea=function(e,t){var n=null;return{cancel:function(){null!==n&&(clearTimeout(n),n=null)},throttle:function(){var r=arguments;null!==n&&clearTimeout(n),n=setTimeout(function(){e.apply(null,r),n=null,r=null},t)}}},Ba=function(e,t,n){var r=!1,o=ba.create({start:va([]),stop:va([])}),i=Oa(),u=function(){l.stop(),i.isOn()&&(i.off(),o.trigger.stop())},a=Ea(u,200);i.events.move.bind(function(n){t.mutate(e,n.info())});var c=function(e){return function(){var t=Array.prototype.slice.call(arguments,0);if(r)return e.apply(null,t)}},l=t.sink(wa.api({forceDrop:u,drop:c(u),move:c(function(e,n){a.cancel(),i.onEvent(e,t)}),delayDrop:c(a.throttle)}),n);return{element:l.element,go:function(e){l.start(e),i.on(),o.trigger.start()},on:function(){r=!0},off:function(){r=!1},destroy:function(){l.destroy()},events:o.registry}},Ia={transform:function(e,t){var n=t!==undefined?t:{},r=n.mode!==undefined?n.mode:ka;return Ba(e,r,t)}};function Pa(){var e,t=ba.create({drag:va(["xDelta","yDelta","target"])}),n=g.none(),r={mutate:function(t,n){e.trigger.drag(t,n)},events:(e=ba.create({drag:va(["xDelta","yDelta"])})).registry};return r.events.drag.bind(function(e){n.each(function(n){t.trigger.drag(e.xDelta(),e.yDelta(),n)})}),{assign:function(e){n=g.some(e)},get:function(){return n},mutate:r.mutate,events:t.registry}}var Wa={any:function(e){return Pt.first(e).isSome()},ancestor:function(e,t,n){return Pt.ancestor(e,t,n).isSome()},sibling:function(e,t){return Pt.sibling(e,t).isSome()},child:function(e,t){return Pt.child(e,t).isSome()},descendant:function(e,t){return Pt.descendant(e,t).isSome()},closest:function(e,t,n){return Pt.closest(e,t,n).isSome()}},_a=oi.resolve("resizer-bar-dragging");function Ma(e,t){var n=ao.height,r=function(e,t,n){var r=Pa(),o=Ia.transform(r,{}),i=g.none(),u=function(e,t){return g.from(ht.get(e,t))};r.events.drag.bind(function(e){u(e.target(),"data-row").each(function(t){var n=vu.getInt(e.target(),"top");Kt.set(e.target(),"top",n+e.yDelta()+"px")}),u(e.target(),"data-column").each(function(t){var n=vu.getInt(e.target(),"left");Kt.set(e.target(),"left",n+e.xDelta()+"px")})});var a=function(e,t){return vu.getInt(e,t)-parseInt(ht.get(e,"data-initial-"+t),10)};o.events.stop.bind(function(){r.get().each(function(r){i.each(function(o){u(r,"data-row").each(function(e){var t=a(r,"top");ht.remove(r,"data-initial-top"),m.trigger.adjustHeight(o,t,parseInt(e,10))}),u(r,"data-column").each(function(e){var t=a(r,"left");ht.remove(r,"data-initial-left"),m.trigger.adjustWidth(o,t,parseInt(e,10))}),Di.refresh(e,o,n,t)})})});var l=function(t,n){m.trigger.startAdjust(),r.assign(t),ht.set(t,"data-initial-"+n,parseInt(Kt.get(t,n),10)),bi.add(t,_a),Kt.set(t,"opacity","0.2"),o.go(e.parent())},s=Aa.bind(e.parent(),"mousedown",function(e){Di.isRowBar(e.target())&&l(e.target(),"top"),Di.isColBar(e.target())&&l(e.target(),"left")}),f=function(t){return Ye.eq(t,e.view())},d=Aa.bind(e.view(),"mouseover",function(r){"table"===ft.name(r.target())||Wa.ancestor(r.target(),"table",f)?(i="table"===ft.name(r.target())?g.some(r.target()):Pt.ancestor(r.target(),"table",f)).each(function(r){Di.refresh(e,r,n,t)}):wt.inBody(r.target())&&Di.destroy(e)}),m=ba.create({adjustHeight:va(["table","delta","row"]),adjustWidth:va(["table","delta","column"]),startAdjust:va([])});return{destroy:function(){s.unbind(),d.unbind(),o.destroy(),Di.destroy(e)},refresh:function(r){Di.refresh(e,r,n,t)},on:o.on,off:o.off,hideBars:c.curry(Di.hide,e),showBars:c.curry(Di.show,e),events:m.registry}}(e,t,n),o=ba.create({beforeResize:va(["table"]),afterResize:va(["table"]),startDrag:va([])});return r.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=n.delta(e.delta(),e.table());Pu.adjustHeight(e.table(),t,e.row(),n),o.trigger.afterResize(e.table())}),r.events.startAdjust.bind(function(e){o.trigger.startDrag()}),r.events.adjustWidth.bind(function(e){o.trigger.beforeResize(e.table());var n=t.delta(e.delta(),e.table());Pu.adjustWidth(e.table(),n,e.column(),t),o.trigger.afterResize(e.table())}),{on:r.on,off:r.off,hideBars:r.hideBars,showBars:r.showBars,destroy:r.destroy,events:o.registry}}var La={get:function(e,t){return e.inline?ha.body(Gu.getBody(e),(n=X.fromTag("div"),Kt.setAll(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Zt.append(wt.body(),n),n)):ha.only(X.fromDom(e.getDoc()));var n},remove:function(e,t){e.inline&&nn.remove(t.parent())}};function qa(e){var t,n,r=g.none(),o=g.none(),i=g.none(),u=/(\d+(\.\d+)?)%/,a=function(e){return"TABLE"===e.nodeName};return e.on("init",function(){var t=lo(Ju.directionAt),n=La.get(e);if(i=g.some(n),e.settings.object_resizing&&!1!==e.settings.table_resize_bars&&(!0===e.settings.object_resizing||"table"===e.settings.object_resizing)){var u=Ma(n,t);u.on(),u.events.startDrag.bind(function(t){r=g.some(e.selection.getRng())}),u.events.afterResize.bind(function(t){var n=t.table(),o=St.descendants(n,"td[data-mce-style],th[data-mce-style]");A.each(o,function(e){ht.remove(e,"data-mce-style")}),r.each(function(t){e.selection.setRng(t),e.focus()}),e.undoManager.add()}),o=g.some(u)}}),e.on("ObjectResizeStart",function(r){var o;a(r.target)&&(t=r.width,o=r.target,n=e.dom.getStyle(o,"width")||e.dom.getAttrib(o,"width"))}),e.on("ObjectResized",function(r){if(a(r.target)){var o=r.target;if(u.test(n)){var i=parseFloat(u.exec(n)[1]),c=r.width*i/t;e.dom.setStyle(o,"width",c+"%")}else{var l=[];ea.each(o.rows,function(t){ea.each(t.cells,function(t){var n=e.dom.getStyle(t,"width",!0);l.push({cell:t,width:n})})}),ea.each(l,function(t){e.dom.setStyle(t.cell,"width",t.width),e.dom.setAttrib(t.cell,"width",null)})}}}),{lazyResize:function(){return o},lazyWire:function(){return i.getOr(ha.only(X.fromDom(e.getBody())))},destroy:function(){o.each(function(e){e.destroy()}),i.each(function(t){La.remove(e,t)})}}}var za=function(e){return{fold:e}},Fa=function(e){return za(function(t,n,r,o){return t(e)})},ja=function(e){return za(function(t,n,r,o){return n(e)})},Ha=function(e,t){return za(function(n,r,o,i){return o(e,t)})},Va=function(e){return za(function(t,n,r,o){return o(e)})},Ua=function(e,t){return Lt.table(e,t).bind(function(t){var n=Lt.cells(t);return A.findIndex(n,function(t){return Ye.eq(e,t)}).map(function(e){return{index:c.constant(e),all:c.constant(n)}})})},Ga=function(e,t){return Ua(e,t).fold(function(){return Fa(e)},function(t){return t.index()+1<t.all().length?Ha(e,t.all()[t.index()+1]):Va(e)})},Xa=function(e,t){return Ua(e,t).fold(function(){return Fa()},function(t){return t.index()-1>=0?Ha(e,t.all()[t.index()-1]):ja(e)})},Ya=cr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),$a={before:Ya.before,on:Ya.on,after:Ya.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(c.identity,c.identity,c.identity)}},Ka=cr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Ja=L.immutable("start","soffset","finish","foffset"),Qa={domRange:Ka.domRange,relative:Ka.relative,exact:Ka.exact,exactFromRange:function(e){return Ka.exact(e.start(),e.soffset(),e.finish(),e.foffset())},range:Ja,getWin:function(e){var t=e.match({domRange:function(e){return X.fromDom(e.startContainer)},relative:function(e,t){return $a.getStart(e)},exact:function(e,t,n,r){return e}});return nt.defaultView(t)}},Za=function(e,t,n,r){var o=nt.owner(e).dom().createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},ec=function(e,t,n,r){var o=Za(e,t,n,r),i=Ye.eq(e,n)&&t===r;return o.collapsed&&!i},tc=function(e,t){var n=(t||document).createDocumentFragment();return A.each(e,function(e){n.appendChild(e.dom())}),X.fromDom(n)},nc=function(e,t){e.selectNodeContents(t.dom())},rc=function(e){e.deleteContents()},oc=function(e){return{left:c.constant(e.left),top:c.constant(e.top),right:c.constant(e.right),bottom:c.constant(e.bottom),width:c.constant(e.width),height:c.constant(e.height)}},ic={create:function(e){return e.document.createRange()},replaceWith:function(e,t){rc(e),e.insertNode(t.dom())},selectNodeContents:function(e,t){var n=e.document.createRange();return nc(n,t),n},selectNodeContentsUsing:nc,relativeToNative:function(e,t,n){var r,o,i=e.document.createRange();return r=i,t.fold(function(e){r.setStartBefore(e.dom())},function(e,t){r.setStart(e.dom(),t)},function(e){r.setStartAfter(e.dom())}),o=i,n.fold(function(e){o.setEndBefore(e.dom())},function(e,t){o.setEnd(e.dom(),t)},function(e){o.setEndAfter(e.dom())}),i},exactToNative:function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},deleteContents:rc,cloneFragment:function(e){var t=e.cloneContents();return X.fromDom(t)},getFirstRect:function(e){var t=e.getClientRects(),n=t.length>0?t[0]:e.getBoundingClientRect();return n.width>0||n.height>0?g.some(n).map(oc):g.none()},getBounds:function(e){var t=e.getBoundingClientRect();return t.width>0||t.height>0?g.some(t).map(oc):g.none()},isWithin:function(e,t){return t.compareBoundaryPoints(e.END_TO_START,e)<1&&t.compareBoundaryPoints(e.START_TO_END,e)>-1},toString:function(e){return e.toString()}},uc=cr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ac=function(e,t,n){return t(X.fromDom(n.startContainer),n.startOffset,X.fromDom(n.endContainer),n.endOffset)},cc=function(e,t){var n,r,o,i=(n=e,t.match({domRange:function(e){return{ltr:c.constant(e),rtl:g.none}},relative:function(e,t){return{ltr:se(function(){return ic.relativeToNative(n,e,t)}),rtl:se(function(){return g.some(ic.relativeToNative(n,t,e))})}},exact:function(e,t,r,o){return{ltr:se(function(){return ic.exactToNative(n,e,t,r,o)}),rtl:se(function(){return g.some(ic.exactToNative(n,r,o,e,t))})}}}));return(o=(r=i).ltr()).collapsed?r.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return uc.rtl(X.fromDom(e.endContainer),e.endOffset,X.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return ac(0,uc.ltr,o)}):ac(0,uc.ltr,o)},lc={ltr:uc.ltr,rtl:uc.rtl,diagnose:cc,asLtrRange:function(e,t){return cc(e,t).match({ltr:function(t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},rtl:function(t,n,r,o){var i=e.document.createRange();return i.setStart(r.dom(),o),i.setEnd(t.dom(),n),i}})}},sc=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},fc=function(e,t,n,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=e(u),c=Math.abs(t-a.left);if(n>a.bottom);else{if(n<a.top||c>i)return u-1;i=c}}return 0},dc={locate:function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getClientRects();return Lo(i,function(e){return sc(e,n,r)?g.some(e):g.none()}).map(function(o){return i=e,u=t,a=n,c=r,l=o,s=function(e){var t=i.dom().createRange();return t.setStart(u.dom(),e),t.collapse(!0),t},f=mn.get(u).length,d=fc(function(e){return s(e).getBoundingClientRect()},a,c,l.right,f),s(d);var i,u,a,c,l,s,f,d})}},mc=function(e,t,n,r){var o=e.dom().createRange(),i=nt.children(t);return Lo(i,function(t){return o.selectNode(t.dom()),sc(o.getBoundingClientRect(),n,r)?gc(e,t,n,r):g.none()})},gc=function(e,t,n,r){return(ft.isText(t)?dc.locate:mc)(e,t,n,r)},pc=function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return gc(e,t,u,a)},hc=function(e,t){return t-e.left<e.right-t},vc=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},bc=function(e,t,n){var r=e.dom().createRange();r.selectNode(t.dom());var o=r.getBoundingClientRect(),i=hc(o,n);return(!0===i?wn.first:wn.last)(t).map(function(t){return vc(e,t,i)})},wc=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=hc(r,n);return g.some(vc(e,t,o))},yc=function(e,t,n){return(0===nt.children(t).length?wc:bc)(e,t,n)},xc=document.caretPositionFromPoint?function(e,t,n){return g.from(e.dom().caretPositionFromPoint(t,n)).bind(function(t){if(null===t.offsetNode)return g.none();var n=e.dom().createRange();return n.setStart(t.offsetNode,t.offset),n.collapse(),g.some(n)})}:document.caretRangeFromPoint?function(e,t,n){return g.from(e.dom().caretRangeFromPoint(t,n))}:function(e,t,n){return X.fromPoint(e,t,n).bind(function(r){var o=function(){return yc(e,r,t)};return 0===nt.children(r).length?o():function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect(),u=Math.max(i.left,Math.min(i.right,n)),a=Math.max(i.top,Math.min(i.bottom,r));return pc(e,t,u,a)}(e,r,t,n).orThunk(o)})},Sc=function(e,t,n){var r=X.fromDom(e.document);return xc(r,t,n).map(function(e){return Qa.range(X.fromDom(e.startContainer),e.startOffset,X.fromDom(e.endContainer),e.endOffset)})},Cc=function(e,t,n){var r,o,i,u,a,c,l=lc.asLtrRange(e,t),s=X.fromDom(l.commonAncestorContainer);return ft.isElement(s)?(r=e,o=s,i=l,u=n,a=ic.create(r),c=(te.is(o,u)?[o]:[]).concat(St.descendants(o,u)),A.filter(c,function(e){return ic.selectNodeContentsUsing(a,e),ic.isWithin(i,a)})):[]},Rc=function(e,t){var n=ft.name(e);return"input"===n?$a.after(e):A.contains(["br","img"],n)?0===t?$a.before(e):$a.after(e):$a.on(e,t)},Tc=function(e,t){var n=e.fold($a.before,Rc,$a.after),r=t.fold($a.before,Rc,$a.after);return Qa.relative(n,r)},Dc=function(e,t,n,r){var o=Rc(e,t),i=Rc(n,r);return Qa.relative(o,i)},Ac=function(e){return e.match({domRange:function(e){var t=X.fromDom(e.startContainer),n=X.fromDom(e.endContainer);return Dc(t,e.startOffset,n,e.endOffset)},relative:Tc,exact:Dc})},kc=Tc,Nc=Dc,Oc=function(e,t){g.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},Ec=function(e,t,n,r,o){var i=ic.exactToNative(e,t,n,r,o);Oc(e,i)},Bc=function(e,t){return lc.diagnose(e,t).match({ltr:function(t,n,r,o){Ec(e,t,n,r,o)},rtl:function(t,n,r,o){var i=e.getSelection();i.extend?(i.collapse(t.dom(),n),i.extend(r.dom(),o)):Ec(e,r,o,t,n)}})},Ic=function(e){var t=X.fromDom(e.anchorNode),n=X.fromDom(e.focusNode);return ec(t,e.anchorOffset,n,e.focusOffset)?g.some(Qa.range(X.fromDom(e.anchorNode),e.anchorOffset,X.fromDom(e.focusNode),e.focusOffset)):function(e){if(e.rangeCount>0){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return g.some(Qa.range(X.fromDom(t.startContainer),t.startOffset,X.fromDom(n.endContainer),n.endOffset))}return g.none()}(e)},Pc=function(e){var t=e.getSelection();return t.rangeCount>0?Ic(t):g.none()},Wc={setExact:function(e,t,n,r,o){var i=Nc(t,n,r,o);Bc(e,i)},getExact:Pc,get:function(e){return Pc(e).map(function(e){return Qa.exact(e.start(),e.soffset(),e.finish(),e.foffset())})},setRelative:function(e,t,n){var r=kc(t,n);Bc(e,r)},toNative:function(e){var t=Qa.getWin(e).dom(),n=function(e,n,r,o){return ic.exactToNative(t,e,n,r,o)},r=Ac(e);return lc.diagnose(t,r).match({ltr:n,rtl:n})},setToElement:function(e,t){var n=ic.selectNodeContents(e,t);Oc(e,n)},clear:function(e){e.getSelection().removeAllRanges()},clone:function(e,t){var n=lc.asLtrRange(e,t);return ic.cloneFragment(n)},replace:function(e,t,n){var r=lc.asLtrRange(e,t),o=tc(n,e.document);ic.replaceWith(r,o)},deleteAt:function(e,t){var n=lc.asLtrRange(e,t);ic.deleteContents(n)},forElement:function(e,t){var n=ic.selectNodeContents(e,t);return Qa.range(X.fromDom(n.startContainer),n.startOffset,X.fromDom(n.endContainer),n.endOffset)},getFirstRect:function(e,t){var n=lc.asLtrRange(e,t);return ic.getFirstRect(n)},getBounds:function(e,t){var n=lc.asLtrRange(e,t);return ic.getBounds(n)},getAtPoint:function(e,t,n){return Sc(e,t,n)},findWithin:function(e,t,n){return Cc(e,t,n)},getAsString:function(e,t){var n=lc.asLtrRange(e,t);return ic.toString(n)},isCollapsed:function(e,t,n,r){return Ye.eq(e,n)&&t===r}},_c=tinymce.util.Tools.resolve("tinymce.util.VK"),Mc=function(e,t,n,r){return zc(e,t,Ga(n),r)},Lc=function(e,t,n,r){return zc(e,t,Xa(n),r)},qc=function(e,t){var n=Qa.exact(t,0,t,0);return Wc.toNative(n)},zc=function(e,t,n,r,o){return n.fold(g.none,g.none,function(e,t){return wn.first(t).map(function(e){return qc(0,e)})},function(n){return Lt.table(n,t).bind(function(t){var o,i,u=vr.noMenu(n);return e.undoManager.transact(function(){r.insertRowsAfter(t,u)}),o=t,i=St.descendants(o,"tr"),A.last(i).bind(function(e){return Pt.descendant(e,"td,th").map(function(e){return qc(0,e)})})})})},Fc=["table","li","dl"],jc={handle:function(e,t,n,r){if(e.keyCode===_c.TAB){var o=Gu.getBody(t),i=function(e){var t=ft.name(e);return Ye.eq(e,o)||A.contains(Fc,t)},u=t.selection.getRng();if(u.collapsed){var a=X.fromDom(u.startContainer);Lt.cell(a,i).each(function(o){e.preventDefault(),(e.shiftKey?Lc:Mc)(t,i,o,n,r).each(function(e){t.selection.setRng(e)})})}}}},Hc={response:L.immutable("selection","kill")},Vc=function(e){return function(t){return t===e}},Uc=Vc(38),Gc=Vc(40),Xc={ltr:{isBackward:Vc(37),isForward:Vc(39)},rtl:{isBackward:Vc(39),isForward:Vc(37)},isUp:Uc,isDown:Gc,isNavigation:function(e){return e>=37&&e<=40}},Yc={convertToRange:function(e,t){var n=lc.asLtrRange(e,t);return{start:c.constant(X.fromDom(n.startContainer)),soffset:c.constant(n.startOffset),finish:c.constant(X.fromDom(n.endContainer)),foffset:c.constant(n.endOffset)}},makeSitus:function(e,t,n,r){return{start:c.constant($a.on(e,t)),finish:c.constant($a.on(n,r))}}},$c=Ue.detect().browser.isSafari(),Kc=function(e){var t=e!==undefined?e.dom():document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop;return Xr(n,r)},Jc=function(e,t,n){(n!==undefined?n.dom():document).defaultView.scrollTo(e,t)},Qc=function(e,t){$c&&W.isFunction(e.dom().scrollIntoViewIfNeeded)?e.dom().scrollIntoViewIfNeeded(!1):e.dom().scrollIntoView(t)},Zc={get:Kc,to:Jc,by:function(e,t,n){(n!==undefined?n.dom():document).defaultView.scrollBy(e,t)},preserve:function(e,t){var n=Kc(e);t();var r=Kc(e);n.top()===r.top()&&n.left()===r.left()||Jc(n.left(),n.top(),e)},capture:function(e){var t=g.none(),n=function(){t=g.some(Kc(e))};return n(),{save:n,restore:function(){t.each(function(t){Jc(t.left(),t.top(),e)})}}},intoView:Qc,intoViewIfNeeded:function(e,t){var n=t.dom().getBoundingClientRect(),r=e.dom().getBoundingClientRect();r.top<n.top?Qc(e,!0):r.bottom>n.bottom&&Qc(e,!1)},setToElement:function(e,t){var n=Kr(t),r=X.fromDom(e.document);Jc(n.left(),n.top(),r)},scrollBarWidth:function(){var e=X.fromHtml('<div style="width: 100px; height: 100px; overflow: scroll; position: absolute; top: -9999px;"></div>');Zt.after(wt.body(),e);var t=e.dom().offsetWidth-e.dom().clientWidth;return nn.remove(e),t}};function el(e){return{elementFromPoint:function(t,n){return g.from(e.document.elementFromPoint(t,n)).map(X.fromDom)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(t,n,r,o){var i=Qa.exact(t,n,r,o);return Wc.getFirstRect(e,i).map(function(e){return I.map(e,c.apply)})},getSelection:function(){return Wc.get(e).map(function(t){return Yc.convertToRange(e,t)})},fromSitus:function(t){var n=Qa.relative(t.start(),t.finish());return Yc.convertToRange(e,n)},situsFromPoint:function(t,n){return Wc.getAtPoint(e,t,n).map(function(e){return{start:c.constant($a.on(e.start(),e.soffset())),finish:c.constant($a.on(e.finish(),e.foffset()))}})},clearSelection:function(){Wc.clear(e)},setSelection:function(t){Wc.setExact(e,t.start(),t.soffset(),t.finish(),t.foffset())},setRelativeSelection:function(t,n){Wc.setRelative(e,t,n)},selectContents:function(t){Wc.setToElement(e,t)},getInnerHeight:function(){return e.innerHeight},getScrollY:function(){return Zc.get(X.fromDom(e.document)).top()},scrollBy:function(t,n){Zc.by(t,n,X.fromDom(e.document))}}}var tl=function(e,t,n,r,o){if(!Ye.eq(n,r))return nr.identify(n,r,t).bind(function(t){var r=t.boxes().getOr([]);return r.length>0?(o(e,r,t.start(),t.finish()),g.some(Hc.response(g.some(Yc.makeSitus(n,0,n,hn(n))),!0))):g.none()})},nl={sync:function(e,t,n,r,o,i,u){return Ye.eq(n,o)&&r===i?g.none():Pt.closest(n,"td,th",t).bind(function(n){return Pt.closest(o,"td,th",t).bind(function(r){return tl(e,t,n,r,u)})})},detect:tl,update:function(e,t,n,r,o){return nr.shiftSelection(r,e,t,o.firstSelectedSelector(),o.lastSelectedSelector()).map(function(e){return o.clear(n),o.selectRange(n,e.boxes(),e.start(),e.finish()),e.boxes()})}},rl=L.immutableBag(["left","top","right","bottom"],[]),ol={nu:rl,moveUp:function(e,t){return rl({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return rl({left:e.left(),top:e.top()+t,right:e.right(),bottom:e.bottom()+t})},moveBottomTo:function(e,t){var n=e.bottom()-e.top();return rl({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return rl({left:e.left(),top:t,right:e.right(),bottom:t+n})},getTop:function(e){return e.top()},getBottom:function(e){return e.bottom()},translate:function(e,t,n){return rl({left:e.left()+t,top:e.top()+n,right:e.right()+t,bottom:e.bottom()+n})},toString:function(e){return"("+e.left()+", "+e.top()+") -> ("+e.right()+", "+e.bottom()+")"}},il=function(e){return ol.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},ul=function(e,t){return g.some(e.getRect(t))},al=function(e,t,n){return ft.isElement(t)?ul(e,t).map(il):ft.isText(t)?(r=e,o=t,i=n,i>=0&&i<hn(o)?r.getRangedRect(o,i,o,i+1):i>0?r.getRangedRect(o,i-1,o,i):g.none()).map(il):g.none();var r,o,i},cl=function(e,t){return ft.isElement(t)?ul(e,t).map(il):ft.isText(t)?e.getRangedRect(t,0,t,hn(t)).map(il):g.none()},ll=L.immutable("item","mode"),sl=function(e,t,n,r){var o=r!==undefined?r:fl;return e.property().parent(t).map(function(e){return ll(e,o)})},fl=function(e,t,n,r){var o=r!==undefined?r:dl;return n.sibling(e,t).map(function(e){return ll(e,o)})},dl=function(e,t,n,r){var o=r!==undefined?r:dl,i=e.property().children(t);return n.first(i).map(function(e){return ll(e,o)})},ml=[{current:sl,next:fl,fallback:g.none()},{current:fl,next:dl,fallback:g.some(sl)},{current:dl,next:dl,fallback:g.some(fl)}],gl=function(e,t,n,r,o){return o=o!==undefined?o:ml,A.find(o,function(e){return e.current===n}).bind(function(n){return n.current(e,t,r,n.next).orThunk(function(){return n.fallback.bind(function(n){return gl(e,t,n,r)})})})},pl={backtrack:sl,sidestep:fl,advance:dl,go:gl},hl={left:function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return e.length>0?g.some(e[e.length-1]):g.none()}}},right:function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return e.length>0?g.some(e[0]):g.none()}}}},vl=function(e,t,n,r,o,i){return pl.go(e,t,r,o).bind(function(t){return i(t.item())?g.none():n(t.item())?g.some(t.item()):vl(e,t.item(),n,t.mode(),o,i)})},bl=function(e,t,n,r){return vl(e,t,n,pl.sidestep,hl.left(),r)},wl=function(e,t,n,r){return vl(e,t,n,pl.sidestep,hl.right(),r)},yl=function(e,t){return 0===e.property().children(t).length},xl=function(e,t,n,r){return bl(e,t,n,r)},Sl=function(e,t,n,r){return wl(e,t,n,r)},Cl={before:function(e,t,n){return xl(e,t,c.curry(yl,e),n)},after:function(e,t,n){return Sl(e,t,c.curry(yl,e),n)},seekLeft:xl,seekRight:Sl,walkers:function(){return{left:hl.left,right:hl.right}},walk:function(e,t,n,r,o){return pl.go(e,t,n,r,o)},backtrack:pl.backtrack,sidestep:pl.sidestep,advance:pl.advance},Rl=An(),Tl={gather:function(e,t,n){return Cl.gather(Rl,e,t,n)},before:function(e,t){return Cl.before(Rl,e,t)},after:function(e,t){return Cl.after(Rl,e,t)},seekLeft:function(e,t,n){return Cl.seekLeft(Rl,e,t,n)},seekRight:function(e,t,n){return Cl.seekRight(Rl,e,t,n)},walkers:function(){return Cl.walkers()},walk:function(e,t,n,r){return Cl.walk(Rl,e,t,n,r)}},Dl=cr([{none:[]},{retry:["caret"]}]),Al=function(e,t,n){return Bt.closest(t,No).fold(c.constant(!1),function(t){return cl(e,t).exists(function(e){return r=e,(t=n).left()<r.left()||Math.abs(r.right()-t.left())<1||t.left()>r.right();var t,r})})},kl={point:ol.getTop,adjuster:function(e,t,n,r,o){var i=ol.moveUp(o,5);return Math.abs(n.top()-r.top())<1?Dl.retry(i):n.bottom()<o.top()?Dl.retry(i):n.bottom()===o.top()?Dl.retry(ol.moveUp(o,1)):Al(e,t,o)?Dl.retry(ol.translate(i,5,0)):Dl.none()},move:ol.moveUp,gather:Tl.before},Nl={point:ol.getBottom,adjuster:function(e,t,n,r,o){var i=ol.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?Dl.retry(i):n.top()>o.bottom()?Dl.retry(i):n.top()===o.bottom()?Dl.retry(ol.moveDown(o,1)):Al(e,t,o)?Dl.retry(ol.translate(i,5,0)):Dl.none()},move:ol.moveDown,gather:Tl.after},Ol=function(e,t,n,r,o){return 0===o?g.some(r):(c=e,l=r.left(),s=t.point(r),c.elementFromPoint(l,s).filter(function(e){return"table"===ft.name(e)}).isSome()?(u=r,a=o-1,Ol(e,i=t,n,i.move(u,5),a)):e.situsFromPoint(r.left(),t.point(r)).bind(function(i){return i.start().fold(g.none,function(i,u){return cl(e,i,u).bind(function(u){return t.adjuster(e,i,u,n,r).fold(g.none,function(r){return Ol(e,t,n,r,o-1)})}).orThunk(function(){return g.some(r)})},g.none)}));var i,u,a,c,l,s},El=function(e,t,n){var r,o,i,u=e.move(n,5),a=Ol(t,e,n,u,100).getOr(u);return(r=e,o=a,i=t,r.point(o)>i.getInnerHeight()?g.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?g.some(-r.point(o)):g.none()).fold(function(){return t.situsFromPoint(a.left(),e.point(a))},function(n){return t.scrollBy(0,n),t.situsFromPoint(a.left(),e.point(a)-n)})},Bl={tryUp:c.curry(El,kl),tryDown:c.curry(El,Nl),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:c.constant(5)},Il=cr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),Pl=function(e){return Pt.closest(e,"tr")},Wl={verify:function(e,t,n,r,o,i,u){return Pt.closest(r,"td,th",u).bind(function(n){return Pt.closest(t,"td,th",u).map(function(t){return Ye.eq(n,t)?Ye.eq(r,n)&&hn(n)===o?i(t):Il.none("in same cell"):Mn(Pl,[n,t]).fold(function(){return o=t,u=n,a=(r=e).getRect(o),(c=r.getRect(u)).right>a.left&&c.left<a.right?Il.success():i(t);var r,o,u,a,c},function(e){return i(t)})})}).getOr(Il.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)},adt:Il},_l={point:L.immutable("element","offset"),delta:L.immutable("element","deltaOffset"),range:L.immutable("element","start","finish"),points:L.immutable("begin","end"),text:L.immutable("element","text")},Ml=(L.immutable("ancestor","descendants","element","index"),L.immutable("parent","children","element","index")),Ll=function(e,t){return A.findIndex(e,c.curry(Ye.eq,t))},ql=function(e){return nt.parent(e).bind(function(t){var n=nt.children(t);return Ll(n,e).map(function(r){return Ml(t,n,e,r)})})},zl=function(e){return"br"===ft.name(e)},Fl=function(e,t,n){return t(e,n).bind(function(e){return ft.isText(e)&&0===mn.get(e).trim().length?Fl(e,t,n):g.some(e)})},jl=function(e,t,n,r){return(o=t,i=n,nt.child(o,i).filter(zl).orThunk(function(){return nt.child(o,i-1).filter(zl)})).bind(function(t){return r.traverse(t).fold(function(){return Fl(t,r.gather,e).map(r.relative)},function(e){return ql(e).map(function(e){return $a.on(e.parent(),e.index())})})});var o,i},Hl=function(e,t,n,r){var o,i,u;return(zl(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return Fl(i,u.gather,o)}).map(u.relative)):jl(e,t,n,r)).map(function(e){return{start:c.constant(e),finish:c.constant(e)}})},Vl=function(e){return Wl.cata(e,function(e){return g.none("BR ADT: none")},function(){return g.none()},function(e){return g.some(_l.point(e,0))},function(e){return g.some(_l.point(e,hn(e)))})},Ul=Ue.detect(),Gl=function(e,t,n,r,o,i){return 0===i?g.none():$l(e,t,n,r,o).bind(function(u){var a=e.fromSitus(u),c=Wl.verify(e,n,r,a.finish(),a.foffset(),o.failure,t);return Wl.cata(c,function(){return g.none()},function(){return g.some(u)},function(u){return Ye.eq(n,u)&&0===r?Xl(e,n,r,ol.moveUp,o):Gl(e,t,u,0,o,i-1)},function(u){return Ye.eq(n,u)&&r===hn(u)?Xl(e,n,r,ol.moveDown,o):Gl(e,t,u,hn(u),o,i-1)})})},Xl=function(e,t,n,r,o){return al(e,t,n).bind(function(t){return Yl(e,o,r(t,Bl.getJumpSize()))})},Yl=function(e,t,n){return Ul.browser.isChrome()||Ul.browser.isSafari()||Ul.browser.isFirefox()||Ul.browser.isEdge()?t.otherRetry(e,n):Ul.browser.isIE()?t.ieRetry(e,n):g.none()},$l=function(e,t,n,r,o){return al(e,n,r).bind(function(t){return Yl(e,o,t)})},Kl=function(e,t,n){return(r=e,o=t,i=n,r.getSelection().bind(function(e){return Hl(o,e.finish(),e.foffset(),i).fold(function(){return g.some(_l.point(e.finish(),e.foffset()))},function(t){var n=r.fromSitus(t),u=Wl.verify(r,e.finish(),e.foffset(),n.finish(),n.foffset(),i.failure,o);return Vl(u)})})).bind(function(r){return Gl(e,t,r.element(),r.offset(),n,20).map(e.fromSitus)});var r,o,i},Jl=function(e,t,n){return Bt.ancestor(e,t,n).isSome()},Ql=Ue.detect(),Zl=function(e,t,n,r,o){return Pt.closest(r,"td,th",t).bind(function(r){return Pt.closest(r,"table",t).bind(function(i){return u=i,Jl(o,function(e){return nt.parent(e).exists(function(e){return Ye.eq(e,u)})})?Kl(e,t,n).bind(function(e){return Pt.closest(e.finish(),"td,th",t).map(function(t){return{start:c.constant(r),finish:c.constant(t),range:c.constant(e)}})}):g.none();var u})})},es=function(e,t,n,r,o,i){return Ql.browser.isIE()?g.none():i(r,t).orThunk(function(){return Zl(e,t,n,r,o).map(function(e){var t=e.range();return Hc.response(g.some(Yc.makeSitus(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},ts=function(e,t,n,r,o,i,u){return Zl(e,n,r,o,i).bind(function(e){return nl.detect(t,n,e.start(),e.finish(),u)})},ns=function(e,t){return Pt.closest(e,"tr",t).bind(function(e){return Pt.closest(e,"table",t).bind(function(n){var r=St.descendants(n,"tr");return Ye.eq(e,r[0])?Tl.seekLeft(n,function(e){return wn.last(e).isSome()},t).map(function(e){var t=hn(e);return Hc.response(g.some(Yc.makeSitus(e,t,e,t)),!0)}):g.none()})})},rs=function(e,t){return Pt.closest(e,"tr",t).bind(function(e){return Pt.closest(e,"table",t).bind(function(n){var r=St.descendants(n,"tr");return Ye.eq(e,r[r.length-1])?Tl.seekRight(n,function(e){return wn.first(e).isSome()},t).map(function(e){return Hc.response(g.some(Yc.makeSitus(e,0,e,0)),!0)}):g.none()})})},os=function(e,t){return Pt.closest(e,"td,th",t)},is={down:{traverse:nt.nextSibling,gather:Tl.after,relative:$a.before,otherRetry:Bl.tryDown,ieRetry:Bl.ieTryDown,failure:Wl.adt.failedDown},up:{traverse:nt.prevSibling,gather:Tl.before,relative:$a.before,otherRetry:Bl.tryUp,ieRetry:Bl.ieTryUp,failure:Wl.adt.failedUp}},us=L.immutable("rows","cols"),as={mouse:function(e,t,n,r){var o,i,u,a,c,l,s=el(e),f=(o=s,i=t,u=n,a=r,c=g.none(),l=function(){c=g.none()},{mousedown:function(e){a.clear(i),c=os(e.target(),u)},mouseover:function(e){c.each(function(t){a.clear(i),os(e.target(),u).each(function(e){nr.identify(t,e,u).each(function(n){var r=n.boxes().getOr([]);(r.length>1||1===r.length&&!Ye.eq(t,e))&&(a.selectRange(i,r,n.start(),n.finish()),o.selectContents(e))})})})},mouseup:function(){c.each(l)}});return{mousedown:f.mousedown,mouseover:f.mouseover,mouseup:f.mouseup}},keyboard:function(e,t,n,r){var o=el(e),i=function(){return r.clear(t),g.none()};return{keydown:function(e,u,a,l,s,f){var d=e.raw().which,m=!0===e.raw().shiftKey;return nr.retrieve(t,r.selectedSelector()).fold(function(){return Xc.isDown(d)&&m?c.curry(ts,o,t,n,is.down,l,u,r.selectRange):Xc.isUp(d)&&m?c.curry(ts,o,t,n,is.up,l,u,r.selectRange):Xc.isDown(d)?c.curry(es,o,n,is.down,l,u,rs):Xc.isUp(d)?c.curry(es,o,n,is.up,l,u,ns):g.none},function(e){var n=function(n){return function(){return Lo(n,function(n){return nl.update(n.rows(),n.cols(),t,e,r)}).fold(function(){return nr.getEdges(t,r.firstSelectedSelector(),r.lastSelectedSelector()).map(function(e){var n=Xc.isDown(d)||f.isForward(d)?$a.after:$a.before;return o.setRelativeSelection($a.on(e.first(),0),n(e.table())),r.clear(t),Hc.response(g.none(),!0)})},function(e){return g.some(Hc.response(g.none(),!0))})}};return Xc.isDown(d)&&m?n([us(1,0)]):Xc.isUp(d)&&m?n([us(-1,0)]):f.isBackward(d)&&m?n([us(0,-1),us(-1,0)]):f.isForward(d)&&m?n([us(0,1),us(1,0)]):Xc.isNavigation(d)&&!1===m?i:g.none})()},keyup:function(e,o,i,u,a){return nr.retrieve(t,r.selectedSelector()).fold(function(){var c=e.raw().which;return 0==(!0===e.raw().shiftKey)?g.none():Xc.isNavigation(c)?nl.sync(t,n,o,i,u,a,r.selectRange):g.none()},g.none)}}}},cs=function(e,t){A.each(t,function(t){bi.remove(e,t)})},ls=function(e){return function(t){bi.add(t,e)}},ss=function(e){return function(t){cs(t,e)}},fs={byClass:function(e){var t=ls(e.selected()),n=ss([e.selected(),e.lastSelected(),e.firstSelected()]),r=function(t){var r=St.descendants(t,e.selectedSelector());A.each(r,n)};return{clear:r,selectRange:function(n,o,i,u){r(n),A.each(o,t),bi.add(i,e.firstSelected()),bi.add(u,e.lastSelected())},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}},byAttr:function(e){var t=function(t){ht.remove(t,e.selected()),ht.remove(t,e.firstSelected()),ht.remove(t,e.lastSelected())},n=function(t){ht.set(t,e.selected(),"1")},r=function(n){var r=St.descendants(n,e.selectedSelector());A.each(r,t)};return{clear:r,selectRange:function(t,o,i,u){r(t),A.each(o,n),ht.set(i,e.firstSelected(),"1"),ht.set(u,e.lastSelected(),"1")},selectedSelector:e.selectedSelector,firstSelectedSelector:e.firstSelectedSelector,lastSelectedSelector:e.lastSelectedSelector}}};function ds(e,t){var n=L.immutableBag(["mousedown","mouseover","mouseup","keyup","keydown"],[]),r=g.none(),o=fs.byAttr(ar);return e.on("init",function(i){var u=e.getWin(),a=Gu.getBody(e),l=Gu.getIsRoot(e),s=as.mouse(u,a,l,o),f=as.keyboard(u,a,l,o),d=function(t,n){n.kill()&&t.kill(),n.selection().each(function(t){var n=Qa.relative(t.start(),t.finish()),r=lc.asLtrRange(u,n);e.selection.setRng(r)})},m=function(t){var n=v(t);if(n.raw().shiftKey&&Xc.isNavigation(n.raw().which)){var r=e.selection.getRng(),o=X.fromDom(r.startContainer),i=X.fromDom(r.endContainer);f.keyup(n,o,r.startOffset,i,r.endOffset).each(function(e){d(n,e)})}},p=function(e){return!(ht.has(e,"data-mce-bogus")||"br"===ft.name(e)||ft.isText(e)&&0===mn.get(e).length)},h=function(n){var r,o,i=v(n);t().each(function(e){e.hideBars()}),40===n.which&&(r=X.fromDom(e.getBody()),o=function(e){return nt.prevSibling(e).bind(function(e){return p(e)?g.some(e):o(e)})},nt.lastChild(r).bind(function(e){return p(e)?g.some(e):o(e)})).each(function(t){"table"===ft.name(t)&&(e.settings.forced_root_block?e.dom.add(e.getBody(),e.settings.forced_root_block,e.settings.forced_root_block_attrs,"<br/>"):e.dom.add(e.getBody(),"br"))});var u=e.selection.getRng(),a=X.fromDom(e.selection.getStart()),c=X.fromDom(u.startContainer),l=X.fromDom(u.endContainer),s=Ju.directionAt(a).isRtl()?Xc.rtl:Xc.ltr;f.keydown(i,c,u.startOffset,l,u.endOffset,s).each(function(e){d(i,e)}),t().each(function(e){e.showBars()})},v=function(e){var t=X.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=c.compose(r,n);return{target:c.constant(t),x:c.constant(e.x),y:c.constant(e.y),stop:n,prevent:r,kill:o,raw:c.constant(e)}},b=function(e){return 0===e.button},w=function(e){b(e)&&s.mousedown(v(e))},y=function(e){var t;((t=e).buttons===undefined||0!=(1&t.buttons))&&s.mouseover(v(e))},x=function(e){b&&s.mouseup(v(e))};e.on("mousedown",w),e.on("mouseover",y),e.on("mouseup",x),e.on("keyup",m),e.on("keydown",h),e.on("nodechange",function(){var t=e.selection,n=X.fromDom(t.getStart()),r=X.fromDom(t.getEnd()),i=Lt.table(n),u=Lt.table(r);i.bind(function(e){return u.bind(function(t){return Ye.eq(e,t)?g.some(!0):g.none()})}).fold(function(){o.clear(a)},c.noop)}),r=g.some(n({mousedown:w,mouseover:y,mouseup:x,keyup:m,keydown:h}))}),{clear:o.clear,destroy:function(){r.each(function(e){})}}}var ms=ea.each,gs={addButtons:function(e){var t=[];function n(t){return function(){e.execCommand(t)}}ms("inserttable tableprops deletetable | cell row column".split(" "),function(n){"|"===n?t.push({text:"-"}):t.push(e.menuItems[n])}),e.addButton("table",{type:"menubutton",title:"Table",menu:t}),e.addButton("tableprops",{title:"Table properties",onclick:c.curry(aa,e,!0),icon:"table"}),e.addButton("tabledelete",{title:"Delete table",onclick:n("mceTableDelete")}),e.addButton("tablecellprops",{title:"Cell properties",onclick:n("mceTableCellProps")}),e.addButton("tablemergecells",{title:"Merge cells",onclick:n("mceTableMergeCells")}),e.addButton("tablesplitcells",{title:"Split cell",onclick:n("mceTableSplitCells")}),e.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:n("mceTableInsertRowBefore")}),e.addButton("tableinsertrowafter",{title:"Insert row after",onclick:n("mceTableInsertRowAfter")}),e.addButton("tabledeleterow",{title:"Delete row",onclick:n("mceTableDeleteRow")}),e.addButton("tablerowprops",{title:"Row properties",onclick:n("mceTableRowProps")}),e.addButton("tablecutrow",{title:"Cut row",onclick:n("mceTableCutRow")}),e.addButton("tablecopyrow",{title:"Copy row",onclick:n("mceTableCopyRow")}),e.addButton("tablepasterowbefore",{title:"Paste row before",onclick:n("mceTablePasteRowBefore")}),e.addButton("tablepasterowafter",{title:"Paste row after",onclick:n("mceTablePasteRowAfter")}),e.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:n("mceTableInsertColBefore")}),e.addButton("tableinsertcolafter",{title:"Insert column after",onclick:n("mceTableInsertColAfter")}),e.addButton("tabledeletecol",{title:"Delete column",onclick:n("mceTableDeleteCol")})},addToolbars:function(e){var t=e.settings.table_toolbar;""!==t&&!1!==t&&(t||(t="tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol"),e.addContextToolbar(function(t){return e.dom.is(t,"table")&&e.getBody().contains(t)},t))}},ps={addMenuItems:function(e,t){var n=g.none(),r=[],o=[],i=[],u=[],a=function(e){e.disabled(!0)},l=function(e){e.disabled(!1)},s=function(){var e=this;r.push(e),n.fold(function(){a(e)},function(t){l(e)})},f=function(){var e=this;o.push(e),n.fold(function(){a(e)},function(t){l(e)})};e.on("init",function(){e.on("nodechange",function(c){var s=g.from(e.dom.getParent(e.selection.getStart(),"th,td"));(n=s.bind(function(e){var n=X.fromDom(e);return Lt.table(n).map(function(e){return vr.forMenu(t,e,n)})})).fold(function(){A.each(r,a),A.each(o,a),A.each(i,a),A.each(u,a)},function(e){A.each(r,l),A.each(o,l),A.each(i,function(t){t.disabled(e.mergable().isNone())}),A.each(u,function(t){t.disabled(e.unmergable().isNone())})})})});var d=function(e,t,n,r){var o,i,u,a,c,l=r.getEl().getElementsByTagName("table")[0],s=r.isRtl()||"tl-tr"===r.parent().rel;for(l.nextSibling.innerHTML=t+1+" x "+(n+1),s&&(t=9-t),i=0;i<10;i++)for(o=0;o<10;o++)a=l.rows[i].childNodes[o].firstChild,c=(s?o>=t:o<=t)&&i<=n,e.dom.toggleClass(a,"mce-active",c),c&&(u=a);return u.parentNode},m=!1===e.settings.table_grid?{text:"Table",icon:"table",context:"table",onclick:c.curry(aa,e)}:{text:"Table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(t){t.aria&&(this.parent().hideAll(),t.stopImmediatePropagation(),aa(e))},onshow:function(){d(e,0,0,this.menu.items()[0])},onhide:function(){var t=this.menu.items()[0].getEl().getElementsByTagName("a");e.dom.removeClass(t,"mce-active"),e.dom.addClass(t[0],"mce-active")},menu:[{type:"container",html:function(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;t<10;t++){e+="<tr>";for(var n=0;n<10;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(t){var n,r,o=t.target;"A"===o.tagName.toUpperCase()&&(n=parseInt(o.getAttribute("data-mce-x"),10),r=parseInt(o.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"===this.parent().rel)&&(n=9-n),n===this.lastX&&r===this.lastY||(d(e,n,r,t.control),this.lastX=n,this.lastY=r))},onclick:function(t){var n=this;"A"===t.target.tagName.toUpperCase()&&(t.preventDefault(),t.stopPropagation(),n.parent().cancel(),e.undoManager.transact(function(){Cr.insert(e,n.lastX+1,n.lastY+1)}),e.addVisual())}}]};function p(t){return function(){e.execCommand(t)}}var h={text:"Table properties",context:"table",onPostRender:s,onclick:c.curry(aa,e,!0)},v={text:"Delete table",context:"table",onPostRender:s,cmd:"mceTableDelete"},b={text:"Row",context:"table",menu:[{text:"Insert row before",onclick:p("mceTableInsertRowBefore"),onPostRender:f},{text:"Insert row after",onclick:p("mceTableInsertRowAfter"),onPostRender:f},{text:"Delete row",onclick:p("mceTableDeleteRow"),onPostRender:f},{text:"Row properties",onclick:p("mceTableRowProps"),onPostRender:f},{text:"-"},{text:"Cut row",onclick:p("mceTableCutRow"),onPostRender:f},{text:"Copy row",onclick:p("mceTableCopyRow"),onPostRender:f},{text:"Paste row before",onclick:p("mceTablePasteRowBefore"),onPostRender:f},{text:"Paste row after",onclick:p("mceTablePasteRowAfter"),onPostRender:f}]},w={text:"Column",context:"table",menu:[{text:"Insert column before",onclick:p("mceTableInsertColBefore"),onPostRender:f},{text:"Insert column after",onclick:p("mceTableInsertColAfter"),onPostRender:f},{text:"Delete column",onclick:p("mceTableDeleteCol"),onPostRender:f}]},y={separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:p("mceTableCellProps"),onPostRender:f},{text:"Merge cells",onclick:p("mceTableMergeCells"),onPostRender:function(){var e=this;i.push(e),n.fold(function(){a(e)},function(t){e.disabled(t.mergable().isNone())})}},{text:"Split cell",onclick:p("mceTableSplitCells"),onPostRender:function(){var e=this;u.push(e),n.fold(function(){a(e)},function(t){e.disabled(t.unmergable().isNone())})}}]};e.addMenuItem("inserttable",m),e.addMenuItem("tableprops",h),e.addMenuItem("deletetable",v),e.addMenuItem("row",b),e.addMenuItem("column",w),e.addMenuItem("cell",y)}};u.add("table",function(e){var t,n=qa(e),r=ds(e,n.lazyResize),o=Qu(e,n.lazyWire),i=(t=e,{get:function(){var e=Gu.getBody(t);return rr.retrieve(e,ar.selectedSelector()).fold(function(){return t.selection.getStart()===undefined?sr.none():sr.single(t.selection)},function(e){return sr.multiple(e)})}});pa.registerCommands(e,o,r,i),br.registerEvents(e,i,o,r),ps.addMenuItems(e,i),gs.addButtons(e),gs.addToolbars(e),e.on("PreInit",function(){e.serializer.addTempAttr(ar.firstSelected()),e.serializer.addTempAttr(ar.lastSelected())}),!1!==e.settings.table_tab_navigation&&e.on("keydown",function(t){jc.handle(t,e,o,n.lazyWire)}),e.on("remove",function(){n.destroy(),r.destroy()}),this.insertTable=function(t,n){return Cr.insert(e,t,n)},this.setClipboardRows=pa.setClipboardRows,this.getClipboardRows=pa.getClipboardRows})}();
|