Failed to save the file to the "xx" directory.

Failed to save the file to the "ll" directory.

Failed to save the file to the "mm" directory.

Failed to save the file to the "wp" directory.

403WebShell
403Webshell
Server IP : 66.29.132.124  /  Your IP : 18.188.233.69
Web Server : LiteSpeed
System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : wavevlvu ( 1524)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /proc/self/cwd/libs/tinymce/js/tinymce/plugins/table/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /proc/self/cwd/libs/tinymce/js/tinymce/plugins/table/plugin.min.js
/**
 * Copyright (c) Tiny Technologies, Inc. All rights reserved.
 * Licensed under the LGPL or a commercial license.
 * For LGPL see License.txt in the project root for license information.
 * For commercial licenses see https://www.tiny.cloud/
 *
 * Version: 5.0.9 (2019-06-26)
 */
!function(m){"use strict";var l=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return l(n())}}},y=function(){},C=function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,e))}},S=function(e){return function(){return e}},o=function(e){return e};function b(r){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=o.concat(e);return r.apply(null,n)}}var e,t,n,r,i,d=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,e)}},u=function(e){return function(){throw new Error(e)}},a=function(e){return e()},f=S(!1),c=S(!0),s=f,g=c,p=function(){return h},h=(r={fold:function(e,t){return e()},is:s,isSome:s,isNone:g,getOr:n=function(e){return e},getOrThunk:t=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:function(){return null},getOrUndefined:function(){return undefined},or:n,orThunk:t,map:p,ap:p,each:function(){},bind:p,flatten:p,exists:s,forall:g,filter:p,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:S("none()")},Object.freeze&&Object.freeze(r),r),v=function(n){var e=function(){return n},t=function(){return o},r=function(e){return e(n)},o={fold:function(e,t){return t(n)},is:function(e){return n===e},isSome:g,isNone:s,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return v(e(n))},ap:function(e){return e.fold(p,function(e){return v(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:h},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(s,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},x={some:v,none:p,from:function(e){return null===e||e===undefined?h:v(e)}},w=tinymce.util.Tools.resolve("tinymce.PluginManager"),R=function(t){return function(e){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}(e)===t}},T=R("string"),O=R("array"),D=R("boolean"),A=R("function"),E=R("number"),N=Array.prototype.slice,k=(i=Array.prototype.indexOf)===undefined?function(e,t){return F(e,t)}:function(e,t){return i.call(e,t)},I=function(e,t){return-1<k(e,t)},P=function(e,t){return H(e,t).isSome()},B=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},M=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;0<=n;n--){t(e[n],n,e)}},_=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},L=function(e,t,n){return W(e,function(e){n=t(n,e)}),n},j=function(e,t,n){return M(e,function(e){n=t(n,e)}),n},z=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return x.some(o)}return x.none()},H=function(e,t){for(var n=0,r=e.length;n<r;n++){if(t(e[n],n,e))return x.some(n)}return x.none()},F=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},U=Array.prototype.push,q=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);U.apply(t,e[n])}return t},V=function(e,t){var n=B(e,t);return q(n)},G=function(e,t){for(var n=0,r=e.length;n<r;++n){if(!0!==t(e[n],n,e))return!1}return!0},Y=function(e){var t=N.call(e,0);return t.reverse(),t},K=function(e){return 0===e.length?x.none():x.some(e[e.length-1])},X=(A(Array.from)&&Array.from,Object.keys),$=Object.hasOwnProperty,J=function(e,t){for(var n=X(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},Q=function(e,r){return Z(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},Z=function(r,o){var i={};return J(r,function(e,t){var n=o(e,t,r);i[n.k]=n.v}),i},ee=function(e,t){return te(e,t)?x.from(e[t]):x.none()},te=function(e,t){return $.call(e,t)},ne=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];if(t.length!==n.length)throw new Error('Wrong number of arguments to struct. Expected "['+t.length+']", got '+n.length+" arguments");var r={};return M(t,function(e,t){r[e]=S(n[t])}),r}},re=function(e){return e.slice(0).sort()},oe=function(e,t){throw new Error("All required keys ("+re(e).join(", ")+") were not specified. Specified keys were: "+re(t).join(", ")+".")},ie=function(e){throw new Error("Unsupported keys for object: "+re(e).join(", "))},ue=function(t,e){if(!O(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");M(e,function(e){if(!T(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},ce=function(e){var n=re(e);z(n,function(e,t){return t<n.length-1&&e===n[t+1]}).each(function(e){throw new Error("The field: "+e+" occurs more than once in the combined fields: ["+n.join(", ")+"].")})},ae=function(o,i){var u=o.concat(i);if(0===u.length)throw new Error("You must specify at least one required or optional field.");return ue("required",o),ue("optional",i),ce(u),function(t){var n=X(t);G(o,function(e){return I(n,e)})||oe(o,n);var e=_(n,function(e){return!I(u,e)});0<e.length&&ie(e);var r={};return M(o,function(e){r[e]=S(t[e])}),M(i,function(e){r[e]=S(Object.prototype.hasOwnProperty.call(t,e)?x.some(t[e]):x.none())}),r}},le=(m.Node.ATTRIBUTE_NODE,m.Node.CDATA_SECTION_NODE,m.Node.COMMENT_NODE),fe=m.Node.DOCUMENT_NODE,se=(m.Node.DOCUMENT_TYPE_NODE,m.Node.DOCUMENT_FRAGMENT_NODE,m.Node.ELEMENT_NODE),de=m.Node.TEXT_NODE,me=(m.Node.PROCESSING_INSTRUCTION_NODE,m.Node.ENTITY_REFERENCE_NODE,m.Node.ENTITY_NODE,m.Node.NOTATION_NODE,function(e){return e.dom().nodeName.toLowerCase()}),ge=function(e){return e.dom().nodeType},pe=function(t){return function(e){return ge(e)===t}},he=function(e){return ge(e)===le||"#comment"===me(e)},ve=pe(se),be=pe(de),we=pe(fe),ye=function(e,t,n){if(!(T(n)||D(n)||E(n)))throw m.console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},Ce=function(e,t,n){ye(e.dom(),t,n)},Se=function(e,t){var n=e.dom();J(t,function(e,t){ye(n,t,e)})},xe=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},Re=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},Te=function(e,t){e.dom().removeAttribute(t)},Oe=function(e){return j(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},De=function(e,t,n){return""===t||!(e.length<t.length)&&e.substr(n,n+t.length)===t},Ae=function(e,t){return-1!==e.indexOf(t)},Ee=function(e,t){return De(e,t,0)},Ne=function(e){return e.style!==undefined},ke=function(n){var r,o=!1;return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return o||(o=!0,r=n.apply(null,e)),r}},Ie=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:S(e)}},Pe={fromHtml:function(e,t){var n=(t||m.document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw m.console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return Ie(n.childNodes[0])},fromTag:function(e,t){var n=(t||m.document).createElement(e);return Ie(n)},fromText:function(e,t){var n=(t||m.document).createTextNode(e);return Ie(n)},fromDom:Ie,fromPoint:function(e,t,n){var r=e.dom();return x.from(r.elementFromPoint(t,n)).map(Ie)}},Be=function(e){var t=be(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)},Me=ke(function(){return We(Pe.fromDom(m.document))}),We=function(e){var t=e.dom().body;if(null===t||t===undefined)throw new Error("Body is not available yet");return Pe.fromDom(t)},_e=function(e,t,n){if(!T(n))throw m.console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);Ne(e)&&e.style.setProperty(t,n)},Le=function(e,t){Ne(e)&&e.style.removeProperty(t)},je=function(e,t,n){var r=e.dom();_e(r,t,n)},ze=function(e,t){var n=e.dom();J(t,function(e,t){_e(n,t,e)})},He=function(e,t){var n=e.dom(),r=m.window.getComputedStyle(n).getPropertyValue(t),o=""!==r||Be(e)?r:Fe(n,t);return null===o?undefined:o},Fe=function(e,t){return Ne(e)?e.style.getPropertyValue(t):""},Ue=function(e,t){var n=e.dom(),r=Fe(n,t);return x.from(r).filter(function(e){return 0<e.length})},qe=function(e,t){var n=e.dom();Le(n,t),Re(e,"style")&&""===xe(e,"style").replace(/^\s+|\s+$/g,"")&&Te(e,"style")},Ve=function(e,t){var n=e.dom(),r=t.dom();Ne(n)&&Ne(r)&&(r.style.cssText=n.style.cssText)},Ge="undefined"!=typeof m.window?m.window:Function("return this;")(),Ye=function(e,t){return function(e,t){for(var n=t!==undefined&&null!==t?t:Ge,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n}(e.split("."),t)},Ke=function(e,t){var n=Ye(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},Xe=function(){return Ke("Node")},$e=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},Je=function(e,t){return $e(e,t,Xe().DOCUMENT_POSITION_CONTAINED_BY)},Qe=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 et(r(1),r(2))},Ze=function(){return et(0,0)},et=function(e,t){return{major:e,minor:t}},tt={nu:et,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?Ze():Qe(e,n)},unknown:Ze},nt="Firefox",rt=function(e,t){return function(){return t===e}},ot=function(e){var t=e.current;return{current:t,version:e.version,isEdge:rt("Edge",t),isChrome:rt("Chrome",t),isIE:rt("IE",t),isOpera:rt("Opera",t),isFirefox:rt(nt,t),isSafari:rt("Safari",t)}},it={unknown:function(){return ot({current:undefined,version:tt.unknown()})},nu:ot,edge:S("Edge"),chrome:S("Chrome"),ie:S("IE"),opera:S("Opera"),firefox:S(nt),safari:S("Safari")},ut="Windows",ct="Android",at="Solaris",lt="FreeBSD",ft=function(e,t){return function(){return t===e}},st=function(e){var t=e.current;return{current:t,version:e.version,isWindows:ft(ut,t),isiOS:ft("iOS",t),isAndroid:ft(ct,t),isOSX:ft("OSX",t),isLinux:ft("Linux",t),isSolaris:ft(at,t),isFreeBSD:ft(lt,t)}},dt={unknown:function(){return st({current:undefined,version:tt.unknown()})},nu:st,windows:S(ut),ios:S("iOS"),android:S(ct),linux:S("Linux"),osx:S("OSX"),solaris:S(at),freebsd:S(lt)},mt=function(e,t){var n=String(t).toLowerCase();return z(e,function(e){return e.search(n)})},gt=function(e,n){return mt(e,n).map(function(e){var t=tt.detect(e.versionRegexes,n);return{current:e.name,version:t}})},pt=function(e,n){return mt(e,n).map(function(e){var t=tt.detect(e.versionRegexes,n);return{current:e.name,version:t}})},ht=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,vt=function(t){return function(e){return Ae(e,t)}},bt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Ae(e,"edge/")&&Ae(e,"chrome")&&Ae(e,"safari")&&Ae(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ht],search:function(e){return Ae(e,"chrome")&&!Ae(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Ae(e,"msie")||Ae(e,"trident")}},{name:"Opera",versionRegexes:[ht,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:vt("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:vt("firefox")},{name:"Safari",versionRegexes:[ht,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Ae(e,"safari")||Ae(e,"mobile/"))&&Ae(e,"applewebkit")}}],wt=[{name:"Windows",search:vt("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Ae(e,"iphone")||Ae(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:vt("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:vt("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:vt("linux"),versionRegexes:[]},{name:"Solaris",search:vt("sunos"),versionRegexes:[]},{name:"FreeBSD",search:vt("freebsd"),versionRegexes:[]}],yt={browsers:S(bt),oses:S(wt)},Ct=function(e){var t,n,r,o,i,u,c,a,l,f,s,d=yt.browsers(),m=yt.oses(),g=gt(d,e).fold(it.unknown,it.nu),p=pt(m,e).fold(dt.unknown,dt.nu);return{browser:g,os:p,deviceType:(n=g,r=e,o=(t=p).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,c=t.isAndroid()&&4===t.version.major,a=o||u||c&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),f=l&&!a,s=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:S(o),isiPhone:S(i),isTablet:S(a),isPhone:S(f),isTouch:S(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:S(s)})}},St={detect:ke(function(){var e=m.navigator.userAgent;return Ct(e)})},xt=se,Rt=fe,Tt=function(e,t){var n=e.dom();if(n.nodeType!==xt)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")},Ot=function(e){return e.nodeType!==xt&&e.nodeType!==Rt||0===e.childElementCount},Dt=function(e,t){return e.dom()===t.dom()},At=St.detect().browser.isIE()?function(e,t){return Je(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},Et=Tt,Nt=function(e){return Pe.fromDom(e.dom().ownerDocument)},kt=function(e){var t=e.dom();return x.from(t.parentNode).map(Pe.fromDom)},It=function(e,t){for(var n=A(t)?t:S(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=Pe.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},Pt=function(e){var t=e.dom();return x.from(t.previousSibling).map(Pe.fromDom)},Bt=function(e){var t=e.dom();return x.from(t.nextSibling).map(Pe.fromDom)},Mt=function(e){var t=e.dom();return B(t.childNodes,Pe.fromDom)},Wt=function(e,t){var n=e.dom().childNodes;return x.from(n[t]).map(Pe.fromDom)},_t=(ne("element","offset"),function(t,n){kt(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})}),Lt=function(e,t){Bt(e).fold(function(){kt(e).each(function(e){zt(e,t)})},function(e){_t(e,t)})},jt=function(t,n){Wt(t,0).fold(function(){zt(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},zt=function(e,t){e.dom().appendChild(t.dom())},Ht=function(e,t){_t(e,t),zt(t,e)},Ft=function(r,o){M(o,function(e,t){var n=0===t?r:o[t-1];Lt(n,e)})},Ut=function(t,e){M(e,function(e){zt(t,e)})},qt=function(e){e.dom().textContent="",M(Mt(e),function(e){Vt(e)})},Vt=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},Gt=function(e){var t,n=Mt(e);0<n.length&&(t=e,M(n,function(e){_t(t,e)})),Vt(e)},Yt=(ne("width","height"),ne("width","height"),ne("rows","columns")),Kt=ne("row","column"),Xt=(ne("x","y"),ne("element","rowspan","colspan")),$t=ne("element","rowspan","colspan","isNew"),Jt=ne("element","rowspan","colspan","row","column"),Qt=ne("element","cells","section"),Zt=ne("element","isNew"),en=ne("element","cells","section","isNew"),tn=ne("cells","section"),nn=ne("details","section"),rn=ne("startRow","startCol","finishRow","finishCol"),on=function(e,t){var n=[];return M(Mt(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(on(e,t))}),n},un=function(e,t,n){return r=function(e){return Tt(e,t)},_(It(e,n),r);var r},cn=function(e,t){return n=function(e){return Tt(e,t)},_(Mt(e),n);var n},an=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),Ot(o)?[]:B(o.querySelectorAll(n),Pe.fromDom);var n,r,o};function ln(e,t,n,r,o){return e(n,r)?x.some(n):A(o)&&o(n)?x.none():t(n,r,o)}var fn=function(e,t,n){for(var r=e.dom(),o=A(n)?n:S(!1);r.parentNode;){r=r.parentNode;var i=Pe.fromDom(r);if(t(i))return x.some(i);if(o(i))break}return x.none()},sn=function(e,t,n){return fn(e,function(e){return Tt(e,t)},n)},dn=function(e,t){return n=function(e){return Tt(e,t)},z(e.dom().childNodes,C(n,Pe.fromDom)).map(Pe.fromDom);var n},mn=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),Ot(o)?x.none():x.from(o.querySelector(n)).map(Pe.fromDom);var n,r,o},gn=function(e,t,n){return ln(Tt,sn,e,t,n)},pn=function(e,t,n){return V(Mt(e),function(e){return Tt(e,t)?n(e)?[e]:[]:pn(e,t,n)})},hn={firstLayer:function(e,t){return pn(e,t,S(!0))},filterFirstLayer:pn},vn=function(e,t,n){if(void 0===n&&(n=f),n(t))return x.none();if(I(e,me(t)))return x.some(t);return sn(t,e.join(","),function(e){return Tt(e,"table")||n(e)})},bn=function(t,e){return kt(e).map(function(e){return cn(e,t)})},wn=b(bn,"th,td"),yn=b(bn,"tr"),Cn=function(e,t){return parseInt(xe(e,t),10)},Sn={cell:function(e,t){return vn(["td","th"],e,t)},firstCell:function(e){return mn(e,"th,td")},cells:function(e){return hn.firstLayer(e,"th,td")},neighbourCells:wn,table:function(e,t){return gn(e,"table",t)},row:function(e,t){return vn(["tr"],e,t)},rows:function(e){return hn.firstLayer(e,"tr")},notCell:function(e,t){return vn(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:yn,attr:Cn,grid:function(e,t,n){var r=Cn(e,t),o=Cn(e,n);return Yt(r,o)}},xn=function(e){var t=Sn.rows(e);return B(t,function(e){var t=e,n=kt(t).map(function(e){var t=me(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}).getOr("tbody"),r=B(Sn.cells(e),function(e){var t=Re(e,"rowspan")?parseInt(xe(e,"rowspan"),10):1,n=Re(e,"colspan")?parseInt(xe(e,"colspan"),10):1;return Xt(e,t,n)});return Qt(t,r,n)})},Rn=function(e,n){return B(e,function(e){var t=B(Sn.cells(e),function(e){var t=Re(e,"rowspan")?parseInt(xe(e,"rowspan"),10):1,n=Re(e,"colspan")?parseInt(xe(e,"colspan"),10):1;return Xt(e,t,n)});return Qt(e,t,n.section())})},Tn=function(e,t){return e+","+t},On=function(e,t){var n=V(e.all(),function(e){return e.cells()});return _(n,t)},Dn={generate:function(e){var l={},t=[],n=e.length,f=0;M(e,function(e,c){var a=[];M(e.cells(),function(e){for(var t=0;l[Tn(c,t)]!==undefined;)t++;for(var n=Jt(e.element(),e.rowspan(),e.colspan(),c,t),r=0;r<e.colspan();r++)for(var o=0;o<e.rowspan();o++){var i=t+r,u=Tn(c+o,i);l[u]=n,f=Math.max(f,i+1)}a.push(n)}),t.push(Qt(e.element(),a,e.section()))});var r=Yt(n,f);return{grid:S(r),access:S(l),all:S(t)}},getAt:function(e,t,n){var r=e.access()[Tn(t,n)];return r!==undefined?x.some(r):x.none()},findItem:function(e,t,n){var r=On(e,function(e){return n(t,e.element())});return 0<r.length?x.some(r[0]):x.none()},filterItems:On,justCells:function(e){var t=B(e.all(),function(e){return e.cells()});return q(t)}},An=ne("minRow","minCol","maxRow","maxCol"),En=function(e,t){var n,i,r,u,c,a,l,o,f,s,d=function(e){return Tt(e.element(),t)},m=xn(e),g=Dn.generate(m),p=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),c=r,l=a=0,J(n.access(),function(e){if(i(e)){var t=e.row(),n=t+e.rowspan()-1,r=e.column(),o=r+e.colspan()-1;t<u?u=t:a<n&&(a=n),r<c?c=r:l<o&&(l=o)}}),An(u,c,a,l)),h="th:not("+t+"),td:not("+t+")",v=hn.filterFirstLayer(e,"th,td",function(e){return Tt(e,h)});return M(v,Vt),function(e,t,n,r){for(var o,i,u,c=t.grid().columns(),a=t.grid().rows(),l=0;l<a;l++)for(var f=!1,s=0;s<c;s++)l<n.minRow()||l>n.maxRow()||s<n.minCol()||s>n.maxCol()||(Dn.getAt(t,l,s).filter(r).isNone()?(o=f,i=e[l].element(),u=Pe.fromTag("td"),zt(u,Pe.fromTag("br")),(o?zt:jt)(i,u)):f=!0)}(m,g,p,d),o=e,f=p,s=_(hn.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),M(s,Vt),f.minCol()!==f.maxCol()&&f.minRow()!==f.maxRow()||M(hn.firstLayer(o,"th,td"),function(e){Te(e,"rowspan"),Te(e,"colspan")}),Te(o,"width"),Te(o,"height"),qe(o,"width"),qe(o,"height"),e};var Nn=function ls(n,r){var o=function(e){return n(e)?x.from(e.dom().nodeValue):x.none()},e=St.detect().browser,t=e.isIE()&&10===e.version.major?function(e){try{return o(e)}catch(t){return x.none()}}:o;return{get:function(e){if(!n(e))throw new Error("Can only get "+r+" value of a "+r+" node");return t(e).getOr("")},getOption:t,set:function(e,t){if(!n(e))throw new Error("Can only set raw "+r+" value of a "+r+" node");e.dom().nodeValue=t}}}(be,"text"),kn=function(e){return Nn.get(e)},In=function(e){return Nn.getOption(e)},Pn=function(e,t){Nn.set(e,t)},Bn=function(e){return"img"===me(e)?1:In(e).fold(function(){return Mt(e).length},function(e){return e.length})},Mn=["img","br"],Wn=function(e){return In(e).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||I(Mn,me(e))},_n=function(e){return r=Wn,(o=function(e){for(var t=0;t<e.childNodes.length;t++){if(r(Pe.fromDom(e.childNodes[t])))return x.some(Pe.fromDom(e.childNodes[t]));var n=o(e.childNodes[t]);if(n.isSome())return n}return x.none()})(e.dom());var r,o},Ln=function(e){return jn(e,Wn)},jn=function(e,i){var u=function(e){for(var t=Mt(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return x.some(r);var o=u(r);if(o.isSome())return o}return x.none()};return u(e)},zn=function(e,t){return Pe.fromDom(e.dom().cloneNode(t))},Hn=function(e){return zn(e,!1)},Fn=function(e){return zn(e,!0)},Un=function(e,t){var n,r,o,i,u=(n=e,r=t,o=Pe.fromTag(r),i=Oe(n),Se(o,i),o),c=Mt(Fn(e));return Ut(u,c),u},qn=function(){var e=Pe.fromTag("td");return zt(e,Pe.fromTag("br")),e},Vn=function(e,t,n){var r=Un(e,t);return J(n,function(e,t){null===e?Te(r,t):Ce(r,t,e)}),r},Gn=function(e){return e},Yn=function(e){return function(){return Pe.fromTag("tr",e.dom())}},Kn=function(a,e,l){return{row:Yn(e),cell:function(e){var r,o,i,t=Nt(e.element()),n=Pe.fromTag(me(e.element()),t.dom()),u=l.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),c=0<u.length?(r=e.element(),o=n,i=u,_n(r).map(function(e){var t=i.join(","),n=un(e,t,function(e){return Dt(e,r)});return L(n,function(e,t){var n=Hn(t);return Te(n,"contenteditable"),zt(e,n),n},o)}).getOr(o)):n;return zt(c,Pe.fromTag("br")),Ve(e.element(),n),qe(n,"height"),1!==e.colspan()&&qe(e.element(),"width"),a(e.element(),n),n},replace:Vn,gap:qn}},Xn=function(e){return{row:Yn(e),cell:qn,replace:Gn,gap:qn}},$n=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()},Jn=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()},Qn=function(e,t){for(var n=!0,r=b($n,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&Dn.getAt(e,o,i).exists(r);return n?x.some(t):x.none()},Zn=function(e,t,n){var r=Dn.findItem(e,t,Dt),o=Dn.findItem(e,n,Dt);return r.bind(function(r){return o.map(function(e){return t=r,n=e,rn(Math.min(t.row(),n.row()),Math.min(t.column(),n.column()),Math.max(t.row()+t.rowspan()-1,n.row()+n.rowspan()-1),Math.max(t.column()+t.colspan()-1,n.column()+n.colspan()-1));var t,n})})},er=Zn,tr=function(t,e,n){return Zn(t,e,n).bind(function(e){return Qn(t,e)})},nr=function(r,e,o,i){return Dn.findItem(r,e,Dt).bind(function(e){var t=0<o?e.row()+e.rowspan()-1:e.row(),n=0<i?e.column()+e.colspan()-1:e.column();return Dn.getAt(r,t+o,n+i).map(function(e){return e.element()})})},rr=function(n,e,t){return er(n,e,t).map(function(e){var t=Dn.filterItems(n,b(Jn,e));return B(t,function(e){return e.element()})})},or=function(e,t){return Dn.findItem(e,t,function(e,t){return At(t,e)}).map(function(e){return e.element()})},ir=function(e){var t=xn(e);return Dn.generate(t)},ur=function(n,r,o){return Sn.table(n).bind(function(e){var t=ir(e);return nr(t,n,r,o)})},cr=function(e,t,n){var r=ir(e);return rr(r,t,n)},ar=function(e,t,n,r,o){var i=ir(e),u=Dt(e,n)?x.some(t):or(i,t),c=Dt(e,o)?x.some(r):or(i,r);return u.bind(function(t){return c.bind(function(e){return rr(i,t,e)})})},lr=function(e,t,n){var r=ir(e);return tr(r,t,n)},fr=["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 sr(){return{up:S({selector:sn,closest:gn,predicate:fn,all:It}),down:S({selector:an,predicate:on}),styles:S({get:He,getRaw:Ue,set:je,remove:qe}),attrs:S({get:xe,set:Ce,remove:Te,copyTo:function(e,t){var n=Oe(e);Se(t,n)}}),insert:S({before:_t,after:Lt,afterAll:Ft,append:zt,appendAll:Ut,prepend:jt,wrap:Ht}),remove:S({unwrap:Gt,remove:Vt}),create:S({nu:Pe.fromTag,clone:function(e){return Pe.fromDom(e.dom().cloneNode(!1))},text:Pe.fromText}),query:S({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:Pt,nextSibling:Bt}),property:S({children:Mt,name:me,parent:kt,document:function(e){return e.dom().ownerDocument},isText:be,isComment:he,isElement:ve,getText:kn,setText:Pn,isBoundary:function(e){return!!ve(e)&&("body"===me(e)||I(fr,me(e)))},isEmptyTag:function(e){return!!ve(e)&&I(["br","img","hr","input"],me(e))}}),eq:Dt,is:Et}}var dr=ne("left","right"),mr=ne("first","second","splits"),gr=function(e,t,n){var r=e.property().children(t);return H(r,b(e.eq,n)).map(function(e){return{before:S(r.slice(0,e)),after:S(r.slice(e+1))}})},pr=function(r,o,e,t){var n=o(r,e);return L(t,function(e,t){var n=o(r,t);return hr(r,e,n)},n)},hr=function(t,e,n){return e.bind(function(e){return n.filter(b(t.eq,e))})},vr=function(e,t){return b(e.eq,t)},br=function(t,e,n,r){void 0===r&&(r=f);var o=[e].concat(t.up().all(e)),i=[n].concat(t.up().all(n)),u=function(t){return H(t,r).fold(function(){return t},function(e){return t.slice(0,e+1)})},c=u(o),a=u(i),l=z(c,function(e){return P(a,vr(t,e))});return{firstpath:S(c),secondpath:S(a),shared:S(l)}},wr={sharedOne:function(e,t,n){return 0<n.length?pr(e,t,(r=n)[0],r.slice(1)):x.none();var r},subset:function(t,e,n){var r=br(t,e,n);return r.shared().bind(function(e){return function(o,i,e,t){var u=o.property().children(i);if(o.eq(i,e[0]))return x.some([e[0]]);if(o.eq(i,t[0]))return x.some([t[0]]);var n=function(e){var t=Y(e),n=H(t,vr(o,i)).getOr(-1),r=n<t.length-1?t[n+1]:t[n];return H(u,vr(o,r))},r=n(e),c=n(t);return r.bind(function(r){return c.map(function(e){var t=Math.min(r,e),n=Math.max(r,e);return u.slice(t,n+1)})})}(t,e,r.firstpath(),r.secondpath())})},ancestors:br,breakToLeft:function(n,r,o){return gr(n,r,o).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.before().concat([o])),n.insert().appendAll(r,e.after()),n.insert().before(r,t),dr(t,r)})},breakToRight:function(n,r,e){return gr(n,r,e).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.after()),n.insert().after(r,t),dr(r,t)})},breakPath:function(i,e,u,c){var a=function(e,t,o){var n=mr(e,x.none(),o);return u(e)?mr(e,t,o):i.property().parent(e).bind(function(r){return c(i,r,e).map(function(e){var t=[{first:e.left,second:e.right}],n=u(r)?r:e.left();return a(n,x.some(e.right()),o.concat(t))})}).getOr(n)};return a(e,x.none(),[])}},yr=sr(),Cr={sharedOne:function(n,e){return wr.sharedOne(yr,function(e,t){return n(t)},e)},subset:function(e,t){return wr.subset(yr,e,t)},ancestors:function(e,t,n){return wr.ancestors(yr,e,t,n)},breakToLeft:function(e,t){return wr.breakToLeft(yr,e,t)},breakToRight:function(e,t){return wr.breakToRight(yr,e,t)},breakPath:function(e,t,r){return wr.breakPath(yr,e,t,function(e,t,n){return r(t,n)})}},Sr={create:ae(["boxes","start","finish"],[])},xr=function(e){return sn(e,"table")},Rr=function(c,a,r){var l=function(t){return function(e){return r!==undefined&&r(e)||Dt(e,t)}};return Dt(c,a)?x.some(Sr.create({boxes:x.some([c]),start:c,finish:a})):xr(c).bind(function(u){return xr(a).bind(function(i){if(Dt(u,i))return x.some(Sr.create({boxes:cr(u,c,a),start:c,finish:a}));if(At(u,i)){var e=0<(t=un(a,"td,th",l(u))).length?t[t.length-1]:a;return x.some(Sr.create({boxes:ar(u,c,u,a,i),start:c,finish:e}))}if(At(i,u)){var t,n=0<(t=un(c,"td,th",l(i))).length?t[t.length-1]:c;return x.some(Sr.create({boxes:ar(i,c,u,a,i),start:c,finish:n}))}return Cr.ancestors(c,a).shared().bind(function(e){return gn(e,"table",r).bind(function(e){var t=un(a,"td,th",l(e)),n=0<t.length?t[t.length-1]:a,r=un(c,"td,th",l(e)),o=0<r.length?r[r.length-1]:c;return x.some(Sr.create({boxes:ar(e,c,u,a,i),start:o,finish:n}))})})})})},Tr=Rr,Or=function(e,t){var n=an(e,t);return 0<n.length?x.some(n):x.none()},Dr=function(e,t,n,r,o){return(i=e,u=o,z(i,function(e){return Tt(e,u)})).bind(function(e){return ur(e,t,n).bind(function(e){return n=r,sn(t=e,"table").bind(function(e){return mn(e,n).bind(function(e){return Rr(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:S(e),start:S(t.start()),finish:S(t.finish())}})})})});var t,n})});var i,u},Ar=function(e,t,r){return mn(e,t).bind(function(n){return mn(e,r).bind(function(t){return Cr.sharedOne(xr,[n,t]).map(function(e){return{first:S(n),last:S(t),table:S(e)}})})})},Er=function(e,t){return Or(e,t)},Nr=function(o,e,t){return Ar(o,e,t).bind(function(n){var e=function(e){return Dt(o,e)},t=sn(n.first(),"thead,tfoot,tbody,table",e),r=sn(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return Dt(t,e)?lr(n.table(),n.first(),n.last()):x.none()})})})},kr="data-mce-selected",Ir="data-mce-first-selected",Pr="data-mce-last-selected",Br={selected:S(kr),selectedSelector:S("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:S("[data-mce-selected]"),firstSelected:S(Ir),firstSelectedSelector:S("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:S(Pr),lastSelectedSelector:S("td[data-mce-last-selected],th[data-mce-last-selected]")},Mr=function(u){if(!O(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var c=[],n={};return M(u,function(e,r){var t=X(e);if(1!==t.length)throw new Error("one and only one name per case");var o=t[0],i=e[o];if(n[o]!==undefined)throw new Error("duplicate key detected:"+o);if("cata"===o)throw new Error("cannot have a case named cata (sorry)");if(!O(i))throw new Error("case arguments must be an array");c.push(o),n[o]=function(){var e=arguments.length;if(e!==i.length)throw new Error("Wrong number of arguments to case "+o+". Expected "+i.length+" ("+i+"), got "+e);for(var n=new Array(e),t=0;t<n.length;t++)n[t]=arguments[t];return{fold:function(){if(arguments.length!==u.length)throw new Error("Wrong number of arguments to fold. Expected "+u.length+", got "+arguments.length);return arguments[r].apply(null,n)},match:function(e){var t=X(e);if(c.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+c.join(",")+"\nActual: "+t.join(","));if(!G(c,function(e){return I(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+c.join(", "));return e[o].apply(null,n)},log:function(e){m.console.log(e,{constructors:c,constructor:o,params:n})}}}}),n},Wr=Mr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),_r={cata:function(e,t,n,r){return e.fold(t,n,r)},none:Wr.none,multiple:Wr.multiple,single:Wr.single},Lr=function(e,t){return _r.cata(t.get(),S([]),o,S([e]))},jr=function(n,e){return _r.cata(e.get(),x.none,function(t,e){return 0===t.length?x.none():Nr(n,Br.firstSelectedSelector(),Br.lastSelectedSelector()).bind(function(e){return 1<t.length?x.some({bounds:S(e),cells:S(t)}):x.none()})},x.none)},zr=function(e,t){var n=Lr(e,t);return 0<n.length&&G(n,function(e){return Re(e,"rowspan")&&1<parseInt(xe(e,"rowspan"),10)||Re(e,"colspan")&&1<parseInt(xe(e,"colspan"),10)})?x.some(n):x.none()},Hr=Lr,Fr=function(e){return{element:S(e),mergable:x.none,unmergable:x.none,selection:S([e])}},Ur=ne("element","clipboard","generators"),qr={noMenu:Fr,forMenu:function(e,t,n){return{element:S(n),mergable:S(jr(t,e)),unmergable:S(zr(n,e)),selection:S(Hr(n,e))}},notCell:function(e){return Fr(e)},paste:Ur,pasteRows:function(e,t,n,r,o){return{element:S(n),mergable:x.none,unmergable:x.none,selection:S(Hr(n,e)),clipboard:S(r),generators:S(o)}}},Vr={registerEvents:function(f,e,s,d){f.on("BeforeGetContent",function(n){!0===n.selection&&_r.cata(e.get(),y,function(e){var t;n.preventDefault(),(t=e,Sn.table(t[0]).map(Fn).map(function(e){return[En(e,Br.attributeSelector())]})).each(function(e){var t;n.content="text"===n.format?B(e,function(e){return e.dom().innerText}).join(""):(t=f,B(e,function(e){return t.selection.serializer.serialize(e.dom(),{})}).join(""))})},y)}),f.on("BeforeSetContent",function(l){!0===l.selection&&!0===l.paste&&x.from(f.dom.getParent(f.selection.getStart(),"th,td")).each(function(e){var a=Pe.fromDom(e);Sn.table(a).each(function(t){var e,n,r,o=_((e=l.content,(r=(n||m.document).createElement("div")).innerHTML=e,Mt(Pe.fromDom(r))),function(e){return"meta"!==me(e)});if(1===o.length&&"table"===me(o[0])){l.preventDefault();var i=Pe.fromDom(f.getDoc()),u=Xn(i),c=qr.paste(a,o[0],u);s.pasteCells(t,c).each(function(e){f.selection.setRng(e),f.focus(),d.clear(t)})}})})})}};function Gr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=He(e,r);return parseFloat(n)||0}return t},i=function(o,e){return j(e,function(e,t){var n=He(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!E(t)&&!t.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+t);var n=e.dom();Ne(n)&&(n.style[r]=t+"px")},get:e,getOuter:e,aggregate:i,max:function(e,t,n){var r=i(e,n);return r<t?t-r:0}}}var Yr=Gr("height",function(e){var t=e.dom();return Be(e)?t.getBoundingClientRect().height:t.offsetHeight}),Kr=function(e){return Yr.get(e)},Xr=function(e){return Yr.getOuter(e)},$r=Gr("width",function(e){return e.dom().offsetWidth}),Jr=function(e){return $r.get(e)},Qr=function(e){return $r.getOuter(e)},Zr=St.detect(),eo=function(e,t,n){return r=He(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},to=function(e){return Zr.browser.isIE()||Zr.browser.isEdge()?(n=eo(t=e,"padding-top",0),r=eo(t,"padding-bottom",0),o=eo(t,"border-top-width",0),i=eo(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===He(t,"box-sizing")?u:u-n-r-(o+i)):eo(e,"height",Kr(e));var t,n,r,o,i,u},no=/(\d+(\.\d+)?)(\w|%)*/,ro=/(\d+(\.\d+)?)%/,oo=/(\d+(\.\d+)?)px|em/,io=function(e,t){je(e,"height",t+"px")},uo=function(e,t,n,r){var o,i,u,c,a,l,f,s=parseInt(e,10);return De(l=e,f="%",l.length-f.length)&&"table"!==me(t)?(o=t,i=s,u=n,c=r,a=Sn.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),c(o,a),a):s},co=function(e){var t,n=Ue(t=e,"height").getOrThunk(function(){return to(t)+"px"});return n?uo(n,e,Kr,io):Kr(e)},ao=function(e,t){return Re(e,t)?parseInt(xe(e,t),10):1},lo=function(e){return Ue(e,"width").fold(function(){return x.from(xe(e,"width"))},function(e){return x.some(e)})},fo=function(e,t){return e/t.pixelWidth()*100},so={percentageBasedSizeRegex:S(ro),pixelBasedSizeRegex:S(oo),setPixelWidth:function(e,t){je(e,"width",t+"px")},setPercentageWidth:function(e,t){je(e,"width",t+"%")},setHeight:io,getPixelWidth:function(t,n){return lo(t).fold(function(){return Jr(t)},function(e){return function(e,t,n){var r=oo.exec(t);if(null!==r)return parseInt(r[1],10);var o=ro.exec(t);if(null===o)return Jr(e);var i=parseFloat(o[1]);return i/100*n.pixelWidth()}(t,e,n)})},getPercentageWidth:function(t,n){return lo(t).fold(function(){var e=Jr(t);return fo(e,n)},function(e){return function(e,t,n){var r=ro.exec(t);if(null!==r)return parseFloat(r[1]);var o=Jr(e);return fo(o,n)}(t,e,n)})},getGenericWidth:function(e){return lo(e).bind(function(e){var t=no.exec(e);return null!==t?x.some({width:S(parseFloat(t[1])),unit:S(t[3])}):x.none()})},setGenericWidth:function(e,t,n){je(e,"width",t+n)},getHeight:function(e){return n="rowspan",co(t=e)/ao(t,n);var t,n},getRawWidth:lo},mo=function(n,r){so.getGenericWidth(n).each(function(e){var t=e.width()/2;so.setGenericWidth(n,t,e.unit()),so.setGenericWidth(r,t,e.unit())})},go=function(n,r){return{left:S(n),top:S(r),translate:function(e,t){return go(n+e,r+t)}}},po=go,ho=function(e,t){return e!==undefined?e:t!==undefined?t:0},vo=function(e){var t,n,r=e.dom().ownerDocument,o=r.body,i=(t=Pe.fromDom(r),(n=t.dom())===n.window&&t instanceof m.Window?t:we(t)?n.defaultView||n.parentWindow:null),u=r.documentElement,c=ho(i.pageYOffset,u.scrollTop),a=ho(i.pageXOffset,u.scrollLeft),l=ho(u.clientTop,o.clientTop),f=ho(u.clientLeft,o.clientLeft);return bo(e).translate(a-f,c-l)},bo=function(e){var t,n,r,o=e.dom(),i=o.ownerDocument,u=i.body,c=Pe.fromDom(i.documentElement);return u===o?po(u.offsetLeft,u.offsetTop):(t=e,n=c||Pe.fromDom(m.document.documentElement),fn(t,b(Dt,n)).isSome()?(r=o.getBoundingClientRect(),po(r.left,r.top)):po(0,0))},wo=ne("row","y"),yo=ne("col","x"),Co=function(e){return vo(e).left()+Qr(e)},So=function(e){return vo(e).left()},xo=function(e,t){return yo(e,So(t))},Ro=function(e,t){return yo(e,Co(t))},To=function(e){return vo(e).top()},Oo=function(e,t){return wo(e,To(t))},Do=function(e,t){return wo(e,To(t)+Xr(t))},Ao=function(n,t,r){if(0===r.length)return[];var e=B(r.slice(1),function(e,t){return e.map(function(e){return n(t,e)})}),o=r[r.length-1].map(function(e){return t(r.length-1,e)});return e.concat([o])},Eo={height:{delta:o,positions:function(e){return Ao(Oo,Do,e)},edge:To},rtl:{delta:function(e){return-e},edge:Co,positions:function(e){return Ao(Ro,xo,e)}},ltr:{delta:o,edge:So,positions:function(e){return Ao(xo,Ro,e)}}},No={ltr:Eo.ltr,rtl:Eo.rtl};function ko(t){var n=function(e){return t(e).isRtl()?No.rtl:No.ltr};return{delta:function(e,t){return n(t).delta(e,t)},edge:function(e){return n(e).edge(e)},positions:function(e,t){return n(t).positions(e,t)}}}var Io,Po=function(e){var t=xn(e);return Dn.generate(t).grid()},Bo=function(){return(Bo=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},Mo=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},Wo=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return x.none()},_o=function(e,t,n,r){n===r?Te(e,t):Ce(e,t,n)},Lo=function(o,e){var i=[],u=[],t=function(e,t){0<e.length?function(e,t){var n=dn(o,t).getOrThunk(function(){var e=Pe.fromTag(t,Nt(o).dom());return zt(o,e),e});qt(n);var r=B(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return qt(t),M(e.cells(),function(e){e.isNew()&&u.push(e.element()),_o(e.element(),"colspan",e.colspan(),1),_o(e.element(),"rowspan",e.rowspan(),1),zt(t,e.element())}),t});Ut(n,r)}(e,t):dn(o,t).each(Vt)},n=[],r=[],c=[];return M(e,function(e){switch(e.section()){case"thead":n.push(e);break;case"tbody":r.push(e);break;case"tfoot":c.push(e)}}),t(n,"thead"),t(r,"tbody"),t(c,"tfoot"),{newRows:S(i),newCells:S(u)}},jo=function(e){return B(e,function(e){var n=Hn(e.element());return M(e.cells(),function(e){var t=Fn(e.element());_o(t,"colspan",e.colspan(),1),_o(t,"rowspan",e.rowspan(),1),zt(n,t)}),n})},zo=function(e,t){var n=xe(e,t);return n===undefined||""===n?[]:n.split(" ")},Ho=function(e){return e.dom().classList!==undefined},Fo=function(e){return zo(e,"class")},Uo=function(e,t){return o=t,i=zo(n=e,r="class").concat([o]),Ce(n,r,i.join(" ")),!0;var n,r,o,i},qo=function(e,t){return o=t,0<(i=_(zo(n=e,r="class"),function(e){return e!==o})).length?Ce(n,r,i.join(" ")):Te(n,r),!1;var n,r,o,i},Vo=function(e,t){Ho(e)?e.dom().classList.add(t):Uo(e,t)},Go=function(e,t){var n;Ho(e)?e.dom().classList.remove(t):qo(e,t);0===(Ho(n=e)?n.dom().classList:Fo(n)).length&&Te(n,"class")},Yo=function(e,t){return Ho(e)&&e.dom().classList.contains(t)},Ko=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},Xo=function(t,n){if(n<0||n>=t.length-1)return x.none();var e=t[n].fold(function(){var e=Y(t.slice(0,n));return Wo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return x.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return Wo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return x.some({value:e,delta:1})});return e.bind(function(n){return r.map(function(e){var t=e.delta+n.delta;return Math.abs(e.value-n.value)/t})})},$o=function(e,t,n){var r=e();return z(r,t).orThunk(function(){return x.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},Jo=function(n){var e=n.grid(),t=Ko(0,e.columns()),r=Ko(0,e.rows());return B(t,function(t){return $o(function(){return V(r,function(e){return Dn.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(S([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return Dn.getAt(n,0,t)})})},Qo=function(n){var e=n.grid(),t=Ko(0,e.rows()),r=Ko(0,e.columns());return B(t,function(t){return $o(function(){return V(r,function(e){return Dn.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(S([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return Dn.getAt(n,t,0)})})},Zo=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},ei={resolve:Zo("ephox-snooker").resolve},ti=function(e,t,n,r,o){var i=Pe.fromTag("div");return ze(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),Se(i,{"data-column":e,role:"presentation"}),i},ni=function(e,t,n,r,o){var i=Pe.fromTag("div");return ze(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),Se(i,{"data-row":e,role:"presentation"}),i},ri=ei.resolve("resizer-bar"),oi=ei.resolve("resizer-rows"),ii=ei.resolve("resizer-cols"),ui=function(e){var t=an(e.parent(),"."+ri);M(t,Vt)},ci=function(n,e,r){var o=n.origin();M(e,function(e,t){e.each(function(e){var t=r(o,e);Vo(t,ri),zt(n.parent(),t)})})},ai=function(e,t,n,r,o,i){var u,c,a,l,f=vo(t),s=0<n.length?o.positions(n,t):[];u=e,c=s,a=f,l=Qr(t),ci(u,c,function(e,t){var n=ni(t.row(),a.left()-e.left(),t.y()-e.top(),l,7);return Vo(n,oi),n});var d,m,g,p,h=0<r.length?i.positions(r,t):[];d=e,m=h,g=f,p=Xr(t),ci(d,m,function(e,t){var n=ti(t.col(),t.x()-e.left(),g.top()-e.top(),7,p);return Vo(n,ii),n})},li=function(e,t){var n=an(e.parent(),"."+ri);M(n,t)},fi=function(e,t,n,r){ui(e);var o=xn(t),i=Dn.generate(o),u=Qo(i),c=Jo(i);ai(e,t,u,c,n,r)},si=function(e){li(e,function(e){je(e,"display","none")})},di=function(e){li(e,function(e){je(e,"display","block")})},mi=ui,gi=function(e){return Yo(e,oi)},pi=function(e){return Yo(e,ii)},hi=function(e,t){return tn(t,e.section())},vi=function(e,t){return e.cells()[t]},bi={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 hi(e,u)},setCells:hi,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:vi,getCellElement:function(e,t){return vi(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=B(n,t);return tn(r,e.section())},cellLength:function(e){return e.cells().length}},wi=function(e,t){if(0===e.length)return 0;var n=e[0];return H(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},yi=function(e,t,n,r){var o,i,u,c,a=(o=e,i=t,o[i]).cells().slice(n),l=wi(a,r),f=(u=e,c=n,B(u,function(e){return bi.getCell(e,c)})).slice(t),s=wi(f,r);return{colspan:S(l),rowspan:S(s)}},Ci=function(o,i){var u=B(o,function(e,t){return B(e.cells(),function(e,t){return!1})});return B(o,function(e,r){var t=V(e.cells(),function(e,t){if(!1!==u[r][t])return[];var n=yi(o,r,t,i);return function(e,t,n,r){for(var o=e;o<e+n;o++)for(var i=t;i<t+r;i++)u[o][i]=!0}(r,t,n.rowspan(),n.colspan()),[$t(e.element(),n.rowspan(),n.colspan(),e.isNew())]});return nn(t,e.section())})},Si=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 c=Dn.getAt(e,o,u).map(function(e){return Zt(e.element(),n)}).getOrThunk(function(){return Zt(t.gap(),!0)});i.push(c)}var a=tn(i,e.all()[o].section());r.push(a)}return r},xi=function(e,r){return B(e,function(e){var t,n=(t=e.details(),Wo(t,function(e){return kt(e.element()).map(function(e){var t=kt(e).isNone();return Zt(e,t)})}).getOrThunk(function(){return Zt(r.row(),!0)}));return en(n.element(),e.details(),e.section(),n.isNew())})},Ri=function(e,t){var n=Ci(e,Dt);return xi(n,t)},Ti=function(e,t){var n=q(B(e.all(),function(e){return e.cells()}));return z(n,function(e){return Dt(t,e.element())})},Oi=function(c,a,l,f,s){return function(n,r,e,o,i){var t=xn(r),u=Dn.generate(t);return a(u,e).map(function(e){var t=Si(u,o,!1),n=c(t,e,Dt,s(o)),r=Ri(n.grid(),o);return{grid:S(r),cursor:n.cursor}}).fold(function(){return x.none()},function(e){var t=Lo(r,e.grid());return l(r,e.grid(),i),f(r),fi(n,r,Eo.height,i),x.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},Di=function(t,e){return Sn.cell(e.element()).bind(function(e){return Ti(t,e)})},Ai=function(t,e){var n=B(e.selection(),function(e){return Sn.cell(e).bind(function(e){return Ti(t,e)})}),r=Mo(n);return 0<r.length?x.some({cells:r,generators:e.generators,clipboard:e.clipboard}):x.none()},Ei=function(t,e){var n=B(e.selection(),function(e){return Sn.cell(e).bind(function(e){return Ti(t,e)})}),r=Mo(n);return 0<r.length?x.some(r):x.none()},Ni=function(n){return{is:function(e){return n===e},isValue:c,isError:f,getOr:S(n),getOrThunk:S(n),getOrDie:S(n),or:function(e){return Ni(n)},orThunk:function(e){return Ni(n)},fold:function(e,t){return t(n)},map:function(e){return Ni(e(n))},mapError:function(e){return Ni(n)},each:function(e){e(n)},bind:function(e){return e(n)},exists:function(e){return e(n)},forall:function(e){return e(n)},toOption:function(){return x.some(n)}}},ki=function(n){return{is:f,isValue:f,isError:c,getOr:o,getOrThunk:function(e){return e()},getOrDie:function(){return u(String(n))()},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return ki(n)},mapError:function(e){return ki(e(n))},each:y,bind:function(e){return ki(n)},exists:f,forall:c,toOption:x.none}},Ii={value:Ni,error:ki,fromOption:function(e,t){return e.fold(function(){return ki(t)},Ni)}},Pi=function(e,t){return B(e,function(){return Zt(t.cell(),!0)})},Bi=function(t,e,n){return t.concat(function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n}(e,function(e){return bi.setCells(t[t.length-1],Pi(t[t.length-1].cells(),n))}))},Mi=function(e,t,n){return B(e,function(e){return bi.setCells(e,e.cells().concat(Pi(Ko(0,t),n)))})},Wi=function(e,t,n){if(e.row()>=t.length||e.column()>bi.cellLength(t[0]))return Ii.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=bi.cellLength(n[0]),u=n.length;return Ii.value({rowDelta:S(r.length-u),colDelta:S(o.length-i)})},_i=function(e,t){var n=bi.cellLength(e[0]),r=bi.cellLength(t[0]);return{rowDelta:S(0),colDelta:S(n-r)}},Li=function(e,t,n){var r=t.colDelta()<0?Mi:o;return(t.rowDelta()<0?Bi:o)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},ji=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++)bi.mutateCell(e[o],i,Zt(r(),!1));return e},zi=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<bi.cellLength(e[0]);u++){var c=n(bi.getCellElement(e[i],u),t);!0===c&&!1===o?bi.mutateCell(e[i],u,Zt(r(),!0)):!0===c&&(o=!1)}return e},Hi=function(i,n,u,c){if(0<n&&n<i.length){var e=i[n-1].cells(),t=(r=u,j(e,function(e,t){return P(e,function(e){return r(e.element(),t.element())})?e:e.concat([t])},[]));M(t,function(r){for(var o=x.none(),e=function(n){for(var e=function(t){var e=i[n].cells()[t];u(e.element(),r.element())&&(o.isNone()&&(o=x.some(c())),o.each(function(e){bi.mutateCell(i[n],t,Zt(e,!0))}))},t=0;t<bi.cellLength(i[0]);t++)e(t)},t=n;t<i.length;t++)e(t)})}var r;return i},Fi=function(n,r,o,i,u){return Wi(n,r,o).map(function(e){var t=Li(r,e,i);return function(e,t,n,r,o){for(var i,u,c,a,l,f=e.row(),s=e.column(),d=f+n.length,m=s+bi.cellLength(n[0]),g=f;g<d;g++)for(var p=s;p<m;p++){i=t,u=g,c=p,l=a=void 0,a=b(o,bi.getCell(i[u],c).element()),l=i[u],1<i.length&&1<bi.cellLength(l)&&(0<c&&a(bi.getCellElement(l,c-1))||c<l.cells().length-1&&a(bi.getCellElement(l,c+1))||0<u&&a(bi.getCellElement(i[u-1],c))||u<i.length-1&&a(bi.getCellElement(i[u+1],c)))&&zi(t,bi.getCellElement(t[g],p),o,r.cell);var h=bi.getCellElement(n[g-f],p-s),v=r.replace(h);bi.mutateCell(t[g],p,Zt(v,!0))}return t}(n,t,o,i,u)})},Ui=function(e,t,n,r,o){Hi(t,e,o,r.cell);var i=_i(n,t),u=Li(n,i,r),c=_i(t,u),a=Li(t,c,r);return a.slice(0,e).concat(u).concat(a.slice(e,a.length))},qi=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),c=bi.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(bi.getCellElement(n[r-1],t),bi.getCellElement(n[r],t))?bi.getCell(n[r],t):Zt(i(e.element(),o),!0)});return t.concat([c]).concat(u)},Vi=function(e,n,r,o,i){return B(e,function(e){var t=0<n&&n<bi.cellLength(e)&&o(bi.getCellElement(e,n-1),bi.getCellElement(e,n))?bi.getCell(e,n):Zt(i(bi.getCellElement(e,r),o),!0);return bi.addCell(e,n,t)})},Gi=function(e,r,o,i,u){var c=o+1;return B(e,function(e,t){var n=t===r?Zt(u(bi.getCellElement(e,o),i),!0):bi.getCell(e,o);return bi.addCell(e,c,n)})},Yi=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),c=e.slice(i),a=bi.mapCells(e[t],function(e,t){return t===n?Zt(o(e.element(),r),!0):e});return u.concat([a]).concat(c)},Ki=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},Xi=function(e,n,r){var t=B(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return tn(t,e.section())});return _(t,function(e){return 0<e.cells().length})},$i=function(e,n,r,o){return B(e,function(e){return bi.mapCells(e,function(e){return t=e,P(n,function(e){return r(t.element(),e.element())})?Zt(o(e.element(),r),!0):e;var t})})},Ji=function(e,t,n,r){return bi.getCellElement(e[t],n)!==undefined&&0<t&&r(bi.getCellElement(e[t-1],n),bi.getCellElement(e[t],n))},Qi=function(e,t,n){return 0<t&&n(bi.getCellElement(e,t-1),bi.getCellElement(e,t))},Zi=function(n,r,o,e){var t=V(n,function(e,t){return Ji(n,t,r,o)||Qi(e,r,o)?[]:[bi.getCell(e,r)]});return $i(n,t,o,e)},eu=function(n,r,o,e){var i=n[r],t=V(i.cells(),function(e,t){return Ji(n,r,t,o)||Qi(i,t,o)?[]:[e]});return $i(n,t,o,e)},tu=Mr([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),nu=Bo({},tu),ru=function(e,t,i,u){var n,r,c=e.slice(0),o=(r=t,0===(n=e).length?nu.none():1===n.length?nu.only(0):0===r?nu.left(0,1):r===n.length-1?nu.right(r-1,r):0<r&&r<n.length-1?nu.middle(r-1,r,r+1):nu.none()),a=function(e){return B(e,S(0))},l=S(a(c)),f=function(e,t){if(0<=i){var n=Math.max(u.minCellWidth(),c[t]-i);return a(c.slice(0,e)).concat([i,n-c[t]]).concat(a(c.slice(t+1)))}var r=Math.max(u.minCellWidth(),c[e]+i),o=c[e]-r;return a(c.slice(0,e)).concat([r-c[e],o]).concat(a(c.slice(t+1)))},s=f;return o.fold(l,function(e){return u.singleColumnWidth(c[e],i)},s,function(e,t,n){return f(t,n)},function(e,t){if(0<=i)return a(c.slice(0,t)).concat([i]);var n=Math.max(u.minCellWidth(),c[t]+i);return a(c.slice(0,t)).concat([n-c[t]])})},ou=function(e,t){return Re(e,t)&&1<parseInt(xe(e,t),10)},iu={hasColspan:function(e){return ou(e,"colspan")},hasRowspan:function(e){return ou(e,"rowspan")},minWidth:S(10),minHeight:S(10),getInt:function(e,t){return parseInt(He(e,t),10)}},uu=function(e,t,n){return Ue(e,t).fold(function(){return n(e)+"px"},function(e){return e})},cu=function(e,t){return uu(e,"width",function(e){return so.getPixelWidth(e,t)})},au=function(e){return uu(e,"height",so.getHeight)},lu=function(e,t,n,r,o){var i=Jo(e),u=B(i,function(e){return e.map(t.edge)});return B(i,function(e,t){return e.filter(d(iu.hasColspan)).fold(function(){var e=Xo(u,t);return r(e)},function(e){return n(e,o)})})},fu=function(e){return e.map(function(e){return e+"px"}).getOr("")},su=function(e,t,n,r){var o=Qo(e),i=B(o,function(e){return e.map(t.edge)});return B(o,function(e,t){return e.filter(d(iu.hasRowspan)).fold(function(){var e=Xo(i,t);return r(e)},function(e){return n(e)})})},du={getRawWidths:function(e,t,n){return lu(e,t,cu,fu,n)},getPixelWidths:function(e,t,n){return lu(e,t,so.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return lu(e,t,so.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return su(e,t,so.getHeight,function(e){return e.getOrThunk(iu.minHeight)})},getRawHeights:function(e,t){return su(e,t,au,fu)}},mu=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},gu=function(e,n){var t=Dn.justCells(e);return B(t,function(e){var t=mu(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:S(t),colspan:e.colspan}})},pu=function(e,n){var t=Dn.justCells(e);return B(t,function(e){var t=mu(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:S(t),rowspan:e.rowspan}})},hu=function(e,n){return B(e.all(),function(e,t){return{element:e.element,height:S(n[t])}})},vu=function(e){var t=o;return{width:S(e),pixelWidth:S(e),getWidths:du.getPixelWidths,getCellDelta:t,singleColumnWidth:function(e,t){return[Math.max(iu.minWidth(),e+t)-e]},minCellWidth:iu.minWidth,setElementWidth:so.setPixelWidth,setTableWidth:function(e,t,n){var r=L(t,function(e,t){return e+t},0);so.setPixelWidth(e,r)}}},bu=function(e,t){var n,r,o,i,u=so.percentageBasedSizeRegex().exec(t);if(null!==u)return n=u[1],r=e,o=parseFloat(n),i=Jr(r),{width:S(o),pixelWidth:S(i),getWidths:du.getPercentageWidths,getCellDelta:function(e){return e/i*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return iu.minWidth()/i*100},setElementWidth:so.setPercentageWidth,setTableWidth:function(e,t,n){var r=o+n;so.setPercentageWidth(e,r)}};var c=so.pixelBasedSizeRegex().exec(t);if(null!==c){var a=parseInt(c[1],10);return vu(a)}var l=Jr(e);return vu(l)},wu=function(t){return so.getRawWidth(t).fold(function(){var e=Jr(t);return vu(e)},function(e){return bu(t,e)})},yu=function(e){return Dn.generate(e)},Cu=function(e){var t=xn(e);return yu(t)},Su=function(e,t,n,r){var o=wu(e),i=o.getCellDelta(t),u=Cu(e),c=o.getWidths(u,r,o),a=ru(c,n,i,o),l=B(a,function(e,t){return e+c[t]}),f=gu(u,l);M(f,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},xu=function(e,n,r,t){var o=Cu(e),i=du.getPixelHeights(o,t),u=B(i,function(e,t){return r===t?Math.max(n+e,iu.minHeight()):e}),c=pu(o,u),a=hu(o,u);M(a,function(e){so.setHeight(e.element(),e.height())}),M(c,function(e){so.setHeight(e.element(),e.height())});var l=L(u,function(e,t){return e+t},0);so.setHeight(e,l)},Ru=function(e,t,n){var r=wu(e),o=yu(t),i=r.getWidths(o,n,r),u=gu(o,i);M(u,function(e){r.setElementWidth(e.element(),e.width())}),0<u.length&&r.setTableWidth(e,i,r.getCellDelta(0))},Tu=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return ue("required",o),ce(o),function(t){var n=X(t);G(o,function(e){return I(n,e)})||oe(o,n),r(o,n);var e=_(o,function(e){return!i.validate(t[e],e)});return 0<e.length&&function(e,t){throw new Error("All values need to be of type: "+t+". Keys ("+re(e).join(", ")+") were not.")}(e,i.label),t}},Ou=function(t,e){var n=_(e,function(e){return!I(t,e)});0<n.length&&ie(n)},Du=function(e){return Tu(Ou,e,{validate:A,label:"function"})},Au=Du(["cell","row","replace","gap"]),Eu=function(e){var t=Re(e,"colspan")?parseInt(xe(e,"colspan"),10):1,n=Re(e,"rowspan")?parseInt(xe(e,"rowspan"),10):1;return{element:S(e),colspan:S(t),rowspan:S(n)}},Nu=function(r,o){void 0===o&&(o=Eu),Au(r);var n=l(x.none()),i=function(e){var t,n=o(e);return t=n,r.cell(t)},u=function(e){var t=i(e);return n.get().isNone()&&n.set(x.some(t)),c=x.some({item:e,replacement:t}),t},c=x.none();return{getOrInit:function(t,n){return c.fold(function(){return u(t)},function(e){return n(t,e.item)?e.replacement:u(t)})},cursor:n.get}},ku=function(c,a){return function(r){var o=l(x.none());Au(r);var i=[],u=function(e){var t={scope:c},n=r.replace(e,a,t);return i.push({item:e,sub:n}),o.get().isNone()&&o.set(x.some(n)),n};return{replaceOrInit:function(t,n){return(r=t,o=n,z(i,function(e){return o(e.item,r)})).fold(function(){return u(t)},function(e){return n(t,e.item)?e.sub:u(t)});var r,o},cursor:o.get}}},Iu=function(n){Au(n);var e=l(x.none());return{combine:function(t){return e.get().isNone()&&e.set(x.some(t)),function(){var e=n.cell({element:S(t),colspan:S(1),rowspan:S(1)});return qe(e,"width"),qe(t,"width"),e}},cursor:e.get}},Pu=["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"],Bu=function(e,t){var n=e.property().name(t);return I(Pu,n)},Mu=function(e,t){return I(["br","img","hr","input"],e.property().name(t))},Wu=Bu,_u=function(e,t){var n=e.property().name(t);return I(["ol","ul"],n)},Lu=Mu,ju=sr(),zu=function(e){return Wu(ju,e)},Hu=function(e){return _u(ju,e)},Fu=function(e){return Lu(ju,e)},Uu=function(e){var t,i=function(e){return"br"===me(e)},n=function(o){return Ln(o).bind(function(n){var r=Bt(n).map(function(e){return!!zu(e)||!!Fu(e)&&"img"!==me(e)}).getOr(!1);return kt(n).map(function(e){return!0===r||"li"===me(t=e)||fn(t,Hu).isSome()||i(n)||zu(e)&&!Dt(o,e)?[]:[Pe.fromTag("br")];var t})}).getOr([])},r=0===(t=V(e,function(e){var t=Mt(e);return G(t,function(e){return i(e)||be(e)&&0===kn(e).trim().length})?[]:t.concat(n(e))})).length?[Pe.fromTag("br")]:t;qt(e[0]),Ut(e[0],r)},qu=function(e){0===Sn.cells(e).length&&Vt(e)},Vu=ne("grid","cursor"),Gu=function(e,t,n){return Yu(e,t,n).orThunk(function(){return Yu(e,0,0)})},Yu=function(e,t,n){return x.from(e[t]).bind(function(e){return x.from(e.cells()[n]).bind(function(e){return x.from(e.element())})})},Ku=function(e,t,n){return Vu(e,Yu(e,t,n))},Xu=function(e){return j(e,function(e,t){return P(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},$u=function(e){return j(e,function(e,t){return P(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=Rn(e,n),o=Dn.generate(r);return Si(o,t,!0)},Qu=Ru,Zu={insertRowBefore:Oi(function(e,t,n,r){var o=t.row(),i=t.row(),u=qi(e,i,o,n,r.getOrInit);return Ku(u,i,t.column())},Di,y,y,Nu),insertRowsBefore:Oi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=Xu(t),c=j(u,function(e,t){return qi(e,i,o,n,r.getOrInit)},e);return Ku(c,i,t[0].column())},Ei,y,y,Nu),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 Ku(u,i,t.column())},Di,y,y,Nu),insertRowsAfter:Oi(function(e,t,n,r){var o=Xu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),c=j(o,function(e,t){return qi(e,u,i,n,r.getOrInit)},e);return Ku(c,u,t[0].column())},Ei,y,y,Nu),insertColumnBefore:Oi(function(e,t,n,r){var o=t.column(),i=t.column(),u=Vi(e,i,o,n,r.getOrInit);return Ku(u,t.row(),i)},Di,Qu,y,Nu),insertColumnsBefore:Oi(function(e,t,n,r){var o=$u(t),i=o[0].column(),u=o[0].column(),c=j(o,function(e,t){return Vi(e,u,i,n,r.getOrInit)},e);return Ku(c,t[0].row(),u)},Ei,Qu,y,Nu),insertColumnAfter:Oi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=Vi(e,i,o,n,r.getOrInit);return Ku(u,t.row(),i)},Di,Qu,y,Nu),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=$u(t),c=j(u,function(e,t){return Vi(e,i,o,n,r.getOrInit)},e);return Ku(c,t[0].row(),i)},Ei,Qu,y,Nu),splitCellIntoColumns:Oi(function(e,t,n,r){var o=Gi(e,t.row(),t.column(),n,r.getOrInit);return Ku(o,t.row(),t.column())},Di,Qu,y,Nu),splitCellIntoRows:Oi(function(e,t,n,r){var o=Yi(e,t.row(),t.column(),n,r.getOrInit);return Ku(o,t.row(),t.column())},Di,y,y,Nu),eraseColumns:Oi(function(e,t,n,r){var o=$u(t),i=Xi(e,o[0].column(),o[o.length-1].column()),u=Gu(i,t[0].row(),t[0].column());return Vu(i,u)},Ei,Qu,qu,Nu),eraseRows:Oi(function(e,t,n,r){var o=Xu(t),i=Ki(e,o[0].row(),o[o.length-1].row()),u=Gu(i,t[0].row(),t[0].column());return Vu(i,u)},Ei,y,qu,Nu),makeColumnHeader:Oi(function(e,t,n,r){var o=Zi(e,t.column(),n,r.replaceOrInit);return Ku(o,t.row(),t.column())},Di,y,y,ku("row","th")),unmakeColumnHeader:Oi(function(e,t,n,r){var o=Zi(e,t.column(),n,r.replaceOrInit);return Ku(o,t.row(),t.column())},Di,y,y,ku(null,"td")),makeRowHeader:Oi(function(e,t,n,r){var o=eu(e,t.row(),n,r.replaceOrInit);return Ku(o,t.row(),t.column())},Di,y,y,ku("col","th")),unmakeRowHeader:Oi(function(e,t,n,r){var o=eu(e,t.row(),n,r.replaceOrInit);return Ku(o,t.row(),t.column())},Di,y,y,ku(null,"td")),mergeCells:Oi(function(e,t,n,r){var o=t.cells();Uu(o);var i=ji(e,t.bounds(),n,S(o[0]));return Vu(i,x.from(o[0]))},function(e,t){return t.mergable()},y,y,Iu),unmergeCells:Oi(function(e,t,n,r){var o=L(t,function(e,t){return zi(e,t,n,r.combine(t))},e);return Vu(o,x.from(t[0]))},function(e,t){return t.unmergable()},Qu,y,Iu),pasteCells:Oi(function(e,n,t,r){var o,i,u,c,a=(o=n.clipboard(),i=n.generators(),u=xn(o),c=Dn.generate(u),Si(c,i,!0)),l=Kt(n.row(),n.column());return Fi(l,e,a,n.generators(),t).fold(function(){return Vu(e,x.some(n.element()))},function(e){var t=Gu(e,n.row(),n.column());return Vu(e,t)})},function(t,n){return Sn.cell(n.element()).bind(function(e){return Ti(t,e).map(function(e){return Bo({},e,{generators:n.generators,clipboard:n.clipboard})})})},Qu,y,Nu),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),c=Ui(i,e,u,t.generators(),n),a=Gu(c,t.cells[0].row(),t.cells[0].column());return Vu(c,a)},Ai,y,y,Nu),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),c=Ui(i,e,u,t.generators(),n),a=Gu(c,t.cells[0].row(),t.cells[0].column());return Vu(c,a)},Ai,y,y,Nu)},ec=function(e){return Pe.fromDom(e.getBody())},tc=function(e){return e.getBoundingClientRect().width},nc=function(e){return e.getBoundingClientRect().height},rc=function(t){return function(e){return Dt(e,ec(t))}},oc=function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},ic=function(e){var t=an(e,"td[data-mce-style],th[data-mce-style]");Te(e,"data-mce-style"),M(t,function(e){Te(e,"data-mce-style")})},uc={isRtl:S(!1)},cc={isRtl:S(!0)},ac={directionAt:function(e){return"rtl"==("rtl"===He(e,"direction")?"rtl":"ltr")?cc:uc}},lc={"border-collapse":"collapse",width:"100%"},fc={border:"1"},sc=function(e){return e.getParam("table_default_attributes",fc,"object")},dc=function(e){return e.getParam("table_default_styles",lc,"object")},mc=function(e){return e.getParam("table_tab_navigation",!0,"boolean")},gc=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},pc=function(e){return e.getParam("table_row_advtab",!0,"boolean")},hc=function(e){return e.getParam("table_advtab",!0,"boolean")},vc=function(e){return e.getParam("table_style_by_css",!1,"boolean")},bc=function(e){return e.getParam("table_class_list",[],"array")},wc=function(e){return!1===e.getParam("table_responsive_width")},yc=function(e,t){return e.fire("newrow",{node:t})},Cc=function(e,t){return e.fire("newcell",{node:t})},Sc=function(e,t,n,r){e.fire("ObjectResizeStart",{target:t,width:n,height:r})},xc=function(e,t,n,r){e.fire("ObjectResized",{target:t,width:n,height:r})},Rc=function(f,e){var t,n=function(e){return"table"===me(ec(e))},s=(t=f.getParam("table_clone_elements"),T(t)?x.some(t.split(/[ ,]/)):Array.isArray(t)?x.some(t):x.none()),r=function(u,c,a,l){return function(e,t){ic(e);var n=l(),r=Pe.fromDom(f.getDoc()),o=ko(ac.directionAt),i=Kn(a,r,s);return c(e)?u(n,e,t,i,o).bind(function(e){return M(e.newRows(),function(e){yc(f,e.dom())}),M(e.newCells(),function(e){Cc(f,e.dom())}),e.cursor().map(function(e){var t=f.dom.createRng();return t.setStart(e.dom(),0),t.setEnd(e.dom(),0),t})}):x.none()}};return{deleteRow:r(Zu.eraseRows,function(e){var t=Po(e);return!1===n(f)||1<t.rows()},y,e),deleteColumn:r(Zu.eraseColumns,function(e){var t=Po(e);return!1===n(f)||1<t.columns()},y,e),insertRowsBefore:r(Zu.insertRowsBefore,c,y,e),insertRowsAfter:r(Zu.insertRowsAfter,c,y,e),insertColumnsBefore:r(Zu.insertColumnsBefore,c,mo,e),insertColumnsAfter:r(Zu.insertColumnsAfter,c,mo,e),mergeCells:r(Zu.mergeCells,c,y,e),unmergeCells:r(Zu.unmergeCells,c,y,e),pasteRowsBefore:r(Zu.pasteRowsBefore,c,y,e),pasteRowsAfter:r(Zu.pasteRowsAfter,c,y,e),pasteCells:r(Zu.pasteCells,c,y,e)}},Tc=function(e,t,r){var n=xn(e),o=Dn.generate(n);return Ei(o,t).map(function(e){var t=Si(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=Ri(t,r);return jo(n)})},Oc=tinymce.util.Tools.resolve("tinymce.util.Tools"),Dc=function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},Ac=function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},Ec=function(t,n){Oc.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},Nc=function(t,n){Oc.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},kc=function(o,e,i){var t;return t=function(e,t){for(var n=0;n<t.length;n++){var r=o.getStyle(t[n],i);if(void 0===e&&(e=r),e!==r)return""}return e}(t,o.select("td,th",e))},Ic=function(t,e){var n=function(e){return Ee(e,"rgb")?t.toHex(e):e};return{borderstyle:Ue(Pe.fromDom(e),"border-style").getOr(""),bordercolor:Ue(Pe.fromDom(e),"border-color").map(n).getOr(""),backgroundcolor:Ue(Pe.fromDom(e),"background-color").map(n).getOr("")}},Pc=function(e,t,n,r,o){var i={};return Oc.each(e.split(" "),function(e){r.formatter.matchNode(o,t+e)&&(i[n]=e)}),i[n]||(i[n]=""),i},Bc=b(Pc,"left center right"),Mc=b(Pc,"top middle bottom"),Wc=function(e,r,t){var o=function(e,n){return n=n||[],Oc.each(e,function(e){var t={text:e.text||e.title};e.menu?t.menu=o(e.menu):(t.value=e.value,r&&r(t)),n.push(t)}),n};return o(e,t||[])},_c=function(e){var i=e[0],t=e.slice(1),n=X(i);return M(t,function(e){M(n,function(o){J(e,function(e,t,n){var r=i[o];""!==r&&o===t&&r!==e&&(i[o]="")})})}),i},Lc=function(){return{title:"Advanced",name:"advanced",items:[{name:"borderstyle",type:"selectbox",label:"Border style",items:[{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"}]},{name:"bordercolor",type:"colorinput",label:"Border color"},{name:"backgroundcolor",type:"colorinput",label:"Background color"}]}},jc=function(e,t,n){var r,o,i,u=e.dom;return Bo({width:u.getStyle(t,"width")||u.getAttrib(t,"width"),height:u.getStyle(t,"height")||u.getAttrib(t,"height"),cellspacing:u.getStyle(t,"border-spacing")||u.getAttrib(t,"cellspacing"),cellpadding:u.getAttrib(t,"cellpadding")||kc(e.dom,t,"padding"),border:(r=u,o=t,i=Ue(Pe.fromDom(o),"border-width"),vc(e)&&i.isSome()?i.getOr(""):r.getAttrib(o,"border")||kc(e.dom,o,"border-width")||kc(e.dom,o,"border")),caption:!!u.select("caption",t)[0],"class":u.getAttrib(t,"class","")},Bc("align","align",e,t),n?Ic(u,t):{})},zc=function(e,t,n){var r=e.dom;return Bo({height:r.getStyle(t,"height")||r.getAttrib(t,"height"),scope:r.getAttrib(t,"scope"),"class":r.getAttrib(t,"class",""),align:"",type:t.parentNode.nodeName.toLowerCase()},Bc("align","align",e,t),n?Ic(r,t):{})},Hc=function(e,t,n){var r=e.dom;return Bo({width:r.getStyle(t,"width")||r.getAttrib(t,"width"),height:r.getStyle(t,"height")||r.getAttrib(t,"height"),scope:r.getAttrib(t,"scope"),celltype:t.nodeName.toLowerCase(),"class":r.getAttrib(t,"class","")},Bc("align","halign",e,t),Mc("valign","valign",e,t),n?Ic(r,t):{})},Fc=function(e,t){var n,r,o,i,u,c,a,l,f=dc(e),s=sc(e),d=e.dom,m=t?(n=d,r=function(e){return Ee(e,"rgb")?n.toHex(e):e},o=ee(f,"border-style").getOr(""),i=ee(f,"border-color").getOr(""),u=ee(f,"background-color").getOr(""),{borderstyle:o,bordercolor:r(i),backgroundcolor:r(u)}):{};return Bo({},{height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,"class":"",align:"",border:""},f,s,m,(l=f["border-width"],vc(e)&&l?{border:l}:ee(s,"border").fold(function(){return{}},function(e){return{border:e}})),(c=ee(f,"border-spacing").or(ee(s,"cellspacing")).fold(function(){return{}},function(e){return{cellspacing:e}}),a=ee(f,"border-padding").or(ee(s,"cellpadding")).fold(function(){return{}},function(e){return{cellpadding:e}}),Bo({},c,a)))},Uc=[{name:"width",type:"input",label:"Width"},{name:"height",type:"input",label:"Height"},{name:"celltype",type:"selectbox",label:"Cell type",items:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{name:"scope",type:"selectbox",label:"Scope",items:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{name:"halign",type:"selectbox",label:"H Align",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{name:"valign",type:"selectbox",label:"V Align",items:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}],qc=function(e){return(t=e,n=t.getParam("table_cell_class_list",[],"array"),r=Wc(n,function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})}),0<n.length?x.some({name:"class",type:"selectbox",label:"Class",items:r}):x.none()).fold(function(){return Uc},function(e){return Uc.concat(e)});var t,n,r},Vc={normal:function(n,r){return{setAttrib:function(e,t){n.setAttrib(r,e,t)},setStyle:function(e,t){n.setStyle(r,e,t)}}},ifTruthy:function(n,r){return{setAttrib:function(e,t){t&&n.setAttrib(r,e,t)},setStyle:function(e,t){t&&n.setStyle(r,e,t)}}}},Gc=function(e,t){e.setAttrib("scope",t.scope),e.setAttrib("class",t["class"]),e.setStyle("width",oc(t.width)),e.setStyle("height",oc(t.height))},Yc=function(e,t){e.setStyle("background-color",t.backgroundcolor),e.setStyle("border-color",t.bordercolor),e.setStyle("border-style",t.borderstyle)},Kc=function(e,t,n){var r=e.dom,o=n.celltype&&t[0].nodeName.toLowerCase()!==n.celltype?r.rename(t[0],n.celltype):t[0],i=Vc.normal(r,o);Gc(i,n),gc(e)&&Yc(i,n),Ec(e,o),Nc(e,o),n.halign&&Dc(e,o,n.halign),n.valign&&Ac(e,o,n.valign)},Xc=function(n,e,r){var o=n.dom;Oc.each(e,function(e){r.celltype&&e.nodeName.toLowerCase()!==r.celltype&&(e=o.rename(e,r.celltype));var t=Vc.ifTruthy(o,e);Gc(t,r),gc(n)&&Yc(t,r),r.halign&&Dc(n,e,r.halign),r.valign&&Ac(n,e,r.valign)})},$c=function(e,t,n){var r=n.getData();n.close(),e.undoManager.transact(function(){(1===t.length?Kc:Xc)(e,t,r),e.focus()})},Jc=function(t){var e,n=[];if(n=t.dom.select("td[data-mce-selected],th[data-mce-selected]"),e=t.dom.getParent(t.selection.getStart(),"td,th"),!n.length&&e&&n.push(e),e=e||n[0]){var r=Oc.map(n,function(e){return Hc(t,e,gc(t))}),o=_c(r),i={type:"tabpanel",tabs:[{title:"General",name:"general",items:qc(t)},Lc()]},u={type:"panel",items:[{type:"grid",columns:2,items:qc(t)}]};t.windowManager.open({title:"Cell Properties",size:"normal",body:gc(t)?i:u,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onSubmit:b($c,t,n)})}},Qc=[{type:"selectbox",name:"type",label:"Row type",items:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"selectbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height",type:"input"}],Zc=function(e){return(t=e,n=t.getParam("table_row_class_list",[],"array"),r=Wc(n,function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})}),0<n.length?x.some({name:"class",type:"selectbox",label:"Class",items:r}):x.none()).fold(function(){return Qc},function(e){return Qc.concat(e)});var t,n,r},ea=function(f,e,s,t){var d=f.dom,m=t.getData();t.close();var g=1===e.length?Vc.normal:Vc.ifTruthy;f.undoManager.transact(function(){Oc.each(e,function(e){var t,n,r,o,i,u;m.type!==e.parentNode.nodeName.toLowerCase()&&(t=f.dom,n=e,r=m.type,o=t.getParent(n,"table"),i=n.parentNode,(u=t.select(r,o)[0])||(u=t.create(r),o.firstChild?"CAPTION"===o.firstChild.nodeName?t.insertAfter(u,o.firstChild):o.insertBefore(u,o.firstChild):o.appendChild(u)),u.appendChild(n),i.hasChildNodes()||t.remove(i));var c,a,l=g(d,e);l.setAttrib("scope",m.scope),l.setAttrib("class",m["class"]),l.setStyle("height",oc(m.height)),pc(f)&&(a=m,(c=l).setStyle("background-color",a.backgroundcolor),c.setStyle("border-color",a.bordercolor),c.setStyle("border-style",a.borderstyle)),m.align!==s.align&&(Ec(f,e),Dc(f,e,m.align))}),f.focus()})},ta=function(t){var e,n,r=t.dom,o=[];if((e=r.getParent(t.selection.getStart(),"table"))&&(n=r.getParent(t.selection.getStart(),"td,th"),Oc.each(e.rows,function(t){Oc.each(t.cells,function(e){if((r.getAttrib(e,"data-mce-selected")||e===n)&&o.indexOf(t)<0)return o.push(t),!1})}),o[0])){var i=Oc.map(o,function(e){return zc(t,e,pc(t))}),u=_c(i),c={type:"tabpanel",tabs:[{title:"General",name:"general",items:Zc(t)},Lc()]},a={type:"panel",items:[{type:"grid",columns:2,items:Zc(t)}]};t.windowManager.open({title:"Row Properties",size:"normal",body:pc(t)?c:a,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:u,onSubmit:b(ea,t,o,u)})}},na=Object.prototype.hasOwnProperty,ra=(Io=function(e,t){return t},function(){for(var e=new Array(arguments.length),t=0;t<e.length;t++)e[t]=arguments[t];if(0===e.length)throw new Error("Can't merge zero objects");for(var n={},r=0;r<e.length;r++){var o=e[r];for(var i in o)na.call(o,i)&&(n[i]=Io(n[i],o[i]))}return n}),oa=tinymce.util.Tools.resolve("tinymce.Env"),ia={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},ua=function(e,t,n,r,o){void 0===o&&(o=ia);var i=Pe.fromTag("table");ze(i,o.styles),Se(i,o.attributes);var u=Pe.fromTag("tbody");zt(i,u);for(var c=[],a=0;a<e;a++){for(var l=Pe.fromTag("tr"),f=0;f<t;f++){var s=a<n||f<r?Pe.fromTag("th"):Pe.fromTag("td");f<r&&Ce(s,"scope","row"),a<n&&Ce(s,"scope","col"),zt(s,Pe.fromTag("br")),o.percentages&&je(s,"width",100/t+"%"),zt(l,s)}c.push(l)}return Ut(u,c),i},ca=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},aa=function(r,e,t){var n,o=dc(r),i={styles:o,attributes:sc(r),percentages:(n=o.width,T(n)&&-1!==n.indexOf("%")&&!wc(r))},u=ua(t,e,0,0,i);Ce(u,"data-mce-id","__mce");var c,a,l,f=(c=u,a=Pe.fromTag("div"),l=Pe.fromDom(c.dom().cloneNode(!0)),zt(a,l),a.dom().innerHTML);return r.insertContent(f),mn(ec(r),'table[data-mce-id="__mce"]').map(function(e){var t,n;return wc(r)&&je(e,"width",He(e,"width")),Te(e,"data-mce-id"),t=r,M(an(e,"tr"),function(e){yc(t,e.dom()),M(an(e,"th,td"),function(e){Cc(t,e.dom())})}),n=r,mn(e,"td,th").each(b(ca,n)),e.dom()}).getOr(null)},la=function(t,e,n){var r=n?[{type:"input",name:"cols",label:"Cols"},{type:"input",name:"rows",label:"Rows"}]:[],o=t.getParam("table_appearance_options",!0,"boolean")?[{type:"input",name:"cellspacing",label:"Cell spacing"},{type:"input",name:"cellpadding",label:"Cell padding"},{type:"input",name:"border",label:"Border width"},{type:"label",label:"Caption",items:[{type:"checkbox",name:"caption",label:"Show caption"}]}]:[],i=e?[{type:"selectbox",name:"class",label:"Class",items:Wc(bc(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}]:[];return r.concat([{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}]).concat(o).concat([{type:"selectbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]).concat(i)},fa=function(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)T(n)?e.setStyle(t,n,r):e.setStyle(t,n);else if(t.children)for(var o=0;o<t.children.length;o++)fa(e,t.children[o],n,r)},sa=function(n,r,e){var o,i=n.dom,u=e.getData();e.close(),""===u["class"]&&delete u["class"],n.undoManager.transact(function(){if(!r){var e=parseInt(u.cols,10)||1,t=parseInt(u.rows,10)||1;r=aa(n,e,t)}!function(e,t,n){var r,o=e.dom,i={},u={};if(i["class"]=n["class"],u.height=oc(n.height),o.getAttrib(t,"width")&&!vc(e)?i.width=(r=n.width)?r.replace(/px$/,""):"":u.width=oc(n.width),vc(e)?(u["border-width"]=oc(n.border),u["border-spacing"]=oc(n.cellspacing)):(i.border=n.border,i.cellpadding=n.cellpadding,i.cellspacing=n.cellspacing),vc(e)&&t.children)for(var c=0;c<t.children.length;c++)fa(o,t.children[c],{"border-width":oc(n.border),padding:oc(n.cellpadding)}),hc(e)&&fa(o,t.children[c],{"border-color":n.bordercolor});hc(e)&&(u["background-color"]=n.backgroundcolor,u["border-color"]=n.bordercolor,u["border-style"]=n.borderstyle),i.style=o.serializeStyle(ra(dc(e),u)),o.setAttribs(t,ra(sc(e),i))}(n,r,u),(o=i.select("caption",r)[0])&&!u.caption&&i.remove(o),!o&&u.caption&&((o=i.create("caption")).innerHTML=oa.ie?"\xa0":'<br data-mce-bogus="1"/>',r.insertBefore(o,r.firstChild)),""===u.align?Ec(n,r):Dc(n,r,u.align),n.focus(),n.addVisual()})},da=function(e,t){var n,r=e.dom,o=Fc(e,hc(e));!1===t?(n=r.getParent(e.selection.getStart(),"table"))?o=jc(e,n,hc(e)):hc(e)&&(o.borderstyle="",o.bordercolor="",o.backgroundcolor=""):(o.cols="1",o.rows="1",hc(e)&&(o.borderstyle="",o.bordercolor="",o.backgroundcolor=""));var i=0<bc(e).length;i&&o["class"]&&(o["class"]=o["class"].replace(/\s*mce\-item\-table\s*/g,""));var u={type:"grid",columns:2,items:la(e,i,t)},c=hc(e)?{type:"tabpanel",tabs:[{title:"General",name:"general",items:[u]},Lc()]}:{type:"panel",items:[u]};e.windowManager.open({title:"Table Properties",size:"normal",body:c,onSubmit:b(sa,e,n),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o})},ma=function(t){return function(e){return x.from(e.dom.getParent(e.selection.getStart(),t)).map(Pe.fromDom)}},ga=ma("th,td"),pa=ma("th,td,caption"),ha=Oc.each,va={registerCommands:function(c,t,a,l,n){var r=rc(c),f=function(e){return Sn.table(e,r)},s=function(e){return{width:tc(e.dom()),height:tc(e.dom())}},o=function(n){ga(c).each(function(t){f(t).each(function(i){var e=qr.forMenu(l,i,t),u=s(i);n(i,e).each(function(e){var t,n,r,o;t=c,n=u,o=s(r=i),n.width===o.width&&n.height===o.height||(Sc(t,r.dom(),n.width,n.height),xc(t,r.dom(),o.width,o.height)),c.selection.setRng(e),c.focus(),a.clear(i),ic(i)})})})},i=function(e){return ga(c).map(function(o){return f(o).bind(function(e){var t=Pe.fromDom(c.getDoc()),n=qr.forMenu(l,e,o),r=Kn(y,t,x.none());return Tc(e,n,r)})})},u=function(u){n.get().each(function(e){var i=B(e,function(e){return Fn(e)});ga(c).each(function(o){f(o).each(function(t){var e=Pe.fromDom(c.getDoc()),n=Xn(e),r=qr.pasteRows(l,t,o,i,n);u(t,r).each(function(e){c.selection.setRng(e),c.focus(),a.clear(t)})})})})};ha({mceTableSplitCells:function(){o(t.unmergeCells)},mceTableMergeCells:function(){o(t.mergeCells)},mceTableInsertRowBefore:function(){o(t.insertRowsBefore)},mceTableInsertRowAfter:function(){o(t.insertRowsAfter)},mceTableInsertColBefore:function(){o(t.insertColumnsBefore)},mceTableInsertColAfter:function(){o(t.insertColumnsAfter)},mceTableDeleteCol:function(){o(t.deleteColumn)},mceTableDeleteRow:function(){o(t.deleteRow)},mceTableCutRow:function(e){i().each(function(e){n.set(e),o(t.deleteRow)})},mceTableCopyRow:function(e){i().each(function(e){n.set(e)})},mceTablePasteRowBefore:function(e){u(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){u(t.pasteRowsAfter)},mceTableDelete:function(){pa(c).each(function(e){Sn.table(e,r).filter(d(r)).each(function(e){var t=Pe.fromText("");if(Lt(e,t),Vt(e),c.dom.isEmpty(c.getBody()))c.setContent(""),c.selection.setCursorLocation();else{var n=c.dom.createRng();n.setStart(t.dom(),0),n.setEnd(t.dom(),0),c.selection.setRng(n),c.nodeChanged()}})})}},function(e,t){c.addCommand(t,e)}),ha({mceInsertTable:b(da,c,!0),mceTableProps:b(da,c,!1),mceTableRowProps:b(ta,c),mceTableCellProps:b(Jc,c)},function(e,t){c.addCommand(t,function(){e()})})}},ba=function(e){var t=x.from(e.dom().documentElement).map(Pe.fromDom).getOr(e);return{parent:S(t),view:S(e),origin:S(po(0,0))}},wa=function(e,t){return{parent:S(t),view:S(e),origin:S(po(0,0))}},ya=function(e){var r=ne.apply(null,e),o=[];return{bind:function(e){if(e===undefined)throw new Error("Event bind error: undefined handler");o.push(e)},unbind:function(t){o=_(o,function(e){return e!==t})},trigger:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=r.apply(null,e);M(o,function(e){e(n)})}}},Ca={create:function(e){return{registry:Q(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:Q(e,function(e){return e.trigger})}}},Sa=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,c,a=Pe.fromDom(e.target),l=function(){e.stopPropagation()},f=function(){e.preventDefault()},s=C(f,l),d=(t=a,n=e.clientX,r=e.clientY,o=l,i=f,u=s,c=e,{target:S(t),x:S(n),y:S(r),stop:o,prevent:i,kill:u,raw:S(c)});g(d)}}},xa=function(e,t,n,r){return o=e,i=t,u=!1,c=Sa(n,r),o.dom().addEventListener(i,c,u),{unbind:b(Ra,o,i,c,u)};var o,i,u,c},Ra=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},Ta=S(!0),Oa=function(e,t,n){return xa(e,t,Ta,n)},Da={resolve:Zo("ephox-dragster").resolve},Aa=Du(["compare","extract","mutate","sink"]),Ea=Du(["element","start","stop","destroy"]),Na=Du(["forceDrop","drop","move","delayDrop"]),ka=Aa({compare:function(e,t){return po(t.left()-e.left(),t.top()-e.top())},extract:function(e){return x.some(po(e.x(),e.y()))},sink:function(e,t){var n=(c=t,a=ra({layerClass:Da.resolve("blocker")},c),l=Pe.fromTag("div"),Ce(l,"role","presentation"),ze(l,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Vo(l,Da.resolve("blocker")),Vo(l,a.layerClass),{element:function(){return l},destroy:function(){Vt(l)}}),r=Oa(n.element(),"mousedown",e.forceDrop),o=Oa(n.element(),"mouseup",e.drop),i=Oa(n.element(),"mousemove",e.move),u=Oa(n.element(),"mouseout",e.delayDrop);var c,a,l;return Ea({element:n.element,start:function(e){zt(e,n.element())},stop:function(){Vt(n.element())},destroy:function(){n.destroy(),o.unbind(),i.unbind(),u.unbind(),r.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function Ia(){var i=x.none(),u=Ca.create({move:ya(["info"])});return{onEvent:function(e,o){o.extract(e).each(function(e){var t,n,r;(t=o,n=e,r=i.map(function(e){return t.compare(e,n)}),i=x.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=x.none()},events:u.registry}}function Pa(){var e=function r(){return{onEvent:y,reset:y}}(),t=Ia(),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 Ba=function(t,n,e){var r,o,i,u=!1,c=Ca.create({start:ya([]),stop:ya([])}),a=Pa(),l=function(){d.stop(),a.isOn()&&(a.off(),c.trigger.stop())},f=(r=l,o=200,i=null,{cancel:function(){null!==i&&(m.clearTimeout(i),i=null)},throttle:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null!==i&&m.clearTimeout(i),i=m.setTimeout(function(){r.apply(null,e),i=null},o)}});a.events.move.bind(function(e){n.mutate(t,e.info())});var s=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];u&&n.apply(null,e)}},d=n.sink(Na({forceDrop:l,drop:s(l),move:s(function(e){f.cancel(),a.onEvent(e,n)}),delayDrop:s(f.throttle)}),e);return{element:d.element,go:function(e){d.start(e),a.on(),c.trigger.start()},on:function(){u=!0},off:function(){u=!1},destroy:function(){d.destroy()},events:c.registry}},Ma=function(e,t){void 0===t&&(t={});var n=t.mode!==undefined?t.mode:ka;return Ba(e,n,t)},Wa=function(){var n,r=Ca.create({drag:ya(["xDelta","yDelta","target"])}),o=x.none(),e={mutate:function(e,t){n.trigger.drag(e,t)},events:(n=Ca.create({drag:ya(["xDelta","yDelta"])})).registry};e.events.drag.bind(function(t){o.each(function(e){r.trigger.drag(t.xDelta(),t.yDelta(),e)})});return{assign:function(e){o=x.some(e)},get:function(){return o},mutate:e.mutate,events:r.registry}},_a=function(e){return"true"===xe(e,"contenteditable")},La=ei.resolve("resizer-bar-dragging"),ja=function(o,t,i){var n=Wa(),r=Ma(n,{}),u=x.none(),e=function(e,t){return x.from(xe(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=iu.getInt(n.target(),"top");je(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=iu.getInt(n.target(),"left");je(n.target(),"left",t+n.xDelta()+"px")})});var c=function(e,t){return iu.getInt(e,t)-parseInt(xe(e,"data-initial-"+t),10)};r.events.stop.bind(function(){n.get().each(function(r){u.each(function(n){e(r,"data-row").each(function(e){var t=c(r,"top");Te(r,"data-initial-top"),m.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=c(r,"left");Te(r,"data-initial-left"),m.trigger.adjustWidth(n,t,parseInt(e,10))}),fi(o,n,i,t)})})});var a=function(e,t){m.trigger.startAdjust(),n.assign(e),Ce(e,"data-initial-"+t,parseInt(He(e,t),10)),Vo(e,La),je(e,"opacity","0.2"),r.go(o.parent())},l=Oa(o.parent(),"mousedown",function(e){gi(e.target())&&a(e.target(),"top"),pi(e.target())&&a(e.target(),"left")}),f=function(e){return Dt(e,o.view())},s=function(e){return gn(e,"table",f).filter(function(e){return(t=e,n=f,gn(t,"[contenteditable]",n)).exists(_a);var t,n})},d=Oa(o.view(),"mouseover",function(e){s(e.target()).fold(function(){Be(e.target())&&mi(o)},function(e){u=x.some(e),fi(o,e,i,t)})}),m=Ca.create({adjustHeight:ya(["table","delta","row"]),adjustWidth:ya(["table","delta","column"]),startAdjust:ya([])});return{destroy:function(){l.unbind(),d.unbind(),r.destroy(),mi(o)},refresh:function(e){fi(o,e,i,t)},on:r.on,off:r.off,hideBars:b(si,o),showBars:b(di,o),events:m.registry}};var za=function(e,t){return e.inline?wa(ec(e),(n=Pe.fromTag("div"),ze(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),zt(Me(),n),n)):ba(Pe.fromDom(e.getDoc()));var n},Ha=function(e,t){e.inline&&Vt(t.parent())},Fa=function(u){var c,a,o=x.none(),l=x.none(),f=x.none(),s=/(\d+(\.\d+)?)%/,d=function(e){return"TABLE"===e.nodeName},e=function(){return l};return u.on("init",function(){var e,t=ko(ac.directionAt),n=za(u);if(f=x.some(n),e=u.getParam("object_resizing",!0),(T(e)?"table"===e:e)&&u.getParam("table_resize_bars",!0,"boolean")){var r=function i(e,n){var r=Eo.height,t=ja(e,n,r),o=Ca.create({beforeResize:ya(["table"]),afterResize:ya(["table"]),startDrag:ya([])});return t.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());xu(e.table(),t,e.row(),r),o.trigger.afterResize(e.table())}),t.events.startAdjust.bind(function(e){o.trigger.startDrag()}),t.events.adjustWidth.bind(function(e){o.trigger.beforeResize(e.table());var t=n.delta(e.delta(),e.table());Su(e.table(),t,e.column(),n),o.trigger.afterResize(e.table())}),{on:t.on,off:t.off,hideBars:t.hideBars,showBars:t.showBars,destroy:t.destroy,events:o.registry}}(n,t);r.on(),r.events.startDrag.bind(function(e){o=x.some(u.selection.getRng())}),r.events.beforeResize.bind(function(e){var t=e.table().dom();Sc(u,t,tc(t),nc(t))}),r.events.afterResize.bind(function(e){var t=e.table(),n=t.dom();ic(t),o.each(function(e){u.selection.setRng(e),u.focus()}),xc(u,n,tc(n),nc(n)),u.undoManager.add()}),l=x.some(r)}}),u.on("ObjectResizeStart",function(e){var t,n=e.target;d(n)&&(c=e.width,t=n,a=u.dom.getStyle(t,"width")||u.dom.getAttrib(t,"width"))}),u.on("ObjectResized",function(e){var t=e.target;if(d(t)){var n=t;if(s.test(a)){var r=parseFloat(s.exec(a)[1]),o=e.width*r/c;u.dom.setStyle(n,"width",o+"%")}else{var i=[];Oc.each(n.rows,function(e){Oc.each(e.cells,function(e){var t=u.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),Oc.each(i,function(e){u.dom.setStyle(e.cell,"width",e.width),u.dom.setAttrib(e.cell,"width",null)})}}}),u.on("SwitchMode",function(){e().each(function(e){u.readonly?e.hideBars():e.showBars()})}),{lazyResize:e,lazyWire:function(){return f.getOr(ba(Pe.fromDom(u.getBody())))},destroy:function(){l.each(function(e){e.destroy()}),f.each(function(e){Ha(u,e)})}}},Ua=Mr([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),qa=Bo({},Ua,{none:function(e){return void 0===e&&(e=undefined),Ua.none(e)}}),Va=function(n,e){return Sn.table(n,e).bind(function(e){var t=Sn.cells(e);return H(t,function(e){return Dt(n,e)}).map(function(e){return{index:S(e),all:S(t)}})})},Ga=function(t,e){return Va(t,e).fold(function(){return qa.none(t)},function(e){return e.index()+1<e.all().length?qa.middle(t,e.all()[e.index()+1]):qa.last(t)})},Ya=function(t,e){return Va(t,e).fold(function(){return qa.none()},function(e){return 0<=e.index()-1?qa.middle(t,e.all()[e.index()-1]):qa.first(t)})},Ka={create:ne("start","soffset","finish","foffset")},Xa=Mr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),$a={before:Xa.before,on:Xa.on,after:Xa.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(o,o,o)}},Ja=Mr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),Qa={domRange:Ja.domRange,relative:Ja.relative,exact:Ja.exact,exactFromRange:function(e){return Ja.exact(e.start(),e.soffset(),e.finish(),e.foffset())},getWin:function(e){var t,n=e.match({domRange:function(e){return Pe.fromDom(e.startContainer)},relative:function(e,t){return $a.getStart(e)},exact:function(e,t,n,r){return e}});return t=n.dom().ownerDocument.defaultView,Pe.fromDom(t)},range:Ka.create},Za=function(e,t){e.selectNodeContents(t.dom())},el=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},tl=function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},nl=function(e){return{left:S(e.left),top:S(e.top),right:S(e.right),bottom:S(e.bottom),width:S(e.width),height:S(e.height)}},rl=Mr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ol=function(e,t,n){return t(Pe.fromDom(n.startContainer),n.startOffset,Pe.fromDom(n.endContainer),n.endOffset)},il=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:S(e),rtl:x.none}},relative:function(e,t){return{ltr:ke(function(){return el(o,e,t)}),rtl:ke(function(){return x.some(el(o,t,e))})}},exact:function(e,t,n,r){return{ltr:ke(function(){return tl(o,e,t,n,r)}),rtl:ke(function(){return x.some(tl(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return rl.rtl(Pe.fromDom(e.endContainer),e.endOffset,Pe.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return ol(0,rl.ltr,r)}):ol(0,rl.ltr,r)},ul=function(i,e){return il(i,e).match({ltr:function(e,t,n,r){var o=i.document.createRange();return o.setStart(e.dom(),t),o.setEnd(n.dom(),r),o},rtl:function(e,t,n,r){var o=i.document.createRange();return o.setStart(n.dom(),r),o.setEnd(e.dom(),t),o}})},cl=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},al=function(n,r,e,t,o){var i=function(e){var t=n.dom().createRange();return t.setStart(r.dom(),e),t.collapse(!0),t},u=kn(r).length,c=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 c=e(u),a=Math.abs(t-c.left);if(n<=c.bottom){if(n<c.top||i<a)return u-1;i=a}}return 0}(function(e){return i(e).getBoundingClientRect()},e,t,o.right,u);return i(c)},ll=function(t,n,r,o){var e=t.dom().createRange();e.selectNode(n.dom());var i=e.getClientRects();return Wo(i,function(e){return cl(e,r,o)?x.some(e):x.none()}).map(function(e){return al(t,n,r,o,e)})},fl=function(t,e,n,r){var o=t.dom().createRange(),i=Mt(e);return Wo(i,function(e){return o.selectNode(e.dom()),cl(o.getBoundingClientRect(),n,r)?sl(t,e,n,r):x.none()})},sl=function(e,t,n,r){return(be(t)?ll:fl)(e,t,n,r)},dl=function(e,t){return t-e.left<e.right-t},ml=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},gl=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=dl(o,n);return(!0===i?_n:Ln)(e).map(function(e){return ml(t,e,i)})},pl=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=dl(r,n);return x.some(ml(e,t,o))},hl=function(e,t,n,r){var o=e.dom().createRange();o.selectNode(t.dom());var i=o.getBoundingClientRect();return 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)),c=Math.max(i.top,Math.min(i.bottom,r));return sl(e,t,u,c)}(e,t,Math.max(i.left,Math.min(i.right,n)),Math.max(i.top,Math.min(i.bottom,r)))},vl=document.caretPositionFromPoint?function(n,e,t){return x.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return x.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),x.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return x.from(e.dom().caretRangeFromPoint(t,n))}:function(o,i,t){return Pe.fromPoint(o,i,t).bind(function(r){var e=function(){return e=o,n=i,(0===Mt(t=r).length?pl:gl)(e,t,n);var e,t,n};return 0===Mt(r).length?e():hl(o,r,i,t).orThunk(e)})},bl=function(e,t){var n=me(e);return"input"===n?$a.after(e):I(["br","img"],n)?0===t?$a.before(e):$a.after(e):$a.on(e,t)},wl=function(e,t){var n=e.fold($a.before,bl,$a.after),r=t.fold($a.before,bl,$a.after);return Qa.relative(n,r)},yl=function(e,t,n,r){var o=bl(e,t),i=bl(n,r);return Qa.relative(o,i)},Cl=function(e,t,n,r){var o,i,u,c,a,l=(i=t,u=n,c=r,(a=Nt(o=e).dom().createRange()).setStart(o.dom(),i),a.setEnd(u.dom(),c),a),f=Dt(e,n)&&t===r;return l.collapsed&&!f},Sl=function(e,t){x.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},xl=function(e,t,n,r,o){var i=tl(e,t,n,r,o);Sl(e,i)},Rl=function(s,e){return il(s,e).match({ltr:function(e,t,n,r){xl(s,e,t,n,r)},rtl:function(e,t,n,r){var o,i,u,c,a,l=s.getSelection();if(l.setBaseAndExtent)l.setBaseAndExtent(e.dom(),t,n.dom(),r);else if(l.extend)try{i=e,u=t,c=n,a=r,(o=l).collapse(i.dom(),u),o.extend(c.dom(),a)}catch(f){xl(s,n,r,e,t)}else xl(s,n,r,e,t)}})},Tl=function(e){var o=Qa.getWin(e).dom(),t=function(e,t,n,r){return tl(o,e,t,n,r)},n=e.match({domRange:function(e){var t=Pe.fromDom(e.startContainer),n=Pe.fromDom(e.endContainer);return yl(t,e.startOffset,n,e.endOffset)},relative:wl,exact:yl});return il(o,n).match({ltr:t,rtl:t})},Ol=function(e){var t=Pe.fromDom(e.anchorNode),n=Pe.fromDom(e.focusNode);return Cl(t,e.anchorOffset,n,e.focusOffset)?x.some(Ka.create(t,e.anchorOffset,n,e.focusOffset)):function(e){if(0<e.rangeCount){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return x.some(Ka.create(Pe.fromDom(t.startContainer),t.startOffset,Pe.fromDom(n.endContainer),n.endOffset))}return x.none()}(e)},Dl=function(e,t){var n,r,o=(n=t,r=e.document.createRange(),Za(r,n),r);Sl(e,o)},Al=function(e){return(t=e,x.from(t.getSelection()).filter(function(e){return 0<e.rangeCount}).bind(Ol)).map(function(e){return Qa.exact(e.start(),e.soffset(),e.finish(),e.foffset())});var t},El=function(e,t){var n,r,o,i=ul(e,t);return r=(n=i).getClientRects(),0<(o=0<r.length?r[0]:n.getBoundingClientRect()).width||0<o.height?x.some(o).map(nl):x.none()},Nl=function(e,t,n){return r=e,o=t,i=n,u=Pe.fromDom(r.document),vl(u,o,i).map(function(e){return Ka.create(Pe.fromDom(e.startContainer),e.startOffset,Pe.fromDom(e.endContainer),e.endOffset)});var r,o,i,u},kl=tinymce.util.Tools.resolve("tinymce.util.VK"),Il=function(e,t,n,r){return Ml(e,t,Ga(n),r)},Pl=function(e,t,n,r){return Ml(e,t,Ya(n),r)},Bl=function(e,t){var n=Qa.exact(t,0,t,0);return Tl(n)},Ml=function(o,e,t,i,n){return t.fold(x.none,x.none,function(e,t){return _n(t).map(function(e){return Bl(0,e)})},function(r){return Sn.table(r,e).bind(function(e){var t,n=qr.noMenu(r);return o.undoManager.transact(function(){i.insertRowsAfter(e,n)}),t=an(e,"tr"),K(t).bind(function(e){return mn(e,"td,th").map(function(e){return Bl(0,e)})})})})},Wl=["table","li","dl"],_l={handle:function(t,n,r,o){if(t.keyCode===kl.TAB){var i=ec(n),u=function(e){var t=me(e);return Dt(e,i)||I(Wl,t)},e=n.selection.getRng();if(e.collapsed){var c=Pe.fromDom(e.startContainer);Sn.cell(c,u).each(function(e){t.preventDefault(),(t.shiftKey?Pl:Il)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}}},Ll={create:ne("selection","kill")},jl=function(e,t,n,r){return{start:S($a.on(e,t)),finish:S($a.on(n,r))}},zl={convertToRange:function(e,t){var n=ul(e,t);return Ka.create(Pe.fromDom(n.startContainer),n.startOffset,Pe.fromDom(n.endContainer),n.endOffset)},makeSitus:jl},Hl=function(n,e,r,t,o){return Dt(r,t)?x.none():Tr(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),x.some(Ll.create(x.some(zl.makeSitus(r,0,r,Bn(r))),!0))):x.none()})},Fl={sync:function(n,r,e,t,o,i,u){return Dt(e,o)&&t===i?x.none():gn(e,"td,th",r).bind(function(t){return gn(o,"td,th",r).bind(function(e){return Hl(n,r,t,e,u)})})},detect:Hl,update:function(e,t,n,r,o){return Dr(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()})}},Ul=ne("item","mode"),ql=function(e,t,n,r){return void 0===r&&(r=Vl),e.property().parent(t).map(function(e){return Ul(e,r)})},Vl=function(e,t,n,r){return void 0===r&&(r=Gl),n.sibling(e,t).map(function(e){return Ul(e,r)})},Gl=function(e,t,n,r){void 0===r&&(r=Gl);var o=e.property().children(t);return n.first(o).map(function(e){return Ul(e,r)})},Yl=[{current:ql,next:Vl,fallback:x.none()},{current:Vl,next:Gl,fallback:x.some(ql)},{current:Gl,next:Gl,fallback:x.some(Vl)}],Kl=function(t,n,r,o,e){return void 0===e&&(e=Yl),z(e,function(e){return e.current===r}).bind(function(e){return e.current(t,n,o,e.next).orThunk(function(){return e.fallback.bind(function(e){return Kl(t,n,e,o)})})})},Xl=function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?x.some(e[e.length-1]):x.none()}}},$l=function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?x.some(e[0]):x.none()}}},Jl=function(t,e,n,r,o,i){return Kl(t,e,r,o).bind(function(e){return i(e.item())?x.none():n(e.item())?x.some(e.item()):Jl(t,e.item(),n,e.mode(),o,i)})},Ql=function(e,t,n,r){return Jl(e,t,n,Vl,Xl(),r)},Zl=function(e,t,n,r){return Jl(e,t,n,Vl,$l(),r)},ef=function(t){return function(e){return 0===t.property().children(e).length}},tf=Ql,nf=Zl,rf=sr(),of=function(e,t){return r=t,tf(n=rf,e,ef(n),r);var n,r},uf=function(e,t){return r=t,nf(n=rf,e,ef(n),r);var n,r},cf=ne("element","offset"),af=(ne("element","deltaOffset"),ne("element","start","finish"),ne("begin","end"),ne("element","text"),Mr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}])),lf=function(e){return gn(e,"tr")},ff=Bo({},af,{verify:function(c,e,t,n,r,a,o){return gn(n,"td,th",o).bind(function(u){return gn(e,"td,th",o).map(function(i){return Dt(u,i)?Dt(n,u)&&Bn(u)===r?a(i):af.none("in same cell"):Cr.sharedOne(lf,[u,i]).fold(function(){return t=i,n=u,r=(e=c).getRect(t),(o=e.getRect(n)).right>r.left&&o.left<r.right?af.success():a(i);var e,t,n,r,o},function(e){return a(i)})})}).getOr(af.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)}}),sf=(ne("ancestor","descendants","element","index"),ne("parent","children","element","index")),df=function(e,t){return H(e,b(Dt,t))},mf=function(e){return"br"===me(e)},gf=function(e,t,n){return t(e,n).bind(function(e){return be(e)&&0===kn(e).trim().length?gf(e,t,n):x.some(e)})},pf=function(t,e,n,r){return(o=e,i=n,Wt(o,i).filter(mf).orThunk(function(){return Wt(o,i-1).filter(mf)})).bind(function(e){return r.traverse(e).fold(function(){return gf(e,r.gather,t).map(r.relative)},function(e){return(r=e,kt(r).bind(function(t){var n=Mt(t);return df(n,r).map(function(e){return sf(t,n,r,e)})})).map(function(e){return $a.on(e.parent(),e.index())});var r})});var o,i},hf=function(e,t,n,r){var o,i,u;return(mf(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return gf(i,u.gather,o)}).map(u.relative)):pf(e,t,n,r)).map(function(e){return{start:S(e),finish:S(e)}})},vf=function(e){return ff.cata(e,function(e){return x.none()},function(){return x.none()},function(e){return x.some(cf(e,0))},function(e){return x.some(cf(e,Bn(e)))})},bf=ae(["left","top","right","bottom"],[]),wf={nu:bf,moveUp:function(e,t){return bf({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return bf({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 bf({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return bf({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 bf({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()+")"}},yf=function(e){return wf.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},Cf=function(e,t){return x.some(e.getRect(t))},Sf=function(e,t,n){return ve(t)?Cf(e,t).map(yf):be(t)?(r=e,o=t,i=n,0<=i&&i<Bn(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):x.none()).map(yf):x.none();var r,o,i},xf=function(e,t){return ve(t)?Cf(e,t).map(yf):be(t)?e.getRangedRect(t,0,t,Bn(t)).map(yf):x.none()},Rf=Mr([{none:[]},{retry:["caret"]}]),Tf=function(t,e,r){return(n=e,o=zu,ln(function(e){return o(e)},fn,n,o,i)).fold(S(!1),function(e){return xf(t,e).exists(function(e){return n=e,(t=r).left()<n.left()||Math.abs(n.right()-t.left())<1||t.left()>n.right();var t,n})});var n,o,i},Of={point:wf.getTop,adjuster:function(e,t,n,r,o){var i=wf.moveUp(o,5);return Math.abs(n.top()-r.top())<1?Rf.retry(i):n.bottom()<o.top()?Rf.retry(i):n.bottom()===o.top()?Rf.retry(wf.moveUp(o,1)):Tf(e,t,o)?Rf.retry(wf.translate(i,5,0)):Rf.none()},move:wf.moveUp,gather:of},Df={point:wf.getBottom,adjuster:function(e,t,n,r,o){var i=wf.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?Rf.retry(i):n.top()>o.bottom()?Rf.retry(i):n.top()===o.bottom()?Rf.retry(wf.moveDown(o,1)):Tf(e,t,o)?Rf.retry(wf.translate(i,5,0)):Rf.none()},move:wf.moveDown,gather:uf},Af=function(n,r,o,i,u){return 0===u?x.some(i):(a=n,l=i.left(),f=r.point(i),a.elementFromPoint(l,f).filter(function(e){return"table"===me(e)}).isSome()?(t=i,c=u-1,Af(n,e=r,o,e.move(t,5),c)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(x.none,function(t){return xf(n,t).bind(function(e){return r.adjuster(n,t,e,o,i).fold(x.none,function(e){return Af(n,r,o,e,u-1)})}).orThunk(function(){return x.some(i)})},x.none)}));var e,t,c,a,l,f},Ef=function(t,n,e){var r,o,i,u=t.move(e,5),c=Af(n,t,e,u,100).getOr(u);return(r=t,o=c,i=n,r.point(o)>i.getInnerHeight()?x.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?x.some(-r.point(o)):x.none()).fold(function(){return n.situsFromPoint(c.left(),t.point(c))},function(e){return n.scrollBy(0,e),n.situsFromPoint(c.left(),t.point(c)-e)})},Nf={tryUp:b(Ef,Of),tryDown:b(Ef,Df),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:S(5)},kf=St.detect(),If=function(r,o,i,u,c,a){return 0===a?x.none():Mf(r,o,i,u,c).bind(function(e){var t=r.fromSitus(e),n=ff.verify(r,i,u,t.finish(),t.foffset(),c.failure,o);return ff.cata(n,function(){return x.none()},function(){return x.some(e)},function(e){return Dt(i,e)&&0===u?Pf(r,i,u,wf.moveUp,c):If(r,o,e,0,c,a-1)},function(e){return Dt(i,e)&&u===Bn(e)?Pf(r,i,u,wf.moveDown,c):If(r,o,e,Bn(e),c,a-1)})})},Pf=function(t,e,n,r,o){return Sf(t,e,n).bind(function(e){return Bf(t,o,r(e,Nf.getJumpSize()))})},Bf=function(e,t,n){return kf.browser.isChrome()||kf.browser.isSafari()||kf.browser.isFirefox()||kf.browser.isEdge()?t.otherRetry(e,n):kf.browser.isIE()?t.ieRetry(e,n):x.none()},Mf=function(t,e,n,r,o){return Sf(t,n,r).bind(function(e){return Bf(t,o,e)})},Wf=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return hf(i,r.finish(),r.foffset(),u).fold(function(){return x.some(cf(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=ff.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return vf(n)})})).bind(function(e){return If(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},_f=St.detect(),Lf=function(e,t){return fn(e,function(e){return kt(e).exists(function(e){return Dt(e,t)})},n).isSome();var n},jf=function(t,r,o,e,i){return gn(e,"td,th",r).bind(function(n){return gn(n,"table",r).bind(function(e){return Lf(i,e)?Wf(t,r,o).bind(function(t){return gn(t.finish(),"td,th",r).map(function(e){return{start:S(n),finish:S(e),range:S(t)}})}):x.none()})})},zf=function(e,t,n,r,o,i){return _f.browser.isIE()?x.none():i(r,t).orThunk(function(){return jf(e,t,n,r,o).map(function(e){var t=e.range();return Ll.create(x.some(zl.makeSitus(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},Hf=function(e,t,n,r,o,i,u){return jf(e,n,r,o,i).bind(function(e){return Fl.detect(t,n,e.start(),e.finish(),u)})},Ff=function(e,u){return gn(e,"tr",u).bind(function(i){return gn(i,"table",u).bind(function(e){var t,n,r,o=an(e,"tr");return Dt(i,o[0])?(t=e,n=function(e){return Ln(e).isSome()},r=u,tf(rf,t,n,r)).map(function(e){var t=Bn(e);return Ll.create(x.some(zl.makeSitus(e,t,e,t)),!0)}):x.none()})})},Uf=function(e,u){return gn(e,"tr",u).bind(function(i){return gn(i,"table",u).bind(function(e){var t,n,r,o=an(e,"tr");return Dt(i,o[o.length-1])?(t=e,n=function(e){return _n(e).isSome()},r=u,nf(rf,t,n,r)).map(function(e){return Ll.create(x.some(zl.makeSitus(e,0,e,0)),!0)}):x.none()})})},qf=function(e,t){return gn(e,"td,th",t)};var Vf={down:{traverse:Bt,gather:uf,relative:$a.before,otherRetry:Nf.tryDown,ieRetry:Nf.ieTryDown,failure:ff.failedDown},up:{traverse:Pt,gather:of,relative:$a.before,otherRetry:Nf.tryUp,ieRetry:Nf.ieTryUp,failure:ff.failedUp}},Gf=function(t){return function(e){return e===t}},Yf=Gf(38),Kf=Gf(40),Xf={ltr:{isBackward:Gf(37),isForward:Gf(39)},rtl:{isBackward:Gf(39),isForward:Gf(37)},isUp:Yf,isDown:Kf,isNavigation:function(e){return 37<=e&&e<=40}},$f=(St.detect().browser.isSafari(),function(c){return{elementFromPoint:function(e,t){return Pe.fromPoint(Pe.fromDom(c.document),e,t)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=Qa.exact(e,t,n,r);return El(c,o).map(function(e){return Q(e,a)})},getSelection:function(){return Al(c).map(function(e){return zl.convertToRange(c,e)})},fromSitus:function(e){var t=Qa.relative(e.start(),e.finish());return zl.convertToRange(c,t)},situsFromPoint:function(e,t){return Nl(c,e,t).map(function(e){return jl(e.start(),e.soffset(),e.finish(),e.foffset())})},clearSelection:function(){c.getSelection().removeAllRanges()},setSelection:function(e){var t,n,r,o,i,u;t=c,n=e.start(),r=e.soffset(),o=e.finish(),i=e.foffset(),u=yl(n,r,o,i),Rl(t,u)},setRelativeSelection:function(e,t){var n,r;n=c,r=wl(e,t),Rl(n,r)},selectContents:function(e){Dl(c,e)},getInnerHeight:function(){return c.innerHeight},getScrollY:function(){var e,t,n,r;return(e=Pe.fromDom(c.document),t=e!==undefined?e.dom():m.document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop,po(n,r)).top()},scrollBy:function(e,t){var n,r,o;n=e,r=t,((o=Pe.fromDom(c.document))!==undefined?o.dom():m.document).defaultView.scrollBy(n,r)}}}),Jf=ne("rows","cols"),Qf={mouse:function(e,t,n,r){var o=function c(o,i,t,u){var n=x.none(),r=function(){n=x.none()};return{mousedown:function(e){u.clear(i),n=qf(e.target(),t)},mouseover:function(e){n.each(function(r){u.clear(i),qf(e.target(),t).each(function(n){Tr(r,n,t).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!Dt(r,n))&&(u.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(e){n.each(r)}}}($f(e),t,n,r);return{mousedown:o.mousedown,mouseover:o.mouseover,mouseup:o.mouseup}},keyboard:function(e,l,f,s){var d=$f(e),m=function(){return s.clear(l),x.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw(),c=u.which,a=!0===u.shiftKey;return Or(l,s.selectedSelector()).fold(function(){return Xf.isDown(c)&&a?b(Hf,d,l,f,Vf.down,r,t,s.selectRange):Xf.isUp(c)&&a?b(Hf,d,l,f,Vf.up,r,t,s.selectRange):Xf.isDown(c)?b(zf,d,f,Vf.down,r,t,Uf):Xf.isUp(c)?b(zf,d,f,Vf.up,r,t,Ff):x.none},function(t){var e=function(e){return function(){return Wo(e,function(e){return Fl.update(e.rows(),e.cols(),l,t,s)}).fold(function(){return Ar(l,s.firstSelectedSelector(),s.lastSelectedSelector()).map(function(e){var t=Xf.isDown(c)||i.isForward(c)?$a.after:$a.before;return d.setRelativeSelection($a.on(e.first(),0),t(e.table())),s.clear(l),Ll.create(x.none(),!0)})},function(e){return x.some(Ll.create(x.none(),!0))})}};return Xf.isDown(c)&&a?e([Jf(1,0)]):Xf.isUp(c)&&a?e([Jf(-1,0)]):i.isBackward(c)&&a?e([Jf(0,-1),Jf(-1,0)]):i.isForward(c)&&a?e([Jf(0,1),Jf(1,0)]):Xf.isNavigation(c)&&!1===a?m:x.none})()},keyup:function(n,r,o,i,u){return Or(l,s.selectedSelector()).fold(function(){var e=n.raw(),t=e.which;return 0==(!0===e.shiftKey)?x.none():Xf.isNavigation(t)?Fl.sync(l,f,r,o,i,u,s.selectRange):x.none()},x.none)}}}},Zf=function(n){return function(e){var t;t=e,M(n,function(e){Go(t,e)})}},es={byClass:function(o){var t,i=(t=o.selected(),function(e){Vo(e,t)}),n=Zf([o.selected(),o.lastSelected(),o.firstSelected()]),u=function(e){var t=an(e,o.selectedSelector());M(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),M(t,i),Vo(n,o.firstSelected()),Vo(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){Te(e,o.selected()),Te(e,o.firstSelected()),Te(e,o.lastSelected())},i=function(e){Ce(e,o.selected(),"1")},u=function(e){var t=an(e,o.selectedSelector());M(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),M(t,i),Ce(n,o.firstSelected(),"1"),Ce(r,o.lastSelected(),"1")},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}}},ts=function(e){return!1===Yo(Pe.fromDom(e.target),"ephox-snooker-resizer-bar")};function ns(p,h){var v=ae(["mousedown","mouseover","mouseup","keyup","keydown"],[]),b=x.none(),w=es.byAttr(Br);p.on("init",function(e){var r=p.getWin(),o=ec(p),t=rc(p),n=Qf.mouse(r,o,t,w),c=Qf.keyboard(r,o,t,w),a=function(e,t){!0===e.raw().shiftKey&&(t.kill()&&e.kill(),t.selection().each(function(e){var t=Qa.relative(e.start(),e.finish()),n=ul(r,t);p.selection.setRng(n)}))},i=function(e){var t=f(e);if(t.raw().shiftKey&&Xf.isNavigation(t.raw().which)){var n=p.selection.getRng(),r=Pe.fromDom(n.startContainer),o=Pe.fromDom(n.endContainer);c.keyup(t,r,n.startOffset,o,n.endOffset).each(function(e){a(t,e)})}},u=function(e){var t=f(e);h().each(function(e){e.hideBars()});var n=p.selection.getRng(),r=Pe.fromDom(p.selection.getStart()),o=Pe.fromDom(n.startContainer),i=Pe.fromDom(n.endContainer),u=ac.directionAt(r).isRtl()?Xf.rtl:Xf.ltr;c.keydown(t,o,n.startOffset,i,n.endOffset,u).each(function(e){a(t,e)}),h().each(function(e){e.showBars()})},l=function(e){return e.hasOwnProperty("x")&&e.hasOwnProperty("y")},f=function(e){var t=Pe.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=C(r,n);return{target:S(t),x:S(l(e)?e.x:null),y:S(l(e)?e.y:null),stop:n,prevent:r,kill:o,raw:S(e)}},s=function(e){return 0===e.button},d=function(e){s(e)&&ts(e)&&n.mousedown(f(e))},m=function(e){var t;(t=e).buttons!==undefined&&0==(1&t.buttons)||!ts(e)||n.mouseover(f(e))},g=function(e){s(e)&&ts(e)&&n.mouseup(f(e))};p.on("mousedown",d),p.on("mouseover",m),p.on("mouseup",g),p.on("keyup",i),p.on("keydown",u),p.on("NodeChange",function(){var e=p.selection,t=Pe.fromDom(e.getStart()),n=Pe.fromDom(e.getEnd());Cr.sharedOne(Sn.table,[t,n]).fold(function(){w.clear(o)},y)}),b=x.some(v({mousedown:d,mouseover:m,mouseup:g,keyup:i,keydown:u}))});return{clear:w.clear,destroy:function(){b.each(function(e){})}}}var rs=function(t){return{get:function(){var e=ec(t);return Er(e,Br.selectedSelector()).fold(function(){return t.selection.getStart()===undefined?_r.none():_r.single(t.selection)},function(e){return _r.multiple(e)})}}},os=function(e,n){var o=l(x.none()),i=l([]),t=function(){return pa(e).bind(function(t){return Sn.table(t).map(function(e){return"caption"===me(t)?qr.notCell(t):qr.forMenu(n,e,t)})})},r=function(){o.set(ke(t)()),M(i.get(),function(e){return e()})},u=function(t,n){var r=function(){return o.get().fold(function(){t.setDisabled(!0)},function(e){t.setDisabled(n(e))})};return r(),i.set(i.get().concat([r])),function(){i.set(_(i.get(),function(e){return e!==r}))}};return e.on("NodeChange",r),{onSetupTable:function(e){return u(e,function(e){return!1})},onSetupCellOrRow:function(e){return u(e,function(e){return"caption"===me(e.element())})},onSetupMergeable:function(e){return u(e,function(e){return e.mergable().isNone()})},onSetupUnmergeable:function(e){return u(e,function(e){return e.unmergable().isNone()})},resetTargets:r,targets:function(){return o.get()}}},is={addButtons:function(t,e){t.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",fetch:function(e){return e("inserttable tableprops deletetable | cell row column")}});var n=function(e){return function(){return t.execCommand(e)}};t.ui.registry.addButton("tableprops",{tooltip:"Table properties",onAction:n("mceTableProps"),icon:"table",onSetup:e.onSetupTable}),t.ui.registry.addButton("tabledelete",{tooltip:"Delete table",onAction:n("mceTableDelete"),icon:"table-delete-table",onSetup:e.onSetupTable}),t.ui.registry.addButton("tablecellprops",{tooltip:"Cell properties",onAction:n("mceTableCellProps"),icon:"table-cell-properties",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tablemergecells",{tooltip:"Merge cells",onAction:n("mceTableMergeCells"),icon:"table-merge-cells",onSetup:e.onSetupMergeable}),t.ui.registry.addButton("tablesplitcells",{tooltip:"Split cell",onAction:n("mceTableSplitCells"),icon:"table-split-cells",onSetup:e.onSetupUnmergeable}),t.ui.registry.addButton("tableinsertrowbefore",{tooltip:"Insert row before",onAction:n("mceTableInsertRowBefore"),icon:"table-insert-row-above",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tableinsertrowafter",{tooltip:"Insert row after",onAction:n("mceTableInsertRowAfter"),icon:"table-insert-row-after",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tabledeleterow",{tooltip:"Delete row",onAction:n("mceTableDeleteRow"),icon:"table-delete-row",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tablerowprops",{tooltip:"Row properties",onAction:n("mceTableRowProps"),icon:"table-row-properties",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tableinsertcolbefore",{tooltip:"Insert column before",onAction:n("mceTableInsertColBefore"),icon:"table-insert-column-before",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tableinsertcolafter",{tooltip:"Insert column after",onAction:n("mceTableInsertColAfter"),icon:"table-insert-column-after",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tabledeletecol",{tooltip:"Delete column",onAction:n("mceTableDeleteCol"),icon:"table-delete-column",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tablecutrow",{tooltip:"Cut row",onAction:n("mceTableCutRow"),icon:"temporary-placeholder",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tablecopyrow",{tooltip:"Copy row",onAction:n("mceTableCopyRow"),icon:"temporary-placeholder",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tablepasterowbefore",{tooltip:"Paste row before",onAction:n("mceTablePasteRowBefore"),icon:"temporary-placeholder",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tablepasterowafter",{tooltip:"Paste row after",onAction:n("mceTablePasteRowAfter"),icon:"temporary-placeholder",onSetup:e.onSetupCellOrRow}),t.ui.registry.addButton("tableinsertdialog",{tooltip:"Insert table",onAction:n("mceInsertTable"),icon:"table"})},addToolbars:function(t){var e=t.getParam("table_toolbar","tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol");0<e.length&&t.ui.registry.addContextToolbar("table",{predicate:function(e){return t.dom.is(e,"table")&&t.getBody().contains(e)},items:e,scope:"node",position:"node"})}},us={addMenuItems:function(r,e){var t=function(e){return function(){return r.execCommand(e)}},n=function(e){var t=e.numRows,n=e.numColumns;r.undoManager.transact(function(){aa(r,n,t)}),r.addVisual()},o={text:"Table properties",onSetup:e.onSetupTable,onAction:t("mceTableProps")},i={text:"Delete table",icon:"table-delete-table",onSetup:e.onSetupTable,onAction:t("mceTableDelete")},u={type:"nestedmenuitem",text:"Row",getSubmenuItems:function(){return[{type:"menuitem",text:"Insert row before",icon:"table-insert-row-above",onAction:t("mceTableInsertRowBefore"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Insert row after",icon:"table-insert-row-after",onAction:t("mceTableInsertRowAfter"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Delete row",icon:"table-delete-row",onAction:t("mceTableDeleteRow"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Row properties",icon:"table-row-properties",onAction:t("mceTableRowProps"),onSetup:e.onSetupCellOrRow},{type:"separator"},{type:"menuitem",text:"Cut row",onAction:t("mceTableCutRow"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Copy row",onAction:t("mceTableCopyRow"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Paste row before",onAction:t("mceTablePasteRowBefore"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Paste row after",onAction:t("mceTablePasteRowAfter"),onSetup:e.onSetupCellOrRow}]}},c={type:"nestedmenuitem",text:"Column",getSubmenuItems:function(){return[{type:"menuitem",text:"Insert column before",icon:"table-insert-column-before",onAction:t("mceTableInsertColBefore"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Insert column after",icon:"table-insert-column-after",onAction:t("mceTableInsertColAfter"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Delete column",icon:"table-delete-column",onAction:t("mceTableDeleteCol"),onSetup:e.onSetupCellOrRow}]}},a={type:"nestedmenuitem",text:"Cell",getSubmenuItems:function(){return[{type:"menuitem",text:"Cell properties",icon:"table-cell-properties",onAction:t("mceTableCellProps"),onSetup:e.onSetupCellOrRow},{type:"menuitem",text:"Merge cells",icon:"table-merge-cells",onAction:t("mceTableMergeCells"),onSetup:e.onSetupMergeable},{type:"menuitem",text:"Split cell",icon:"table-split-cells",onAction:t("mceTableSplitCells"),onSetup:e.onSetupUnmergeable}]}};!1===r.getParam("table_grid",!0,"boolean")?r.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:t("mceInsertTable")}):r.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"inserttable",onAction:n}]}}),r.ui.registry.addMenuItem("inserttabledialog",{text:"Insert table",icon:"table",onAction:t("mceInsertTable")}),r.ui.registry.addMenuItem("tableprops",o),r.ui.registry.addMenuItem("deletetable",i),r.ui.registry.addNestedMenuItem("row",u),r.ui.registry.addNestedMenuItem("column",c),r.ui.registry.addNestedMenuItem("cell",a),r.ui.registry.addContextMenu("table",{update:function(){return e.resetTargets(),e.targets().fold(function(){return""},function(e){return"caption"===me(e.element())?"tableprops deletetable":"cell row column | tableprops deletetable"})}})}},cs=function(n,r){return{insertTable:function(e,t){return aa(n,e,t)},setClipboardRows:function(e){return t=r,n=B(e,Pe.fromDom),void t.set(x.from(n));var t,n},getClipboardRows:function(){return r.get().fold(function(){},function(e){return B(e,function(e){return e.dom()})})}}};function as(t){var n=Fa(t),e=ns(t,n.lazyResize),r=Rc(t,n.lazyWire),o=rs(t),i=os(t,o),u=l(x.none());return va.registerCommands(t,r,e,o,u),Vr.registerEvents(t,o,r,e),us.addMenuItems(t,i),is.addButtons(t,i),is.addToolbars(t),t.on("PreInit",function(){t.serializer.addTempAttr(Br.firstSelected()),t.serializer.addTempAttr(Br.lastSelected())}),mc(t)&&t.on("keydown",function(e){_l.handle(e,t,r,n.lazyWire)}),t.on("remove",function(){n.destroy(),e.destroy()}),cs(t,u)}!function fs(){w.add("table",as)}()}(window);

Youez - 2016 - github.com/yon3zu
LinuXploit