"use strict";(self.webpackChunkplugin_store_frontend=self.webpackChunkplugin_store_frontend||[]).push([[5928],{55928:function(e,i,o){o.r(i),o.d(i,{HaImagecropperDialog:function(){return f}});var a,r,t=o(64599),n=o(35806),s=o(71008),c=o(62193),p=o(2816),l=o(27927),d=(o(81027),o(95737),o(50693),o(39790),o(36016),o(99019),o(43037),o(96858),o(84341),o(49365),o(38389),o(74860),o(71011),o(71174),o(72606),o(49048)),u=o.n(d),h=o(32609),m=o(50289),_=o(29818),v=o(85323),k=(o(79618),o(60303)),f=(0,l.A)([(0,_.EM)("image-cropper-dialog")],(function(e,i){var o=function(i){function o(){var i;(0,s.A)(this,o);for(var a=arguments.length,r=new Array(a),t=0;t<a;t++)r[t]=arguments[t];return i=(0,c.A)(this,o,[].concat(r)),e(i),i}return(0,p.A)(o,i),(0,n.A)(o)}(i);return{F:o,d:[{kind:"field",decorators:[(0,_.MZ)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,_.wk)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,_.wk)()],key:"_open",value:function(){return!1}},{kind:"field",decorators:[(0,_.P)("img",!0)],key:"_image",value:void 0},{kind:"field",key:"_cropper",value:void 0},{kind:"method",key:"showDialog",value:function(e){this._params=e,this._open=!0}},{kind:"method",key:"closeDialog",value:function(){var e;this._open=!1,this._params=void 0,null===(e=this._cropper)||void 0===e||e.destroy(),this._cropper=void 0}},{kind:"method",key:"updated",value:function(e){var i=this;e.has("_params")&&this._params&&(this._cropper?this._cropper.replace(URL.createObjectURL(this._params.file)):(this._image.src=URL.createObjectURL(this._params.file),this._cropper=new(u())(this._image,{aspectRatio:this._params.options.aspectRatio,viewMode:1,dragMode:"move",minCropBoxWidth:50,ready:function(){URL.revokeObjectURL(i._image.src)}})))}},{kind:"method",key:"render",value:function(){var e;return(0,m.qy)(a||(a=(0,t.A)(['<ha-dialog @closed="','" scrimClickAction escapeKeyAction .open="','"> <div class="container ','"> <img alt="','"> </div> <mwc-button slot="secondaryAction" @click="','"> ',' </mwc-button> <mwc-button slot="primaryAction" @click="','"> '," </mwc-button> </ha-dialog>"])),this.closeDialog,this._open,(0,v.H)({round:Boolean(null===(e=this._params)||void 0===e?void 0:e.options.round)}),this.hass.localize("ui.dialogs.image_cropper.crop_image"),this.closeDialog,this.hass.localize("ui.common.cancel"),this._cropImage,this.hass.localize("ui.dialogs.image_cropper.crop"))}},{kind:"method",key:"_cropImage",value:function(){var e=this;this._cropper.getCroppedCanvas().toBlob((function(i){if(i){var o=new File([i],e._params.file.name,{type:e._params.options.type||e._params.file.type});e._params.croppedCallback(o),e.closeDialog()}}),this._params.options.type||this._params.file.type,this._params.options.quality)}},{kind:"get",static:!0,key:"styles",value:function(){return[k.nA,(0,m.AH)(r||(r=(0,t.A)([""," .container{max-width:640px}img{max-width:100%}.container.round .cropper-face,.container.round .cropper-view-box{border-radius:50%}.cropper-line,.cropper-point,.cropper-point.point-se::before{background-color:var(--primary-color)}"])),(0,m.iz)(h))]}}]}}),m.WF)}}]);
//# sourceMappingURL=5928.ko3kHeAf-xc.js.map