"use strict";(self.webpackChunkknx_frontend=self.webpackChunkknx_frontend||[]).push([[2e3],{12e3:function(e,i,o){o.r(i),o.d(i,{HaImagecropperDialog:function(){return f}});var n,a,r=o(6238),t=o(36683),s=o(89231),c=o(29864),p=o(83647),l=o(8364),d=(o(77052),o(21950),o(848),o(68113),o(26777),o(56262),o(73842),o(8339),o(29734),o(72134),o(7146),o(97157),o(56648),o(72435),o(58068),o(56889)),u=o.n(d),h=o(32609),m=o(98597),_=o(196),v=o(69760),k=(o(88762),o(43799)),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 n=arguments.length,a=new Array(n),r=0;r<n;r++)a[r]=arguments[r];return i=(0,c.A)(this,o,[].concat(a)),e(i),i}return(0,p.A)(o,i),(0,t.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)(n||(n=(0,r.A)(["<ha-dialog\n      @closed=","\n      scrimClickAction\n      escapeKeyAction\n      .open=",'\n    >\n      <div\n        class="container ','"\n      >\n        <img alt=',' />\n      </div>\n      <mwc-button slot="secondaryAction" @click=',">\n        ",'\n      </mwc-button>\n      <mwc-button slot="primaryAction" @click=',">\n        ","\n      </mwc-button>\n    </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)(a||(a=(0,r.A)(["\n        ","\n        .container {\n          max-width: 640px;\n        }\n        img {\n          max-width: 100%;\n        }\n        .container.round .cropper-view-box,\n        .container.round .cropper-face {\n          border-radius: 50%;\n        }\n        .cropper-line,\n        .cropper-point,\n        .cropper-point.point-se::before {\n          background-color: var(--primary-color);\n        }\n      "])),(0,m.iz)(h))]}}]}}),m.WF)}}]);