public/plugins/imagetools/plugin.min.js in card-mod-tinymce_editor-0.15.5 vs public/plugins/imagetools/plugin.min.js in card-mod-tinymce_editor-0.15.6
- old
+ new
@@ -2,8 +2,8 @@
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*
- * Version: 5.0.11 (2019-07-04)
+ * Version: 5.10.7 (2022-12-06)
*/
-!function(l){"use strict";var e,n,t,r,o=function(e){var n=e,t=function(){return n};return{get:t,set:function(e){n=e},clone:function(){return o(t())}}},i=tinymce.util.Tools.resolve("tinymce.PluginManager"),a=tinymce.util.Tools.resolve("tinymce.util.Tools"),v=function(e){return function(){return e}},u=v(!1),c=v(!0),s=u,f=c,d=function(){return m},m=(r={fold:function(e,n){return e()},is:s,isSome:s,isNone:f,getOr:t=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:t,orThunk:n,map:d,ap:d,each:function(){},bind:d,flatten:d,exists:s,forall:f,filter:d,equals:e=function(e){return e.isNone()},equals_:e,toArray:function(){return[]},toString:v("none()")},Object.freeze&&Object.freeze(r),r),h=function(t){var e=function(){return t},n=function(){return o},r=function(e){return e(t)},o={fold:function(e,n){return n(t)},is:function(e){return t===e},isSome:f,isNone:s,getOr:e,getOrThunk:e,getOrDie:e,getOrNull:e,getOrUndefined:e,or:n,orThunk:n,map:function(e){return h(e(t))},ap:function(e){return e.fold(d,function(e){return h(e(t))})},each:function(e){e(t)},bind:r,flatten:e,exists:r,forall:r,filter:function(e){return e(t)?o:m},equals:function(e){return e.is(t)},equals_:function(e,n){return e.fold(s,function(e){return n(t,e)})},toArray:function(){return[t]},toString:function(){return"some("+t+")"}};return o},p={some:h,none:d,from:function(e){return null===e||e===undefined?m:h(e)}},g="undefined"!=typeof l.window?l.window:Function("return this;")(),y=function(e,n){return function(e,n){for(var t=n!==undefined&&null!==n?n:g,r=0;r<e.length&&t!==undefined&&null!==t;++r)t=t[e[r]];return t}(e.split("."),n)},w={getOrDie:function(e,n){var t=y(e,n);if(t===undefined||null===t)throw e+" not available on this browser";return t}};function b(){return new(w.getOrDie("FileReader"))}var O={atob:function(e){return w.getOrDie("atob")(e)},requestAnimationFrame:function(e){w.getOrDie("requestAnimationFrame")(e)}};function E(e,n){return N(l.document.createElement("canvas"),e,n)}function T(e){var n=E(e.width,e.height);return I(n).drawImage(e,0,0),n}function I(e){return e.getContext("2d")}function N(e,n,t){return e.width=n,e.height=t,e}var S=window.Promise?window.Promise:function(){var i=function(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],f(e,r(o,this),r(a,this))},e=i.immediateFn||"function"==typeof window.setImmediate&&window.setImmediate||function(e){l.setTimeout(e,1)};function r(e,n){return function(){return e.apply(n,arguments)}}var t=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};function u(r){var o=this;null!==this._state?e(function(){var e=o._state?r.onFulfilled:r.onRejected;if(null!==e){var n;try{n=e(o._value)}catch(t){return void r.reject(t)}r.resolve(n)}else(o._state?r.resolve:r.reject)(o._value)}):this._deferreds.push(r)}function o(e){try{if(e===this)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if("function"==typeof n)return void f(r(n,e),r(o,this),r(a,this))}this._state=!0,this._value=e,c.call(this)}catch(t){a.call(this,t)}}function a(e){this._state=!1,this._value=e,c.call(this)}function c(){for(var e=0,n=this._deferreds;e<n.length;e++){var t=n[e];u.call(this,t)}this._deferreds=[]}function s(e,n,t,r){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof n?n:null,this.resolve=t,this.reject=r}function f(e,n,t){var r=!1;try{e(function(e){r||(r=!0,n(e))},function(e){r||(r=!0,t(e))})}catch(o){if(r)return;r=!0,t(o)}}return i.prototype["catch"]=function(e){return this.then(null,e)},i.prototype.then=function(t,r){var o=this;return new i(function(e,n){u.call(o,new s(t,r,e,n))})},i.all=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var c=Array.prototype.slice.call(1===e.length&&t(e[0])?e[0]:e);return new i(function(o,i){if(0===c.length)return o([]);var u=c.length;function a(n,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var t=e.then;if("function"==typeof t)return void t.call(e,function(e){a(n,e)},i)}c[n]=e,0==--u&&o(c)}catch(r){i(r)}}for(var e=0;e<c.length;e++)a(e,c[e])})},i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(e){e(n)})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(o){return new i(function(e,n){for(var t=0,r=o;t<r.length;t++)r[t].then(e,n)})},i}();function _(e){var n=e.src;return 0===n.indexOf("data:")?R(n):function t(r){return new S(function(e,t){var n=new l.XMLHttpRequest;n.open("GET",r,!0),n.responseType="blob",n.onload=function(){200===this.status&&e(this.response)},n.onerror=function(){var e,n=this;t(0===this.status?((e=new Error("No access to download image")).code=18,e.name="SecurityError",e):new Error("Error "+n.status+" downloading image"))},n.send()})}(n)}function x(a){return new S(function(e,n){var t=l.URL.createObjectURL(a),r=new l.Image,o=function(){r.removeEventListener("load",i),r.removeEventListener("error",u)};function i(){o(),e(r)}function u(){o(),n("Unable to load data of type "+a.type+": "+t)}r.addEventListener("load",i),r.addEventListener("error",u),r.src=t,r.complete&&i()})}function A(e){var n=e.split(","),t=/data:([^;]+)/.exec(n[0]);if(!t)return p.none();for(var r,o=t[1],i=n[1],u=O.atob(i),a=u.length,c=Math.ceil(a/1024),s=new Array(c),f=0;f<c;++f){for(var l=1024*f,d=Math.min(l+1024,a),m=new Array(d-l),h=l,g=0;h<d;++g,++h)m[g]=u[h].charCodeAt(0);s[f]=(r=m,new(w.getOrDie("Uint8Array"))(r))}return p.some(function v(e,n){return new(w.getOrDie("Blob"))(e,n)}(s,{type:o}))}function R(t){return new S(function(e,n){A(t).fold(function(){n("uri is not base64: "+t)},e)})}function D(e,r,o){return r=r||"image/png",l.HTMLCanvasElement.prototype.toBlob?new S(function(n,t){e.toBlob(function(e){e?n(e):t()},r,o)}):R(e.toDataURL(r,o))}function C(e){return x(e).then(function(e){!function t(e){l.URL.revokeObjectURL(e.src)}(e);var n=E(function r(e){return e.naturalWidth||e.width}(e),function o(e){return e.naturalHeight||e.height}(e));return I(n).drawImage(e,0,0),n})}function U(e,n,t){var r=n.type;function o(n,t){return e.then(function(e){return function r(e,n,t){return n=n||"image/png",e.toDataURL(n,t)}(e,n,t)})}return{getType:v(r),toBlob:function i(){return S.resolve(n)},toDataURL:function u(){return t},toBase64:function a(){return t.split(",")[1]},toAdjustedBlob:function c(n,t){return e.then(function(e){return D(e,n,t)})},toAdjustedDataURL:o,toAdjustedBase64:function s(e,n){return o(e,n).then(function(e){return e.split(",")[1]})},toCanvas:function f(){return e.then(T)}}}function j(n){return function e(t){return new S(function(e){var n=b();n.onloadend=function(){e(n.result)},n.readAsDataURL(t)})}(n).then(function(e){return U(C(n),n,e)})}function L(n,e){return D(n,e).then(function(e){return U(S.resolve(n),e,n.toDataURL())})}function k(n,t){return n.toCanvas().then(function(e){return function a(e,n,t){var r=E(e.width,e.height),o=I(r),i=0,u=0;90!==(t=t<0?360+t:t)&&270!==t||N(r,r.height,r.width);90!==t&&180!==t||(i=r.width);270!==t&&180!==t||(u=r.height);return o.translate(i,u),o.rotate(t*Math.PI/180),o.drawImage(e,0,0),L(r,n)}(e,n.getType(),t)})}function P(n,t){return n.toCanvas().then(function(e){return function i(e,n,t){var r=E(e.width,e.height),o=I(r);"v"===t?(o.scale(1,-1),o.drawImage(e,0,-r.height)):(o.scale(-1,1),o.drawImage(e,-r.width,0));return L(r,n)}(e,n.getType(),t)})}var M=function(e){return j(e)},B=function(){return w.getOrDie("URL")},F=function(e){return B().createObjectURL(e)},z=function(e){B().revokeObjectURL(e)},H=tinymce.util.Tools.resolve("tinymce.util.Delay"),q=tinymce.util.Tools.resolve("tinymce.util.Promise"),$=tinymce.util.Tools.resolve("tinymce.util.URI");var X,W={getImageSize:function Tn(e){var n,t;function r(e){return/^[0-9\.]+px$/.test(e)}return n=e.style.width,t=e.style.height,n||t?r(n)&&r(t)?{w:parseInt(n,10),h:parseInt(t,10)}:null:(n=e.width,t=e.height,n&&t?{w:parseInt(n,10),h:parseInt(t,10)}:null)},setImageSize:function In(e,n){var t,r;n&&(t=e.style.width,r=e.style.height,(t||r)&&(e.style.width=n.w+"px",e.style.height=n.h+"px",e.removeAttribute("data-mce-style")),t=e.width,r=e.height,(t||r)&&(e.setAttribute("width",n.w),e.setAttribute("height",n.h)))},getNaturalImageSize:function Nn(e){return{w:e.naturalWidth,h:e.naturalHeight}}},G=(X="function",function(e){return function(e){if(null===e)return"null";var n=typeof e;return"object"===n&&(Array.prototype.isPrototypeOf(e)||e.constructor&&"Array"===e.constructor.name)?"array":"object"===n&&(String.prototype.isPrototypeOf(e)||e.constructor&&"String"===e.constructor.name)?"string":n}(e)===X}),Y=Array.prototype.slice,V=function(e,n){for(var t=0,r=e.length;t<r;t++){var o=e[t];if(n(o,t,e))return p.some(o)}return p.none()};G(Array.from)&&Array.from;var J=function(e){return null!==e&&e!==undefined},K=function(e,n){var t;return t=n.reduce(function(e,n){return J(e)?e[n]:undefined},e),J(t)?t:null},Q=function(n){return new q(function(t){var e=b();e.onload=function(e){var n=e.target;t(n.result)},e.readAsText(n)})},Z=function(r,o,i){return new q(function(e){var t;(t=function n(){return new(w.getOrDie("XMLHttpRequest"))}()).onreadystatechange=function(){4===t.readyState&&e({status:t.status,blob:this.response})},t.open("GET",r,!0),t.withCredentials=i,a.each(o,function(e,n){t.setRequestHeader(n,e)}),t.responseType="blob",t.send()})},ee=function(e){var n;try{n=JSON.parse(e)}catch(t){}return n},ne=[{code:404,message:"Could not find Image Proxy"},{code:403,message:"Rejected request"},{code:0,message:"Incorrect Image Proxy URL"}],te=[{type:"key_missing",message:"The request did not include an api key."},{type:"key_not_found",message:"The provided api key could not be found."},{type:"domain_not_trusted",message:"The api key is not valid for the request origins."}],re=function(n){return"ImageProxy HTTP error: "+V(ne,function(e){return n===e.code}).fold(v("Unknown ImageProxy error"),function(e){return e.message})},oe=function(e){var n=re(e);return q.reject(n)},ie=function(n){return V(te,function(e){return e.type===n}).fold(v("Unknown service error"),function(e){return e.message})},ue=function(e,n){return Q(n).then(function(e){var n,t,r=(n=ee(e),"ImageProxy Service error: "+((t=K(n,["error","type"]))?ie(t):"Invalid JSON in service error message"));return q.reject(r)})},ae=function(e,n){return 400===(t=e)||403===t||500===t?ue(0,n):oe(e);var t},ce=oe,se=function(e,n){var t,r,o,i={"Content-Type":"application/json;charset=UTF-8","tiny-api-key":n};return Z((t=e,r=n,o=-1===t.indexOf("?")?"?":"&",/[?&]apiKey=/.test(t)||!r?t:t+o+"apiKey="+encodeURIComponent(r)),i,!1).then(function(e){return e.status<200||300<=e.status?ae(e.status,e.blob):q.resolve(e.blob)})};var fe,le,de,me=function(e,n,t){return n?se(e,n):function r(e,n){return Z(e,{},n).then(function(e){return e.status<200||300<=e.status?ce(e.status):q.resolve(e.blob)})}(e,t)},he=function(){return w.getOrDie("Node")},ge=function(e,n,t){return 0!=(e.compareDocumentPosition(n)&t)},ve=function(e,n){return ge(e,n,he().DOCUMENT_POSITION_CONTAINED_BY)},pe=function(e,n){var t=function(e,n){for(var t=0;t<e.length;t++){var r=e[t];if(r.test(n))return r}return undefined}(e,n);if(!t)return{major:0,minor:0};var r=function(e){return Number(n.replace(t,"$"+e))};return we(r(1),r(2))},ye=function(){return we(0,0)},we=function(e,n){return{major:e,minor:n}},be={nu:we,detect:function(e,n){var t=String(n).toLowerCase();return 0===e.length?ye():pe(e,t)},unknown:ye},Oe="Firefox",Ee=function(e,n){return function(){return n===e}},Te=function(e){var n=e.current;return{current:n,version:e.version,isEdge:Ee("Edge",n),isChrome:Ee("Chrome",n),isIE:Ee("IE",n),isOpera:Ee("Opera",n),isFirefox:Ee(Oe,n),isSafari:Ee("Safari",n)}},Ie={unknown:function(){return Te({current:undefined,version:be.unknown()})},nu:Te,edge:v("Edge"),chrome:v("Chrome"),ie:v("IE"),opera:v("Opera"),firefox:v(Oe),safari:v("Safari")},Ne="Windows",Se="Android",_e="Solaris",xe="FreeBSD",Ae=function(e,n){return function(){return n===e}},Re=function(e){var n=e.current;return{current:n,version:e.version,isWindows:Ae(Ne,n),isiOS:Ae("iOS",n),isAndroid:Ae(Se,n),isOSX:Ae("OSX",n),isLinux:Ae("Linux",n),isSolaris:Ae(_e,n),isFreeBSD:Ae(xe,n)}},De={unknown:function(){return Re({current:undefined,version:be.unknown()})},nu:Re,windows:v(Ne),ios:v("iOS"),android:v(Se),linux:v("Linux"),osx:v("OSX"),solaris:v(_e),freebsd:v(xe)},Ce=function(e,n){var t=String(n).toLowerCase();return V(e,function(e){return e.search(t)})},Ue=function(e,t){return Ce(e,t).map(function(e){var n=be.detect(e.versionRegexes,t);return{current:e.name,version:n}})},je=function(e,t){return Ce(e,t).map(function(e){var n=be.detect(e.versionRegexes,t);return{current:e.name,version:n}})},Le=function(e,n){return-1!==e.indexOf(n)},ke=/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,Pe=function(n){return function(e){return Le(e,n)}},Me=[{name:"Edge",versionRegexes:[/.*?edge\/ ?([0-9]+)\.([0-9]+)$/],search:function(e){return Le(e,"edge/")&&Le(e,"chrome")&&Le(e,"safari")&&Le(e,"applewebkit")}},{name:"Chrome",versionRegexes:[/.*?chrome\/([0-9]+)\.([0-9]+).*/,ke],search:function(e){return Le(e,"chrome")&&!Le(e,"chromeframe")}},{name:"IE",versionRegexes:[/.*?msie\ ?([0-9]+)\.([0-9]+).*/,/.*?rv:([0-9]+)\.([0-9]+).*/],search:function(e){return Le(e,"msie")||Le(e,"trident")}},{name:"Opera",versionRegexes:[ke,/.*?opera\/([0-9]+)\.([0-9]+).*/],search:Pe("opera")},{name:"Firefox",versionRegexes:[/.*?firefox\/\ ?([0-9]+)\.([0-9]+).*/],search:Pe("firefox")},{name:"Safari",versionRegexes:[ke,/.*?cpu os ([0-9]+)_([0-9]+).*/],search:function(e){return(Le(e,"safari")||Le(e,"mobile/"))&&Le(e,"applewebkit")}}],Be=[{name:"Windows",search:Pe("win"),versionRegexes:[/.*?windows\ nt\ ?([0-9]+)\.([0-9]+).*/]},{name:"iOS",search:function(e){return Le(e,"iphone")||Le(e,"ipad")},versionRegexes:[/.*?version\/\ ?([0-9]+)\.([0-9]+).*/,/.*cpu os ([0-9]+)_([0-9]+).*/,/.*cpu iphone os ([0-9]+)_([0-9]+).*/]},{name:"Android",search:Pe("android"),versionRegexes:[/.*?android\ ?([0-9]+)\.([0-9]+).*/]},{name:"OSX",search:Pe("os x"),versionRegexes:[/.*?os\ x\ ?([0-9]+)_([0-9]+).*/]},{name:"Linux",search:Pe("linux"),versionRegexes:[]},{name:"Solaris",search:Pe("sunos"),versionRegexes:[]},{name:"FreeBSD",search:Pe("freebsd"),versionRegexes:[]}],Fe={browsers:v(Me),oses:v(Be)},ze=function(e){var n,t,r,o,i,u,a,c,s,f,l,d=Fe.browsers(),m=Fe.oses(),h=Ue(d,e).fold(Ie.unknown,Ie.nu),g=je(m,e).fold(De.unknown,De.nu);return{browser:h,os:g,deviceType:(t=h,r=e,o=(n=g).isiOS()&&!0===/ipad/i.test(r),i=n.isiOS()&&!o,u=n.isAndroid()&&3===n.version.major,a=n.isAndroid()&&4===n.version.major,c=o||u||a&&!0===/mobile/i.test(r),s=n.isiOS()||n.isAndroid(),f=s&&!c,l=t.isSafari()&&n.isiOS()&&!1===/safari/i.test(r),{isiPad:v(o),isiPhone:v(i),isTablet:v(c),isPhone:v(f),isTouch:v(s),isAndroid:n.isAndroid,isiOS:n.isiOS,isWebView:v(l)})}},He={detect:(de=!(fe=function(){var e=l.navigator.userAgent;return ze(e)}),function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return de||(de=!0,le=fe.apply(null,e)),le})},qe=function(e){if(null===e||e===undefined)throw new Error("Node cannot be null or undefined");return{dom:v(e)}},$e={fromHtml:function(e,n){var t=(n||l.document).createElement("div");if(t.innerHTML=e,!t.hasChildNodes()||1<t.childNodes.length)throw l.console.error("HTML does not have a single root node",e),new Error("HTML must have a single root node");return qe(t.childNodes[0])},fromTag:function(e,n){var t=(n||l.document).createElement(e);return qe(t)},fromText:function(e,n){var t=(n||l.document).createTextNode(e);return qe(t)},fromDom:qe,fromPoint:function(e,n,t){var r=e.dom();return p.from(r.elementFromPoint(n,t)).map(qe)}},Xe=(l.Node.ATTRIBUTE_NODE,l.Node.CDATA_SECTION_NODE,l.Node.COMMENT_NODE,l.Node.DOCUMENT_NODE,l.Node.DOCUMENT_TYPE_NODE,l.Node.DOCUMENT_FRAGMENT_NODE,l.Node.ELEMENT_NODE),We=(l.Node.TEXT_NODE,l.Node.PROCESSING_INSTRUCTION_NODE,l.Node.ENTITY_REFERENCE_NODE,l.Node.ENTITY_NODE,l.Node.NOTATION_NODE,Xe),Ge=(He.detect().browser.isIE(),function(e,n){return t=function(e){return function(e,n){var t=e.dom();if(t.nodeType!==We)return!1;if(t.matches!==undefined)return t.matches(n);if(t.msMatchesSelector!==undefined)return t.msMatchesSelector(n);if(t.webkitMatchesSelector!==undefined)return t.webkitMatchesSelector(n);if(t.mozMatchesSelector!==undefined)return t.mozMatchesSelector(n);throw new Error("Browser lacks native selectors")}(e,n)},V(e.dom().childNodes,(r=t,o=$e.fromDom,function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return r(o.apply(null,e))})).map($e.fromDom);var t,r,o}),Ye=0,Ve=function(e){return Ge($e.fromDom(e),"img")},Je=function(e,n){return e.dom.is(n,"figure")},Ke=function(e,n){e.notificationManager.open({text:n,type:"error"})},Qe=function(e){var n=e.selection.getNode();return Je(e,n)?Ve(n):p.some($e.fromDom(n))},Ze=function(e,n){var t=n.src;return 0===t.indexOf("data:")||0===t.indexOf("blob:")||new $(t).host===e.documentBaseURI.host},en=function(e,n){return-1!==a.inArray(e.getParam("imagetools_cors_hosts",[],"string[]"),new $(n.src).host)},nn=function(e,n){var t,r,o,i,u=n.src;return en(e,n)?me(n.src,null,(r=e,o=n,-1!==a.inArray(r.getParam("imagetools_credentials_hosts",[],"string[]"),new $(o.src).host))):Ze(e,n)?_(n):(u=e.getParam("imagetools_proxy"),u+=(-1===u.indexOf("?")?"?":"&")+"url="+encodeURIComponent(n.src),t=(i=e).getParam("api_key",i.getParam("imagetools_api_key","","string"),"string"),me(u,t,!1))},tn=function(e,n){return(t=e,p.from(t.getParam("imagetools_fetch_image",null,"function"))).fold(function(){return nn(e,n)},function(e){return e(n)});var t},rn=function(e,n){var t;return(t=e.editorUpload.blobCache.getByUri(n.src))?q.resolve(t.blob()):tn(e,n)},on=function(e){H.clearTimeout(e.get())},un=function(a,c,s,f,l,d){return c.toBlob().then(function(e){var n,t,r,o,i,u;return r=a.editorUpload.blobCache,n=l.src,a.getParam("images_reuse_filename",!1,"boolean")&&(t=(o=r.getByUri(n))?(n=o.uri(),o.name()):(i=a,(u=n.match(/\/([^\/\?]+)?\.(?:jpeg|jpg|png|gif)(?:\?|$)/i))?i.dom.encode(u[1]):null)),o=r.create({id:"imagetools"+Ye++,blob:e,base64:c.toBase64(),uri:n,name:t}),r.add(o),a.undoManager.transact(function(){a.$(l).on("load",function r(){var e,n,t;a.$(l).off("load",r),a.nodeChanged(),s?a.editorUpload.uploadImagesAuto():(on(f),e=a,n=f,t=H.setEditorTimeout(e,function(){e.editorUpload.uploadImagesAuto()},e.getParam("images_upload_timeout",3e4,"number")),n.set(t))}),d&&a.$(l).attr({width:d.w,height:d.h}),a.$(l).attr({src:o.blobUri()}).removeAttr("data-mce-src")}),o})},an=function(t,r,e,o){return function(){return Qe(t).fold(function(){Ke(t,"Could not find selected image")},function(n){return t._scanForImages().then(function(){return rn(t,n.dom())}).then(M).then(e).then(function(e){return un(t,e,!1,r,n.dom(),o)},function(e){Ke(t,e)})})}},cn=function(n,t,r){return function(){var e=Qe(n).fold(function(){return null},function(e){var n=W.getImageSize(e.dom());return n?{w:n.h,h:n.w}:null});return an(n,t,function(e){return k(e,r)},e)()}},sn=function(e,n,t){return function(){return an(e,n,function(e){return P(e,t)})()}},fn=function(t,e){var n=function(e){return n=e,t.dom.is(n,"img:not([data-mce-object],[data-mce-placeholder])")&&(Ze(t,e)||en(t,e)||t.settings.imagetools_proxy);var n};return Je(t,e)?Ve(e).map(function(e){return n(e.dom())?p.some(e.dom()):p.none()}):n(e)?p.some(e):p.none()},ln=on,dn=rn,mn=Qe,hn=function(t,r,o,i,u){return new q(function(e){var n;(n=u,x(n)).then(function(e){var n=W.getNaturalImageSize(e);return i.w===n.w&&i.h===n.h||W.getImageSize(o)&&W.setImageSize(o,n),z(e.src),u}).then(M).then(function(e){return un(t,e,!0,r,o)},function(){})})},gn=v("save-state"),vn=v("disable"),pn=v("enable"),yn=function(i,u){return function(){var r=mn(i),o=r.map(function(e){return W.getNaturalImageSize(e.dom())});mn(i).each(function(n){fn(i,n.dom()).each(function(e){dn(i,n.dom()).then(function(e){var n,t={blob:n=e,url:F(n)};i.windowManager.open({title:"Edit Image",size:"large",body:{type:"panel",items:[{type:"imagetools",name:"imagetools",label:"Edit Image",currentState:t}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0,disabled:!0}],onSubmit:function(e){var t=e.getData().imagetools.blob;r.each(function(n){o.each(function(e){hn(i,u,n.dom(),e,t)})}),e.close()},onCancel:function(){},onAction:function(e,n){switch(n.name){case gn():n.value?e.enable("save"):e.disable("save");break;case vn():e.disable("save"),e.disable("cancel");break;case pn():e.enable("cancel")}}})})})})}},wn=function(t,e){a.each({mceImageRotateLeft:cn(t,e,-90),mceImageRotateRight:cn(t,e,90),mceImageFlipVertical:sn(t,e,"v"),mceImageFlipHorizontal:sn(t,e,"h"),mceEditImage:yn(t,e)},function(e,n){t.addCommand(n,e)})},bn=function(t,r,o){t.on("NodeChange",function(e){var n=o.get();n&&n.src!==e.element.src&&(ln(r),t.editorUpload.uploadImagesAuto(),o.set(null)),fn(t,e.element).each(o.set)})},On=function(r){var n=function(e){return function(){return r.execCommand(e)}};r.ui.registry.addButton("rotateleft",{tooltip:"Rotate counterclockwise",icon:"rotate-left",onAction:n("mceImageRotateLeft")}),r.ui.registry.addButton("rotateright",{tooltip:"Rotate clockwise",icon:"rotate-right",onAction:n("mceImageRotateRight")}),r.ui.registry.addButton("flipv",{tooltip:"Flip vertically",icon:"flip-vertically",onAction:n("mceImageFlipVertical")}),r.ui.registry.addButton("fliph",{tooltip:"Flip horizontally",icon:"flip-horizontally",onAction:n("mceImageFlipHorizontal")}),r.ui.registry.addButton("editimage",{tooltip:"Edit image",icon:"edit-image",onAction:n("mceEditImage"),onSetup:function(t){var e=function(){mn(r).each(function(e){var n=fn(r,e.dom()).isNone();t.setDisabled(n)})};return r.on("NodeChange",e),function(){r.off("NodeChange",e)}}}),r.ui.registry.addButton("imageoptions",{tooltip:"Image options",icon:"image-options",onAction:n("mceImage")}),r.ui.registry.addContextMenu("imagetools",{update:function(e){return fn(r,e).fold(function(){return[]},function(e){return[{text:"Edit image",icon:"edit-image",onAction:n("mceEditImage")}]})}})},En=function(n){var e;n.ui.registry.addContextToolbar("imagetools",{items:(e=n,e.getParam("imagetools_toolbar","rotateleft rotateright flipv fliph editimage imageoptions")),predicate:function(e){return fn(n,e).isSome()},position:"node",scope:"node"})};!function Sn(){i.add("imagetools",function(e){var n=o(0),t=o(null);wn(e,n),On(e),En(e),bn(e,n,t)})}()}(window);
+!function(){"use strict";function c(e){var t=e;return{get:function(){return t},set:function(e){t=e}}}function h(e){return null!=e}function r(){}function i(e){return function(){return e}}function e(e){return e}function t(){return d}function s(e){return n=typeof(t=e),"array"==(null===t?"null":"object"==n&&(Array.prototype.isPrototypeOf(t)||t.constructor&&"Array"===t.constructor.name)?"array":"object"==n&&(String.prototype.isPrototypeOf(t)||t.constructor&&"String"===t.constructor.name)?"string":n);var t,n}var n,o=tinymce.util.Tools.resolve("tinymce.PluginManager"),f=tinymce.util.Tools.resolve("tinymce.util.Tools"),a=function(e){return typeof e===n},u=i(!(n="function")),l=i(!0),d={fold:function(e,t){return e()},isSome:u,isNone:l,getOr:e,getOrThunk:m,getOrDie:function(e){throw new Error(e||"error: getOrDie called on none.")},getOrNull:i(null),getOrUndefined:i(void 0),or:e,orThunk:m,map:t,each:r,bind:t,exists:u,forall:l,filter:function(){return d},toArray:function(){return[]},toString:i("none()")};function m(e){return e()}var g=function(n){function e(){return o}function t(e){return e(n)}var r=i(n),o={fold:function(e,t){return t(n)},isSome:l,isNone:u,getOr:r,getOrThunk:r,getOrDie:r,getOrNull:r,getOrUndefined:r,or:e,orThunk:e,map:function(e){return g(e(n))},each:function(e){e(n)},bind:t,exists:t,forall:t,filter:function(e){return e(n)?o:d},toArray:function(){return[n]},toString:function(){return"some("+n+")"}};return o},p={some:g,none:t,from:function(e){return null==e?d:g(e)}},v={},y={exports:v};function w(e,t){return U(document.createElement("canvas"),e,t)}function b(e){var t=w(e.width,e.height);return R(t).drawImage(e,0,0),t}function _(u){return new I(function(e,t){function n(){o.removeEventListener("load",i),o.removeEventListener("error",a)}var r=URL.createObjectURL(u),o=new Image,i=function(){n(),e(o)},a=function(){n(),t("Unable to load data of type "+u.type+": "+r)};o.addEventListener("load",i),o.addEventListener("error",a),o.src=r,o.complete&&setTimeout(i,0)})}function E(e,r,o){return r=r||"image/png",a(HTMLCanvasElement.prototype.toBlob)?new I(function(t,n){e.toBlob(function(e){e?t(e):n()},r,o)}):j(e.toDataURL(r,o))}function T(e,t){for(var n=0,r=e.length;n<r;n++)t(e[n],n)}function x(e,t){return function(e,t,n){for(var r=0,o=e.length;r<o;r++){var i=e[r];if(t(i,r))return p.some(i);if(n(i,r))break}return p.none()}(e,t,u)}!function(){var e=this,t=function(){var e,t,n,r={exports:{}};function o(){}function i(e){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(e,this)}function a(n,r){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,i._immediateFn(function(){var e,t=1===n._state?r.onFulfilled:r.onRejected;if(null!==t){try{e=t(n._value)}catch(e){return void c(r.promise,e)}u(r.promise,e)}else(1===n._state?u:c)(r.promise,n._value)})):n._deferreds.push(r)}function u(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof i)return t._state=3,t._value=e,void s(t);if("function"==typeof n)return void l((r=n,o=e,function(){r.apply(o,arguments)}),t)}t._state=1,t._value=e,s(t)}catch(e){c(t,e)}var r,o}function c(e,t){e._state=2,e._value=t,s(e)}function s(e){2===e._state&&0===e._deferreds.length&&i._immediateFn(function(){e._handled||i._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)a(e,e._deferreds[t]);e._deferreds=null}function f(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}function l(e,t){var n=!1;try{e(function(e){n||(n=!0,u(t,e))},function(e){n||(n=!0,c(t,e))})}catch(e){if(n)return;n=!0,c(t,e)}}e=r,t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},n=setTimeout,i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){var n=new this.constructor(o);return a(this,new f(e,t,n)),n},i.all=function(e){var u=Array.prototype.slice.call(e);return new i(function(o,i){if(0===u.length)return o([]);for(var a=u.length,e=0;e<u.length;e++)!function t(n,e){try{if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if("function"==typeof r)return r.call(e,function(e){t(n,e)},i),0}u[n]=e,0==--a&&o(u)}catch(e){i(e)}}(e,u[e])})},i.resolve=function(t){return t&&"object"==typeof t&&t.constructor===i?t:new i(function(e){e(t)})},i.reject=function(n){return new i(function(e,t){t(n)})},i.race=function(o){return new i(function(e,t){for(var n=0,r=o.length;n<r;n++)o[n].then(e,t)})},i._immediateFn="function"==typeof setImmediate?function(e){setImmediate(e)}:function(e){n(e,0)},i._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)},i._setImmediateFn=function(e){i._immediateFn=e},i._setUnhandledRejectionFn=function(e){i._unhandledRejectionFn=e},e.exports?e.exports=i:t.Promise||(t.Promise=i);var d=r.exports;return{boltExport:("undefined"!=typeof window?window:Function("return this;")()).Promise||d}};"object"==typeof v&&void 0!==y?y.exports=t():(e="undefined"!=typeof globalThis?globalThis:e||self).EphoxContactWrapper=t()}();var I=y.exports.boltExport,R=function(e){return e.getContext("2d")},U=function(e,t,n){return e.width=t,e.height=n,e},A=function(r){return new I(function(e,t){var n=new XMLHttpRequest;n.open("GET",r,!0),n.responseType="blob",n.onload=function(){200===this.status&&e(this.response)},n.onerror=function(){var e;t(0===this.status?((e=new Error("No access to download image")).code=18,e.name="SecurityError",e):new Error("Error "+this.status+" downloading image"))},n.send()})},j=function(h){return new I(function(e,t){!function(){var e=h.split(","),t=/data:([^;]+)/.exec(e[0]);if(!t)return p.none();for(var n=t[1],r=e[1],o=atob(r),i=o.length,a=Math.ceil(i/1024),u=new Array(a),c=0;c<a;++c){for(var s=1024*c,f=Math.min(1024+s,i),l=new Array(f-s),d=s,m=0;d<f;++m,++d)l[m]=o[d].charCodeAt(0);u[c]=new Uint8Array(l)}return p.some(new Blob(u,{type:n}))}().fold(function(){t("uri is not base64: "+h)},e)})},S=function(e){URL.revokeObjectURL(e.src)},M=_,P=Array.prototype.indexOf,O=Object.keys;function L(e,t,n){function r(t,n){return e.then(function(e){return e.toDataURL(t||"image/png",n)})}return{getType:i(t.type),toBlob:function(){return I.resolve(t)},toDataURL:i(n),toBase64:function(){return n.split(",")[1]},toAdjustedBlob:function(t,n){return e.then(function(e){return E(e,t,n)})},toAdjustedDataURL:r,toAdjustedBase64:function(e,t){return r(e,t).then(function(e){return e.split(",")[1]})},toCanvas:function(){return e.then(b)}}}function k(t,e){return E(t,e).then(function(e){return L(I.resolve(t),e,t.toDataURL())})}function C(e,t){void 0===t&&(t=2);var n=Math.pow(10,t),r=Math.round(e*n);return Math.ceil(r/n)}function F(t,n,r){return void 0===r&&(r=!1),new I(function(e){var a=new XMLHttpRequest;a.onreadystatechange=function(){4===a.readyState&&e({status:a.status,blob:a.response})},a.open("GET",t,!0),a.withCredentials=r,function(e){for(var t,n=O(e),r=0,o=n.length;r<o;r++){var i=n[r];t=e[i],a.setRequestHeader(i,t)}}(n),a.responseType="blob",a.send()})}function B(e){var t,n=(t=e,"ImageProxy HTTP error: "+x(J,function(e){return t===e.code}).fold(i("Unknown ImageProxy error"),function(e){return e.message}));return I.reject(n)}function N(t){return x(K,function(e){return e.type===t}).fold(i("Unknown service error"),function(e){return e.message})}function D(e){return"ImageProxy Service error: "+function(e){try{return p.some(JSON.parse(e))}catch(e){return p.none()}}(e).bind(function(e){return n=function(e,t){return h(e)?e[t]:void 0},r=e,T(["error","type"],function(e,t){r=n(r,e)}),t=r,p.from(t).map(N);var n,r,t}).getOr("Invalid JSON in service error message")}function H(e){return e<200||300<=e}function z(e,t){var n,r,o,i={"Content-Type":"application/json;charset=UTF-8","tiny-api-key":t};return F((r=t,o=-1===(n=e).indexOf("?")?"?":"&",/[?&]apiKey=/.test(n)?n:n+o+"apiKey="+encodeURIComponent(r)),i).then(function(e){return H(e.status)?(t=e.status,"application/json"!==(null==(n=e.blob)?void 0:n.type)||400!==t&&403!==t&&404!==t&&500!==t?B(t):(r=n,new I(function(e,t){var n=new FileReader;n.onload=function(){e(n.result)},n.onerror=function(e){t(e)},n.readAsText(r)}).then(function(e){var t=D(e);return I.reject(t)}))):I.resolve(e.blob);var r,t,n})}function q(e,t,n){return void 0===n&&(n=!1),t?z(e,t):F(e,{},n).then(function(e){return H(e.status)?B(e.status):I.resolve(e.blob)})}function W(t){return n=t,new I(function(e){var t=new FileReader;t.onloadend=function(){e(t.result)},t.readAsDataURL(n)}).then(function(e){return L(_(t).then(function(e){S(e);var t=w(e.naturalWidth||e.width,e.naturalHeight||e.height);return R(t).drawImage(e,0,0),t}),t,e)});var n}!function(a){if(!s(a))throw new Error("cases must be an array");if(0===a.length)throw new Error("there must be at least one case");var u=[],n={};T(a,function(e,r){var t=O(e);if(1!==t.length)throw new Error("one and only one name per case");var i=t[0],o=e[i];if(void 0!==n[i])throw new Error("duplicate key detected:"+i);if("cata"===i)throw new Error("cannot have a case named cata (sorry)");if(!s(o))throw new Error("case arguments must be an array");u.push(i),n[i]=function(){for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var t=n.length;if(t!==o.length)throw new Error("Wrong number of arguments to case "+i+". Expected "+o.length+" ("+o+"), got "+t);return{fold:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length!==a.length)throw new Error("Wrong number of arguments to fold. Expected "+a.length+", got "+e.length);return e[r].apply(null,n)},match:function(e){var o=O(e);if(u.length!==o.length)throw new Error("Wrong number of arguments to match. Expected: "+u.join(",")+"\nActual: "+o.join(","));if(!function(e){for(var t,n=0,r=e.length;n<r;++n)if(!0!==(t=e[n],function(e,t){return-1<P.call(e,t)}(o,t)))return;return 1}(u))throw new Error("Not all branches were specified when using match. Specified: "+o.join(", ")+"\nRequired: "+u.join(", "));return e[i].apply(null,n)},log:function(e){console.log(e,{constructors:u,constructor:i,params:n})}}}})}([{bothErrors:["error1","error2"]},{firstError:["error1","value2"]},{secondError:["value1","error2"]},{bothValues:["value1","value2"]}]);function $(e){if(null==e)throw new Error("Node cannot be null or undefined");return{dom:e}}var V=function(e,t,n){var r=(n<0?360+n:n)*Math.PI/180,o=e.width,i=e.height,a=Math.sin(r),u=Math.cos(r),c=C(Math.abs(o*u)+Math.abs(i*a)),s=C(Math.abs(o*a)+Math.abs(i*u)),f=w(c,s),l=R(f);return l.translate(c/2,s/2),l.rotate(r),l.drawImage(e,-o/2,-i/2),k(f,t)},G=function(e,t,n){var r=w(e.width,e.height),o=R(r);return"v"===n?(o.scale(1,-1),o.drawImage(e,0,-r.height)):(o.scale(-1,1),o.drawImage(e,-r.width,0)),k(r,t)},J=[{code:404,message:"Could not find Image Proxy"},{code:403,message:"Rejected request"},{code:0,message:"Incorrect Image Proxy URL"}],K=[{type:"not_found",message:"Failed to load image."},{type:"key_missing",message:"The request did not include an api key."},{type:"key_not_found",message:"The provided api key could not be found."},{type:"domain_not_trusted",message:"The api key is not valid for the request origins."}],X={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 $(n.childNodes[0])},fromTag:function(e,t){var n=(t||document).createElement(e);return $(n)},fromText:function(e,t){var n=(t||document).createTextNode(e);return $(n)},fromDom:$,fromPoint:function(e,t,n){return p.from(e.dom.elementFromPoint(t,n)).map($)}};function Q(e){return e.getParam("imagetools_proxy")}function Y(e){function t(e){return/^[0-9\.]+px$/.test(e)}var n=e.style.width,r=e.style.height;return n||r?t(n)&&t(r)?{w:parseInt(n,10),h:parseInt(r,10)}:null:(n=e.width,r=e.height,n&&r?{w:parseInt(n,10),h:parseInt(r,10)}:null)}function Z(e){return{w:e.naturalWidth,h:e.naturalHeight}}function ee(e){return t=X.fromDom(e),n="img",r=function(r){return function(e){var t=r.dom;if(1!==t.nodeType)return!1;var n=t;if(void 0!==n.matches)return n.matches(e);if(void 0!==n.msMatchesSelector)return n.msMatchesSelector(e);if(void 0!==n.webkitMatchesSelector)return n.webkitMatchesSelector(e);if(void 0!==n.mozMatchesSelector)return n.mozMatchesSelector(e);throw new Error("Browser lacks native selectors")}(n)},x(t.dom.childNodes,function(e){return r(X.fromDom(e))}).map(X.fromDom);var t,n,r}function te(e,t){return e.dom.is(t,"figure")}function ne(e,t){return e.dom.is(t,"img:not([data-mce-object],[data-mce-placeholder])")}function re(t,e){function n(e){return ne(t,e)&&(be(t,e)||_e(t,e)||h(Q(t)))}return te(t,e)?ee(e).bind(function(e){return n(e.dom)?p.some(e.dom):p.none()}):n(e)?p.some(e):p.none()}function oe(e,t){e.notificationManager.open({text:t,type:"error"})}function ie(e){var t=e.selection.getNode(),n=e.dom.getParent(t,"figure.image");return null!==n&&te(e,n)?ee(n):ne(e,t)?p.some(X.fromDom(t)):p.none()}function ae(e,t,n){var r=t.match(/(?:\/|^)(([^\/\?]+)\.(?:[a-z0-9.]+))(?:\?|$)/i);return h(r)?e.dom.encode(r[n]):null}function ue(e,t){if(_e(e,t))return q(t.src,null,(n=t,-1!==f.inArray(e.getParam("imagetools_credentials_hosts",[],"string[]"),new ye(n.src).host)));var n,r;if(be(e,t))return(0===(r=t.src).indexOf("data:")?j:A)(r);var o=Q(e);return q(o+(-1===o.indexOf("?")?"?":"&")+"url="+encodeURIComponent(t.src),e.getParam("api_key",e.getParam("imagetools_api_key","","string"),"string"),!1)}function ce(e,t){var n,r,o=e.editorUpload.blobCache.getByUri(t.src);return o?ve.resolve(o.blob()):(n=e,r=t,p.from(n.getParam("imagetools_fetch_image",null,"function")).fold(function(){return ue(n,r)},function(e){return e(r)}))}function se(e){pe.clearTimeout(e.get())}function fe(u,c,s,f,l,d,m){return s.toBlob().then(function(e){var t,n,o,r=u.editorUpload.blobCache,i=d.src,a=c.type===e.type;return u.getParam("images_reuse_filename",!1,"boolean")&&(n=h(o=r.getByUri(i))?(i=o.uri(),t=o.name(),o.filename()):(t=ae(u,i,2),ae(u,i,1))),o=r.create({id:"imagetools"+we++,blob:e,base64:s.toBase64(),uri:i,name:t,filename:a?n:void 0}),r.add(o),u.undoManager.transact(function(){var r=function(){var e,t,n;u.$(d).off("load",r),u.nodeChanged(),f?u.editorUpload.uploadImagesAuto():(se(l),e=u,t=l,n=pe.setEditorTimeout(e,function(){e.editorUpload.uploadImagesAuto()},e.getParam("images_upload_timeout",3e4,"number")),t.set(n))};u.$(d).on("load",r),m&&u.$(d).attr({width:m.w,height:m.h}),u.$(d).attr({src:o.blobUri()}).removeAttr("data-mce-src")}),o})}function le(r,o,e,i){return function(){return ie(r).fold(function(){oe(r,"Could not find selected image")},function(n){return r._scanForImages().then(function(){return ce(r,n.dom)}).then(function(t){return W(t).then(e).then(function(e){return fe(r,t,e,!1,o,n.dom,i)})}).catch(function(e){oe(r,e)})})}}function de(t,n,r){return function(){var e=ie(t).map(function(e){var t=Y(e.dom);return t?{w:t.h,h:t.w}:null}).getOrNull();return le(t,n,function(e){return n=r,(t=e).toCanvas().then(function(e){return V(e,t.getType(),n)});var t,n},e)()}}function me(e,t,r){return function(){return le(e,t,function(e){return n=r,(t=e).toCanvas().then(function(e){return G(e,t.getType(),n)});var t,n})()}}function he(s,f){return function(){var n=ie(s),i=n.map(function(e){return Z(e.dom)});n.each(function(t){re(s,t.dom).each(function(e){ce(s,t.dom).then(function(e){var t={blob:e,url:URL.createObjectURL(e)};s.windowManager.open({title:"Edit Image",size:"large",body:{type:"panel",items:[{type:"imagetools",name:"imagetools",label:"Edit Image",currentState:t}]},buttons:[{type:"cancel",name:"cancel",text:"Cancel"},{type:"submit",name:"save",text:"Save",primary:!0,disabled:!0}],onSubmit:function(e){var o=e.getData().imagetools.blob;n.each(function(r){i.each(function(e){var t,n,a,u,c;t=s,n=f,a=r.dom,u=e,M(c=o).then(function(e){var t,n,r,o,i=Z(e);return u.w===i.w&&u.h===i.h||Y(a)&&(t=a,(n=i)&&(r=t.style.width,o=t.style.height,(r||o)&&(t.style.width=n.w+"px",t.style.height=n.h+"px",t.removeAttribute("data-mce-style")),r=t.width,o=t.height,(r||o)&&(t.setAttribute("width",String(n.w)),t.setAttribute("height",String(n.h))))),URL.revokeObjectURL(e.src),c}).then(W).then(function(e){return fe(t,c,e,!0,n,a)})})}),e.close()},onCancel:r,onAction:function(e,t){switch(t.name){case"save-state":t.value?e.enable("save"):e.disable("save");break;case"disable":e.disable("save"),e.disable("cancel");break;case"enable":e.enable("cancel")}}})})})})}}function ge(t){function n(e){return function(){return t.execCommand(e)}}function e(){return ie(t).exists(function(e){return re(t,e.dom).isSome()})}function r(t){function i(e){return t.setDisabled(!e)}return i(e()),o=o.concat([i]),function(){o=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var o=e[n];o!==i&&t.push(o)}return t}(o)}}var o=[];t.on("NodeChange",function(){var t=e();T(o,function(e){return e(t)})}),t.ui.registry.addButton("rotateleft",{tooltip:"Rotate counterclockwise",icon:"rotate-left",onAction:n("mceImageRotateLeft"),onSetup:r}),t.ui.registry.addButton("rotateright",{tooltip:"Rotate clockwise",icon:"rotate-right",onAction:n("mceImageRotateRight"),onSetup:r}),t.ui.registry.addButton("flipv",{tooltip:"Flip vertically",icon:"flip-vertically",onAction:n("mceImageFlipVertical"),onSetup:r}),t.ui.registry.addButton("fliph",{tooltip:"Flip horizontally",icon:"flip-horizontally",onAction:n("mceImageFlipHorizontal"),onSetup:r}),t.ui.registry.addButton("editimage",{tooltip:"Edit image",icon:"edit-image",onAction:n("mceEditImage"),onSetup:r}),t.ui.registry.addButton("imageoptions",{tooltip:"Image options",icon:"image",onAction:n("mceImage")}),t.ui.registry.addContextMenu("imagetools",{update:function(e){return re(t,e).map(function(e){return{text:"Edit image",icon:"edit-image",onAction:n("mceEditImage")}}).toArray()}})}"undefined"!=typeof window||Function("return this;")();var pe=tinymce.util.Tools.resolve("tinymce.util.Delay"),ve=tinymce.util.Tools.resolve("tinymce.util.Promise"),ye=tinymce.util.Tools.resolve("tinymce.util.URI"),we=0,be=function(e,t){var n=t.src;return 0===n.indexOf("data:")||0===n.indexOf("blob:")||new ye(n).host===e.documentBaseURI.host},_e=function(e,t){return-1!==f.inArray(e.getParam("imagetools_cors_hosts",[],"string[]"),new ye(t.src).host)};o.add("imagetools",function(e){var t,r,o,i,n=c(0),a=c(null),u=e;f.each({mceImageRotateLeft:de(u,n,-90),mceImageRotateRight:de(u,n,90),mceImageFlipVertical:me(u,n,"v"),mceImageFlipHorizontal:me(u,n,"h"),mceEditImage:he(u,n)},function(e,t){u.addCommand(t,e)}),ge(e),(t=e).ui.registry.addContextToolbar("imagetools",{items:t.getParam("imagetools_toolbar","rotateleft rotateright flipv fliph editimage imageoptions"),predicate:function(e){return re(t,e).isSome()},position:"node",scope:"node"}),o=n,i=a,(r=e).on("NodeChange",function(e){var t=i.get(),n=re(r,e.element);t&&!n.exists(function(e){return t.src===e.src})&&(se(o),r.editorUpload.uploadImagesAuto(),i.set(null)),n.each(i.set)})})}();
\ No newline at end of file