@webqit/oohtml 3.1.2 → 3.1.4

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
@@ -7,13 +7,13 @@
7
7
 
8
8
  **[On the Agenda](#on-the-agenda) • [Modular HTML](#modular-html) • [HTML Imports](#html-imports) • [Data Binding](#data-binding) • [Data Plumbing](#data-plumbing) • [Polyfill](#polyfill) • [Examples](#examples) • [License](#license)**
9
9
 
10
- Object-Oriented HTML (OOHTML) is a set of features that extend standard HTML and the DOM to enable authoring modular, reusable and reactive markup - with a "buildless", web-native workflow as design goal! This project presents what "modern HTML" could look like at its best!
10
+ Object-Oriented HTML (OOHTML) is a set of features that extend standard HTML and the DOM to enable authoring modular, reusable and reactive markup - with a "buildless", web-native workflow as design goal! This project presents what "modern HTML" could mean today!
11
11
 
12
12
  Building Single Page Applications? OOHTML is a special love letter!
13
13
 
14
14
  <details><summary>Versions</summary>
15
15
 
16
- *This is documentation for `OOHTML@2.x`. (Looking for [`OOHTML@1.x`](https://github.com/webqit/oohtml/tree/v1.10.4)?)*
16
+ *This is documentation for `OOHTML@3`. (Looking for [`OOHTML@1`](https://github.com/webqit/oohtml/tree/v1.10.4)?)*
17
17
 
18
18
  </details>
19
19
 
@@ -21,7 +21,7 @@ Building Single Page Applications? OOHTML is a special love letter!
21
21
 
22
22
  <details><summary>Show</summary>
23
23
 
24
- Vanilla HTML is unsurprisingly becoming a compelling option for an increasing number of developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and other fundamental capabilities like data binding! Authors still have to rely on tools - or, to say the least, have to do half of the work in HTML and half in JS - to get even basic things working!
24
+ Vanilla HTML is unsurprisingly becoming the most compelling option for an increasing number of developers! But the current authoring experience still leaves much to be desired in how the language lacks modularity, reusability, and other fundamental capabilities like data binding! Authors still have to rely on tools - or, to say the least, have to do half of the work in HTML and half in JS - to get even basic things working!
25
25
 
26
26
  This project pursues an object-oriented approach to HTML and implicitly revisits much of what inhibits the idea of a *component* architecture for HTML!
27
27
 
@@ -42,13 +42,13 @@ This project pursues an object-oriented approach to HTML and implicitly revisits
42
42
 
43
43
  Modular HTML is a markup pattern that lets us write arbitrary markup as self-contained objects - with each *encapsulating* their own structure, styling and logic!
44
44
 
45
- OOHTML makes this possible in just simple conventions - via two new attributes: `namespace` and `scoped`!
45
+ OOHTML makes this possible by introducing "namespacing" and style and script scoping!
46
46
 
47
47
  ### Namespacing
48
48
 
49
49
  Naming things is hard! That's especially so where you have one global namespace and a miriad of potentially conflicting names to coordinate!
50
50
 
51
- Here, we get the `namespace` attribute for designating an element as own naming context for identifiers instead of the global namespace:
51
+ Here, we get the `namespace` attribute for designating an element as own naming context for identifiers instead of the global document namespace:
52
52
 
53
53
  ```html
54
54
  <div id="user" namespace>
@@ -124,11 +124,11 @@ console.log(window.foo); // div
124
124
 
125
125
  </details>
126
126
 
127
- ### Scoping
127
+ ### Style and Script Scoping
128
128
 
129
- We often need a way to keep things like styles and scripts [scoped to a component](https://vuejs.org/guide/scaling-up/sfc.html).
129
+ We often need a way to keep things like component-specific stylesheets and scripts [scoped to a component](https://vuejs.org/guide/scaling-up/sfc.html).
130
130
 
131
- Here, we get the `scoped` attribute for *scoping* said element-specific stylesheets and scripts:
131
+ Here, we get the `scoped` attribute for doing just that:
132
132
 
133
133
  ```html
134
134
  <div>
@@ -144,7 +144,7 @@ Here, we get the `scoped` attribute for *scoping* said element-specific styleshe
144
144
  </div>
145
145
  ```
146
146
 
147
- **-->** *with a complementary API that exposes said assets to JavaScript applications*:
147
+ **-->** *with a complementary API that exposes said assets for low-level access*:
148
148
 
149
149
  ```js
150
150
  let { styleSheets, scripts } = user; // APIs that are analogous to the document.styleSheets, document.scripts properties
@@ -152,9 +152,9 @@ let { styleSheets, scripts } = user; // APIs that are analogous to the document.
152
152
 
153
153
  <details><summary>Learn more</summary>
154
154
 
155
- The `scoped` has two effects on the `<script>` element:
155
+ Here, the `scoped` has two effects on the `<script>` element:
156
156
 
157
- + The `this` keyword is a reference to the script's host element
157
+ + The `this` keyword is implicitly bound to the script's host element
158
158
  + The `<script>` element is executed again on each re-insertion to the DOM
159
159
 
160
160
  </details>
@@ -169,7 +169,7 @@ OOHTML makes this possible in just simple conventions - via a new `def` attribut
169
169
 
170
170
  A module here is any piece of markup that can be reused.
171
171
 
172
- Here, we get the `def` attribute for defining those - either as whole *module* or as *fragment*:
172
+ Here, we get the `def` attribute for defining those - both at the `<template>` element level and at its contents (*fragment*) level:
173
173
 
174
174
  ```html
175
175
  <head>
@@ -203,7 +203,7 @@ Here, we get the `def` attribute for defining those - either as whole *module* o
203
203
 
204
204
  We shouldn't need a different mechanism to work with remote content.
205
205
 
206
- Here, we get remote-loading modules using the `src` attribute:
206
+ Here, we get remote-loading modules with same `<template>` element using the `src` attribute:
207
207
 
208
208
  ```html
209
209
  <template def="foo" src="/foo.html"></template>
@@ -231,7 +231,7 @@ foo.addEventListener('error', errorCallback);
231
231
 
232
232
  ### Declarative Module Imports
233
233
 
234
- HTML snippets should be reusable in "HTML"!
234
+ HTML snippets should be reusable in HTML itself!
235
235
 
236
236
  Here, we get an `<import>` element that lets us do just that:
237
237
 
@@ -251,10 +251,10 @@ Here, we get an `<import>` element that lets us do just that:
251
251
 
252
252
  <details><summary>All in realtime</summary>
253
253
 
254
- Import *refs* are live bindings that are highly sensitive to:
254
+ Here, import *refs* are live bindings that are highly sensitive to:
255
255
 
256
- + changes in the *ref* itself (in being defined/undefined/redefined)
257
- + changes in the referenced *defs* themselves (in being added/removed/loaded)
256
+ + changes in the *ref* itself (on being defined/undefined/redefined)
257
+ + changes in the referenced *defs* themselves (on being added/removed/loaded)
258
258
 
259
259
  And an `<import>` element that has been resolved will self-restore in the event that:
260
260
 
@@ -306,7 +306,7 @@ const moduleObject2 = document.import('/foo/nested#fragment2');
306
306
  console.log(moduleObject2.value); // divElement
307
307
  ```
308
308
 
309
- **-->** *with the `moduleObject.value` property being a live property for when results are delivered asynchronous; e.g. with an asynchronously loaded module*:
309
+ **-->** *with the `moduleObject.value` property being a live property for when results are delivered asynchronous; e.g. in the case of remote modules*:
310
310
 
311
311
  ```js
312
312
  Observer.observe(moduleObject2, 'value', e => {
@@ -314,7 +314,7 @@ Observer.observe(moduleObject2, 'value', e => {
314
314
  });
315
315
  ```
316
316
 
317
- **-->** *with an equivalent `callback` option on the `import()` method itself*:
317
+ **-->** *with an equivalent `callback` option on the `import()` API itself*:
318
318
 
319
319
  ```js
320
320
  document.import('/foo#fragment1', divElement => {
@@ -322,7 +322,7 @@ document.import('/foo#fragment1', divElement => {
322
322
  });
323
323
  ```
324
324
 
325
- **-->** *with an optional `live` parameter for staying subscribed to updated results*:
325
+ **-->** *with an optional `live` parameter for staying subscribed to live results*:
326
326
 
327
327
  ```js
328
328
  const moduleObject2 = document.import('/foo/nested#fragment2', true/*live*/);
@@ -338,7 +338,7 @@ document.import('/foo#fragment1', true/*live*/, divElement => {
338
338
  });
339
339
  ```
340
340
 
341
- *...both of which get notified on doing the below*:
341
+ *...both of which get notified on doing something like the below*:
342
342
 
343
343
  ```js
344
344
  document.querySelector('template[def="foo"]').content.firstElementChild.remove();
@@ -363,9 +363,9 @@ setTimeout(() => {
363
363
 
364
364
  ### Lazy-Loading Modules
365
365
 
366
- We can defer module loading until we really need them.
366
+ We should be able to defer module loading until we really need them.
367
367
 
368
- Here, we get the `loading="lazy"` directive for that; and loading is only then triggered on the first attempt to import them or their contents:
368
+ Here, we get the `loading="lazy"` directive for that; and loading is only then triggered on the first attempt to import those or their contents:
369
369
 
370
370
  ```html
371
371
  <!-- Loading doesn't happen until the first time this is being accessed -->
@@ -383,9 +383,9 @@ const moduleObject2 = document.import('/foo#fragment1'); // Triggers module load
383
383
 
384
384
  ### Module Inheritance
385
385
 
386
- We'll often have repeating markup structures.
386
+ We'll often have repeating markup structures across component layouts.
387
387
 
388
- Here, we get module nesting with inheritance to simplify that:
388
+ Here, we get module nesting with inheritance to facilitate more reusability:
389
389
 
390
390
  ```html
391
391
  <template def="foo">
@@ -433,14 +433,14 @@ Here, we get module nesting with inheritance to simplify that:
433
433
 
434
434
  We should be able to have *relative* import refs that resolve against local contexts in the document tree.
435
435
 
436
- Here, we call those arbitrary contexts "Imports Contexts", and these could be:
436
+ Here, we get just that - as "Imports Contexts", which could be:
437
437
 
438
438
  + Simple Base Path Contexts ([below](#base-path-contexts))
439
439
  + Scoped Module Contexts ([below](#scoped-module-contexts))
440
440
  + Named Contexts ([below](#named-contexts))
441
441
  + Extended Scoped Module Contexts ([below](#extended-scoped-module-contexts))
442
442
 
443
- Alongside which we have a complementary `Element.prototype.import()` API for thinking in contexts.
443
+ And to facilitate thinking in contexts, we also get an `Element.prototype.import()` API for context-based module imports.
444
444
 
445
445
  #### "Base Path" Contexts
446
446
 
@@ -533,7 +533,7 @@ const globalModule = contextElement.import('/foo#fragment1'); // Absolute path,
533
533
 
534
534
  #### Named Contexts
535
535
 
536
- Imports Contexts may be named:
536
+ Imports Contexts may be named for direct referencing:
537
537
 
538
538
  ```html
539
539
  <body contextname="context1" importscontext="/foo/nested">
@@ -599,7 +599,7 @@ Data binding is about declaratively binding the UI to application data, wherein
599
599
 
600
600
  OOHTML makes this possible in just simple conventions - via a new comment-based data-binding syntax `<?{ }?>` and a complementary new `expr` attribute!
601
601
 
602
- And there's one more: Quantum Scripts which brings the most advanced form of reactivity to HTML!
602
+ And there's one more: Quantum Scripts for when we need to write extended reactive logic on the UI!
603
603
 
604
604
  ### Discrete Data-Binding
605
605
 
@@ -762,7 +762,7 @@ Bindings are resolved in realtime! And in fact, for lists, in-place mutations -
762
762
 
763
763
  <details><summary>With SSR support</summary>
764
764
 
765
- For lists, generated item elements are automatically assigned a corresponding key with a `data-key` attribute! This helps in remapping generated item nodes to their respective entry in *iteratee* during a rerendering or during hydration.
765
+ For lists, generated item elements are automatically assigned a corresponding key with a `data-key` attribute! This helps in remapping generated item nodes to their corresponding entry in *iteratee* during a rerendering or during hydration.
766
766
 
767
767
  </details>
768
768
 
@@ -770,7 +770,7 @@ For lists, generated item elements are automatically assigned a corresponding ke
770
770
 
771
771
  We often still need to write more serious reactive logic on the UI than a declarative data-binding language can provide for. But we shouldn't need to reach for special tooling or some "serious" programming paradigm on top of JavaScript.
772
772
 
773
- Here, from the same `<script>` element we already write, we get a direct upgrade path to reactive programming in just the addition of an attribute: `quantum`:
773
+ Here, from the same `<script>` element we already write, we get a direct upgrade path to reactive programming in just the addition of an attribute: `quantum` - for [Quantum Scripts](https://github.com/webqit/quantum-js):
774
774
 
775
775
  ```html
776
776
  <script quantum>
@@ -786,7 +786,7 @@ Here, from the same `<script>` element we already write, we get a direct upgrade
786
786
  </script>
787
787
  ```
788
788
 
789
- **-->** *which gives us fine-grained reactivity on top of literal JavaScript syntax; and which adds up really well with the `scoped` attribute*:
789
+ **-->** *which gives us fine-grained reactivity on top of literal JavaScript syntax; and which adds up really well with the `scoped` attribute for Single Page Applications*:
790
790
 
791
791
  ```html
792
792
  <main>
@@ -881,7 +881,7 @@ But while that is automatic, DOM event handlers bound via `addEventListener()` w
881
881
 
882
882
  ## Data Plumbing
883
883
 
884
- Components often need to manage, or be managed by, dynamic data. That could get pretty problematic and messy if all of that should go on DOM nodes as direct properties:
884
+ Components often need to manage, and be managed by, dynamic data. That could get pretty problematic and messy if all of that should go on DOM nodes as direct properties:
885
885
 
886
886
  <details><summary>Example</summary>
887
887
 
@@ -951,7 +951,7 @@ document.bind({ name: 'James Boye', cool: '100%' }, { merge: true });
951
951
  console.log(document.bindings); // { signedIn: false, hot: '100%', name: 'James Boye', cool: '100%' }
952
952
  ```
953
953
 
954
- **-->** *which also provides an easy way to passing data down a component tree*:
954
+ **-->** *which also provides an easy way to pass data down a component tree*:
955
955
 
956
956
  ```js
957
957
  // Inside a custom element
@@ -961,7 +961,7 @@ connectedCallback() {
961
961
  }
962
962
  ```
963
963
 
964
- **-->** *and with the Observer API in the picture for reactivity*:
964
+ **-->** *and with the Observer API in the picture all the way for reactivity*:
965
965
 
966
966
  ```js
967
967
  Observer.observe(document.bindings, mutations => {
@@ -993,7 +993,7 @@ node.bindings.style = 'tall-dark'; // Reactive assignment
993
993
  delete node.bindings.style; // Reactive deletion
994
994
  ```
995
995
 
996
- For mutations at a deeper level to be reactive, the corresponding Observer API method must be used:
996
+ For mutations at a deeper level to be reactive, the corresponding Observer API method would need to be used:
997
997
 
998
998
  ```js
999
999
  Observer.set(document.bindings.app, 'title', 'Demo App!!!');
@@ -1006,7 +1006,7 @@ Observer.deleteProperty(document.bindings.app, 'title');
1006
1006
 
1007
1007
  Component trees on the typical UI often call for more than the normal top-down flow of data that the Bindings API facilitates. A child may require the ability to look up the component tree to directly access specific data, or in other words, get data from "context". This is where a Context API comes in.
1008
1008
 
1009
- Interestingly, the Context API is the underlying resolution mechanism for HTML Imports and Data Binding in OOHTML!
1009
+ Interestingly, the Context API is the underlying resolution mechanism behind HTML Imports and Data Binding in OOHTML!
1010
1010
 
1011
1011
  Here, we simply leverage the DOM's existing event system to fire a "request" event and let an arbitrary "provider" in context fulfill the request. This becomes very simple with the Context API which is exposed on the document object and on element instances as a readonly `contexts` property.
1012
1012
 
@@ -1055,7 +1055,7 @@ document.contexts.detach(fakeImportsContext);
1055
1055
  In the current OOHTML implementation, the Context API interfaces are exposed via the global `webqit` object:
1056
1056
 
1057
1057
  ```js
1058
- const { DOMContext, DOMContextRequestEvent, DOMContextResponse } = window.webqit;
1058
+ const { DOMContext, DOMContextRequestEvent, DOMContextResponse, DuplicateContextError } = window.webqit;
1059
1059
  ```
1060
1060
 
1061
1061
  Now, by design...
@@ -1097,7 +1097,7 @@ Now, by design...
1097
1097
  static kind = 'html-imports';
1098
1098
  matchEvent(event) {
1099
1099
  // The default request matching algorithm + "detail" matching
1100
- return super.matchEvent() && event.detail === this.detail;
1100
+ return super.matchEvent(event) && event.detail === this.detail;
1101
1101
  }
1102
1102
  handle(event) {
1103
1103
  console.log(event.detail);
@@ -1150,7 +1150,7 @@ Now, by design...
1150
1150
  }
1151
1151
  ```
1152
1152
 
1153
- ...and optionally implements a `subscribed` and `unsubscribed` lifecycle hook for when a "live" event enters and leaves the instance:
1153
+ ...or optionally implement a `subscribed` and `unsubscribed` lifecycle hook for when a "live" event enters and leaves the instance:
1154
1154
 
1155
1155
  ```js
1156
1156
  // Define a CustomContext class
@@ -1191,7 +1191,7 @@ Now, by design...
1191
1191
  abortController.abort(); // Which also calls response.abort();
1192
1192
  ```
1193
1193
 
1194
- + now, when a node in a provider's subtree is suddenly attached an identical provider, any live requests the super provider may be serving are automatically "claimed" by the sub provider:
1194
+ + now, where a node in a provider's subtree is suddenly attached an identical provider, any live requests the super provider may be serving are automatically "claimed" by the sub provider:
1195
1195
 
1196
1196
  ```js
1197
1197
  document: // 'fake-provider' here
@@ -1200,7 +1200,7 @@ Now, by design...
1200
1200
  └── body: // 'fake-provider' here. Our request above is now served from here.
1201
1201
  ```
1202
1202
 
1203
- And when the sub provider is suddenly detached from said node, any live requests it may have served are automatically hoisted back to super provider.
1203
+ And where the sub provider is suddenly detached from said node, any live requests it may have served are automatically hoisted back to super provider.
1204
1204
 
1205
1205
  ```js
1206
1206
  document: // 'fake-provider' here. Our request above is now served from here.
@@ -1209,11 +1209,11 @@ Now, by design...
1209
1209
  └── body:
1210
1210
  ```
1211
1211
 
1212
- While, in all, saving the requesting code that "admin" work!
1212
+ While, in all, the requesting code is saved that "admin" work!
1213
1213
 
1214
1214
  </details>
1215
1215
 
1216
- **-->** *all of which gives us the imperative equivalent of declarative context-based features like HTMLImports and Data Binding*:
1216
+ **-->** *all of which gives us a standardized API underneath context-based features in HTML - like HTMLImports and Data Binding*:
1217
1217
 
1218
1218
  ```html
1219
1219
  <div contextname="vendor1">
@@ -1260,10 +1260,10 @@ console.log(response.value.title);
1260
1260
 
1261
1261
  ## Polyfill
1262
1262
 
1263
- OOHTML is being developed as something to be used today—via a polyfill. This is an intentional effort that's helping to ensure that the project evolves through a practice-driven process.
1263
+ OOHTML is being developed as something to be used today—via a polyfill. This is an intentional effort that has continued to ensure that the proposal evolves through a practice-driven process.
1264
1264
 
1265
1265
  <details><summary>Load from a CDN<br>
1266
- └───────── <a href="https://bundlephobia.com/result?p=@webqit/oohtml"><img align="right" src="https://img.shields.io/badge/21.7%20kB-black"></a></summary>
1266
+ └───────── <a href="https://bundlephobia.com/result?p=@webqit/oohtml"><img align="right" src="https://img.shields.io/badge/21.8%20kB-black"></a></summary>
1267
1267
 
1268
1268
  ```html
1269
1269
  <script src="https://unpkg.com/@webqit/oohtml/dist/main.lite.js"></script>
@@ -1355,7 +1355,7 @@ If you'll be going ahead to build a real app with OOHTML, you may want to consid
1355
1355
 
1356
1356
  ...still gives the `window` object in the console.
1357
1357
 
1358
- + **Scoped CSS**. This feature is only in "concept" implementation and doesn't work right now as is. The current implementation simply wraps `<style scoped>` blocks in an `@scope {}` block - which itself isn't supported in any browser. To try this "concept" implementation, set the `style.strategy` config to `@scope`:
1358
+ + **Scoped CSS**. This feature is only in "concept" implementation and doesn't work right now as is. The current implementation simply wraps `<style scoped>` blocks in an `@scope {}` block - which itself isn't supported in any browser *yet*. To try this "concept" implementation, set the `style.strategy` config to `@scope`:
1359
1359
 
1360
1360
  ```html
1361
1361
  <head>
@@ -1382,7 +1382,7 @@ If you'll be going ahead to build a real app with OOHTML, you may want to consid
1382
1382
  </style>
1383
1383
  ```
1384
1384
 
1385
- A working implementation may be coming soon, but in the meantime, you could try one of the polyfills for `<style scoped>` out there; e.g. [samthor/scoped](https://github.com/samthor/scoped):
1385
+ Browser support for `@scope {}` style blocks may be coming soon, but in the meantime, you could try one of the polyfills for `<style scoped>` out there; e.g. [samthor/scoped](https://github.com/samthor/scoped):
1386
1386
 
1387
1387
  ```html
1388
1388
  <script src="https://unpkg.com/style-scoped/scoped.min.js"></script>
@@ -1,2 +1,2 @@
1
- (()=>{var $t=Object.defineProperty;var Nt=(n,t,r)=>t in n?$t(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r;var yt=(n,t,r)=>(Nt(n,typeof t!="symbol"?t+"":t,r),r);function x(n){return!Array.isArray(n)&&typeof n=="object"&&n}function y(n){return Array.isArray(n)}function it(n,t,r=null){return y(t)?n.filter(e=>r?t.filter(i=>r(e,i)).length:t.indexOf(e)!==-1):[]}function N(n,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new G}),!arguments.length)return globalThis.webqit.refs;let r=globalThis.webqit.refs.get(n);r||(r=new G,globalThis.webqit.refs.set(n,r));let e,i;for(;e=t.shift();)(i=r)&&!(r=r.get(e))&&(r=new G,i.set(e,r));return r}var G=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,r){let e=super.set(t,r);return this.fire("set",t,r,t),e}delete(t){let r=super.delete(t);return this.fire("delete",t),r}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,r,e){let i={type:t,key:r,callback:e};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(t,r,e){if(Array.isArray(t)||Array.isArray(r))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(Z([t,"*"],i.type)&&Z([r,"*"],i.key)&&i.callback===e)||this.observers.delete(i)}fire(t,r,...e){for(let i of this.observers)!(Z([t,"*"],i.type)&&Z([r,"*"],i.key))||i.callback(...e)}},Z=(n,t)=>Array.isArray(t)?it(n,t).length:n.includes(t);function R(n){return typeof n=="function"}function B(n){return n===null||n===""}function P(n){return arguments.length&&(n===void 0||typeof n>"u")}function O(n){return Array.isArray(n)||typeof n=="object"&&n||R(n)}function ot(n){return B(n)||P(n)||n===!1||n===0||O(n)&&!Object.keys(n).length}function w(n){return R(n)||n&&{}.toString.call(n)==="[object function]"}function X(n){return n instanceof Number||typeof n=="number"}function C(n){return X(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function W(n){return n instanceof String||typeof n=="string"&&n!==null}function st(n){return!W(n)&&!P(n.length)}function K(n,...t){return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function ft(e,t){t=t||Object.prototype,t=t&&!y(t)?[t]:t;for(var r=[],e=e;e&&(!t||t.indexOf(e)<0)&&e.name!=="default";)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}function lt(n,t){var r=[];return ft(n,t).forEach(e=>{K(r,...Object.getOwnPropertyNames(e))}),r}function T(n,t,r=!1,e=!1,i=!1){var o=0,s=n.shift();if((C(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((f,d)=>{!O(f)&&!w(f)||(r?lt(f):Object.keys(f)).forEach(u=>{if(!!t(u,s,f,d)){var c=s[u],m=f[u];if((y(c)&&y(m)||x(c)&&x(m))&&(o===!0||o>0))s[u]=y(c)&&y(m)?[]:{},T([C(o)?o-1:o,s[u],c,m],t,r,e,i);else if(y(s)&&y(f))e?s[u]=m:s.push(m);else try{i?Object.defineProperty(s,u,Object.getOwnPropertyDescriptor(f,u)):s[u]=f[u]}catch{}}})}),s}function U(...n){return T(n,(t,r,e)=>!0,!1,!1,!1)}function A(n,t=!0){return y(n)?n:!t&&x(n)?[n]:n!==!1&&n!==0&&ot(n)?[]:st(n)?Array.prototype.slice.call(n):x(n)?Object.values(n):[n]}function z(n,t,r={},e={}){t=A(t).slice();for(var i=n;!P(i)&&!B(i)&&t.length;){var o=t.shift();if(!(r.get?r.get(i,o):O(i)?o in i:i[o])){e.exists=!1;return}i=r.get?r.get(i,o):i[o]}return e.exists=!0,i}function ut(n,t,r,e={},i={}){let o=(c,m,l)=>i.set?i.set(c,m,l):(C(t[f])&&y(c)?c.push(l):c[m]=l,!0);t=A(t);for(var s=n,f=0;f<t.length;f++)if(f<t.length-1){if(!s||!O(s)&&!w(s))return!1;var d=z(s,t[f],i);if(!O(d)){if(i.buildTree===!1)return!1;d=w(i.buildTree)?i.buildTree(f):C(t[f+1])?[]:{};var u=o(s,t[f],d);if(!u)return!1}s=d}else return o(s,t[f],r)}var J=class{constructor(t,r=!0){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=r,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t);this._run()})}onread(t,r=!1){if(r)return new Promise(e=>{this.async===!1?e(t()):this.readCallbacks.add(()=>{e(t())})});this.async===!1?t():this.readCallbacks.add(t)}onwrite(t,r=!1){if(r)return new Promise(e=>{this.async===!1?e(t()):this.writeCallbacks.add(()=>{e(t())})});this.async===!1?t():this.writeCallbacks.add(t)}cycle(t,r,e){this.onread(()=>{let i=t(e),o=s=>{s!==void 0&&this.onwrite(()=>{let f=r(s,e),d=u=>{u!==void 0&&this.cycle(t,r,u)};f instanceof Promise?f.then(d):d(f)})};i instanceof Promise?i.then(o):o(i)})}};function At(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function et(n,t,r,e=!0){r=(Array.isArray(r)?r:[r]).map(f=>(f+"").replace("(",e?"(.//":"(./")).join("|");let i=n.document.evaluate(r,t,null,XPathResult.ANY_TYPE),o=[],s;for(;s=i.iterateNext();)o.push(s);return o}function Et(n,t,r){return r=(Array.isArray(r)?r:[r]).map(e=>(e+"").replace("(","(self::")).join("|"),n.document.evaluate(`${r}`,t,null,XPathResult.BOOLEAN_TYPE).booleanValue}function Ct(n,t="|"){return[...n].reduce(([r,e,i,o],s)=>!r&&e===0&&(Array.isArray(t)?t:[t]).includes(s)?[r,e,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&e++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&e--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,e,i]),[null,0,[""]])[2].reverse()}var S=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:At(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ct(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var L=class{constructor(t,r,e){this.context=t,this.namespace=r,this.window=t.defaultView||t.ownerDocument?.defaultView||e,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(w(t[0])?t=[[],...t]:x(t[0])&&!(t[0]instanceof S)&&t.length===1?t=[[],void 0,t[0]]:x(t[1])&&t.length===2?t=[A(t[0],!1),void 0,t[1]]:t[0]=A(t[0],!1),t[0].filter(r=>typeof r!="string"&&!(r instanceof S)&&!(r instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(r=>r instanceof S?r:new S(r)),t}registry(...t){return N("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,r,e){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,d]of this.registry(t))for(let[u,c]of d){let m=o.filter(l=>u.contains(l.target)?f==="subtree"||l.target===u:!1);if(!!m.length){Array.isArray(r)||(m=m[0]);for(let l of c)s.add([l,m,u])}}for(let[f,d,u]of s)e.call(i,f,d,u)}disconnectables(t,...r){let e={disconnect(){r.forEach(i=>i&&w(i.disconnect)&&i.disconnect()||w(i)&&i()||x(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>e.disconnect()),e}};var I=class extends L{constructor(t,...r){super(t,"attr",...r)}get(t,r=void 0,e={}){let i=typeof t=="string"||t instanceof S;[t=[],r=void 0,e={}]=this.resolveArgs(arguments);let{context:o}=this,s=Mt(o,t);if(!r)return s;let f=e.lifecycleSignals&&this.createSignalGenerator();if(i)for(let d of s){let u=f?.generate()||{};r(d,u,o)}else{let d=f?.generate()||{};r(s,d,o)}if(e.live){f&&(e={...e,signalGenerator:f});let d=this.observe(i?t[0]:t,r,{newValue:!0,...e});return this.disconnectables(e.signal,d)}}observe(t,r,e={}){let i=typeof t=="string"||t instanceof S;if([t=[],r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(i?t[0]:t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:o,window:s,webqit:f}=this;e.eventDetails&&!f.realdom.attrInterceptionHooks?.intercepting&&qt.call(s,"intercept",()=>{});let d=new s.MutationObserver(l=>{l=Pt(l).map(p=>It.call(s,p)),Tt.call(s,m,l,o)}),u={attributes:!0,attributeOldValue:e.oldValue,subtree:e.subtree};t.length&&(u.attributeFilter=t.map(l=>l+"")),d.observe(o,u);let c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:d};return this.disconnectables(e.signal,d,c)}observeSync(t,r,e={}){let i=typeof t=="string"||t instanceof S;[t,r,e={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let f=e.timing==="intercept"?"intercept":"sync",d=e.subtree?"subtree":"children";this.registry(f).size||qt.call(s,f,_=>{this.forEachMatchingContext(f,_,Tt)});let u={disconnect(){p.delete(m),p.size||l.delete(o)}},c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:u},l=this.registry(f,d);l.has(o)||l.set(o,new Set);let p=l.get(o);return p.add(m),this.disconnectables(e.signal,u,c)}};function Pt(n){return n.reduce((t,r,e)=>t[e-1]?.attributeName===r.attributeName?t:t.concat(r),[])}function Tt(n,t){let{context:r,spec:e,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:d}=n,u=e.map(l=>l+"");if(o.atomic&&!s.size?t=Mt(r,e,t):o.timing!=="async"&&e.length&&(t=t.filter(l=>u.includes(l.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(l=>{let p;return o.eventDetails||({event:p,...l}=l),!o.oldValue&&"oldValue"in l&&({oldValue:p,...l}=l),!o.newValue&&"value"in l?{value:p,...l}=l:o.newValue&&typeof l.value>"u"&&(l={...l,value:l.target.getAttribute(l.name)}),l})),o.atomic&&(t.forEach(l=>s.set(l.name,l)),t=Array.from(s.entries()).map(([,l])=>l));let c=f?t[0]:t,m=d?.generate()||{};i(c,m,r)}function Mt(n,t,r=[]){let e={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...e})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...e})}function It({target:n,attributeName:t,value:r,oldValue:e}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[t]?.[0]||"mutation";return{target:n,name:t,value:r,oldValue:e,type:"observation",event:s}}function qt(n,t){let r=this,{webqit:e,document:i,Element:o}=r;e.realdom.attrInterceptionHooks||Object.defineProperty(e.realdom,"attrInterceptionHooks",{value:new Map}),e.realdom.attrInterceptionHooks.has(n)||e.realdom.attrInterceptionHooks.set(n,new Set),e.realdom.attrInterceptionHooks.get(n).add(t);let s=()=>e.realdom.attrInterceptionHooks.get(n).delete(t);if(e.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),e.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"attrInterceptionRecords",{value:new Map});let f=(c,m)=>{e.realdom.attrInterceptionRecords.has(c.target)||e.realdom.attrInterceptionRecords.set(c.target,{});let l=e.realdom.attrInterceptionRecords.get(c.target);l[c.name]=l[c.name]||[],l[c.name].unshift(c.event),e.realdom.attrInterceptionHooks.get("intercept")?.forEach(_=>_([c]));let p=m();return e.realdom.attrInterceptionHooks.get("sync")?.forEach(_=>_([c])),p};new r.MutationObserver(c=>{c=c.filter(m=>!(r.webqit.realdom.attrInterceptionRecords?.get(m.target)||{})[m.attributeName]?.shift()),c=Pt(c).map(m=>It.call(r,m)),c.length&&(e.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m(c)),e.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m(c)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let u=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(c=>{u[c]=o.prototype[c],o.prototype[c]=function(...m){let l,p=this.getAttribute(m[0]);["setAttribute","toggleAttribute"].includes(c)&&(l=m[1]),c==="toggleAttribute"&&l===void 0&&(l=p===null);let _={target:this,name:m[0],value:l,oldValue:p,type:"interception",event:[this,c]};return f(_,()=>u[c].call(this,...m))}}),s}var Y=class extends L{constructor(t,...r){super(t,"tree",...r)}attr(t,r=void 0,e={}){let{context:i,window:o}=this;return new I(i,o).get(...arguments)}query(t,r=void 0,e={}){[t,r=void 0,e={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=u=>(o.has(u)||o.set(u,{target:u,entrants:[],exits:[],type:"query",event:null}),o.get(u));if(!e.generation||e.generation==="entrants"){if(!t.length)[...i.children].forEach(u=>s(i).entrants.push(u));else if(t.every(u=>u.type==="selector")){let[u,c]=t.reduce(([l,p],_)=>_.kind==="xpath"?[l,p.concat(_)]:[l.concat(_),p],[[],[]]),m=[];e.subtree?(u.length&&m.push(...i.querySelectorAll(u.join(","))),c.length&&m.push(...et(this.window,i,c))):(u.length&&m.push(...[...i.children].filter(l=>l.matches(u))),c.length&&m.push(...et(this.window,i,c,!1))),m.forEach(l=>s(l.parentNode||i).entrants.push(l))}}if(!r)return o;let f={disconnected:!1},d=r&&e.lifecycleSignals&&this.createSignalGenerator();for(let[,u]of o){if(f.disconnected)break;let c=d?.generate()||{};r(u,c,i)}if(e.live){d&&(e={...e,signalGenerator:d});let u=this.observe(t,r,e);return this.disconnectables(e.signal,f,u)}return this.disconnectables(e.signal,f,d)}children(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!1})}subtree(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!0})}observe(t,r,e={}){if([t,r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:i,window:o,webqit:s,document:f}=this;e.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Dt.call(o,"sync",()=>{});let d=new o.MutationObserver(m=>m.forEach(l=>{mt.call(o,c,Ht.call(o,l),i)}));d.observe(i,{childList:!0,subtree:e.subtree});let u=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),c={context:i,spec:t,callback:r,params:e,signalGenerator:u,disconnectable:d};if(e.staticSensitivity){let m=kt.call(o,c);return this.disconnectables(e.signal,d,u,m)}return this.disconnectables(e.signal,d,u)}observeSync(t,r,e={}){[t,r,e={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let s=e.timing==="intercept"?"intercept":"sync",f=e.subtree?"subtree":"children";this.registry(s).size||Dt.call(o,s,_=>{this.forEachMatchingContext(s,_,mt)});let d=new o.MutationObserver(_=>_.forEach(a=>{Array.isArray((a=Ht.call(o,a)).event)||mt.call(o,m,a,i)}));d.observe(i,{childList:!0,subtree:e.subtree});let u={disconnect(){d.disconnect(),p.delete(m),p.size||l.delete(i)}},c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),m={context:i,spec:t,callback:r,params:e,signalGenerator:c,disconnectable:u},l=this.registry(s,f);l.has(i)||l.set(i,new Set);let p=l.get(i);if(p.add(m),e.staticSensitivity){let _=kt.call(o,m);return this.disconnectables(e.signal,u,c,_)}return this.disconnectables(e.signal,u,c)}};function kt(n){let t=this,{context:r,spec:e,callback:i,params:o,signalGenerator:s}=n,f=e.filter(p=>p.kind==="css"),d=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],u=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],c=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(_=>_[1]).concat(d(p)).concat(u(p));if(!(n.$attrs=Array.from(new Set(f.filter(p=>(p+"").includes("[")).reduce((p,_)=>p.concat(c(_+"")),[])))).length)return;let m=new Set,l=new Set;return m.push=p=>(l.delete(p),m.add(p)),l.push=p=>(m.delete(p),l.add(p)),n.$deliveryCache={entrants:m,exits:l},new I(r,t).observe(n.$attrs,p=>{let _=new Map,a=h=>(_.has(h)||_.set(h,{target:h,entrants:[],exits:[],type:"static",event:null}),_.get(h)),v=new WeakMap,g=h=>(v.has(h)||v.set(h,f.some(b=>h.matches(b+""))),v.get(h));for(let h of p)["entrants","exits"].forEach(b=>{o.generation&&b!==o.generation||n.$deliveryCache[b].has(h.target)||(b==="entrants"?!g(h.target):g(h.target))||(n.$deliveryCache[b].push(h.target),a(h.target)[b].push(h.target),a(h.target).event=h.event)});for(let[,h]of _){let b=s?.generate()||{};i(h,b,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function mt(n,t){let{context:r,spec:e,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,d={...t,entrants:[],exits:[]};if(o.eventDetails||delete d.event,["entrants","exits"].forEach(c=>{if(!(o.generation&&c!==o.generation)&&(e.length?d[c]=ee.call(this,e,t[c],t.event!=="parse"):d[c]=[...t[c]],!!f))for(let m of d[c])f[c].push(m)}),!d.entrants.length&&!d.exits.length)return;let u=s?.generate()||{};i(d,u,r)}function ee(n,t,r){t=Array.isArray(t)?t:[...t];let e=(i,o)=>{if(o.type==="selector"){let s=o.isXpathAttr?[]:i.filter(f=>o.kind==="xpath"?Et(this,f,o+""):f.matches&&f.matches(o+""));if((r||o.isXpathAttr)&&(s=i.reduce((f,d)=>o.kind==="xpath"?[...f,...et(this,d,o,r)]:d.querySelectorAll?[...f,...d.querySelectorAll(o+"")]:f,s)),s.length)return s}else if(i.includes(o.content)||r&&i.some(s=>s.contains(o.content)))return[o.content]};return t.$$searchCache||(t.$$searchCache=new Map),n.reduce((i,o)=>{let s;return t.$$searchCache.has(o.content)?s=t.$$searchCache.get(o.content):(s=e(t,o)||[],o.type==="instance"&&t.$$searchCache.set(o.content,s)),i.concat(s)},[])}function Ht({target:n,addedNodes:t,removedNodes:r}){let e=this,i;return i=A(t).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||e.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:r,type:"observation",event:i}}function Dt(n,t){let r=this,{webqit:e,document:i,Node:o,CharacterData:s,Element:f,HTMLElement:d,HTMLTemplateElement:u,DocumentFragment:c}=r;e.realdom.domInterceptionHooks||Object.defineProperty(e.realdom,"domInterceptionHooks",{value:new Map}),e.realdom.domInterceptionHooks.has(n)||e.realdom.domInterceptionHooks.set(n,new Set),e.realdom.domInterceptionHooks.get(n).add(t);let m=()=>e.realdom.domInterceptionHooks.get(n).delete(t);if(e.realdom.domInterceptionHooks?.intercepting)return m;console.warn("DOM mutation APIs are now being intercepted."),e.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"domInterceptionRecords",{value:new Map});let l=(a,v)=>{a.entrants.concat(a.exits).forEach(h=>{clearTimeout(e.realdom.domInterceptionRecords.get(h)?.timeout),e.realdom.domInterceptionRecords.set(h,a.event);let b=setTimeout(()=>{e.realdom.domInterceptionRecords.delete(h)},0);Object.defineProperty(a.event,"timeout",{value:b,configurable:!0})}),e.realdom.domInterceptionHooks.get("intercept")?.forEach(h=>h(a));let g=v();return e.realdom.domInterceptionHooks.get("sync")?.forEach(h=>h(a)),g},p={characterData:Object.create(null),other:Object.create(null)};["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(a=>{function v(...g){let h=this instanceof s?p.characterData:p.other,b=()=>h[a].call(this,...g);if(!(this instanceof s||this instanceof f||this instanceof c))return b();let q=[],E=[],V=this;["insertBefore"].includes(a)?E=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(a)?(E=[g[1]],["beforebegin","afterend"].includes(g[0])&&(V=this.parentNode)):["setHTML","replaceChildren"].includes(a)?(q=[...this.childNodes],E=a==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(a)?(q=[this],E=a==="replaceWith"?[...g]:[],V=this.parentNode):["replaceChild"].includes(a)?(q=[g[1]],E=[g[0]]):["removeChild"].includes(a)?q=[...g]:(E=[...g],["before","after"].includes(a)&&(V=this.parentNode));let D=a;if(["insertAdjacentHTML","setHTML"].includes(a)){let gt=this.nodeName;if(a==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return h[a].call(this,...g);gt=this.parentNode.nodeName}let Q=i.createElement(gt);h.setHTML.call(Q,E[0],a==="setHTML"?g[1]:{}),E=[...Q.childNodes],a==="insertAdjacentHTML"?(D="insertAdjacentElement",g[1]=new c,g[1].______isTemp=!0,g[1].append(...Q.childNodes)):(D="replaceChildren",g=[...Q.childNodes])}return l({target:V,entrants:E,exits:q,type:"interception",event:[this,a]},()=>h[D].call(this,...g))}["insertBefore","replaceChild","removeChild","appendChild"].includes(a)?(p.other[a]=o.prototype[a],o.prototype[a]=v):(["after","before","remove","replaceWith"].includes(a)&&(p.characterData[a]=s.prototype[a],s.prototype[a]=v),f.prototype[a]&&(p.other[a]=f.prototype[a],f.prototype[a]=v))});let _=Object.create(null);return["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(a=>{let v=["textContent","nodeValue"].includes(a)?o:["outerText","innerText"].includes(a)?d:f;_[a]=Object.getOwnPropertyDescriptor(v.prototype,a),Object.defineProperty(v.prototype,a,{..._[a],set:function(g){let h=()=>_[a].set.call(this,g);if(!(this instanceof f))return h();let b=[],q=[],E=this;if(["outerHTML","outerText"].includes(a)?(b=[this],E=this.parentNode):b=[...this.childNodes],["outerHTML","innerHTML"].includes(a)){let D=this.nodeName;if(a==="outerHTML"){if(!this.parentNode)return h();D=this.parentNode.nodeName}let $=i.createElement(D==="TEMPLATE"?"div":D);_[a].set.call($,g),q=this instanceof u?[]:[...$.childNodes],a==="outerHTML"?(g=new c,g.______isTemp=!0,g.append(...$.childNodes),h=()=>f.prototype.replaceWith.call(this,g)):this instanceof u?h=()=>this.content.replaceChildren(...$.childNodes):h=()=>f.prototype.replaceChildren.call(this,...$.childNodes)}return l({target:E,entrants:q,exits:b,type:"interception",event:[this,a]},h)}})}),["append","prepend","replaceChildren"].forEach(a=>{[i,c.prototype].forEach(v=>{let g=v[a];v[a]=function(...h){if(this.______isTemp)return g.call(this,...h);let b=a==="replaceChildren"?[...this.childNodes]:[];return l({target:this,entrants:h,exits:b,type:"interception",event:[this,a]},()=>g.call(this,...h))}})}),m}function Lt(){re.call(this),ne.call(this),ie.call(this)}function re(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ne(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function ie(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(t){for(var r=(this.document||this.ownerDocument).querySelectorAll(t),e=r.length;--e>=0&&r.item(e)!==this;);return e>-1})}function jt(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Lt.call(n),n.webqit.realdom.meta=(...r)=>oe.call(n,...r),n.webqit.realdom.ready=(...r)=>dt.call(n,...r),n.webqit.realdom.realtime=(r,e="dom")=>{if(e==="dom")return new Y(r,n);if(e==="attr")return new I(r,n)};let t=new J(n);return n.webqit.realdom.schedule=(r,...e)=>t[`on${r}`](...e),n.webqit.realdom}function dt(...n){let t="interactive",r;W(n[0])?(t=n[0],w(n[1])&&(r=n[1])):w(n[0])&&(r=n[0]);let e={interactive:["interactive","complete"],complete:["complete"]};if(!e[t])throw new Error(`Invalid ready-state timing: ${t}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>dt.call(this,"interactive",o)),complete:new Promise(o=>dt.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[t];if(e[t].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[t].push(r)}function oe(n){let t=this,r={},e;return(e=t.document.querySelector(`meta[name="${n}"]`))&&(r=(e.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return ut(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:C(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return e.content},json(){return JSON.parse(JSON.stringify(r))}}}var rt=(...n)=>N("oohtml",...n),k={};function Ft(n,t,r){let e=this,i=jt.call(e);e.webqit||(e.webqit={}),e.webqit.oohtml||(e.webqit.oohtml={}),e.webqit.oohtml.configs||(e.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");return e.webqit.oohtml.configs[o]||(e.webqit.oohtml.configs[o]={}),k.window=e,U(2,e.webqit.oohtml.configs[o],r,t,i.meta(n).json()),{config:e.webqit.oohtml.configs[o],realdom:i,window:e}}function nt(){let{window:n}=k,{webqit:t}=n;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class r extends n.Event{constructor(...i){let o=i.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=i.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let f=["contextrequest","contextclaim"],d=i.pop()||f[0];if(!f.includes(d))throw new Error(`Invalid event type. Must be one of: ${f.join(",")}`);let{kind:u,detail:c,targetContext:m,live:l,signal:p,diff:_,...a}=s;super(d,{...a,bubbles:a.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>u}),Object.defineProperty(this,"targetContext",{get:()=>m}),Object.defineProperty(this,"detail",{get:()=>c}),Object.defineProperty(this,"live",{get:()=>l}),Object.defineProperty(this,"signal",{get:()=>p}),Object.defineProperty(this,"diff",{get:()=>_}),Object.defineProperty(this,"options",{get:()=>a})}respondWith(i){if(this.diff){if("_prevValue"in this&&this._prevValue===i)return;Object.defineProperty(this,"_prevValue",{value:i,configurable:!0})}return this.callback(i)}}return t.DOMContextRequestEvent=r,r}var j=class extends AbortController{constructor(t){super(),t(r=>{let{window:{webqit:{Observer:e}}}=k;e.defineProperty(this,"value",{value:r,configurable:!0,enumerable:!0})},this)}};var pt=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=k;return t}get name(){return this.host===k.window.document?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(t.target===this.host||!(t.detail instanceof pt))return;let r=new Set;return this.subscriptions.forEach(e=>{!t.target.contains(e.target)||!t.detail.matchEvent(e)||(t.stopPropagation(),this.subscriptions.delete(e),r.add(e))}),t.respondWith(r)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:r}=M.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return r.forEach(e=>{this.subscriptions.add(e),this.subscribed(e),this.handle(e)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(r=>{this.subscriptions.delete(r),this.unsubscribed(r);let{target:e}=r;e.dispatchEvent(r)}),this}},H=pt;yt(H,"kind");var F=class extends Error{};var M=class{static instance(t){return rt(t).get("contexts::instance")||new this(t)}constructor(t){rt(t).get("contexts::instance")?.dispose(),rt(t).set("contexts::instance",this);let r={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>r})}get[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(r=>typeof t[0]=="function"?t[0](r):r.constructor.kind===t[0]&&(t.length===1||r.detail===t[1]))}attach(t){if(!(t instanceof H))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new F(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new j((r,e)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(r):t[t.length-1]=r);let i;(i=t.find(s=>typeof s=="object"&&s))&&i.live&&(i.signal&&i.signal.addEventListener("abort",()=>e.abort()),t[t.indexOf(i)]={...i,signal:e.signal});let o=new(nt())(...t);this["#"].host.dispatchEvent(o)})}};function ht(n={}){let{config:t,window:r}=Ft.call(this,"context-api",n,{attr:{contextname:"contextname"},api:{contexts:"contexts"}});r.webqit.DOMContexts=M,r.webqit.DOMContext=H,r.webqit.DOMContextRequestEvent=nt(),r.webqit.DOMContextResponse=j,r.webqit.DuplicateContextError=F,se.call(r,t)}function se(n){let t=this;if(n.api.contexts in t.document)throw new Error(`document already has a "${n.api.contexts}" property!`);if(n.api.contexts in t.HTMLElement.prototype)throw new Error(`The "HTMLElement" class already has a "${n.api.contexts}" property!`);Object.defineProperty(t.document,n.api.contexts,{get:function(){return M.instance(t.document)}}),Object.defineProperty(t.HTMLElement.prototype,n.api.contexts,{get:function(){return M.instance(this)}});let r=new Set;t.addEventListener("contextrequest",e=>{typeof e.respondWith=="function"&&(r.add(e),e.respondWith())}),t.addEventListener("contextclaim",e=>{if(typeof e.detail!="object"||typeof e.detail.matchEvent!="function"||typeof e.respondWith!="function")return;let i=new Set;r.forEach(o=>{!e.detail.matchEvent(o)||(r.delete(o),i.add(o))}),e.respondWith(i)})}ht.call(window);})();
1
+ (()=>{var $t=Object.defineProperty;var Nt=(n,t,r)=>t in n?$t(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r;var yt=(n,t,r)=>(Nt(n,typeof t!="symbol"?t+"":t,r),r);function x(n){return!Array.isArray(n)&&typeof n=="object"&&n}function y(n){return Array.isArray(n)}function it(n,t,r=null){return y(t)?n.filter(e=>r?t.filter(i=>r(e,i)).length:t.indexOf(e)!==-1):[]}function N(n,...t){if(globalThis.webqit||(globalThis.webqit={}),globalThis.webqit.refs||Object.defineProperty(globalThis.webqit,"refs",{value:new G}),!arguments.length)return globalThis.webqit.refs;let r=globalThis.webqit.refs.get(n);r||(r=new G,globalThis.webqit.refs.set(n,r));let e,i;for(;e=t.shift();)(i=r)&&!(r=r.get(e))&&(r=new G,i.set(e,r));return r}var G=class extends Map{constructor(...t){super(...t),this.observers=new Set}set(t,r){let e=super.set(t,r);return this.fire("set",t,r,t),e}delete(t){let r=super.delete(t);return this.fire("delete",t),r}has(t){return this.fire("has",t),super.has(t)}get(t){return this.fire("get",t),super.get(t)}keyNames(){return Array.from(super.keys())}observe(t,r,e){let i={type:t,key:r,callback:e};return this.observers.add(i),()=>this.observers.delete(i)}unobserve(t,r,e){if(Array.isArray(t)||Array.isArray(r))throw new Error('The "type" and "key" arguments can only be strings.');for(let i of this.observers)!(Z([t,"*"],i.type)&&Z([r,"*"],i.key)&&i.callback===e)||this.observers.delete(i)}fire(t,r,...e){for(let i of this.observers)!(Z([t,"*"],i.type)&&Z([r,"*"],i.key))||i.callback(...e)}},Z=(n,t)=>Array.isArray(t)?it(n,t).length:n.includes(t);function R(n){return typeof n=="function"}function B(n){return n===null||n===""}function P(n){return arguments.length&&(n===void 0||typeof n>"u")}function O(n){return Array.isArray(n)||typeof n=="object"&&n||R(n)}function ot(n){return B(n)||P(n)||n===!1||n===0||O(n)&&!Object.keys(n).length}function w(n){return R(n)||n&&{}.toString.call(n)==="[object function]"}function X(n){return n instanceof Number||typeof n=="number"}function C(n){return X(n)||n!==!0&&n!==!1&&n!==null&&n!==""&&!isNaN(n*1)}function W(n){return n instanceof String||typeof n=="string"&&n!==null}function st(n){return!W(n)&&!P(n.length)}function K(n,...t){return t.forEach(r=>{n.indexOf(r)<0&&n.push(r)}),n}function ft(e,t){t=t||Object.prototype,t=t&&!y(t)?[t]:t;for(var r=[],e=e;e&&(!t||t.indexOf(e)<0)&&e.name!=="default";)r.push(e),e=e?Object.getPrototypeOf(e):null;return r}function lt(n,t){var r=[];return ft(n,t).forEach(e=>{K(r,...Object.getOwnPropertyNames(e))}),r}function T(n,t,r=!1,e=!1,i=!1){var o=0,s=n.shift();if((C(s)||s===!0||s===!1)&&(o=s,s=n.shift()),!n.length)throw new Error("_merge() requires two or more array/objects.");return n.forEach((f,d)=>{!O(f)&&!w(f)||(r?lt(f):Object.keys(f)).forEach(u=>{if(!!t(u,s,f,d)){var c=s[u],m=f[u];if((y(c)&&y(m)||x(c)&&x(m))&&(o===!0||o>0))s[u]=y(c)&&y(m)?[]:{},T([C(o)?o-1:o,s[u],c,m],t,r,e,i);else if(y(s)&&y(f))e?s[u]=m:s.push(m);else try{i?Object.defineProperty(s,u,Object.getOwnPropertyDescriptor(f,u)):s[u]=f[u]}catch{}}})}),s}function U(...n){return T(n,(t,r,e)=>!0,!1,!1,!1)}function A(n,t=!0){return y(n)?n:!t&&x(n)?[n]:n!==!1&&n!==0&&ot(n)?[]:st(n)?Array.prototype.slice.call(n):x(n)?Object.values(n):[n]}function z(n,t,r={},e={}){t=A(t).slice();for(var i=n;!P(i)&&!B(i)&&t.length;){var o=t.shift();if(!(r.get?r.get(i,o):O(i)?o in i:i[o])){e.exists=!1;return}i=r.get?r.get(i,o):i[o]}return e.exists=!0,i}function ut(n,t,r,e={},i={}){let o=(c,m,l)=>i.set?i.set(c,m,l):(C(t[f])&&y(c)?c.push(l):c[m]=l,!0);t=A(t);for(var s=n,f=0;f<t.length;f++)if(f<t.length-1){if(!s||!O(s)&&!w(s))return!1;var d=z(s,t[f],i);if(!O(d)){if(i.buildTree===!1)return!1;d=w(i.buildTree)?i.buildTree(f):C(t[f+1])?[]:{};var u=o(s,t[f],d);if(!u)return!1}s=d}else return o(s,t[f],r)}var J=class{constructor(t,r=!0){Object.defineProperty(this,"window",{value:t}),Object.defineProperty(this,"readCallbacks",{value:new Set}),Object.defineProperty(this,"writeCallbacks",{value:new Set}),this.async=r,this.window.requestAnimationFrame?this._run():this.async=!1}_run(){this.window.requestAnimationFrame(()=>{for(let t of this.readCallbacks)t(),this.readCallbacks.delete(t);for(let t of this.writeCallbacks)t(),this.writeCallbacks.delete(t);this._run()})}onread(t,r=!1){if(r)return new Promise(e=>{this.async===!1?e(t()):this.readCallbacks.add(()=>{e(t())})});this.async===!1?t():this.readCallbacks.add(t)}onwrite(t,r=!1){if(r)return new Promise(e=>{this.async===!1?e(t()):this.writeCallbacks.add(()=>{e(t())})});this.async===!1?t():this.writeCallbacks.add(t)}cycle(t,r,e){this.onread(()=>{let i=t(e),o=s=>{s!==void 0&&this.onwrite(()=>{let f=r(s,e),d=u=>{u!==void 0&&this.cycle(t,r,u)};f instanceof Promise?f.then(d):d(f)})};i instanceof Promise?i.then(o):o(i)})}};function At(n){return(n=n.trim())&&n.startsWith("(")&&n.endsWith(")")}function et(n,t,r,e=!0){r=(Array.isArray(r)?r:[r]).map(f=>(f+"").replace("(",e?"(.//":"(./")).join("|");let i=n.document.evaluate(r,t,null,XPathResult.ANY_TYPE),o=[],s;for(;s=i.iterateNext();)o.push(s);return o}function Et(n,t,r){return r=(Array.isArray(r)?r:[r]).map(e=>(e+"").replace("(","(self::")).join("|"),n.document.evaluate(`${r}`,t,null,XPathResult.BOOLEAN_TYPE).booleanValue}function Ct(n,t="|"){return[...n].reduce(([r,e,i,o],s)=>!r&&e===0&&(Array.isArray(t)?t:[t]).includes(s)?[r,e,[""].concat(i)]:(!r&&["(","[","{"].includes(s)&&!i[0].endsWith("\\")&&e++,!r&&[")","]","}"].includes(s)&&!i[0].endsWith("\\")&&e--,['"',"'","`"].includes(s)&&!i[0].endsWith("\\")&&(r=r===s?null:r||s),i[0]+=s,[r,e,i]),[null,0,[""]])[2].reverse()}var S=class{constructor(t){this.content=t,this.type=typeof t=="string"?"selector":"instance",this.kind=this.type==="instance"?null:At(t)?"xpath":"css",this.kind==="xpath"&&(this.isXpathAttr=Ct(t.trim().slice(1,-1),"@").length>1)}toString(){return this.content}};var L=class{constructor(t,r,e){this.context=t,this.namespace=r,this.window=t.defaultView||t.ownerDocument?.defaultView||e,this.document=this.window.document,this.webqit=this.window.webqit,Object.defineProperty(this,"#",{value:{}})}resolveArgs(t){if(w(t[0])?t=[[],...t]:x(t[0])&&!(t[0]instanceof S)&&t.length===1?t=[[],void 0,t[0]]:x(t[1])&&t.length===2?t=[A(t[0],!1),void 0,t[1]]:t[0]=A(t[0],!1),t[0].filter(r=>typeof r!="string"&&!(r instanceof S)&&!(r instanceof this.window.Node)).length)throw new Error("Argument #2 must be either a string or a Node object, or a list of those.");return t[0]=t[0].map(r=>r instanceof S?r:new S(r)),t}registry(...t){return N("realdom.realtime",this.window,this.namespace,...t)}createSignalGenerator(){return{generate(){return this.lastController?.abort(),this.lastController=new AbortController,{signal:this.lastController.signal}},disconnect(){this.lastController?.abort()}}}forEachMatchingContext(t,r,e){let{window:i}=this,o=Array.isArray(r)?r:[r],s=new Set;for(let[f,d]of this.registry(t))for(let[u,c]of d){let m=o.filter(l=>u.contains(l.target)?f==="subtree"||l.target===u:!1);if(!!m.length){Array.isArray(r)||(m=m[0]);for(let l of c)s.add([l,m,u])}}for(let[f,d,u]of s)e.call(i,f,d,u)}disconnectables(t,...r){let e={disconnect(){r.forEach(i=>i&&w(i.disconnect)&&i.disconnect()||w(i)&&i()||x(i)&&(i.disconnected=!0))}};return t&&t.addEventListener("abort",()=>e.disconnect()),e}};var I=class extends L{constructor(t,...r){super(t,"attr",...r)}get(t,r=void 0,e={}){let i=typeof t=="string"||t instanceof S;[t=[],r=void 0,e={}]=this.resolveArgs(arguments);let{context:o}=this,s=Mt(o,t);if(!r)return s;let f=e.lifecycleSignals&&this.createSignalGenerator();if(i)for(let d of s){let u=f?.generate()||{};r(d,u,o)}else{let d=f?.generate()||{};r(s,d,o)}if(e.live){f&&(e={...e,signalGenerator:f});let d=this.observe(i?t[0]:t,r,{newValue:!0,...e});return this.disconnectables(e.signal,d)}}observe(t,r,e={}){let i=typeof t=="string"||t instanceof S;if([t=[],r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(i?t[0]:t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:o,window:s,webqit:f}=this;e.eventDetails&&!f.realdom.attrInterceptionHooks?.intercepting&&qt.call(s,"intercept",()=>{});let d=new s.MutationObserver(l=>{l=Pt(l).map(p=>It.call(s,p)),Tt.call(s,m,l,o)}),u={attributes:!0,attributeOldValue:e.oldValue,subtree:e.subtree};t.length&&(u.attributeFilter=t.map(l=>l+"")),d.observe(o,u);let c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:d};return this.disconnectables(e.signal,d,c)}observeSync(t,r,e={}){let i=typeof t=="string"||t instanceof S;[t,r,e={}]=this.resolveArgs(arguments);let{context:o,window:s}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let f=e.timing==="intercept"?"intercept":"sync",d=e.subtree?"subtree":"children";this.registry(f).size||qt.call(s,f,_=>{this.forEachMatchingContext(f,_,Tt)});let u={disconnect(){p.delete(m),p.size||l.delete(o)}},c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),m={context:o,spec:t,callback:r,params:e,atomics:new Map,originalFilterIsString:i,signalGenerator:c,disconnectable:u},l=this.registry(f,d);l.has(o)||l.set(o,new Set);let p=l.get(o);return p.add(m),this.disconnectables(e.signal,u,c)}};function Pt(n){return n.reduce((t,r,e)=>t[e-1]?.attributeName===r.attributeName?t:t.concat(r),[])}function Tt(n,t){let{context:r,spec:e,callback:i,params:o,atomics:s,originalFilterIsString:f,signalGenerator:d}=n,u=e.map(l=>l+"");if(o.atomic&&!s.size?t=Mt(r,e,t):o.timing!=="async"&&e.length&&(t=t.filter(l=>u.includes(l.name))),!t.length)return;o.newValue===null&&o.oldValue===null&&o.eventDetails||(t=t.map(l=>{let p;return o.eventDetails||({event:p,...l}=l),!o.oldValue&&"oldValue"in l&&({oldValue:p,...l}=l),!o.newValue&&"value"in l?{value:p,...l}=l:o.newValue&&typeof l.value>"u"&&(l={...l,value:l.target.getAttribute(l.name)}),l})),o.atomic&&(t.forEach(l=>s.set(l.name,l)),t=Array.from(s.entries()).map(([,l])=>l));let c=f?t[0]:t,m=d?.generate()||{};i(c,m,r)}function Mt(n,t,r=[]){let e={event:null,type:"attribute"};return t.length?t.map(o=>(o=o+"",r.find(s=>s.name===o)||{target:n,name:o,value:n.getAttribute(o),...e})):Array.from(n.attributes).map(o=>r.find(s=>s.name===o.nodeName)||{target:n,name:o.nodeName,value:o.nodeValue,...e})}function It({target:n,attributeName:t,value:r,oldValue:e}){let s=(this.webqit.realdom.attrInterceptionRecords?.get(n)||{})[t]?.[0]||"mutation";return{target:n,name:t,value:r,oldValue:e,type:"observation",event:s}}function qt(n,t){let r=this,{webqit:e,document:i,Element:o}=r;e.realdom.attrInterceptionHooks||Object.defineProperty(e.realdom,"attrInterceptionHooks",{value:new Map}),e.realdom.attrInterceptionHooks.has(n)||e.realdom.attrInterceptionHooks.set(n,new Set),e.realdom.attrInterceptionHooks.get(n).add(t);let s=()=>e.realdom.attrInterceptionHooks.get(n).delete(t);if(e.realdom.attrInterceptionHooks?.intercepting)return s;console.warn("Attr mutation APIs are now being intercepted."),e.realdom.attrInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"attrInterceptionRecords",{value:new Map});let f=(c,m)=>{e.realdom.attrInterceptionRecords.has(c.target)||e.realdom.attrInterceptionRecords.set(c.target,{});let l=e.realdom.attrInterceptionRecords.get(c.target);l[c.name]=l[c.name]||[],l[c.name].unshift(c.event),e.realdom.attrInterceptionHooks.get("intercept")?.forEach(_=>_([c]));let p=m();return e.realdom.attrInterceptionHooks.get("sync")?.forEach(_=>_([c])),p};new r.MutationObserver(c=>{c=c.filter(m=>!(r.webqit.realdom.attrInterceptionRecords?.get(m.target)||{})[m.attributeName]?.shift()),c=Pt(c).map(m=>It.call(r,m)),c.length&&(e.realdom.attrInterceptionHooks.get("intercept")?.forEach(m=>m(c)),e.realdom.attrInterceptionHooks.get("sync")?.forEach(m=>m(c)))}).observe(i,{attributes:!0,subtree:!0,attributeOldValue:!0});let u=Object.create(null);return["setAttribute","removeAttribute","toggleAttribute"].forEach(c=>{u[c]=o.prototype[c],o.prototype[c]=function(...m){let l,p=this.getAttribute(m[0]);["setAttribute","toggleAttribute"].includes(c)&&(l=m[1]),c==="toggleAttribute"&&l===void 0&&(l=p===null);let _={target:this,name:m[0],value:l,oldValue:p,type:"interception",event:[this,c]};return f(_,()=>u[c].call(this,...m))}}),s}var Y=class extends L{constructor(t,...r){super(t,"tree",...r)}attr(t,r=void 0,e={}){let{context:i,window:o}=this;return new I(i,o).get(...arguments)}query(t,r=void 0,e={}){[t,r=void 0,e={}]=this.resolveArgs(arguments);let{context:i}=this,o=new Map,s=u=>(o.has(u)||o.set(u,{target:u,entrants:[],exits:[],type:"query",event:null}),o.get(u));if(!e.generation||e.generation==="entrants"){if(!t.length)[...i.children].forEach(u=>s(i).entrants.push(u));else if(t.every(u=>u.type==="selector")){let[u,c]=t.reduce(([l,p],_)=>_.kind==="xpath"?[l,p.concat(_)]:[l.concat(_),p],[[],[]]),m=[];e.subtree?(u.length&&m.push(...i.querySelectorAll(u.join(","))),c.length&&m.push(...et(this.window,i,c))):(u.length&&m.push(...[...i.children].filter(l=>l.matches(u))),c.length&&m.push(...et(this.window,i,c,!1))),m.forEach(l=>s(l.parentNode||i).entrants.push(l))}}if(!r)return o;let f={disconnected:!1},d=r&&e.lifecycleSignals&&this.createSignalGenerator();for(let[,u]of o){if(f.disconnected)break;let c=d?.generate()||{};r(u,c,i)}if(e.live){d&&(e={...e,signalGenerator:d});let u=this.observe(t,r,e);return this.disconnectables(e.signal,f,u)}return this.disconnectables(e.signal,f,d)}children(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!1})}subtree(t,r=void 0,e={}){return[t,r=void 0,e={}]=this.resolveArgs(arguments),this.query(t,r,{...e,subtree:!0})}observe(t,r,e={}){if([t,r,e={}]=this.resolveArgs(arguments),["sync","intercept"].includes(e.timing))return this.observeSync(t,r,e);if(e.timing&&e.timing!=="async")throw new Error(`Timing option "${e.timing}" invalid.`);let{context:i,window:o,webqit:s,document:f}=this;e.eventDetails&&(s.realdom.domInterceptionRecordsAlwaysOn=!0),(f.readyState==="loading"||s.realdom.domInterceptionRecordsAlwaysOn)&&!s.realdom.domInterceptionHooks?.intercepting&&Dt.call(o,"sync",()=>{});let d=new o.MutationObserver(m=>m.forEach(l=>{mt.call(o,c,Ht.call(o,l),i)}));d.observe(i,{childList:!0,subtree:e.subtree});let u=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),c={context:i,spec:t,callback:r,params:e,signalGenerator:u,disconnectable:d};if(e.staticSensitivity){let m=kt.call(o,c);return this.disconnectables(e.signal,d,u,m)}return this.disconnectables(e.signal,d,u)}observeSync(t,r,e={}){[t,r,e={}]=this.resolveArgs(arguments);let{context:i,window:o}=this;if(e.timing&&!["sync","intercept"].includes(e.timing))throw new Error(`Timing option "${e.timing}" invalid.`);let s=e.timing==="intercept"?"intercept":"sync",f=e.subtree?"subtree":"children";this.registry(s).size||Dt.call(o,s,_=>{this.forEachMatchingContext(s,_,mt)});let d=new o.MutationObserver(_=>_.forEach(a=>{Array.isArray((a=Ht.call(o,a)).event)||mt.call(o,m,a,i)}));d.observe(i,{childList:!0,subtree:e.subtree});let u={disconnect(){d.disconnect(),p.delete(m),p.size||l.delete(i)}},c=e.signalGenerator||e.lifecycleSignals&&this.createSignalGenerator(),m={context:i,spec:t,callback:r,params:e,signalGenerator:c,disconnectable:u},l=this.registry(s,f);l.has(i)||l.set(i,new Set);let p=l.get(i);if(p.add(m),e.staticSensitivity){let _=kt.call(o,m);return this.disconnectables(e.signal,u,c,_)}return this.disconnectables(e.signal,u,c)}};function kt(n){let t=this,{context:r,spec:e,callback:i,params:o,signalGenerator:s}=n,f=e.filter(p=>p.kind==="css"),d=p=>p.match(/\.([\w-]+)/g)?.length?["class"]:[],u=p=>p.match(/#([\w-]+)/g)?.length?["id"]:[],c=p=>[...p.matchAll(/\[([^\=\]]+)(\=[^\]]+)?\]/g)].map(_=>_[1]).concat(d(p)).concat(u(p));if(!(n.$attrs=Array.from(new Set(f.filter(p=>(p+"").includes("[")).reduce((p,_)=>p.concat(c(_+"")),[])))).length)return;let m=new Set,l=new Set;return m.push=p=>(l.delete(p),m.add(p)),l.push=p=>(m.delete(p),l.add(p)),n.$deliveryCache={entrants:m,exits:l},new I(r,t).observe(n.$attrs,p=>{let _=new Map,a=h=>(_.has(h)||_.set(h,{target:h,entrants:[],exits:[],type:"static",event:null}),_.get(h)),v=new WeakMap,g=h=>(v.has(h)||v.set(h,f.some(b=>h.matches(b+""))),v.get(h));for(let h of p)["entrants","exits"].forEach(b=>{o.generation&&b!==o.generation||n.$deliveryCache[b].has(h.target)||(b==="entrants"?!g(h.target):g(h.target))||(n.$deliveryCache[b].push(h.target),a(h.target)[b].push(h.target),a(h.target).event=h.event)});for(let[,h]of _){let b=s?.generate()||{};i(h,b,r)}},{subtree:o.subtree,timing:o.timing,eventDetails:o.eventDetails})}function mt(n,t){let{context:r,spec:e,callback:i,params:o,signalGenerator:s,$deliveryCache:f}=n,d={...t,entrants:[],exits:[]};if(o.eventDetails||delete d.event,["entrants","exits"].forEach(c=>{if(!(o.generation&&c!==o.generation)&&(e.length?d[c]=ee.call(this,e,t[c],t.event!=="parse"):d[c]=[...t[c]],!!f))for(let m of d[c])f[c].push(m)}),!d.entrants.length&&!d.exits.length)return;let u=s?.generate()||{};i(d,u,r)}function ee(n,t,r){t=Array.isArray(t)?t:[...t];let e=(i,o)=>{if(o.type==="selector"){let s=o.isXpathAttr?[]:i.filter(f=>o.kind==="xpath"?Et(this,f,o+""):f.matches&&f.matches(o+""));if((r||o.isXpathAttr)&&(s=i.reduce((f,d)=>o.kind==="xpath"?[...f,...et(this,d,o,r)]:d.querySelectorAll?[...f,...d.querySelectorAll(o+"")]:f,s)),s.length)return s}else if(i.includes(o.content)||r&&i.some(s=>s.contains(o.content)))return[o.content]};return t.$$searchCache||(t.$$searchCache=new Map),n.reduce((i,o)=>{let s;return t.$$searchCache.has(o.content)?s=t.$$searchCache.get(o.content):(s=e(t,o)||[],o.type==="instance"&&t.$$searchCache.set(o.content,s)),i.concat(s)},[])}function Ht({target:n,addedNodes:t,removedNodes:r}){let e=this,i;return i=A(t).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),null),i=A(r).reduce((o,s)=>o||e.webqit.realdom.domInterceptionRecords?.get(s),i),i=i||e.document.readyState==="loading"&&"parse"||"mutation",{target:n,entrants:t,exits:r,type:"observation",event:i}}function Dt(n,t){let r=this,{webqit:e,document:i,Node:o,CharacterData:s,Element:f,HTMLElement:d,HTMLTemplateElement:u,DocumentFragment:c}=r;e.realdom.domInterceptionHooks||Object.defineProperty(e.realdom,"domInterceptionHooks",{value:new Map}),e.realdom.domInterceptionHooks.has(n)||e.realdom.domInterceptionHooks.set(n,new Set),e.realdom.domInterceptionHooks.get(n).add(t);let m=()=>e.realdom.domInterceptionHooks.get(n).delete(t);if(e.realdom.domInterceptionHooks?.intercepting)return m;console.warn("DOM mutation APIs are now being intercepted."),e.realdom.domInterceptionHooks.intercepting=!0,Object.defineProperty(e.realdom,"domInterceptionRecords",{value:new Map});let l=(a,v)=>{a.entrants.concat(a.exits).forEach(h=>{clearTimeout(e.realdom.domInterceptionRecords.get(h)?.timeout),e.realdom.domInterceptionRecords.set(h,a.event);let b=setTimeout(()=>{e.realdom.domInterceptionRecords.delete(h)},0);Object.defineProperty(a.event,"timeout",{value:b,configurable:!0})}),e.realdom.domInterceptionHooks.get("intercept")?.forEach(h=>h(a));let g=v();return e.realdom.domInterceptionHooks.get("sync")?.forEach(h=>h(a)),g},p={characterData:Object.create(null),other:Object.create(null)};["insertBefore","insertAdjacentElement","insertAdjacentHTML","setHTML","replaceChildren","replaceWith","remove","replaceChild","removeChild","before","after","append","prepend","appendChild"].forEach(a=>{function v(...g){let h=this instanceof s?p.characterData:p.other,b=()=>h[a].call(this,...g);if(!(this instanceof s||this instanceof f||this instanceof c))return b();let q=[],E=[],V=this;["insertBefore"].includes(a)?E=[g[0]]:["insertAdjacentElement","insertAdjacentHTML"].includes(a)?(E=[g[1]],["beforebegin","afterend"].includes(g[0])&&(V=this.parentNode)):["setHTML","replaceChildren"].includes(a)?(q=[...this.childNodes],E=a==="replaceChildren"?[...g]:[g[0]]):["replaceWith","remove"].includes(a)?(q=[this],E=a==="replaceWith"?[...g]:[],V=this.parentNode):["replaceChild"].includes(a)?(q=[g[1]],E=[g[0]]):["removeChild"].includes(a)?q=[...g]:(E=[...g],["before","after"].includes(a)&&(V=this.parentNode));let D=a;if(["insertAdjacentHTML","setHTML"].includes(a)){let gt=this.nodeName;if(a==="insertAdjacentHTML"&&["beforebegin","afterend"].includes(g[0])){if(!this.parentNode)return h[a].call(this,...g);gt=this.parentNode.nodeName}let Q=i.createElement(gt);h.setHTML.call(Q,E[0],a==="setHTML"?g[1]:{}),E=[...Q.childNodes],a==="insertAdjacentHTML"?(D="insertAdjacentElement",g[1]=new c,g[1].______isTemp=!0,g[1].append(...Q.childNodes)):(D="replaceChildren",g=[...Q.childNodes])}return l({target:V,entrants:E,exits:q,type:"interception",event:[this,a]},()=>h[D].call(this,...g))}["insertBefore","replaceChild","removeChild","appendChild"].includes(a)?(p.other[a]=o.prototype[a],o.prototype[a]=v):(["after","before","remove","replaceWith"].includes(a)&&(p.characterData[a]=s.prototype[a],s.prototype[a]=v),f.prototype[a]&&(p.other[a]=f.prototype[a],f.prototype[a]=v))});let _=Object.create(null);return["outerHTML","outerText","innerHTML","innerText","textContent","nodeValue"].forEach(a=>{let v=["textContent","nodeValue"].includes(a)?o:["outerText","innerText"].includes(a)?d:f;_[a]=Object.getOwnPropertyDescriptor(v.prototype,a),Object.defineProperty(v.prototype,a,{..._[a],set:function(g){let h=()=>_[a].set.call(this,g);if(!(this instanceof f))return h();let b=[],q=[],E=this;if(["outerHTML","outerText"].includes(a)?(b=[this],E=this.parentNode):b=[...this.childNodes],["outerHTML","innerHTML"].includes(a)){let D=this.nodeName;if(a==="outerHTML"){if(!this.parentNode)return h();D=this.parentNode.nodeName}let $=i.createElement(D==="TEMPLATE"?"div":D);_[a].set.call($,g),q=this instanceof u?[]:[...$.childNodes],a==="outerHTML"?(g=new c,g.______isTemp=!0,g.append(...$.childNodes),h=()=>f.prototype.replaceWith.call(this,g)):this instanceof u?h=()=>this.content.replaceChildren(...$.childNodes):h=()=>f.prototype.replaceChildren.call(this,...$.childNodes)}return l({target:E,entrants:q,exits:b,type:"interception",event:[this,a]},h)}})}),["append","prepend","replaceChildren"].forEach(a=>{[i,c.prototype].forEach(v=>{let g=v[a];v[a]=function(...h){if(this.______isTemp)return g.call(this,...h);let b=a==="replaceChildren"?[...this.childNodes]:[];return l({target:this,entrants:h,exits:b,type:"interception",event:[this,a]},()=>g.call(this,...h))}})}),m}function Lt(){re.call(this),ne.call(this),ie.call(this)}function re(){let n=this;n.CSS||(n.CSS={}),n.CSS.escape||(n.CSS.escape=t=>t.replace(/([\:@\~\$\&])/g,"\\$1"))}function ne(){let n=this;"isConnected"in n.Node.prototype||Object.defineProperty(n.Node.prototype,"isConnected",{get:function(){return!this.ownerDocument||!(this.ownerDocument.compareDocumentPosition(this)&this.DOCUMENT_POSITION_DISCONNECTED)}})}function ie(){let n=this;n.Element.prototype.matches||(n.Element.prototype.matches=n.Element.prototype.matchesSelector||n.Element.prototype.mozMatchesSelector||n.Element.prototype.msMatchesSelector||n.Element.prototype.oMatchesSelector||n.Element.prototype.webkitMatchesSelector||function(t){for(var r=(this.document||this.ownerDocument).querySelectorAll(t),e=r.length;--e>=0&&r.item(e)!==this;);return e>-1})}function jt(){let n=this;if(n.webqit||(n.webqit={}),n.webqit.realdom)return n.webqit.realdom;n.webqit.realdom={},Lt.call(n),n.webqit.realdom.meta=(...r)=>oe.call(n,...r),n.webqit.realdom.ready=(...r)=>dt.call(n,...r),n.webqit.realdom.realtime=(r,e="dom")=>{if(e==="dom")return new Y(r,n);if(e==="attr")return new I(r,n)};let t=new J(n);return n.webqit.realdom.schedule=(r,...e)=>t[`on${r}`](...e),n.webqit.realdom}function dt(...n){let t="interactive",r;W(n[0])?(t=n[0],w(n[1])&&(r=n[1])):w(n[0])&&(r=n[0]);let e={interactive:["interactive","complete"],complete:["complete"]};if(!e[t])throw new Error(`Invalid ready-state timing: ${t}.`);let i=this;if(!r)return i.webqit.realdom.readyStatePromises||(i.webqit.realdom.readyStatePromises={interactive:new Promise(o=>dt.call(this,"interactive",o)),complete:new Promise(o=>dt.call(this,"complete",o))}),i.webqit.realdom.readyStatePromises[t];if(e[t].includes(i.document.readyState))return r(i);i.webqit.realdom.readyStateCallbacks||(i.webqit.realdom.readyStateCallbacks={interactive:[],complete:[]},i.document.addEventListener("readystatechange",()=>{let o=i.document.readyState;for(let s of i.webqit.realdom.readyStateCallbacks[o].splice(0))s(i)},!1)),i.webqit.realdom.readyStateCallbacks[t].push(r)}function oe(n){let t=this,r={},e;return(e=t.document.querySelector(`meta[name="${n}"]`))&&(r=(e.content||"").split(";").filter(i=>i).reduce((i,o)=>{let s=o.split("=").map(f=>f.trim());return ut(i,s[0].split("."),s[1]==="true"?!0:s[1]==="false"?!1:C(s[1])?parseInt(s[1]):s[1]),i},{})),{get name(){return n},get content(){return e.content},json(){return JSON.parse(JSON.stringify(r))}}}var rt=(...n)=>N("oohtml",...n),k={};function Ft(n,t,r){let e=this,i=jt.call(e);e.webqit||(e.webqit={}),e.webqit.oohtml||(e.webqit.oohtml={}),e.webqit.oohtml.configs||(e.webqit.oohtml.configs={});let o=n.toUpperCase().replace("-","_");return e.webqit.oohtml.configs[o]||(e.webqit.oohtml.configs[o]={}),k.window=e,U(2,e.webqit.oohtml.configs[o],r,t,i.meta(n).json()),{config:e.webqit.oohtml.configs[o],realdom:i,window:e}}function nt(){let{window:n}=k,{webqit:t}=n;if(t.DOMContextRequestEvent)return t.DOMContextRequestEvent;class r extends n.Event{constructor(...i){let o=i.pop();if(typeof o!="function")throw new Error("Callback must be provided.");let s=i.pop();if(!s?.kind)throw new Error('"options.kind" must be specified.');let f=["contextrequest","contextclaim"],d=i.pop()||f[0];if(!f.includes(d))throw new Error(`Invalid event type. Must be one of: ${f.join(",")}`);let{kind:u,detail:c,targetContext:m,live:l,signal:p,diff:_,...a}=s;super(d,{...a,bubbles:a.bubbles!==!1}),Object.defineProperty(this,"callback",{get:()=>o}),Object.defineProperty(this,"kind",{get:()=>u}),Object.defineProperty(this,"targetContext",{get:()=>m}),Object.defineProperty(this,"detail",{get:()=>c}),Object.defineProperty(this,"live",{get:()=>l}),Object.defineProperty(this,"signal",{get:()=>p}),Object.defineProperty(this,"diff",{get:()=>_}),Object.defineProperty(this,"options",{get:()=>a})}respondWith(i){if(this.diff){if("_prevValue"in this&&this._prevValue===i)return;Object.defineProperty(this,"_prevValue",{value:i,configurable:!0})}return this.callback(i)}}return t.DOMContextRequestEvent=r,r}var j=class extends AbortController{constructor(t){super(),t(r=>{let{window:{webqit:{Observer:e}}}=k;e.defineProperty(this,"value",{value:r,configurable:!0,enumerable:!0})},this)}};var pt=class{static createRequest(){return{kind:this.kind}}constructor(t=null){Object.defineProperty(this,"detail",{get:()=>t}),Object.defineProperty(this,"subscriptions",{value:new Set})}get configs(){let{window:{webqit:{oohtml:{configs:t}}}}=k;return t}get name(){return this.host===k.window.document?1/0:this.host.getAttribute(this.configs.CONTEXT_API.attr.contextname)}subscribed(t){}handle(t){}unsubscribed(t){}matchEvent(t){return t.kind===this.constructor.kind&&(!t.targetContext||t.targetContext===this.name)}handleEvent(t){if(!(this.disposed||typeof t.respondWith!="function")){if(t.type==="contextclaim"){if(t.target===this.host||!(t.detail instanceof pt))return;let r=new Set;return this.subscriptions.forEach(e=>{!t.target.contains(e.target)||!t.detail.matchEvent(e)||(t.stopPropagation(),this.subscriptions.delete(e),r.add(e))}),t.respondWith(r)}if(t.type==="contextrequest")return this.matchEvent(t)?(t.live&&(this.subscriptions.add(t),this.subscribed(t),t.signal?.addEventListener("abort",()=>{this.subscriptions.delete(t),this.unsubscribed(t)})),t.stopPropagation(),this.handle(t)):void 0}}initialize(t){this.host=t,this.disposed=!1,t.addEventListener("contextrequest",this),t.addEventListener("contextclaim",this);let{value:r}=M.instance(t).request("contextclaim",{kind:this.constructor.kind,detail:this});return r.forEach(e=>{this.subscriptions.add(e),this.subscribed(e),this.handle(e)}),this}dispose(t){return this.disposed=!0,t.removeEventListener("contextrequest",this),t.removeEventListener("contextclaim",this),this.subscriptions.forEach(r=>{this.subscriptions.delete(r),this.unsubscribed(r);let{target:e}=r;e.dispatchEvent(r)}),this}},H=pt;yt(H,"kind");var F=class extends Error{};var M=class{static instance(t){return rt(t).get("contexts::instance")||new this(t)}constructor(t){rt(t).get("contexts::instance")?.dispose(),rt(t).set("contexts::instance",this);let r={host:t,contexts:new Set};Object.defineProperty(this,"#",{get:()=>r})}get[Symbol.iterator](){return this["#"].contexts[Symbol.iterator]}get length(){return this["#"].contexts.size}find(...t){return[...this["#"].contexts].find(r=>typeof t[0]=="function"?t[0](r):r.constructor.kind===t[0]&&(t.length===1||r.detail===t[1]))}attach(t){if(!(t instanceof H))throw new TypeError("Context is not a valid DOMContext instance.");if(this.find(t.constructor.kind,t.detail))throw new F(`Context of same kind "${t.constructor.kind}"${t.detail?` and detail "${t.detail}"`:""} already exists.`);this["#"].contexts.add(t),t.initialize(this["#"].host)}detach(t){t.dispose(this["#"].host),this["#"].contexts.delete(t)}request(...t){return new j((r,e)=>{typeof t[t.length-1]!="function"&&(t[t.length-1]?t.push(r):t[t.length-1]=r);let i;(i=t.find(s=>typeof s=="object"&&s))&&i.live&&(i.signal&&i.signal.addEventListener("abort",()=>e.abort()),t[t.indexOf(i)]={...i,signal:e.signal});let o=new(nt())(...t);this["#"].host.dispatchEvent(o)})}};function ht(n={}){let{config:t,window:r}=Ft.call(this,"context-api",n,{attr:{contextname:"contextname"},api:{contexts:"contexts"}});r.webqit.DOMContexts=M,r.webqit.DOMContext=H,r.webqit.DOMContextRequestEvent=nt(),r.webqit.DOMContextResponse=j,r.webqit.DuplicateContextError=F,se.call(r,t)}function se(n){let t=this;if(n.api.contexts in t.document)throw new Error(`document already has a "${n.api.contexts}" property!`);if(n.api.contexts in t.HTMLElement.prototype)throw new Error(`The "HTMLElement" class already has a "${n.api.contexts}" property!`);Object.defineProperty(t.document,n.api.contexts,{get:function(){return M.instance(t.document)}}),Object.defineProperty(t.HTMLElement.prototype,n.api.contexts,{get:function(){return M.instance(this)}});let r=new Set;t.addEventListener("contextrequest",e=>{typeof e.respondWith=="function"&&(r.add(e),e.respondWith())}),t.addEventListener("contextclaim",e=>{if(typeof e.detail!="object"||typeof e.detail.matchEvent!="function"||typeof e.respondWith!="function")return;let i=new Set;r.forEach(o=>{!e.target.contains(o.target)||!e.detail.matchEvent(o)||(r.delete(o),i.add(o))}),e.respondWith(i)})}ht.call(window);})();
2
2
  //# sourceMappingURL=context-api.js.map