tinymce-rails 4.9.11.1 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -6
- data/app/assets/source/tinymce/tinymce.js +14735 -15357
- data/lib/tinymce/rails/asset_installer/compile.rb +2 -2
- data/lib/tinymce/rails/asset_installer.rb +1 -1
- data/lib/tinymce/rails/asset_manifest.rb +4 -9
- data/lib/tinymce/rails/configuration.rb +2 -2
- data/lib/tinymce/rails/configuration_file.rb +3 -4
- data/lib/tinymce/rails/engine.rb +1 -5
- data/lib/tinymce/rails/helper.rb +1 -1
- data/lib/tinymce/rails/version.rb +2 -2
- data/vendor/assets/javascripts/tinymce/jquery.tinymce.js +92 -1
- data/vendor/assets/javascripts/tinymce/plugins/advlist/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/anchor/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/autolink/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/autoresize/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/autosave/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/bbcode/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/charmap/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/code/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/codesample/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/colorpicker/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/contextmenu/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/directionality/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/js/emojis.js +2 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullpage/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/fullscreen/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/help/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/hr/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/image/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/imagetools/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/importcss/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/insertdatetime/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/legacyoutput/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/link/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/lists/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/media/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/nonbreaking/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/noneditable/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/pagebreak/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/paste/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/preview/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/print/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/quickbars/plugin.js +9 -0
- data/vendor/assets/javascripts/tinymce/plugins/save/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/searchreplace/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/spellchecker/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/tabfocus/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/table/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/template/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/textcolor/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/textpattern/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/toc/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/visualchars/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/plugins/wordcount/plugin.js +9 -1
- data/vendor/assets/javascripts/tinymce/skins/content/default/content.css +44 -0
- data/vendor/assets/javascripts/tinymce/skins/content/default/content.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/content/document/content.css +48 -0
- data/vendor/assets/javascripts/tinymce/skins/content/document/content.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/content/writer/content.css +45 -0
- data/vendor/assets/javascripts/tinymce/skins/content/writer/content.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.inline.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/content.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide/skin.mobile.min.css +2 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.inline.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/content.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/skins/ui/oxide-dark/skin.min.css +8 -0
- data/vendor/assets/javascripts/tinymce/themes/mobile/theme.js +9 -1
- data/vendor/assets/javascripts/tinymce/themes/silver/theme.js +9 -0
- data/vendor/assets/javascripts/tinymce/tinymce.js +9 -2
- metadata +24 -46
- data/vendor/assets/config/tinymce-rails.manifest.js +0 -8
- data/vendor/assets/javascripts/tinymce/plugins/codesample/css/prism.css +0 -138
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/help/img/logo.png +0 -0
- data/vendor/assets/javascripts/tinymce/plugins/visualblocks/css/visualblocks.css +0 -154
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.inline.min.css +0 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/content.min.css +0 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce-small.svg +0 -63
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce.svg +0 -132
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/object.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.min.css +0 -1
- data/vendor/assets/javascripts/tinymce/skins/lightgray/skin.mobile.min.css +0 -2
- data/vendor/assets/javascripts/tinymce/themes/inlite/theme.js +0 -1
- data/vendor/assets/javascripts/tinymce/themes/modern/theme.js +0 -1
- /data/vendor/assets/javascripts/tinymce/skins/{lightgray → ui/oxide}/content.mobile.min.css +0 -0
- /data/vendor/assets/javascripts/tinymce/skins/{lightgray → ui/oxide}/fonts/tinymce-mobile.woff +0 -0
@@ -1 +1,9 @@
|
|
1
|
-
!function(m){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=function(){},x=function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,e))}},C=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 t,n,r,i,g=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,e)}},f=C(!1),u=C(!0),a=function(){return c},c=(t=function(e){return e.isNone()},i={fold:function(e,t){return e()},is:f,isSome:f,isNone:u,getOr:r=function(e){return e},getOrThunk:n=function(e){return e()},getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:C(null),getOrUndefined:C(undefined),or:r,orThunk:n,map:a,each:y,bind:a,exists:f,forall:u,filter:a,equals:t,equals_:t,toArray:function(){return[]},toString:C("none()")},Object.freeze&&Object.freeze(i),i),l=function(n){var e=C(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:u,isNone:f,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return l(e(n))},each:function(e){e(n)},bind:r,exists:r,forall:r,filter:function(e){return e(n)?o:c},toArray:function(){return[n]},toString:function(){return"some("+n+")"},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(f,function(e){return t(n,e)})}};return o},R={some:l,none:a,from:function(e){return null===e||e===undefined?c:l(e)}},s=function(t){return function(e){return function(e){if(null===e)return"null";var t=typeof e;return"object"===t&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===t&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":t}(e)===t}},d=s("string"),h=s("array"),p=s("boolean"),v=s("function"),w=s("number"),S=Array.prototype.slice,T=Array.prototype.indexOf,D=Array.prototype.push,O=function(e,t){return n=e,r=t,-1<T.call(n,r);var n,r},N=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n))return!0;return!1},E=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)}return r},k=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)},A=function(e,t){for(var n=[],r=0,o=e.length;r<o;r++){var i=e[r];t(i,r)&&n.push(i)}return n},P=function(e,t,n){return function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n)}(e,function(e){n=t(n,e)}),n},I=function(e,t,n){return k(e,function(e){n=t(n,e)}),n},B=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n))return R.some(o)}return R.none()},W=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n))return R.some(n);return R.none()},M=function(e){for(var t=[],n=0,r=e.length;n<r;++n){if(!h(e[n]))throw new Error("Arr.flatten item "+n+" was not an array, input: "+e);D.apply(t,e[n])}return t},_=function(e,t){var n=E(e,t);return M(n)},L=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n))return!1;return!0},F=function(e){var t=S.call(e,0);return t.reverse(),t},j=(v(Array.from)&&Array.from,Object.keys),z=function(e,t){for(var n=j(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i)}},H=function(e,n){return U(e,function(e,t){return{k:t,v:n(e,t)}})},U=function(e,r){var o={};return z(e,function(e,t){var n=r(e,t);o[n.k]=n.v}),o},q=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 k(t,function(e,t){r[e]=C(n[t])}),r}},V=function(e){return e.slice(0).sort()},G=function(e,t){throw new Error("All required keys ("+V(e).join(", ")+") were not specified. Specified keys were: "+V(t).join(", ")+".")},Y=function(e){throw new Error("Unsupported keys for object: "+V(e).join(", "))},X=function(t,e){if(!h(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");k(e,function(e){if(!d(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},K=function(e){var n=V(e);B(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(", ")+"].")})},J=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 X("required",o),X("optional",i),K(u),function(t){var n=j(t);L(o,function(e){return O(n,e)})||G(o,n);var e=A(n,function(e){return!O(u,e)});0<e.length&&Y(e);var r={};return k(o,function(e){r[e]=C(t[e])}),k(i,function(e){r[e]=C(Object.prototype.hasOwnProperty.call(t,e)?R.some(t[e]):R.none())}),r}},$=(m.Node.ATTRIBUTE_NODE,m.Node.CDATA_SECTION_NODE,m.Node.COMMENT_NODE),Q=m.Node.DOCUMENT_NODE,Z=(m.Node.DOCUMENT_TYPE_NODE,m.Node.DOCUMENT_FRAGMENT_NODE,m.Node.ELEMENT_NODE),ee=m.Node.TEXT_NODE,te=(m.Node.PROCESSING_INSTRUCTION_NODE,m.Node.ENTITY_REFERENCE_NODE,m.Node.ENTITY_NODE,m.Node.NOTATION_NODE,"undefined"!=typeof m.window?m.window:Function("return this;")()),ne=function(e,t){return function(e,t){for(var n=t!==undefined&&null!==t?t:te,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n}(e.split("."),t)},re=function(e,t){var n=ne(e,t);if(n===undefined||null===n)throw new Error(e+" not available on this browser");return n},oe=function(e){return e.dom().nodeName.toLowerCase()},ie=function(e){return e.dom().nodeType},ue=function(t){return function(e){return ie(e)===t}},ae=function(e){return ie(e)===$||"#comment"===oe(e)},ce=ue(Z),le=ue(ee),fe=function(e,t,n){if(!(d(n)||p(n)||w(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+"")},se=function(e,t,n){fe(e.dom(),t,n)},de=function(e,t){var n=e.dom();z(t,function(e,t){fe(n,t,e)})},me=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},ge=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},he=function(e,t){e.dom().removeAttribute(t)},pe=function(e){return I(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},ve=function(e,t){return-1!==e.indexOf(t)},be=function(e){return e.style!==undefined&&v(e.style.getPropertyValue)},we=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}},ye=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:C(e)}},xe={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 ye(n.childNodes[0])},fromTag:function(e,t){var n=(t||m.document).createElement(e);return ye(n)},fromText:function(e,t){var n=(t||m.document).createTextNode(e);return ye(n)},fromDom:ye,fromPoint:function(e,t,n){var r=e.dom();return R.from(r.elementFromPoint(t,n)).map(ye)}},Ce=function(e){var t=le(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)},Re=we(function(){return Se(xe.fromDom(m.document))}),Se=function(e){var t=e.dom().body;if(null===t||t===undefined)throw new Error("Body is not available yet");return xe.fromDom(t)},Te=function(e,t,n){if(!d(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);be(e)&&e.style.setProperty(t,n)},De=function(e,t,n){var r=e.dom();Te(r,t,n)},Oe=function(e,t){var n=e.dom();z(t,function(e,t){Te(n,t,e)})},Ne=function(e,t){var n=e.dom(),r=m.window.getComputedStyle(n).getPropertyValue(t),o=""!==r||Ce(e)?r:Ee(n,t);return null===o?undefined:o},Ee=function(e,t){return be(e)?e.style.getPropertyValue(t):""},ke=function(e,t){var n=e.dom(),r=Ee(n,t);return R.from(r).filter(function(e){return 0<e.length})},Ae=function(e,t){var n,r,o=e.dom();r=t,be(n=o)&&n.style.removeProperty(r),ge(e,"style")&&""===me(e,"style").replace(/^\s+|\s+$/g,"")&&he(e,"style")},Pe=function(){return re("Node")},Ie=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},Be=function(e,t){return Ie(e,t,Pe().DOCUMENT_POSITION_CONTAINED_BY)},We=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 _e(r(1),r(2))},Me=function(){return _e(0,0)},_e=function(e,t){return{major:e,minor:t}},Le={nu:_e,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?Me():We(e,n)},unknown:Me},Fe="Firefox",je=function(e,t){return function(){return t===e}},ze=function(e){var t=e.current;return{current:t,version:e.version,isEdge:je("Edge",t),isChrome:je("Chrome",t),isIE:je("IE",t),isOpera:je("Opera",t),isFirefox:je(Fe,t),isSafari:je("Safari",t)}},He={unknown:function(){return ze({current:undefined,version:Le.unknown()})},nu:ze,edge:C("Edge"),chrome:C("Chrome"),ie:C("IE"),opera:C("Opera"),firefox:C(Fe),safari:C("Safari")},Ue="Windows",qe="Android",Ve="Solaris",Ge="FreeBSD",Ye=function(e,t){return function(){return t===e}},Xe=function(e){var t=e.current;return{current:t,version:e.version,isWindows:Ye(Ue,t),isiOS:Ye("iOS",t),isAndroid:Ye(qe,t),isOSX:Ye("OSX",t),isLinux:Ye("Linux",t),isSolaris:Ye(Ve,t),isFreeBSD:Ye(Ge,t)}},Ke={unknown:function(){return Xe({current:undefined,version:Le.unknown()})},nu:Xe,windows:C(Ue),ios:C("iOS"),android:C(qe),linux:C("Linux"),osx:C("OSX"),solaris:C(Ve),freebsd:C(Ge)},Je=function(e,t){var n=String(t).toLowerCase();return B(e,function(e){return e.search(n)})},$e=function(e,n){return Je(e,n).map(function(e){var t=Le.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Qe=function(e,n){return Je(e,n).map(function(e){var t=Le.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ze=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,et=function(t){return function(e){return ve(e,t)}},tt=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return ve(e,"edge/")&&ve(e,"chrome")&&ve(e,"safari")&&ve(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Ze],search:function(e){return ve(e,"chrome")&&!ve(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return ve(e,"msie")||ve(e,"trident")}},{name:"Opera",versionRegexes:[Ze,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:et("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:et("firefox")},{name:"Safari",versionRegexes:[Ze,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(ve(e,"safari")||ve(e,"mobile/"))&&ve(e,"applewebkit")}}],nt=[{name:"Windows",search:et("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return ve(e,"iphone")||ve(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:et("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:et("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:et("linux"),versionRegexes:[]},{name:"Solaris",search:et("sunos"),versionRegexes:[]},{name:"FreeBSD",search:et("freebsd"),versionRegexes:[]}],rt={browsers:C(tt),oses:C(nt)},ot=function(e){var t,n,r,o,i,u,a,c,l,f,s,d=rt.browsers(),m=rt.oses(),g=$e(d,e).fold(He.unknown,He.nu),h=Qe(m,e).fold(Ke.unknown,Ke.nu);return{browser:g,os:h,deviceType:(n=g,r=e,o=(t=h).isiOS()&&!0===/ipad/i.test(r),i=t.isiOS()&&!o,u=t.isAndroid()&&3===t.version.major,a=t.isAndroid()&&4===t.version.major,c=o||u||a&&!0===/mobile/i.test(r),l=t.isiOS()||t.isAndroid(),f=l&&!c,s=n.isSafari()&&t.isiOS()&&!1===/safari/i.test(r),{isiPad:C(o),isiPhone:C(i),isTablet:C(c),isPhone:C(f),isTouch:C(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:C(s)})}},it={detect:we(function(){var e=m.navigator.userAgent;return ot(e)})},ut=Z,at=Q,ct=function(e,t){var n=e.dom();if(n.nodeType!==ut)return!1;var r=n;if(r.matches!==undefined)return r.matches(t);if(r.msMatchesSelector!==undefined)return r.msMatchesSelector(t);if(r.webkitMatchesSelector!==undefined)return r.webkitMatchesSelector(t);if(r.mozMatchesSelector!==undefined)return r.mozMatchesSelector(t);throw new Error("Browser lacks native selectors")},lt=function(e){return e.nodeType!==ut&&e.nodeType!==at||0===e.childElementCount},ft=function(e,t){return e.dom()===t.dom()},st=it.detect().browser.isIE()?function(e,t){return Be(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},dt=ct,mt=function(e){return xe.fromDom(e.dom().ownerDocument)},gt=function(e){return R.from(e.dom().parentNode).map(xe.fromDom)},ht=function(e,t){for(var n=v(t)?t:f,r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=xe.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},pt=function(e){return R.from(e.dom().previousSibling).map(xe.fromDom)},vt=function(e){return R.from(e.dom().nextSibling).map(xe.fromDom)},bt=function(e){return E(e.dom().childNodes,xe.fromDom)},wt=function(e,t){var n=e.dom().childNodes;return R.from(n[t]).map(xe.fromDom)},yt=(q("element","offset"),function(t,n){gt(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})}),xt=function(e,t){vt(e).fold(function(){gt(e).each(function(e){Rt(e,t)})},function(e){yt(e,t)})},Ct=function(t,n){wt(t,0).fold(function(){Rt(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},Rt=function(e,t){e.dom().appendChild(t.dom())},St=function(e,t){yt(e,t),Rt(t,e)},Tt=function(r,o){k(o,function(e,t){var n=0===t?r:o[t-1];xt(n,e)})},Dt=function(t,e){k(e,function(e){Rt(t,e)})},Ot=function(e){e.dom().textContent="",k(bt(e),function(e){Nt(e)})},Nt=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},Et=function(e){var t,n=bt(e);0<n.length&&(t=e,k(n,function(e){yt(t,e)})),Nt(e)},kt=(q("width","height"),q("width","height"),q("rows","columns")),At=q("row","column"),Pt=(q("x","y"),q("element","rowspan","colspan")),It=q("element","rowspan","colspan","isNew"),Bt=q("element","rowspan","colspan","row","column"),Wt=q("element","cells","section"),Mt=q("element","isNew"),_t=q("element","cells","section","isNew"),Lt=q("cells","section"),Ft=q("details","section"),jt=q("startRow","startCol","finishRow","finishCol"),zt=function(e,t){var n=[];return k(bt(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(zt(e,t))}),n},Ht=function(e,t,n){return r=function(e){return ct(e,t)},A(ht(e,n),r);var r},Ut=function(e,t){return n=function(e){return ct(e,t)},A(bt(e),n);var n},qt=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),lt(o)?[]:E(o.querySelectorAll(n),xe.fromDom);var n,r,o};function Vt(e,t,n,r,o){return e(n,r)?R.some(n):v(o)&&o(n)?R.none():t(n,r,o)}var Gt,Yt,Xt,Kt=function(e,t,n){for(var r=e.dom(),o=v(n)?n:C(!1);r.parentNode;){r=r.parentNode;var i=xe.fromDom(r);if(t(i))return R.some(i);if(o(i))break}return R.none()},Jt=function(e,t,n){return Kt(e,function(e){return ct(e,t)},n)},$t=function(e,t){return n=function(e){return ct(e,t)},B(e.dom().childNodes,function(e){return n(xe.fromDom(e))}).map(xe.fromDom);var n},Qt=function(e,t){return n=t,o=(r=e)===undefined?m.document:r.dom(),lt(o)?R.none():R.from(o.querySelector(n)).map(xe.fromDom);var n,r,o},Zt=function(e,t,n){return Vt(ct,Jt,e,t,n)},en=function(e,t,n){return _(bt(e),function(e){return ct(e,t)?n(e)?[e]:[]:en(e,t,n)})},tn={firstLayer:function(e,t){return en(e,t,C(!0))},filterFirstLayer:en},nn=function(e,t,n){return void 0===n&&(n=f),n(t)?R.none():O(e,oe(t))?R.some(t):Jt(t,e.join(","),function(e){return ct(e,"table")||n(e)})},rn=function(t,e){return gt(e).map(function(e){return Ut(e,t)})},on=b(rn,"th,td"),un=b(rn,"tr"),an=function(e,t){return parseInt(me(e,t),10)},cn={cell:function(e,t){return nn(["td","th"],e,t)},firstCell:function(e){return Qt(e,"th,td")},cells:function(e){return tn.firstLayer(e,"th,td")},neighbourCells:on,table:function(e,t){return Zt(e,"table",t)},row:function(e,t){return nn(["tr"],e,t)},rows:function(e){return tn.firstLayer(e,"tr")},notCell:function(e,t){return nn(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:un,attr:an,grid:function(e,t,n){var r=an(e,t),o=an(e,n);return kt(r,o)}},ln=function(e){var t=cn.rows(e);return E(t,function(e){var t=e,n=gt(t).map(function(e){var t=oe(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}).getOr("tbody"),r=E(cn.cells(e),function(e){var t=ge(e,"rowspan")?parseInt(me(e,"rowspan"),10):1,n=ge(e,"colspan")?parseInt(me(e,"colspan"),10):1;return Pt(e,t,n)});return Wt(t,r,n)})},fn=function(e,n){return E(e,function(e){var t=E(cn.cells(e),function(e){var t=ge(e,"rowspan")?parseInt(me(e,"rowspan"),10):1,n=ge(e,"colspan")?parseInt(me(e,"colspan"),10):1;return Pt(e,t,n)});return Wt(e,t,n.section())})},sn=function(e,t){return e+","+t},dn=function(e,t){var n=_(e.all(),function(e){return e.cells()});return A(n,t)},mn={generate:function(e){var l={},t=[],n=e.length,f=0;k(e,function(e,a){var c=[];k(e.cells(),function(e){for(var t=0;l[sn(a,t)]!==undefined;)t++;for(var n=Bt(e.element(),e.rowspan(),e.colspan(),a,t),r=0;r<e.colspan();r++)for(var o=0;o<e.rowspan();o++){var i=t+r,u=sn(a+o,i);l[u]=n,f=Math.max(f,i+1)}c.push(n)}),t.push(Wt(e.element(),c,e.section()))});var r=kt(n,f);return{grid:C(r),access:C(l),all:C(t)}},getAt:function(e,t,n){var r=e.access()[sn(t,n)];return r!==undefined?R.some(r):R.none()},findItem:function(e,t,n){var r=dn(e,function(e){return n(t,e.element())});return 0<r.length?R.some(r[0]):R.none()},filterItems:dn,justCells:function(e){var t=E(e.all(),function(e){return e.cells()});return M(t)}},gn=q("minRow","minCol","maxRow","maxCol"),hn=function(e,t){var n,i,r,u,a,c,l,o,f,s,d=function(e){return ct(e.element(),t)},m=ln(e),g=mn.generate(m),h=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),a=r,l=c=0,z(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:c<n&&(c=n),r<a?a=r:l<o&&(l=o)}}),gn(u,a,c,l)),p="th:not("+t+"),td:not("+t+")",v=tn.filterFirstLayer(e,"th,td",function(e){return ct(e,p)});return k(v,Nt),function(e,t,n,r){for(var o,i,u,a=t.grid().columns(),c=t.grid().rows(),l=0;l<c;l++)for(var f=!1,s=0;s<a;s++)l<n.minRow()||l>n.maxRow()||s<n.minCol()||s>n.maxCol()||(mn.getAt(t,l,s).filter(r).isNone()?(o=f,i=e[l].element(),u=xe.fromTag("td"),Rt(u,xe.fromTag("br")),(o?Rt:Ct)(i,u)):f=!0)}(m,g,h,d),o=e,f=h,s=A(tn.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),k(s,Nt),f.minCol()!==f.maxCol()&&f.minRow()!==f.maxRow()||k(tn.firstLayer(o,"th,td"),function(e){he(e,"rowspan"),he(e,"colspan")}),he(o,"width"),he(o,"height"),Ae(o,"width"),Ae(o,"height"),e},pn=(Gt=le,Yt="text",{get:function(e){if(!Gt(e))throw new Error("Can only get "+Yt+" value of a "+Yt+" node");return Xt(e).getOr("")},getOption:Xt=function(e){return Gt(e)?R.from(e.dom().nodeValue):R.none()},set:function(e,t){if(!Gt(e))throw new Error("Can only set raw "+Yt+" value of a "+Yt+" node");e.dom().nodeValue=t}}),vn=function(e){return pn.get(e)},bn=function(e){return pn.getOption(e)},wn=function(e,t){pn.set(e,t)},yn=function(e){return"img"===oe(e)?1:bn(e).fold(function(){return bt(e).length},function(e){return e.length})},xn=["img","br"],Cn=function(e){return bn(e).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||O(xn,oe(e))},Rn=function(e){return o=Cn,(i=function(e){for(var t=0;t<e.childNodes.length;t++){var n=xe.fromDom(e.childNodes[t]);if(o(n))return R.some(n);var r=i(e.childNodes[t]);if(r.isSome())return r}return R.none()})(e.dom());var o,i},Sn=function(e){return Tn(e,Cn)},Tn=function(e,i){var u=function(e){for(var t=bt(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return R.some(r);var o=u(r);if(o.isSome())return o}return R.none()};return u(e)},Dn=function(e,t){return xe.fromDom(e.dom().cloneNode(t))},On=function(e){return Dn(e,!1)},Nn=function(e){return Dn(e,!0)},En=function(e,t){var n,r,o,i,u=(n=e,r=t,o=xe.fromTag(r),i=pe(n),de(o,i),o),a=bt(Nn(e));return Dt(u,a),u},kn=function(){var e=xe.fromTag("td");return Rt(e,xe.fromTag("br")),e},An=function(e,t,n){var r=En(e,t);return z(n,function(e,t){null===e?he(r,t):se(r,t,e)}),r},Pn=function(e){return e},In=function(e){return function(){return xe.fromTag("tr",e.dom())}},Bn=function(d,e,m){return{row:In(e),cell:function(e){var r,o,i,t,n,u,a,c=mt(e.element()),l=xe.fromTag(oe(e.element()),c.dom()),f=m.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),s=0<f.length?(r=e.element(),o=l,i=f,Rn(r).map(function(e){var t=i.join(","),n=Ht(e,t,function(e){return ft(e,r)});return P(n,function(e,t){var n=On(t);return he(n,"contenteditable"),Rt(e,n),n},o)}).getOr(o)):l;return Rt(s,xe.fromTag("br")),t=e.element(),n=l,u=t.dom(),a=n.dom(),be(u)&&be(a)&&(a.style.cssText=u.style.cssText),Ae(l,"height"),1!==e.colspan()&&Ae(e.element(),"width"),d(e.element(),l),l},replace:An,gap:kn}},Wn=function(e){return{row:In(e),cell:kn,replace:Pn,gap:kn}},Mn=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()},_n=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()},Ln=function(e,t){for(var n=!0,r=b(Mn,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&mn.getAt(e,o,i).exists(r);return n?R.some(t):R.none()},Fn=function(e,t,n){var r=mn.findItem(e,t,ft),o=mn.findItem(e,n,ft);return r.bind(function(r){return o.map(function(e){return t=r,n=e,jt(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})})},jn=Fn,zn=function(t,e,n){return Fn(t,e,n).bind(function(e){return Ln(t,e)})},Hn=function(r,e,o,i){return mn.findItem(r,e,ft).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 mn.getAt(r,t+o,n+i).map(function(e){return e.element()})})},Un=function(n,e,t){return jn(n,e,t).map(function(e){var t=mn.filterItems(n,b(_n,e));return E(t,function(e){return e.element()})})},qn=function(e,t){return mn.findItem(e,t,function(e,t){return st(t,e)}).map(function(e){return e.element()})},Vn=function(e){var t=ln(e);return mn.generate(t)},Gn=function(n,r,o){return cn.table(n).bind(function(e){var t=Vn(e);return Hn(t,n,r,o)})},Yn=function(e,t,n){var r=Vn(e);return Un(r,t,n)},Xn=function(e,t,n,r,o){var i=Vn(e),u=ft(e,n)?R.some(t):qn(i,t),a=ft(e,o)?R.some(r):qn(i,r);return u.bind(function(t){return a.bind(function(e){return Un(i,t,e)})})},Kn=function(e,t,n){var r=Vn(e);return zn(r,t,n)},Jn=["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 $n(){return{up:C({selector:Jt,closest:Zt,predicate:Kt,all:ht}),down:C({selector:qt,predicate:zt}),styles:C({get:Ne,getRaw:ke,set:De,remove:Ae}),attrs:C({get:me,set:se,remove:he,copyTo:function(e,t){var n=pe(e);de(t,n)}}),insert:C({before:yt,after:xt,afterAll:Tt,append:Rt,appendAll:Dt,prepend:Ct,wrap:St}),remove:C({unwrap:Et,remove:Nt}),create:C({nu:xe.fromTag,clone:function(e){return xe.fromDom(e.dom().cloneNode(!1))},text:xe.fromText}),query:C({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:pt,nextSibling:vt}),property:C({children:bt,name:oe,parent:gt,document:function(e){return e.dom().ownerDocument},isText:le,isComment:ae,isElement:ce,getText:vn,setText:wn,isBoundary:function(e){return!!ce(e)&&("body"===oe(e)||O(Jn,oe(e)))},isEmptyTag:function(e){return!!ce(e)&&O(["br","img","hr","input"],oe(e))}}),eq:ft,is:dt}}var Qn=q("left","right"),Zn=q("first","second","splits"),er=function(e,t,n){var r=e.property().children(t);return W(r,b(e.eq,n)).map(function(e){return{before:C(r.slice(0,e)),after:C(r.slice(e+1))}})},tr=function(r,o,e,t){var n=o(r,e);return P(t,function(e,t){var n=o(r,t);return nr(r,e,n)},n)},nr=function(t,e,n){return e.bind(function(e){return n.filter(b(t.eq,e))})},rr=function(e,t){return b(e.eq,t)},or=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 W(t,r).fold(function(){return t},function(e){return t.slice(0,e+1)})},a=u(o),c=u(i),l=B(a,function(e){return N(c,rr(t,e))});return{firstpath:C(a),secondpath:C(c),shared:C(l)}},ir={sharedOne:function(e,t,n){return 0<n.length?tr(e,t,(r=n)[0],r.slice(1)):R.none();var r},subset:function(t,e,n){var r=or(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 R.some([e[0]]);if(o.eq(i,t[0]))return R.some([t[0]]);var n=function(e){var t=F(e),n=W(t,rr(o,i)).getOr(-1),r=n<t.length-1?t[n+1]:t[n];return W(u,rr(o,r))},r=n(e),a=n(t);return r.bind(function(r){return a.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:or,breakToLeft:function(n,r,o){return er(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),Qn(t,r)})},breakToRight:function(n,r,e){return er(n,r,e).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.after()),n.insert().after(r,t),Qn(r,t)})},breakPath:function(i,e,u,a){var c=function(e,t,o){var n=Zn(e,R.none(),o);return u(e)?Zn(e,t,o):i.property().parent(e).bind(function(r){return a(i,r,e).map(function(e){var t=[{first:e.left,second:e.right}],n=u(r)?r:e.left();return c(n,R.some(e.right()),o.concat(t))})}).getOr(n)};return c(e,R.none(),[])}},ur=$n(),ar={sharedOne:function(n,e){return ir.sharedOne(ur,function(e,t){return n(t)},e)},subset:function(e,t){return ir.subset(ur,e,t)},ancestors:function(e,t,n){return ir.ancestors(ur,e,t,n)},breakToLeft:function(e,t){return ir.breakToLeft(ur,e,t)},breakToRight:function(e,t){return ir.breakToRight(ur,e,t)},breakPath:function(e,t,r){return ir.breakPath(ur,e,t,function(e,t,n){return r(t,n)})}},cr={create:J(["boxes","start","finish"],[])},lr=function(e){return Jt(e,"table")},fr=function(a,c,r){var l=function(t){return function(e){return r!==undefined&&r(e)||ft(e,t)}};return ft(a,c)?R.some(cr.create({boxes:R.some([a]),start:a,finish:c})):lr(a).bind(function(u){return lr(c).bind(function(i){if(ft(u,i))return R.some(cr.create({boxes:Yn(u,a,c),start:a,finish:c}));if(st(u,i)){var e=0<(t=Ht(c,"td,th",l(u))).length?t[t.length-1]:c;return R.some(cr.create({boxes:Xn(u,a,u,c,i),start:a,finish:e}))}if(st(i,u)){var t,n=0<(t=Ht(a,"td,th",l(i))).length?t[t.length-1]:a;return R.some(cr.create({boxes:Xn(i,a,u,c,i),start:a,finish:n}))}return ar.ancestors(a,c).shared().bind(function(e){return Zt(e,"table",r).bind(function(e){var t=Ht(c,"td,th",l(e)),n=0<t.length?t[t.length-1]:c,r=Ht(a,"td,th",l(e)),o=0<r.length?r[r.length-1]:a;return R.some(cr.create({boxes:Xn(e,a,u,c,i),start:o,finish:n}))})})})})},sr=fr,dr=function(e,t){var n=qt(e,t);return 0<n.length?R.some(n):R.none()},mr=function(e,t,n,r,o){return(i=e,u=o,B(i,function(e){return ct(e,u)})).bind(function(e){return Gn(e,t,n).bind(function(e){return n=r,Jt(t=e,"table").bind(function(e){return Qt(e,n).bind(function(e){return fr(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:C(e),start:C(t.start()),finish:C(t.finish())}})})})});var t,n})});var i,u},gr=function(e,t,r){return Qt(e,t).bind(function(n){return Qt(e,r).bind(function(t){return ar.sharedOne(lr,[n,t]).map(function(e){return{first:C(n),last:C(t),table:C(e)}})})})},hr=function(e,t){return dr(e,t)},pr=function(o,e,t){return gr(o,e,t).bind(function(n){var e=function(e){return ft(o,e)},t=Jt(n.first(),"thead,tfoot,tbody,table",e),r=Jt(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return ft(t,e)?Kn(n.table(),n.first(),n.last()):R.none()})})})},vr="data-mce-selected",br="data-mce-first-selected",wr="data-mce-last-selected",yr={selected:C(vr),selectedSelector:C("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:C("[data-mce-selected]"),firstSelected:C(br),firstSelectedSelector:C("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:C(wr),lastSelectedSelector:C("td[data-mce-last-selected],th[data-mce-last-selected]")},xr=function(u){if(!h(u))throw new Error("cases must be an array");if(0===u.length)throw new Error("there must be at least one case");var a=[],n={};return k(u,function(e,r){var t=j(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(!h(i))throw new Error("case arguments must be an array");a.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=j(e);if(a.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+a.join(",")+"\nActual: "+t.join(","));if(!L(a,function(e){return O(t,e)}))throw new Error("Not all branches were specified when using match. Specified: "+t.join(", ")+"\nRequired: "+a.join(", "));return e[o].apply(null,n)},log:function(e){m.console.log(e,{constructors:a,constructor:o,params:n})}}}}),n},Cr=xr([{none:[]},{multiple:["elements"]},{single:["selection"]}]),Rr={cata:function(e,t,n,r){return e.fold(t,n,r)},none:Cr.none,multiple:Cr.multiple,single:Cr.single},Sr=function(e,t){return Rr.cata(t.get(),C([]),o,C([e]))},Tr=function(n,e){return Rr.cata(e.get(),R.none,function(t,e){return 0===t.length?R.none():pr(n,yr.firstSelectedSelector(),yr.lastSelectedSelector()).bind(function(e){return 1<t.length?R.some({bounds:C(e),cells:C(t)}):R.none()})},R.none)},Dr=function(e,t){var n=Sr(e,t);return 0<n.length&&L(n,function(e){return ge(e,"rowspan")&&1<parseInt(me(e,"rowspan"),10)||ge(e,"colspan")&&1<parseInt(me(e,"colspan"),10)})?R.some(n):R.none()},Or=Sr,Nr=function(e){return{element:C(e),mergable:R.none,unmergable:R.none,selection:C([e])}},Er=q("element","clipboard","generators"),kr={noMenu:Nr,forMenu:function(e,t,n){return{element:C(n),mergable:C(Tr(t,e)),unmergable:C(Dr(n,e)),selection:C(Or(n,e))}},notCell:function(e){return Nr(e)},paste:Er,pasteRows:function(e,t,n,r,o){return{element:C(n),mergable:R.none,unmergable:R.none,selection:C(Or(n,e)),clipboard:C(r),generators:C(o)}}},Ar=function(f,e,s,d){f.on("BeforeGetContent",function(n){!0===n.selection&&Rr.cata(e.get(),y,function(e){var t;n.preventDefault(),(t=e,cn.table(t[0]).map(Nn).map(function(e){return[hn(e,yr.attributeSelector())]})).each(function(e){var t;n.content="text"===n.format?E(e,function(e){return e.dom().innerText}).join(""):(t=f,E(e,function(e){return t.selection.serializer.serialize(e.dom(),{})}).join(""))})},y)}),f.on("BeforeSetContent",function(l){!0===l.selection&&!0===l.paste&&R.from(f.dom.getParent(f.selection.getStart(),"th,td")).each(function(e){var c=xe.fromDom(e);cn.table(c).each(function(t){var e,n,r,o=A((e=l.content,(r=(n||m.document).createElement("div")).innerHTML=e,bt(xe.fromDom(r))),function(e){return"meta"!==oe(e)});if(1===o.length&&"table"===oe(o[0])){l.preventDefault();var i=xe.fromDom(f.getDoc()),u=Wn(i),a=kr.paste(c,o[0],u);s.pasteCells(t,a).each(function(e){f.selection.setRng(e),f.focus(),d.clear(t)})}})})})};function Pr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=Ne(e,r);return parseFloat(n)||0}return t},i=function(o,e){return I(e,function(e,t){var n=Ne(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!w(t)&&!t.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+t);var n=e.dom();be(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 Ir=Pr("height",function(e){var t=e.dom();return Ce(e)?t.getBoundingClientRect().height:t.offsetHeight}),Br=function(e){return Ir.get(e)},Wr=function(e){return Ir.getOuter(e)},Mr=Pr("width",function(e){return e.dom().offsetWidth}),_r=function(e){return Mr.get(e)},Lr=function(e){return Mr.getOuter(e)},Fr=it.detect(),jr=function(e,t,n){return r=Ne(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},zr=function(e){return Fr.browser.isIE()||Fr.browser.isEdge()?(n=jr(t=e,"padding-top",0),r=jr(t,"padding-bottom",0),o=jr(t,"border-top-width",0),i=jr(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===Ne(t,"box-sizing")?u:u-n-r-(o+i)):jr(e,"height",Br(e));var t,n,r,o,i,u},Hr=/(\d+(\.\d+)?)(\w|%)*/,Ur=/(\d+(\.\d+)?)%/,qr=/(\d+(\.\d+)?)px|em/,Vr=function(e,t){De(e,"height",t+"px")},Gr=function(e,t,n,r){var o,i,u,a,c,l,f,s,d,m=parseInt(e,10);return s=l="%",d=(f=e).length-l.length,""!==s&&(f.length<s.length||f.substr(d,d+s.length)!==s)||"table"===oe(t)?m:(o=t,i=m,u=n,a=r,c=cn.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),a(o,c),c)},Yr=function(e){var t,n=ke(t=e,"height").getOrThunk(function(){return zr(t)+"px"});return n?Gr(n,e,Br,Vr):Br(e)},Xr=function(e,t){return ge(e,t)?parseInt(me(e,t),10):1},Kr=function(e){return ke(e,"width").fold(function(){return R.from(me(e,"width"))},function(e){return R.some(e)})},Jr=function(e,t){return e/t.pixelWidth()*100},$r={percentageBasedSizeRegex:C(Ur),pixelBasedSizeRegex:C(qr),setPixelWidth:function(e,t){De(e,"width",t+"px")},setPercentageWidth:function(e,t){De(e,"width",t+"%")},setHeight:Vr,getPixelWidth:function(t,n){return Kr(t).fold(function(){return _r(t)},function(e){return function(e,t,n){var r=qr.exec(t);if(null!==r)return parseInt(r[1],10);var o=Ur.exec(t);if(null!==o){var i=parseFloat(o[1]);return i/100*n.pixelWidth()}return _r(e)}(t,e,n)})},getPercentageWidth:function(t,n){return Kr(t).fold(function(){var e=_r(t);return Jr(e,n)},function(e){return function(e,t,n){var r=Ur.exec(t);if(null!==r)return parseFloat(r[1]);var o=_r(e);return Jr(o,n)}(t,e,n)})},getGenericWidth:function(e){return Kr(e).bind(function(e){var t=Hr.exec(e);return null!==t?R.some({width:C(parseFloat(t[1])),unit:C(t[3])}):R.none()})},setGenericWidth:function(e,t,n){De(e,"width",t+n)},getHeight:function(e){return n="rowspan",Yr(t=e)/Xr(t,n);var t,n},getRawWidth:Kr},Qr=function(n,r){$r.getGenericWidth(n).each(function(e){var t=e.width()/2;$r.setGenericWidth(n,t,e.unit()),$r.setGenericWidth(r,t,e.unit())})},Zr=function(n,r){return{left:C(n),top:C(r),translate:function(e,t){return Zr(n+e,r+t)}}},eo=Zr,to=function(e,t){return e!==undefined?e:t!==undefined?t:0},no=function(e){var t=e.dom().ownerDocument,n=t.body,r=t.defaultView,o=t.documentElement,i=to(r.pageYOffset,o.scrollTop),u=to(r.pageXOffset,o.scrollLeft),a=to(o.clientTop,n.clientTop),c=to(o.clientLeft,n.clientLeft);return ro(e).translate(u-c,i-a)},ro=function(e){var t,n=e.dom(),r=n.ownerDocument.body;return r===n?eo(r.offsetLeft,r.offsetTop):Ce(e)?(t=n.getBoundingClientRect(),eo(t.left,t.top)):eo(0,0)},oo=q("row","y"),io=q("col","x"),uo=function(e){return no(e).left()+Lr(e)},ao=function(e){return no(e).left()},co=function(e,t){return io(e,ao(t))},lo=function(e,t){return io(e,uo(t))},fo=function(e){return no(e).top()},so=function(e,t){return oo(e,fo(t))},mo=function(e,t){return oo(e,fo(t)+Wr(t))},go=function(n,t,r){if(0===r.length)return[];var e=E(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])},ho={height:{delta:o,positions:function(e){return go(so,mo,e)},edge:fo},rtl:{delta:function(e){return-e},edge:uo,positions:function(e){return go(lo,co,e)}},ltr:{delta:o,edge:ao,positions:function(e){return go(co,lo,e)}}},po={ltr:ho.ltr,rtl:ho.rtl};function vo(t){var n=function(e){return t(e).isRtl()?po.rtl:po.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 bo=function(e){var t=ln(e);return mn.generate(t).grid()},wo=function(){return(wo=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)},yo=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},xo=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return R.none()},Co=function(e,t,n,r){n===r?he(e,t):se(e,t,n)},Ro=function(o,e){var i=[],u=[],t=function(e,t){0<e.length?function(e,t){var n=$t(o,t).getOrThunk(function(){var e=xe.fromTag(t,mt(o).dom());return Rt(o,e),e});Ot(n);var r=E(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return Ot(t),k(e.cells(),function(e){e.isNew()&&u.push(e.element()),Co(e.element(),"colspan",e.colspan(),1),Co(e.element(),"rowspan",e.rowspan(),1),Rt(t,e.element())}),t});Dt(n,r)}(e,t):$t(o,t).each(Nt)},n=[],r=[],a=[];return k(e,function(e){switch(e.section()){case"thead":n.push(e);break;case"tbody":r.push(e);break;case"tfoot":a.push(e)}}),t(n,"thead"),t(r,"tbody"),t(a,"tfoot"),{newRows:C(i),newCells:C(u)}},So=function(e){return E(e,function(e){var n=On(e.element());return k(e.cells(),function(e){var t=Nn(e.element());Co(t,"colspan",e.colspan(),1),Co(t,"rowspan",e.rowspan(),1),Rt(n,t)}),n})},To=function(e,t){var n=me(e,t);return n===undefined||""===n?[]:n.split(" ")},Do=function(e){return e.dom().classList!==undefined},Oo=function(e,t){return o=t,i=To(n=e,r="class").concat([o]),se(n,r,i.join(" ")),!0;var n,r,o,i},No=function(e,t){return o=t,0<(i=A(To(n=e,r="class"),function(e){return e!==o})).length?se(n,r,i.join(" ")):he(n,r),!1;var n,r,o,i},Eo=function(e,t){Do(e)?e.dom().classList.add(t):Oo(e,t)},ko=function(e){0===(Do(e)?e.dom().classList:To(e,"class")).length&&he(e,"class")},Ao=function(e,t){return Do(e)&&e.dom().classList.contains(t)},Po=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},Io=function(t,n){if(n<0||n>=t.length-1)return R.none();var e=t[n].fold(function(){var e=F(t.slice(0,n));return xo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return R.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return xo(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return R.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})})},Bo=function(e,t,n){var r=e();return B(r,t).orThunk(function(){return R.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},Wo=function(n){var e=n.grid(),t=Po(0,e.columns()),r=Po(0,e.rows());return E(t,function(t){return Bo(function(){return _(r,function(e){return mn.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return mn.getAt(n,0,t)})})},Mo=function(n){var e=n.grid(),t=Po(0,e.rows()),r=Po(0,e.columns());return E(t,function(t){return Bo(function(){return _(r,function(e){return mn.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return mn.getAt(n,t,0)})})},_o=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},Lo={resolve:_o("ephox-snooker").resolve},Fo=function(e,t,n,r,o){var i=xe.fromTag("div");return Oe(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),de(i,{"data-column":e,role:"presentation"}),i},jo=function(e,t,n,r,o){var i=xe.fromTag("div");return Oe(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),de(i,{"data-row":e,role:"presentation"}),i},zo=Lo.resolve("resizer-bar"),Ho=Lo.resolve("resizer-rows"),Uo=Lo.resolve("resizer-cols"),qo=function(e){var t=qt(e.parent(),"."+zo);k(t,Nt)},Vo=function(n,e,r){var o=n.origin();k(e,function(e,t){e.each(function(e){var t=r(o,e);Eo(t,zo),Rt(n.parent(),t)})})},Go=function(e,t,n,r,o,i){var u,a,c,l,f=no(t),s=0<n.length?o.positions(n,t):[];u=e,a=s,c=f,l=Lr(t),Vo(u,a,function(e,t){var n=jo(t.row(),c.left()-e.left(),t.y()-e.top(),l,7);return Eo(n,Ho),n});var d,m,g,h,p=0<r.length?i.positions(r,t):[];d=e,m=p,g=f,h=Wr(t),Vo(d,m,function(e,t){var n=Fo(t.col(),t.x()-e.left(),g.top()-e.top(),7,h);return Eo(n,Uo),n})},Yo=function(e,t){var n=qt(e.parent(),"."+zo);k(n,t)},Xo=function(e,t,n,r){qo(e);var o=ln(t),i=mn.generate(o),u=Mo(i),a=Wo(i);Go(e,t,u,a,n,r)},Ko=function(e){Yo(e,function(e){De(e,"display","none")})},Jo=function(e){Yo(e,function(e){De(e,"display","block")})},$o=qo,Qo=function(e){return Ao(e,Ho)},Zo=function(e){return Ao(e,Uo)},ei=function(e,t){return Lt(t,e.section())},ti=function(e,t){return e.cells()[t]},ni={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 ei(e,u)},setCells:ei,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:ti,getCellElement:function(e,t){return ti(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=E(n,t);return Lt(r,e.section())},cellLength:function(e){return e.cells().length}},ri=function(e,t){if(0===e.length)return 0;var n=e[0];return W(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},oi=function(e,t,n,r){var o,i,u,a,c=(o=e,i=t,o[i]).cells().slice(n),l=ri(c,r),f=(u=e,a=n,E(u,function(e){return ni.getCell(e,a)})).slice(t),s=ri(f,r);return{colspan:C(l),rowspan:C(s)}},ii=function(o,i){var u=E(o,function(e,t){return E(e.cells(),function(e,t){return!1})});return E(o,function(e,r){var t=_(e.cells(),function(e,t){if(!1===u[r][t]){var n=oi(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()),[It(e.element(),n.rowspan(),n.colspan(),e.isNew())]}return[]});return Ft(t,e.section())})},ui=function(e,t,n){for(var r=[],o=0;o<e.grid().rows();o++){for(var i=[],u=0;u<e.grid().columns();u++){var a=mn.getAt(e,o,u).map(function(e){return Mt(e.element(),n)}).getOrThunk(function(){return Mt(t.gap(),!0)});i.push(a)}var c=Lt(i,e.all()[o].section());r.push(c)}return r},ai=function(e,r){return E(e,function(e){var t,n=(t=e.details(),xo(t,function(e){return gt(e.element()).map(function(e){var t=gt(e).isNone();return Mt(e,t)})}).getOrThunk(function(){return Mt(r.row(),!0)}));return _t(n.element(),e.details(),e.section(),n.isNew())})},ci=function(e,t){var n=ii(e,ft);return ai(n,t)},li=function(e,t){var n=M(E(e.all(),function(e){return e.cells()}));return B(n,function(e){return ft(t,e.element())})},fi=function(a,c,l,f,s){return function(n,r,e,o,i){var t=ln(r),u=mn.generate(t);return c(u,e).map(function(e){var t=ui(u,o,!1),n=a(t,e,ft,s(o)),r=ci(n.grid(),o);return{grid:C(r),cursor:n.cursor}}).fold(function(){return R.none()},function(e){var t=Ro(r,e.grid());return l(r,e.grid(),i),f(r),Xo(n,r,ho.height,i),R.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},si=function(t,e){return cn.cell(e.element()).bind(function(e){return li(t,e)})},di=function(t,e){var n=E(e.selection(),function(e){return cn.cell(e).bind(function(e){return li(t,e)})}),r=yo(n);return 0<r.length?R.some({cells:r,generators:e.generators,clipboard:e.clipboard}):R.none()},mi=function(t,e){var n=E(e.selection(),function(e){return cn.cell(e).bind(function(e){return li(t,e)})}),r=yo(n);return 0<r.length?R.some(r):R.none()},gi=function(n){return{is:function(e){return n===e},isValue:u,isError:f,getOr:C(n),getOrThunk:C(n),getOrDie:C(n),or:function(e){return gi(n)},orThunk:function(e){return gi(n)},fold:function(e,t){return t(n)},map:function(e){return gi(e(n))},mapError:function(e){return gi(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 R.some(n)}}},hi=function(n){return{is:f,isValue:f,isError:u,getOr:o,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(n),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return hi(n)},mapError:function(e){return hi(e(n))},each:y,bind:function(e){return hi(n)},exists:f,forall:u,toOption:R.none}},pi={value:gi,error:hi,fromOption:function(e,t){return e.fold(function(){return hi(t)},gi)}},vi=function(e,t){return E(e,function(){return Mt(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 ni.setCells(t[t.length-1],vi(t[t.length-1].cells(),n))}))},wi=function(e,t,n){return E(e,function(e){return ni.setCells(e,e.cells().concat(vi(Po(0,t),n)))})},yi=function(e,t,n){if(e.row()>=t.length||e.column()>ni.cellLength(t[0]))return pi.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=ni.cellLength(n[0]),u=n.length;return pi.value({rowDelta:C(r.length-u),colDelta:C(o.length-i)})},xi=function(e,t){var n=ni.cellLength(e[0]),r=ni.cellLength(t[0]);return{rowDelta:C(0),colDelta:C(n-r)}},Ci=function(e,t,n){var r=t.colDelta()<0?wi:o;return(t.rowDelta()<0?bi:o)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},Ri=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++)ni.mutateCell(e[o],i,Mt(r(),!1));return e},Si=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<ni.cellLength(e[0]);u++){var a=n(ni.getCellElement(e[i],u),t);!0===a&&!1===o?ni.mutateCell(e[i],u,Mt(r(),!0)):!0===a&&(o=!1)}return e},Ti=function(i,n,u,a){if(0<n&&n<i.length){var e=i[n-1].cells(),t=(r=u,I(e,function(e,t){return N(e,function(e){return r(e.element(),t.element())})?e:e.concat([t])},[]));k(t,function(r){for(var o=R.none(),e=function(n){for(var e=function(t){var e=i[n].cells()[t];u(e.element(),r.element())&&(o.isNone()&&(o=R.some(a())),o.each(function(e){ni.mutateCell(i[n],t,Mt(e,!0))}))},t=0;t<ni.cellLength(i[0]);t++)e(t)},t=n;t<i.length;t++)e(t)})}var r;return i},Di=function(n,r,o,i,u){return yi(n,r,o).map(function(e){var t=Ci(r,e,i);return function(e,t,n,r,o){for(var i,u,a,c,l,f=e.row(),s=e.column(),d=f+n.length,m=s+ni.cellLength(n[0]),g=f;g<d;g++)for(var h=s;h<m;h++){i=t,u=g,a=h,l=c=void 0,c=b(o,ni.getCell(i[u],a).element()),l=i[u],1<i.length&&1<ni.cellLength(l)&&(0<a&&c(ni.getCellElement(l,a-1))||a<l.cells().length-1&&c(ni.getCellElement(l,a+1))||0<u&&c(ni.getCellElement(i[u-1],a))||u<i.length-1&&c(ni.getCellElement(i[u+1],a)))&&Si(t,ni.getCellElement(t[g],h),o,r.cell);var p=ni.getCellElement(n[g-f],h-s),v=r.replace(p);ni.mutateCell(t[g],h,Mt(v,!0))}return t}(n,t,o,i,u)})},Oi=function(e,t,n,r,o){Ti(t,e,o,r.cell);var i=xi(n,t),u=Ci(n,i,r),a=xi(t,u),c=Ci(t,a,r);return c.slice(0,e).concat(u).concat(c.slice(e,c.length))},Ni=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),a=ni.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(ni.getCellElement(n[r-1],t),ni.getCellElement(n[r],t))?ni.getCell(n[r],t):Mt(i(e.element(),o),!0)});return t.concat([a]).concat(u)},Ei=function(e,n,r,o,i){return E(e,function(e){var t=0<n&&n<ni.cellLength(e)&&o(ni.getCellElement(e,n-1),ni.getCellElement(e,n))?ni.getCell(e,n):Mt(i(ni.getCellElement(e,r),o),!0);return ni.addCell(e,n,t)})},ki=function(e,r,o,i,u){var a=o+1;return E(e,function(e,t){var n=t===r?Mt(u(ni.getCellElement(e,o),i),!0):ni.getCell(e,o);return ni.addCell(e,a,n)})},Ai=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),a=e.slice(i),c=ni.mapCells(e[t],function(e,t){return t===n?Mt(o(e.element(),r),!0):e});return u.concat([c]).concat(a)},Pi=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},Ii=function(e,n,r){var t=E(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return Lt(t,e.section())});return A(t,function(e){return 0<e.cells().length})},Bi=function(e,n,r,o){return E(e,function(e){return ni.mapCells(e,function(e){return t=e,N(n,function(e){return r(t.element(),e.element())})?Mt(o(e.element(),r),!0):e;var t})})},Wi=function(e,t,n,r){return ni.getCellElement(e[t],n)!==undefined&&0<t&&r(ni.getCellElement(e[t-1],n),ni.getCellElement(e[t],n))},Mi=function(e,t,n){return 0<t&&n(ni.getCellElement(e,t-1),ni.getCellElement(e,t))},_i=function(n,r,o,e){var t=_(n,function(e,t){return Wi(n,t,r,o)||Mi(e,r,o)?[]:[ni.getCell(e,r)]});return Bi(n,t,o,e)},Li=function(n,r,o,e){var i=n[r],t=_(i.cells(),function(e,t){return Wi(n,r,t,o)||Mi(i,t,o)?[]:[e]});return Bi(n,t,o,e)},Fi=xr([{none:[]},{only:["index"]},{left:["index","next"]},{middle:["prev","index","next"]},{right:["prev","index"]}]),ji=wo({},Fi),zi=function(e,t,i,u){var n,r,a=e.slice(0),o=(r=t,0===(n=e).length?ji.none():1===n.length?ji.only(0):0===r?ji.left(0,1):r===n.length-1?ji.right(r-1,r):0<r&&r<n.length-1?ji.middle(r-1,r,r+1):ji.none()),c=function(e){return E(e,C(0))},l=C(c(a)),f=function(e,t){if(0<=i){var n=Math.max(u.minCellWidth(),a[t]-i);return c(a.slice(0,e)).concat([i,n-a[t]]).concat(c(a.slice(t+1)))}var r=Math.max(u.minCellWidth(),a[e]+i),o=a[e]-r;return c(a.slice(0,e)).concat([r-a[e],o]).concat(c(a.slice(t+1)))},s=f;return o.fold(l,function(e){return u.singleColumnWidth(a[e],i)},s,function(e,t,n){return f(t,n)},function(e,t){if(0<=i)return c(a.slice(0,t)).concat([i]);var n=Math.max(u.minCellWidth(),a[t]+i);return c(a.slice(0,t)).concat([n-a[t]])})},Hi=function(e,t){return ge(e,t)&&1<parseInt(me(e,t),10)},Ui={hasColspan:function(e){return Hi(e,"colspan")},hasRowspan:function(e){return Hi(e,"rowspan")},minWidth:C(10),minHeight:C(10),getInt:function(e,t){return parseInt(Ne(e,t),10)}},qi=function(e,t,n){return ke(e,t).fold(function(){return n(e)+"px"},function(e){return e})},Vi=function(e,t){return qi(e,"width",function(e){return $r.getPixelWidth(e,t)})},Gi=function(e){return qi(e,"height",$r.getHeight)},Yi=function(e,t,n,r,o){var i=Wo(e),u=E(i,function(e){return e.map(t.edge)});return E(i,function(e,t){return e.filter(g(Ui.hasColspan)).fold(function(){var e=Io(u,t);return r(e)},function(e){return n(e,o)})})},Xi=function(e){return e.map(function(e){return e+"px"}).getOr("")},Ki=function(e,t,n,r){var o=Mo(e),i=E(o,function(e){return e.map(t.edge)});return E(o,function(e,t){return e.filter(g(Ui.hasRowspan)).fold(function(){var e=Io(i,t);return r(e)},function(e){return n(e)})})},Ji={getRawWidths:function(e,t,n){return Yi(e,t,Vi,Xi,n)},getPixelWidths:function(e,t,n){return Yi(e,t,$r.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return Yi(e,t,$r.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Ki(e,t,$r.getHeight,function(e){return e.getOrThunk(Ui.minHeight)})},getRawHeights:function(e,t){return Ki(e,t,Gi,Xi)}},$i=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},Qi=function(e,n){var t=mn.justCells(e);return E(t,function(e){var t=$i(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:C(t),colspan:e.colspan}})},Zi=function(e,n){var t=mn.justCells(e);return E(t,function(e){var t=$i(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:C(t),rowspan:e.rowspan}})},eu=function(e,n){return E(e.all(),function(e,t){return{element:e.element,height:C(n[t])}})},tu=function(e){var t=o;return{width:C(e),pixelWidth:C(e),getWidths:Ji.getPixelWidths,getCellDelta:t,singleColumnWidth:function(e,t){return[Math.max(Ui.minWidth(),e+t)-e]},minCellWidth:Ui.minWidth,setElementWidth:$r.setPixelWidth,setTableWidth:function(e,t,n){var r=P(t,function(e,t){return e+t},0);$r.setPixelWidth(e,r)}}},nu=function(e,t){var n,r,o,i,u=$r.percentageBasedSizeRegex().exec(t);if(null!==u)return n=u[1],r=e,o=parseFloat(n),i=_r(r),{width:C(o),pixelWidth:C(i),getWidths:Ji.getPercentageWidths,getCellDelta:function(e){return e/i*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return Ui.minWidth()/i*100},setElementWidth:$r.setPercentageWidth,setTableWidth:function(e,t,n){var r=n/100*o;$r.setPercentageWidth(e,o+r)}};var a=$r.pixelBasedSizeRegex().exec(t);if(null!==a){var c=parseInt(a[1],10);return tu(c)}var l=_r(e);return tu(l)},ru=function(t){return $r.getRawWidth(t).fold(function(){var e=_r(t);return tu(e)},function(e){return nu(t,e)})},ou=function(e){return mn.generate(e)},iu=function(e){var t=ln(e);return ou(t)},uu=function(e,t,n,r){var o=ru(e),i=o.getCellDelta(t),u=iu(e),a=o.getWidths(u,r,o),c=zi(a,n,i,o),l=E(c,function(e,t){return e+a[t]}),f=Qi(u,l);k(f,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},au=function(e,n,r,t){var o=iu(e),i=Ji.getPixelHeights(o,t),u=E(i,function(e,t){return r===t?Math.max(n+e,Ui.minHeight()):e}),a=Zi(o,u),c=eu(o,u);k(c,function(e){$r.setHeight(e.element(),e.height())}),k(a,function(e){$r.setHeight(e.element(),e.height())});var l=P(u,function(e,t){return e+t},0);$r.setHeight(e,l)},cu=function(e,t,n){var r=ru(e),o=ou(t),i=r.getWidths(o,n,r),u=Qi(o,i);k(u,function(e){r.setElementWidth(e.element(),e.width())}),0<u.length&&r.setTableWidth(e,i,r.getCellDelta(0))},lu=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return lu(n())}}},fu=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return X("required",o),K(o),function(t){var n=j(t);L(o,function(e){return O(n,e)})||G(o,n),r(o,n);var e=A(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 ("+V(e).join(", ")+") were not.")}(e,i.label),t}},su=function(t,e){var n=A(e,function(e){return!O(t,e)});0<n.length&&Y(n)},du=function(e){return fu(su,e,{validate:v,label:"function"})},mu=du(["cell","row","replace","gap"]),gu=function(e){var t=ge(e,"colspan")?parseInt(me(e,"colspan"),10):1,n=ge(e,"rowspan")?parseInt(me(e,"rowspan"),10):1;return{element:C(e),colspan:C(t),rowspan:C(n)}},hu=function(r,o){void 0===o&&(o=gu),mu(r);var n=lu(R.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(R.some(t)),a=R.some({item:e,replacement:t}),t},a=R.none();return{getOrInit:function(t,n){return a.fold(function(){return u(t)},function(e){return n(t,e.item)?e.replacement:u(t)})},cursor:n.get}},pu=function(a,c){return function(r){var o=lu(R.none());mu(r);var i=[],u=function(e){var t={scope:a},n=r.replace(e,c,t);return i.push({item:e,sub:n}),o.get().isNone()&&o.set(R.some(n)),n};return{replaceOrInit:function(t,n){return(r=t,o=n,B(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}}},vu=function(n){mu(n);var e=lu(R.none());return{combine:function(t){return e.get().isNone()&&e.set(R.some(t)),function(){var e=n.cell({element:C(t),colspan:C(1),rowspan:C(1)});return Ae(e,"width"),Ae(t,"width"),e}},cursor:e.get}},bu=["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"],wu=function(e,t){var n=e.property().name(t);return O(bu,n)},yu=function(e,t){return O(["br","img","hr","input"],e.property().name(t))},xu=wu,Cu=function(e,t){var n=e.property().name(t);return O(["ol","ul"],n)},Ru=yu,Su=$n(),Tu=function(e){return xu(Su,e)},Du=function(e){return Cu(Su,e)},Ou=function(e){return Ru(Su,e)},Nu=function(e){var t,i=function(e){return"br"===oe(e)},n=function(o){return Sn(o).bind(function(n){var r=vt(n).map(function(e){return!!Tu(e)||!!Ou(e)&&"img"!==oe(e)}).getOr(!1);return gt(n).map(function(e){return!0===r||"li"===oe(t=e)||Kt(t,Du).isSome()||i(n)||Tu(e)&&!ft(o,e)?[]:[xe.fromTag("br")];var t})}).getOr([])},r=0===(t=_(e,function(e){var t=bt(e);return L(t,function(e){return i(e)||le(e)&&0===vn(e).trim().length})?[]:t.concat(n(e))})).length?[xe.fromTag("br")]:t;Ot(e[0]),Dt(e[0],r)},Eu=function(e){0===cn.cells(e).length&&Nt(e)},ku=q("grid","cursor"),Au=function(e,t,n){return Pu(e,t,n).orThunk(function(){return Pu(e,0,0)})},Pu=function(e,t,n){return R.from(e[t]).bind(function(e){return R.from(e.cells()[n]).bind(function(e){return R.from(e.element())})})},Iu=function(e,t,n){return ku(e,Pu(e,t,n))},Bu=function(e){return I(e,function(e,t){return N(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},Wu=function(e){return I(e,function(e,t){return N(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},Mu=function(e,t,n){var r=fn(e,n),o=mn.generate(r);return ui(o,t,!0)},_u=cu,Lu={insertRowBefore:fi(function(e,t,n,r){var o=t.row(),i=t.row(),u=Ni(e,i,o,n,r.getOrInit);return Iu(u,i,t.column())},si,y,y,hu),insertRowsBefore:fi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=Bu(t),a=I(u,function(e,t){return Ni(e,i,o,n,r.getOrInit)},e);return Iu(a,i,t[0].column())},mi,y,y,hu),insertRowAfter:fi(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=Ni(e,i,o,n,r.getOrInit);return Iu(u,i,t.column())},si,y,y,hu),insertRowsAfter:fi(function(e,t,n,r){var o=Bu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),a=I(o,function(e,t){return Ni(e,u,i,n,r.getOrInit)},e);return Iu(a,u,t[0].column())},mi,y,y,hu),insertColumnBefore:fi(function(e,t,n,r){var o=t.column(),i=t.column(),u=Ei(e,i,o,n,r.getOrInit);return Iu(u,t.row(),i)},si,_u,y,hu),insertColumnsBefore:fi(function(e,t,n,r){var o=Wu(t),i=o[0].column(),u=o[0].column(),a=I(o,function(e,t){return Ei(e,u,i,n,r.getOrInit)},e);return Iu(a,t[0].row(),u)},mi,_u,y,hu),insertColumnAfter:fi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=Ei(e,i,o,n,r.getOrInit);return Iu(u,t.row(),i)},si,_u,y,hu),insertColumnsAfter:fi(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=Wu(t),a=I(u,function(e,t){return Ei(e,i,o,n,r.getOrInit)},e);return Iu(a,t[0].row(),i)},mi,_u,y,hu),splitCellIntoColumns:fi(function(e,t,n,r){var o=ki(e,t.row(),t.column(),n,r.getOrInit);return Iu(o,t.row(),t.column())},si,_u,y,hu),splitCellIntoRows:fi(function(e,t,n,r){var o=Ai(e,t.row(),t.column(),n,r.getOrInit);return Iu(o,t.row(),t.column())},si,y,y,hu),eraseColumns:fi(function(e,t,n,r){var o=Wu(t),i=Ii(e,o[0].column(),o[o.length-1].column()),u=Au(i,t[0].row(),t[0].column());return ku(i,u)},mi,_u,Eu,hu),eraseRows:fi(function(e,t,n,r){var o=Bu(t),i=Pi(e,o[0].row(),o[o.length-1].row()),u=Au(i,t[0].row(),t[0].column());return ku(i,u)},mi,y,Eu,hu),makeColumnHeader:fi(function(e,t,n,r){var o=_i(e,t.column(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu("row","th")),unmakeColumnHeader:fi(function(e,t,n,r){var o=_i(e,t.column(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu(null,"td")),makeRowHeader:fi(function(e,t,n,r){var o=Li(e,t.row(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu("col","th")),unmakeRowHeader:fi(function(e,t,n,r){var o=Li(e,t.row(),n,r.replaceOrInit);return Iu(o,t.row(),t.column())},si,y,y,pu(null,"td")),mergeCells:fi(function(e,t,n,r){var o=t.cells();Nu(o);var i=Ri(e,t.bounds(),n,C(o[0]));return ku(i,R.from(o[0]))},function(e,t){return t.mergable()},y,y,vu),unmergeCells:fi(function(e,t,n,r){var o=P(t,function(e,t){return Si(e,t,n,r.combine(t))},e);return ku(o,R.from(t[0]))},function(e,t){return t.unmergable()},_u,y,vu),pasteCells:fi(function(e,n,t,r){var o,i,u,a,c=(o=n.clipboard(),i=n.generators(),u=ln(o),a=mn.generate(u),ui(a,i,!0)),l=At(n.row(),n.column());return Di(l,e,c,n.generators(),t).fold(function(){return ku(e,R.some(n.element()))},function(e){var t=Au(e,n.row(),n.column());return ku(e,t)})},function(t,n){return cn.cell(n.element()).bind(function(e){return li(t,e).map(function(e){return wo(wo({},e),{generators:n.generators,clipboard:n.clipboard})})})},_u,y,hu),pasteRowsBefore:fi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=Mu(t.clipboard(),t.generators(),o),a=Oi(i,e,u,t.generators(),n),c=Au(a,t.cells[0].row(),t.cells[0].column());return ku(a,c)},di,y,y,hu),pasteRowsAfter:fi(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=Mu(t.clipboard(),t.generators(),o),a=Oi(i,e,u,t.generators(),n),c=Au(a,t.cells[0].row(),t.cells[0].column());return ku(a,c)},di,y,y,hu)},Fu=function(e){return xe.fromDom(e.getBody())},ju=function(e){return e.getBoundingClientRect().width},zu=function(e){return e.getBoundingClientRect().height},Hu=function(t){return function(e){return ft(e,Fu(t))}},Uu=function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},qu=function(e){var t=qt(e,"td[data-mce-style],th[data-mce-style]");he(e,"data-mce-style"),k(t,function(e){he(e,"data-mce-style")})},Vu={isRtl:C(!1)},Gu={isRtl:C(!0)},Yu={directionAt:function(e){return"rtl"==("rtl"===Ne(e,"direction")?"rtl":"ltr")?Gu:Vu}},Xu=["tableprops","tabledelete","|","tableinsertrowbefore","tableinsertrowafter","tabledeleterow","|","tableinsertcolbefore","tableinsertcolafter","tabledeletecol"],Ku={"border-collapse":"collapse",width:"100%"},Ju={border:"1"},$u=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},Qu=function(e){return e.getParam("table_row_advtab",!0,"boolean")},Zu=function(e){return e.getParam("table_advtab",!0,"boolean")},ea=function(e){return e.getParam("table_style_by_css",!1,"boolean")},ta=function(e){return e.getParam("table_cell_class_list",[],"array")},na=function(e){return e.getParam("table_row_class_list",[],"array")},ra=function(e){return e.getParam("table_class_list",[],"array")},oa=function(e){return!1===e.getParam("table_responsive_width")},ia=function(e,t){return e.fire("newrow",{node:t})},ua=function(e,t){return e.fire("newcell",{node:t})},aa=function(e,t,n,r){e.fire("ObjectResizeStart",{target:t,width:n,height:r})},ca=function(e,t,n,r){e.fire("ObjectResized",{target:t,width:n,height:r})},la=function(f,e){var t,n=function(e){return"table"===oe(Fu(e))},s=(t=f.getParam("table_clone_elements"),d(t)?R.some(t.split(/[ ,]/)):Array.isArray(t)?R.some(t):R.none()),r=function(u,a,c,l){return function(e,t){qu(e);var n=l(),r=xe.fromDom(f.getDoc()),o=vo(Yu.directionAt),i=Bn(c,r,s);return a(e)?u(n,e,t,i,o).bind(function(e){return k(e.newRows(),function(e){ia(f,e.dom())}),k(e.newCells(),function(e){ua(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})}):R.none()}};return{deleteRow:r(Lu.eraseRows,function(e){var t=bo(e);return!1===n(f)||1<t.rows()},y,e),deleteColumn:r(Lu.eraseColumns,function(e){var t=bo(e);return!1===n(f)||1<t.columns()},y,e),insertRowsBefore:r(Lu.insertRowsBefore,u,y,e),insertRowsAfter:r(Lu.insertRowsAfter,u,y,e),insertColumnsBefore:r(Lu.insertColumnsBefore,u,Qr,e),insertColumnsAfter:r(Lu.insertColumnsAfter,u,Qr,e),mergeCells:r(Lu.mergeCells,u,y,e),unmergeCells:r(Lu.unmergeCells,u,y,e),pasteRowsBefore:r(Lu.pasteRowsBefore,u,y,e),pasteRowsAfter:r(Lu.pasteRowsAfter,u,y,e),pasteCells:r(Lu.pasteCells,u,y,e)}},fa=function(e,t,r){var n=ln(e),o=mn.generate(n);return mi(o,t).map(function(e){var t=ui(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=ci(t,r);return So(n)})},sa=tinymce.util.Tools.resolve("tinymce.util.Tools"),da=function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},ma=function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},ga=function(t,n){sa.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},ha=function(t,n){sa.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},pa=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))},va=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);i["border-style"]=o.borderStyle,i["border-color"]=o.borderColor,i["background-color"]=o.backgroundColor,i.width=o.width?Uu(o.width):"",i.height=o.height?Uu(o.height):"",r.find("#style").value(n.serializeStyle(n.parseStyle(n.serializeStyle(i))))},ba=function(e,t){var n=e.dom,r=t.control.rootControl,o=r.toJSON(),i=n.parseStyle(o.style);r.find("#borderStyle").value(i["border-style"]||""),r.find("#borderColor").value(i["border-color"]||""),r.find("#backgroundColor").value(i["background-color"]||""),r.find("#width").value(i.width||""),r.find("#height").value(i.height||"")},wa={createStyleForm:function(n){var e=function(){var e=n.getParam("color_picker_callback");if(e)return function(t){return e.call(n,function(e){t.control.value(e).fire("change")},t.control.value())}};return{title:"Advanced",type:"form",defaults:{onchange:b(va,n)},items:[{label:"Style",name:"style",type:"textbox",onchange:b(ba,n)},{type:"form",padding:0,formItemDefaults:{layout:"grid",alignH:["start","right"]},defaults:{size:7},items:[{label:"Border style",type:"listbox",name:"borderStyle",width:90,onselect:b(va,n),values:[{text:"Select...",value:""},{text:"Solid",value:"solid"},{text:"Dotted",value:"dotted"},{text:"Dashed",value:"dashed"},{text:"Double",value:"double"},{text:"Groove",value:"groove"},{text:"Ridge",value:"ridge"},{text:"Inset",value:"inset"},{text:"Outset",value:"outset"},{text:"None",value:"none"},{text:"Hidden",value:"hidden"}]},{label:"Border color",type:"colorbox",name:"borderColor",onaction:e()},{label:"Background color",type:"colorbox",name:"backgroundColor",onaction:e()}]}]}},buildListItems:function(e,r,t){var o=function(e,n){return n=n||[],sa.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||[])},updateStyleField:va,extractAdvancedStyles:function(e,t){var n=e.parseStyle(e.getAttrib(t,"style")),r={};return n["border-style"]&&(r.borderStyle=n["border-style"]),n["border-color"]&&(r.borderColor=n["border-color"]),n["background-color"]&&(r.backgroundColor=n["background-color"]),r.style=e.serializeStyle(n),r},updateAdvancedFields:ba,syncAdvancedStyleFields:function(e,t){t.control.rootControl.find("#style")[0].getEl().isEqualNode(m.document.activeElement)?ba(e,t):va(e,t)}},ya=function(r,o,e){var i,u=r.dom;function a(e,t,n){(1===o.length||n)&&u.setAttrib(e,t,n)}function c(e,t,n){(1===o.length||n)&&u.setStyle(e,t,n)}$u(r)&&wa.syncAdvancedStyleFields(r,e),i=e.control.rootControl.toJSON(),r.undoManager.transact(function(){sa.each(o,function(e){var t,n;a(e,"scope",i.scope),1===o.length?a(e,"style",i.style):(t=e,n=i.style,delete t.dataset.mceStyle,t.style.cssText+=";"+n),a(e,"class",i["class"]),c(e,"width",Uu(i.width)),c(e,"height",Uu(i.height)),i.type&&e.nodeName.toLowerCase()!==i.type&&(e=u.rename(e,i.type)),1===o.length&&(ga(r,e),ha(r,e)),i.align&&da(r,e,i.align),i.valign&&ma(r,e,i.valign)}),r.focus()})},xa=function(t){var e,n,r,o=[];if(o=t.dom.select("td[data-mce-selected],th[data-mce-selected]"),e=t.dom.getParent(t.selection.getStart(),"td,th"),!o.length&&e&&o.push(e),e=e||o[0]){var i,u,a,c;1<o.length?n={width:"",height:"",scope:"","class":"",align:"",valign:"",style:"",type:e.nodeName.toLowerCase()}:(u=e,a=(i=t).dom,c={width:a.getStyle(u,"width")||a.getAttrib(u,"width"),height:a.getStyle(u,"height")||a.getAttrib(u,"height"),scope:a.getAttrib(u,"scope"),"class":a.getAttrib(u,"class"),type:u.nodeName.toLowerCase(),style:"",align:"",valign:""},sa.each("left center right".split(" "),function(e){i.formatter.matchNode(u,"align"+e)&&(c.align=e)}),sa.each("top middle bottom".split(" "),function(e){i.formatter.matchNode(u,"valign"+e)&&(c.valign=e)}),$u(i)&&sa.extend(c,wa.extractAdvancedStyles(a,u)),n=c),0<ta(t).length&&(r={name:"class",type:"listbox",label:"Class",values:wa.buildListItems(ta(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"td",classes:[e.value]})})})});var l={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",layout:"grid",columns:2,labelGapCalc:!1,padding:0,defaults:{type:"textbox",maxWidth:50},items:[{label:"Width",name:"width",onchange:b(wa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(wa.updateStyleField,t)},{label:"Cell type",name:"type",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"Cell",value:"td"},{text:"Header cell",value:"th"}]},{label:"Scope",name:"scope",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Row",value:"row"},{text:"Column",value:"col"},{text:"Row group",value:"rowgroup"},{text:"Column group",value:"colgroup"}]},{label:"H Align",name:"align",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"V Align",name:"valign",type:"listbox",text:"None",minWidth:90,maxWidth:null,values:[{text:"None",value:""},{text:"Top",value:"top"},{text:"Middle",value:"middle"},{text:"Bottom",value:"bottom"}]}]},r]};$u(t)?t.windowManager.open({title:"Cell properties",bodyType:"tabpanel",data:n,body:[{title:"General",type:"form",items:l},wa.createStyleForm(t)],onsubmit:b(ya,t,o)}):t.windowManager.open({title:"Cell properties",data:n,body:l,onsubmit:b(ya,t,o)})}};function Ca(f,s,d,e){var m=f.dom;function g(e,t,n){(1===s.length||n)&&m.setAttrib(e,t,n)}Qu(f)&&wa.syncAdvancedStyleFields(f,e);var h=e.control.rootControl.toJSON();f.undoManager.transact(function(){sa.each(s,function(e){var t,n,r,o,i,u,a,c,l;g(e,"scope",h.scope),g(e,"style",h.style),g(e,"class",h["class"]),t=e,n="height",r=Uu(h.height),(1===s.length||r)&&m.setStyle(t,n,r),h.type!==e.parentNode.nodeName.toLowerCase()&&(o=f.dom,i=e,u=h.type,a=o.getParent(i,"table"),c=i.parentNode,(l=o.select(u,a)[0])||(l=o.create(u),a.firstChild?"CAPTION"===a.firstChild.nodeName?o.insertAfter(l,a.firstChild):a.insertBefore(l,a.firstChild):a.appendChild(l)),l.appendChild(i),c.hasChildNodes()||o.remove(c)),h.align!==d.align&&(ga(f,e),da(f,e,h.align))}),f.focus()})}var Ra=function(t){var e,n,r,o,i,u,a,c,l,f,s=t.dom,d=[];e=s.getParent(t.selection.getStart(),"table"),n=s.getParent(t.selection.getStart(),"td,th"),sa.each(e.rows,function(t){sa.each(t.cells,function(e){if(s.getAttrib(e,"data-mce-selected")||e===n)return d.push(t),!1})}),(r=d[0])&&(1<d.length?i={height:"",scope:"",style:"","class":"",align:"",type:r.parentNode.nodeName.toLowerCase()}:(c=r,l=(a=t).dom,f={height:l.getStyle(c,"height")||l.getAttrib(c,"height"),scope:l.getAttrib(c,"scope"),"class":l.getAttrib(c,"class"),align:"",style:"",type:c.parentNode.nodeName.toLowerCase()},sa.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),Qu(a)&&sa.extend(f,wa.extractAdvancedStyles(l,c)),i=f),0<na(t).length&&(o={name:"class",type:"listbox",label:"Class",values:wa.buildListItems(na(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})})}),u={type:"form",columns:2,padding:0,defaults:{type:"textbox"},items:[{type:"listbox",name:"type",label:"Row type",text:"Header",maxWidth:null,values:[{text:"Header",value:"thead"},{text:"Body",value:"tbody"},{text:"Footer",value:"tfoot"}]},{type:"listbox",name:"align",label:"Alignment",text:"None",maxWidth:null,values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},{label:"Height",name:"height"},o]},Qu(t)?t.windowManager.open({title:"Row properties",data:i,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},wa.createStyleForm(t)],onsubmit:b(Ca,t,d,i)}):t.windowManager.open({title:"Row properties",data:i,body:u,onsubmit:b(Ca,t,d,i)}))},Sa=tinymce.util.Tools.resolve("tinymce.Env"),Ta={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},Da=function(e,t,n,r,o){void 0===o&&(o=Ta);var i=xe.fromTag("table");Oe(i,o.styles),de(i,o.attributes);var u=xe.fromTag("tbody");Rt(i,u);for(var a=[],c=0;c<e;c++){for(var l=xe.fromTag("tr"),f=0;f<t;f++){var s=c<n||f<r?xe.fromTag("th"):xe.fromTag("td");f<r&&se(s,"scope","row"),c<n&&se(s,"scope","col"),Rt(s,xe.fromTag("br")),o.percentages&&De(s,"width",100/t+"%"),Rt(l,s)}a.push(l)}return Dt(u,a),i},Oa=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},Na=function(r,e,t){var n,o,i=r.getParam("table_default_styles",Ku,"object"),u={styles:i,attributes:(o=r,o.getParam("table_default_attributes",Ju,"object")),percentages:(n=i.width,d(n)&&-1!==n.indexOf("%")&&!oa(r))},a=Da(t,e,0,0,u);se(a,"data-mce-id","__mce");var c,l,f,s=(c=a,l=xe.fromTag("div"),f=xe.fromDom(c.dom().cloneNode(!0)),Rt(l,f),l.dom().innerHTML);return r.insertContent(s),Qt(Fu(r),'table[data-mce-id="__mce"]').map(function(e){var t,n;return oa(r)&&De(e,"width",Ne(e,"width")),he(e,"data-mce-id"),t=r,k(qt(e,"tr"),function(e){ia(t,e.dom()),k(qt(e,"th,td"),function(e){ua(t,e.dom())})}),n=r,Qt(e,"td,th").each(b(Oa,n)),e.dom()}).getOr(null)};function Ea(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)Ea(e,t.children[o],n,r)}var ka,Aa=function(e,t,n){var r,o,i=e.dom;Zu(e)&&wa.syncAdvancedStyleFields(e,n),!1===(o=n.control.rootControl.toJSON())["class"]&&delete o["class"],e.undoManager.transact(function(){t||(t=Na(e,o.cols||1,o.rows||1)),function(e,t,n){var r,o=e.dom,i={},u={};if(i["class"]=n["class"],u.height=Uu(n.height),o.getAttrib(t,"width")&&!ea(e)?i.width=(r=n.width)?r.replace(/px$/,""):"":u.width=Uu(n.width),ea(e)?(u["border-width"]=Uu(n.border),u["border-spacing"]=Uu(n.cellspacing),sa.extend(i,{"data-mce-border-color":n.borderColor,"data-mce-cell-padding":n.cellpadding,"data-mce-border":n.border})):sa.extend(i,{border:n.border,cellpadding:n.cellpadding,cellspacing:n.cellspacing}),ea(e)&&t.children)for(var a=0;a<t.children.length;a++)Ea(o,t.children[a],{"border-width":Uu(n.border),"border-color":n.borderColor,padding:Uu(n.cellpadding)});n.style?sa.extend(u,o.parseStyle(n.style)):u=sa.extend({},o.parseStyle(o.getAttrib(t,"style")),u),i.style=o.serializeStyle(u),o.setAttribs(t,i)}(e,t,o),(r=i.select("caption",t)[0])&&!o.caption&&i.remove(r),!r&&o.caption&&((r=i.create("caption")).innerHTML=Sa.ie?"\xa0":'<br data-mce-bogus="1"/>',t.insertBefore(r,t.firstChild)),ga(e,t),o.align&&da(e,t,o.align),e.focus(),e.addVisual()})},Pa=function(t,e){var n,r,o,i,u,a,c,l,f,s,d=t.dom,m={};!0===e?(n=d.getParent(t.selection.getStart(),"table"))&&(c=n,l=(a=t).dom,f={width:l.getStyle(c,"width")||l.getAttrib(c,"width"),height:l.getStyle(c,"height")||l.getAttrib(c,"height"),cellspacing:l.getStyle(c,"border-spacing")||l.getAttrib(c,"cellspacing"),cellpadding:l.getAttrib(c,"data-mce-cell-padding")||l.getAttrib(c,"cellpadding")||pa(a.dom,c,"padding"),border:l.getAttrib(c,"data-mce-border")||l.getAttrib(c,"border")||pa(a.dom,c,"border"),borderColor:l.getAttrib(c,"data-mce-border-color"),caption:!!l.select("caption",c)[0],"class":l.getAttrib(c,"class")},sa.each("left center right".split(" "),function(e){a.formatter.matchNode(c,"align"+e)&&(f.align=e)}),Zu(a)&&sa.extend(f,wa.extractAdvancedStyles(l,c)),m=f):(r={label:"Cols",name:"cols"},o={label:"Rows",name:"rows"}),0<ra(t).length&&(m["class"]&&(m["class"]=m["class"].replace(/\s*mce\-item\-table\s*/g,"")),i={name:"class",type:"listbox",label:"Class",values:wa.buildListItems(ra(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}),u={type:"form",layout:"flex",direction:"column",labelGapCalc:"children",padding:0,items:[{type:"form",labelGapCalc:!1,padding:0,layout:"grid",columns:2,defaults:{type:"textbox",maxWidth:50},items:(s=t,s.getParam("table_appearance_options",!0,"boolean")?[r,o,{label:"Width",name:"width",onchange:b(wa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(wa.updateStyleField,t)},{label:"Cell spacing",name:"cellspacing"},{label:"Cell padding",name:"cellpadding"},{label:"Border",name:"border"},{label:"Caption",name:"caption",type:"checkbox"}]:[r,o,{label:"Width",name:"width",onchange:b(wa.updateStyleField,t)},{label:"Height",name:"height",onchange:b(wa.updateStyleField,t)}])},{label:"Alignment",name:"align",type:"listbox",text:"None",values:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]},i]},Zu(t)?t.windowManager.open({title:"Table properties",data:m,bodyType:"tabpanel",body:[{title:"General",type:"form",items:u},wa.createStyleForm(t)],onsubmit:b(Aa,t,n)}):t.windowManager.open({title:"Table properties",data:m,body:u,onsubmit:b(Aa,t,n)})},Ia=sa.each,Ba=function(a,t,c,l,n){var r=Hu(a),e=function(e){return function(){return R.from(a.dom.getParent(a.selection.getStart(),e)).map(xe.fromDom)}},o=e("caption"),f=e("th,td"),s=function(e){return cn.table(e,r)},d=function(e){return{width:ju(e.dom()),height:ju(e.dom())}},i=function(n){f().each(function(t){s(t).each(function(i){var e=kr.forMenu(l,i,t),u=d(i);n(i,e).each(function(e){var t,n,r,o;t=a,n=u,o=d(r=i),n.width===o.width&&n.height===o.height||(aa(t,r.dom(),n.width,n.height),ca(t,r.dom(),o.width,o.height)),a.selection.setRng(e),a.focus(),c.clear(i),qu(i)})})})},u=function(e){return f().bind(function(o){return s(o).bind(function(e){var t=xe.fromDom(a.getDoc()),n=kr.forMenu(l,e,o),r=Bn(y,t,R.none());return fa(e,n,r)})})},m=function(u){n.get().each(function(e){var i=E(e,function(e){return Nn(e)});f().each(function(o){s(o).each(function(t){var e=xe.fromDom(a.getDoc()),n=Wn(e),r=kr.pasteRows(l,t,o,i,n);u(t,r).each(function(e){a.selection.setRng(e),a.focus(),c.clear(t)})})})})};Ia({mceTableSplitCells:function(){i(t.unmergeCells)},mceTableMergeCells:function(){i(t.mergeCells)},mceTableInsertRowBefore:function(){i(t.insertRowsBefore)},mceTableInsertRowAfter:function(){i(t.insertRowsAfter)},mceTableInsertColBefore:function(){i(t.insertColumnsBefore)},mceTableInsertColAfter:function(){i(t.insertColumnsAfter)},mceTableDeleteCol:function(){i(t.deleteColumn)},mceTableDeleteRow:function(){i(t.deleteRow)},mceTableCutRow:function(e){n.set(u()),i(t.deleteRow)},mceTableCopyRow:function(e){n.set(u())},mceTablePasteRowBefore:function(e){m(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){m(t.pasteRowsAfter)},mceTableDelete:function(){f().orThunk(o).each(function(e){cn.table(e,r).filter(g(r)).each(function(e){var t=xe.fromText("");xt(e,t),Nt(e);var n=a.dom.createRng();n.setStart(t.dom(),0),n.setEnd(t.dom(),0),a.selection.setRng(n)})})}},function(e,t){a.addCommand(t,e)}),Ia({mceInsertTable:b(Pa,a),mceTableProps:b(Pa,a,!0),mceTableRowProps:b(Ra,a),mceTableCellProps:b(xa,a)},function(n,e){a.addCommand(e,function(e,t){n(t)})})},Wa=function(e){var t=R.from(e.dom().documentElement).map(xe.fromDom).getOr(e);return{parent:C(t),view:C(e),origin:C(eo(0,0))}},Ma=function(e,t){return{parent:C(t),view:C(e),origin:C(eo(0,0))}},_a=function(e){var r=q.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=A(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);k(o,function(e){e(n)})}}},La={create:function(e){return{registry:H(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:H(e,function(e){return e.trigger})}}},Fa=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,a,c=xe.fromDom(e.target),l=function(){e.stopPropagation()},f=function(){e.preventDefault()},s=x(f,l),d=(t=c,n=e.clientX,r=e.clientY,o=l,i=f,u=s,a=e,{target:C(t),x:C(n),y:C(r),stop:o,prevent:i,kill:u,raw:C(a)});g(d)}}},ja=function(e,t,n,r){return o=e,i=t,u=!1,a=Fa(n,r),o.dom().addEventListener(i,a,u),{unbind:b(za,o,i,a,u)};var o,i,u,a},za=function(e,t,n,r){e.dom().removeEventListener(t,n,r)},Ha=C(!0),Ua=function(e,t,n){return ja(e,t,Ha,n)},qa=Object.prototype.hasOwnProperty,Va=(ka=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)qa.call(o,i)&&(n[i]=ka(n[i],o[i]))}return n}),Ga={resolve:_o("ephox-dragster").resolve},Ya=du(["compare","extract","mutate","sink"]),Xa=du(["element","start","stop","destroy"]),Ka=du(["forceDrop","drop","move","delayDrop"]),Ja=Ya({compare:function(e,t){return eo(t.left()-e.left(),t.top()-e.top())},extract:function(e){return R.some(eo(e.x(),e.y()))},sink:function(e,t){var n,r,o,i=(n=t,r=Va({layerClass:Ga.resolve("blocker")},n),o=xe.fromTag("div"),se(o,"role","presentation"),Oe(o,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Eo(o,Ga.resolve("blocker")),Eo(o,r.layerClass),{element:function(){return o},destroy:function(){Nt(o)}}),u=Ua(i.element(),"mousedown",e.forceDrop),a=Ua(i.element(),"mouseup",e.drop),c=Ua(i.element(),"mousemove",e.move),l=Ua(i.element(),"mouseout",e.delayDrop);return Xa({element:i.element,start:function(e){Rt(e,i.element())},stop:function(){Nt(i.element())},destroy:function(){i.destroy(),a.unbind(),c.unbind(),l.unbind(),u.unbind()}})},mutate:function(e,t){e.mutate(t.left(),t.top())}});function $a(){var i=R.none(),u=La.create({move:_a(["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=R.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=R.none()},events:u.registry}}function Qa(){var e={onEvent:y,reset:y},t=$a(),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 Za=function(t,n,e){var r,o,i,u=!1,a=La.create({start:_a([]),stop:_a([])}),c=Qa(),l=function(){d.stop(),c.isOn()&&(c.off(),a.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)}});c.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(Ka({forceDrop:l,drop:s(l),move:s(function(e){f.cancel(),c.onEvent(e,n)}),delayDrop:s(f.throttle)}),e);return{element:d.element,go:function(e){d.start(e),c.on(),a.trigger.start()},on:function(){u=!0},off:function(){u=!1},destroy:function(){d.destroy()},events:a.registry}},ec=function(e,t){void 0===t&&(t={});var n=t.mode!==undefined?t.mode:Ja;return Za(e,n,t)},tc=function(){var n,r=La.create({drag:_a(["xDelta","yDelta","target"])}),o=R.none(),e={mutate:function(e,t){n.trigger.drag(e,t)},events:(n=La.create({drag:_a(["xDelta","yDelta"])})).registry};return e.events.drag.bind(function(t){o.each(function(e){r.trigger.drag(t.xDelta(),t.yDelta(),e)})}),{assign:function(e){o=R.some(e)},get:function(){return o},mutate:e.mutate,events:r.registry}},nc=function(e){return"true"===me(e,"contenteditable")},rc=Lo.resolve("resizer-bar-dragging"),oc=function(o,t,i){var n=tc(),r=ec(n,{}),u=R.none(),e=function(e,t){return R.from(me(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=Ui.getInt(n.target(),"top");De(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=Ui.getInt(n.target(),"left");De(n.target(),"left",t+n.xDelta()+"px")})});var a=function(e,t){return Ui.getInt(e,t)-parseInt(me(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=a(r,"top");he(r,"data-initial-top"),m.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=a(r,"left");he(r,"data-initial-left"),m.trigger.adjustWidth(n,t,parseInt(e,10))}),Xo(o,n,i,t)})})});var c=function(e,t){m.trigger.startAdjust(),n.assign(e),se(e,"data-initial-"+t,parseInt(Ne(e,t),10)),Eo(e,rc),De(e,"opacity","0.2"),r.go(o.parent())},l=Ua(o.parent(),"mousedown",function(e){Qo(e.target())&&c(e.target(),"top"),Zo(e.target())&&c(e.target(),"left")}),f=function(e){return ft(e,o.view())},s=function(e){return Zt(e,"table",f).filter(function(e){return(t=e,n=f,Zt(t,"[contenteditable]",n)).exists(nc);var t,n})},d=Ua(o.view(),"mouseover",function(e){s(e.target()).fold(function(){Ce(e.target())&&$o(o)},function(e){u=R.some(e),Xo(o,e,i,t)})}),m=La.create({adjustHeight:_a(["table","delta","row"]),adjustWidth:_a(["table","delta","column"]),startAdjust:_a([])});return{destroy:function(){l.unbind(),d.unbind(),r.destroy(),$o(o)},refresh:function(e){Xo(o,e,i,t)},on:r.on,off:r.off,hideBars:b(Ko,o),showBars:b(Jo,o),events:m.registry}},ic=function(e,n){var r=ho.height,t=oc(e,n,r),o=La.create({beforeResize:_a(["table"]),afterResize:_a(["table"]),startDrag:_a([])});return t.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());au(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());uu(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}},uc=function(e,t){return e.inline?Ma(Fu(e),(n=xe.fromTag("div"),Oe(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),Rt(Re(),n),n)):Wa(xe.fromDom(e.getDoc()));var n},ac=function(e,t){e.inline&&Nt(t.parent())},cc=function(u){var a,c,o=R.none(),i=R.none(),l=R.none(),f=/(\d+(\.\d+)?)%/,s=function(e){return"TABLE"===e.nodeName};return u.on("init",function(){var e,t=vo(Yu.directionAt),n=uc(u);if(l=R.some(n),("table"===(e=u.getParam("object_resizing",!0))||e)&&u.getParam("table_resize_bars",!0,"boolean")){var r=ic(n,t);r.on(),r.events.startDrag.bind(function(e){o=R.some(u.selection.getRng())}),r.events.beforeResize.bind(function(e){var t=e.table().dom();aa(u,t,ju(t),zu(t))}),r.events.afterResize.bind(function(e){var t=e.table(),n=t.dom();qu(t),o.each(function(e){u.selection.setRng(e),u.focus()}),ca(u,n,ju(n),zu(n)),u.undoManager.add()}),i=R.some(r)}}),u.on("ObjectResizeStart",function(e){var t,n=e.target;s(n)&&(a=e.width,t=n,c=u.dom.getStyle(t,"width")||u.dom.getAttrib(t,"width"))}),u.on("ObjectResized",function(e){var t=e.target;if(s(t)){var n=t;if(f.test(c)){var r=parseFloat(f.exec(c)[1]),o=e.width*r/a;u.dom.setStyle(n,"width",o+"%")}else{var i=[];sa.each(n.rows,function(e){sa.each(e.cells,function(e){var t=u.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),sa.each(i,function(e){u.dom.setStyle(e.cell,"width",e.width),u.dom.setAttrib(e.cell,"width",null)})}}}),{lazyResize:function(){return i},lazyWire:function(){return l.getOr(Wa(xe.fromDom(u.getBody())))},destroy:function(){i.each(function(e){e.destroy()}),l.each(function(e){ac(u,e)})}}},lc=xr([{none:["current"]},{first:["current"]},{middle:["current","target"]},{last:["current"]}]),fc=wo(wo({},lc),{none:function(e){return void 0===e&&(e=undefined),lc.none(e)}}),sc=function(n,e){return cn.table(n,e).bind(function(e){var t=cn.cells(e);return W(t,function(e){return ft(n,e)}).map(function(e){return{index:C(e),all:C(t)}})})},dc=function(t,e){return sc(t,e).fold(function(){return fc.none(t)},function(e){return e.index()+1<e.all().length?fc.middle(t,e.all()[e.index()+1]):fc.last(t)})},mc=function(t,e){return sc(t,e).fold(function(){return fc.none()},function(e){return 0<=e.index()-1?fc.middle(t,e.all()[e.index()-1]):fc.first(t)})},gc={create:q("start","soffset","finish","foffset")},hc=xr([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),pc={before:hc.before,on:hc.on,after:hc.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(o,o,o)}},vc=xr([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),bc={domRange:vc.domRange,relative:vc.relative,exact:vc.exact,exactFromRange:function(e){return vc.exact(e.start(),e.soffset(),e.finish(),e.foffset())},getWin:function(e){var t,n=e.match({domRange:function(e){return xe.fromDom(e.startContainer)},relative:function(e,t){return pc.getStart(e)},exact:function(e,t,n,r){return e}});return t=n,xe.fromDom(t.dom().ownerDocument.defaultView)},range:gc.create},wc=function(e,t){e.selectNodeContents(t.dom())},yc=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},xc=function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},Cc=function(e){return{left:C(e.left),top:C(e.top),right:C(e.right),bottom:C(e.bottom),width:C(e.width),height:C(e.height)}},Rc=xr([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),Sc=function(e,t,n){return t(xe.fromDom(n.startContainer),n.startOffset,xe.fromDom(n.endContainer),n.endOffset)},Tc=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:C(e),rtl:R.none}},relative:function(e,t){return{ltr:we(function(){return yc(o,e,t)}),rtl:we(function(){return R.some(yc(o,t,e))})}},exact:function(e,t,n,r){return{ltr:we(function(){return xc(o,e,t,n,r)}),rtl:we(function(){return R.some(xc(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return Rc.rtl(xe.fromDom(e.endContainer),e.endOffset,xe.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return Sc(0,Rc.ltr,r)}):Sc(0,Rc.ltr,r)},Dc=function(i,e){return Tc(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}})},Oc=function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom},Nc=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=vn(r).length,a=function(e,t,n,r,o){if(0===o)return 0;if(t===r)return o-1;for(var i=r,u=1;u<o;u++){var a=e(u),c=Math.abs(t-a.left);if(n<=a.bottom){if(n<a.top||i<c)return u-1;i=c}}return 0}(function(e){return i(e).getBoundingClientRect()},e,t,o.right,u);return i(a)},Ec=function(e,t,n,r){return le(t)?function(t,n,r,o){var e=t.dom().createRange();e.selectNode(n.dom());var i=e.getClientRects();return xo(i,function(e){return Oc(e,r,o)?R.some(e):R.none()}).map(function(e){return Nc(t,n,r,o,e)})}(e,t,n,r):(i=t,u=n,a=r,c=(o=e).dom().createRange(),l=bt(i),xo(l,function(e){return c.selectNode(e.dom()),Oc(c.getBoundingClientRect(),u,a)?Ec(o,e,u,a):R.none()}));var o,i,u,a,c,l},kc=function(e,t){return t-e.left<e.right-t},Ac=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},Pc=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=kc(o,n);return(!0===i?Rn:Sn)(e).map(function(e){return Ac(t,e,i)})},Ic=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=kc(r,n);return R.some(Ac(e,t,o))},Bc=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)),a=Math.max(i.top,Math.min(i.bottom,r));return Ec(e,t,u,a)}(e,t,Math.max(i.left,Math.min(i.right,n)),Math.max(i.top,Math.min(i.bottom,r)))},Wc=document.caretPositionFromPoint?function(n,e,t){return R.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return R.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),R.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return R.from(e.dom().caretRangeFromPoint(t,n))}:function(o,i,t){return xe.fromPoint(o,i,t).bind(function(r){var e=function(){return e=o,n=i,(0===bt(t=r).length?Ic:Pc)(e,t,n);var e,t,n};return 0===bt(r).length?e():Bc(o,r,i,t).orThunk(e)})},Mc=function(e,t){var n=oe(e);return"input"===n?pc.after(e):O(["br","img"],n)?0===t?pc.before(e):pc.after(e):pc.on(e,t)},_c=function(e,t){var n=e.fold(pc.before,Mc,pc.after),r=t.fold(pc.before,Mc,pc.after);return bc.relative(n,r)},Lc=function(e,t,n,r){var o=Mc(e,t),i=Mc(n,r);return bc.relative(o,i)},Fc=function(e,t,n,r){var o,i,u,a,c,l=(i=t,u=n,a=r,(c=mt(o=e).dom().createRange()).setStart(o.dom(),i),c.setEnd(u.dom(),a),c),f=ft(e,n)&&t===r;return l.collapsed&&!f},jc=function(e,t){R.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},zc=function(e,t,n,r,o){var i=xc(e,t,n,r,o);jc(e,i)},Hc=function(s,e){return Tc(s,e).match({ltr:function(e,t,n,r){zc(s,e,t,n,r)},rtl:function(e,t,n,r){var o,i,u,a,c,l=s.getSelection();if(l.setBaseAndExtent)l.setBaseAndExtent(e.dom(),t,n.dom(),r);else if(l.extend)try{i=e,u=t,a=n,c=r,(o=l).collapse(i.dom(),u),o.extend(a.dom(),c)}catch(f){zc(s,n,r,e,t)}else zc(s,n,r,e,t)}})},Uc=function(e){var o=bc.getWin(e).dom(),t=function(e,t,n,r){return xc(o,e,t,n,r)},n=e.match({domRange:function(e){var t=xe.fromDom(e.startContainer),n=xe.fromDom(e.endContainer);return Lc(t,e.startOffset,n,e.endOffset)},relative:_c,exact:Lc});return Tc(o,n).match({ltr:t,rtl:t})},qc=function(e){var t=xe.fromDom(e.anchorNode),n=xe.fromDom(e.focusNode);return Fc(t,e.anchorOffset,n,e.focusOffset)?R.some(gc.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 R.some(gc.create(xe.fromDom(t.startContainer),t.startOffset,xe.fromDom(n.endContainer),n.endOffset))}return R.none()}(e)},Vc=function(e,t){var n,r,o=(n=t,r=e.document.createRange(),wc(r,n),r);jc(e,o)},Gc=function(e){return(t=e,R.from(t.getSelection()).filter(function(e){return 0<e.rangeCount}).bind(qc)).map(function(e){return bc.exact(e.start(),e.soffset(),e.finish(),e.foffset())});var t},Yc=function(e,t){var n,r,o,i=Dc(e,t);return r=(n=i).getClientRects(),0<(o=0<r.length?r[0]:n.getBoundingClientRect()).width||0<o.height?R.some(o).map(Cc):R.none()},Xc=function(e,t,n){return r=e,o=t,i=n,u=xe.fromDom(r.document),Wc(u,o,i).map(function(e){return gc.create(xe.fromDom(e.startContainer),e.startOffset,xe.fromDom(e.endContainer),e.endOffset)});var r,o,i,u},Kc=tinymce.util.Tools.resolve("tinymce.util.VK"),Jc=function(e,t,n,r){return el(e,t,dc(n),r)},$c=function(e,t,n,r){return el(e,t,mc(n),r)},Qc=function(e,t){var n=bc.exact(t,0,t,0);return Uc(n)},Zc=function(e,t){var n,r=qt(t,"tr");return(n=r,0===n.length?R.none():R.some(n[n.length-1])).bind(function(e){return Qt(e,"td,th").map(function(e){return Qc(0,e)})})},el=function(r,e,t,o,n){return t.fold(R.none,R.none,function(e,t){return Rn(t).map(function(e){return Qc(0,e)})},function(n){return cn.table(n,e).bind(function(e){var t=kr.noMenu(n);return r.undoManager.transact(function(){o.insertRowsAfter(e,t)}),Zc(0,e)})})},tl=["table","li","dl"],nl=function(t,n,r,o){if(t.keyCode===Kc.TAB){var i=Fu(n),u=function(e){var t=oe(e);return ft(e,i)||O(tl,t)},e=n.selection.getRng();if(e.collapsed){var a=xe.fromDom(e.startContainer);cn.cell(a,u).each(function(e){t.preventDefault(),(t.shiftKey?$c:Jc)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}},rl={create:q("selection","kill")},ol=function(e,t,n,r){return{start:C(pc.on(e,t)),finish:C(pc.on(n,r))}},il={convertToRange:function(e,t){var n=Dc(e,t);return gc.create(xe.fromDom(n.startContainer),n.startOffset,xe.fromDom(n.endContainer),n.endOffset)},makeSitus:ol},ul=function(n,e,r,t,o){return ft(r,t)?R.none():sr(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),R.some(rl.create(R.some(il.makeSitus(r,0,r,yn(r))),!0))):R.none()})},al={sync:function(n,r,e,t,o,i,u){return ft(e,o)&&t===i?R.none():Zt(e,"td,th",r).bind(function(t){return Zt(o,"td,th",r).bind(function(e){return ul(n,r,t,e,u)})})},detect:ul,update:function(e,t,n,r,o){return mr(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()})}},cl=q("item","mode"),ll=function(e,t,n,r){return void 0===r&&(r=fl),e.property().parent(t).map(function(e){return cl(e,r)})},fl=function(e,t,n,r){return void 0===r&&(r=sl),n.sibling(e,t).map(function(e){return cl(e,r)})},sl=function(e,t,n,r){void 0===r&&(r=sl);var o=e.property().children(t);return n.first(o).map(function(e){return cl(e,r)})},dl=[{current:ll,next:fl,fallback:R.none()},{current:fl,next:sl,fallback:R.some(ll)},{current:sl,next:sl,fallback:R.some(fl)}],ml=function(t,n,r,o,e){return void 0===e&&(e=dl),B(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 ml(t,n,e,o)})})})},gl=function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?R.some(e[e.length-1]):R.none()}}},hl=function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?R.some(e[0]):R.none()}}},pl=function(t,e,n,r,o,i){return ml(t,e,r,o).bind(function(e){return i(e.item())?R.none():n(e.item())?R.some(e.item()):pl(t,e.item(),n,e.mode(),o,i)})},vl=function(t){return function(e){return 0===t.property().children(e).length}},bl=function(e,t,n,r){return pl(e,t,n,fl,gl(),r)},wl=function(e,t,n,r){return pl(e,t,n,fl,hl(),r)},yl=$n(),xl=function(e,t){return r=t,bl(n=yl,e,vl(n),r);var n,r},Cl=function(e,t){return r=t,wl(n=yl,e,vl(n),r);var n,r},Rl=q("element","offset"),Sl=(q("element","deltaOffset"),q("element","start","finish"),q("begin","end"),q("element","text"),xr([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}])),Tl=function(e){return Zt(e,"tr")},Dl=wo(wo({},Sl),{verify:function(a,e,t,n,r,c,o){return Zt(n,"td,th",o).bind(function(u){return Zt(e,"td,th",o).map(function(i){return ft(u,i)?ft(n,u)&&yn(u)===r?c(i):Sl.none("in same cell"):ar.sharedOne(Tl,[u,i]).fold(function(){return t=i,n=u,r=(e=a).getRect(t),(o=e.getRect(n)).right>r.left&&o.left<r.right?Sl.success():c(i);var e,t,n,r,o},function(e){return c(i)})})}).getOr(Sl.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)}}),Ol=(q("ancestor","descendants","element","index"),q("parent","children","element","index")),Nl=function(e,t){return W(e,b(ft,t))},El=function(e){return"br"===oe(e)},kl=function(e,t,n){return t(e,n).bind(function(e){return le(e)&&0===vn(e).trim().length?kl(e,t,n):R.some(e)})},Al=function(t,e,n,r){return(o=e,i=n,wt(o,i).filter(El).orThunk(function(){return wt(o,i-1).filter(El)})).bind(function(e){return r.traverse(e).fold(function(){return kl(e,r.gather,t).map(r.relative)},function(e){return(r=e,gt(r).bind(function(t){var n=bt(t);return Nl(n,r).map(function(e){return Ol(t,n,r,e)})})).map(function(e){return pc.on(e.parent(),e.index())});var r})});var o,i},Pl=function(e,t,n,r){var o,i,u;return(El(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return kl(i,u.gather,o)}).map(u.relative)):Al(e,t,n,r)).map(function(e){return{start:C(e),finish:C(e)}})},Il=function(e){return Dl.cata(e,function(e){return R.none()},function(){return R.none()},function(e){return R.some(Rl(e,0))},function(e){return R.some(Rl(e,yn(e)))})},Bl=J(["left","top","right","bottom"],[]),Wl={nu:Bl,moveUp:function(e,t){return Bl({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return Bl({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 Bl({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return Bl({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 Bl({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()+")"}},Ml=function(e){return Wl.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},_l=function(e,t){return R.some(e.getRect(t))},Ll=function(e,t,n){return ce(t)?_l(e,t).map(Ml):le(t)?(r=e,o=t,i=n,0<=i&&i<yn(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):R.none()).map(Ml):R.none();var r,o,i},Fl=function(e,t){return ce(t)?_l(e,t).map(Ml):le(t)?e.getRangedRect(t,0,t,yn(t)).map(Ml):R.none()},jl=xr([{none:[]},{retry:["caret"]}]),zl=function(t,e,r){return(n=e,o=Tu,Vt(function(e,t){return t(e)},Kt,n,o,i)).fold(C(!1),function(e){return Fl(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},Hl={point:Wl.getTop,adjuster:function(e,t,n,r,o){var i=Wl.moveUp(o,5);return Math.abs(n.top()-r.top())<1?jl.retry(i):n.bottom()<o.top()?jl.retry(i):n.bottom()===o.top()?jl.retry(Wl.moveUp(o,1)):zl(e,t,o)?jl.retry(Wl.translate(i,5,0)):jl.none()},move:Wl.moveUp,gather:xl},Ul={point:Wl.getBottom,adjuster:function(e,t,n,r,o){var i=Wl.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?jl.retry(i):n.top()>o.bottom()?jl.retry(i):n.top()===o.bottom()?jl.retry(Wl.moveDown(o,1)):zl(e,t,o)?jl.retry(Wl.translate(i,5,0)):jl.none()},move:Wl.moveDown,gather:Cl},ql=function(n,r,o,i,u){return 0===u?R.some(i):(c=n,l=i.left(),f=r.point(i),c.elementFromPoint(l,f).filter(function(e){return"table"===oe(e)}).isSome()?(t=i,a=u-1,ql(n,e=r,o,e.move(t,5),a)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(R.none,function(t){return Fl(n,t).bind(function(e){return r.adjuster(n,t,e,o,i).fold(R.none,function(e){return ql(n,r,o,e,u-1)})}).orThunk(function(){return R.some(i)})},R.none)}));var e,t,a,c,l,f},Vl=function(t,n,e){var r,o,i,u=t.move(e,5),a=ql(n,t,e,u,100).getOr(u);return(r=t,o=a,i=n,r.point(o)>i.getInnerHeight()?R.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?R.some(-r.point(o)):R.none()).fold(function(){return n.situsFromPoint(a.left(),t.point(a))},function(e){return n.scrollBy(0,e),n.situsFromPoint(a.left(),t.point(a)-e)})},Gl={tryUp:b(Vl,Hl),tryDown:b(Vl,Ul),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:C(5)},Yl=it.detect(),Xl=function(r,o,i,u,a,c){return 0===c?R.none():$l(r,o,i,u,a).bind(function(e){var t=r.fromSitus(e),n=Dl.verify(r,i,u,t.finish(),t.foffset(),a.failure,o);return Dl.cata(n,function(){return R.none()},function(){return R.some(e)},function(e){return ft(i,e)&&0===u?Kl(r,i,u,Wl.moveUp,a):Xl(r,o,e,0,a,c-1)},function(e){return ft(i,e)&&u===yn(e)?Kl(r,i,u,Wl.moveDown,a):Xl(r,o,e,yn(e),a,c-1)})})},Kl=function(t,e,n,r,o){return Ll(t,e,n).bind(function(e){return Jl(t,o,r(e,Gl.getJumpSize()))})},Jl=function(e,t,n){return Yl.browser.isChrome()||Yl.browser.isSafari()||Yl.browser.isFirefox()||Yl.browser.isEdge()?t.otherRetry(e,n):Yl.browser.isIE()?t.ieRetry(e,n):R.none()},$l=function(t,e,n,r,o){return Ll(t,n,r).bind(function(e){return Jl(t,o,e)})},Ql=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return Pl(i,r.finish(),r.foffset(),u).fold(function(){return R.some(Rl(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=Dl.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return Il(n)})})).bind(function(e){return Xl(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},Zl=it.detect(),ef=function(e,t){return Kt(e,function(e){return gt(e).exists(function(e){return ft(e,t)})},n).isSome();var n},tf=function(t,r,o,e,i){return Zt(e,"td,th",r).bind(function(n){return Zt(n,"table",r).bind(function(e){return ef(i,e)?Ql(t,r,o).bind(function(t){return Zt(t.finish(),"td,th",r).map(function(e){return{start:C(n),finish:C(e),range:C(t)}})}):R.none()})})},nf=function(e,t,n,r,o,i){return Zl.browser.isIE()?R.none():i(r,t).orThunk(function(){return tf(e,t,n,r,o).map(function(e){var t=e.range();return rl.create(R.some(il.makeSitus(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},rf=function(e,t,n,r,o,i,u){return tf(e,n,r,o,i).bind(function(e){return al.detect(t,n,e.start(),e.finish(),u)})},of=function(e,u){return Zt(e,"tr",u).bind(function(i){return Zt(i,"table",u).bind(function(e){var t,n,r,o=qt(e,"tr");return ft(i,o[0])?(t=e,n=function(e){return Sn(e).isSome()},r=u,bl(yl,t,n,r)).map(function(e){var t=yn(e);return rl.create(R.some(il.makeSitus(e,t,e,t)),!0)}):R.none()})})},uf=function(e,u){return Zt(e,"tr",u).bind(function(i){return Zt(i,"table",u).bind(function(e){var t,n,r,o=qt(e,"tr");return ft(i,o[o.length-1])?(t=e,n=function(e){return Rn(e).isSome()},r=u,wl(yl,t,n,r)).map(function(e){return rl.create(R.some(il.makeSitus(e,0,e,0)),!0)}):R.none()})})},af=function(e,t){return Zt(e,"td,th",t)},cf={down:{traverse:vt,gather:Cl,relative:pc.before,otherRetry:Gl.tryDown,ieRetry:Gl.ieTryDown,failure:Dl.failedDown},up:{traverse:pt,gather:xl,relative:pc.before,otherRetry:Gl.tryUp,ieRetry:Gl.ieTryUp,failure:Dl.failedUp}},lf=function(t){return function(e){return e===t}},ff=lf(38),sf=lf(40),df={ltr:{isBackward:lf(37),isForward:lf(39)},rtl:{isBackward:lf(39),isForward:lf(37)},isUp:ff,isDown:sf,isNavigation:function(e){return 37<=e&&e<=40}},mf=function(e){return{left:e.left(),top:e.top(),right:e.right(),bottom:e.bottom(),width:e.width(),height:e.height()}},gf=(it.detect().browser.isSafari(),function(a){return{elementFromPoint:function(e,t){return xe.fromPoint(xe.fromDom(a.document),e,t)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=bc.exact(e,t,n,r);return Yc(a,o).map(mf)},getSelection:function(){return Gc(a).map(function(e){return il.convertToRange(a,e)})},fromSitus:function(e){var t=bc.relative(e.start(),e.finish());return il.convertToRange(a,t)},situsFromPoint:function(e,t){return Xc(a,e,t).map(function(e){return ol(e.start(),e.soffset(),e.finish(),e.foffset())})},clearSelection:function(){a.getSelection().removeAllRanges()},setSelection:function(e){var t,n,r,o,i,u;t=a,n=e.start(),r=e.soffset(),o=e.finish(),i=e.foffset(),u=Lc(n,r,o,i),Hc(t,u)},setRelativeSelection:function(e,t){var n,r;n=a,r=_c(e,t),Hc(n,r)},selectContents:function(e){Vc(a,e)},getInnerHeight:function(){return a.innerHeight},getScrollY:function(){var e,t,n,r;return(e=xe.fromDom(a.document),t=e!==undefined?e.dom():m.document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop,eo(n,r)).top()},scrollBy:function(e,t){var n,r,o;n=e,r=t,((o=xe.fromDom(a.document))!==undefined?o.dom():m.document).defaultView.scrollBy(n,r)}}}),hf=q("rows","cols"),pf={mouse:function(e,t,n,r){var o,i,u,a,c,l,f=gf(e),s=(o=f,i=t,u=n,a=r,c=R.none(),l=function(){c=R.none()},{mousedown:function(e){a.clear(i),c=af(e.target(),u)},mouseover:function(e){c.each(function(r){a.clear(i),af(e.target(),u).each(function(n){sr(r,n,u).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!ft(r,n))&&(a.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(e){c.each(l)}});return{mousedown:s.mousedown,mouseover:s.mouseover,mouseup:s.mouseup}},keyboard:function(e,l,f,s){var d=gf(e),m=function(){return s.clear(l),R.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw(),a=u.which,c=!0===u.shiftKey;return dr(l,s.selectedSelector()).fold(function(){return df.isDown(a)&&c?b(rf,d,l,f,cf.down,r,t,s.selectRange):df.isUp(a)&&c?b(rf,d,l,f,cf.up,r,t,s.selectRange):df.isDown(a)?b(nf,d,f,cf.down,r,t,uf):df.isUp(a)?b(nf,d,f,cf.up,r,t,of):R.none},function(t){var e=function(e){return function(){return xo(e,function(e){return al.update(e.rows(),e.cols(),l,t,s)}).fold(function(){return gr(l,s.firstSelectedSelector(),s.lastSelectedSelector()).map(function(e){var t=df.isDown(a)||i.isForward(a)?pc.after:pc.before;return d.setRelativeSelection(pc.on(e.first(),0),t(e.table())),s.clear(l),rl.create(R.none(),!0)})},function(e){return R.some(rl.create(R.none(),!0))})}};return df.isDown(a)&&c?e([hf(1,0)]):df.isUp(a)&&c?e([hf(-1,0)]):i.isBackward(a)&&c?e([hf(0,-1),hf(-1,0)]):i.isForward(a)&&c?e([hf(0,1),hf(1,0)]):df.isNavigation(a)&&!1===c?m:R.none})()},keyup:function(n,r,o,i,u){return dr(l,s.selectedSelector()).fold(function(){var e=n.raw(),t=e.which;return 0==(!0===e.shiftKey)?R.none():df.isNavigation(t)?al.sync(l,f,r,o,i,u,s.selectRange):R.none()},R.none)}}}},vf=function(r,e){k(e,function(e){var t,n;n=e,Do(t=r)?t.dom().classList.remove(n):No(t,n),ko(t)})},bf={byClass:function(o){var t,n,i=(t=o.selected(),function(e){Eo(e,t)}),r=(n=[o.selected(),o.lastSelected(),o.firstSelected()],function(e){vf(e,n)}),u=function(e){var t=qt(e,o.selectedSelector());k(t,r)};return{clear:u,selectRange:function(e,t,n,r){u(e),k(t,i),Eo(n,o.firstSelected()),Eo(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){he(e,o.selected()),he(e,o.firstSelected()),he(e,o.lastSelected())},i=function(e){se(e,o.selected(),"1")},u=function(e){var t=qt(e,o.selectedSelector());k(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),k(t,i),se(n,o.firstSelected(),"1"),se(r,o.lastSelected(),"1")},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}}},wf=function(e){return!1===Ao(xe.fromDom(e.target),"ephox-snooker-resizer-bar")};function yf(h,p){var v=J(["mousedown","mouseover","mouseup","keyup","keydown"],[]),b=R.none(),w=bf.byAttr(yr);return h.on("init",function(e){var r=h.getWin(),o=Fu(h),t=Hu(h),n=pf.mouse(r,o,t,w),a=pf.keyboard(r,o,t,w),c=function(e,t){!0===e.raw().shiftKey&&(t.kill()&&e.kill(),t.selection().each(function(e){var t=bc.relative(e.start(),e.finish()),n=Dc(r,t);h.selection.setRng(n)}))},i=function(e){var t=f(e);if(t.raw().shiftKey&&df.isNavigation(t.raw().which)){var n=h.selection.getRng(),r=xe.fromDom(n.startContainer),o=xe.fromDom(n.endContainer);a.keyup(t,r,n.startOffset,o,n.endOffset).each(function(e){c(t,e)})}},u=function(e){var t=f(e);p().each(function(e){e.hideBars()});var n=h.selection.getRng(),r=xe.fromDom(h.selection.getStart()),o=xe.fromDom(n.startContainer),i=xe.fromDom(n.endContainer),u=Yu.directionAt(r).isRtl()?df.rtl:df.ltr;a.keydown(t,o,n.startOffset,i,n.endOffset,u).each(function(e){c(t,e)}),p().each(function(e){e.showBars()})},l=function(e){return e.hasOwnProperty("x")&&e.hasOwnProperty("y")},f=function(e){var t=xe.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=x(r,n);return{target:C(t),x:C(l(e)?e.x:null),y:C(l(e)?e.y:null),stop:n,prevent:r,kill:o,raw:C(e)}},s=function(e){return 0===e.button},d=function(e){s(e)&&wf(e)&&n.mousedown(f(e))},m=function(e){var t;((t=e).buttons===undefined||Sa.ie&&12<=Sa.ie&&0===t.buttons||0!=(1&t.buttons))&&wf(e)&&n.mouseover(f(e))},g=function(e){s(e)&&wf(e)&&n.mouseup(f(e))};h.on("mousedown",d),h.on("mouseover",m),h.on("mouseup",g),h.on("keyup",i),h.on("keydown",u),h.on("nodechange",function(){var e=h.selection,t=xe.fromDom(e.getStart()),n=xe.fromDom(e.getEnd());ar.sharedOne(cn.table,[t,n]).fold(function(){w.clear(o)},y)}),b=R.some(v({mousedown:d,mouseover:m,mouseup:g,keyup:i,keydown:u}))}),{clear:w.clear,destroy:function(){b.each(function(e){})}}}var xf=sa.each,Cf=function(t){var n=[];function e(e){return function(){t.execCommand(e)}}xf("inserttable tableprops deletetable | cell row column".split(" "),function(e){"|"===e?n.push({text:"-"}):n.push(t.menuItems[e])}),t.addButton("table",{type:"menubutton",title:"Table",menu:n}),t.addButton("tableprops",{title:"Table properties",onclick:e("mceTableProps"),icon:"table"}),t.addButton("tabledelete",{title:"Delete table",onclick:e("mceTableDelete")}),t.addButton("tablecellprops",{title:"Cell properties",onclick:e("mceTableCellProps")}),t.addButton("tablemergecells",{title:"Merge cells",onclick:e("mceTableMergeCells")}),t.addButton("tablesplitcells",{title:"Split cell",onclick:e("mceTableSplitCells")}),t.addButton("tableinsertrowbefore",{title:"Insert row before",onclick:e("mceTableInsertRowBefore")}),t.addButton("tableinsertrowafter",{title:"Insert row after",onclick:e("mceTableInsertRowAfter")}),t.addButton("tabledeleterow",{title:"Delete row",onclick:e("mceTableDeleteRow")}),t.addButton("tablerowprops",{title:"Row properties",onclick:e("mceTableRowProps")}),t.addButton("tablecutrow",{title:"Cut row",onclick:e("mceTableCutRow")}),t.addButton("tablecopyrow",{title:"Copy row",onclick:e("mceTableCopyRow")}),t.addButton("tablepasterowbefore",{title:"Paste row before",onclick:e("mceTablePasteRowBefore")}),t.addButton("tablepasterowafter",{title:"Paste row after",onclick:e("mceTablePasteRowAfter")}),t.addButton("tableinsertcolbefore",{title:"Insert column before",onclick:e("mceTableInsertColBefore")}),t.addButton("tableinsertcolafter",{title:"Insert column after",onclick:e("mceTableInsertColAfter")}),t.addButton("tabledeletecol",{title:"Delete column",onclick:e("mceTableDeleteCol")})},Rf=function(t){var e,n=""===(e=t.getParam("table_toolbar",Xu))||!1===e?[]:d(e)?e.split(/[ ,]/):h(e)?e:[];0<n.length&&t.addContextToolbar(function(e){return t.dom.is(e,"table")&&t.getBody().contains(e)},n.join(" "))},Sf=function(o,n){var r=R.none(),i=[],u=[],a=[],c=[],l=function(e){e.disabled(!0)},f=function(e){e.disabled(!1)},e=function(){var t=this;i.push(t),r.fold(function(){l(t)},function(e){f(t)})},t=function(){var t=this;u.push(t),r.fold(function(){l(t)},function(e){f(t)})};o.on("init",function(){o.on("nodechange",function(e){var t=R.from(o.dom.getParent(o.selection.getStart(),"th,td"));(r=t.bind(function(e){var t=xe.fromDom(e);return cn.table(t).map(function(e){return kr.forMenu(n,e,t)})})).fold(function(){k(i,l),k(u,l),k(a,l),k(c,l)},function(t){k(i,f),k(u,f),k(a,function(e){e.disabled(t.mergable().isNone())}),k(c,function(e){e.disabled(t.unmergable().isNone())})})})});var s=function(e,t,n,r){var o,i,u,a,c,l=r.getEl().getElementsByTagName("table")[0],f=r.isRtl()||"tl-tr"===r.parent().rel;for(l.nextSibling.innerHTML=t+1+" x "+(n+1),f&&(t=9-t),i=0;i<10;i++)for(o=0;o<10;o++)a=l.rows[i].childNodes[o].firstChild,c=(f?t<=o:o<=t)&&i<=n,e.dom.toggleClass(a,"mce-active",c),c&&(u=a);return u.parentNode},d=!1===o.getParam("table_grid",!0,"boolean")?{text:"Table",icon:"table",context:"table",onclick:m("mceInsertTable")}:{text:"Table",icon:"table",context:"table",ariaHideMenu:!0,onclick:function(e){e.aria&&(this.parent().hideAll(),e.stopImmediatePropagation(),o.execCommand("mceInsertTable"))},onshow:function(){s(o,0,0,this.menu.items()[0])},onhide:function(){var e=this.menu.items()[0].getEl().getElementsByTagName("a");o.dom.removeClass(e,"mce-active"),o.dom.addClass(e[0],"mce-active")},menu:[{type:"container",html:function(){var e="";e='<table role="grid" class="mce-grid mce-grid-border" aria-readonly="true">';for(var t=0;t<10;t++){e+="<tr>";for(var n=0;n<10;n++)e+='<td role="gridcell" tabindex="-1"><a id="mcegrid'+(10*t+n)+'" href="#" data-mce-x="'+n+'" data-mce-y="'+t+'"></a></td>';e+="</tr>"}return e+="</table>",e+='<div class="mce-text-center" role="presentation">1 x 1</div>'}(),onPostRender:function(){this.lastX=this.lastY=0},onmousemove:function(e){var t,n,r=e.target;"A"===r.tagName.toUpperCase()&&(t=parseInt(r.getAttribute("data-mce-x"),10),n=parseInt(r.getAttribute("data-mce-y"),10),(this.isRtl()||"tl-tr"===this.parent().rel)&&(t=9-t),t===this.lastX&&n===this.lastY||(s(o,t,n,e.control),this.lastX=t,this.lastY=n))},onclick:function(e){var t=this;"A"===e.target.tagName.toUpperCase()&&(e.preventDefault(),e.stopPropagation(),t.parent().cancel(),o.undoManager.transact(function(){Na(o,t.lastX+1,t.lastY+1)}),o.addVisual())}}]};function m(e){return function(){o.execCommand(e)}}var g={text:"Table properties",context:"table",onPostRender:e,onclick:m("mceTableProps")},h={text:"Delete table",context:"table",onPostRender:e,cmd:"mceTableDelete"},p={text:"Row",context:"table",menu:[{text:"Insert row before",onclick:m("mceTableInsertRowBefore"),onPostRender:t},{text:"Insert row after",onclick:m("mceTableInsertRowAfter"),onPostRender:t},{text:"Delete row",onclick:m("mceTableDeleteRow"),onPostRender:t},{text:"Row properties",onclick:m("mceTableRowProps"),onPostRender:t},{text:"-"},{text:"Cut row",onclick:m("mceTableCutRow"),onPostRender:t},{text:"Copy row",onclick:m("mceTableCopyRow"),onPostRender:t},{text:"Paste row before",onclick:m("mceTablePasteRowBefore"),onPostRender:t},{text:"Paste row after",onclick:m("mceTablePasteRowAfter"),onPostRender:t}]},v={text:"Column",context:"table",menu:[{text:"Insert column before",onclick:m("mceTableInsertColBefore"),onPostRender:t},{text:"Insert column after",onclick:m("mceTableInsertColAfter"),onPostRender:t},{text:"Delete column",onclick:m("mceTableDeleteCol"),onPostRender:t}]},b={separator:"before",text:"Cell",context:"table",menu:[{text:"Cell properties",onclick:m("mceTableCellProps"),onPostRender:t},{text:"Merge cells",onclick:m("mceTableMergeCells"),onPostRender:function(){var t=this;a.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.mergable().isNone())})}},{text:"Split cell",onclick:m("mceTableSplitCells"),onPostRender:function(){var t=this;c.push(t),r.fold(function(){l(t)},function(e){t.disabled(e.unmergable().isNone())})}}]};o.addMenuItem("inserttable",d),o.addMenuItem("tableprops",g),o.addMenuItem("deletetable",h),o.addMenuItem("row",p),o.addMenuItem("column",v),o.addMenuItem("cell",b)},Tf=function(n,r){return{insertTable:function(e,t){return Na(n,e,t)},setClipboardRows:function(e){return t=r,n=E(e,xe.fromDom),void t.set(R.from(n));var t,n},getClipboardRows:function(){return r.get().fold(function(){},function(e){return E(e,function(e){return e.dom()})})}}};e.add("table",function(t){var n,r=cc(t),e=yf(t,r.lazyResize),o=la(t,r.lazyWire),i=(n=t,{get:function(){var e=Fu(n);return hr(e,yr.selectedSelector()).fold(function(){return n.selection.getStart()===undefined?Rr.none():Rr.single(n.selection)},function(e){return Rr.multiple(e)})}}),u=lu(R.none());return Ba(t,o,e,i,u),Ar(t,i,o,e),Sf(t,i),Cf(t),Rf(t),t.on("PreInit",function(){t.serializer.addTempAttr(yr.firstSelected()),t.serializer.addTempAttr(yr.lastSelected())}),t.getParam("table_tab_navigation",!0,"boolean")&&t.on("keydown",function(e){nl(e,t,o,r.lazyWire)}),t.on("remove",function(){r.destroy(),e.destroy()}),Tf(t,u)})}(window);
|
1
|
+
/**
|
2
|
+
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
|
3
|
+
* Licensed under the LGPL or a commercial license.
|
4
|
+
* For LGPL see License.txt in the project root for license information.
|
5
|
+
* For commercial licenses see https://www.tiny.cloud/
|
6
|
+
*
|
7
|
+
* Version: 5.0.0-1 (2019-02-04)
|
8
|
+
*/
|
9
|
+
!function(){"use strict";var e=tinymce.util.Tools.resolve("tinymce.PluginManager"),y=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t]},x=function(n,r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n(r.apply(null,e))}},C=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 t,n,r,i,u,m=function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!n.apply(null,e)}},a=function(e){return e()},c=C(!1),l=C(!0),f=c,s=l,d=function(){return g},g=(i={fold:function(e,t){return e()},is:f,isSome:f,isNone:s,getOr:r=function(e){return e},getOrThunk:n=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:r,orThunk:n,map:d,ap:d,each:function(){},bind:d,flatten:d,exists:f,forall:s,filter:d,equals:t=function(e){return e.isNone()},equals_:t,toArray:function(){return[]},toString:C("none()")},Object.freeze&&Object.freeze(i),i),p=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:s,isNone:f,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:t,orThunk:t,map:function(e){return p(e(n))},ap:function(e){return e.fold(d,function(e){return p(e(n))})},each:function(e){e(n)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(n)?o:g},equals:function(e){return e.is(n)},equals_:function(e,t){return e.fold(f,function(e){return t(n,e)})},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},S={some:p,none:d,from:function(e){return null===e||e===undefined?g:p(e)}},h=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}},v=h("string"),w=h("array"),R=h("boolean"),T=h("function"),D=h("number"),O=(u=Array.prototype.indexOf)===undefined?function(e,t){return _(e,t)}:function(e,t){return u.call(e,t)},A=function(e,t){return-1<O(e,t)},E=function(e,t){return W(e,t).isSome()},N=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},k=function(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)},I=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},P=function(e,t,n){return function(e,t){for(var n=e.length-1;0<=n;n--)t(e[n],n,e)}(e,function(e){n=t(n,e)}),n},B=function(e,t,n){return k(e,function(e){n=t(n,e)}),n},M=function(e,t){for(var n=0,r=e.length;n<r;n++){var o=e[n];if(t(o,n,e))return S.some(o)}return S.none()},W=function(e,t){for(var n=0,r=e.length;n<r;n++)if(t(e[n],n,e))return S.some(n);return S.none()},_=function(e,t){for(var n=0,r=e.length;n<r;++n)if(e[n]===t)return n;return-1},L=Array.prototype.push,j=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);L.apply(t,e[n])}return t},z=function(e,t){var n=N(e,t);return j(n)},H=function(e,t){for(var n=0,r=e.length;n<r;++n)if(!0!==t(e[n],n,e))return!1;return!0},F=Array.prototype.slice,U=function(e){var t=F.call(e,0);return t.reverse(),t},q=(T(Array.from)&&Array.from,Object.keys),V=Object.hasOwnProperty,G=function(e,t){for(var n=q(e),r=0,o=n.length;r<o;r++){var i=n[r];t(e[i],i,e)}},Y=function(e,r){return K(e,function(e,t,n){return{k:t,v:r(e,t,n)}})},K=function(r,o){var i={};return G(r,function(e,t){var n=o(e,t,r);i[n.k]=n.v}),i},X=function(e,t){return $(e,t)?S.some(e[t]):S.none()},$=function(e,t){return V.call(e,t)},J=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 k(t,function(e,t){r[e]=C(n[t])}),r}},Q=function(e){return e.slice(0).sort()},Z=function(e,t){throw new Error("All required keys ("+Q(e).join(", ")+") were not specified. Specified keys were: "+Q(t).join(", ")+".")},ee=function(e){throw new Error("Unsupported keys for object: "+Q(e).join(", "))},te=function(t,e){if(!w(e))throw new Error("The "+t+" fields must be an array. Was: "+e+".");k(e,function(e){if(!v(e))throw new Error("The value "+e+" in the "+t+" fields was not a string.")})},ne=function(e){var n=Q(e);M(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(", ")+"].")})},re=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 te("required",o),te("optional",i),ne(u),function(t){var n=q(t);H(o,function(e){return A(n,e)})||Z(o,n);var e=I(n,function(e){return!A(u,e)});0<e.length&&ee(e);var r={};return k(o,function(e){r[e]=C(t[e])}),k(i,function(e){r[e]=C(Object.prototype.hasOwnProperty.call(t,e)?S.some(t[e]):S.none())}),r}},oe=J("width","height"),ie=J("rows","columns"),ue=J("row","column"),ce=J("x","y"),ae=J("element","rowspan","colspan"),le=J("element","rowspan","colspan","isNew"),fe={dimensions:oe,grid:ie,address:ue,coords:ce,extended:J("element","rowspan","colspan","row","column"),detail:ae,detailnew:le,rowdata:J("element","cells","section"),elementnew:J("element","isNew"),rowdatanew:J("element","cells","section","isNew"),rowcells:J("cells","section"),rowdetails:J("details","section"),bounds:J("startRow","startCol","finishRow","finishCol")},se=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:C(e)}},de={fromHtml:function(e,t){var n=(t||document).createElement("div");if(n.innerHTML=e,!n.hasChildNodes()||1<n.childNodes.length)throw console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return se(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return se(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return se(n)},fromDom:se,fromPoint:function(e,t,n){var r=e.dom();return S.from(r.elementFromPoint(t,n)).map(se)}},me=(Node.ATTRIBUTE_NODE,Node.CDATA_SECTION_NODE,Node.COMMENT_NODE),ge=Node.DOCUMENT_NODE,pe=(Node.DOCUMENT_TYPE_NODE,Node.DOCUMENT_FRAGMENT_NODE,Node.ELEMENT_NODE),he=Node.TEXT_NODE,ve=(Node.PROCESSING_INSTRUCTION_NODE,Node.ENTITY_REFERENCE_NODE,Node.ENTITY_NODE,Node.NOTATION_NODE,pe),be=ge,we=function(e,t){var n=e.dom();if(n.nodeType!==ve)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")},ye=function(e){return e.nodeType!==ve&&e.nodeType!==be||0===e.childElementCount},xe="undefined"!=typeof window?window:Function("return this;")(),Ce=function(e,t){return function(e,t){for(var n=t!==undefined&&null!==t?t:xe,r=0;r<e.length&&n!==undefined&&null!==n;++r)n=n[e[r]];return n}(e.split("."),t)},Se=function(e,t){var n=Ce(e,t);if(n===undefined||null===n)throw e+" not available on this browser";return n},Re=function(){return Se("Node")},Te=function(e,t,n){return 0!=(e.compareDocumentPosition(t)&n)},De=function(e,t){return Te(e,t,Re().DOCUMENT_POSITION_CONTAINED_BY)},Oe=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}},Ae=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 Ne(r(1),r(2))},Ee=function(){return Ne(0,0)},Ne=function(e,t){return{major:e,minor:t}},ke={nu:Ne,detect:function(e,t){var n=String(t).toLowerCase();return 0===e.length?Ee():Ae(e,n)},unknown:Ee},Ie="Firefox",Pe=function(e,t){return function(){return t===e}},Be=function(e){var t=e.current;return{current:t,version:e.version,isEdge:Pe("Edge",t),isChrome:Pe("Chrome",t),isIE:Pe("IE",t),isOpera:Pe("Opera",t),isFirefox:Pe(Ie,t),isSafari:Pe("Safari",t)}},Me={unknown:function(){return Be({current:undefined,version:ke.unknown()})},nu:Be,edge:C("Edge"),chrome:C("Chrome"),ie:C("IE"),opera:C("Opera"),firefox:C(Ie),safari:C("Safari")},We="Windows",_e="Android",Le="Solaris",je="FreeBSD",ze=function(e,t){return function(){return t===e}},He=function(e){var t=e.current;return{current:t,version:e.version,isWindows:ze(We,t),isiOS:ze("iOS",t),isAndroid:ze(_e,t),isOSX:ze("OSX",t),isLinux:ze("Linux",t),isSolaris:ze(Le,t),isFreeBSD:ze(je,t)}},Fe={unknown:function(){return He({current:undefined,version:ke.unknown()})},nu:He,windows:C(We),ios:C("iOS"),android:C(_e),linux:C("Linux"),osx:C("OSX"),solaris:C(Le),freebsd:C(je)},Ue=function(e,t){var n=String(t).toLowerCase();return M(e,function(e){return e.search(n)})},qe=function(e,n){return Ue(e,n).map(function(e){var t=ke.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ve=function(e,n){return Ue(e,n).map(function(e){var t=ke.detect(e.versionRegexes,n);return{current:e.name,version:t}})},Ge=function(e,t,n){return""===t||!(e.length<t.length)&&e.substr(n,n+t.length)===t},Ye=function(e,t){return-1!==e.indexOf(t)},Ke=function(e,t){return Ge(e,t,0)},Xe=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,$e=function(t){return function(e){return Ye(e,t)}},Je=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Ye(e,"edge/")&&Ye(e,"chrome")&&Ye(e,"safari")&&Ye(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,Xe],search:function(e){return Ye(e,"chrome")&&!Ye(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Ye(e,"msie")||Ye(e,"trident")}},{name:"Opera",versionRegexes:[Xe,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:$e("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:$e("firefox")},{name:"Safari",versionRegexes:[Xe,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Ye(e,"safari")||Ye(e,"mobile/"))&&Ye(e,"applewebkit")}}],Qe=[{name:"Windows",search:$e("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Ye(e,"iphone")||Ye(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:$e("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:$e("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:$e("linux"),versionRegexes:[]},{name:"Solaris",search:$e("sunos"),versionRegexes:[]},{name:"FreeBSD",search:$e("freebsd"),versionRegexes:[]}],Ze={browsers:C(Je),oses:C(Qe)},et=function(e){var t,n,r,o,i,u,c,a,l,f,s,d=Ze.browsers(),m=Ze.oses(),g=qe(d,e).fold(Me.unknown,Me.nu),p=Ve(m,e).fold(Fe.unknown,Fe.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:C(o),isiPhone:C(i),isTablet:C(a),isPhone:C(f),isTouch:C(l),isAndroid:t.isAndroid,isiOS:t.isiOS,isWebView:C(s)})}},tt={detect:Oe(function(){var e=navigator.userAgent;return et(e)})},nt=function(e,t){return e.dom()===t.dom()},rt=tt.detect().browser.isIE()?function(e,t){return De(e.dom(),t.dom())}:function(e,t){var n=e.dom(),r=t.dom();return n!==r&&n.contains(r)},ot=we,it=function(e){return de.fromDom(e.dom().ownerDocument)},ut=function(e){var t=e.dom();return S.from(t.parentNode).map(de.fromDom)},ct=function(e,t){for(var n=T(t)?t:C(!1),r=e.dom(),o=[];null!==r.parentNode&&r.parentNode!==undefined;){var i=r.parentNode,u=de.fromDom(i);if(o.push(u),!0===n(u))break;r=i}return o},at=function(e){var t=e.dom();return S.from(t.previousSibling).map(de.fromDom)},lt=function(e){var t=e.dom();return S.from(t.nextSibling).map(de.fromDom)},ft=function(e){var t=e.dom();return N(t.childNodes,de.fromDom)},st=function(e,t){var n=e.dom().childNodes;return S.from(n[t]).map(de.fromDom)},dt=(J("element","offset"),function(e,t,n){return z(ft(e),function(e){return we(e,t)?n(e)?[e]:[]:dt(e,t,n)})}),mt={firstLayer:function(e,t){return dt(e,t,C(!0))},filterFirstLayer:dt},gt=function(e){return e.dom().nodeName.toLowerCase()},pt=function(e){return e.dom().nodeType},ht=function(t){return function(e){return pt(e)===t}},vt=function(e){return pt(e)===me||"#comment"===gt(e)},bt=ht(pe),wt=ht(he),yt=ht(ge),xt=function(e,t,n){if(!(v(n)||R(n)||D(n)))throw console.error("Invalid call to Attr.set. Key ",t,":: Value ",n,":: Element ",e),new Error("Attribute value was not simple");e.setAttribute(t,n+"")},Ct=function(e,t,n){xt(e.dom(),t,n)},St=function(e,t){var n=e.dom();G(t,function(e,t){xt(n,t,e)})},Rt=function(e,t){var n=e.dom().getAttribute(t);return null===n?undefined:n},Tt=function(e,t){var n=e.dom();return!(!n||!n.hasAttribute)&&n.hasAttribute(t)},Dt=function(e,t){e.dom().removeAttribute(t)},Ot=function(e){return B(e.dom().attributes,function(e,t){return e[t.name]=t.value,e},{})},At=function(e){var t=wt(e)?e.dom().parentNode:e.dom();return t!==undefined&&null!==t&&t.ownerDocument.body.contains(t)},Et=Oe(function(){return Nt(de.fromDom(document))}),Nt=function(e){var t=e.dom().body;if(null===t||t===undefined)throw new Error("Body is not available yet");return de.fromDom(t)},kt=function(e,t){var n=[];return k(ft(e),function(e){t(e)&&(n=n.concat([e])),n=n.concat(kt(e,t))}),n},It=function(e,t,n){return r=function(e){return we(e,t)},I(ct(e,n),r);var r},Pt=function(e,t){return n=function(e){return we(e,t)},I(ft(e),n);var n},Bt=function(e,t){return n=t,o=(r=e)===undefined?document:r.dom(),ye(o)?[]:N(o.querySelectorAll(n),de.fromDom);var n,r,o};function Mt(e,t,n,r,o){return e(n,r)?S.some(n):T(o)&&o(n)?S.none():t(n,r,o)}var Wt=function(e,t,n){for(var r=e.dom(),o=T(n)?n:C(!1);r.parentNode;){r=r.parentNode;var i=de.fromDom(r);if(t(i))return S.some(i);if(o(i))break}return S.none()},_t=function(e,t,n){return Wt(e,function(e){return we(e,t)},n)},Lt=function(e,t){return n=function(e){return we(e,t)},M(e.dom().childNodes,x(n,de.fromDom)).map(de.fromDom);var n},jt=function(e,t){return n=t,o=(r=e)===undefined?document:r.dom(),ye(o)?S.none():S.from(o.querySelector(n)).map(de.fromDom);var n,r,o},zt=function(e,t,n){return Mt(we,_t,e,t,n)},Ht=function(e,t,n){var r=n!==undefined?n:C(!1);return r(t)?S.none():A(e,gt(t))?S.some(t):_t(t,e.join(","),function(e){return we(e,"table")||r(e)})},Ft=function(t,e){return ut(e).map(function(e){return Pt(e,t)})},Ut=b(Ft,"th,td"),qt=b(Ft,"tr"),Vt=function(e,t){return parseInt(Rt(e,t),10)},Gt={cell:function(e,t){return Ht(["td","th"],e,t)},firstCell:function(e){return jt(e,"th,td")},cells:function(e){return mt.firstLayer(e,"th,td")},neighbourCells:Ut,table:function(e,t){return zt(e,"table",t)},row:function(e,t){return Ht(["tr"],e,t)},rows:function(e){return mt.firstLayer(e,"tr")},notCell:function(e,t){return Ht(["caption","tr","tbody","tfoot","thead"],e,t)},neighbourRows:qt,attr:Vt,grid:function(e,t,n){var r=Vt(e,t),o=Vt(e,n);return fe.grid(r,o)}},Yt=function(e){var t=Gt.rows(e);return N(t,function(e){var t=e,n=ut(t).map(function(e){var t=gt(e);return"tfoot"===t||"thead"===t||"tbody"===t?t:"tbody"}).getOr("tbody"),r=N(Gt.cells(e),function(e){var t=Tt(e,"rowspan")?parseInt(Rt(e,"rowspan"),10):1,n=Tt(e,"colspan")?parseInt(Rt(e,"colspan"),10):1;return fe.detail(e,t,n)});return fe.rowdata(t,r,n)})},Kt=function(e,n){return N(e,function(e){var t=N(Gt.cells(e),function(e){var t=Tt(e,"rowspan")?parseInt(Rt(e,"rowspan"),10):1,n=Tt(e,"colspan")?parseInt(Rt(e,"colspan"),10):1;return fe.detail(e,t,n)});return fe.rowdata(e,t,n.section())})},Xt=function(e,t){return e+","+t},$t=function(e,t){var n=z(e.all(),function(e){return e.cells()});return I(n,t)},Jt={generate:function(e){var f={},t=[],n=e.length,s=0;k(e,function(e,a){var l=[];k(e.cells(),function(e,t){for(var n=0;f[Xt(a,n)]!==undefined;)n++;for(var r=fe.extended(e.element(),e.rowspan(),e.colspan(),a,n),o=0;o<e.colspan();o++)for(var i=0;i<e.rowspan();i++){var u=n+o,c=Xt(a+i,u);f[c]=r,s=Math.max(s,u+1)}l.push(r)}),t.push(fe.rowdata(e.element(),l,e.section()))});var r=fe.grid(n,s);return{grid:C(r),access:C(f),all:C(t)}},getAt:function(e,t,n){var r=e.access()[Xt(t,n)];return r!==undefined?S.some(r):S.none()},findItem:function(e,t,n){var r=$t(e,function(e){return n(t,e.element())});return 0<r.length?S.some(r[0]):S.none()},filterItems:$t,justCells:function(e){var t=N(e.all(),function(e){return e.cells()});return j(t)}},Qt=function(e){return e.style!==undefined},Zt=function(e,t,n){if(!v(n))throw console.error("Invalid call to CSS.set. Property ",t,":: Value ",n,":: Element ",e),new Error("CSS value must be a string: "+n);Qt(e)&&e.style.setProperty(t,n)},en=function(e,t,n){var r=e.dom();Zt(r,t,n)},tn=function(e,t){var n=e.dom();G(t,function(e,t){Zt(n,t,e)})},nn=function(e,t){var n=e.dom(),r=window.getComputedStyle(n).getPropertyValue(t),o=""!==r||At(e)?r:rn(n,t);return null===o?undefined:o},rn=function(e,t){return Qt(e)?e.style.getPropertyValue(t):""},on=function(e,t){var n=e.dom(),r=rn(n,t);return S.from(r).filter(function(e){return 0<e.length})},un=function(e,t){var n,r,o=e.dom();r=t,Qt(n=o)&&n.style.removeProperty(r),Tt(e,"style")&&""===Rt(e,"style").replace(/^\s+|\s+$/g,"")&&Dt(e,"style")},cn=function(t,n){ut(t).each(function(e){e.dom().insertBefore(n.dom(),t.dom())})},an=function(e,t){lt(e).fold(function(){ut(e).each(function(e){fn(e,t)})},function(e){cn(e,t)})},ln=function(t,n){st(t,0).fold(function(){fn(t,n)},function(e){t.dom().insertBefore(n.dom(),e.dom())})},fn=function(e,t){e.dom().appendChild(t.dom())},sn=function(e,t){cn(e,t),fn(t,e)},dn=function(r,o){k(o,function(e,t){var n=0===t?r:o[t-1];an(n,e)})},mn=function(t,e){k(e,function(e){fn(t,e)})},gn=function(e){e.dom().textContent="",k(ft(e),function(e){pn(e)})},pn=function(e){var t=e.dom();null!==t.parentNode&&t.parentNode.removeChild(t)},hn=function(e){var t,n=ft(e);0<n.length&&(t=e,k(n,function(e){cn(t,e)})),pn(e)},vn=J("minRow","minCol","maxRow","maxCol"),bn=function(e,t){var n,i,r,u,c,a,l,o,f,s,d=function(e){return we(e.element(),t)},m=Yt(e),g=Jt.generate(m),p=(i=d,r=(n=g).grid().columns(),u=n.grid().rows(),c=r,l=a=0,G(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)}}),vn(u,c,a,l)),h="th:not("+t+"),td:not("+t+")",v=mt.filterFirstLayer(e,"th,td",function(e){return we(e,h)});return k(v,pn),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()||(Jt.getAt(t,l,s).filter(r).isNone()?(o=f,i=e[l].element(),u=de.fromTag("td"),fn(u,de.fromTag("br")),(o?fn:ln)(i,u)):f=!0)}(m,g,p,d),o=e,f=p,s=I(mt.firstLayer(o,"tr"),function(e){return 0===e.dom().childElementCount}),k(s,pn),f.minCol()!==f.maxCol()&&f.minRow()!==f.maxRow()||k(mt.firstLayer(o,"th,td"),function(e){Dt(e,"rowspan"),Dt(e,"colspan")}),Dt(o,"width"),Dt(o,"height"),un(o,"width"),un(o,"height"),e},wn=function(e,t){return de.fromDom(e.dom().cloneNode(t))},yn=function(e){return wn(e,!1)},xn=function(e){return wn(e,!0)},Cn=function(e,t){var n,r,o,i,u=(n=e,r=t,o=de.fromTag(r),i=Ot(n),St(o,i),o),c=ft(xn(e));return mn(u,c),u},Sn=function ls(n,r){var o=function(e){return n(e)?S.from(e.dom().nodeValue):S.none()},e=tt.detect().browser,t=e.isIE()&&10===e.version.major?function(e){try{return o(e)}catch(t){return S.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}}}(wt,"text"),Rn=function(e){return Sn.get(e)},Tn=function(e){return Sn.getOption(e)},Dn=function(e,t){Sn.set(e,t)},On=function(e){return"img"===gt(e)?1:Tn(e).fold(function(){return ft(e).length},function(e){return e.length})},An=["img","br"],En=function(e){return Tn(e).filter(function(e){return 0!==e.trim().length||-1<e.indexOf("\xa0")}).isSome()||A(An,gt(e))},Nn=function(e){return r=En,(o=function(e){for(var t=0;t<e.childNodes.length;t++){if(r(de.fromDom(e.childNodes[t])))return S.some(de.fromDom(e.childNodes[t]));var n=o(e.childNodes[t]);if(n.isSome())return n}return S.none()})(e.dom());var r,o},kn=function(e){return In(e,En)},In=function(e,i){var u=function(e){for(var t=ft(e),n=t.length-1;0<=n;n--){var r=t[n];if(i(r))return S.some(r);var o=u(r);if(o.isSome())return o}return S.none()};return u(e)},Pn=function(){var e=de.fromTag("td");return fn(e,de.fromTag("br")),e},Bn=function(e,t,n){var r=Cn(e,t);return G(n,function(e,t){null===e?Dt(r,t):Ct(r,t,e)}),r},Mn=function(e){return e},Wn=function(e){return function(){return de.fromTag("tr",e.dom())}},_n=function(d,e,m){return{row:Wn(e),cell:function(e){var r,o,i,t,n,u,c,a=it(e.element()),l=de.fromTag(gt(e.element()),a.dom()),f=m.getOr(["strong","em","b","i","span","font","h1","h2","h3","h4","h5","h6","p","div"]),s=0<f.length?(r=e.element(),o=l,i=f,Nn(r).map(function(e){var t=i.join(","),n=It(e,t,function(e){return nt(e,r)});return P(n,function(e,t){var n=yn(t);return Dt(n,"contenteditable"),fn(e,n),n},o)}).getOr(o)):l;return fn(s,de.fromTag("br")),t=e.element(),n=l,u=t.dom(),c=n.dom(),Qt(u)&&Qt(c)&&(c.style.cssText=u.style.cssText),un(l,"height"),1!==e.colspan()&&un(e.element(),"width"),d(e.element(),l),l},replace:Bn,gap:Pn}},Ln=function(e){return{row:Wn(e),cell:Pn,replace:Mn,gap:Pn}},jn=["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 zn(){return{up:C({selector:_t,closest:zt,predicate:Wt,all:ct}),down:C({selector:Bt,predicate:kt}),styles:C({get:nn,getRaw:on,set:en,remove:un}),attrs:C({get:Rt,set:Ct,remove:Dt,copyTo:function(e,t){var n=Ot(e);St(t,n)}}),insert:C({before:cn,after:an,afterAll:dn,append:fn,appendAll:mn,prepend:ln,wrap:sn}),remove:C({unwrap:hn,remove:pn}),create:C({nu:de.fromTag,clone:function(e){return de.fromDom(e.dom().cloneNode(!1))},text:de.fromText}),query:C({comparePosition:function(e,t){return e.dom().compareDocumentPosition(t.dom())},prevSibling:at,nextSibling:lt}),property:C({children:ft,name:gt,parent:ut,isText:wt,isComment:vt,isElement:bt,getText:Rn,setText:Dn,isBoundary:function(e){return!!bt(e)&&("body"===gt(e)||A(jn,gt(e)))},isEmptyTag:function(e){return!!bt(e)&&A(["br","img","hr","input"],gt(e))}}),eq:nt,is:ot}}var Hn=J("left","right"),Fn=function(e,t,n){var r=e.property().children(t);return W(r,b(e.eq,n)).map(function(e){return{before:C(r.slice(0,e)),after:C(r.slice(e+1))}})},Un=function(n,r,o){return Fn(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),Hn(t,r)})},qn=function(n,r,e){return Fn(n,r,e).map(function(e){var t=n.create().clone(r);return n.insert().appendAll(t,e.after()),n.insert().after(r,t),Hn(r,t)})},Vn=function(i,e,u,c){var r=J("first","second","splits"),a=function(e,t,o){var n=r(e,S.none(),o);return u(e)?r(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,S.some(e.right()),o.concat(t))}).getOr(n)})};return a(e,S.none(),[])},Gn=function(r,o,e,t){var n=o(r,e);return P(t,function(e,t){var n=o(r,t);return Yn(r,e,n)},n)},Yn=function(t,e,n){return e.bind(function(e){return n.filter(b(t.eq,e))})},Kn=function(e,t,n){return 0<n.length?Gn(e,t,(r=n)[0],r.slice(1)):S.none();var r},Xn=function(e,t){return b(e.eq,t)},$n=function(t,e,n,r){var o=r!==undefined?r:C(!1),i=[e].concat(t.up().all(e)),u=[n].concat(t.up().all(n)),c=function(t){return W(t,o).fold(function(){return t},function(e){return t.slice(0,e+1)})},a=c(i),l=c(u),f=M(a,function(e){return E(l,Xn(t,e))});return{firstpath:C(a),secondpath:C(l),shared:C(f)}},Jn=function(t,e,n){var r=$n(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 S.some([e[0]]);if(o.eq(i,t[0]))return S.some([t[0]]);var n=function(e){var t=U(e),n=W(t,Xn(o,i)).getOr(-1),r=n<t.length-1?t[n+1]:t[n];return W(u,Xn(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())})},Qn=$n,Zn=function(e,t,n){return Kn(e,t,n)},er=function(e,t,n){return Jn(e,t,n)},tr=function(e,t,n,r){return Qn(e,t,n,r)},nr=function(e,t,n){return Un(e,t,n)},rr=function(e,t,n){return qn(e,t,n)},or=function(e,t,n,r){return Vn(e,t,n,r)},ir=zn(),ur={sharedOne:function(n,e){return Zn(ir,function(e,t){return n(t)},e)},subset:function(e,t){return er(ir,e,t)},ancestors:function(e,t,n){return tr(ir,e,t,n)},breakToLeft:function(e,t){return nr(ir,e,t)},breakToRight:function(e,t){return rr(ir,e,t)},breakPath:function(e,t,r){return or(ir,e,t,function(e,t,n){return r(t,n)})}},cr=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()},ar=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()},lr=function(e,t){for(var n=!0,r=b(cr,t),o=t.startRow();o<=t.finishRow();o++)for(var i=t.startCol();i<=t.finishCol();i++)n=n&&Jt.getAt(e,o,i).exists(r);return n?S.some(t):S.none()},fr=function(e,t,n){var r=Jt.findItem(e,t,nt),o=Jt.findItem(e,n,nt);return r.bind(function(r){return o.map(function(e){return t=r,n=e,fe.bounds(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})})},sr=fr,dr=function(t,e,n){return fr(t,e,n).bind(function(e){return lr(t,e)})},mr=function(r,e,o,i){return Jt.findItem(r,e,nt).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 Jt.getAt(r,t+o,n+i).map(function(e){return e.element()})})},gr=function(n,e,t){return sr(n,e,t).map(function(e){var t=Jt.filterItems(n,b(ar,e));return N(t,function(e){return e.element()})})},pr=function(e,t){return Jt.findItem(e,t,function(e,t){return rt(t,e)}).bind(function(e){return e.element()})},hr=function(e){var t=Yt(e);return Jt.generate(t)},vr=function(n,r,o){return Gt.table(n).bind(function(e){var t=hr(e);return mr(t,n,r,o)})},br=function(e,t,n){var r=hr(e);return gr(r,t,n)},wr=function(e,t,n,r,o){var i=hr(e),u=nt(e,n)?t:pr(i,t),c=nt(e,o)?r:pr(i,r);return gr(i,u,c)},yr=function(e,t,n){var r=hr(e);return dr(r,t,n)},xr=function(e,t){return _t(e,"table")},Cr=re(["boxes","start","finish"],[]),Sr=function(c,a,r){var l=function(t){return function(e){return r(e)||nt(e,t)}};return nt(c,a)?S.some(Cr({boxes:S.some([c]),start:c,finish:a})):xr(c).bind(function(u){return xr(a).bind(function(i){if(nt(u,i))return S.some(Cr({boxes:br(u,c,a),start:c,finish:a}));if(rt(u,i)){var e=0<(t=It(a,"td,th",l(u))).length?t[t.length-1]:a;return S.some(Cr({boxes:wr(u,c,u,a,i),start:c,finish:e}))}if(rt(i,u)){var t,n=0<(t=It(c,"td,th",l(i))).length?t[t.length-1]:c;return S.some(Cr({boxes:wr(i,c,u,a,i),start:c,finish:n}))}return ur.ancestors(c,a).shared().bind(function(e){return zt(e,"table",r).bind(function(e){var t=It(a,"td,th",l(e)),n=0<t.length?t[t.length-1]:a,r=It(c,"td,th",l(e)),o=0<r.length?r[r.length-1]:c;return S.some(Cr({boxes:wr(e,c,u,a,i),start:o,finish:n}))})})})})},Rr=Sr,Tr=function(e,t){var n=Bt(e,t);return 0<n.length?S.some(n):S.none()},Dr=function(e,t,n,r,o){return(i=e,u=o,M(i,function(e){return we(e,u)})).bind(function(e){return vr(e,t,n).bind(function(e){return n=r,_t(t=e,"table").bind(function(e){return jt(e,n).bind(function(e){return Sr(e,t).bind(function(t){return t.boxes().map(function(e){return{boxes:C(e),start:C(t.start()),finish:C(t.finish())}})})})});var t,n})});var i,u},Or=function(e,t,r){return jt(e,t).bind(function(n){return jt(e,r).bind(function(t){return ur.sharedOne(xr,[n,t]).map(function(e){return{first:C(n),last:C(t),table:C(e)}})})})},Ar=function(e,t){return Tr(e,t)},Er=function(o,e,t){return Or(o,e,t).bind(function(n){var e=function(e){return nt(o,e)},t=_t(n.first(),"thead,tfoot,tbody,table",e),r=_t(n.last(),"thead,tfoot,tbody,table",e);return t.bind(function(t){return r.bind(function(e){return nt(t,e)?yr(n.table(),n.first(),n.last()):S.none()})})})},Nr="data-mce-selected",kr="data-mce-first-selected",Ir="data-mce-last-selected",Pr={selected:C(Nr),selectedSelector:C("td[data-mce-selected],th[data-mce-selected]"),attributeSelector:C("[data-mce-selected]"),firstSelected:C(kr),firstSelectedSelector:C("td[data-mce-first-selected],th[data-mce-first-selected]"),lastSelected:C(Ir),lastSelectedSelector:C("td[data-mce-last-selected],th[data-mce-last-selected]")},Br=function(u){if(!w(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 k(u,function(e,r){var t=q(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(!w(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=q(e);if(c.length!==t.length)throw new Error("Wrong number of arguments to match. Expected: "+c.join(",")+"\nActual: "+t.join(","));if(!H(c,function(e){return A(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){console.log(e,{constructors:c,constructor:o,params:n})}}}}),n},Mr=Br([{none:[]},{multiple:["elements"]},{single:["selection"]}]),Wr={cata:function(e,t,n,r){return e.fold(t,n,r)},none:Mr.none,multiple:Mr.multiple,single:Mr.single},_r=function(e,t){return Wr.cata(t.get(),C([]),o,C([e]))},Lr=function(n,e){return Wr.cata(e.get(),S.none,function(t,e){return 0===t.length?S.none():Er(n,Pr.firstSelectedSelector(),Pr.lastSelectedSelector()).bind(function(e){return 1<t.length?S.some({bounds:C(e),cells:C(t)}):S.none()})},S.none)},jr=function(e,t){var n=_r(e,t);return 0<n.length&&H(n,function(e){return Tt(e,"rowspan")&&1<parseInt(Rt(e,"rowspan"),10)||Tt(e,"colspan")&&1<parseInt(Rt(e,"colspan"),10)})?S.some(n):S.none()},zr=_r,Hr=function(e){return{element:C(e),mergable:S.none,unmergable:S.none,selection:C([e])}},Fr=J("element","clipboard","generators"),Ur={noMenu:Hr,forMenu:function(e,t,n){return{element:C(n),mergable:C(Lr(t,e)),unmergable:C(jr(n,e)),selection:C(zr(n,e))}},notCell:function(e){return Hr(e)},paste:Fr,pasteRows:function(e,t,n,r,o){return{element:C(n),mergable:S.none,unmergable:S.none,selection:C(zr(n,e)),clipboard:C(r),generators:C(o)}}},qr=function(f,e,s,d){f.on("BeforeGetContent",function(n){!0===n.selection&&Wr.cata(e.get(),y,function(e){var t;n.preventDefault(),(t=e,Gt.table(t[0]).map(xn).map(function(e){return[bn(e,Pr.attributeSelector())]})).each(function(e){var t;n.content="text"===n.format?N(e,function(e){return e.dom().innerText}).join(""):(t=f,N(e,function(e){return t.selection.serializer.serialize(e.dom(),{})}).join(""))})},y)}),f.on("BeforeSetContent",function(l){!0===l.selection&&!0===l.paste&&S.from(f.dom.getParent(f.selection.getStart(),"th,td")).each(function(e){var a=de.fromDom(e);Gt.table(a).bind(function(t){var e,n,r,o=I((e=l.content,(r=(n||document).createElement("div")).innerHTML=e,ft(de.fromDom(r))),function(e){return"meta"!==gt(e)});if(1===o.length&&"table"===gt(o[0])){l.preventDefault();var i=de.fromDom(f.getDoc()),u=Ln(i),c=Ur.paste(a,o[0],u);s.pasteCells(t,c).each(function(e){f.selection.setRng(e),f.focus(),d.clear(t)})}})})})};function Vr(r,o){var e=function(e){var t=o(e);if(t<=0||null===t){var n=nn(e,r);return parseFloat(n)||0}return t},i=function(o,e){return B(e,function(e,t){var n=nn(o,t),r=n===undefined?0:parseInt(n,10);return isNaN(r)?e:e+r},0)};return{set:function(e,t){if(!D(t)&&!t.match(/^[0-9]+$/))throw new Error(r+".set accepts only positive integer values. Value was "+t);var n=e.dom();Qt(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 Gr=Vr("height",function(e){var t=e.dom();return At(e)?t.getBoundingClientRect().height:t.offsetHeight}),Yr=function(e){return Gr.get(e)},Kr=function(e){return Gr.getOuter(e)},Xr=Vr("width",function(e){return e.dom().offsetWidth}),$r=function(e){return Xr.get(e)},Jr=function(e){return Xr.getOuter(e)},Qr=tt.detect(),Zr=function(e,t,n){return r=nn(e,t),o=n,i=parseFloat(r),isNaN(i)?o:i;var r,o,i},eo=function(e){return Qr.browser.isIE()||Qr.browser.isEdge()?(n=Zr(t=e,"padding-top",0),r=Zr(t,"padding-bottom",0),o=Zr(t,"border-top-width",0),i=Zr(t,"border-bottom-width",0),u=t.dom().getBoundingClientRect().height,"border-box"===nn(t,"box-sizing")?u:u-n-r-(o+i)):Zr(e,"height",Yr(e));var t,n,r,o,i,u},to=/(\d+(\.\d+)?)(\w|%)*/,no=/(\d+(\.\d+)?)%/,ro=/(\d+(\.\d+)?)px|em/,oo=function(e,t){en(e,"height",t+"px")},io=function(e,t,n,r){var o,i,u,c,a,l,f,s=parseInt(e,10);return Ge(l=e,f="%",l.length-f.length)&&"table"!==gt(t)?(o=t,i=s,u=n,c=r,a=Gt.table(o).map(function(e){var t=u(e);return Math.floor(i/100*t)}).getOr(i),c(o,a),a):s},uo=function(e){var t,n=on(t=e,"height").getOrThunk(function(){return eo(t)+"px"});return n?io(n,e,Yr,oo):Yr(e)},co=function(e,t){return Tt(e,t)?parseInt(Rt(e,t),10):1},ao=function(e){return on(e,"width").fold(function(){return S.from(Rt(e,"width"))},function(e){return S.some(e)})},lo=function(e,t){return e/t.pixelWidth()*100},fo={percentageBasedSizeRegex:C(no),pixelBasedSizeRegex:C(ro),setPixelWidth:function(e,t){en(e,"width",t+"px")},setPercentageWidth:function(e,t){en(e,"width",t+"%")},setHeight:oo,getPixelWidth:function(t,n){return ao(t).fold(function(){return $r(t)},function(e){return function(e,t,n){if(ro.test(t)){var r=ro.exec(t);return parseInt(r[1],10)}if(no.test(t)){var o=no.exec(t),i=parseFloat(o[1]);return i/100*n.pixelWidth()}return $r(e)}(t,e,n)})},getPercentageWidth:function(t,n){return ao(t).fold(function(){var e=$r(t);return lo(e,n)},function(e){return function(e,t,n){if(no.test(t)){var r=no.exec(t);return parseFloat(r[1])}var o=$r(e);return lo(o,n)}(t,e,n)})},getGenericWidth:function(e){return ao(e).bind(function(e){if(to.test(e)){var t=to.exec(e);return S.some({width:C(t[1]),unit:C(t[3])})}return S.none()})},setGenericWidth:function(e,t,n){en(e,"width",t+n)},getHeight:function(e){return n="rowspan",uo(t=e)/co(t,n);var t,n},getRawWidth:ao},so=function(n,r){fo.getGenericWidth(n).each(function(e){var t=e.width()/2;fo.setGenericWidth(n,t,e.unit()),fo.setGenericWidth(r,t,e.unit())})},mo=function(n,r){return{left:C(n),top:C(r),translate:function(e,t){return mo(n+e,r+t)}}},go=mo,po=function(e,t){return e!==undefined?e:t!==undefined?t:0},ho=function(e){var t,n,r=e.dom().ownerDocument,o=r.body,i=(t=de.fromDom(r),(n=t.dom())===n.window&&t instanceof Window?t:yt(t)?n.defaultView||n.parentWindow:null),u=r.documentElement,c=po(i.pageYOffset,u.scrollTop),a=po(i.pageXOffset,u.scrollLeft),l=po(u.clientTop,o.clientTop),f=po(u.clientLeft,o.clientLeft);return vo(e).translate(a-f,c-l)},vo=function(e){var t,n,r,o=e.dom(),i=o.ownerDocument,u=i.body,c=de.fromDom(i.documentElement);return u===o?go(u.offsetLeft,u.offsetTop):(t=e,n=c||de.fromDom(document.documentElement),Wt(t,b(nt,n)).isSome()?(r=o.getBoundingClientRect(),go(r.left,r.top)):go(0,0))},bo=J("row","y"),wo=J("col","x"),yo=function(e){return ho(e).left()+Jr(e)},xo=function(e){return ho(e).left()},Co=function(e,t){return wo(e,xo(t))},So=function(e,t){return wo(e,yo(t))},Ro=function(e){return ho(e).top()},To=function(n,t,r){if(0===r.length)return[];var e=N(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])},Do={delta:o,positions:b(To,function(e,t){return bo(e,Ro(t))},function(e,t){return bo(e,Ro(t)+Kr(t))}),edge:Ro},Oo={delta:o,edge:xo,positions:b(To,Co,So)},Ao={height:Do,rtl:{delta:function(e,t){return-e},edge:yo,positions:b(To,So,Co)},ltr:Oo},Eo={ltr:Ao.ltr,rtl:Ao.rtl};function No(t){var n=function(e){return t(e).isRtl()?Eo.rtl:Eo.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 ko,Io=function(e){var t=Yt(e);return Jt.generate(t).grid()},Po=function(e){var t=e,n=function(){return t};return{get:n,set:function(e){t=e},clone:function(){return Po(n())}}},Bo=function(r,o,i){if(0===o.length)throw new Error("You must specify at least one required field.");return te("required",o),ne(o),function(t){var n=q(t);H(o,function(e){return A(n,e)})||Z(o,n),r(o,n);var e=I(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 ("+Q(e).join(", ")+") were not.")}(e,i.label),t}},Mo=function(t,e){var n=I(e,function(e){return!A(t,e)});0<n.length&&ee(n)},Wo=function(e){return Bo(Mo,e,{validate:T,label:"function"})},_o=function(e){var t=Tt(e,"colspan")?parseInt(Rt(e,"colspan"),10):1,n=Tt(e,"rowspan")?parseInt(Rt(e,"rowspan"),10):1;return{element:C(e),colspan:C(t),rowspan:C(n)}},Lo=Wo(["cell","row","replace","gap"]),jo=function(r,e){Lo(r);var n=Po(S.none()),o=e!==undefined?e:_o,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(S.some(t)),c=S.some({item:e,replacement:t}),t},c=S.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}},zo=function(o,c){return function(n){var r=Po(S.none());Lo(n);var i=[],u=function(e){var t=n.replace(e,c,{scope:o});return i.push({item:e,sub:t}),r.get().isNone()&&r.set(S.some(t)),t};return{replaceOrInit:function(t,n){return(r=t,o=n,M(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:r.get}}},Ho=function(n){Lo(n);var e=Po(S.none());return{combine:function(t){return e.get().isNone()&&e.set(S.some(t)),function(){var e=n.cell({element:C(t),colspan:C(1),rowspan:C(1)});return un(e,"width"),un(t,"width"),e}},cursor:e.get}},Fo=["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"],Uo=function(e,t){var n=e.property().name(t);return A(Fo,n)},qo=function(e,t){return A(["br","img","hr","input"],e.property().name(t))},Vo=Uo,Go=function(e,t){var n=e.property().name(t);return A(["ol","ul"],n)},Yo=qo,Ko=zn(),Xo=function(e){return Vo(Ko,e)},$o=function(e){return Go(Ko,e)},Jo=function(e){return Yo(Ko,e)},Qo=function(e){var t,i=function(e){return"br"===gt(e)},n=function(o){return kn(o).bind(function(n){var r=lt(n).map(function(e){return!!Xo(e)||(Jo(e)?"img"!==gt(e):void 0)}).getOr(!1);return ut(n).map(function(e){return!0===r||"li"===gt(t=e)||Wt(t,$o).isSome()||i(n)||Xo(e)&&!nt(o,e)?[]:[de.fromTag("br")];var t})}).getOr([])},r=0===(t=z(e,function(e){var t=ft(e);return H(t,function(e){return i(e)||wt(e)&&0===Rn(e).trim().length})?[]:t.concat(n(e))})).length?[de.fromTag("br")]:t;gn(e[0]),mn(e[0],r)},Zo=Object.prototype.hasOwnProperty,ei=(ko=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)Zo.call(o,i)&&(n[i]=ko(n[i],o[i]))}return n}),ti=function(e){for(var t=[],n=function(e){t.push(e)},r=0;r<e.length;r++)e[r].each(n);return t},ni=function(e,t){for(var n=0;n<e.length;n++){var r=t(e[n],n);if(r.isSome())return r}return S.none()},ri=function(e,t){return fe.rowcells(t,e.section())},oi=function(e,t){return e.cells()[t]},ii={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 ri(e,u)},setCells:ri,mutateCell:function(e,t,n){e.cells()[t]=n},getCell:oi,getCellElement:function(e,t){return oi(e,t).element()},mapCells:function(e,t){var n=e.cells(),r=N(n,t);return fe.rowcells(r,e.section())},cellLength:function(e){return e.cells().length}},ui=function(e,t){if(0===e.length)return 0;var n=e[0];return W(e,function(e){return!t(n.element(),e.element())}).fold(function(){return e.length},function(e){return e})},ci=function(e,t,n,r){var o,i,u,c,a=(o=e,i=t,o[i]).cells().slice(n),l=ui(a,r),f=(u=e,c=n,N(u,function(e){return ii.getCell(e,c)})).slice(t),s=ui(f,r);return{colspan:C(l),rowspan:C(s)}},ai=function(o,i){var u=N(o,function(e,t){return N(e.cells(),function(e,t){return!1})});return N(o,function(e,r){var t=z(e.cells(),function(e,t){if(!1!==u[r][t])return[];var n=ci(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()),[fe.detailnew(e.element(),n.rowspan(),n.colspan(),e.isNew())]});return fe.rowdetails(t,e.section())})},li=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=Jt.getAt(e,o,u).map(function(e){return fe.elementnew(e.element(),n)}).getOrThunk(function(){return fe.elementnew(t.gap(),!0)});i.push(c)}var a=fe.rowcells(i,e.all()[o].section());r.push(a)}return r},fi=function(e,t,n,r){n===r?Dt(e,t):Ct(e,t,n)},si=function(o,e){var i=[],u=[],t=function(e,t){0<e.length?function(e,t){var n=Lt(o,t).getOrThunk(function(){var e=de.fromTag(t,it(o).dom());return fn(o,e),e});gn(n);var r=N(e,function(e){e.isNew()&&i.push(e.element());var t=e.element();return gn(t),k(e.cells(),function(e){e.isNew()&&u.push(e.element()),fi(e.element(),"colspan",e.colspan(),1),fi(e.element(),"rowspan",e.rowspan(),1),fn(t,e.element())}),t});mn(n,r)}(e,t):Lt(o,t).each(pn)},n=[],r=[],c=[];return k(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:C(i),newCells:C(u)}},di=function(e){return N(e,function(e){var n=yn(e.element());return k(e.cells(),function(e){var t=xn(e.element());fi(t,"colspan",e.colspan(),1),fi(t,"rowspan",e.rowspan(),1),fn(n,t)}),n})},mi=function(e,t){for(var n=[],r=0;r<e;r++)n.push(t(r));return n},gi=function(e,t){for(var n=[],r=e;r<t;r++)n.push(r);return n},pi=function(t,n){if(n<0||n>=t.length-1)return S.none();var e=t[n].fold(function(){var e=U(t.slice(0,n));return ni(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return S.some({value:e,delta:0})}),r=t[n+1].fold(function(){var e=t.slice(n+1);return ni(e,function(e,t){return e.map(function(e){return{value:e,delta:t+1}})})},function(e){return S.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})})},hi=function(e,t,n){var r=e();return M(r,t).orThunk(function(){return S.from(r[0]).orThunk(n)}).map(function(e){return e.element()})},vi=function(n){var e=n.grid(),t=gi(0,e.columns()),r=gi(0,e.rows());return N(t,function(t){return hi(function(){return z(r,function(e){return Jt.getAt(n,e,t).filter(function(e){return e.column()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.colspan()},function(){return Jt.getAt(n,0,t)})})},bi=function(n){var e=n.grid(),t=gi(0,e.rows()),r=gi(0,e.columns());return N(t,function(t){return hi(function(){return z(r,function(e){return Jt.getAt(n,t,e).filter(function(e){return e.row()===t}).fold(C([]),function(e){return[e]})})},function(e){return 1===e.rowspan()},function(){return Jt.getAt(n,t,0)})})},wi=function(e,t,n,r,o){var i=de.fromTag("div");return tn(i,{position:"absolute",left:t-r/2+"px",top:n+"px",height:o+"px",width:r+"px"}),St(i,{"data-column":e,role:"presentation"}),i},yi=function(e,t,n,r,o){var i=de.fromTag("div");return tn(i,{position:"absolute",left:t+"px",top:n-o/2+"px",height:o+"px",width:r+"px"}),St(i,{"data-row":e,role:"presentation"}),i},xi=function(e){var t=e.replace(/\./g,"-");return{resolve:function(e){return t+"-"+e}}},Ci={resolve:xi("ephox-snooker").resolve},Si=function(e,t){var n=Rt(e,t);return n===undefined||""===n?[]:n.split(" ")},Ri=function(e){return e.dom().classList!==undefined},Ti=function(e,t){return o=t,i=Si(n=e,r="class").concat([o]),Ct(n,r,i.join(" ")),!0;var n,r,o,i},Di=function(e,t){return o=t,0<(i=I(Si(n=e,r="class"),function(e){return e!==o})).length?Ct(n,r,i.join(" ")):Dt(n,r),!1;var n,r,o,i},Oi=function(e,t){Ri(e)?e.dom().classList.add(t):Ti(e,t)},Ai=function(e){0===(Ri(e)?e.dom().classList:Si(e,"class")).length&&Dt(e,"class")},Ei=function(e,t){return Ri(e)&&e.dom().classList.contains(t)},Ni=Ci.resolve("resizer-bar"),ki=Ci.resolve("resizer-rows"),Ii=Ci.resolve("resizer-cols"),Pi=function(e){var t=Bt(e.parent(),"."+Ni);k(t,pn)},Bi=function(n,e,r){var o=n.origin();k(e,function(e,t){e.each(function(e){var t=r(o,e);Oi(t,Ni),fn(n.parent(),t)})})},Mi=function(e,t,n,r,o,i){var u,c,a,l,f=ho(t),s=0<n.length?o.positions(n,t):[];u=e,c=s,a=f,l=Jr(t),Bi(u,c,function(e,t){var n=yi(t.row(),a.left()-e.left(),t.y()-e.top(),l,7);return Oi(n,ki),n});var d,m,g,p,h=0<r.length?i.positions(r,t):[];d=e,m=h,g=f,p=Kr(t),Bi(d,m,function(e,t){var n=wi(t.col(),t.x()-e.left(),g.top()-e.top(),7,p);return Oi(n,Ii),n})},Wi=function(e,t){var n=Bt(e.parent(),"."+Ni);k(n,t)},_i={refresh:function(e,t,n,r){Pi(e);var o=Yt(t),i=Jt.generate(o),u=bi(i),c=vi(i);Mi(e,t,u,c,n,r)},hide:function(e){Wi(e,function(e){en(e,"display","none")})},show:function(e){Wi(e,function(e){en(e,"display","block")})},destroy:Pi,isRowBar:function(e){return Ei(e,ki)},isColBar:function(e){return Ei(e,Ii)}},Li=function(e,r){return N(e,function(e){var t,n=(t=e.details(),ni(t,function(e){return ut(e.element()).map(function(e){var t=ut(e).isNone();return fe.elementnew(e,t)})}).getOrThunk(function(){return fe.elementnew(r.row(),!0)}));return fe.rowdatanew(n.element(),e.details(),e.section(),n.isNew())})},ji=function(e,t){var n=ai(e,nt);return Li(n,t)},zi=function(e,t){var n=j(N(e.all(),function(e){return e.cells()}));return M(n,function(e){return nt(t,e.element())})},Hi=function(c,a,l,f,s){return function(n,r,e,o,i){var t=Yt(r),u=Jt.generate(t);return a(u,e).map(function(e){var t=li(u,o,!1),n=c(t,e,nt,s(o)),r=ji(n.grid(),o);return{grid:C(r),cursor:n.cursor}}).fold(function(){return S.none()},function(e){var t=si(r,e.grid());return l(r,e.grid(),i),f(r),_i.refresh(n,r,Ao.height,i),S.some({cursor:e.cursor,newRows:t.newRows,newCells:t.newCells})})}},Fi=ji,Ui=function(t,e){return Gt.cell(e.element()).bind(function(e){return zi(t,e)})},qi=function(t,e){var n=N(e.selection(),function(e){return Gt.cell(e).bind(function(e){return zi(t,e)})}),r=ti(n);return 0<r.length?S.some(r):S.none()},Vi=function(t,n){return Gt.cell(n.element()).bind(function(e){return zi(t,e).map(function(e){return ei(e,{generators:n.generators,clipboard:n.clipboard})})})},Gi=function(t,e){var n=N(e.selection(),function(e){return Gt.cell(e).bind(function(e){return zi(t,e)})}),r=ti(n);return 0<r.length?S.some(ei({cells:r},{generators:e.generators,clipboard:e.clipboard})):S.none()},Yi=function(e,t){return t.mergable()},Ki=function(e,t){return t.unmergable()},Xi=function(n){return{is:function(e){return n===e},isValue:l,isError:c,getOr:C(n),getOrThunk:C(n),getOrDie:C(n),or:function(e){return Xi(n)},orThunk:function(e){return Xi(n)},fold:function(e,t){return t(n)},map:function(e){return Xi(e(n))},mapError:function(e){return Xi(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 S.some(n)}}},$i=function(n){return{is:c,isValue:c,isError:l,getOr:o,getOrThunk:function(e){return e()},getOrDie:function(){return e=String(n),function(){throw new Error(e)}();var e},or:function(e){return e},orThunk:function(e){return e()},fold:function(e,t){return e(n)},map:function(e){return $i(n)},mapError:function(e){return $i(e(n))},each:y,bind:function(e){return $i(n)},exists:c,forall:l,toOption:S.none}},Ji={value:Xi,error:$i},Qi=function(e,t){return N(e,function(){return fe.elementnew(t.cell(),!0)})},Zi=function(t,e,n){return t.concat(mi(e,function(e){return ii.setCells(t[t.length-1],Qi(t[t.length-1].cells(),n))}))},eu=function(e,t,n){return N(e,function(e){return ii.setCells(e,e.cells().concat(Qi(gi(0,t),n)))})},tu=function(e,t,n){if(e.row()>=t.length||e.column()>ii.cellLength(t[0]))return Ji.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=ii.cellLength(n[0]),u=n.length;return Ji.value({rowDelta:C(r.length-u),colDelta:C(o.length-i)})},nu=function(e,t){var n=ii.cellLength(e[0]),r=ii.cellLength(t[0]);return{rowDelta:C(0),colDelta:C(n-r)}},ru=function(e,t,n){var r=t.colDelta()<0?eu:o;return(t.rowDelta()<0?Zi:o)(r(e,Math.abs(t.colDelta()),n),Math.abs(t.rowDelta()),n)},ou=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++)ii.mutateCell(e[o],i,fe.elementnew(r(),!1));return e},iu=function(e,t,n,r){for(var o=!0,i=0;i<e.length;i++)for(var u=0;u<ii.cellLength(e[0]);u++){var c=n(ii.getCellElement(e[i],u),t);!0===c&&!1===o?ii.mutateCell(e[i],u,fe.elementnew(r(),!0)):!0===c&&(o=!1)}return e},uu=function(i,u,c,a){if(0<u&&u<i.length){var e=i[u-1].cells(),t=(n=c,B(e,function(e,t){return E(e,function(e){return n(e.element(),t.element())})?e:e.concat([t])},[]));k(t,function(e){for(var t=S.none(),n=u;n<i.length;n++)for(var r=0;r<ii.cellLength(i[0]);r++){var o=i[n].cells()[r];c(o.element(),e.element())&&(t.isNone()&&(t=S.some(a())),t.each(function(e){ii.mutateCell(i[n],r,fe.elementnew(e,!0))}))}})}var n;return i},cu=function(n,r,o,i,u){return tu(n,r,o).map(function(e){var t=ru(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+ii.cellLength(n[0]),g=f;g<d;g++)for(var p=s;p<m;p++){i=t,u=g,c=p,a=void 0,a=b(o,ii.getCell(i[u],c).element()),l=i[u],1<i.length&&1<ii.cellLength(l)&&(0<c&&a(ii.getCellElement(l,c-1))||c<l.length-1&&a(ii.getCellElement(l,c+1))||0<u&&a(ii.getCellElement(i[u-1],c))||u<i.length-1&&a(ii.getCellElement(i[u+1],c)))&&iu(t,ii.getCellElement(t[g],p),o,r.cell);var h=ii.getCellElement(n[g-f],p-s),v=r.replace(h);ii.mutateCell(t[g],p,fe.elementnew(v,!0))}return t}(n,t,o,i,u)})},au=function(e,t,n,r,o){uu(t,e,o,r.cell);var i=nu(n,t),u=ru(n,i,r),c=nu(t,u),a=ru(t,c,r);return a.slice(0,e).concat(u).concat(a.slice(e,a.length))},lu=function(n,r,e,o,i){var t=n.slice(0,r),u=n.slice(r),c=ii.mapCells(n[e],function(e,t){return 0<r&&r<n.length&&o(ii.getCellElement(n[r-1],t),ii.getCellElement(n[r],t))?ii.getCell(n[r],t):fe.elementnew(i(e.element(),o),!0)});return t.concat([c]).concat(u)},fu=function(e,n,r,o,i){return N(e,function(e){var t=0<n&&n<ii.cellLength(e)&&o(ii.getCellElement(e,n-1),ii.getCellElement(e,n))?ii.getCell(e,n):fe.elementnew(i(ii.getCellElement(e,r),o),!0);return ii.addCell(e,n,t)})},su=function(e,r,o,i,u){var c=o+1;return N(e,function(e,t){var n=t===r?fe.elementnew(u(ii.getCellElement(e,o),i),!0):ii.getCell(e,o);return ii.addCell(e,c,n)})},du=function(e,t,n,r,o){var i=t+1,u=e.slice(0,i),c=e.slice(i),a=ii.mapCells(e[t],function(e,t){return t===n?fe.elementnew(o(e.element(),r),!0):e});return u.concat([a]).concat(c)},mu=function(e,t,n){return e.slice(0,t).concat(e.slice(n+1))},gu=function(e,n,r){var t=N(e,function(e){var t=e.cells().slice(0,n).concat(e.cells().slice(r+1));return fe.rowcells(t,e.section())});return I(t,function(e){return 0<e.cells().length})},pu=function(e,n,r,o){return N(e,function(e){return ii.mapCells(e,function(e){return t=e,E(n,function(e){return r(t.element(),e.element())})?fe.elementnew(o(e.element(),r),!0):e;var t})})},hu=function(e,t,n,r){return ii.getCellElement(e[t],n)!==undefined&&0<t&&r(ii.getCellElement(e[t-1],n),ii.getCellElement(e[t],n))},vu=function(e,t,n){return 0<t&&n(ii.getCellElement(e,t-1),ii.getCellElement(e,t))},bu=function(n,r,o,e){var t=z(n,function(e,t){return hu(n,t,r,o)||vu(e,r,o)?[]:[ii.getCell(e,r)]});return pu(n,t,o,e)},wu=function(n,r,o,e){var i=n[r],t=z(i.cells(),function(e,t){return hu(n,r,t,o)||vu(i,t,o)?[]:[e]});return pu(n,t,o,e)},yu=function(e){return{fold:e}},xu=function(){return yu(function(e,t,n,r,o){return e()})},Cu=function(i){return yu(function(e,t,n,r,o){return t(i)})},Su=function(i,u){return yu(function(e,t,n,r,o){return n(i,u)})},Ru=function(i,u,c){return yu(function(e,t,n,r,o){return r(i,u,c)})},Tu=function(i,u){return yu(function(e,t,n,r,o){return o(i,u)})},Du=function(e,t,i,u){var n,r,c=e.slice(0),o=(r=t,0===(n=e).length?xu():1===n.length?Cu(0):0===r?Su(0,1):r===n.length-1?Tu(r-1,r):0<r&&r<n.length-1?Ru(r-1,r,r+1):xu()),a=function(e){return N(e,C(0))},l=C(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 Tt(e,t)&&1<parseInt(Rt(e,t),10)},Au={hasColspan:function(e){return Ou(e,"colspan")},hasRowspan:function(e){return Ou(e,"rowspan")},minWidth:C(10),minHeight:C(10),getInt:function(e,t){return parseInt(nn(e,t),10)}},Eu=function(e,t,n){return on(e,t).fold(function(){return n(e)+"px"},function(e){return e})},Nu=function(e){return Eu(e,"width",fo.getPixelWidth)},ku=function(e){return Eu(e,"height",fo.getHeight)},Iu=function(e,t,n,r,o){var i=vi(e),u=N(i,function(e){return e.map(t.edge)});return N(i,function(e,t){return e.filter(m(Au.hasColspan)).fold(function(){var e=pi(u,t);return r(e)},function(e){return n(e,o)})})},Pu=function(e){return e.map(function(e){return e+"px"}).getOr("")},Bu=function(e,t,n,r){var o=bi(e),i=N(o,function(e){return e.map(t.edge)});return N(o,function(e,t){return e.filter(m(Au.hasRowspan)).fold(function(){var e=pi(i,t);return r(e)},function(e){return n(e)})})},Mu={getRawWidths:function(e,t){return Iu(e,t,Nu,Pu)},getPixelWidths:function(e,t,n){return Iu(e,t,fo.getPixelWidth,function(e){return e.getOrThunk(n.minCellWidth)},n)},getPercentageWidths:function(e,t,n){return Iu(e,t,fo.getPercentageWidth,function(e){return e.fold(function(){return n.minCellWidth()},function(e){return e/n.pixelWidth()*100})},n)},getPixelHeights:function(e,t){return Bu(e,t,fo.getHeight,function(e){return e.getOrThunk(Au.minHeight)})},getRawHeights:function(e,t){return Bu(e,t,ku,Pu)}},Wu=function(e,t,n){for(var r=0,o=e;o<t;o++)r+=n[o]!==undefined?n[o]:0;return r},_u=function(e,n){var t=Jt.justCells(e);return N(t,function(e){var t=Wu(e.column(),e.column()+e.colspan(),n);return{element:e.element,width:C(t),colspan:e.colspan}})},Lu=function(e,n){var t=Jt.justCells(e);return N(t,function(e){var t=Wu(e.row(),e.row()+e.rowspan(),n);return{element:e.element,height:C(t),rowspan:e.rowspan}})},ju=function(e,n){return N(e.all(),function(e,t){return{element:e.element,height:C(n[t])}})},zu=function(e){var t=parseInt(e,10),n=o;return{width:C(t),pixelWidth:C(t),getWidths:Mu.getPixelWidths,getCellDelta:n,singleColumnWidth:function(e,t){return[Math.max(Au.minWidth(),e+t)-e]},minCellWidth:Au.minWidth,setElementWidth:fo.setPixelWidth,setTableWidth:function(e,t,n){var r=P(t,function(e,t){return e+t},0);fo.setPixelWidth(e,r)}}},Hu=function(e,t){if(fo.percentageBasedSizeRegex().test(t)){var n=fo.percentageBasedSizeRegex().exec(t);return o=n[1],i=e,u=parseFloat(o),c=$r(i),{width:C(u),pixelWidth:C(c),getWidths:Mu.getPercentageWidths,getCellDelta:function(e){return e/c*100},singleColumnWidth:function(e,t){return[100-e]},minCellWidth:function(){return Au.minWidth()/c*100},setElementWidth:fo.setPercentageWidth,setTableWidth:function(e,t,n){var r=u+n;fo.setPercentageWidth(e,r)}}}if(fo.pixelBasedSizeRegex().test(t)){var r=fo.pixelBasedSizeRegex().exec(t);return zu(r[1])}var o,i,u,c,a=$r(e);return zu(a)},Fu=function(t){return fo.getRawWidth(t).fold(function(){var e=$r(t);return zu(e)},function(e){return Hu(t,e)})},Uu=function(e){return Jt.generate(e)},qu=function(e){var t=Yt(e);return Uu(t)},Vu=function(e,t,n,r){var o=Fu(e),i=o.getCellDelta(t),u=qu(e),c=o.getWidths(u,r,o),a=Du(c,n,i,o),l=N(a,function(e,t){return e+c[t]}),f=_u(u,l);k(f,function(e){o.setElementWidth(e.element(),e.width())}),n===u.grid().columns()-1&&o.setTableWidth(e,l,i)},Gu=function(e,n,r,t){var o=qu(e),i=Mu.getPixelHeights(o,t),u=N(i,function(e,t){return r===t?Math.max(n+e,Au.minHeight()):e}),c=Lu(o,u),a=ju(o,u);k(a,function(e){fo.setHeight(e.element(),e.height())}),k(c,function(e){fo.setHeight(e.element(),e.height())});var l=P(u,function(e,t){return e+t},0);fo.setHeight(e,l)},Yu=function(e,t,n){var r=Fu(e),o=Uu(t),i=r.getWidths(o,n,r),u=_u(o,i);k(u,function(e){r.setElementWidth(e.element(),e.width())});var c=P(i,function(e,t){return t+e},0);0<u.length&&r.setTableWidth(e,c)},Ku=function(e){0===Gt.cells(e).length&&pn(e)},Xu=J("grid","cursor"),$u=function(e,t,n){return Ju(e,t,n).orThunk(function(){return Ju(e,0,0)})},Ju=function(e,t,n){return S.from(e[t]).bind(function(e){return S.from(e.cells()[n]).bind(function(e){return S.from(e.element())})})},Qu=function(e,t,n){return Xu(e,Ju(e,t,n))},Zu=function(e){return B(e,function(e,t){return E(e,function(e){return e.row()===t.row()})?e:e.concat([t])},[]).sort(function(e,t){return e.row()-t.row()})},ec=function(e){return B(e,function(e,t){return E(e,function(e){return e.column()===t.column()})?e:e.concat([t])},[]).sort(function(e,t){return e.column()-t.column()})},tc=function(e,t,n){var r=Kt(e,n),o=Jt.generate(r);return li(o,t,!0)},nc=Yu,rc={insertRowBefore:Hi(function(e,t,n,r){var o=t.row(),i=t.row(),u=lu(e,i,o,n,r.getOrInit);return Qu(u,i,t.column())},Ui,y,y,jo),insertRowsBefore:Hi(function(e,t,n,r){var o=t[0].row(),i=t[0].row(),u=Zu(t),c=B(u,function(e,t){return lu(e,i,o,n,r.getOrInit)},e);return Qu(c,i,t[0].column())},qi,y,y,jo),insertRowAfter:Hi(function(e,t,n,r){var o=t.row(),i=t.row()+t.rowspan(),u=lu(e,i,o,n,r.getOrInit);return Qu(u,i,t.column())},Ui,y,y,jo),insertRowsAfter:Hi(function(e,t,n,r){var o=Zu(t),i=o[o.length-1].row(),u=o[o.length-1].row()+o[o.length-1].rowspan(),c=B(o,function(e,t){return lu(e,u,i,n,r.getOrInit)},e);return Qu(c,u,t[0].column())},qi,y,y,jo),insertColumnBefore:Hi(function(e,t,n,r){var o=t.column(),i=t.column(),u=fu(e,i,o,n,r.getOrInit);return Qu(u,t.row(),i)},Ui,nc,y,jo),insertColumnsBefore:Hi(function(e,t,n,r){var o=ec(t),i=o[0].column(),u=o[0].column(),c=B(o,function(e,t){return fu(e,u,i,n,r.getOrInit)},e);return Qu(c,t[0].row(),u)},qi,nc,y,jo),insertColumnAfter:Hi(function(e,t,n,r){var o=t.column(),i=t.column()+t.colspan(),u=fu(e,i,o,n,r.getOrInit);return Qu(u,t.row(),i)},Ui,nc,y,jo),insertColumnsAfter:Hi(function(e,t,n,r){var o=t[t.length-1].column(),i=t[t.length-1].column()+t[t.length-1].colspan(),u=ec(t),c=B(u,function(e,t){return fu(e,i,o,n,r.getOrInit)},e);return Qu(c,t[0].row(),i)},qi,nc,y,jo),splitCellIntoColumns:Hi(function(e,t,n,r){var o=su(e,t.row(),t.column(),n,r.getOrInit);return Qu(o,t.row(),t.column())},Ui,nc,y,jo),splitCellIntoRows:Hi(function(e,t,n,r){var o=du(e,t.row(),t.column(),n,r.getOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,jo),eraseColumns:Hi(function(e,t,n,r){var o=ec(t),i=gu(e,o[0].column(),o[o.length-1].column()),u=$u(i,t[0].row(),t[0].column());return Xu(i,u)},qi,nc,Ku,jo),eraseRows:Hi(function(e,t,n,r){var o=Zu(t),i=mu(e,o[0].row(),o[o.length-1].row()),u=$u(i,t[0].row(),t[0].column());return Xu(i,u)},qi,y,Ku,jo),makeColumnHeader:Hi(function(e,t,n,r){var o=bu(e,t.column(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,zo("row","th")),unmakeColumnHeader:Hi(function(e,t,n,r){var o=bu(e,t.column(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,zo(null,"td")),makeRowHeader:Hi(function(e,t,n,r){var o=wu(e,t.row(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,zo("col","th")),unmakeRowHeader:Hi(function(e,t,n,r){var o=wu(e,t.row(),n,r.replaceOrInit);return Qu(o,t.row(),t.column())},Ui,y,y,zo(null,"td")),mergeCells:Hi(function(e,t,n,r){var o=t.cells();Qo(o);var i=ou(e,t.bounds(),n,C(o[0]));return Xu(i,S.from(o[0]))},Yi,y,y,Ho),unmergeCells:Hi(function(e,t,n,r){var o=P(t,function(e,t){return iu(e,t,n,r.combine(t))},e);return Xu(o,S.from(t[0]))},Ki,nc,y,Ho),pasteCells:Hi(function(e,n,t,r){var o,i,u,c,a=(o=n.clipboard(),i=n.generators(),u=Yt(o),c=Jt.generate(u),li(c,i,!0)),l=fe.address(n.row(),n.column());return cu(l,e,a,n.generators(),t).fold(function(){return Xu(e,S.some(n.element()))},function(e){var t=$u(e,n.row(),n.column());return Xu(e,t)})},Vi,nc,y,jo),pasteRowsBefore:Hi(function(e,t,n,r){var o=e[t.cells[0].row()],i=t.cells[0].row(),u=tc(t.clipboard(),t.generators(),o),c=au(i,e,u,t.generators(),n),a=$u(c,t.cells[0].row(),t.cells[0].column());return Xu(c,a)},Gi,y,y,jo),pasteRowsAfter:Hi(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=tc(t.clipboard(),t.generators(),o),c=au(i,e,u,t.generators(),n),a=$u(c,t.cells[0].row(),t.cells[0].column());return Xu(c,a)},Gi,y,y,jo)},oc=function(e){return de.fromDom(e.getBody())},ic=function(e){return e.getBoundingClientRect().width},uc=function(e){return e.getBoundingClientRect().height},cc=function(t){return function(e){return nt(e,oc(t))}},ac=function(e){return/^[0-9]+$/.test(e)&&(e+="px"),e},lc=function(e){var t=Bt(e,"td[data-mce-style],th[data-mce-style]");Dt(e,"data-mce-style"),k(t,function(e){Dt(e,"data-mce-style")})},fc={isRtl:C(!1)},sc={isRtl:C(!0)},dc={directionAt:function(e){return"rtl"==("rtl"===nn(e,"direction")?"rtl":"ltr")?sc:fc}},mc={"border-collapse":"collapse",width:"100%"},gc={border:"1"},pc=function(e){return e.getParam("table_default_attributes",gc,"object")},hc=function(e){return e.getParam("table_default_styles",mc,"object")},vc=function(e){return e.getParam("table_cell_advtab",!0,"boolean")},bc=function(e){return e.getParam("table_row_advtab",!0,"boolean")},wc=function(e){return e.getParam("table_advtab",!0,"boolean")},yc=function(e){return e.getParam("table_style_by_css",!1,"boolean")},xc=function(e){return e.getParam("table_class_list",[],"array")},Cc=function(e){return!1===e.getParam("table_responsive_width")},Sc=function(e,t){return e.fire("newrow",{node:t})},Rc=function(e,t){return e.fire("newcell",{node:t})},Tc=function(e,t,n,r){e.fire("ObjectResizeStart",{target:t,width:n,height:r})},Dc=function(e,t,n,r){e.fire("ObjectResized",{target:t,width:n,height:r})},Oc=function(f,e){var t,n=function(e){return"table"===gt(oc(e))},s=(t=f.getParam("table_clone_elements"),v(t)?S.some(t.split(/[ ,]/)):Array.isArray(t)?S.some(t):S.none()),r=function(u,c,a,l){return function(e,t){lc(e);var n=l(),r=de.fromDom(f.getDoc()),o=No(dc.directionAt),i=_n(a,r,s);return c(e)?u(n,e,t,i,o).bind(function(e){return k(e.newRows(),function(e){Sc(f,e.dom())}),k(e.newCells(),function(e){Rc(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})}):S.none()}};return{deleteRow:r(rc.eraseRows,function(e){var t=Io(e);return!1===n(f)||1<t.rows()},y,e),deleteColumn:r(rc.eraseColumns,function(e){var t=Io(e);return!1===n(f)||1<t.columns()},y,e),insertRowsBefore:r(rc.insertRowsBefore,l,y,e),insertRowsAfter:r(rc.insertRowsAfter,l,y,e),insertColumnsBefore:r(rc.insertColumnsBefore,l,so,e),insertColumnsAfter:r(rc.insertColumnsAfter,l,so,e),mergeCells:r(rc.mergeCells,l,y,e),unmergeCells:r(rc.unmergeCells,l,y,e),pasteRowsBefore:r(rc.pasteRowsBefore,l,y,e),pasteRowsAfter:r(rc.pasteRowsAfter,l,y,e),pasteCells:r(rc.pasteCells,l,y,e)}},Ac=function(e,t,r){var n=Yt(e),o=Jt.generate(n);return qi(o,t).map(function(e){var t=li(o,r,!1).slice(e[0].row(),e[e.length-1].row()+e[e.length-1].rowspan()),n=Fi(t,r);return di(n)})},Ec=tinymce.util.Tools.resolve("tinymce.util.Tools"),Nc=function(e,t,n){n&&e.formatter.apply("align"+n,{},t)},kc=function(e,t,n){n&&e.formatter.apply("valign"+n,{},t)},Ic=function(t,n){Ec.each("left center right".split(" "),function(e){t.formatter.remove("align"+e,{},n)})},Pc=function(t,n){Ec.each("top middle bottom".split(" "),function(e){t.formatter.remove("valign"+e,{},n)})},Bc=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))},Mc=function(){return(Mc=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)},Wc=function(t,e){var n=function(e){return Ke(e,"rgb")?t.toHex(e):e};return{borderstyle:on(de.fromDom(e),"border-style").getOr(""),bordercolor:on(de.fromDom(e),"border-color").map(n).getOr(""),backgroundcolor:on(de.fromDom(e),"background-color").map(n).getOr("")}},_c=function(e,t,n,r,o){var i={};return Ec.each(e.split(" "),function(e){r.formatter.matchNode(o,t+e)&&(i[n]=e)}),i[n]||(i[n]=""),i},Lc=b(_c,"left center right"),jc=b(_c,"top middle bottom"),zc=function(e,r,t){var o=function(e,n){return n=n||[],Ec.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||[])},Hc=function(e){var i=e[0],t=e.slice(1),n=q(i);return k(t,function(e){k(n,function(o){G(e,function(e,t,n){var r=i[o];""!==r&&o===t&&r!==e&&(i[o]="")})})}),i},Fc=function(){return{title:"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"}]}},Uc=function(e,t,n){var r,o,i,u=e.dom;return Mc({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")||Bc(e.dom,t,"padding"),border:(r=u,o=t,i=on(de.fromDom(o),"border-width"),yc(e)&&i.isSome()?i.getOr(""):r.getAttrib(o,"border")||Bc(e.dom,o,"border-width")||Bc(e.dom,o,"border")),caption:!!u.select("caption",t)[0],"class":u.getAttrib(t,"class","")},Lc("align","align",e,t),n?Wc(u,t):{})},qc=function(e,t,n){var r=e.dom;return Mc({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()},Lc("align","align",e,t),n?Wc(r,t):{})},Vc=function(e,t,n){var r=e.dom;return Mc({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","")},Lc("align","halign",e,t),jc("valign","valign",e,t),n?Wc(r,t):{})},Gc=function(e,t){var n,r,o,i,u,c,a,l,f=hc(e),s=pc(e),d=e.dom,m=t?(n=d,r=function(e){return Ke(e,"rgb")?n.toHex(e):e},o=X(f,"border-style").getOr(""),i=X(f,"border-color").getOr(""),u=X(f,"background-color").getOr(""),{borderstyle:o,bordercolor:r(i),backgroundcolor:r(u)}):{};return Mc({},{height:"",width:"100%",cellspacing:"",cellpadding:"",caption:!1,"class":"",align:"",border:""},f,s,m,(l=f["border-width"],yc(e)&&l?{border:l}:X(s,"border").fold(function(){return{}},function(e){return{border:e}})),(c=X(f,"border-spacing").or(X(s,"cellspacing")).fold(function(){return{}},function(e){return{cellspacing:e}}),a=X(f,"border-padding").or(X(s,"cellpadding")).fold(function(){return{}},function(e){return{cellpadding:e}}),Mc({},c,a)))},Yc=[{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"}]}],Kc=function(e){return(t=e,n=t.getParam("table_cell_class_list",[],"array"),r=zc(n,function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})}),0<n.length?S.some({name:"class",type:"selectbox",label:"Class",items:r}):S.none()).fold(function(){return Yc},function(e){return Yc.concat(e)});var t,n,r},Xc={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)}}}},$c=function(e,t){e.setAttrib("scope",t.scope),e.setAttrib("class",t["class"]),e.setStyle("width",ac(t.width)),e.setStyle("height",ac(t.height))},Jc=function(e,t){e.setStyle("background-color",t.backgroundcolor),e.setStyle("border-color",t.bordercolor),e.setStyle("border-style",t.borderstyle)},Qc=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=Xc.normal(r,o);$c(i,n),vc(e)&&Jc(i,n),Ic(e,o),Pc(e,o),n.halign&&Nc(e,o,n.halign),n.valign&&kc(e,o,n.valign)},Zc=function(n,e,r){var o=n.dom;Ec.each(e,function(e){r.celltype&&e.nodeName.toLowerCase()!==r.celltype&&(e=o.rename(e,r.celltype));var t=Xc.ifTruthy(o,e);$c(t,r),vc(n)&&Jc(t,r),r.halign&&Nc(n,e,r.halign),r.valign&&kc(n,e,r.valign)})},ea=function(e,t,n){var r=n.getData();n.close(),e.undoManager.transact(function(){(1===t.length?Qc:Zc)(e,t,r),e.focus()})},ta=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=Ec.map(n,function(e){return Vc(t,e,vc(t))}),o=Hc(r),i={type:"tabpanel",tabs:[{title:"General",items:Kc(t)},Fc()]},u={type:"panel",items:[{type:"grid",columns:2,items:Kc(t)}]};t.windowManager.open({title:"Cell Properties",size:"normal",body:vc(t)?i:u,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o,onSubmit:b(ea,t,n)})}},na=[{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"}],ra=function(e){return(t=e,n=t.getParam("table_row_class_list",[],"array"),r=zc(n,function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"tr",classes:[e.value]})})}),0<n.length?S.some({name:"class",type:"selectbox",label:"Class",items:r}):S.none()).fold(function(){return na},function(e){return na.concat(e)});var t,n,r},oa=function(f,e,s,t){var d=f.dom,m=t.getData();t.close();var g=1===e.length?Xc.normal:Xc.ifTruthy;f.undoManager.transact(function(){Ec.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",ac(m.height)),bc(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&&(Ic(f,e),Nc(f,e,m.align))}),f.focus()})},ia=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"),Ec.each(e.rows,function(t){Ec.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=Ec.map(o,function(e){return qc(t,e,bc(t))}),u=Hc(i),c={type:"tabpanel",tabs:[{title:"General",items:ra(t)},Fc()]},a={type:"panel",items:[{type:"grid",columns:2,items:ra(t)}]};t.windowManager.open({title:"Row Properties",size:"normal",body:bc(t)?c:a,buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:u,onSubmit:b(oa,t,o,u)})}},ua=tinymce.util.Tools.resolve("tinymce.Env"),ca={styles:{"border-collapse":"collapse",width:"100%"},attributes:{border:"1"},percentages:!0},aa=function(e,t,n,r,o){void 0===o&&(o=ca);var i=de.fromTag("table");tn(i,o.styles),St(i,o.attributes);var u=de.fromTag("tbody");fn(i,u);for(var c=[],a=0;a<e;a++){for(var l=de.fromTag("tr"),f=0;f<t;f++){var s=a<n||f<r?de.fromTag("th"):de.fromTag("td");f<r&&Ct(s,"scope","row"),a<n&&Ct(s,"scope","col"),fn(s,de.fromTag("br")),o.percentages&&en(s,"width",100/t+"%"),fn(l,s)}c.push(l)}return mn(u,c),i},la=function(e,t){e.selection.select(t.dom(),!0),e.selection.collapse(!0)},fa=function(r,e,t){var n,o=hc(r),i={styles:o,attributes:pc(r),percentages:(n=o.width,v(n)&&-1!==n.indexOf("%")&&!Cc(r))},u=aa(t,e,0,0,i);Ct(u,"data-mce-id","__mce");var c,a,l,f=(c=u,a=de.fromTag("div"),l=de.fromDom(c.dom().cloneNode(!0)),fn(a,l),a.dom().innerHTML);return r.insertContent(f),jt(oc(r),'table[data-mce-id="__mce"]').map(function(e){var t,n;return Cc(r)&&en(e,"width",nn(e,"width")),Dt(e,"data-mce-id"),t=r,k(Bt(e,"tr"),function(e){Sc(t,e.dom()),k(Bt(e,"th,td"),function(e){Rc(t,e.dom())})}),n=r,jt(e,"td,th").each(b(la,n)),e.dom()}).getOr(null)},sa=function(e,t,n,r){if("TD"===t.tagName||"TH"===t.tagName)e.setStyle(t,n,r);else if(t.children)for(var o=0;o<t.children.length;o++)sa(e,t.children[o],n,r)},da=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=fa(n,e,t)}!function(e,t,n){var r,o=e.dom,i={},u={};if(i["class"]=n["class"],u.height=ac(n.height),o.getAttrib(t,"width")&&!yc(e)?i.width=(r=n.width)?r.replace(/px$/,""):"":u.width=ac(n.width),yc(e)?(u["border-width"]=ac(n.border),u["border-spacing"]=ac(n.cellspacing)):(i.border=n.border,i.cellpadding=n.cellpadding,i.cellspacing=n.cellspacing),yc(e)&&t.children)for(var c=0;c<t.children.length;c++)sa(o,t.children[c],{"border-width":ac(n.border),padding:ac(n.cellpadding)}),wc(e)&&sa(o,t.children[c],{"border-color":n.bordercolor});wc(e)&&(u["background-color"]=n.backgroundcolor,u["border-color"]=n.bordercolor,u["border-style"]=n.borderstyle),i.style=o.serializeStyle(ei(hc(e),u)),o.setAttribs(t,ei(pc(e),i))}(n,r,u),(o=i.select("caption",r)[0])&&!u.caption&&i.remove(o),!o&&u.caption&&((o=i.create("caption")).innerHTML=ua.ie?"\xa0":'<br data-mce-bogus="1"/>',r.insertBefore(o,r.firstChild)),""===u.align?Ic(n,r):Nc(n,r,u.align),n.focus(),n.addVisual()})},ma=function(t,e){var n,r=t.dom,o=Gc(t,wc(t));!1===e?(n=r.getParent(t.selection.getStart(),"table"))?o=Uc(t,n,wc(t)):wc(t)&&(o.borderstyle="",o.bordercolor="",o.backgroundcolor=""):(o.cols="1",o.rows="1",wc(t)&&(o.borderstyle="",o.bordercolor="",o.backgroundcolor=""));var i=0<xc(t).length;i&&o["class"]&&(o["class"]=o["class"].replace(/\s*mce\-item\-table\s*/g,""));var u=e?[{type:"input",name:"cols",label:"Cols"},{type:"input",name:"rows",label:"Rows"}]:[],c=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"}]}]:[],a=i?[{type:"selectbox",name:"class",label:"Class",items:zc(xc(t),function(e){e.value&&(e.textStyle=function(){return t.formatter.getCssText({block:"table",classes:[e.value]})})})}]:[],l={type:"grid",columns:2,items:u.concat([{type:"input",name:"width",label:"Width"},{type:"input",name:"height",label:"Height"}]).concat(c).concat([{type:"selectbox",name:"align",label:"Alignment",items:[{text:"None",value:""},{text:"Left",value:"left"},{text:"Center",value:"center"},{text:"Right",value:"right"}]}]).concat(a)},f={type:"panel",items:[l]},s={type:"tabpanel",tabs:[{title:"General",items:[l]},Fc()]},d=wc(t)?s:f;t.windowManager.open({title:"Table Properties",size:"normal",body:d,onSubmit:b(da,t,n),buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0}],initialData:o})},ga=Ec.each,pa=function(c,t,a,l,n){var r=cc(c),f=function(){return de.fromDom(c.dom.getParent(c.selection.getStart(),"th,td"))},s=function(e){return Gt.table(e,r)},d=function(e){return{width:ic(e.dom()),height:ic(e.dom())}},o=function(t){var n=f();s(n).each(function(i){var e=Ur.forMenu(l,i,n),u=d(i);t(i,e).each(function(e){var t,n,r,o;t=c,n=u,o=d(r=i),n.width===o.width&&n.height===o.height||(Tc(t,r.dom(),n.width,n.height),Dc(t,r.dom(),o.width,o.height)),c.selection.setRng(e),c.focus(),a.clear(i),lc(i)})})},i=function(e){var o=f();return s(o).bind(function(e){var t=de.fromDom(c.getDoc()),n=Ur.forMenu(l,e,o),r=_n(y,t,S.none());return Ac(e,n,r)})},u=function(u){n.get().each(function(e){var o=N(e,function(e){return xn(e)}),i=f();s(i).bind(function(t){var e=de.fromDom(c.getDoc()),n=Ln(e),r=Ur.pasteRows(l,t,i,o,n);u(t,r).each(function(e){c.selection.setRng(e),c.focus(),a.clear(t)})})})};ga({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){n.set(i()),o(t.deleteRow)},mceTableCopyRow:function(e){n.set(i())},mceTablePasteRowBefore:function(e){u(t.pasteRowsBefore)},mceTablePasteRowAfter:function(e){u(t.pasteRowsAfter)},mceTableDelete:function(){var e=de.fromDom(c.dom.getParent(c.selection.getStart(),"th,td"));Gt.table(e,r).filter(m(r)).each(function(e){var t=de.fromText("");if(an(e,t),pn(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)}),ga({mceInsertTable:b(ma,c,!0),mceTableProps:b(ma,c,!1),mceTableRowProps:b(ia,c),mceTableCellProps:b(ta,c)},function(n,e){c.addCommand(e,function(e,t){n(t)})})},ha=function(e){var t=S.from(e.dom().documentElement).map(de.fromDom).getOr(e);return{parent:C(t),view:C(e),origin:C(go(0,0))}},va=function(e,t){return{parent:C(t),view:C(e),origin:C(go(0,0))}};function ba(e){var n=J.apply(null,e),r=[];return{bind:function(e){if(e===undefined)throw"Event bind error: undefined handler";r.push(e)},unbind:function(t){r=I(r,function(e){return e!==t})},trigger:function(){var t=n.apply(null,arguments);k(r,function(e){e(t)})}}}var wa={create:function(e){return{registry:Y(e,function(e){return{bind:e.bind,unbind:e.unbind}}),trigger:Y(e,function(e){return e.trigger})}}},ya={mode:Wo(["compare","extract","mutate","sink"]),sink:Wo(["element","start","stop","destroy"]),api:Wo(["forceDrop","drop","move","delayDrop"])},xa={resolve:xi("ephox-dragster").resolve},Ca=function(m,g){return function(e){if(m(e)){var t,n,r,o,i,u,c,a=de.fromDom(e.target),l=function(){e.stopPropagation()},f=function(){e.preventDefault()},s=x(f,l),d=(t=a,n=e.clientX,r=e.clientY,o=l,i=f,u=s,c=e,{target:C(t),x:C(n),y:C(r),stop:o,prevent:i,kill:u,raw:C(c)});g(d)}}},Sa=function(e,t,n,r){return o=e,i=t,u=!1,c=Ca(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=C(!0),Da=function(e,t,n){return Sa(e,t,Ta,n)},Oa=ya.mode({compare:function(e,t){return go(t.left()-e.left(),t.top()-e.top())},extract:function(e){return S.some(go(e.x(),e.y()))},sink:function(e,t){var n=function c(e){var t=ei({layerClass:xa.resolve("blocker")},e),n=de.fromTag("div");return Ct(n,"role","presentation"),tn(n,{position:"fixed",left:"0px",top:"0px",width:"100%",height:"100%"}),Oi(n,xa.resolve("blocker")),Oi(n,t.layerClass),{element:function(){return n},destroy:function(){pn(n)}}}(t),r=Da(n.element(),"mousedown",e.forceDrop),o=Da(n.element(),"mouseup",e.drop),i=Da(n.element(),"mousemove",e.move),u=Da(n.element(),"mouseout",e.delayDrop);return ya.sink({element:n.element,start:function(e){fn(e,n.element())},stop:function(){pn(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 Aa(){var i=S.none(),u=wa.create({move:ba(["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=S.some(n),r).each(function(e){u.trigger.move(e)})})},reset:function(){i=S.none()},events:u.registry}}function Ea(){var e=function r(e){return{onEvent:function(e,t){},reset:y}}(),t=Aa(),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 Na=function(t,n,e){var r,o,i,u=!1,c=wa.create({start:ba([]),stop:ba([])}),a=Ea(),l=function(){d.stop(),a.isOn()&&(a.off(),c.trigger.stop())},f=(r=l,o=200,i=null,{cancel:function(){null!==i&&(clearTimeout(i),i=null)},throttle:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];null!==i&&clearTimeout(i),i=setTimeout(function(){r.apply(null,e),i=null},o)}});a.events.move.bind(function(e){n.mutate(t,e.info())});var s=function(t){return function(){var e=Array.prototype.slice.call(arguments,0);if(u)return t.apply(null,e)}},d=n.sink(ya.api({forceDrop:l,drop:s(l),move:s(function(e,t){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}},ka={transform:function(e,t){var n=t!==undefined?t:{},r=n.mode!==undefined?n.mode:Oa;return Na(e,r,t)}};function Ia(){var n=wa.create({drag:ba(["xDelta","yDelta","target"])}),r=S.none(),e=function t(){var n=wa.create({drag:ba(["xDelta","yDelta"])});return{mutate:function(e,t){n.trigger.drag(e,t)},events:n.registry}}();return e.events.drag.bind(function(t){r.each(function(e){n.trigger.drag(t.xDelta(),t.yDelta(),e)})}),{assign:function(e){r=S.some(e)},get:function(){return r},mutate:e.mutate,events:n.registry}}var Pa=function(e,t,n){return zt(e,t,n).isSome()},Ba=Ci.resolve("resizer-bar-dragging");function Ma(e,n){var r=Ao.height,t=function m(o,t,i){var n=Ia(),r=ka.transform(n,{}),u=S.none(),e=function(e,t){return S.from(Rt(e,t))};n.events.drag.bind(function(n){e(n.target(),"data-row").each(function(e){var t=Au.getInt(n.target(),"top");en(n.target(),"top",t+n.yDelta()+"px")}),e(n.target(),"data-column").each(function(e){var t=Au.getInt(n.target(),"left");en(n.target(),"left",t+n.xDelta()+"px")})});var c=function(e,t){return Au.getInt(e,t)-parseInt(Rt(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");Dt(r,"data-initial-top"),d.trigger.adjustHeight(n,t,parseInt(e,10))}),e(r,"data-column").each(function(e){var t=c(r,"left");Dt(r,"data-initial-left"),d.trigger.adjustWidth(n,t,parseInt(e,10))}),_i.refresh(o,n,i,t)})})});var a=function(e,t){d.trigger.startAdjust(),n.assign(e),Ct(e,"data-initial-"+t,parseInt(nn(e,t),10)),Oi(e,Ba),en(e,"opacity","0.2"),r.go(o.parent())},l=Da(o.parent(),"mousedown",function(e){_i.isRowBar(e.target())&&a(e.target(),"top"),_i.isColBar(e.target())&&a(e.target(),"left")}),f=function(e){return nt(e,o.view())},s=Da(o.view(),"mouseover",function(e){"table"===gt(e.target())||Pa(e.target(),"table",f)?(u="table"===gt(e.target())?S.some(e.target()):_t(e.target(),"table",f)).each(function(e){_i.refresh(o,e,i,t)}):At(e.target())&&_i.destroy(o)}),d=wa.create({adjustHeight:ba(["table","delta","row"]),adjustWidth:ba(["table","delta","column"]),startAdjust:ba([])});return{destroy:function(){l.unbind(),s.unbind(),r.destroy(),_i.destroy(o)},refresh:function(e){_i.refresh(o,e,i,t)},on:r.on,off:r.off,hideBars:b(_i.hide,o),showBars:b(_i.show,o),events:d.registry}}(e,n,r),o=wa.create({beforeResize:ba(["table"]),afterResize:ba(["table"]),startDrag:ba([])});return t.events.adjustHeight.bind(function(e){o.trigger.beforeResize(e.table());var t=r.delta(e.delta(),e.table());Gu(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());Vu(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}}var Wa=function(e,t){return e.inline?va(oc(e),(n=de.fromTag("div"),tn(n,{position:"static",height:"0",width:"0",padding:"0",margin:"0",border:"0"}),fn(Et(),n),n)):ha(de.fromDom(e.getDoc()));var n},_a=function(e,t){e.inline&&pn(t.parent())},La=function(u){var c,a,o=S.none(),i=S.none(),l=S.none(),f=/(\d+(\.\d+)?)%/,s=function(e){return"TABLE"===e.nodeName};return u.on("init",function(){var e,t=No(dc.directionAt),n=Wa(u);if(l=S.some(n),("table"===(e=u.getParam("object_resizing",!0))||e)&&u.getParam("table_resize_bars",!0,"boolean")){var r=Ma(n,t);r.on(),r.events.startDrag.bind(function(e){o=S.some(u.selection.getRng())}),r.events.beforeResize.bind(function(e){var t=e.table().dom();Tc(u,t,ic(t),uc(t))}),r.events.afterResize.bind(function(e){var t=e.table(),n=t.dom();lc(t),o.each(function(e){u.selection.setRng(e),u.focus()}),Dc(u,n,ic(n),uc(n)),u.undoManager.add()}),i=S.some(r)}}),u.on("ObjectResizeStart",function(e){var t,n=e.target;s(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(s(t)){var n=t;if(f.test(a)){var r=parseFloat(f.exec(a)[1]),o=e.width*r/c;u.dom.setStyle(n,"width",o+"%")}else{var i=[];Ec.each(n.rows,function(e){Ec.each(e.cells,function(e){var t=u.dom.getStyle(e,"width",!0);i.push({cell:e,width:t})})}),Ec.each(i,function(e){u.dom.setStyle(e.cell,"width",e.width),u.dom.setAttrib(e.cell,"width",null)})}}}),{lazyResize:function(){return i},lazyWire:function(){return l.getOr(ha(de.fromDom(u.getBody())))},destroy:function(){i.each(function(e){e.destroy()}),l.each(function(e){_a(u,e)})}}},ja=function(e){return{fold:e}},za=function(o){return ja(function(e,t,n,r){return e(o)})},Ha=function(o){return ja(function(e,t,n,r){return t(o)})},Fa=function(o,i){return ja(function(e,t,n,r){return n(o,i)})},Ua=function(o){return ja(function(e,t,n,r){return r(o)})},qa=function(n,e){return Gt.table(n,e).bind(function(e){var t=Gt.cells(e);return W(t,function(e){return nt(n,e)}).map(function(e){return{index:C(e),all:C(t)}})})},Va=function(t,e){return qa(t,e).fold(function(){return za(t)},function(e){return e.index()+1<e.all().length?Fa(t,e.all()[e.index()+1]):Ua(t)})},Ga=function(t,e){return qa(t,e).fold(function(){return za()},function(e){return 0<=e.index()-1?Fa(t,e.all()[e.index()-1]):Ha(t)})},Ya=Br([{before:["element"]},{on:["element","offset"]},{after:["element"]}]),Ka={before:Ya.before,on:Ya.on,after:Ya.after,cata:function(e,t,n,r){return e.fold(t,n,r)},getStart:function(e){return e.fold(o,o,o)}},Xa=Br([{domRange:["rng"]},{relative:["startSitu","finishSitu"]},{exact:["start","soffset","finish","foffset"]}]),$a=J("start","soffset","finish","foffset"),Ja=function(e){var t,n=e.match({domRange:function(e){return de.fromDom(e.startContainer)},relative:function(e,t){return Ka.getStart(e)},exact:function(e,t,n,r){return e}});return t=n.dom().ownerDocument.defaultView,de.fromDom(t)},Qa=(Xa.domRange,Xa.relative),Za=Xa.exact,el=function(e,t,n,r){var o,i,u,c,a,l=(i=t,u=n,c=r,(a=it(o=e).dom().createRange()).setStart(o.dom(),i),a.setEnd(u.dom(),c),a),f=nt(e,n)&&t===r;return l.collapsed&&!f},tl=function(e,t){e.selectNodeContents(t.dom())},nl=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},rl=function(e,t,n,r,o){var i=e.document.createRange();return i.setStart(t.dom(),n),i.setEnd(r.dom(),o),i},ol=function(e){return{left:C(e.left),top:C(e.top),right:C(e.right),bottom:C(e.bottom),width:C(e.width),height:C(e.height)}},il=Br([{ltr:["start","soffset","finish","foffset"]},{rtl:["start","soffset","finish","foffset"]}]),ul=function(e,t,n){return t(de.fromDom(n.startContainer),n.startOffset,de.fromDom(n.endContainer),n.endOffset)},cl=function(e,t){var o,n,r,i=(o=e,t.match({domRange:function(e){return{ltr:C(e),rtl:S.none}},relative:function(e,t){return{ltr:Oe(function(){return nl(o,e,t)}),rtl:Oe(function(){return S.some(nl(o,t,e))})}},exact:function(e,t,n,r){return{ltr:Oe(function(){return rl(o,e,t,n,r)}),rtl:Oe(function(){return S.some(rl(o,n,r,e,t))})}}}));return(r=(n=i).ltr()).collapsed?n.rtl().filter(function(e){return!1===e.collapsed}).map(function(e){return il.rtl(de.fromDom(e.endContainer),e.endOffset,de.fromDom(e.startContainer),e.startOffset)}).getOrThunk(function(){return ul(0,il.ltr,r)}):ul(0,il.ltr,r)},al=function(i,e){return cl(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}})},ll=(il.ltr,il.rtl,function(e,t,n){return t>=e.left&&t<=e.right&&n>=e.top&&n<=e.bottom}),fl=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=Rn(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)},sl=function(t,n,r,o){var e=t.dom().createRange();e.selectNode(n.dom());var i=e.getClientRects();return ni(i,function(e){return ll(e,r,o)?S.some(e):S.none()}).map(function(e){return fl(t,n,r,o,e)})},dl=function(t,e,n,r){var o=t.dom().createRange(),i=ft(e);return ni(i,function(e){return o.selectNode(e.dom()),ll(o.getBoundingClientRect(),n,r)?ml(t,e,n,r):S.none()})},ml=function(e,t,n,r){return(wt(t)?sl:dl)(e,t,n,r)},gl=function(e,t){return t-e.left<e.right-t},pl=function(e,t,n){var r=e.dom().createRange();return r.selectNode(t.dom()),r.collapse(n),r},hl=function(t,e,n){var r=t.dom().createRange();r.selectNode(e.dom());var o=r.getBoundingClientRect(),i=gl(o,n);return(!0===i?Nn:kn)(e).map(function(e){return pl(t,e,i)})},vl=function(e,t,n){var r=t.dom().getBoundingClientRect(),o=gl(r,n);return S.some(pl(e,t,o))},bl=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 ml(e,t,u,c)}(e,t,Math.max(i.left,Math.min(i.right,n)),Math.max(i.top,Math.min(i.bottom,r)))},wl=document.caretPositionFromPoint?function(n,e,t){return S.from(n.dom().caretPositionFromPoint(e,t)).bind(function(e){if(null===e.offsetNode)return S.none();var t=n.dom().createRange();return t.setStart(e.offsetNode,e.offset),t.collapse(),S.some(t)})}:document.caretRangeFromPoint?function(e,t,n){return S.from(e.dom().caretRangeFromPoint(t,n))}:function(o,i,t){return de.fromPoint(o,i,t).bind(function(r){var e=function(){return e=o,n=i,(0===ft(t=r).length?vl:hl)(e,t,n);var e,t,n};return 0===ft(r).length?e():bl(o,r,i,t).orThunk(e)})},yl=function(e,t){var n=gt(e);return"input"===n?Ka.after(e):A(["br","img"],n)?0===t?Ka.before(e):Ka.after(e):Ka.on(e,t)},xl=function(e,t){var n=e.fold(Ka.before,yl,Ka.after),r=t.fold(Ka.before,yl,Ka.after);return Qa(n,r)},Cl=function(e,t,n,r){var o=yl(e,t),i=yl(n,r);return Qa(o,i)},Sl=function(e,t){S.from(e.getSelection()).each(function(e){e.removeAllRanges(),e.addRange(t)})},Rl=function(e,t,n,r,o){var i=rl(e,t,n,r,o);Sl(e,i)},Tl=function(s,e){return cl(s,e).match({ltr:function(e,t,n,r){Rl(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){Rl(s,n,r,e,t)}else Rl(s,n,r,e,t)}})},Dl=function(e){var o=Ja(e).dom(),t=function(e,t,n,r){return rl(o,e,t,n,r)},n=e.match({domRange:function(e){var t=de.fromDom(e.startContainer),n=de.fromDom(e.endContainer);return Cl(t,e.startOffset,n,e.endOffset)},relative:xl,exact:Cl});return cl(o,n).match({ltr:t,rtl:t})},Ol=function(e){var t=de.fromDom(e.anchorNode),n=de.fromDom(e.focusNode);return el(t,e.anchorOffset,n,e.focusOffset)?S.some($a(de.fromDom(e.anchorNode),e.anchorOffset,de.fromDom(e.focusNode),e.focusOffset)):function(e){if(0<e.rangeCount){var t=e.getRangeAt(0),n=e.getRangeAt(e.rangeCount-1);return S.some($a(de.fromDom(t.startContainer),t.startOffset,de.fromDom(n.endContainer),n.endOffset))}return S.none()}(e)},Al=function(e,t){var n,r,o=(n=t,r=e.document.createRange(),tl(r,n),r);Sl(e,o)},El=function(e){return(t=e,S.from(t.getSelection()).filter(function(e){return 0<e.rangeCount}).bind(Ol)).map(function(e){return Za(e.start(),e.soffset(),e.finish(),e.foffset())});var t},Nl=function(e,t){var n,r,o,i=al(e,t);return r=(n=i).getClientRects(),0<(o=0<r.length?r[0]:n.getBoundingClientRect()).width||0<o.height?S.some(o).map(ol):S.none()},kl=function(e,t,n){return r=e,o=t,i=n,u=de.fromDom(r.document),wl(u,o,i).map(function(e){return $a(de.fromDom(e.startContainer),e.startOffset,de.fromDom(e.endContainer),e.endOffset)});var r,o,i,u},Il=tinymce.util.Tools.resolve("tinymce.util.VK"),Pl=function(e,t,n,r){return _l(e,t,Va(n),r)},Bl=function(e,t,n,r){return _l(e,t,Ga(n),r)},Ml=function(e,t){var n=Za(t,0,t,0);return Dl(n)},Wl=function(e,t){var n,r=Bt(t,"tr");return(n=r,0===n.length?S.none():S.some(n[n.length-1])).bind(function(e){return jt(e,"td,th").map(function(e){return Ml(0,e)})})},_l=function(r,e,t,o,n){return t.fold(S.none,S.none,function(e,t){return Nn(t).map(function(e){return Ml(0,e)})},function(n){return Gt.table(n,e).bind(function(e){var t=Ur.noMenu(n);return r.undoManager.transact(function(){o.insertRowsAfter(e,t)}),Wl(0,e)})})},Ll=["table","li","dl"],jl=function(t,n,r,o){if(t.keyCode===Il.TAB){var i=oc(n),u=function(e){var t=gt(e);return nt(e,i)||A(Ll,t)},e=n.selection.getRng();if(e.collapsed){var c=de.fromDom(e.startContainer);Gt.cell(c,u).each(function(e){t.preventDefault(),(t.shiftKey?Bl:Pl)(n,u,e,r,o).each(function(e){n.selection.setRng(e)})})}}},zl={response:J("selection","kill")},Hl=function(t){return function(e){return e===t}},Fl=Hl(38),Ul=Hl(40),ql={ltr:{isBackward:Hl(37),isForward:Hl(39)},rtl:{isBackward:Hl(39),isForward:Hl(37)},isUp:Fl,isDown:Ul,isNavigation:function(e){return 37<=e&&e<=40}},Vl=function(e,t){var n=al(e,t);return{start:C(de.fromDom(n.startContainer)),soffset:C(n.startOffset),finish:C(de.fromDom(n.endContainer)),foffset:C(n.endOffset)}},Gl=function(e,t,n,r){return{start:C(Ka.on(e,t)),finish:C(Ka.on(n,r))}};function Yl(c){return{elementFromPoint:function(e,t){return de.fromPoint(de.fromDom(c.document),e,t)},getRect:function(e){return e.dom().getBoundingClientRect()},getRangedRect:function(e,t,n,r){var o=Za(e,t,n,r);return Nl(c,o).map(function(e){return Y(e,a)})},getSelection:function(){return El(c).map(function(e){return Vl(c,e)})},fromSitus:function(e){var t=Qa(e.start(),e.finish());return Vl(c,t)},situsFromPoint:function(e,t){return kl(c,e,t).map(function(e){return{start:C(Ka.on(e.start(),e.soffset())),finish:C(Ka.on(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=Cl(n,r,o,i),Tl(t,u)},setRelativeSelection:function(e,t){var n,r;n=c,r=xl(e,t),Tl(n,r)},selectContents:function(e){Al(c,e)},getInnerHeight:function(){return c.innerHeight},getScrollY:function(){var e,t,n,r;return(e=de.fromDom(c.document),t=e!==undefined?e.dom():document,n=t.body.scrollLeft||t.documentElement.scrollLeft,r=t.body.scrollTop||t.documentElement.scrollTop,go(n,r)).top()},scrollBy:function(e,t){var n,r,o;n=e,r=t,((o=de.fromDom(c.document))!==undefined?o.dom():document).defaultView.scrollBy(n,r)}}}tt.detect().browser.isSafari();var Kl=function(n,e,r,t,o){return nt(r,t)?S.none():Rr(r,t,e).bind(function(e){var t=e.boxes().getOr([]);return 0<t.length?(o(n,t,e.start(),e.finish()),S.some(zl.response(S.some(Gl(r,0,r,On(r))),!0))):S.none()})},Xl={sync:function(n,r,e,t,o,i,u){return nt(e,o)&&t===i?S.none():zt(e,"td,th",r).bind(function(t){return zt(o,"td,th",r).bind(function(e){return Kl(n,r,t,e,u)})})},detect:Kl,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()})}},$l=re(["left","top","right","bottom"],[]),Jl={nu:$l,moveUp:function(e,t){return $l({left:e.left(),top:e.top()-t,right:e.right(),bottom:e.bottom()-t})},moveDown:function(e,t){return $l({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 $l({left:e.left(),top:t-n,right:e.right(),bottom:t})},moveTopTo:function(e,t){var n=e.bottom()-e.top();return $l({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 $l({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()+")"}},Ql=function(e){return Jl.nu({left:e.left,top:e.top,right:e.right,bottom:e.bottom})},Zl=function(e,t){return S.some(e.getRect(t))},ef=function(e,t,n){return bt(t)?Zl(e,t).map(Ql):wt(t)?(r=e,o=t,i=n,0<=i&&i<On(o)?r.getRangedRect(o,i,o,i+1):0<i?r.getRangedRect(o,i-1,o,i):S.none()).map(Ql):S.none();var r,o,i},tf=function(e,t){return bt(t)?Zl(e,t).map(Ql):wt(t)?e.getRangedRect(t,0,t,On(t)).map(Ql):S.none()},nf=J("item","mode"),rf=function(e,t,n,r){var o=r!==undefined?r:of;return e.property().parent(t).map(function(e){return nf(e,o)})},of=function(e,t,n,r){var o=r!==undefined?r:uf;return n.sibling(e,t).map(function(e){return nf(e,o)})},uf=function(e,t,n,r){var o=r!==undefined?r:uf,i=e.property().children(t);return n.first(i).map(function(e){return nf(e,o)})},cf=[{current:rf,next:of,fallback:S.none()},{current:of,next:uf,fallback:S.some(rf)},{current:uf,next:uf,fallback:S.some(of)}],af=function(t,n,r,o,e){return e=e!==undefined?e:cf,M(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 af(t,n,e,o)})})})},lf={backtrack:rf,sidestep:of,advance:uf,go:af},ff={left:function(){return{sibling:function(e,t){return e.query().prevSibling(t)},first:function(e){return 0<e.length?S.some(e[e.length-1]):S.none()}}},right:function(){return{sibling:function(e,t){return e.query().nextSibling(t)},first:function(e){return 0<e.length?S.some(e[0]):S.none()}}}},sf=function(t,e,n,r,o,i){return lf.go(t,e,r,o).bind(function(e){return i(e.item())?S.none():n(e.item())?S.some(e.item()):sf(t,e.item(),n,e.mode(),o,i)})},df=function(e,t,n,r){return sf(e,t,n,lf.sidestep,ff.left(),r)},mf=function(e,t,n,r){return sf(e,t,n,lf.sidestep,ff.right(),r)},gf=function(e,t){return 0===e.property().children(t).length},pf=function(e,t,n,r){return df(e,t,n,r)},hf=function(e,t,n,r){return mf(e,t,n,r)},vf={before:function(e,t,n){return pf(e,t,b(gf,e),n)},after:function(e,t,n){return hf(e,t,b(gf,e),n)},seekLeft:pf,seekRight:hf,walkers:function(){return{left:ff.left,right:ff.right}},walk:function(e,t,n,r,o){return lf.go(e,t,n,r,o)},backtrack:lf.backtrack,sidestep:lf.sidestep,advance:lf.advance},bf=zn(),wf={before:function(e,t){return vf.before(bf,e,t)},after:function(e,t){return vf.after(bf,e,t)},seekLeft:function(e,t,n){return vf.seekLeft(bf,e,t,n)},seekRight:function(e,t,n){return vf.seekRight(bf,e,t,n)},walkers:function(){return vf.walkers()},walk:function(e,t,n,r){return vf.walk(bf,e,t,n,r)}},yf=Br([{none:[]},{retry:["caret"]}]),xf=function(t,e,r){return(n=e,o=Xo,Mt(function(e){return o(e)},Wt,n,o,i)).fold(C(!1),function(e){return tf(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},Cf={point:Jl.getTop,adjuster:function(e,t,n,r,o){var i=Jl.moveUp(o,5);return Math.abs(n.top()-r.top())<1?yf.retry(i):n.bottom()<o.top()?yf.retry(i):n.bottom()===o.top()?yf.retry(Jl.moveUp(o,1)):xf(e,t,o)?yf.retry(Jl.translate(i,5,0)):yf.none()},move:Jl.moveUp,gather:wf.before},Sf={point:Jl.getBottom,adjuster:function(e,t,n,r,o){var i=Jl.moveDown(o,5);return Math.abs(n.bottom()-r.bottom())<1?yf.retry(i):n.top()>o.bottom()?yf.retry(i):n.top()===o.bottom()?yf.retry(Jl.moveDown(o,1)):xf(e,t,o)?yf.retry(Jl.translate(i,5,0)):yf.none()},move:Jl.moveDown,gather:wf.after},Rf=function(n,r,o,i,u){return 0===u?S.some(i):(a=n,l=i.left(),f=r.point(i),a.elementFromPoint(l,f).filter(function(e){return"table"===gt(e)}).isSome()?(t=i,c=u-1,Rf(n,e=r,o,e.move(t,5),c)):n.situsFromPoint(i.left(),r.point(i)).bind(function(e){return e.start().fold(S.none,function(t,e){return tf(n,t,e).bind(function(e){return r.adjuster(n,t,e,o,i).fold(S.none,function(e){return Rf(n,r,o,e,u-1)})}).orThunk(function(){return S.some(i)})},S.none)}));var e,t,c,a,l,f},Tf=function(t,n,e){var r,o,i,u=t.move(e,5),c=Rf(n,t,e,u,100).getOr(u);return(r=t,o=c,i=n,r.point(o)>i.getInnerHeight()?S.some(r.point(o)-i.getInnerHeight()):r.point(o)<0?S.some(-r.point(o)):S.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)})},Df={tryUp:b(Tf,Cf),tryDown:b(Tf,Sf),ieTryUp:function(e,t){return e.situsFromPoint(t.left(),t.top()-5)},ieTryDown:function(e,t){return e.situsFromPoint(t.left(),t.bottom()+5)},getJumpSize:C(5)},Of=Br([{none:["message"]},{success:[]},{failedUp:["cell"]},{failedDown:["cell"]}]),Af=function(e){return zt(e,"tr")},Ef={verify:function(c,e,t,n,r,a,o){return zt(n,"td,th",o).bind(function(u){return zt(e,"td,th",o).map(function(i){return nt(u,i)?nt(n,u)&&On(u)===r?a(i):Of.none("in same cell"):ur.sharedOne(Af,[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?Of.success():a(i);var e,t,n,r,o},function(e){return a(i)})})}).getOr(Of.none("default"))},cata:function(e,t,n,r,o){return e.fold(t,n,r,o)},adt:Of},Nf={point:J("element","offset"),delta:J("element","deltaOffset"),range:J("element","start","finish"),points:J("begin","end"),text:J("element","text")},kf=(J("ancestor","descendants","element","index"),J("parent","children","element","index")),If=function(e,t){return W(e,b(nt,t))},Pf=function(e){return"br"===gt(e)},Bf=function(e,t,n){return t(e,n).bind(function(e){return wt(e)&&0===Rn(e).trim().length?Bf(e,t,n):S.some(e)})},Mf=function(t,e,n,r){return(o=e,i=n,st(o,i).filter(Pf).orThunk(function(){return st(o,i-1).filter(Pf)})).bind(function(e){return r.traverse(e).fold(function(){return Bf(e,r.gather,t).map(r.relative)},function(e){return(r=e,ut(r).bind(function(t){var n=ft(t);return If(n,r).map(function(e){return kf(t,n,r,e)})})).map(function(e){return Ka.on(e.parent(),e.index())});var r})});var o,i},Wf=function(e,t,n,r){var o,i,u;return(Pf(t)?(o=e,i=t,(u=r).traverse(i).orThunk(function(){return Bf(i,u.gather,o)}).map(u.relative)):Mf(e,t,n,r)).map(function(e){return{start:C(e),finish:C(e)}})},_f=function(e){return Ef.cata(e,function(e){return S.none()},function(){return S.none()},function(e){return S.some(Nf.point(e,0))},function(e){return S.some(Nf.point(e,On(e)))})},Lf=tt.detect(),jf=function(r,o,i,u,c,a){return 0===a?S.none():Ff(r,o,i,u,c).bind(function(e){var t=r.fromSitus(e),n=Ef.verify(r,i,u,t.finish(),t.foffset(),c.failure,o);return Ef.cata(n,function(){return S.none()},function(){return S.some(e)},function(e){return nt(i,e)&&0===u?zf(r,i,u,Jl.moveUp,c):jf(r,o,e,0,c,a-1)},function(e){return nt(i,e)&&u===On(e)?zf(r,i,u,Jl.moveDown,c):jf(r,o,e,On(e),c,a-1)})})},zf=function(t,e,n,r,o){return ef(t,e,n).bind(function(e){return Hf(t,o,r(e,Df.getJumpSize()))})},Hf=function(e,t,n){return Lf.browser.isChrome()||Lf.browser.isSafari()||Lf.browser.isFirefox()||Lf.browser.isEdge()?t.otherRetry(e,n):Lf.browser.isIE()?t.ieRetry(e,n):S.none()},Ff=function(t,e,n,r,o){return ef(t,n,r).bind(function(e){return Hf(t,o,e)})},Uf=function(t,n,r){return(o=t,i=n,u=r,o.getSelection().bind(function(r){return Wf(i,r.finish(),r.foffset(),u).fold(function(){return S.some(Nf.point(r.finish(),r.foffset()))},function(e){var t=o.fromSitus(e),n=Ef.verify(o,r.finish(),r.foffset(),t.finish(),t.foffset(),u.failure,i);return _f(n)})})).bind(function(e){return jf(t,n,e.element(),e.offset(),r,20).map(t.fromSitus)});var o,i,u},qf=tt.detect(),Vf=function(e,t){return Wt(e,function(e){return ut(e).exists(function(e){return nt(e,t)})},n).isSome();var n},Gf=function(t,r,o,e,i){return zt(e,"td,th",r).bind(function(n){return zt(n,"table",r).bind(function(e){return Vf(i,e)?Uf(t,r,o).bind(function(t){return zt(t.finish(),"td,th",r).map(function(e){return{start:C(n),finish:C(e),range:C(t)}})}):S.none()})})},Yf=function(e,t,n,r,o,i){return qf.browser.isIE()?S.none():i(r,t).orThunk(function(){return Gf(e,t,n,r,o).map(function(e){var t=e.range();return zl.response(S.some(Gl(t.start(),t.soffset(),t.finish(),t.foffset())),!0)})})},Kf=function(e,t,n,r,o,i,u){return Gf(e,n,r,o,i).bind(function(e){return Xl.detect(t,n,e.start(),e.finish(),u)})},Xf=function(e,r){return zt(e,"tr",r).bind(function(n){return zt(n,"table",r).bind(function(e){var t=Bt(e,"tr");return nt(n,t[0])?wf.seekLeft(e,function(e){return kn(e).isSome()},r).map(function(e){var t=On(e);return zl.response(S.some(Gl(e,t,e,t)),!0)}):S.none()})})},$f=function(e,r){return zt(e,"tr",r).bind(function(n){return zt(n,"table",r).bind(function(e){var t=Bt(e,"tr");return nt(n,t[t.length-1])?wf.seekRight(e,function(e){return Nn(e).isSome()},r).map(function(e){return zl.response(S.some(Gl(e,0,e,0)),!0)}):S.none()})})},Jf=function(e,t){return zt(e,"td,th",t)},Qf={down:{traverse:lt,gather:wf.after,relative:Ka.before,otherRetry:Df.tryDown,ieRetry:Df.ieTryDown,failure:Ef.adt.failedDown},up:{traverse:at,gather:wf.before,relative:Ka.before,otherRetry:Df.tryUp,ieRetry:Df.ieTryUp,failure:Ef.adt.failedUp}},Zf=J("rows","cols"),es={mouse:function(e,t,n,r){var o=function c(o,i,t,u){var n=S.none(),e=function(){n=S.none()};return{mousedown:function(e){u.clear(i),n=Jf(e.target(),t)},mouseover:function(e){n.each(function(r){u.clear(i),Jf(e.target(),t).each(function(n){Rr(r,n,t).each(function(e){var t=e.boxes().getOr([]);(1<t.length||1===t.length&&!nt(r,n))&&(u.selectRange(i,t,e.start(),e.finish()),o.selectContents(n))})})})},mouseup:function(){n.each(e)}}}(Yl(e),t,n,r);return{mousedown:o.mousedown,mouseover:o.mouseover,mouseup:o.mouseup}},keyboard:function(e,a,l,f){var s=Yl(e),d=function(){return f.clear(a),S.none()};return{keydown:function(e,t,n,r,o,i){var u=e.raw().which,c=!0===e.raw().shiftKey;return Tr(a,f.selectedSelector()).fold(function(){return ql.isDown(u)&&c?b(Kf,s,a,l,Qf.down,r,t,f.selectRange):ql.isUp(u)&&c?b(Kf,s,a,l,Qf.up,r,t,f.selectRange):ql.isDown(u)?b(Yf,s,l,Qf.down,r,t,$f):ql.isUp(u)?b(Yf,s,l,Qf.up,r,t,Xf):S.none},function(t){var e=function(e){return function(){return ni(e,function(e){return Xl.update(e.rows(),e.cols(),a,t,f)}).fold(function(){return Or(a,f.firstSelectedSelector(),f.lastSelectedSelector()).map(function(e){var t=ql.isDown(u)||i.isForward(u)?Ka.after:Ka.before;return s.setRelativeSelection(Ka.on(e.first(),0),t(e.table())),f.clear(a),zl.response(S.none(),!0)})},function(e){return S.some(zl.response(S.none(),!0))})}};return ql.isDown(u)&&c?e([Zf(1,0)]):ql.isUp(u)&&c?e([Zf(-1,0)]):i.isBackward(u)&&c?e([Zf(0,-1),Zf(-1,0)]):i.isForward(u)&&c?e([Zf(0,1),Zf(1,0)]):ql.isNavigation(u)&&!1===c?d:S.none})()},keyup:function(t,n,r,o,i){return Tr(a,f.selectedSelector()).fold(function(){var e=t.raw().which;return 0==(!0===t.raw().shiftKey)?S.none():ql.isNavigation(e)?Xl.sync(a,l,n,r,o,i,f.selectRange):S.none()},S.none)}}}},ts=function(r,e){k(e,function(e){var t,n;n=e,Ri(t=r)?t.dom().classList.remove(n):Di(t,n),Ai(t)})},ns={byClass:function(o){var t,n,i=(t=o.selected(),function(e){Oi(e,t)}),r=(n=[o.selected(),o.lastSelected(),o.firstSelected()],function(e){ts(e,n)}),u=function(e){var t=Bt(e,o.selectedSelector());k(t,r)};return{clear:u,selectRange:function(e,t,n,r){u(e),k(t,i),Oi(n,o.firstSelected()),Oi(r,o.lastSelected())},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}},byAttr:function(o){var n=function(e){Dt(e,o.selected()),Dt(e,o.firstSelected()),Dt(e,o.lastSelected())},i=function(e){Ct(e,o.selected(),"1")},u=function(e){var t=Bt(e,o.selectedSelector());k(t,n)};return{clear:u,selectRange:function(e,t,n,r){u(e),k(t,i),Ct(n,o.firstSelected(),"1"),Ct(r,o.lastSelected(),"1")},selectedSelector:o.selectedSelector,firstSelectedSelector:o.firstSelectedSelector,lastSelectedSelector:o.lastSelectedSelector}}},rs=function(e){return!1===Ei(de.fromDom(e.target),"ephox-snooker-resizer-bar")};function os(p,h){var v=re(["mousedown","mouseover","mouseup","keyup","keydown"],[]),b=S.none(),w=ns.byAttr(Pr);return p.on("init",function(e){var r=p.getWin(),o=oc(p),t=cc(p),n=es.mouse(r,o,t,w),c=es.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(e.start(),e.finish()),n=al(r,t);p.selection.setRng(n)}))},i=function(e){var t=f(e);if(t.raw().shiftKey&&ql.isNavigation(t.raw().which)){var n=p.selection.getRng(),r=de.fromDom(n.startContainer),o=de.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=de.fromDom(p.selection.getStart()),o=de.fromDom(n.startContainer),i=de.fromDom(n.endContainer),u=dc.directionAt(r).isRtl()?ql.rtl:ql.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=de.fromDom(e.target),n=function(){e.stopPropagation()},r=function(){e.preventDefault()},o=x(r,n);return{target:C(t),x:C(l(e)?e.x:null),y:C(l(e)?e.y:null),stop:n,prevent:r,kill:o,raw:C(e)}},s=function(e){return 0===e.button},d=function(e){s(e)&&rs(e)&&n.mousedown(f(e))},m=function(e){var t;(t=e).buttons!==undefined&&0==(1&t.buttons)||!rs(e)||n.mouseover(f(e))},g=function(e){s(e)&&rs(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=de.fromDom(e.getStart()),n=de.fromDom(e.getEnd());ur.sharedOne(Gt.table,[t,n]).fold(function(){w.clear(o)},y)}),b=S.some(v({mousedown:d,mouseover:m,mouseup:g,keyup:i,keydown:u}))}),{clear:w.clear,destroy:function(){b.each(function(e){})}}}var is=function(t){t.ui.registry.addMenuButton("table",{tooltip:"Table",icon:"table",fetch:function(e){return e("inserttable tableprops deletetable | cell row column")}});var e=function(e){return function(){return t.execCommand(e)}};t.ui.registry.addButton("tableprops",{tooltip:"Table properties",onAction:e("mceTableProps"),icon:"table"}),t.ui.registry.addButton("tabledelete",{tooltip:"Delete table",onAction:e("mceTableDelete"),icon:"table-delete-table"}),t.ui.registry.addButton("tablecellprops",{tooltip:"Cell properties",onAction:e("mceTableCellProps"),icon:"table-cell-properties"}),t.ui.registry.addButton("tablemergecells",{tooltip:"Merge cells",onAction:e("mceTableMergeCells"),icon:"table-merge-cells"}),t.ui.registry.addButton("tablesplitcells",{tooltip:"Split cell",onAction:e("mceTableSplitCells"),icon:"table-split-cells"}),t.ui.registry.addButton("tableinsertrowbefore",{tooltip:"Insert row before",onAction:e("mceTableInsertRowBefore"),icon:"table-insert-row-above"}),t.ui.registry.addButton("tableinsertrowafter",{tooltip:"Insert row after",onAction:e("mceTableInsertRowAfter"),icon:"table-insert-row-after"}),t.ui.registry.addButton("tabledeleterow",{tooltip:"Delete row",onAction:e("mceTableDeleteRow"),icon:"table-delete-row"}),t.ui.registry.addButton("tablerowprops",{tooltip:"Row properties",onAction:e("mceTableRowProps"),icon:"table-row-properties"}),t.ui.registry.addButton("tableinsertcolbefore",{tooltip:"Insert column before",onAction:e("mceTableInsertColBefore"),icon:"table-insert-column-before"}),t.ui.registry.addButton("tableinsertcolafter",{tooltip:"Insert column after",onAction:e("mceTableInsertColAfter"),icon:"table-insert-column-after"}),t.ui.registry.addButton("tabledeletecol",{tooltip:"Delete column",onAction:e("mceTableDeleteCol"),icon:"table-delete-column"}),t.ui.registry.addButton("tablecutrow",{tooltip:"Cut row",onAction:e("mceTableCutRow"),icon:"temporary-placeholder"}),t.ui.registry.addButton("tablecopyrow",{tooltip:"Copy row",onAction:e("mceTableCopyRow"),icon:"temporary-placeholder"}),t.ui.registry.addButton("tablepasterowbefore",{tooltip:"Paste row before",onAction:e("mceTablePasteRowBefore"),icon:"temporary-placeholder"}),t.ui.registry.addButton("tablepasterowafter",{tooltip:"Paste row after",onAction:e("mceTablePasteRowAfter"),icon:"temporary-placeholder"})},us=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"})},cs=function(r,n){var e=S.none,o=function(e){e.setDisabled(!0)},t=function(t){return e().fold(function(){o(t)},function(e){t.setDisabled(!1)}),function(){}},i=function(t){return e().fold(function(){o(t)},function(e){t.setDisabled(e.mergable().isNone())}),function(){}},u=function(t){return e().fold(function(){o(t)},function(e){t.setDisabled(e.unmergable().isNone())}),function(){}},c=function(){e=Oe(function(){return S.from(r.dom.getParent(r.selection.getStart(),"th,td")).bind(function(e){var t=de.fromDom(e);return Gt.table(t).map(function(e){return Ur.forMenu(n,e,t)})})})};r.on("nodechange",c);var a=function(e){return function(){return r.execCommand(e)}},l=function(e){var t=e.numRows,n=e.numColumns;r.undoManager.transact(function(){fa(r,n,t)}),r.addVisual()},f={text:"Table properties",onSetup:t,onAction:a("mceTableProps")},s={text:"Delete table",icon:"table-delete-table",onSetup:t,onAction:a("mceTableDelete")},d={type:"nestedmenuitem",text:"Row",getSubmenuItems:function(){return[{type:"menuitem",text:"Insert row before",icon:"table-insert-row-above",onAction:a("mceTableInsertRowBefore"),onSetup:t},{type:"menuitem",text:"Insert row after",icon:"table-insert-row-after",onAction:a("mceTableInsertRowAfter"),onSetup:t},{type:"menuitem",text:"Delete row",icon:"table-delete-row",onAction:a("mceTableDeleteRow"),onSetup:t},{type:"menuitem",text:"Row properties",icon:"table-row-properties",onAction:a("mceTableRowProps"),onSetup:t},{type:"separator"},{type:"menuitem",text:"Cut row",onAction:a("mceTableCutRow"),onSetup:t},{type:"menuitem",text:"Copy row",onAction:a("mceTableCopyRow"),onSetup:t},{type:"menuitem",text:"Paste row before",onAction:a("mceTablePasteRowBefore"),onSetup:t},{type:"menuitem",text:"Paste row after",onAction:a("mceTablePasteRowAfter"),onSetup:t}]}},m={type:"nestedmenuitem",text:"Column",getSubmenuItems:function(){return[{type:"menuitem",text:"Insert column before",icon:"table-insert-column-before",onAction:a("mceTableInsertColBefore"),onSetup:t},{type:"menuitem",text:"Insert column after",icon:"table-insert-column-after",onAction:a("mceTableInsertColAfter"),onSetup:t},{type:"menuitem",text:"Delete column",icon:"table-delete-column",onAction:a("mceTableDeleteCol"),onSetup:t}]}},g={type:"nestedmenuitem",text:"Cell",getSubmenuItems:function(){return[{type:"menuitem",text:"Cell properties",icon:"table-cell-properties",onAction:a("mceTableCellProps"),onSetup:t},{type:"menuitem",text:"Merge cells",icon:"table-merge-cells",onAction:a("mceTableMergeCells"),onSetup:i},{type:"menuitem",text:"Split cell",icon:"table-split-cells",onAction:a("mceTableSplitCells"),onSetup:u}]}};!1===r.getParam("table_grid",!0,"boolean")?r.ui.registry.addMenuItem("inserttable",{text:"Table",icon:"table",onAction:a("mceInsertTable")}):r.ui.registry.addNestedMenuItem("inserttable",{text:"Table",icon:"table",getSubmenuItems:function(){return[{type:"fancymenuitem",fancytype:"inserttable",onAction:l}]}}),r.ui.registry.addMenuItem("tableprops",f),r.ui.registry.addMenuItem("deletetable",s),r.ui.registry.addNestedMenuItem("row",d),r.ui.registry.addNestedMenuItem("column",m),r.ui.registry.addNestedMenuItem("cell",g),r.ui.registry.addContextMenu("table",{update:function(){return c(),e().fold(function(){return""},function(){return"cell row column | tableprops deletetable"})}})},as=function(n,r){return{insertTable:function(e,t){return fa(n,e,t)},setClipboardRows:function(e){return t=r,n=N(e,de.fromDom),void t.set(S.from(n));var t,n},getClipboardRows:function(){return r.get().fold(function(){},function(e){return N(e,function(e){return e.dom()})})}}};e.add("table",function fs(t){var n,r=La(t),e=os(t,r.lazyResize),o=Oc(t,r.lazyWire),i=(n=t,{get:function(){var e=oc(n);return Ar(e,Pr.selectedSelector()).fold(function(){return n.selection.getStart()===undefined?Wr.none():Wr.single(n.selection)},function(e){return Wr.multiple(e)})}}),u=Po(S.none());return pa(t,o,e,i,u),qr(t,i,o,e),cs(t,i),is(t),us(t),t.on("PreInit",function(){t.serializer.addTempAttr(Pr.firstSelected()),t.serializer.addTempAttr(Pr.lastSelected())}),t.getParam("table_tab_navigation",!0,"boolean")&&t.on("keydown",function(e){jl(e,t,o,r.lazyWire)}),t.on("remove",function(){r.destroy(),e.destroy()}),as(t,u)}),function ss(){}}();
|