UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

5 lines 11.3 kB
(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["37860"],{84200:function(t,e,i){"use strict";i.d(e,{r:()=>a});i(71695),i(92519),i(42179),i(89256),i(24931),i(88463),i(57449),i(19814),i(47021);const o=(t,e,i=true)=>{var a;if(!t||t===document.body)return null;if((t=null!==(a=t.assignedSlot)&&void 0!==a?a:t).parentElement)t=t.parentElement;else{const e=t.getRootNode();t=e instanceof ShadowRoot?e.host:null}return(i?Object.prototype.hasOwnProperty.call(t,e):t&&e in t)?t:o(t,e,i)},a=(t,e,i=true)=>{const a=new Set;for(;t;)a.add(t),t=o(t,e,i);return a}},81165:function(t,e,i){"use strict";i.d(e,{j:()=>o});const o=(t=document)=>{var e;return null!==(e=t.activeElement)&&void 0!==e&&null!==(e=e.shadowRoot)&&void 0!==e&&e.activeElement?o(t.activeElement.shadowRoot):t.activeElement}},76320:function(t,e,i){"use strict";i.d(e,{T:()=>o,y:()=>a});i(40251);const o=t=>{requestAnimationFrame((()=>setTimeout(t,0)))},a=()=>new Promise((t=>{o(t)}))},73729:function(t,e,i){"use strict";i.d(e,{i:()=>m});var o=i(61701),a=i(72621),n=(i(22152),i(71695),i(47021),i(74966)),r=i(51408),s=i(57243),l=i(50778),d=i(76525);i(23334);let c,p,u,g=t=>t;const h=["button","ha-list-item"],m=(t,e)=>{var i;return(0,s.dy)(c||(c=g` <div class="header_title"> <ha-icon-button .label="${0}" .path="${0}" dialogAction="close" class="header_button"></ha-icon-button> <span>${0}</span> </div> `),null!==(i=null==t?void 0:t.localize("ui.common.close"))&&void 0!==i?i:"Close","M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",e)};(0,o.Z)([(0,l.Mo)("ha-dialog")],(function(t,e){class i extends e{constructor(...e){super(...e),t(this)}}return{F:i,d:[{kind:"field",key:d.gA,value:void 0},{kind:"method",key:"scrollToPos",value:function(t,e){var i;null===(i=this.contentElement)||void 0===i||i.scrollTo(t,e)}},{kind:"method",key:"renderHeading",value:function(){return(0,s.dy)(p||(p=g`<slot name="heading"> ${0} </slot>`),(0,a.Z)(i,"renderHeading",this,3)([]))}},{kind:"method",key:"firstUpdated",value:function(){var t;(0,a.Z)(i,"firstUpdated",this,3)([]),this.suppressDefaultPressSelector=[this.suppressDefaultPressSelector,h].join(", "),this._updateScrolledAttribute(),null===(t=this.contentElement)||void 0===t||t.addEventListener("scroll",this._onScroll,{passive:!0})}},{kind:"method",key:"disconnectedCallback",value:function(){(0,a.Z)(i,"disconnectedCallback",this,3)([]),this.contentElement.removeEventListener("scroll",this._onScroll)}},{kind:"field",key:"_onScroll",value(){return()=>{this._updateScrolledAttribute()}}},{kind:"method",key:"_updateScrolledAttribute",value:function(){this.contentElement&&this.toggleAttribute("scrolled",0!==this.contentElement.scrollTop)}},{kind:"field",static:!0,key:"styles",value(){return[r.W,(0,s.iv)(u||(u=g`:host([scrolled]) ::slotted(ha-dialog-header){border-bottom:1px solid var(--mdc-dialog-scroll-divider-color,rgba(0,0,0,.12))}.mdc-dialog{--mdc-dialog-scroll-divider-color:var( --dialog-scroll-divider-color, var(--divider-color) );z-index:var(--dialog-z-index,8);-webkit-backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));backdrop-filter:var(--ha-dialog-scrim-backdrop-filter,var(--dialog-backdrop-filter,none));--mdc-dialog-box-shadow:var(--dialog-box-shadow, none);--mdc-typography-headline6-font-weight:400;--mdc-typography-headline6-font-size:1.574rem}.mdc-dialog__actions{justify-content:var(--justify-action-buttons,flex-end);padding-bottom:max(env(safe-area-inset-bottom),24px)}.mdc-dialog__actions span:first-child{flex:var(--secondary-action-button-flex,unset)}.mdc-dialog__actions span:nth-child(2){flex:var(--primary-action-button-flex,unset)}.mdc-dialog__container{align-items:var(--vertical-align-dialog,center)}.mdc-dialog__title{padding:24px 24px 0 24px}.mdc-dialog__title:has(span){padding:12px 12px 0}.mdc-dialog__actions{padding:12px 24px 12px 24px}.mdc-dialog__title::before{content:unset}.mdc-dialog .mdc-dialog__content{position:var(--dialog-content-position,relative);padding:var(--dialog-content-padding,24px)}:host([hideactions]) .mdc-dialog .mdc-dialog__content{padding-bottom:max(var(--dialog-content-padding,24px),env(safe-area-inset-bottom))}.mdc-dialog .mdc-dialog__surface{position:var(--dialog-surface-position,relative);top:var(--dialog-surface-top);margin-top:var(--dialog-surface-margin-top);min-height:var(--mdc-dialog-min-height,auto);border-radius:var(--ha-dialog-border-radius,28px);-webkit-backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);backdrop-filter:var(--ha-dialog-surface-backdrop-filter,none);background:var(--ha-dialog-surface-background,var(--mdc-theme-surface,#fff))}:host([flexContent]) .mdc-dialog .mdc-dialog__content{display:flex;flex-direction:column}.header_title{display:flex;align-items:center;direction:var(--direction)}.header_title span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;padding-left:4px}.header_button{text-decoration:none;color:inherit;inset-inline-start:initial;inset-inline-end:-12px;direction:var(--direction)}.dialog-actions{inset-inline-start:initial!important;inset-inline-end:0px!important;direction:var(--direction)}`))]}}]}}),n.M)},77333:function(t,e,i){"use strict";i.r(e),i.d(e,{HaImagecropperDialog:()=>m});var o=i(61701),a=(i(71695),i(19134),i(97003),i(47021),i(72700),i(8038),i(71513),i(75656),i(50100),i(18084),i(31622),i(65509)),n=i.n(a),r=i(93528),s=i(57243),l=i(50778),d=i(35359),c=(i(73729),i(28008));let p,u,g,h=t=>t,m=(0,o.Z)([(0,l.Mo)("image-cropper-dialog")],(function(t,e){return{F:class extends e{constructor(...e){super(...e),t(this)}},d:[{kind:"field",decorators:[(0,l.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_params",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_open",value(){return!1}},{kind:"field",decorators:[(0,l.IO)("img",!0)],key:"_image",value:void 0},{kind:"field",key:"_cropper",value:void 0},{kind:"field",decorators:[(0,l.SB)()],key:"_isTargetAspectRatio",value:void 0},{kind:"method",key:"showDialog",value:function(t){this._params=t,this._open=!0}},{kind:"method",key:"closeDialog",value:function(){var t;this._open=!1,this._params=void 0,null===(t=this._cropper)||void 0===t||t.destroy(),this._cropper=void 0,this._isTargetAspectRatio=!1}},{kind:"method",key:"updated",value:function(t){t.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(n())(this._image,{aspectRatio:this._params.options.aspectRatio,viewMode:1,dragMode:"move",minCropBoxWidth:50,ready:()=>{this._isTargetAspectRatio=this._checkMatchAspectRatio(),URL.revokeObjectURL(this._image.src)}})))}},{kind:"method",key:"_checkMatchAspectRatio",value:function(){var t;const e=null===(t=this._params)||void 0===t?void 0:t.options.aspectRatio;if(!e)return!0;const i=this._cropper.getImageData();if(i.aspectRatio===e)return!0;if(i.naturalWidth>i.naturalHeight){const t=i.naturalWidth/e;return Math.abs(t-i.naturalHeight)<=1}const o=i.naturalHeight*e;return Math.abs(o-i.naturalWidth)<=1}},{kind:"method",key:"render",value:function(){var t;return(0,s.dy)(p||(p=h`<ha-dialog @closed="${0}" scrimClickAction escapeKeyAction .open="${0}"> <div class="container ${0}"> <img alt="${0}"> </div> <mwc-button slot="secondaryAction" @click="${0}"> ${0} </mwc-button> ${0} <mwc-button slot="primaryAction" @click="${0}"> ${0} </mwc-button> </ha-dialog>`),this.closeDialog,this._open,(0,d.$)({round:Boolean(null===(t=this._params)||void 0===t?void 0:t.options.round)}),this.hass.localize("ui.dialogs.image_cropper.crop_image"),this.closeDialog,this.hass.localize("ui.common.cancel"),this._isTargetAspectRatio?(0,s.dy)(u||(u=h`<mwc-button slot="primaryAction" @click="${0}"> ${0} </mwc-button>`),this._useOriginal,this.hass.localize("ui.dialogs.image_cropper.use_original")):s.Ld,this._cropImage,this.hass.localize("ui.dialogs.image_cropper.crop"))}},{kind:"method",key:"_cropImage",value:function(){this._cropper.getCroppedCanvas().toBlob((t=>{if(!t)return;const e=new File([t],this._params.file.name,{type:this._params.options.type||this._params.file.type});this._params.croppedCallback(e),this.closeDialog()}),this._params.options.type||this._params.file.type,this._params.options.quality)}},{kind:"method",key:"_useOriginal",value:function(){this._params.croppedCallback(this._params.file),this.closeDialog()}},{kind:"get",static:!0,key:"styles",value:function(){return[c.yu,(0,s.iv)(g||(g=h`${0} .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,s.$m)(r))]}}]}}),s.oi)},76525:function(t,e,i){"use strict";i.d(e,{L$:()=>u,gA:()=>d,lD:()=>m,ts:()=>g,vC:()=>c});i(71695),i(92745),i(19423),i(40251),i(47021);var o=i(5111),a=i(84200);if(66977!=i.j)var n=i(81165);var r=i(76320);const s={},l=[],d=Symbol.for("HA focus target"),c=async(t,e,i,r,p,u=!0)=>{if(!(i in s)){if(!p)return!1;s[i]={element:p().then((()=>{const e=document.createElement(i);return t.provideHass(e),e.addEventListener("dialog-closed",h),e.addEventListener("dialog-closed",v),e}))}}if(u){var g,m;const{history:a}=o.E;if(null!==(g=a.state)&&void 0!==g&&g.dialog&&!l.length)return await new Promise((t=>{setTimeout(t)})),c(t,e,i,r,p,u);const n=l.findIndex((t=>t.dialogTag===i));-1!==n&&l.splice(n,1),l.push({element:t,root:e,dialogTag:i,dialogParams:r,dialogImport:p,addHistory:u});const s={dialog:i};null!==(m=a.state)&&void 0!==m&&m.dialog?a.replaceState(s,""):(a.replaceState(Object.assign(Object.assign({},a.state),{},{opensDialog:!0}),""),a.pushState(s,""))}s[i].closedFocusTargets=(0,a.r)((0,n.j)(),d);const f=await s[i].element;return e.appendChild(f),f.showDialog(r),!0},p=async t=>{if(!(t in s))return!0;const e=await s[t].element;return!e.closeDialog||!1!==e.closeDialog()},u=async()=>{if(l.length){var t;const e=l.pop(),i=await p(e.dialogTag);return i||l.push(e),l.length&&null!==(t=o.E.history.state)&&void 0!==t&&t.opensDialog&&o.E.history.pushState({dialog:l[l.length-1].dialogTag},""),i}return!0},g=async()=>{for(let t=l.length-1;t>=0;t--){if(!(!l[t]||await p(l[t].dialogTag)))return!1}return!0},h=t=>{var e;const i=l.findIndex((e=>e.dialogTag===t.detail.dialog));-1!==i&&l.splice(i,1),(null===(e=o.E.history.state)||void 0===e?void 0:e.dialog)===t.detail.dialog&&(l.length?o.E.history.replaceState({dialog:l[l.length-1].dialogTag},""):-1!==i&&o.E.history.back())},m=(t,e)=>{t.addEventListener("show-dialog",(i=>{const{dialogTag:o,dialogImport:a,dialogParams:n,addHistory:r}=i.detail;c(t,e,o,n,a,r)}))},v=async t=>{if(!s[t.detail.dialog])return;const e=s[t.detail.dialog].closedFocusTargets;if(delete s[t.detail.dialog].closedFocusTargets,!e)return;let i=(0,n.j)();i instanceof HTMLElement&&i.blur(),await(0,r.y)();for(const o of e)if(o instanceof HTMLElement&&(o.focus(),i=(0,n.j)(),i&&i!==document.body))return}},22152:function(){Element.prototype.toggleAttribute||(Element.prototype.toggleAttribute=function(t,e){return void 0!==e&&(e=!!e),this.hasAttribute(t)?!!e||(this.removeAttribute(t),!1):!1!==e&&(this.setAttribute(t,""),!0)})}}]); //# sourceMappingURL=37860.67a74d997bc7613f.js.map