agenda-libre-ruby/public/assets/tinymce/plugins/imagetools/plugin-c4dab69e83c305806965c9b31f0ea987b2e2a82a7cb893376775e06cf233a59c.js

3 lines
41 KiB
JavaScript
Raw Normal View History

2018-01-01 17:52:33 +01:00
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};g("1",[],function(){var a=function(b){var c=b,d=function(){return c},e=function(a){c=a},f=function(){return a(d())};return{get:d,set:e,clone:f}};return a}),h("7",tinymce.util.Tools.resolve),g("2",["7"],function(a){return a("tinymce.PluginManager")}),g("8",["7"],function(a){return a("tinymce.util.Tools")}),g("13",[],function(){function a(a,b){return e(document.createElement("canvas"),a,b)}function b(b){var d,e;return d=a(b.width,b.height),e=c(d),e.drawImage(b,0,0),d}function c(a){return a.getContext("2d")}function d(a){var b=null;try{b=a.getContext("webgl")||a.getContext("experimental-webgl")}catch(a){}return b||(b=null),b}function e(a,b,c){return a.width=b,a.height=c,a}return{create:a,clone:b,resize:e,get2dContext:c,get3dContext:d}}),g("14",[],function(){function a(a){return a.naturalWidth||a.width}function b(a){return a.naturalHeight||a.height}return{getWidth:a,getHeight:b}}),g("15",[],function(){function a(a,b){return function(){a.apply(b,arguments)}}function b(b){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof b)throw new TypeError("not a function");this._state=null,this._value=null,this._deferreds=[],h(b,a(d,this),a(e,this))}function c(a){var b=this;return null===this._state?void this._deferreds.push(a):void i(function(){var c=b._state?a.onFulfilled:a.onRejected;if(null===c)return void(b._state?a.resolve:a.reject)(b._value);var d;try{d=c(b._value)}catch(b){return void a.reject(b)}a.resolve(d)})}function d(b){try{if(b===this)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){var c=b.then;if("function"==typeof c)return void h(a(c,b),a(d,this),a(e,this))}this._state=!0,this._value=b,f.call(this)}catch(a){e.call(this,a)}}function e(a){this._state=!1,this._value=a,f.call(this)}function f(){for(var a=0,b=this._deferreds.length;a<b;a++)c.call(this,this._deferreds[a]);this._deferreds=null}function g(a,b,c,d){this.onFulfilled="function"==typeof a?a:null,this.onRejected="function"==typeof b?b:null,this.resolve=c,this.reject=d}function h(a,b,c){var d=!1;try{a(function(a){d||(d=!0,b(a))},function(a){d||(d=!0,c(a))})}catch(a){if(d)return;d=!0,c(a)}}if(window.Promise)return window.Promise;var i=b.immediateFn||"function"==typeof setImmediate&&setImmediate||function(a){setTimeout(a,1)},j=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};return b.prototype["catch"]=function(a){return this.then(null,a)},b.prototype.then=function(a,d){var e=this;return new b(function(b,f){c.call(e,new g(a,d,b,f))})},b.all=function(){var a=Array.prototype.slice.call(1===arguments.length&&j(arguments[0])?arguments[0]:arguments);return new b(function(b,c){function d(f,g){try{if(g&&("object"==typeof g||"function"==typeof g)){var h=g.then;if("function"==typeof h)return void h.call(g,function(a){d(f,a)},c)}a[f]=g,0===--e&&b(a)}catch(a){c(a)}}if(0===a.length)return b([]);for(var e=a.length,f=0;f<a.length;f++)d(f,a[f])})},b.resolve=function(a){return a&&"object"==typeof a&&a.constructor===b?a:new b(function(b){b(a)})},b.reject=function(a){return new b(function(b,c){c(a)})},b.race=function(a){return new b(function(b,c){for(var d=0,e=a.length;d<e;d++)a[d].then(b,c)})},b}),h("f",Array),h("g",Error),g("a",["f","g"],function(a,b){var c=function(){},d=function(a){return function(){r
return function(){b.blobToImageResult(h.blob).then(function(b){a.apply(this,[b].concat(c)).then(oa).then(x)})}}function B(){u(h),m(R),v(P)(),s()}function C(a,b){R?b():e(function(){a-- >0?C(a,b):c.windowManager.alert("Error: failed to apply image operation.")},10)}function D(){R?(x(R.blob),B()):C(100,D)}function E(){var a=V.zoom();a<2&&(a+=.1),V.zoom(a)}function F(){var a=V.zoom();a>.1&&(a-=.1),V.zoom(a)}function G(){h=na.undo(),u(h),s()}function H(){h=na.redo(),u(h),s()}function I(){o(h.blob),O.close()}function J(a){return g.create("Form",{layout:"flex",direction:"row",labelGap:5,border:"0 0 1 0",align:"center",pack:"center",padding:"0 10 0 10",spacing:5,flex:0,minHeight:60,defaults:{classes:"imagetool",type:"button"},items:a})}function K(a,c){return J([{text:"Back",onclick:B},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:D}]).hide().on("show",function(){t(),b.blobToImageResult(h.blob).then(function(a){return c(a)}).then(oa).then(function(a){var b=l(a);u(b),m(R),R=b})})}function L(a,c,d,e,f){function g(a){b.blobToImageResult(h.blob).then(function(b){return c(b,a)}).then(oa).then(function(a){var b=l(a);u(b),m(R),R=b})}return J([{text:"Back",onclick:B},{type:"spacer",flex:1},{type:"slider",flex:1,ondragend:function(a){g(a.value)},minValue:e,maxValue:f,value:d,previewFilter:r},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:D}]).hide().on("show",function(){this.find("slider").value(d),t()})}function M(a,c){function d(){var a,d,e;a=O.find("#r")[0].value(),d=O.find("#g")[0].value(),e=O.find("#b")[0].value(),b.blobToImageResult(h.blob).then(function(b){return c(b,a,d,e)}).then(oa).then(function(a){var b=l(a);u(b),m(R),R=b})}return J([{text:"Back",onclick:B},{type:"spacer",flex:1},{type:"slider",label:"R",name:"r",minValue:0,value:1,maxValue:2,ondragend:d,previewFilter:r},{type:"slider",label:"G",name:"g",minValue:0,value:1,maxValue:2,ondragend:d,previewFilter:r},{type:"slider",label:"B",name:"b",minValue:0,value:1,maxValue:2,ondragend:d,previewFilter:r},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:D}]).hide().on("show",function(){O.find("#r,#g,#b").value(1),t()})}function N(a){a.control.value()===!0&&(la=ka/ja,ma=ja/ka)}var O,P,Q,R,S,T,U,V,W,X,Y,Z,$,_,aa,ba,ca,da,ea,fa,ga,ha,ia,ja,ka,la,ma,na=new j,oa=function(a){return a.toBlob()};S=J([{text:"Back",onclick:B},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:y}]).hide().on("show hide",function(a){V.toggleCropRect("show"===a.type)}).on("show",t),T=J([{text:"Back",onclick:B},{type:"spacer",flex:1},{type:"textbox",name:"w",label:"Width",size:4,onkeyup:q},{type:"textbox",name:"h",label:"Height",size:4,onkeyup:q},{type:"checkbox",name:"constrain",text:"Constrain proportions",checked:!0,onchange:N},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:"submit"}]).hide().on("submit",function(b){var c=parseInt(O.find("#w").value(),10),d=parseInt(O.find("#h").value(),10);b.preventDefault(),A(a.resize,c,d)(),B()}).on("show",t),U=J([{text:"Back",onclick:B},{type:"spacer",flex:1},{icon:"fliph",tooltip:"Flip horizontally",onclick:z(a.flip,"h")},{icon:"flipv",tooltip:"Flip vertically",onclick:z(a.flip,"v")},{icon:"rotateleft",tooltip:"Rotate counterclockwise",onclick:z(a.rotate,-90)},{icon:"rotateright",tooltip:"Rotate clockwise",onclick:z(a.rotate,90)},{type:"spacer",flex:1},{text:"Apply",subtype:"primary",onclick:D}]).hide().on("show",t),Y=K("Invert",a.invert),ea=K("Sharpen",a.sharpen),fa=K("Emboss",a.emboss),Z=L("Brightness",a.brightness,0,-1,1),$=L("Hue",a.hue,180,0,360),_=L("Saturate",a.saturate,0,-1,1),aa=L("Contrast",a.contrast,0,-1,1),ba=L("Grayscale",a.grayscale,0,0,1),ca=L("Sepia",a.sepia,0,0,1),da=M("Colorize",a.colorize),ga=L("Gamma",a.gamma,0,-1,1),ha=L("Exposure",a.exposure,1,0,2),Q=J([{text:"Back",onclick:B},{type:"spacer",flex:1},{text:"hue",icon:"hue",onclick:v($)},{text:"saturate",icon:"saturate",onclick:v(_)},{text:"sepia",icon:"sepia",onclick:v(ca)},{text:"emboss",icon:"emboss",onclick:v(fa)},{text:"exposure",icon:"exposure",onclick:v(ha)},{type:"spacer",flex:1}]).hide(),P=J([{tooltip:"Crop",icon:"