text: /**
   * uploadcareTabEffects 1.5.0
   * Effects Tab for Uploadcare Widget. Edit images in desktop and mobile browsers.
   * https://github.com/uploadcare/uploadcare-widget-tab-effects#readme
   * Date: 2021-03-31
   */
  
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("uploadcare-widget/uploadcare.min")):"function"==typeof define&&define.amd?define(["uploadcare-widget/uploadcare.min"],t):e.uploadcareTabEffects=t(e.uploadcare)}(this,function(e){"use strict";function t(e,t){function n(){this.constructor=e}for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e}function n(e,t,n){if(!e)return{effects:{},otherModifiers:""};var r={},i=e.replace(/-\/preview\//g,"");return t.forEach(function(t){if(C[t]){var a=e.match(C[t]);if(a){var o=void 0;if("crop"===t){var c=a[7]&&[a[8],a[9]],l=parseInt(a[1]),p=parseInt(a[2]),f=n.findIndex(function(e){if(void 0===e.preferedSize)return!0;var t=h(e.preferedSize,2),n=t[0],r=t[1],i=l===n&&p===r,a=(n/r).toPrecision(2)===(l/p).toPrecision(2);return i||a});o={resizeTo:c,index:f>=0?f:null,coords:{width:l,height:p,center:"center"===a[4],left:void 0===a[5]?void 0:parseInt(a[5]),top:void 0===a[6]?void 0:parseInt(a[6])}}}else"boolean"===_[t][0]&&(o=!0),"number"===_[t][0]&&(o=void 0===a[2]?_[t][1]:parseInt(a[2]));r[t]=o,i=i.replace(a[0],"")}}}),{effects:r,otherModifiers:i}}function r(e,n){function r(e,t,n,i,a){r.__super__.constructor.call(this,e,t,n,i,a)}return t(r,e),r.prototype.__setState=function(e,t){var i=this;if("image"===e){if(t.info){var a=T("effects");void 0===this.settings.effects&&a&&(this.settings.effects=a);var o=j(this.settings),c=P(t.info,o);D(c,o,n);var l=o.locale;n.locale.translations=w(n.locale.translations,l),n.locale.rebuild();var p=new ve({uc:n,store:c,settings:o,onDone:function(){var e=i.file.then(function(e){var t=c.getState().image,n=t.cdnUrl,r=t.cdnUrlModifiers,i=t.crop;return b({},e,{cdnUrl:n,cdnUrlModifiers:r,crop:i})});i.dialogApi.fileColl.replace(i.file,e)},onFail:function(){i.file=null,i.__setState("error",{error:"loadImage"})}}),f=this.container[0];f.innerHTML="",Array.prototype.slice.call(p.getElement().children).forEach(function(e){return f.appendChild(e)}),c.setImageLoad("start")}}else r.__super__.__setState.call(this,e,t)},r.prototype.initImage=function(){},r}!function(e,t){if("undefined"==typeof document)return t;e=e||"";var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e)),n.appendChild(r)}('\n.uploadcare-tab-effects--crops{display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around;max-width:100%}\n.uploadcare-tab-effects--effect-button{-ms-flex-negative:1;flex-shrink:1;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:end;justify-content:flex-end;-ms-flex-align:center;align-items:center;padding:0;width:45px;height:45px;border-color:transparent;background:transparent;color:#212121;fill:#212121}.uploadcare-tab-effects--effect-button:active,.uploadcare-tab-effects--effect-button:focus,.uploadcare-tab-effects--effect-button:hover{fill:#0969ee;color:#0969ee}.uploadcare-tab-effects--effect-button:focus,.uploadcare-tab-effects--effect-button:hover{border-color:transparent;background:transparent}.uploadcare-tab-effects--effect-button[aria-disabled=true]{border-color:transparent!important;background:transparent!important;color:#d4d2d2!important;fill:#d4d2d2!important}.uploadcare-tab-effects--effect-button:before{content:"";display:block;-ms-flex-order:1;order:1;margin:1px 0;width:6px;height:6px;background:transparent;border-radius:50%}.uploadcare-tab-effects--effect-button_applied:before{background:#157cfc}@media (min-width:760px){.uploadcare-tab-effects--effect-button:focus,.uploadcare-tab-effects--effect-button:hover{position:relative;overflow:visible}.uploadcare-tab-effects--effect-button:focus:after,.uploadcare-tab-effects--effect-button:hover:after{content:attr(aria-label);display:block;position:absolute;top:0;left:50%;width:auto;height:auto;background:#e3e1e1;color:#212121;-webkit-transform:translateX(-50%) translateY(-100%);transform:translateX(-50%) translateY(-100%);padding:12px;border-radius:6px;line-height:1;min-width:100%}}\n.uploadcare-tab-effects--icon{height:32px}\n.uploadcare-tab-effects--effects{display:-ms-flexbox;display:flex;-ms-flex-pack:distribute;justify-content:space-around;max-width:100%}\n.uploadcare-tab-effects--additions{-ms-flex-positive:1;flex-grow:1}\n\n\n.uploadcare-tab-effects--range{-ms-flex-positive:1;flex-grow:1}input[type=range].uploadcare-tab-effects--range__input{box-sizing:border-box;margin:0;padding:0;width:100%;height:40px;line-height:1}input[type=range].uploadcare-tab-effects--range__input:focus{outline:2px solid rgba(21,124,252,.5);outline-offset:1px}input[type=range].uploadcare-tab-effects--range__input::-moz-range-track{background:#d4d2d2}input[type=range].uploadcare-tab-effects--range__input::-moz-range-progress{background:#157cfc}input[type=range].uploadcare-tab-effects--range__input::-moz-range-thumb{border:none;background:#212121;box-shadow:none}input[type=range].uploadcare-tab-effects--range__input::-moz-range-thumb:focus,input[type=range].uploadcare-tab-effects--range__input::-moz-range-thumb:hover{background:#000}input[type=range].uploadcare-tab-effects--range__input::-moz-range-thumb:active{background:#000}input[type=range].uploadcare-tab-effects--range__input::-ms-track{background:#d4d2d2}input[type=range].uploadcare-tab-effects--range__input::-ms-fill-lower{background:#157cfc}input[type=range].uploadcare-tab-effects--range__input::-ms-thumb{background:#212121}input[type=range].uploadcare-tab-effects--range__input::-ms-thumb:active,input[type=range].uploadcare-tab-effects--range__input:focus::-ms-thumb{background:#000}'),e=e&&"default"in e?e.default:e;var i={effects:{captions:{blur:"Размыццё",crop:"Абрэзка",enhance:"Паляпшэнне",flip:"Адлюстраваць па вертыкалі",grayscale:"Адценні шэрага",invert:"Інвертаваць",mirror:"Адлюстраваць па гарызанталі",rotate:"Павярнуць",sharp:"Выразнасць"},apply:"Ужыць"}},a={effects:{captions:{blur:"Blur",crop:"Crop",enhance:"Enhance",flip:"Flip",grayscale:"Grayscale",invert:"Invert",mirror:"Mirror",rotate:"Rotate",sharp:"Sharpen"},apply:"Apply"}},o={effects:{captions:{blur:"Flouter",crop:"Recadrer",enhance:"Effets",flip:"Retourner",grayscale:"Noir et blanc",invert:"Inverser",mirror:"Mirroir",rotate:"Tourner",sharp:"Netteté"},apply:"Appliquer"}},c={effects:{captions:{blur:"Sfoca",crop:"Ritaglia",enhance:"Accentua",flip:"Capovolgi",grayscale:"Bianconero",invert:"Inverti",mirror:"Specchia",rotate:"Ruota",sharp:"Nitidezza"},apply:"Applica"}},l={effects:{captions:{blur:"ぼかし",crop:"トリミング",enhance:"補正",flip:"反転",grayscale:"グレースケール",invert:"階調反転",mirror:"ミラー",rotate:"回転",sharp:"シャープ"},apply:"適用"}},p={effects:{captions:{blur:"Vervagen",crop:"Bijknippen",enhance:"Verbeteren",flip:"Omkeren",grayscale:"Zwart-wit",invert:"Inverteren",mirror:"Spiegelen",rotate:"Roteren",sharp:"Verscherpen"},apply:"Toepassen"}},f={effects:{captions:{blur:"Размытие",crop:"Обрезка",enhance:"Улучшение",flip:"Отразить по вертикали",grayscale:"Оттенки серого",invert:"Инвертировать",mirror:"Отразить по горизонтали",rotate:"Повернуть",sharp:"Резкость"},apply:"Применить"}},u={effects:{captions:{blur:"Mờ",crop:"Cắt",enhance:"Tinh chỉnh",flip:"Lật",grayscale:"Xám",invert:"Âm bản",mirror:"Gương",rotate:"Xoay",sharp:"Làm nét"},apply:"Áp dụng"}},d=Object.freeze({be:i,en:a,fr:o,it:c,ja:l,nl:p,ru:f,vi:u}),s={effects:["crop","rotate","enhance","sharp","grayscale"],locale:"en"},g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},b=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},h=function(){function e(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,c=e[Symbol.iterator]();!(r=(o=c.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{!r&&c.return&&c.return()}finally{if(i)throw a}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),m=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},L=function(e){return Object.keys(d).indexOf(e)>-1},w=function(e,t){var n=b({},e),r=L(t),i=d[s.locale],a=function(e){return n.hasOwnProperty(e)};for(var o in n)if(a(o)){if(!a(t)){var c=n[t];n[t]=b({},c,i);continue}r||L(o)?n[o]=b({},n[o],d[o]):n[o]=b({},n[o],i)}return n},y=function(e){return(new DOMParser).parseFromString(e,"text/html").body.firstChild},_={blur:["number",10],enhance:["number",50],flip:["boolean"],grayscale:["boolean"],invert:["boolean"],mirror:["boolean"],rotate:["number"],sharp:["number",5]},C={blur:/-\/blur\/(([0-9]+)\/|)/i,crop:/-\/crop\/([0-9]+)x([0-9]+)(\/(center|([0-9]+),([0-9]+)))?\/(-\/resize\/([0-9]+)x([0-9]+)\/)?/i,enhance:/-\/enhance\/(([0-9]+)\/|)/i,flip:/-\/flip\//i,grayscale:/-\/grayscale\//i,invert:/-\/invert\//i,mirror:/-\/mirror\//i,rotate:/-\/rotate\/(([0-9]+)\/)/i,sharp:/-\/sharp\/(([0-9]+)\/|)/i},x={view:"preview",image:{},appliedEffects:{blur:0,crop:null,enhance:0,flip:!1,grayscale:!1,invert:!1,mirror:!1,rotate:0,sharp:0},otherModifiers:""},E=function(e){var t=x.appliedEffects,n={};return e.forEach(function(e){void 0!==t[e]&&(n[e]=t[e])}),n},S=function(e){var t=e.originalSize,n=e.coords,r=n.width,i=n.height,a=n.center,o=n.left,c=n.top,l="";return t?r===t[0]&&i===t[1]||(l+="-/crop/"+r+"x"+i+"/"+o+","+c+"/"):(l+="-/crop/"+r+"x"+i+"/",a?l+="center/":void 0!==o&&void 0!==c&&(l+=o+","+c+"/")),e.resizeTo?l+="-/resize/"+e.resizeTo.join("x")+"/":l+="-/preview/",l},k=function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r="";for(var i in e)if(e[i])switch(g(e[i])){case"boolean":if(!n&&~["flip","mirror"].indexOf(i))break;r+="-/"+i+"/";break;case"number":if(!n&&"rotate"===i)break;r+="-/"+i+"/"+e[i]+"/";break;case"object":"crop"===i&&t&&(r+=S(e[i]))}return r=r?e.crop&&t?r:"-/preview/"+r:""},M=[0,270,180,90],z=function(e){var t=M.indexOf(e);return~t&&t!==M.length-1?M[t+1]:M[0]},A=function(e,t){return e||!~t.indexOf("crop")?e:[{downscale:!1,notLess:!1,preferedSize:void 0,upscale:!1}]},I=["crop","rotate","mirror","flip","blur","sharp","enhance","grayscale","invert"],Z=function(e){var t=[];if("string"==typeof e&&"all"===e)return I;var n=(t="string"==typeof e?e.replace(/\s/g,"").split(","):Array.isArray(e)?e:s.effects).indexOf("crop");return~n&&0!==n&&(t=["crop"].concat(m(t.slice(0,n)),m(t.slice(n+1)))),t},T=function(e){var t=window["UPLOADCARE_"+e.toUpperCase()];return void 0===t?null:t},U=function(e,t){var n=h(t,2),r=n[0],i=n[1],a=e.downscale&&(r>e.preferedSize[0]||i>e.preferedSize[1]),o=e.upscale&&(r<e.preferedSize[0]||i<e.preferedSize[1]);return a||o?e.preferedSize:null},D=function(e,t,n){var r=t.crop,i=e.getState().image;if(r&&!r.some(function(e){return!e.preferedSize})&&i.isImage&&!i.cdnUrlModifiers&&!i.crop){var a=i.originalImageInfo,o=n.utils.fitSize(r[0].preferedSize,[a.width,a.height],!0),c={originalSize:[a.width,a.height],settings:r[0],resizeTo:U(r[0],o),coords:{left:Math.round((a.width-o[0])/2),top:Math.round((a.height-o[1])/2),width:o[0],height:o[1]}};e.setAppliedEffect({crop:c}),e.rebuildImage()}},B=function(e){if(e){var t=e.coords,n=e.resizeTo,r={width:t.width,height:t.height,left:t.left,top:t.top};return n&&(r.sw=n[0],r.sh=n[1]),r}return null},j=function(e){var t=Z(e.effects),n=A(e.crop,t);return b({},e,{crop:n},{effects:t},{locale:e.locale?e.locale:s.locale})},O=function(e){var t=e,n={view:[],imageLoad:[],appliedEffects:[],image:[]},r=function(e,t){return n[t].push(e),function(){n[t]=n[t].filter(function(t){return t!==e})}};return{getState:function(){return t},setView:function(e){t=b({},t,{view:e}),n.view.forEach(function(e){return e()})},setImageLoad:function(e){t=b({},t,{imageLoad:e}),n.imageLoad.forEach(function(e){return e()})},setAppliedEffect:function(e){var r=b({},t.appliedEffects,e);t=b({},t,{appliedEffects:r}),n.appliedEffects.forEach(function(e){return e()})},rebuildImage:function(){var e=t,r=e.appliedEffects,i=e.image,a=k(r)+t.otherModifiers,o=B(r.crop);t.image=b({},i,{cdnUrl:i.originalUrl+(a||""),cdnUrlModifiers:a,crop:o}),n.image.forEach(function(e){return e()})},subscribeToView:function(e){return r(e,"view")},subscribeToImageLoad:function(e){return r(e,"imageLoad")},subscribeToImage:function(e){return r(e,"image")},subscribeToAppliedEffects:function(e){return r(e,"appliedEffects")}}},P=function(e,t){var r=t.effects,i=t.crop,a=E(r),o=n(e.cdnUrlModifiers,r,i);return O(b({},x,{image:e},{appliedEffects:b({},a,o.effects)},{otherModifiers:o.otherModifiers}))},W=function(){var e=void 0,t=function(){e=y('<div class="uploadcare--tab__content uploadcare--preview__content uploadcare--preview__content_crop"></div>\n')};return{getElement:function(){return e||t(),e},appendChild:function(t){e&&e.appendChild(t)}}},V={"crop-button":"uploadcare-tab-effects--crop-button","crop-button__icon":"uploadcare-tab-effects--crop-button__icon",cropButton:"uploadcare-tab-effects--crop-button",cropButton__icon:"uploadcare-tab-effects--crop-button__icon"},q=function(e){return'<div role="button" tabindex="0" class="uploadcare--button uploadcare--button_icon uploadcare--crop-sizes__item '+e.cn["crop-button"]+'" data-caption="'+e.title+'">\n  <div class="uploadcare--crop-sizes__icon '+e.cn["crop-button__icon"]+'"></div>\n</div>\n'},F=function(e){var t=void 0,n=e.size,r=e.title,i=e.onClick,a={applied:e.applied||!1,disabled:e.disabled||!1},o=function(){t=y(q({title:r,cn:V})),c(),a.applied&&t.classList.add("uploadcare--crop-sizes__item_current"),t.addEventListener("click",l)},c=function(){var e=t.querySelector("."+V["crop-button__icon"]),r=n.width,i=n.height;r&&i?(e.style.width=r,e.style.height=i):(e.innerHTML='\n<svg width="32" height="32" role="presentation" class="uploadcare--icon">\n  <use xlink:href="#uploadcare--icon-crop-free"/>\n</svg>\n      ',e.classList.add("uploadcare--crop-sizes__icon_free"))},l=function(){!a.disabled&&i&&i()};return{getElement:function(){return t||o(),t},toggleApplied:function(e){t&&a.applied!==e&&(a.applied=e,t.classList[e?"add":"remove"]("uploadcare--crop-sizes__item_current"))},toggleDisabled:function(e){t&&a.disabled!==e&&(a.disabled=e,t.setAttribute("aria-disabled",e),t.setAttribute("tabindex",e?"-1":"0"))}}},R={crops:"uploadcare-tab-effects--crops"},G=function(e){return'<div class="'+e.cn.crops+'"></div>\n'},N=function(e){var t=void 0,n=[],r=e.crops,i=e.onCropClick,a={currentCrop:e.currentCrop||0},o=function(){t=y(G({cn:R})),r.forEach(function(e){var t=e.index,r=e.size,o=e.title;n[t]=new F({size:r,title:o,applied:a.currentCrop===t,onClick:function(){a.currentCrop!==t&&(c(t),i(e))}})}),n.forEach(function(e){return t.appendChild(e.getElement())})},c=function(e){n&&(a.currentCrop=e,n.forEach(function(t,n){return t.toggleApplied(n===e)}))};return{getElement:function(){return t||o(),t},toggleDisabled:function(e){n&&n.forEach(function(t){return t.toggleDisabled(e)})},updateApplied:c}},X={"effect-button":"uploadcare-tab-effects--effect-button","effect-button_applied":"uploadcare-tab-effects--effect-button_applied",effectButton:"uploadcare-tab-effects--effect-button",effectButton_applied:"uploadcare-tab-effects--effect-button_applied"},H=function(e){return'<div role="button" tabindex="0" class="uploadcare--button uploadcare--button_icon '+e.cn["effect-button"]+'" aria-label="'+e.title+'"></div>\n'},Y={icon:"uploadcare-tab-effects--icon"},Q=Object.freeze({blur:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <defs>\n    <filter id="filter-blur" width="200%" height="200%" x="-50%" y="-50%" filterUnits="objectBoundingBox">\n      <feGaussianBlur stdDeviation="3" in="SourceGraphic">\n    </feGaussianBlur></filter>\n  </defs>\n  <circle cx="16" cy="16" r="8" filter="url(#filter-blur)"></circle>\n</svg>\n'},crop:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <path d="M21,23 L10.9999602,23 C9.8967381,23 9,22.0989187 9,21.0000398 L9,11 L5,11 L5,9 L9,9 L9,5 L11,5 C11,5 11.0034766,21 10.9999602,21 L27,21 L27,23 L23,23 L23,27 L21,27 L21,23 Z M13,11 L13,9 L21.0046024,9 C22.1100735,9 23,9.89939484 23,11.0081317 L23,19.1279297 L21,19.1279297 L21,11.0081317 C21,11.00117 13,11 13,11 Z"></path>\n</svg>\n'},enhance:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <path d="M4.29289322,24.0082521 L16.3137085,11.9874369 C16.7042328,11.5969126 17.3373978,11.5969126 17.7279221,11.9874369 L20.5563492,14.815864 C20.9468735,15.2063883 20.9468735,15.8395533 20.5563492,16.2300776 L8.53553391,28.2508928 C8.14500961,28.6414171 7.51184464,28.6414171 7.12132034,28.2508928 L4.29289322,25.4224657 C3.90236893,25.0319414 3.90236893,24.3987764 4.29289322,24.0082521 Z M14.7175144,16.4120581 L16.131728,17.8262716 L18.4350288,15.5229708 L17.0208153,14.1087572 L14.7175144,16.4120581 L14.7175144,16.4120581 Z M16.3411081,7.13592111 L13.8054564,6.33578644 L16.3411081,5.53565177 L17.1412428,3 L17.9413775,5.53565177 L20.4770292,6.33578644 L17.9413775,7.13592111 L17.1412428,9.67157288 L16.3411081,7.13592111 Z M24.5356518,13.8304648 L22,13.0303301 L24.5356518,12.2301954 L25.3357864,9.69454365 L26.1359211,12.2301954 L28.6715729,13.0303301 L26.1359211,13.8304648 L25.3357864,16.3661165 L24.5356518,13.8304648 Z M9.53565177,10.8304648 L7,10.0303301 L9.53565177,9.23019541 L10.3357864,6.69454365 L11.1359211,9.23019541 L13.6715729,10.0303301 L11.1359211,10.8304648 L10.3357864,13.3661165 L9.53565177,10.8304648 Z M22.5356518,21.8304648 L20,21.0303301 L22.5356518,20.2301954 L23.3357864,17.6945436 L24.1359211,20.2301954 L26.6715729,21.0303301 L24.1359211,21.8304648 L23.3357864,24.3661165 L22.5356518,21.8304648 Z"></path>\n</svg>\n'},flip:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <path d="M15.3492086,13.7592566 L8.34920863,7.7592566 C7.64431003,7.15505781 8.07159372,6 9,6 L23,6 C23.9284063,6 24.35569,7.15505781 23.6507914,7.7592566 L16.6507914,13.7592566 C16.2763016,14.0802478 15.7236984,14.0802478 15.3492086,13.7592566 Z M15.3492086,18.2407434 C15.7236984,17.9197522 16.2763016,17.9197522 16.6507914,18.2407434 L23.6507914,24.2407434 C24.35569,24.8449422 23.9284063,26 23,26 L9,26 C8.07159372,26 7.64431003,24.8449422 8.34920863,24.2407434 L15.3492086,18.2407434 Z M11.7032574,24 L20.2967426,24 L16,20.3170778 L11.7032574,24 Z M27,15 L27,17 L25,17 L25,15 L27,15 Z M23,15 L23,17 L21,17 L21,15 L23,15 Z M19,15 L19,17 L17,17 L17,15 L19,15 Z M15,15 L15,17 L13,17 L13,15 L15,15 Z M11,15 L11,17 L9,17 L9,15 L11,15 Z M7,15 L7,17 L5,17 L5,15 L7,15 Z"></path>\n</svg>\n'},grayscale:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <path d="M19.3596223,12.0563396 L21.926451,14.6231683 C21.8411716,15.2691808 21.6833431,15.8923164 21.4614188,16.484122 L17.1233611,12.1460643 C16.660957,12.2457748 16.2168493,12.3946804 15.7967877,12.5870314 L20.8981472,17.688391 C20.6220708,18.1749895 20.2993732,18.6316689 19.936127,19.0523568 L14.3668527,13.4830825 C14.0447797,13.7487243 13.7487243,14.0447797 13.4830825,14.3668527 L19.0523568,19.936127 C18.6316689,20.2993732 18.1749895,20.6220708 17.688391,20.8981472 L12.5870314,15.7967877 C12.3946804,16.2168493 12.2457748,16.660957 12.1460643,17.1233611 L16.484122,21.4614188 C15.8923164,21.6833431 15.2691808,21.8411716 14.6231683,21.926451 L12.0563396,19.3596223 C12.4769606,22.5431547 15.2015668,25 18.5,25 C22.0898509,25 25,22.0898509 25,18.5 C25,15.2015668 22.5431547,12.4769606 19.3596223,12.0563396 Z M10.5324038,21.4675962 C7.30134737,20.2636648 5,17.1505866 5,13.5 C5,8.80557963 8.80557963,5 13.5,5 C17.1505866,5 20.2636648,7.30134737 21.4675962,10.5324038 C24.6986526,11.7363352 27,14.8494134 27,18.5 C27,23.1944204 23.1944204,27 18.5,27 C14.8494134,27 11.7363352,24.6986526 10.5324038,21.4675962 L10.5324038,21.4675962 Z"></path>\n</svg>\n'},invert:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" xmlns:xlink="http://www.w3.org/1999/xlink">\n  <path d="M5,6.99180311 C5,5.89386312 5.90087297,5 6.99180311,5 L25.0081969,5 C26.1061369,5 27,5.90087297 27,6.99180311 L27,25.0081969 C27,26.1061369 26.099127,27 25.0081969,27 L6.99180311,27 C5.89386312,27 5,26.099127 5,25.0081969 L5,6.99180311 Z M25,7 L7,7 L7,25 L12.071629,19.928371 C13.0769868,20.9337288 14.4658757,21.5555556 16,21.5555556 C19.0682486,21.5555556 21.5555556,19.0682486 21.5555556,16 C21.5555556,14.4658757 20.9337288,13.0769868 19.928371,12.071629 L25,7 L25,7 Z M12.071629,19.928371 C11.0662712,18.9230132 10.4444444,17.5341243 10.4444444,16 C10.4444444,12.9317514 12.9317514,10.4444444 16,10.4444444 C17.5341243,10.4444444 18.9230132,11.0662712 19.928371,12.071629 L12.071629,19.928371 L12.071629,19.928371 Z"></path>\n</svg>\n'},mirror:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <path d="M13.7592566,16.6507914 L7.7592566,23.6507914 C7.15505781,24.35569 6,23.9284063 6,23 L6,9 C6,8.07159372 7.15505781,7.64431003 7.7592566,8.34920863 L13.7592566,15.3492086 C14.0802478,15.7236984 14.0802478,16.2763016 13.7592566,16.6507914 Z M18.2407434,16.6507914 C17.9197522,16.2763016 17.9197522,15.7236984 18.2407434,15.3492086 L24.2407434,8.34920863 C24.8449422,7.64431003 26,8.07159372 26,9 L26,23 C26,23.9284063 24.8449422,24.35569 24.2407434,23.6507914 L18.2407434,16.6507914 Z M24,20.2967426 L24,11.7032574 L20.3170778,16 L24,20.2967426 Z M15,5 L17,5 L17,7 L15,7 L15,5 Z M15,9 L17,9 L17,11 L15,11 L15,9 Z M15,13 L17,13 L17,15 L15,15 L15,13 Z M15,17 L17,17 L17,19 L15,19 L15,17 Z M15,21 L17,21 L17,23 L15,23 L15,21 Z M15,25 L17,25 L17,27 L15,27 L15,25 Z"></path>\n</svg>\n'},rotate:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <path d="M22.8449302,10.1550698 L22.8449302,10.1550698 C21.1616077,8.18356972 18.6836184,7 16,7 C11.0294373,7 7,11.0294373 7,16 C7,20.9705627 11.0294373,25 16,25 C18.6610655,25 21.131472,23.8397191 22.8318195,21.8591349 L24.3493086,23.1619115 C22.2729281,25.5805032 19.2506133,27 16,27 C9.92486775,27 5,22.0751322 5,16 C5,9.92486775 9.92486775,5 16,5 C19.224943,5 22.2084802,6.39983031 24.2627348,8.73726518 L27,6 L27,11.9970707 C27,12.5509732 26.5621186,13 25.9970707,13 L20,13 L22.8449302,10.1550698 Z M15,14 L17,14 C17.5522847,14 18,14.4477153 18,15 L18,17 C18,17.5522847 17.5522847,18 17,18 L15,18 C14.4477153,18 14,17.5522847 14,17 L14,15 C14,14.4477153 14.4477153,14 15,14 Z"></path>\n</svg>\n'},sharp:function(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32">\n  <polygon points="16 6 25 26 7 26"></polygon>\n</svg>\n'}}),J=function(e){var t=e.name;if(!Q[t])throw new Error('Icon with name "'+t+"\" doesn't exist.");var n=void 0,r=function(){(n=y(Q[t]())).setAttribute("class",n.getAttribute("class")+" "+Y.icon)};return{getElement:function(){return n||r(),n}}},K=function(e){var t=void 0,n=e.effect,r=e.title,i=e.onClick,a={applied:e.applied||!1,disabled:e.disabled||!1},o=function(){var e=new J({name:n});(t=y(H({title:r,cn:X}))).appendChild(e.getElement()),a.applied&&t.classList.add(X["effect-button_applied"]),t.addEventListener("click",c),t.addEventListener("keypress",function(e){"Enter"===e.code&&(t.dispatchEvent(new Event("click")),e.preventDefault(),e.stopPropagation())})},c=function(){!a.disabled&&i&&i()};return{getElement:function(){return t||o(),t},getEffect:function(){return n},toggleApplied:function(e){t&&a.applied!==e&&(a.applied=e,t.classList[e?"add":"remove"](X["effect-button_applied"]))},toggleDisabled:function(e){t&&a.disabled!==e&&(a.disabled=e,t.setAttribute("aria-disabled",e),t.setAttribute("tabindex",e?-1:0))}}},$={effects:"uploadcare-tab-effects--effects"},ee=function(e){return'<div class="'+e.cn.effects+'"></div>\n'},te=function(e){var t=void 0,n=[],r=e.effects,i=e.titles,a=e.onEffectClick,o={appliedEffects:e.appliedEffects},c=function(){t=y(ee({cn:$})),r.forEach(function(e){var t=i[e];n.push(new K({effect:e,title:t,applied:!!o.appliedEffects[e],onClick:function(){return a(e)}}))}),n.forEach(function(e){return t.appendChild(e.getElement())})};return{getElement:function(){return t||c(),t},toggleDisabled:function(e){n&&n.forEach(function(t){return t.toggleDisabled(e)})},updateApplied:function(e){n&&(o.appliedEffects=e,n.forEach(function(t){return t.toggleApplied(!!e[t.getEffect()])}))}}},ne={additions:"uploadcare-tab-effects--additions",done:"uploadcare-tab-effects--done",cancel:"uploadcare-tab-effects--cancel"},re=function(e){return'<div class="uploadcare--footer uploadcare--tab__footer">\n  <div class="uploadcare--footer__additions '+e.cn.additions+'"></div>\n\n  <button type="button" class="uploadcare--button uploadcare--footer__button uploadcare--preview__back '+e.cn.cancel+'">\n    '+e.locale.cancel+'\n  </button>\n\n  <button type="button" class="uploadcare--button uploadcare--button_primary uploadcare--footer__button uploadcare--preview__done '+e.cn.done+'">\n    '+e.locale.done+"\n  </button>\n</div>\n"},ie=function(e){var t=void 0,n=void 0,r=void 0,i=void 0,a=e.locale,o=e.onDone,c=e.onCancel,l=function(){t=y(re({cn:ne,locale:a})),n=t.querySelector("."+ne.additions),r=t.querySelector("."+ne.done),i=t.querySelector("."+ne.cancel),r.addEventListener("click",o),i.addEventListener("click",c)};return{getElement:function(){return t||l(),t},empty:function(){if(t)for(;n.firstChild;)n.removeChild(n.firstChild)},appendChild:function(e){t&&n.appendChild(e)},toggleDisabled:function(e){r&&(r.disabled=e)},updateDoneTitle:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;r.innerText=e||a.done}}},ae={title:"uploadcare-tab-effects--title"},oe=function(e){return'<div class="uploadcare--tab__header">\n  <div class="uploadcare--text uploadcare--text_size_large uploadcare--tab__title uploadcare--preview__title '+e.cn.title+'">\n    '+e.title+"\n  </div>\n</div>\n"},ce=function(e){var t=void 0,n=void 0,r=e.title,i=function(){t=y(oe({title:r,cn:ae})),n=t.querySelector("."+ae.title)};return{getElement:function(){return t||i(),t},updateTitle:function(e){n&&(n.innerText=e)}}},le={image:"uploadcare-tab-effects--image","image-container":"uploadcare-tab-effects--image-container",imageContainer:"uploadcare-tab-effects--image-container"},pe=function(e){return'<div class="uploadcare--media '+e.cn["image-container"]+'">\n  <img src="'+e.imageUrl+'" alt="" class="uploadcare--media__image uploadcare--preview__image '+e.cn.image+'">\n</div>\n'},fe=function(e){var t=void 0,n=void 0,r=e.imageUrl,i=e.onUpdate,a=e.onLoad,o=e.onFail,c=function(){t=y(pe({cn:le,imageUrl:r})),(n=t.querySelector("."+le.image)).addEventListener("load",function(){return a()}),n.addEventListener("error",function(){n.complete&&o()}),n.addEventListener("abort",function(){return o()})};return{getElement:function(){return t||c(),t},getImg:function(){return n},updateImageUrl:function(e){n.src===e&&n.removeAttribute("src"),n.src=e,i()}}},ue={range:"uploadcare-tab-effects--range",range__input:"uploadcare-tab-effects--range__input"},de=function(e){return'<div class="'+e.cn.range+'">\n  <input type="range" class="'+e.cn.range__input+'" min="'+e.min+'" max="'+e.max+'" step="'+e.step+'" value="'+e.value+'">\n</div>\n'},se=function(e){var t=void 0,n=e.min,r=void 0===n?0:n,i=e.max,a=void 0===i?100:i,o=e.step,c=void 0===o?1:o,l=e.value,p=void 0===l?50:l,f=e.onChange,u=function(){(t=y(de({cn:ue,min:r,max:a,step:c,value:p}))).addEventListener("change",function(e){return f(e.target.value)})};return{getElement:function(){return t||u(),t}}},ge={enhance:[0,100],sharp:[0,20],blur:[0,100,5]},ve=function(e){var t=void 0,n=void 0,r=void 0,i=void 0,a=void 0,o=void 0,c=void 0,l=e.uc,p=e.store,f=e.settings,u=e.onDone,d=e.onFail,s={cropWidget:null,currentCrop:0},g=l.locale.t,b=l.crop.CropWidget,h="-/preview/1162x693/-/setfill/ffffff/-/format/jpeg/-/progressive/yes/",m=function(){var e=p.getState(),c=e.view,l=e.appliedEffects,u=e.image;t=y("<div></div>\n"),n=new ce({title:L(c)}),i=new ie({locale:{done:g("dialog.tabs.preview.done"),cancel:g("dialog.tabs.preview.image.change")},onDone:C,onCancel:x}),r=new W;var d=u.cdnUrl+h;f.previewUrlCallback&&(d=f.previewUrlCallback(d,u)),a=new fe({imageUrl:d,onUpdate:function(){return p.setImageLoad("start")},onLoad:function(){return p.setImageLoad("load")},onFail:function(){return p.setImageLoad("fail")}}),t.appendChild(n.getElement()),t.appendChild(r.getElement()),t.appendChild(i.getElement()),r.appendChild(a.getElement());var s=f.effects,v=s.reduce(function(e,t){return e[t]=w(t),e},{});o=new te({effects:s,titles:v,appliedEffects:l,onEffectClick:E}),i.appendChild(o.getElement()),p.subscribeToAppliedEffects(M),p.subscribeToView(A),p.subscribeToImage(I),p.subscribeToImageLoad(Z)},L=function(e){return"preview"===e?g("dialog.tabs.preview.image.title"):w(e)},w=function(e){return g("effects.captions."+e)},_=function(){s.cropWidget&&s.cropWidget.__api&&(s.cropWidget.__api.release(),s.cropWidget.__api.destroy(),a.getImg().removeAttribute("style"))},C=function(e){var t=p.getState().view;"preview"===t?u():(e.stopPropagation(),"crop"===t&&B(),p.setView("preview"))},x=function(e){var t=p.getState(),n=t.view,r=t.appliedEffects,i=f.crop;if("preview"!==n){e.stopPropagation();var a=0;"crop"===n&&(a=i.some(function(e){return!e.preferedSize})?null:r[n],_()),p.setAppliedEffect(v({},n,a)),p.setView("preview")}},E=function(e){var t=p.getState().appliedEffects;"rotate"!==e?"boolean"!=typeof t[e]?"crop"!==e&&"number"!=typeof t[e]||p.setView(e):p.setAppliedEffect(v({},e,!t[e])):p.setAppliedEffect({rotate:z(t.rotate)})},S=function(e){var t=p.getState().view;p.setAppliedEffect(v({},t,parseInt(e)))},M=function(){p.rebuildImage();var e=p.getState().appliedEffects;o.updateApplied(e)},A=function(){var e=p.getState(),t=e.view,r=e.appliedEffects,c=e.image;if(n.updateTitle(L(t)),"preview"===t?i.updateDoneTitle():i.updateDoneTitle(g("effects.apply")),i.empty(),"preview"!==t){if("crop"===t){T();var l=c.originalUrl+(k([{crop:null}],!1,!1)||"")+h;return f.previewUrlCallback&&(l=f.previewUrlCallback(l,c)),void a.updateImageUrl(l)}if(ge[t]){var u=r[t];0===u&&(u=ge[t][1]/2,p.setAppliedEffect(v({},t,u)));var d=new se({min:ge[t][0],max:ge[t][1],step:ge[t][2],value:u,onChange:S});i.appendChild(d.getElement())}}else i.appendChild(o.getElement())},I=function(){var e=p.getState().image,t=e.cdnUrl+h;f.previewUrlCallback&&(t=f.previewUrlCallback(t,e)),a.updateImageUrl(t)},Z=function(){var e=p.getState(),t=e.view;switch(e.imageLoad){case"start":i.toggleDisabled(!0),"preview"===t&&o.toggleDisabled(!0),"crop"===t&&c.toggleDisabled(!0);break;case"load":i.toggleDisabled(!1),"preview"===t?o.toggleDisabled(!1):"crop"===t&&(D(),c.toggleDisabled(!1));break;case"fail":d()}},T=function(){var e=f.crop,t=p.getState().appliedEffects.crop;s.currentCrop=t&&void 0!==t.index?t.index:0,c=new N({crops:e.map(function(e,t){var n=j(e);return{index:t,settings:e,title:n.description,size:{width:n.width,height:n.height}}}),currentCrop:s.currentCrop,onCropClick:function(e){s.currentCrop=e.index,s.cropWidget&&s.cropWidget.setCrop(e.settings)}}),i.appendChild(c.getElement())},D=function(){var e=f.crop,t=p.getState(),n=t.appliedEffects,r=t.image,i=n.crop,o=r.originalImageInfo,c=[o.width,o.height];s.cropWidget=new b(l.jQuery(a.getImg()),c,e[s.currentCrop]),i&&i.coords&&s.cropWidget.setSelection(i.coords)},B=function(){var e=s.cropWidget,t=e.crop,n=e.originalSize,r=s.cropWidget.getSelection();_(),p.setAppliedEffect({crop:{originalSize:n,coords:r,resizeTo:U(t,[r.width,r.height]),settings:t,index:s.currentCrop}})},j=function(e){var t=e.preferedSize,n=g("dialog.tabs.preview.crop.free"),r=void 0,i=void 0;if(t){var a=l.utils.gcd(t[0],t[1]),o=l.utils.fitSize(t,[30,30],!0);n=t[0]/a+":"+t[1]/a,r=Math.max(20,o[0])+"px",i=Math.max(12,o[1])+"px"}return{description:n,width:r,height:i}};return{getElement:function(){return t||m(),t}}};return function(t,n,i,a,o){e.plugin(function(e){return a.multiple?new e.widget.tabs.PreviewTabMultiple(t,n,i,a,o):new(r(e.widget.tabs.PreviewTab,e))(t,n,i,a,o)})}});
  