home-assistant-query-selector 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,7 +64,7 @@ instance.addEventListener('onLovelacePanelLoad', ({ detail }) => {
64
64
  });
65
65
 
66
66
  // This event will be triggered every time a more-info dialog is open
67
- instance.addEventListener('onLovelaveMoreInfoDialogOpen', ({ detail }) => {
67
+ instance.addEventListener('onLovelaceMoreInfoDialogOpen', ({ detail }) => {
68
68
 
69
69
  // When the ha-more-info-info element is available in the DOM
70
70
  detail.HA_MORE_INFO_DIALOG_INFO.element.then((dialogInfo) => {
@@ -179,12 +179,12 @@ All the available elements contain an `element` property and three methods:
179
179
  | `querySelectorAll` | Method to query multiple decendants of this element |
180
180
  | `shadowRootQuerySelector` | Method to query for descendants shadowRoots of this element |
181
181
 
182
- #### onLovelaveMoreInfoDialogOpen
182
+ #### onLovelaceMoreInfoDialogOpen
183
183
 
184
184
  This event is triggered when a more-info dialog is open or when one returns to the main view of the more-info dialog from the `History` or `Settings` view inside the dialog.
185
185
 
186
186
  ```typescript
187
- instance.addEventListener('onLovelaveMoreInfoDialogOpen', function({detail}) {
187
+ instance.addEventListener('onLovelaceMoreInfoDialogOpen', function({detail}) {
188
188
  /* detail:
189
189
  {
190
190
  HA_MORE_INFO_DIALOG: {...},
@@ -198,9 +198,9 @@ instance.addEventListener('onLovelaveMoreInfoDialogOpen', function({detail}) {
198
198
 
199
199
  The dispatched event is a [CustomEvent] and its `detail` property is an object containing the main `Home Assistant` `DOM` elements inside a more-info dialog. All the properties and methods included in each element are Promises, so they are async and will be resolved when the element is ready to work with it.
200
200
 
201
- ##### onLovelaveMoreInfoDialogOpen event elements
201
+ ##### onLovelaceMoreInfoDialogOpen event elements
202
202
 
203
- This is the list of the elements available inside the `detail` property of the `onLovelaveMoreInfoDialogOpen` event:
203
+ This is the list of the elements available inside the `detail` property of the `onLovelaceMoreInfoDialogOpen` event:
204
204
 
205
205
  ![more-info dialog dom tree](./images/more-info-dialog-dom-tree.png)
206
206
 
@@ -220,12 +220,12 @@ All the available elements contain an `element` property and three methods:
220
220
  | `querySelectorAll` | Method to query multiple decendants of this element |
221
221
  | `shadowRootQuerySelector` | Method to query for descendants shadowRoots of this element |
222
222
 
223
- #### onLovelaveHistoryAndLogBookDialogOpen
223
+ #### onLovelaceHistoryAndLogBookDialogOpen
224
224
 
225
225
  This event is triggered when the `History` view is opened from the header actions of a more-info dialog.
226
226
 
227
227
  ```typescript
228
- instance.addEventListener('onLovelaveHistoryAndLogBookDialogOpen', function({detail}) {
228
+ instance.addEventListener('onLovelaceHistoryAndLogBookDialogOpen', function({detail}) {
229
229
  /* detail:
230
230
  {
231
231
  HA_MORE_INFO_DIALOG: {...},
@@ -239,9 +239,9 @@ instance.addEventListener('onLovelaveHistoryAndLogBookDialogOpen', function({det
239
239
 
240
240
  The dispatched event is a [CustomEvent] and its `detail` property is an object containing the main `Home Assistant` `DOM` elements inside a more-info dialog `History` view. All the properties and methods included in each element are Promises, so they are async and will be resolved when the element is ready to work with it.
241
241
 
242
- ##### onLovelaveHistoryAndLogBookDialogOpen event elements
242
+ ##### onLovelaceHistoryAndLogBookDialogOpen event elements
243
243
 
244
- This is the list of the elements available inside the `detail` property of the `onLovelaveHistoryAndLogBookDialogOpen` event:
244
+ This is the list of the elements available inside the `detail` property of the `onLovelaceHistoryAndLogBookDialogOpen` event:
245
245
 
246
246
  ![more-info dialog dom tree](https://raw.githubusercontent.com/elchininet/home-assistant-query-selector/master/images/more-info-dialog-history-dom-tree.png)
247
247
 
@@ -261,12 +261,12 @@ All the available elements contain an `element` property and three methods:
261
261
  | `querySelectorAll` | Method to query multiple decendants of this element |
262
262
  | `shadowRootQuerySelector` | Method to query for descendants shadowRoots of this element |
263
263
 
264
- #### onLovelaveSettingsDialogOpen
264
+ #### onLovelaceSettingsDialogOpen
265
265
 
266
266
  This event is triggered when the `Settings` view is opened from the header actions of a more-info dialog.
267
267
 
268
268
  ```typescript
269
- instance.addEventListener('onLovelaveSettingsDialogOpen', function({detail}) {
269
+ instance.addEventListener('onLovelaceSettingsDialogOpen', function({detail}) {
270
270
  /* detail:
271
271
  {
272
272
  HA_MORE_INFO_DIALOG: {...},
@@ -280,9 +280,9 @@ instance.addEventListener('onLovelaveSettingsDialogOpen', function({detail}) {
280
280
 
281
281
  The dispatched event is a [CustomEvent] and its `detail` property is an object containing the main `Home Assistant` `DOM` elements inside a more-info dialog `Settings` view. All the properties and methods included in each element are Promises, so they are async and will be resolved when the element is ready to work with it.
282
282
 
283
- ##### onLovelaveSettingsDialogOpen event elements
283
+ ##### onLovelaceSettingsDialogOpen event elements
284
284
 
285
- This is the list of the elements available inside the `detail` property of the `onLovelaveSettingsDialogOpen` event:
285
+ This is the list of the elements available inside the `detail` property of the `onLovelaceSettingsDialogOpen` event:
286
286
 
287
287
  ![more-info dialog dom tree](https://raw.githubusercontent.com/elchininet/home-assistant-query-selector/master/images/more-info-dialog-settings-dom-tree.png)
288
288
 
@@ -21,9 +21,9 @@ type HomeAssistantElement = {
21
21
  };
22
22
  declare enum HAQuerySelectorEvent {
23
23
  ON_LOVELACE_PANEL_LOAD = "onLovelacePanelLoad",
24
- ON_LOVELACE_MORE_INFO_DIALOG_OPEN = "onLovelaveMoreInfoDialogOpen",
25
- ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN = "onLovelaveHistoryAndLogBookDialogOpen",
26
- ON_LOVELACE_SETTINGS_DIALOG_OPEN = "onLovelaveSettingsDialogOpen"
24
+ ON_LOVELACE_MORE_INFO_DIALOG_OPEN = "onLovelaceMoreInfoDialogOpen",
25
+ ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN = "onLovelaceHistoryAndLogBookDialogOpen",
26
+ ON_LOVELACE_SETTINGS_DIALOG_OPEN = "onLovelaceSettingsDialogOpen"
27
27
  }
28
28
  declare class HAQuerySelector extends EventTarget {
29
29
  #private;
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- function e(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function n(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const r="$",o={retries:100,delay:50};var i,s,c,a,l;!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR"}(i||(i={})),function(e){e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER",e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(s||(s={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(c||(c={})),function(e){e.ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",e.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaveMoreInfoDialogOpen",e.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaveHistoryAndLogBookDialogOpen",e.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaveSettingsDialogOpen"}(a||(a={})),function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(l||(l={}));const u={[i.HOME_ASSISTANT]:{selector:l.HOME_ASSISTANT,children:{shadowRoot:{selector:r,children:{[i.HOME_ASSISTANT_MAIN]:{selector:l.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:r,children:{[i.HA_DRAWER]:{selector:l.HA_DRAWER,children:{[i.HA_SIDEBAR]:{selector:l.HA_SIDEBAR,children:{shadowRoot:{selector:r}}}}}}}}}}}}}},O={[s.PARTIAL_PANEL_RESOLVER]:{selector:l.PARTIAL_PANEL_RESOLVER,children:{[s.HA_PANEL_LOVELACE]:{selector:l.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:r,children:{[s.HUI_ROOT]:{selector:l.HUI_ROOT,children:{shadowRoot:{selector:r,children:{[s.HEADER]:{selector:l.HEADER},[s.HUI_VIEW]:{selector:l.HUI_VIEW}}}}}}}}}}}},_={shadowRoot:{selector:r,children:{[c.HA_MORE_INFO_DIALOG]:{selector:l.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:r,children:{[c.HA_DIALOG]:{selector:l.HA_DIALOG,children:{[c.HA_DIALOG_CONTENT]:{selector:l.HA_DIALOG_CONTENT,children:{[c.HA_MORE_INFO_DIALOG_INFO]:{selector:l.HA_MORE_INFO_DIALOG_INFO},[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:{selector:l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},[c.HA_DIALOG_MORE_INFO_SETTINGS]:{selector:l.HA_DIALOG_MORE_INFO_SETTINGS}}}}}}}}}}}};function h(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function A(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var f="$",d=":host",E="invalid selector",I=10,N=10,L=function(e){var t,n=e[0],r=e[1];return(t=n)&&(t instanceof Document||t instanceof Element)&&"string"==typeof r};function v(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(f).map((function(e){return e.trim()}))}(e);return t(n)}))}function R(e,t,n,r,o){return void 0===o&&(o=!1),new Promise((function(i){var s=0,c=function(){var a=o?e.querySelectorAll(t):e.querySelector(t);o&&a.length||!o&&null!==a?i(a):++s<n?setTimeout(c,r):i(o?document.querySelectorAll(E):null)};c()}))}function S(e,t,n){return new Promise((function(r){var o=0,i=function(){var s=e.shadowRoot;s?r(s):++o<t?setTimeout(i,n):r(null)};i()}))}function H(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(f,").").concat(n)}function w(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(f,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}function T(){return"You can not select a shadowRoot (".concat(f,") of the document.")}function D(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:o=null,i=e.length,s=0,u.label=1;case 1:if(!(s<i))return[3,15];if(0!==s)return[3,8];if(e[s].length)return[3,5];if(t instanceof Document)throw new SyntaxError(T());return t.shadowRoot?[4,R(t.shadowRoot,e[++s],n,r)]:[3,3];case 2:return c=u.sent(),[3,4];case 3:c=null,u.label=4;case 4:return o=c,[3,7];case 5:return[4,R(t,e[s],n,r)];case 6:o=u.sent(),u.label=7;case 7:return[3,13];case 8:return[4,S(o,n,r)];case 9:return(a=u.sent())?[4,R(a,"".concat(d," ").concat(e[s]),n,r)]:[3,11];case 10:return l=u.sent(),[3,12];case 11:l=null,u.label=12;case 12:o=l,u.label=13;case 13:if(null===o)return[2,null];u.label=14;case 14:return s++,[3,1];case 15:return[2,o]}}))}))}function p(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:return o=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),i=o.pop(),o.length?[3,2]:[4,R(t,i,n,r,!0)];case 1:return[2,u.sent()];case 2:return[4,D(o,t,n,r)];case 3:return(s=u.sent())?[4,S(s,n,r)]:[3,5];case 4:return a=u.sent(),[3,6];case 5:a=null,u.label=6;case 6:return(c=a)?[4,R(c,"".concat(d," ").concat(i),n,r,!0)]:[3,8];case 7:return l=u.sent(),[3,9];case 8:l=null,u.label=9;case 9:return[2,l]}}))}))}function y(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i;return A(this,(function(s){switch(s.label){case 0:if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(T());return[2,S(t,n,r)]}return[4,D(e,t,n,r)];case 1:return(o=s.sent())?[4,S(o,n,r)]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=null,s.label=4;case 4:return[2,i]}}))}))}function b(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(H("asyncQuerySelector","asyncShadowRootQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,D(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function G(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(H("asyncQuerySelectorAll"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,p(o[s],t,n,r)]:[3,4];case 2:if(null==(c=a.sent())?void 0:c.length)return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,document.querySelectorAll(E)]}}))}))}function M(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(e.pop().length)throw new SyntaxError(w("asyncShadowRootQuerySelector","asyncQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,y(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function m(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,b(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=e[0],i=e[1],[4,b(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}const g=(t,n,o=null,i=!1)=>Object.entries(n||{}).reduce(((n,s)=>{const[c,a]=s;if(a.selector===r&&o)return a.children?Object.assign(Object.assign({},n),g(t,a.children,o,!0)):n;const l=o?o.then((e=>{return m(e,(n=a.selector,i?"$ "+n:n),t);var n})):m(a.selector,t);return n[c]={element:l,children:g(t,a.children,l),querySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield m(e,n,Object.assign(Object.assign({},t),r))}))},querySelectorAll(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,G(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,G(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))},shadowRootQuerySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,M(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,M(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))}},n}),{}),F=(e,t)=>{const n=Object.entries(t);for(const t of n){if(t[0]===e)return t[1];{const n=F(e,t[1].children);if(n)return n}}},P=(e,t)=>Object.keys(e).reduce(((e,n)=>{const r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(F(n,t),["children"]);return e[n]=Object.assign({},r),e}),{});var V,W,C,j,k,x,B,Y,K,U,Q,q,$,z,J,X,Z,ee,te,ne,re;class oe extends EventTarget{constructor(e={}){super(),V.add(this),W.set(this,void 0),C.set(this,void 0),j.set(this,void 0),k.set(this,void 0),x.set(this,void 0),B.set(this,void 0),Y.set(this,void 0),K.set(this,void 0),U.set(this,void 0),Q.set(this,void 0),q.set(this,void 0),$.set(this,void 0),z.set(this,void 0),n(this,W,Object.assign(Object.assign({},o),e),"f")}listen(){n(this,q,t(this,V,"m",te).bind(this),"f"),n(this,$,t(this,V,"m",ne).bind(this),"f"),n(this,z,t(this,V,"m",re).bind(this),"f"),n(this,K,new MutationObserver(t(this,q,"f")),"f"),n(this,U,new MutationObserver(t(this,$,"f")),"f"),n(this,Q,new MutationObserver(t(this,z,"f")),"f"),t(this,V,"m",Z).call(this),t(this,V,"m",ee).call(this)}}W=new WeakMap,C=new WeakMap,j=new WeakMap,k=new WeakMap,x=new WeakMap,B=new WeakMap,Y=new WeakMap,K=new WeakMap,U=new WeakMap,Q=new WeakMap,q=new WeakMap,$=new WeakMap,z=new WeakMap,V=new WeakSet,J=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},X=function(e=c.HA_MORE_INFO_DIALOG_INFO){n(this,C,g(t(this,W,"f"),_,t(this,B,"f").HOME_ASSISTANT.element),"f");const r=P(c,t(this,C,"f"));r.HA_DIALOG_CONTENT.element.then((e=>{t(this,U,"f").disconnect(),t(this,U,"f").observe(e,{childList:!0})})),n(this,x,((e,t)=>[c.HA_MORE_INFO_DIALOG,c.HA_DIALOG,c.HA_DIALOG_CONTENT,t].reduce(((t,n)=>(t[n]=e[n],t)),{}))(r,e),"f");const o={[c.HA_MORE_INFO_DIALOG_INFO]:a.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:a.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_SETTINGS]:a.ON_LOVELACE_SETTINGS_DIALOG_OPEN};t(this,V,"m",J).call(this,o[e],t(this,x,"f"))},Z=function(){n(this,j,g(t(this,W,"f"),u),"f"),n(this,B,P(i,t(this,j,"f")),"f"),t(this,B,"f")[i.HOME_ASSISTANT].shadowRootQuerySelector("$").then((e=>{t(this,K,"f").disconnect(),t(this,K,"f").observe(e,{childList:!0})}))},ee=function(){n(this,k,g(t(this,W,"f"),O,t(this,B,"f")[i.HA_DRAWER].element),"f"),n(this,Y,P(s,t(this,k,"f")),"f"),t(this,Y,"f")[s.PARTIAL_PANEL_RESOLVER].element.then((e=>{t(this,Q,"f").disconnect(),t(this,Q,"f").observe(e,{childList:!0})})),t(this,V,"m",J).call(this,a.ON_LOVELACE_PANEL_LOAD,Object.assign(Object.assign({},t(this,B,"f")),t(this,Y,"f")))},te=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_MORE_INFO_DIALOG&&t(this,V,"m",X).call(this)}))}))},ne=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{const n={[l.HA_MORE_INFO_DIALOG_INFO]:c.HA_MORE_INFO_DIALOG_INFO,[l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,[l.HA_DIALOG_MORE_INFO_SETTINGS]:c.HA_DIALOG_MORE_INFO_SETTINGS};if(e.localName&&e.localName in n){const r=e.localName;t(this,V,"m",X).call(this,n[r])}}))}))},re=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_PANEL_LOVELACE&&t(this,V,"m",ee).call(this)}))}))};export{oe as HAQuerySelector,a as HAQuerySelectorEvent};
1
+ function e(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function n(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const r="$",o={retries:100,delay:50};var i,s,c,a,l;!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR"}(i||(i={})),function(e){e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER",e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(s||(s={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(c||(c={})),function(e){e.ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",e.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaceMoreInfoDialogOpen",e.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaceHistoryAndLogBookDialogOpen",e.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaceSettingsDialogOpen"}(a||(a={})),function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(l||(l={}));const u={[i.HOME_ASSISTANT]:{selector:l.HOME_ASSISTANT,children:{shadowRoot:{selector:r,children:{[i.HOME_ASSISTANT_MAIN]:{selector:l.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:r,children:{[i.HA_DRAWER]:{selector:l.HA_DRAWER,children:{[i.HA_SIDEBAR]:{selector:l.HA_SIDEBAR,children:{shadowRoot:{selector:r}}}}}}}}}}}}}},O={[s.PARTIAL_PANEL_RESOLVER]:{selector:l.PARTIAL_PANEL_RESOLVER,children:{[s.HA_PANEL_LOVELACE]:{selector:l.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:r,children:{[s.HUI_ROOT]:{selector:l.HUI_ROOT,children:{shadowRoot:{selector:r,children:{[s.HEADER]:{selector:l.HEADER},[s.HUI_VIEW]:{selector:l.HUI_VIEW}}}}}}}}}}}},_={shadowRoot:{selector:r,children:{[c.HA_MORE_INFO_DIALOG]:{selector:l.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:r,children:{[c.HA_DIALOG]:{selector:l.HA_DIALOG,children:{[c.HA_DIALOG_CONTENT]:{selector:l.HA_DIALOG_CONTENT,children:{[c.HA_MORE_INFO_DIALOG_INFO]:{selector:l.HA_MORE_INFO_DIALOG_INFO},[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:{selector:l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},[c.HA_DIALOG_MORE_INFO_SETTINGS]:{selector:l.HA_DIALOG_MORE_INFO_SETTINGS}}}}}}}}}}}};function h(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function A(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var f="$",d=":host",E="invalid selector",I=10,N=10,L=function(e){var t,n=e[0],r=e[1];return(t=n)&&(t instanceof Document||t instanceof Element)&&"string"==typeof r};function v(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(f).map((function(e){return e.trim()}))}(e);return t(n)}))}function R(e,t,n,r,o){return void 0===o&&(o=!1),new Promise((function(i){var s=0,c=function(){var a=o?e.querySelectorAll(t):e.querySelector(t);o&&a.length||!o&&null!==a?i(a):++s<n?setTimeout(c,r):i(o?document.querySelectorAll(E):null)};c()}))}function S(e,t,n){return new Promise((function(r){var o=0,i=function(){var s=e.shadowRoot;s?r(s):++o<t?setTimeout(i,n):r(null)};i()}))}function H(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(f,").").concat(n)}function w(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(f,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}function T(){return"You can not select a shadowRoot (".concat(f,") of the document.")}function D(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:o=null,i=e.length,s=0,u.label=1;case 1:if(!(s<i))return[3,15];if(0!==s)return[3,8];if(e[s].length)return[3,5];if(t instanceof Document)throw new SyntaxError(T());return t.shadowRoot?[4,R(t.shadowRoot,e[++s],n,r)]:[3,3];case 2:return c=u.sent(),[3,4];case 3:c=null,u.label=4;case 4:return o=c,[3,7];case 5:return[4,R(t,e[s],n,r)];case 6:o=u.sent(),u.label=7;case 7:return[3,13];case 8:return[4,S(o,n,r)];case 9:return(a=u.sent())?[4,R(a,"".concat(d," ").concat(e[s]),n,r)]:[3,11];case 10:return l=u.sent(),[3,12];case 11:l=null,u.label=12;case 12:o=l,u.label=13;case 13:if(null===o)return[2,null];u.label=14;case 14:return s++,[3,1];case 15:return[2,o]}}))}))}function p(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:return o=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),i=o.pop(),o.length?[3,2]:[4,R(t,i,n,r,!0)];case 1:return[2,u.sent()];case 2:return[4,D(o,t,n,r)];case 3:return(s=u.sent())?[4,S(s,n,r)]:[3,5];case 4:return a=u.sent(),[3,6];case 5:a=null,u.label=6;case 6:return(c=a)?[4,R(c,"".concat(d," ").concat(i),n,r,!0)]:[3,8];case 7:return l=u.sent(),[3,9];case 8:l=null,u.label=9;case 9:return[2,l]}}))}))}function y(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i;return A(this,(function(s){switch(s.label){case 0:if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(T());return[2,S(t,n,r)]}return[4,D(e,t,n,r)];case 1:return(o=s.sent())?[4,S(o,n,r)]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=null,s.label=4;case 4:return[2,i]}}))}))}function b(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(H("asyncQuerySelector","asyncShadowRootQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,D(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function G(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(H("asyncQuerySelectorAll"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,p(o[s],t,n,r)]:[3,4];case 2:if(null==(c=a.sent())?void 0:c.length)return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,document.querySelectorAll(E)]}}))}))}function M(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(e.pop().length)throw new SyntaxError(w("asyncShadowRootQuerySelector","asyncQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,y(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function m(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,b(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=e[0],i=e[1],[4,b(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}const g=(t,n,o=null,i=!1)=>Object.entries(n||{}).reduce(((n,s)=>{const[c,a]=s;if(a.selector===r&&o)return a.children?Object.assign(Object.assign({},n),g(t,a.children,o,!0)):n;const l=o?o.then((e=>{return m(e,(n=a.selector,i?"$ "+n:n),t);var n})):m(a.selector,t);return n[c]={element:l,children:g(t,a.children,l),querySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield m(e,n,Object.assign(Object.assign({},t),r))}))},querySelectorAll(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,G(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,G(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))},shadowRootQuerySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,M(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,M(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))}},n}),{}),F=(e,t)=>{const n=Object.entries(t);for(const t of n){if(t[0]===e)return t[1];{const n=F(e,t[1].children);if(n)return n}}},P=(e,t)=>Object.keys(e).reduce(((e,n)=>{const r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(F(n,t),["children"]);return e[n]=Object.assign({},r),e}),{});var V,W,C,j,k,x,B,Y,K,U,Q,q,$,z,J,X,Z,ee,te,ne,re;class oe extends EventTarget{constructor(e={}){super(),V.add(this),W.set(this,void 0),C.set(this,void 0),j.set(this,void 0),k.set(this,void 0),x.set(this,void 0),B.set(this,void 0),Y.set(this,void 0),K.set(this,void 0),U.set(this,void 0),Q.set(this,void 0),q.set(this,void 0),$.set(this,void 0),z.set(this,void 0),n(this,W,Object.assign(Object.assign({},o),e),"f")}listen(){n(this,q,t(this,V,"m",te).bind(this),"f"),n(this,$,t(this,V,"m",ne).bind(this),"f"),n(this,z,t(this,V,"m",re).bind(this),"f"),n(this,K,new MutationObserver(t(this,q,"f")),"f"),n(this,U,new MutationObserver(t(this,$,"f")),"f"),n(this,Q,new MutationObserver(t(this,z,"f")),"f"),t(this,V,"m",Z).call(this),t(this,V,"m",ee).call(this)}}W=new WeakMap,C=new WeakMap,j=new WeakMap,k=new WeakMap,x=new WeakMap,B=new WeakMap,Y=new WeakMap,K=new WeakMap,U=new WeakMap,Q=new WeakMap,q=new WeakMap,$=new WeakMap,z=new WeakMap,V=new WeakSet,J=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},X=function(e=c.HA_MORE_INFO_DIALOG_INFO){n(this,C,g(t(this,W,"f"),_,t(this,B,"f").HOME_ASSISTANT.element),"f");const r=P(c,t(this,C,"f"));r.HA_DIALOG_CONTENT.element.then((e=>{t(this,U,"f").disconnect(),t(this,U,"f").observe(e,{childList:!0})})),n(this,x,((e,t)=>[c.HA_MORE_INFO_DIALOG,c.HA_DIALOG,c.HA_DIALOG_CONTENT,t].reduce(((t,n)=>(t[n]=e[n],t)),{}))(r,e),"f");const o={[c.HA_MORE_INFO_DIALOG_INFO]:a.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:a.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_SETTINGS]:a.ON_LOVELACE_SETTINGS_DIALOG_OPEN};t(this,V,"m",J).call(this,o[e],t(this,x,"f"))},Z=function(){n(this,j,g(t(this,W,"f"),u),"f"),n(this,B,P(i,t(this,j,"f")),"f"),t(this,B,"f")[i.HOME_ASSISTANT].shadowRootQuerySelector("$").then((e=>{t(this,K,"f").disconnect(),t(this,K,"f").observe(e,{childList:!0})}))},ee=function(){n(this,k,g(t(this,W,"f"),O,t(this,B,"f")[i.HA_DRAWER].element),"f"),n(this,Y,P(s,t(this,k,"f")),"f"),t(this,Y,"f")[s.PARTIAL_PANEL_RESOLVER].element.then((e=>{t(this,Q,"f").disconnect(),t(this,Q,"f").observe(e,{childList:!0})})),t(this,V,"m",J).call(this,a.ON_LOVELACE_PANEL_LOAD,Object.assign(Object.assign({},t(this,B,"f")),t(this,Y,"f")))},te=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_MORE_INFO_DIALOG&&t(this,V,"m",X).call(this)}))}))},ne=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{const n={[l.HA_MORE_INFO_DIALOG_INFO]:c.HA_MORE_INFO_DIALOG_INFO,[l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,[l.HA_DIALOG_MORE_INFO_SETTINGS]:c.HA_DIALOG_MORE_INFO_SETTINGS};if(e.localName&&e.localName in n){const r=e.localName;t(this,V,"m",X).call(this,n[r])}}))}))},re=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_PANEL_LOVELACE&&t(this,V,"m",ee).call(this)}))}))};export{oe as HAQuerySelector,a as HAQuerySelectorEvent};
package/dist/index.d.ts CHANGED
@@ -21,9 +21,9 @@ type HomeAssistantElement = {
21
21
  };
22
22
  declare enum HAQuerySelectorEvent {
23
23
  ON_LOVELACE_PANEL_LOAD = "onLovelacePanelLoad",
24
- ON_LOVELACE_MORE_INFO_DIALOG_OPEN = "onLovelaveMoreInfoDialogOpen",
25
- ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN = "onLovelaveHistoryAndLogBookDialogOpen",
26
- ON_LOVELACE_SETTINGS_DIALOG_OPEN = "onLovelaveSettingsDialogOpen"
24
+ ON_LOVELACE_MORE_INFO_DIALOG_OPEN = "onLovelaceMoreInfoDialogOpen",
25
+ ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN = "onLovelaceHistoryAndLogBookDialogOpen",
26
+ ON_LOVELACE_SETTINGS_DIALOG_OPEN = "onLovelaceSettingsDialogOpen"
27
27
  }
28
28
  declare class HAQuerySelector extends EventTarget {
29
29
  #private;
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";function e(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function n(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const r="$",o={retries:100,delay:50};var i,s,c,a,l;!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR"}(i||(i={})),function(e){e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER",e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(s||(s={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(c||(c={})),exports.HAQuerySelectorEvent=void 0,(a=exports.HAQuerySelectorEvent||(exports.HAQuerySelectorEvent={})).ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",a.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaveMoreInfoDialogOpen",a.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaveHistoryAndLogBookDialogOpen",a.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaveSettingsDialogOpen",function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(l||(l={}));const u={[i.HOME_ASSISTANT]:{selector:l.HOME_ASSISTANT,children:{shadowRoot:{selector:r,children:{[i.HOME_ASSISTANT_MAIN]:{selector:l.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:r,children:{[i.HA_DRAWER]:{selector:l.HA_DRAWER,children:{[i.HA_SIDEBAR]:{selector:l.HA_SIDEBAR,children:{shadowRoot:{selector:r}}}}}}}}}}}}}},O={[s.PARTIAL_PANEL_RESOLVER]:{selector:l.PARTIAL_PANEL_RESOLVER,children:{[s.HA_PANEL_LOVELACE]:{selector:l.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:r,children:{[s.HUI_ROOT]:{selector:l.HUI_ROOT,children:{shadowRoot:{selector:r,children:{[s.HEADER]:{selector:l.HEADER},[s.HUI_VIEW]:{selector:l.HUI_VIEW}}}}}}}}}}}},_={shadowRoot:{selector:r,children:{[c.HA_MORE_INFO_DIALOG]:{selector:l.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:r,children:{[c.HA_DIALOG]:{selector:l.HA_DIALOG,children:{[c.HA_DIALOG_CONTENT]:{selector:l.HA_DIALOG_CONTENT,children:{[c.HA_MORE_INFO_DIALOG_INFO]:{selector:l.HA_MORE_INFO_DIALOG_INFO},[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:{selector:l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},[c.HA_DIALOG_MORE_INFO_SETTINGS]:{selector:l.HA_DIALOG_MORE_INFO_SETTINGS}}}}}}}}}}}};function h(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function A(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var f="$",d=":host",E="invalid selector",I=10,N=10,L=function(e){var t,n=e[0],r=e[1];return(t=n)&&(t instanceof Document||t instanceof Element)&&"string"==typeof r};function v(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(f).map((function(e){return e.trim()}))}(e);return t(n)}))}function S(e,t,n,r,o){return void 0===o&&(o=!1),new Promise((function(i){var s=0,c=function(){var a=o?e.querySelectorAll(t):e.querySelector(t);o&&a.length||!o&&null!==a?i(a):++s<n?setTimeout(c,r):i(o?document.querySelectorAll(E):null)};c()}))}function H(e,t,n){return new Promise((function(r){var o=0,i=function(){var s=e.shadowRoot;s?r(s):++o<t?setTimeout(i,n):r(null)};i()}))}function R(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(f,").").concat(n)}function w(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(f,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}function p(){return"You can not select a shadowRoot (".concat(f,") of the document.")}function y(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:o=null,i=e.length,s=0,u.label=1;case 1:if(!(s<i))return[3,15];if(0!==s)return[3,8];if(e[s].length)return[3,5];if(t instanceof Document)throw new SyntaxError(p());return t.shadowRoot?[4,S(t.shadowRoot,e[++s],n,r)]:[3,3];case 2:return c=u.sent(),[3,4];case 3:c=null,u.label=4;case 4:return o=c,[3,7];case 5:return[4,S(t,e[s],n,r)];case 6:o=u.sent(),u.label=7;case 7:return[3,13];case 8:return[4,H(o,n,r)];case 9:return(a=u.sent())?[4,S(a,"".concat(d," ").concat(e[s]),n,r)]:[3,11];case 10:return l=u.sent(),[3,12];case 11:l=null,u.label=12;case 12:o=l,u.label=13;case 13:if(null===o)return[2,null];u.label=14;case 14:return s++,[3,1];case 15:return[2,o]}}))}))}function T(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:return o=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),i=o.pop(),o.length?[3,2]:[4,S(t,i,n,r,!0)];case 1:return[2,u.sent()];case 2:return[4,y(o,t,n,r)];case 3:return(s=u.sent())?[4,H(s,n,r)]:[3,5];case 4:return a=u.sent(),[3,6];case 5:a=null,u.label=6;case 6:return(c=a)?[4,S(c,"".concat(d," ").concat(i),n,r,!0)]:[3,8];case 7:return l=u.sent(),[3,9];case 8:l=null,u.label=9;case 9:return[2,l]}}))}))}function D(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i;return A(this,(function(s){switch(s.label){case 0:if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(p());return[2,H(t,n,r)]}return[4,y(e,t,n,r)];case 1:return(o=s.sent())?[4,H(o,n,r)]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=null,s.label=4;case 4:return[2,i]}}))}))}function b(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(R("asyncQuerySelector","asyncShadowRootQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,y(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function G(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(R("asyncQuerySelectorAll"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,T(o[s],t,n,r)]:[3,4];case 2:if(null==(c=a.sent())?void 0:c.length)return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,document.querySelectorAll(E)]}}))}))}function M(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(e.pop().length)throw new SyntaxError(w("asyncShadowRootQuerySelector","asyncQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,D(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function m(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,b(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=e[0],i=e[1],[4,b(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}const g=(t,n,o=null,i=!1)=>Object.entries(n||{}).reduce(((n,s)=>{const[c,a]=s;if(a.selector===r&&o)return a.children?Object.assign(Object.assign({},n),g(t,a.children,o,!0)):n;const l=o?o.then((e=>{return m(e,(n=a.selector,i?"$ "+n:n),t);var n})):m(a.selector,t);return n[c]={element:l,children:g(t,a.children,l),querySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield m(e,n,Object.assign(Object.assign({},t),r))}))},querySelectorAll(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,G(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,G(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))},shadowRootQuerySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,M(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,M(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))}},n}),{}),F=(e,t)=>{const n=Object.entries(t);for(const t of n){if(t[0]===e)return t[1];{const n=F(e,t[1].children);if(n)return n}}},P=(e,t)=>Object.keys(e).reduce(((e,n)=>{const r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(F(n,t),["children"]);return e[n]=Object.assign({},r),e}),{});var V,W,C,x,j,k,B,Q,Y,K,U,q,$,z,J,X,Z,ee,te,ne,re;class oe extends EventTarget{constructor(e={}){super(),V.add(this),W.set(this,void 0),C.set(this,void 0),x.set(this,void 0),j.set(this,void 0),k.set(this,void 0),B.set(this,void 0),Q.set(this,void 0),Y.set(this,void 0),K.set(this,void 0),U.set(this,void 0),q.set(this,void 0),$.set(this,void 0),z.set(this,void 0),n(this,W,Object.assign(Object.assign({},o),e),"f")}listen(){n(this,q,t(this,V,"m",te).bind(this),"f"),n(this,$,t(this,V,"m",ne).bind(this),"f"),n(this,z,t(this,V,"m",re).bind(this),"f"),n(this,Y,new MutationObserver(t(this,q,"f")),"f"),n(this,K,new MutationObserver(t(this,$,"f")),"f"),n(this,U,new MutationObserver(t(this,z,"f")),"f"),t(this,V,"m",Z).call(this),t(this,V,"m",ee).call(this)}}W=new WeakMap,C=new WeakMap,x=new WeakMap,j=new WeakMap,k=new WeakMap,B=new WeakMap,Q=new WeakMap,Y=new WeakMap,K=new WeakMap,U=new WeakMap,q=new WeakMap,$=new WeakMap,z=new WeakMap,V=new WeakSet,J=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},X=function(e=c.HA_MORE_INFO_DIALOG_INFO){n(this,C,g(t(this,W,"f"),_,t(this,B,"f").HOME_ASSISTANT.element),"f");const r=P(c,t(this,C,"f"));r.HA_DIALOG_CONTENT.element.then((e=>{t(this,K,"f").disconnect(),t(this,K,"f").observe(e,{childList:!0})})),n(this,k,((e,t)=>[c.HA_MORE_INFO_DIALOG,c.HA_DIALOG,c.HA_DIALOG_CONTENT,t].reduce(((t,n)=>(t[n]=e[n],t)),{}))(r,e),"f");const o={[c.HA_MORE_INFO_DIALOG_INFO]:exports.HAQuerySelectorEvent.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:exports.HAQuerySelectorEvent.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_SETTINGS]:exports.HAQuerySelectorEvent.ON_LOVELACE_SETTINGS_DIALOG_OPEN};t(this,V,"m",J).call(this,o[e],t(this,k,"f"))},Z=function(){n(this,x,g(t(this,W,"f"),u),"f"),n(this,B,P(i,t(this,x,"f")),"f"),t(this,B,"f")[i.HOME_ASSISTANT].shadowRootQuerySelector("$").then((e=>{t(this,Y,"f").disconnect(),t(this,Y,"f").observe(e,{childList:!0})}))},ee=function(){n(this,j,g(t(this,W,"f"),O,t(this,B,"f")[i.HA_DRAWER].element),"f"),n(this,Q,P(s,t(this,j,"f")),"f"),t(this,Q,"f")[s.PARTIAL_PANEL_RESOLVER].element.then((e=>{t(this,U,"f").disconnect(),t(this,U,"f").observe(e,{childList:!0})})),t(this,V,"m",J).call(this,exports.HAQuerySelectorEvent.ON_LOVELACE_PANEL_LOAD,Object.assign(Object.assign({},t(this,B,"f")),t(this,Q,"f")))},te=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_MORE_INFO_DIALOG&&t(this,V,"m",X).call(this)}))}))},ne=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{const n={[l.HA_MORE_INFO_DIALOG_INFO]:c.HA_MORE_INFO_DIALOG_INFO,[l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,[l.HA_DIALOG_MORE_INFO_SETTINGS]:c.HA_DIALOG_MORE_INFO_SETTINGS};if(e.localName&&e.localName in n){const r=e.localName;t(this,V,"m",X).call(this,n[r])}}))}))},re=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_PANEL_LOVELACE&&t(this,V,"m",ee).call(this)}))}))},exports.HAQuerySelector=oe;
1
+ "use strict";function e(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function t(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function n(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const r="$",o={retries:100,delay:50};var i,s,c,a,l;!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR"}(i||(i={})),function(e){e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER",e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(s||(s={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(c||(c={})),exports.HAQuerySelectorEvent=void 0,(a=exports.HAQuerySelectorEvent||(exports.HAQuerySelectorEvent={})).ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",a.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaceMoreInfoDialogOpen",a.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaceHistoryAndLogBookDialogOpen",a.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaceSettingsDialogOpen",function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(l||(l={}));const u={[i.HOME_ASSISTANT]:{selector:l.HOME_ASSISTANT,children:{shadowRoot:{selector:r,children:{[i.HOME_ASSISTANT_MAIN]:{selector:l.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:r,children:{[i.HA_DRAWER]:{selector:l.HA_DRAWER,children:{[i.HA_SIDEBAR]:{selector:l.HA_SIDEBAR,children:{shadowRoot:{selector:r}}}}}}}}}}}}}},O={[s.PARTIAL_PANEL_RESOLVER]:{selector:l.PARTIAL_PANEL_RESOLVER,children:{[s.HA_PANEL_LOVELACE]:{selector:l.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:r,children:{[s.HUI_ROOT]:{selector:l.HUI_ROOT,children:{shadowRoot:{selector:r,children:{[s.HEADER]:{selector:l.HEADER},[s.HUI_VIEW]:{selector:l.HUI_VIEW}}}}}}}}}}}},_={shadowRoot:{selector:r,children:{[c.HA_MORE_INFO_DIALOG]:{selector:l.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:r,children:{[c.HA_DIALOG]:{selector:l.HA_DIALOG,children:{[c.HA_DIALOG_CONTENT]:{selector:l.HA_DIALOG_CONTENT,children:{[c.HA_MORE_INFO_DIALOG_INFO]:{selector:l.HA_MORE_INFO_DIALOG_INFO},[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:{selector:l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},[c.HA_DIALOG_MORE_INFO_SETTINGS]:{selector:l.HA_DIALOG_MORE_INFO_SETTINGS}}}}}}}}}}}};function h(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function A(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var f="$",d=":host",E="invalid selector",I=10,N=10,L=function(e){var t,n=e[0],r=e[1];return(t=n)&&(t instanceof Document||t instanceof Element)&&"string"==typeof r};function v(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(f).map((function(e){return e.trim()}))}(e);return t(n)}))}function S(e,t,n,r,o){return void 0===o&&(o=!1),new Promise((function(i){var s=0,c=function(){var a=o?e.querySelectorAll(t):e.querySelector(t);o&&a.length||!o&&null!==a?i(a):++s<n?setTimeout(c,r):i(o?document.querySelectorAll(E):null)};c()}))}function H(e,t,n){return new Promise((function(r){var o=0,i=function(){var s=e.shadowRoot;s?r(s):++o<t?setTimeout(i,n):r(null)};i()}))}function R(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(f,").").concat(n)}function w(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(f,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}function p(){return"You can not select a shadowRoot (".concat(f,") of the document.")}function y(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:o=null,i=e.length,s=0,u.label=1;case 1:if(!(s<i))return[3,15];if(0!==s)return[3,8];if(e[s].length)return[3,5];if(t instanceof Document)throw new SyntaxError(p());return t.shadowRoot?[4,S(t.shadowRoot,e[++s],n,r)]:[3,3];case 2:return c=u.sent(),[3,4];case 3:c=null,u.label=4;case 4:return o=c,[3,7];case 5:return[4,S(t,e[s],n,r)];case 6:o=u.sent(),u.label=7;case 7:return[3,13];case 8:return[4,H(o,n,r)];case 9:return(a=u.sent())?[4,S(a,"".concat(d," ").concat(e[s]),n,r)]:[3,11];case 10:return l=u.sent(),[3,12];case 11:l=null,u.label=12;case 12:o=l,u.label=13;case 13:if(null===o)return[2,null];u.label=14;case 14:return s++,[3,1];case 15:return[2,o]}}))}))}function T(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c,a,l;return A(this,(function(u){switch(u.label){case 0:return o=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),i=o.pop(),o.length?[3,2]:[4,S(t,i,n,r,!0)];case 1:return[2,u.sent()];case 2:return[4,y(o,t,n,r)];case 3:return(s=u.sent())?[4,H(s,n,r)]:[3,5];case 4:return a=u.sent(),[3,6];case 5:a=null,u.label=6;case 6:return(c=a)?[4,S(c,"".concat(d," ").concat(i),n,r,!0)]:[3,8];case 7:return l=u.sent(),[3,9];case 8:l=null,u.label=9;case 9:return[2,l]}}))}))}function D(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i;return A(this,(function(s){switch(s.label){case 0:if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(p());return[2,H(t,n,r)]}return[4,y(e,t,n,r)];case 1:return(o=s.sent())?[4,H(o,n,r)]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=null,s.label=4;case 4:return[2,i]}}))}))}function b(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(R("asyncQuerySelector","asyncShadowRootQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,y(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function G(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(R("asyncQuerySelectorAll"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,T(o[s],t,n,r)]:[3,4];case 2:if(null==(c=a.sent())?void 0:c.length)return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,document.querySelectorAll(E)]}}))}))}function M(e,t,n,r){return h(this,void 0,void 0,(function(){var o,i,s,c;return A(this,(function(a){switch(a.label){case 0:o=v(e,(function(e){if(e.pop().length)throw new SyntaxError(w("asyncShadowRootQuerySelector","asyncQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,D(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function m(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,b(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=e[0],i=e[1],[4,b(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}const g=(t,n,o=null,i=!1)=>Object.entries(n||{}).reduce(((n,s)=>{const[c,a]=s;if(a.selector===r&&o)return a.children?Object.assign(Object.assign({},n),g(t,a.children,o,!0)):n;const l=o?o.then((e=>{return m(e,(n=a.selector,i?"$ "+n:n),t);var n})):m(a.selector,t);return n[c]={element:l,children:g(t,a.children,l),querySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield m(e,n,Object.assign(Object.assign({},t),r))}))},querySelectorAll(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,G(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,G(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))},shadowRootQuerySelector(n,r={}){return e(this,void 0,void 0,(function*(){const e=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return h(this,void 0,void 0,(function(){var t,n,r,o,i;return A(this,(function(s){switch(s.label){case 0:return L(e)?(t=e[0],n=e[1],r=e[2],[4,M(n,t,(null==r?void 0:r.retries)||I,(null==r?void 0:r.delay)||N)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,M(o,document,(null==i?void 0:i.retries)||I,(null==i?void 0:i.delay)||N)]}}))}))}(e,n,Object.assign(Object.assign({},t),r))}))}},n}),{}),F=(e,t)=>{const n=Object.entries(t);for(const t of n){if(t[0]===e)return t[1];{const n=F(e,t[1].children);if(n)return n}}},P=(e,t)=>Object.keys(e).reduce(((e,n)=>{const r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(F(n,t),["children"]);return e[n]=Object.assign({},r),e}),{});var V,W,C,x,j,k,B,Q,Y,K,U,q,$,z,J,X,Z,ee,te,ne,re;class oe extends EventTarget{constructor(e={}){super(),V.add(this),W.set(this,void 0),C.set(this,void 0),x.set(this,void 0),j.set(this,void 0),k.set(this,void 0),B.set(this,void 0),Q.set(this,void 0),Y.set(this,void 0),K.set(this,void 0),U.set(this,void 0),q.set(this,void 0),$.set(this,void 0),z.set(this,void 0),n(this,W,Object.assign(Object.assign({},o),e),"f")}listen(){n(this,q,t(this,V,"m",te).bind(this),"f"),n(this,$,t(this,V,"m",ne).bind(this),"f"),n(this,z,t(this,V,"m",re).bind(this),"f"),n(this,Y,new MutationObserver(t(this,q,"f")),"f"),n(this,K,new MutationObserver(t(this,$,"f")),"f"),n(this,U,new MutationObserver(t(this,z,"f")),"f"),t(this,V,"m",Z).call(this),t(this,V,"m",ee).call(this)}}W=new WeakMap,C=new WeakMap,x=new WeakMap,j=new WeakMap,k=new WeakMap,B=new WeakMap,Q=new WeakMap,Y=new WeakMap,K=new WeakMap,U=new WeakMap,q=new WeakMap,$=new WeakMap,z=new WeakMap,V=new WeakSet,J=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},X=function(e=c.HA_MORE_INFO_DIALOG_INFO){n(this,C,g(t(this,W,"f"),_,t(this,B,"f").HOME_ASSISTANT.element),"f");const r=P(c,t(this,C,"f"));r.HA_DIALOG_CONTENT.element.then((e=>{t(this,K,"f").disconnect(),t(this,K,"f").observe(e,{childList:!0})})),n(this,k,((e,t)=>[c.HA_MORE_INFO_DIALOG,c.HA_DIALOG,c.HA_DIALOG_CONTENT,t].reduce(((t,n)=>(t[n]=e[n],t)),{}))(r,e),"f");const o={[c.HA_MORE_INFO_DIALOG_INFO]:exports.HAQuerySelectorEvent.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:exports.HAQuerySelectorEvent.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,[c.HA_DIALOG_MORE_INFO_SETTINGS]:exports.HAQuerySelectorEvent.ON_LOVELACE_SETTINGS_DIALOG_OPEN};t(this,V,"m",J).call(this,o[e],t(this,k,"f"))},Z=function(){n(this,x,g(t(this,W,"f"),u),"f"),n(this,B,P(i,t(this,x,"f")),"f"),t(this,B,"f")[i.HOME_ASSISTANT].shadowRootQuerySelector("$").then((e=>{t(this,Y,"f").disconnect(),t(this,Y,"f").observe(e,{childList:!0})}))},ee=function(){n(this,j,g(t(this,W,"f"),O,t(this,B,"f")[i.HA_DRAWER].element),"f"),n(this,Q,P(s,t(this,j,"f")),"f"),t(this,Q,"f")[s.PARTIAL_PANEL_RESOLVER].element.then((e=>{t(this,U,"f").disconnect(),t(this,U,"f").observe(e,{childList:!0})})),t(this,V,"m",J).call(this,exports.HAQuerySelectorEvent.ON_LOVELACE_PANEL_LOAD,Object.assign(Object.assign({},t(this,B,"f")),t(this,Q,"f")))},te=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_MORE_INFO_DIALOG&&t(this,V,"m",X).call(this)}))}))},ne=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{const n={[l.HA_MORE_INFO_DIALOG_INFO]:c.HA_MORE_INFO_DIALOG_INFO,[l.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:c.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,[l.HA_DIALOG_MORE_INFO_SETTINGS]:c.HA_DIALOG_MORE_INFO_SETTINGS};if(e.localName&&e.localName in n){const r=e.localName;t(this,V,"m",X).call(this,n[r])}}))}))},re=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===l.HA_PANEL_LOVELACE&&t(this,V,"m",ee).call(this)}))}))},exports.HAQuerySelector=oe;
@@ -21,9 +21,9 @@ type HomeAssistantElement = {
21
21
  };
22
22
  declare enum HAQuerySelectorEvent {
23
23
  ON_LOVELACE_PANEL_LOAD = "onLovelacePanelLoad",
24
- ON_LOVELACE_MORE_INFO_DIALOG_OPEN = "onLovelaveMoreInfoDialogOpen",
25
- ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN = "onLovelaveHistoryAndLogBookDialogOpen",
26
- ON_LOVELACE_SETTINGS_DIALOG_OPEN = "onLovelaveSettingsDialogOpen"
24
+ ON_LOVELACE_MORE_INFO_DIALOG_OPEN = "onLovelaceMoreInfoDialogOpen",
25
+ ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN = "onLovelaceHistoryAndLogBookDialogOpen",
26
+ ON_LOVELACE_SETTINGS_DIALOG_OPEN = "onLovelaceSettingsDialogOpen"
27
27
  }
28
28
  declare class HAQuerySelector extends EventTarget {
29
29
  #private;
@@ -1 +1 @@
1
- var HomeAssistantQuerySelector=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function n(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function r(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const o="$",i={retries:100,delay:50};var s,c,a,l,u;!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR"}(s||(s={})),function(e){e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER",e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(c||(c={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(a||(a={})),e.HAQuerySelectorEvent=void 0,(l=e.HAQuerySelectorEvent||(e.HAQuerySelectorEvent={})).ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",l.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaveMoreInfoDialogOpen",l.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaveHistoryAndLogBookDialogOpen",l.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaveSettingsDialogOpen",function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(u||(u={}));const O={[s.HOME_ASSISTANT]:{selector:u.HOME_ASSISTANT,children:{shadowRoot:{selector:o,children:{[s.HOME_ASSISTANT_MAIN]:{selector:u.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:o,children:{[s.HA_DRAWER]:{selector:u.HA_DRAWER,children:{[s.HA_SIDEBAR]:{selector:u.HA_SIDEBAR,children:{shadowRoot:{selector:o}}}}}}}}}}}}}},_={[c.PARTIAL_PANEL_RESOLVER]:{selector:u.PARTIAL_PANEL_RESOLVER,children:{[c.HA_PANEL_LOVELACE]:{selector:u.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:o,children:{[c.HUI_ROOT]:{selector:u.HUI_ROOT,children:{shadowRoot:{selector:o,children:{[c.HEADER]:{selector:u.HEADER},[c.HUI_VIEW]:{selector:u.HUI_VIEW}}}}}}}}}}}},h={shadowRoot:{selector:o,children:{[a.HA_MORE_INFO_DIALOG]:{selector:u.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:o,children:{[a.HA_DIALOG]:{selector:u.HA_DIALOG,children:{[a.HA_DIALOG_CONTENT]:{selector:u.HA_DIALOG_CONTENT,children:{[a.HA_MORE_INFO_DIALOG_INFO]:{selector:u.HA_MORE_INFO_DIALOG_INFO},[a.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:{selector:u.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},[a.HA_DIALOG_MORE_INFO_SETTINGS]:{selector:u.HA_DIALOG_MORE_INFO_SETTINGS}}}}}}}}}}}};function A(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var d="$",E=":host",I="invalid selector",N=10,L=10,v=function(e){var t,n=e[0],r=e[1];return(t=n)&&(t instanceof Document||t instanceof Element)&&"string"==typeof r};function S(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(d).map((function(e){return e.trim()}))}(e);return t(n)}))}function H(e,t,n,r,o){return void 0===o&&(o=!1),new Promise((function(i){var s=0,c=function(){var a=o?e.querySelectorAll(t):e.querySelector(t);o&&a.length||!o&&null!==a?i(a):++s<n?setTimeout(c,r):i(o?document.querySelectorAll(I):null)};c()}))}function R(e,t,n){return new Promise((function(r){var o=0,i=function(){var s=e.shadowRoot;s?r(s):++o<t?setTimeout(i,n):r(null)};i()}))}function w(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(d,").").concat(n)}function y(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(d,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}function T(){return"You can not select a shadowRoot (".concat(d,") of the document.")}function D(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c,a,l;return f(this,(function(u){switch(u.label){case 0:o=null,i=e.length,s=0,u.label=1;case 1:if(!(s<i))return[3,15];if(0!==s)return[3,8];if(e[s].length)return[3,5];if(t instanceof Document)throw new SyntaxError(T());return t.shadowRoot?[4,H(t.shadowRoot,e[++s],n,r)]:[3,3];case 2:return c=u.sent(),[3,4];case 3:c=null,u.label=4;case 4:return o=c,[3,7];case 5:return[4,H(t,e[s],n,r)];case 6:o=u.sent(),u.label=7;case 7:return[3,13];case 8:return[4,R(o,n,r)];case 9:return(a=u.sent())?[4,H(a,"".concat(E," ").concat(e[s]),n,r)]:[3,11];case 10:return l=u.sent(),[3,12];case 11:l=null,u.label=12;case 12:o=l,u.label=13;case 13:if(null===o)return[2,null];u.label=14;case 14:return s++,[3,1];case 15:return[2,o]}}))}))}function p(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c,a,l;return f(this,(function(u){switch(u.label){case 0:return o=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),i=o.pop(),o.length?[3,2]:[4,H(t,i,n,r,!0)];case 1:return[2,u.sent()];case 2:return[4,D(o,t,n,r)];case 3:return(s=u.sent())?[4,R(s,n,r)]:[3,5];case 4:return a=u.sent(),[3,6];case 5:a=null,u.label=6;case 6:return(c=a)?[4,H(c,"".concat(E," ").concat(i),n,r,!0)]:[3,8];case 7:return l=u.sent(),[3,9];case 8:l=null,u.label=9;case 9:return[2,l]}}))}))}function b(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i;return f(this,(function(s){switch(s.label){case 0:if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(T());return[2,R(t,n,r)]}return[4,D(e,t,n,r)];case 1:return(o=s.sent())?[4,R(o,n,r)]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=null,s.label=4;case 4:return[2,i]}}))}))}function G(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c;return f(this,(function(a){switch(a.label){case 0:o=S(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(w("asyncQuerySelector","asyncShadowRootQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,D(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function M(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c;return f(this,(function(a){switch(a.label){case 0:o=S(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(w("asyncQuerySelectorAll"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,p(o[s],t,n,r)]:[3,4];case 2:if(null==(c=a.sent())?void 0:c.length)return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,document.querySelectorAll(I)]}}))}))}function m(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c;return f(this,(function(a){switch(a.label){case 0:o=S(e,(function(e){if(e.pop().length)throw new SyntaxError(y("asyncShadowRootQuerySelector","asyncQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,b(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function g(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A(this,void 0,void 0,(function(){var t,n,r,o,i;return f(this,(function(s){switch(s.label){case 0:return v(e)?(t=e[0],n=e[1],r=e[2],[4,G(n,t,(null==r?void 0:r.retries)||N,(null==r?void 0:r.delay)||L)]):[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=e[0],i=e[1],[4,G(o,document,(null==i?void 0:i.retries)||N,(null==i?void 0:i.delay)||L)]}}))}))}const F=(e,n,r=null,i=!1)=>Object.entries(n||{}).reduce(((n,s)=>{const[c,a]=s;if(a.selector===o&&r)return a.children?Object.assign(Object.assign({},n),F(e,a.children,r,!0)):n;const l=r?r.then((t=>{return g(t,(n=a.selector,i?"$ "+n:n),e);var n})):g(a.selector,e);return n[c]={element:l,children:F(e,a.children,l),querySelector(n,r={}){return t(this,void 0,void 0,(function*(){const t=yield l;return yield g(t,n,Object.assign(Object.assign({},e),r))}))},querySelectorAll(n,r={}){return t(this,void 0,void 0,(function*(){const t=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A(this,void 0,void 0,(function(){var t,n,r,o,i;return f(this,(function(s){switch(s.label){case 0:return v(e)?(t=e[0],n=e[1],r=e[2],[4,M(n,t,(null==r?void 0:r.retries)||N,(null==r?void 0:r.delay)||L)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,M(o,document,(null==i?void 0:i.retries)||N,(null==i?void 0:i.delay)||L)]}}))}))}(t,n,Object.assign(Object.assign({},e),r))}))},shadowRootQuerySelector(n,r={}){return t(this,void 0,void 0,(function*(){const t=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A(this,void 0,void 0,(function(){var t,n,r,o,i;return f(this,(function(s){switch(s.label){case 0:return v(e)?(t=e[0],n=e[1],r=e[2],[4,m(n,t,(null==r?void 0:r.retries)||N,(null==r?void 0:r.delay)||L)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,m(o,document,(null==i?void 0:i.retries)||N,(null==i?void 0:i.delay)||L)]}}))}))}(t,n,Object.assign(Object.assign({},e),r))}))}},n}),{}),P=(e,t)=>{const n=Object.entries(t);for(const t of n){if(t[0]===e)return t[1];{const n=P(e,t[1].children);if(n)return n}}},V=(e,t)=>Object.keys(e).reduce(((e,n)=>{const r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(P(n,t),["children"]);return e[n]=Object.assign({},r),e}),{});var W,C,j,k,B,Q,x,Y,K,U,q,$,z,J,X,Z,ee,te,ne,re,oe;class ie extends EventTarget{constructor(e={}){super(),W.add(this),C.set(this,void 0),j.set(this,void 0),k.set(this,void 0),B.set(this,void 0),Q.set(this,void 0),x.set(this,void 0),Y.set(this,void 0),K.set(this,void 0),U.set(this,void 0),q.set(this,void 0),$.set(this,void 0),z.set(this,void 0),J.set(this,void 0),r(this,C,Object.assign(Object.assign({},i),e),"f")}listen(){r(this,$,n(this,W,"m",ne).bind(this),"f"),r(this,z,n(this,W,"m",re).bind(this),"f"),r(this,J,n(this,W,"m",oe).bind(this),"f"),r(this,K,new MutationObserver(n(this,$,"f")),"f"),r(this,U,new MutationObserver(n(this,z,"f")),"f"),r(this,q,new MutationObserver(n(this,J,"f")),"f"),n(this,W,"m",ee).call(this),n(this,W,"m",te).call(this)}}return C=new WeakMap,j=new WeakMap,k=new WeakMap,B=new WeakMap,Q=new WeakMap,x=new WeakMap,Y=new WeakMap,K=new WeakMap,U=new WeakMap,q=new WeakMap,$=new WeakMap,z=new WeakMap,J=new WeakMap,W=new WeakSet,X=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},Z=function(t=a.HA_MORE_INFO_DIALOG_INFO){r(this,j,F(n(this,C,"f"),h,n(this,x,"f").HOME_ASSISTANT.element),"f");const o=V(a,n(this,j,"f"));o.HA_DIALOG_CONTENT.element.then((e=>{n(this,U,"f").disconnect(),n(this,U,"f").observe(e,{childList:!0})})),r(this,Q,((e,t)=>[a.HA_MORE_INFO_DIALOG,a.HA_DIALOG,a.HA_DIALOG_CONTENT,t].reduce(((t,n)=>(t[n]=e[n],t)),{}))(o,t),"f");const i={[a.HA_MORE_INFO_DIALOG_INFO]:e.HAQuerySelectorEvent.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,[a.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:e.HAQuerySelectorEvent.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,[a.HA_DIALOG_MORE_INFO_SETTINGS]:e.HAQuerySelectorEvent.ON_LOVELACE_SETTINGS_DIALOG_OPEN};n(this,W,"m",X).call(this,i[t],n(this,Q,"f"))},ee=function(){r(this,k,F(n(this,C,"f"),O),"f"),r(this,x,V(s,n(this,k,"f")),"f"),n(this,x,"f")[s.HOME_ASSISTANT].shadowRootQuerySelector("$").then((e=>{n(this,K,"f").disconnect(),n(this,K,"f").observe(e,{childList:!0})}))},te=function(){r(this,B,F(n(this,C,"f"),_,n(this,x,"f")[s.HA_DRAWER].element),"f"),r(this,Y,V(c,n(this,B,"f")),"f"),n(this,Y,"f")[c.PARTIAL_PANEL_RESOLVER].element.then((e=>{n(this,q,"f").disconnect(),n(this,q,"f").observe(e,{childList:!0})})),n(this,W,"m",X).call(this,e.HAQuerySelectorEvent.ON_LOVELACE_PANEL_LOAD,Object.assign(Object.assign({},n(this,x,"f")),n(this,Y,"f")))},ne=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===u.HA_MORE_INFO_DIALOG&&n(this,W,"m",Z).call(this)}))}))},re=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{const t={[u.HA_MORE_INFO_DIALOG_INFO]:a.HA_MORE_INFO_DIALOG_INFO,[u.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:a.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,[u.HA_DIALOG_MORE_INFO_SETTINGS]:a.HA_DIALOG_MORE_INFO_SETTINGS};if(e.localName&&e.localName in t){const r=e.localName;n(this,W,"m",Z).call(this,t[r])}}))}))},oe=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===u.HA_PANEL_LOVELACE&&n(this,W,"m",te).call(this)}))}))},e.HAQuerySelector=ie,e}({});
1
+ var HomeAssistantQuerySelector=function(e){"use strict";function t(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function n(e,t,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(e):r?r.value:t.get(e)}function r(e,t,n,r,o){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?o.call(e,n):o?o.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;const o="$",i={retries:100,delay:50};var s,c,a,l,u;!function(e){e.HOME_ASSISTANT="HOME_ASSISTANT",e.HOME_ASSISTANT_MAIN="HOME_ASSISTANT_MAIN",e.HA_DRAWER="HA_DRAWER",e.HA_SIDEBAR="HA_SIDEBAR"}(s||(s={})),function(e){e.PARTIAL_PANEL_RESOLVER="PARTIAL_PANEL_RESOLVER",e.HA_PANEL_LOVELACE="HA_PANEL_LOVELACE",e.HUI_ROOT="HUI_ROOT",e.HEADER="HEADER",e.HUI_VIEW="HUI_VIEW"}(c||(c={})),function(e){e.HA_MORE_INFO_DIALOG="HA_MORE_INFO_DIALOG",e.HA_DIALOG="HA_DIALOG",e.HA_DIALOG_CONTENT="HA_DIALOG_CONTENT",e.HA_MORE_INFO_DIALOG_INFO="HA_MORE_INFO_DIALOG_INFO",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK",e.HA_DIALOG_MORE_INFO_SETTINGS="HA_DIALOG_MORE_INFO_SETTINGS"}(a||(a={})),e.HAQuerySelectorEvent=void 0,(l=e.HAQuerySelectorEvent||(e.HAQuerySelectorEvent={})).ON_LOVELACE_PANEL_LOAD="onLovelacePanelLoad",l.ON_LOVELACE_MORE_INFO_DIALOG_OPEN="onLovelaceMoreInfoDialogOpen",l.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN="onLovelaceHistoryAndLogBookDialogOpen",l.ON_LOVELACE_SETTINGS_DIALOG_OPEN="onLovelaceSettingsDialogOpen",function(e){e.HOME_ASSISTANT="home-assistant",e.HOME_ASSISTANT_MAIN="home-assistant-main",e.HA_DRAWER="ha-drawer",e.HA_SIDEBAR="ha-sidebar",e.PARTIAL_PANEL_RESOLVER="partial-panel-resolver",e.HA_PANEL_LOVELACE="ha-panel-lovelace",e.HUI_ROOT="hui-root",e.HEADER=".header",e.HUI_VIEW="hui-view",e.HA_MORE_INFO_DIALOG="ha-more-info-dialog",e.HA_DIALOG="ha-dialog",e.HA_DIALOG_CONTENT=".content",e.HA_MORE_INFO_DIALOG_INFO="ha-more-info-info",e.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK="ha-more-info-history-and-logbook",e.HA_DIALOG_MORE_INFO_SETTINGS="ha-more-info-settings"}(u||(u={}));const O={[s.HOME_ASSISTANT]:{selector:u.HOME_ASSISTANT,children:{shadowRoot:{selector:o,children:{[s.HOME_ASSISTANT_MAIN]:{selector:u.HOME_ASSISTANT_MAIN,children:{shadowRoot:{selector:o,children:{[s.HA_DRAWER]:{selector:u.HA_DRAWER,children:{[s.HA_SIDEBAR]:{selector:u.HA_SIDEBAR,children:{shadowRoot:{selector:o}}}}}}}}}}}}}},_={[c.PARTIAL_PANEL_RESOLVER]:{selector:u.PARTIAL_PANEL_RESOLVER,children:{[c.HA_PANEL_LOVELACE]:{selector:u.HA_PANEL_LOVELACE,children:{shadowRoot:{selector:o,children:{[c.HUI_ROOT]:{selector:u.HUI_ROOT,children:{shadowRoot:{selector:o,children:{[c.HEADER]:{selector:u.HEADER},[c.HUI_VIEW]:{selector:u.HUI_VIEW}}}}}}}}}}}},h={shadowRoot:{selector:o,children:{[a.HA_MORE_INFO_DIALOG]:{selector:u.HA_MORE_INFO_DIALOG,children:{shadowRoot:{selector:o,children:{[a.HA_DIALOG]:{selector:u.HA_DIALOG,children:{[a.HA_DIALOG_CONTENT]:{selector:u.HA_DIALOG_CONTENT,children:{[a.HA_MORE_INFO_DIALOG_INFO]:{selector:u.HA_MORE_INFO_DIALOG_INFO},[a.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:{selector:u.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK},[a.HA_DIALOG_MORE_INFO_SETTINGS]:{selector:u.HA_DIALOG_MORE_INFO_SETTINGS}}}}}}}}}}}};function A(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{a(r.next(e))}catch(e){i(e)}}function c(e){try{a(r.throw(e))}catch(e){i(e)}}function a(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,c)}a((r=r.apply(e,t||[])).next())}))}function f(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(s=0)),s;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return s.label++,{value:c[1],done:!1};case 5:s.label++,r=c[1],c=[0];continue;case 7:c=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){s=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){s.label=c[1];break}if(6===c[0]&&s.label<o[1]){s.label=o[1],o=c;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(c);break}o[2]&&s.ops.pop(),s.trys.pop();continue}c=t.call(e,s)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}"function"==typeof SuppressedError&&SuppressedError;var d="$",E=":host",I="invalid selector",N=10,L=10,v=function(e){var t,n=e[0],r=e[1];return(t=n)&&(t instanceof Document||t instanceof Element)&&"string"==typeof r};function S(e,t){return function(e){return e.split(",").map((function(e){return e.trim()}))}(e).map((function(e){var n=function(e){return e.split(d).map((function(e){return e.trim()}))}(e);return t(n)}))}function H(e,t,n,r,o){return void 0===o&&(o=!1),new Promise((function(i){var s=0,c=function(){var a=o?e.querySelectorAll(t):e.querySelector(t);o&&a.length||!o&&null!==a?i(a):++s<n?setTimeout(c,r):i(o?document.querySelectorAll(I):null)};c()}))}function R(e,t,n){return new Promise((function(r){var o=0,i=function(){var s=e.shadowRoot;s?r(s):++o<t?setTimeout(i,n):r(null)};i()}))}function w(e,t){var n=t?" If you want to select a shadowRoot, use ".concat(t," instead."):"";return"".concat(e," cannot be used with a selector ending in a shadowRoot (").concat(d,").").concat(n)}function y(e,t){return"".concat(e," must be used with a selector ending in a shadowRoot (").concat(d,"). If you don't want to select a shadowRoot, use ").concat(t," instead.")}function T(){return"You can not select a shadowRoot (".concat(d,") of the document.")}function D(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c,a,l;return f(this,(function(u){switch(u.label){case 0:o=null,i=e.length,s=0,u.label=1;case 1:if(!(s<i))return[3,15];if(0!==s)return[3,8];if(e[s].length)return[3,5];if(t instanceof Document)throw new SyntaxError(T());return t.shadowRoot?[4,H(t.shadowRoot,e[++s],n,r)]:[3,3];case 2:return c=u.sent(),[3,4];case 3:c=null,u.label=4;case 4:return o=c,[3,7];case 5:return[4,H(t,e[s],n,r)];case 6:o=u.sent(),u.label=7;case 7:return[3,13];case 8:return[4,R(o,n,r)];case 9:return(a=u.sent())?[4,H(a,"".concat(E," ").concat(e[s]),n,r)]:[3,11];case 10:return l=u.sent(),[3,12];case 11:l=null,u.label=12;case 12:o=l,u.label=13;case 13:if(null===o)return[2,null];u.label=14;case 14:return s++,[3,1];case 15:return[2,o]}}))}))}function p(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c,a,l;return f(this,(function(u){switch(u.label){case 0:return o=function(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}([],e,!0),i=o.pop(),o.length?[3,2]:[4,H(t,i,n,r,!0)];case 1:return[2,u.sent()];case 2:return[4,D(o,t,n,r)];case 3:return(s=u.sent())?[4,R(s,n,r)]:[3,5];case 4:return a=u.sent(),[3,6];case 5:a=null,u.label=6;case 6:return(c=a)?[4,H(c,"".concat(E," ").concat(i),n,r,!0)]:[3,8];case 7:return l=u.sent(),[3,9];case 8:l=null,u.label=9;case 9:return[2,l]}}))}))}function b(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i;return f(this,(function(s){switch(s.label){case 0:if(1===e.length&&!e[0].length){if(t instanceof Document)throw new SyntaxError(T());return[2,R(t,n,r)]}return[4,D(e,t,n,r)];case 1:return(o=s.sent())?[4,R(o,n,r)]:[3,3];case 2:return i=s.sent(),[3,4];case 3:i=null,s.label=4;case 4:return[2,i]}}))}))}function G(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c;return f(this,(function(a){switch(a.label){case 0:o=S(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(w("asyncQuerySelector","asyncShadowRootQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,D(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function M(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c;return f(this,(function(a){switch(a.label){case 0:o=S(e,(function(e){if(!e[e.length-1].length)throw new SyntaxError(w("asyncQuerySelectorAll"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,p(o[s],t,n,r)]:[3,4];case 2:if(null==(c=a.sent())?void 0:c.length)return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,document.querySelectorAll(I)]}}))}))}function m(e,t,n,r){return A(this,void 0,void 0,(function(){var o,i,s,c;return f(this,(function(a){switch(a.label){case 0:o=S(e,(function(e){if(e.pop().length)throw new SyntaxError(y("asyncShadowRootQuerySelector","asyncQuerySelector"));return e})),i=o.length,s=0,a.label=1;case 1:return s<i?[4,b(o[s],t,n,r)]:[3,4];case 2:if(c=a.sent())return[2,c];a.label=3;case 3:return s++,[3,1];case 4:return[2,null]}}))}))}function g(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A(this,void 0,void 0,(function(){var t,n,r,o,i;return f(this,(function(s){switch(s.label){case 0:return v(e)?(t=e[0],n=e[1],r=e[2],[4,G(n,t,(null==r?void 0:r.retries)||N,(null==r?void 0:r.delay)||L)]):[3,2];case 1:case 3:return[2,s.sent()];case 2:return o=e[0],i=e[1],[4,G(o,document,(null==i?void 0:i.retries)||N,(null==i?void 0:i.delay)||L)]}}))}))}const F=(e,n,r=null,i=!1)=>Object.entries(n||{}).reduce(((n,s)=>{const[c,a]=s;if(a.selector===o&&r)return a.children?Object.assign(Object.assign({},n),F(e,a.children,r,!0)):n;const l=r?r.then((t=>{return g(t,(n=a.selector,i?"$ "+n:n),e);var n})):g(a.selector,e);return n[c]={element:l,children:F(e,a.children,l),querySelector(n,r={}){return t(this,void 0,void 0,(function*(){const t=yield l;return yield g(t,n,Object.assign(Object.assign({},e),r))}))},querySelectorAll(n,r={}){return t(this,void 0,void 0,(function*(){const t=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A(this,void 0,void 0,(function(){var t,n,r,o,i;return f(this,(function(s){switch(s.label){case 0:return v(e)?(t=e[0],n=e[1],r=e[2],[4,M(n,t,(null==r?void 0:r.retries)||N,(null==r?void 0:r.delay)||L)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,M(o,document,(null==i?void 0:i.retries)||N,(null==i?void 0:i.delay)||L)]}}))}))}(t,n,Object.assign(Object.assign({},e),r))}))},shadowRootQuerySelector(n,r={}){return t(this,void 0,void 0,(function*(){const t=yield l;return yield function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return A(this,void 0,void 0,(function(){var t,n,r,o,i;return f(this,(function(s){switch(s.label){case 0:return v(e)?(t=e[0],n=e[1],r=e[2],[4,m(n,t,(null==r?void 0:r.retries)||N,(null==r?void 0:r.delay)||L)]):[3,2];case 1:return[2,s.sent()];case 2:return o=e[0],i=e[1],[2,m(o,document,(null==i?void 0:i.retries)||N,(null==i?void 0:i.delay)||L)]}}))}))}(t,n,Object.assign(Object.assign({},e),r))}))}},n}),{}),P=(e,t)=>{const n=Object.entries(t);for(const t of n){if(t[0]===e)return t[1];{const n=P(e,t[1].children);if(n)return n}}},V=(e,t)=>Object.keys(e).reduce(((e,n)=>{const r=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(P(n,t),["children"]);return e[n]=Object.assign({},r),e}),{});var W,C,j,k,B,Q,x,Y,K,U,q,$,z,J,X,Z,ee,te,ne,re,oe;class ie extends EventTarget{constructor(e={}){super(),W.add(this),C.set(this,void 0),j.set(this,void 0),k.set(this,void 0),B.set(this,void 0),Q.set(this,void 0),x.set(this,void 0),Y.set(this,void 0),K.set(this,void 0),U.set(this,void 0),q.set(this,void 0),$.set(this,void 0),z.set(this,void 0),J.set(this,void 0),r(this,C,Object.assign(Object.assign({},i),e),"f")}listen(){r(this,$,n(this,W,"m",ne).bind(this),"f"),r(this,z,n(this,W,"m",re).bind(this),"f"),r(this,J,n(this,W,"m",oe).bind(this),"f"),r(this,K,new MutationObserver(n(this,$,"f")),"f"),r(this,U,new MutationObserver(n(this,z,"f")),"f"),r(this,q,new MutationObserver(n(this,J,"f")),"f"),n(this,W,"m",ee).call(this),n(this,W,"m",te).call(this)}}return C=new WeakMap,j=new WeakMap,k=new WeakMap,B=new WeakMap,Q=new WeakMap,x=new WeakMap,Y=new WeakMap,K=new WeakMap,U=new WeakMap,q=new WeakMap,$=new WeakMap,z=new WeakMap,J=new WeakMap,W=new WeakSet,X=function(e,t){this.dispatchEvent(new CustomEvent(e,{detail:t}))},Z=function(t=a.HA_MORE_INFO_DIALOG_INFO){r(this,j,F(n(this,C,"f"),h,n(this,x,"f").HOME_ASSISTANT.element),"f");const o=V(a,n(this,j,"f"));o.HA_DIALOG_CONTENT.element.then((e=>{n(this,U,"f").disconnect(),n(this,U,"f").observe(e,{childList:!0})})),r(this,Q,((e,t)=>[a.HA_MORE_INFO_DIALOG,a.HA_DIALOG,a.HA_DIALOG_CONTENT,t].reduce(((t,n)=>(t[n]=e[n],t)),{}))(o,t),"f");const i={[a.HA_MORE_INFO_DIALOG_INFO]:e.HAQuerySelectorEvent.ON_LOVELACE_MORE_INFO_DIALOG_OPEN,[a.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:e.HAQuerySelectorEvent.ON_LOVELACE_HISTORY_AND_LOGBOOK_DIALOG_OPEN,[a.HA_DIALOG_MORE_INFO_SETTINGS]:e.HAQuerySelectorEvent.ON_LOVELACE_SETTINGS_DIALOG_OPEN};n(this,W,"m",X).call(this,i[t],n(this,Q,"f"))},ee=function(){r(this,k,F(n(this,C,"f"),O),"f"),r(this,x,V(s,n(this,k,"f")),"f"),n(this,x,"f")[s.HOME_ASSISTANT].shadowRootQuerySelector("$").then((e=>{n(this,K,"f").disconnect(),n(this,K,"f").observe(e,{childList:!0})}))},te=function(){r(this,B,F(n(this,C,"f"),_,n(this,x,"f")[s.HA_DRAWER].element),"f"),r(this,Y,V(c,n(this,B,"f")),"f"),n(this,Y,"f")[c.PARTIAL_PANEL_RESOLVER].element.then((e=>{n(this,q,"f").disconnect(),n(this,q,"f").observe(e,{childList:!0})})),n(this,W,"m",X).call(this,e.HAQuerySelectorEvent.ON_LOVELACE_PANEL_LOAD,Object.assign(Object.assign({},n(this,x,"f")),n(this,Y,"f")))},ne=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===u.HA_MORE_INFO_DIALOG&&n(this,W,"m",Z).call(this)}))}))},re=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{const t={[u.HA_MORE_INFO_DIALOG_INFO]:a.HA_MORE_INFO_DIALOG_INFO,[u.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK]:a.HA_DIALOG_MORE_INFO_HISTORY_AND_LOGBOOK,[u.HA_DIALOG_MORE_INFO_SETTINGS]:a.HA_DIALOG_MORE_INFO_SETTINGS};if(e.localName&&e.localName in t){const r=e.localName;n(this,W,"m",Z).call(this,t[r])}}))}))},oe=function(e){e.forEach((({addedNodes:e})=>{e.forEach((e=>{e.localName===u.HA_PANEL_LOVELACE&&n(this,W,"m",te).call(this)}))}))},e.HAQuerySelector=ie,e}({});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "home-assistant-query-selector",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Easily query home-assistant DOM elements in an async way",
5
5
  "keywords": [
6
6
  "query-selector",