More error checking. Increased stability in safari

This commit is contained in:
thomas committed 2022-08-04 11:33:43 +00:00
1 parent 8da698ab82
commit e2bdad02f4
7 files changed
+47 -15

No files matched your search

+2 -2
View File
@@ -53,7 +53,7 @@ function t(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPro
ha-icon-button ha-icon {
display: flex;
}
`}}t([tt()],nt.prototype,"hass",void 0),(async()=>{for(;!window.browser_mod;)await new Promise((t=>setTimeout(t,1e3)));await window.browser_mod.connectionPromise,customElements.get("browser-player")||customElements.define("browser-player",nt)})();async function rt(t){var e;(null===(e=t.localName)||void 0===e?void 0:e.includes("-"))&&await customElements.whenDefined(t.localName),t.updateComplete&&await t.updateComplete}async function at(t,e,i=!1){let s=[t];for("string"==typeof e&&(e=e.split(/(\$| )/));""===e[e.length-1];)e.pop();for(const[t,i]of e.entries()){const t=s[0];if(!t)return null;i.trim().length&&(rt(t),s="$"===i?[t.shadowRoot]:t.querySelectorAll(i))}return i?s:s[0]}async function dt(t,e,i=!1,s=1e4){return Promise.race([at(t,e,i),new Promise(((t,e)=>setTimeout((()=>e(new Error("SELECTTREE-TIMEOUT"))),s)))]).catch((t=>{if(!t.message||"SELECTTREE-TIMEOUT"!==t.message)throw t;return null}))}async function lt(){await Promise.race([customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")]);const t=customElements.get("home-assistant")?"home-assistant":"hc-main";for(;!document.querySelector(t);)await new Promise((t=>window.setTimeout(t,100)));return document.querySelector(t)}async function ct(t){(await lt()).provideHass(t)}const ht=async()=>{var t,e,i;if(void 0!==window.loadCardHelpers)return;await customElements.whenDefined("partial-panel-resolver");const s=document.createElement("partial-panel-resolver").getRoutes([{component_name:"lovelace",url_path:"a"}]);await(null===(i=null===(e=null===(t=null==s?void 0:s.routes)||void 0===t?void 0:t.a)||void 0===e?void 0:e.load)||void 0===i?void 0:i.call(e))},ut=async()=>{if(customElements.get("ha-form"))return;await ht();const t=await window.loadCardHelpers();if(!t)return;const e=await t.createCardElement({type:"button"});e&&await e.constructor.getConfigElement()};const pt=t=>class extends t{constructor(){super(...arguments),this.connected=!1,this.connectionPromise=new Promise((t=>{this._connectionResolve=t})),this.browserEntities={}}LOG(...t){}fireEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}incoming_message(t){var e;t.command?(this.LOG("Command:",t),this.fireEvent(`command-${t.command}`,t)):t.browserEntities?this.browserEntities=t.browserEntities:t.result&&this.update_config(t.result),null===(e=this._connectionResolve)||void 0===e||e.call(this)}update_config(t){var e;this.LOG("Receive:",t);let i=!1;!this.registered&&(null===(e=t.browsers)||void 0===e?void 0:e[this.browserID])&&(i=!0),this._data=t,this.connected||(this.connected=!0,this.fireEvent("browser-mod-connected")),this.fireEvent("browser-mod-config-update"),i&&this.sendUpdate({})}async connect(){const t=(await async function(){const t=await lt();for(;!t.hass;)await new Promise((t=>window.setTimeout(t,100)));return t.hass}()).connection;this.connection=t,t.subscribeMessage((t=>this.incoming_message(t)),{type:"browser_mod/connect",browserID:this.browserID}),t.addEventListener("disconnected",(()=>{this.connected=!1,this.fireEvent("browser-mod-disconnected")})),t.addEventListener("ready",(()=>{this.connected=!0,this.fireEvent("browser-mod-connected"),this.sendUpdate({})})),ct(this)}get config(){var t,e;return null!==(e=null===(t=this._data)||void 0===t?void 0:t.config)&&void 0!==e?e:{}}get browsers(){var t,e;return null!==(e=null===(t=this._data)||void 0===t?void 0:t.browsers)&&void 0!==e?e:[]}get registered(){var t;return void 0!==(null===(t=this.browsers)||void 0===t?void 0:t[this.browserID])}set registered(t){(async()=>{if(t){if(this.registered)return;await this.connection.sendMessage({type:"browser_mod/register",browserID:this.browserID})}else{if(!this.registered)return;await this.connection.sendMessage({type:"browser_mod/unregister",browserID:this.browserID})}})()}async _reregister(t={}){await this.connection.sendMessage({type:"browser_mod/register",browserID:this.browserID,data:Object.assign(Object.assign({},this.browsers[this.browserID]),t)})}get global_settings(){var t,e;const i={},s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.settings)&&void 0!==e?e:{};for(const[t,e]of Object.entries(s))null!==e&&(i[t]=e);return i}get user_settings(){var t,e,i,s,o;const n={},r=null!==(o=null===(e=null===(t=this._data)||void 0===t?void 0:t.user_settings)||void 0===e?void 0:e[null===(s=null===(i=this.hass)||void 0===i?void 0:i.user)||void 0===s?void 0:s.id])&&void 0!==o?o:{};for(const[t,e]of Object.entries(r))null!==e&&(n[t]=e);return n}get browser_settings(){var t,e,i;const s={},o=null!==(i=null===(e=null===(t=this.browsers)||void 0===t?void 0:t[this.browserID])||void 0===e?void 0:e.settings)&&void 0!==i?i:{};for(const[t,e]of Object.entries(o))null!==e&&(s[t]=e);return s}get settings(){return Object.assign(Object.assign(Object.assign({},this.global_settings),this.browser_settings),this.user_settings)}set_setting(t,e,i){var s;switch(i){case"global":this.connection.sendMessage({type:"browser_mod/settings",key:t,value:e});break;case"user":{const i=this.hass.user.id;t Line truncated
`}}t([tt()],nt.prototype,"hass",void 0),(async()=>{for(;!window.browser_mod;)await new Promise((t=>setTimeout(t,1e3)));await window.browser_mod.connectionPromise,customElements.get("browser-player")||customElements.define("browser-player",nt)})();async function rt(t){var e;(null===(e=t.localName)||void 0===e?void 0:e.includes("-"))&&await customElements.whenDefined(t.localName),t.updateComplete&&await t.updateComplete}async function at(t,e,i=!1){let s=[t];for("string"==typeof e&&(e=e.split(/(\$| )/));""===e[e.length-1];)e.pop();for(const[t,i]of e.entries()){const t=s[0];if(!t)return null;i.trim().length&&(rt(t),s="$"===i?[t.shadowRoot]:t.querySelectorAll(i))}return i?s:s[0]}async function dt(t,e,i=!1,s=1e4){return Promise.race([at(t,e,i),new Promise(((t,e)=>setTimeout((()=>e(new Error("SELECTTREE-TIMEOUT"))),s)))]).catch((t=>{if(!t.message||"SELECTTREE-TIMEOUT"!==t.message)throw t;return null}))}async function lt(){await Promise.race([customElements.whenDefined("home-assistant"),customElements.whenDefined("hc-main")]);const t=customElements.get("home-assistant")?"home-assistant":"hc-main";for(;!document.querySelector(t);)await new Promise((t=>window.setTimeout(t,100)));return document.querySelector(t)}async function ct(t){(await lt()).provideHass(t)}const ht=async()=>{var t,e,i;if(void 0!==window.loadCardHelpers)return;await customElements.whenDefined("partial-panel-resolver");const s=document.createElement("partial-panel-resolver").getRoutes([{component_name:"lovelace",url_path:"a"}]);await(null===(i=null===(e=null===(t=null==s?void 0:s.routes)||void 0===t?void 0:t.a)||void 0===e?void 0:e.load)||void 0===i?void 0:i.call(e))},ut=async()=>{if(customElements.get("ha-form"))return;await ht();const t=await window.loadCardHelpers();if(!t)return;const e=await t.createCardElement({type:"button"});e&&await e.constructor.getConfigElement()};const pt=t=>class extends t{constructor(){super(...arguments),this.connected=!1,this.connectionPromise=new Promise((t=>{this._connectionResolve=t})),this.browserEntities={}}LOG(...t){}fireEvent(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e}))}incoming_message(t){var e;t.command?(this.LOG("Command:",t),this.fireEvent(`command-${t.command}`,t)):t.browserEntities?this.browserEntities=t.browserEntities:t.result&&this.update_config(t.result),null===(e=this._connectionResolve)||void 0===e||e.call(this)}update_config(t){var e;this.LOG("Receive:",t);let i=!1;!this.registered&&(null===(e=t.browsers)||void 0===e?void 0:e[this.browserID])&&(i=!0),this._data=t,this.connected||(this.connected=!0,this.fireEvent("browser-mod-connected")),this.fireEvent("browser-mod-config-update"),i&&this.sendUpdate({})}async connect(){const t=(await async function(){const t=await lt();for(;!t.hass;)await new Promise((t=>window.setTimeout(t,100)));return t.hass}()).connection;this.connection=t,t.subscribeMessage((t=>this.incoming_message(t)),{type:"browser_mod/connect",browserID:this.browserID}),t.addEventListener("disconnected",(()=>{this.connected=!1,this.fireEvent("browser-mod-disconnected")})),t.addEventListener("ready",(()=>{this.connected=!0,this.fireEvent("browser-mod-connected"),this.sendUpdate({})})),ct(this)}get config(){var t,e;return null!==(e=null===(t=this._data)||void 0===t?void 0:t.config)&&void 0!==e?e:{}}get browsers(){var t,e;return null!==(e=null===(t=this._data)||void 0===t?void 0:t.browsers)&&void 0!==e?e:[]}get registered(){var t;return void 0!==(null===(t=this.browsers)||void 0===t?void 0:t[this.browserID])}set registered(t){(async()=>{if(t){if(this.registered)return;await this.connection.sendMessage({type:"browser_mod/register",browserID:this.browserID})}else{if(!this.registered)return;await this.connection.sendMessage({type:"browser_mod/unregister",browserID:this.browserID})}})()}async _reregister(t={}){await this.connection.sendMessage({type:"browser_mod/register",browserID:this.browserID,data:Object.assign(Object.assign({},this.browsers[this.browserID]),t)})}get global_settings(){var t,e;const i={},s=null!==(e=null===(t=this._data)||void 0===t?void 0:t.settings)&&void 0!==e?e:{};for(const[t,e]of Object.entries(s))null!==e&&(i[t]=e);return i}get user_settings(){var t,e,i,s,o;const n={},r=null!==(o=null===(e=null===(t=this._data)||void 0===t?void 0:t.user_settings)||void 0===e?void 0:e[null===(s=null===(i=this.hass)||void 0===i?void 0:i.user)||void 0===s?void 0:s.id])&&void 0!==o?o:{};for(const[t,e]of Object.entries(r))null!==e&&(n[t]=e);return n}get browser_settings(){var t,e,i;const s={},o=null!==(i=null===(e=null===(t=this.browsers)||void 0===t?void 0:t[this.browserID])||void 0===e?void 0:e.settings)&&void 0!==i?i:{};for(const[t,e]of Object.entries(o))null!==e&&(s[t]=e);return s}get settings(){return Object.assign(Object.assign(Object.assign({},this.global_settings),this.browser_settings),this.user_settings)}set_setting(t,e,i){var s;switch(i){case"global":this.connection.sendMessage({type:"browser_mod/settings",key:t,value:e});break;case"user":{const i=this.hass.user.id;t Line truncated
<ha-dialog
open
@closed=${this.closeDialog}
@@ -209,7 +209,7 @@ function t(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPro
--vertial-align-dialog: flex-end;
}
}
`}}t([tt()],xt.prototype,"open",void 0),t([tt()],xt.prototype,"content",void 0),t([tt()],xt.prototype,"title",void 0),t([tt({reflect:!0})],xt.prototype,"actions",void 0),t([tt({reflect:!0})],xt.prototype,"card",void 0),t([tt()],xt.prototype,"right_button",void 0),t([tt()],xt.prototype,"left_button",void 0),t([tt()],xt.prototype,"dismissable",void 0),t([tt({reflect:!0})],xt.prototype,"wide",void 0),t([tt({reflect:!0})],xt.prototype,"fullscreen",void 0),t([tt()],xt.prototype,"_style",void 0),t([it("ha-dialog")],xt.prototype,"dialog",void 0),customElements.get("browser-mod-popup")||customElements.define("browser-mod-popup",xt);const St=t=>class extends t{constructor(){super(),ht(),this._popupEl=document.createElement("browser-mod-popup"),document.body.append(this._popupEl)}showPopup(...t){this._popupEl.setupDialog(...t).then((()=>this._popupEl.openDialog()))}closePopup(...t){this._popupEl.closeDialog(),this.showMoreInfo("")}async showMoreInfo(t,e=!1,i){const s=await lt();if(s.dispatchEvent(new CustomEvent("hass-more-info",{bubbles:!0,composed:!0,cancelable:!1,detail:{entityId:t,ignore_popup_card:i}})),e){await new Promise((t=>setTimeout(t,50)));const t=s.shadowRoot.querySelector("ha-more-info-dialog");t&&(t.large=!0)}}};var Ct="2.0.0b3";const Tt=[{name:"entity",label:"Entity",selector:{entity:{}}},{name:"title",label:"Title",selector:{text:{}}},{name:"size",selector:{select:{mode:"dropdown",options:["normal","wide","fullscreen"]}}},{type:"grid",schema:[{name:"right_button",label:"Right button",selector:{text:{}}},{name:"left_button",label:"Left button",selector:{text:{}}}]},{type:"grid",schema:[{name:"right_button_action",label:"Right button action",selector:{object:{}}},{name:"left_button_action",label:"Left button action",selector:{object:{}}}]},{type:"grid",schema:[{name:"dismissable",label:"User dismissable",selector:{boolean:{}}},{name:"timeout",label:"Auto close timeout (ms)",selector:{number:{mode:"box"}}}]},{type:"grid",schema:[{name:"dismiss_action",label:"Dismiss action",selector:{object:{}}},{name:"timeout_action",label:"Timeout action",selector:{object:{}}}]},{name:"style",label:"CSS style",selector:{text:{multiline:!0}}}];class Pt extends Q{constructor(){super(...arguments),this._selectedTab=0,this._cardGUIMode=!0,this._cardGUIModeAvailable=!0}setConfig(t){this._config=t}connectedCallback(){super.connectedCallback(),ut()}_handleSwitchTab(t){this._selectedTab=parseInt(t.detail.index,10)}_configChanged(t){t.stopPropagation(),this._config&&(this._config=Object.assign({},t.detail.value),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})))}_cardConfigChanged(t){if(t.stopPropagation(),!this._config)return;const e=Object.assign({},t.detail.config);this._config=Object.assign(Object.assign({},this._config),{card:e}),this._cardGUIModeAvailable=t.detail.guiModeAvailable,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}_toggleCardMode(t){var e;null===(e=this._cardEditorEl)||void 0===e||e.toggleMode()}_deleteCard(t){this._config&&(this._config=Object.assign({},this._config),delete this._config.card,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})))}_cardGUIModeChanged(t){t.stopPropagation(),this._cardGUIMode=t.detail.guiMode,this._cardGUIModeAvailable=t.detail.guiModeAvailable}render(){return this.hass&&this._config?O`
`}}t([tt()],xt.prototype,"open",void 0),t([tt()],xt.prototype,"content",void 0),t([tt()],xt.prototype,"title",void 0),t([tt({reflect:!0})],xt.prototype,"actions",void 0),t([tt({reflect:!0})],xt.prototype,"card",void 0),t([tt()],xt.prototype,"right_button",void 0),t([tt()],xt.prototype,"left_button",void 0),t([tt()],xt.prototype,"dismissable",void 0),t([tt({reflect:!0})],xt.prototype,"wide",void 0),t([tt({reflect:!0})],xt.prototype,"fullscreen",void 0),t([tt()],xt.prototype,"_style",void 0),t([it("ha-dialog")],xt.prototype,"dialog",void 0),customElements.get("browser-mod-popup")||customElements.define("browser-mod-popup",xt);const St=t=>class extends t{constructor(){super(),ht(),this._popupEl=document.createElement("browser-mod-popup"),document.body.append(this._popupEl)}showPopup(...t){this._popupEl.setupDialog(...t).then((()=>this._popupEl.openDialog()))}closePopup(...t){this._popupEl.closeDialog(),this.showMoreInfo("")}async showMoreInfo(t,e=!1,i){const s=await lt();if(s.dispatchEvent(new CustomEvent("hass-more-info",{bubbles:!0,composed:!0,cancelable:!1,detail:{entityId:t,ignore_popup_card:i}})),e){await new Promise((t=>setTimeout(t,50)));const t=s.shadowRoot.querySelector("ha-more-info-dialog");t&&(t.large=!0)}}};var Ct="2.0.0b4";const Tt=[{name:"entity",label:"Entity",selector:{entity:{}}},{name:"title",label:"Title",selector:{text:{}}},{name:"size",selector:{select:{mode:"dropdown",options:["normal","wide","fullscreen"]}}},{type:"grid",schema:[{name:"right_button",label:"Right button",selector:{text:{}}},{name:"left_button",label:"Left button",selector:{text:{}}}]},{type:"grid",schema:[{name:"right_button_action",label:"Right button action",selector:{object:{}}},{name:"left_button_action",label:"Left button action",selector:{object:{}}}]},{type:"grid",schema:[{name:"dismissable",label:"User dismissable",selector:{boolean:{}}},{name:"timeout",label:"Auto close timeout (ms)",selector:{number:{mode:"box"}}}]},{type:"grid",schema:[{name:"dismiss_action",label:"Dismiss action",selector:{object:{}}},{name:"timeout_action",label:"Timeout action",selector:{object:{}}}]},{name:"style",label:"CSS style",selector:{text:{multiline:!0}}}];class Pt extends Q{constructor(){super(...arguments),this._selectedTab=0,this._cardGUIMode=!0,this._cardGUIModeAvailable=!0}setConfig(t){this._config=t}connectedCallback(){super.connectedCallback(),ut()}_handleSwitchTab(t){this._selectedTab=parseInt(t.detail.index,10)}_configChanged(t){t.stopPropagation(),this._config&&(this._config=Object.assign({},t.detail.value),this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})))}_cardConfigChanged(t){if(t.stopPropagation(),!this._config)return;const e=Object.assign({},t.detail.config);this._config=Object.assign(Object.assign({},this._config),{card:e}),this._cardGUIModeAvailable=t.detail.guiModeAvailable,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}}))}_toggleCardMode(t){var e;null===(e=this._cardEditorEl)||void 0===e||e.toggleMode()}_deleteCard(t){this._config&&(this._config=Object.assign({},this._config),delete this._config.card,this.dispatchEvent(new CustomEvent("config-changed",{detail:{config:this._config}})))}_cardGUIModeChanged(t){t.stopPropagation(),this._cardGUIMode=t.detail.guiMode,this._cardGUIModeAvailable=t.detail.guiModeAvailable}render(){return this.hass&&this._config?O`
<div class="card-config">
<div class="toolbar">
<mwc-tab-bar
@@ -1,4 +1,4 @@
function e(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n}const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;class o{constructor(e,t,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=s.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&s.set(i,e))}return e}toString(){return this.cssText}}const r=(e,...t)=>{const s=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new o(s,e,i)},n=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e;var a;const l=window.trustedTypes,d=l?l.emptyScript:"",h=window.reactiveElementPolyfillSupport,c={toAttribute(e,t){switch(t){case Boolean:e=e?d:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},u=(e,t)=>t!==e&&(t==t||e==e),p={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u};class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;null!==(t=this.h)&&void 0!==t||(this.h=[]),this.h.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const s=this._$Ep(i,t);void 0!==s&&(this._$Ev.set(s,i),e.push(s))})),e}static createProperty(e,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(s){const o=this[e];this[t]=s,this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(n(e))}else void 0!==e&&t.push(n(e));return t}static _$Ep(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{t?e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):i.forEach((t=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=t.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){thisLine truncated
function e(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(r<3?o(n):r>3?o(t,i,n):o(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n}const t=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),s=new WeakMap;class o{constructor(e,t,s){if(this._$cssResult$=!0,s!==i)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const i=this.t;if(t&&void 0===e){const t=void 0!==i&&1===i.length;t&&(e=s.get(i)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&s.set(i,e))}return e}toString(){return this.cssText}}const r=(e,...t)=>{const s=1===e.length?e[0]:t.reduce(((t,i,s)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[s+1]),e[0]);return new o(s,e,i)},n=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new o("string"==typeof e?e:e+"",void 0,i))(t)})(e):e;var a;const l=window.trustedTypes,d=l?l.emptyScript:"",h=window.reactiveElementPolyfillSupport,c={toAttribute(e,t){switch(t){case Boolean:e=e?d:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},u=(e,t)=>t!==e&&(t==t||e==e),p={attribute:!0,type:String,converter:c,reflect:!1,hasChanged:u};class w extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;null!==(t=this.h)&&void 0!==t||(this.h=[]),this.h.push(e)}static get observedAttributes(){this.finalize();const e=[];return this.elementProperties.forEach(((t,i)=>{const s=this._$Ep(i,t);void 0!==s&&(this._$Ev.set(s,i),e.push(s))})),e}static createProperty(e,t=p){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){const i="symbol"==typeof e?Symbol():"__"+e,s=this.getPropertyDescriptor(e,i,t);void 0!==s&&Object.defineProperty(this.prototype,e,s)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(s){const o=this[e];this[t]=s,this.requestUpdate(e,o,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||p}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const e=Object.getPrototypeOf(this);if(e.finalize(),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const e=this.properties,t=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(const i of t)this.createProperty(i,e[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(n(e))}else void 0!==e&&t.push(n(e));return t}static _$Ep(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((e=>this.enableUpdating=e)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),null===(e=this.constructor.h)||void 0===e||e.forEach((e=>e(this)))}addController(e){var t,i;(null!==(t=this._$ES)&&void 0!==t?t:this._$ES=[]).push(e),void 0!==this.renderRoot&&this.isConnected&&(null===(i=e.hostConnected)||void 0===i||i.call(e))}removeController(e){var t;null===(t=this._$ES)||void 0===t||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;const i=null!==(e=this.shadowRoot)&&void 0!==e?e:this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{t?e.adoptedStyleSheets=i.map((e=>e instanceof CSSStyleSheet?e:e.styleSheet)):i.forEach((t=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=t.cssText,e.appendChild(i)}))})(i,this.constructor.elementStyles),i}connectedCallback(){var e;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostConnected)||void 0===t?void 0:t.call(e)}))}enableUpdating(e){}disconnectedCallback(){var e;null===(e=this._$ES)||void 0===e||e.forEach((e=>{var t;return null===(t=e.hostDisconnected)||void 0===t?void 0:t.call(e)}))}attributeChangedCallback(e,t,i){thisLine truncated
<ha-card outlined>
<h1 class="card-header">
<div class="name">This Browser</div>
@@ -60,6 +60,12 @@ function e(e,t,i,s){var o,r=arguments.length,n=r<3?t:null===s?s=Object.getOwnPro
@change=${this.toggleCameraEnabled}
></ha-switch>
</ha-settings-row>
${(null===(r=window.browser_mod)||void 0===r?void 0:r.cameraError)?H`
<ha-alert alert-type="error">
Setting up the device camera failed. Make sure you have
allowed use of the camera in your browser.
</ha-alert>
`:""}
${this._renderInteractionAlert()}
${this._renderFKBSettingsInfo()}
`:""}
+1 -1
View File
@@ -5,7 +5,7 @@
"dependencies": ["panel_custom", "websocket_api", "http", "frontend", "lovelace"],
"codeowners": [],
"requirements": [],
"version": "2.0.0b3",
"version": "2.0.0b4",
"iot_class": "local_push",
"config_flow": true
}