liveroom-client-element 0.0.1 → 0.0.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.
@@ -267,9 +267,9 @@ q.finalized = !0, q.elementProperties = /* @__PURE__ */ new Map(), q.elementStyl
267
267
  * SPDX-License-Identifier: BSD-3-Clause
268
268
  */
269
269
  var Tt;
270
- const gt = window, X = gt.trustedTypes, ne = X ? X.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Rt = "$lit$", I = `lit$${(Math.random() + "").slice(9)}$`, ye = "?" + I, es = `<${ye}>`, z = document, it = () => z.createComment(""), rt = (n) => n === null || typeof n != "object" && typeof n != "function", me = Array.isArray, ss = (n) => me(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", kt = `[
270
+ const gt = window, X = gt.trustedTypes, ne = X ? X.createPolicy("lit-html", { createHTML: (n) => n }) : void 0, Rt = "$lit$", I = `lit$${(Math.random() + "").slice(9)}$`, ye = "?" + I, es = `<${ye}>`, J = document, it = () => J.createComment(""), rt = (n) => n === null || typeof n != "object" && typeof n != "function", me = Array.isArray, ss = (n) => me(n) || typeof (n == null ? void 0 : n[Symbol.iterator]) == "function", kt = `[
271
271
  \f\r]`, Q = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ie = /-->/g, re = />/g, V = RegExp(`>|${kt}(?:([^\\s"'>=/]+)(${kt}*=${kt}*(?:[^
272
- \f\r"'\`<>=]|("|')|))|$)`, "g"), oe = /'/g, ae = /"/g, _e = /^(?:script|style|textarea|title)$/i, ns = (n) => (s, ...t) => ({ _$litType$: n, strings: s, values: t }), he = ns(1), K = Symbol.for("lit-noChange"), O = Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), J = z.createTreeWalker(z, 129, null, !1), is = (n, s) => {
272
+ \f\r"'\`<>=]|("|')|))|$)`, "g"), oe = /'/g, ae = /"/g, _e = /^(?:script|style|textarea|title)$/i, ns = (n) => (s, ...t) => ({ _$litType$: n, strings: s, values: t }), he = ns(1), K = Symbol.for("lit-noChange"), O = Symbol.for("lit-nothing"), le = /* @__PURE__ */ new WeakMap(), z = J.createTreeWalker(J, 129, null, !1), is = (n, s) => {
273
273
  const t = n.length - 1, e = [];
274
274
  let i, r = s === 2 ? "<svg>" : "", o = Q;
275
275
  for (let u = 0; u < t; u++) {
@@ -291,11 +291,11 @@ class ot {
291
291
  this.parts = [];
292
292
  let r = 0, o = 0;
293
293
  const l = s.length - 1, u = this.parts, [d, C] = is(s, t);
294
- if (this.el = ot.createElement(d, e), J.currentNode = this.el.content, t === 2) {
294
+ if (this.el = ot.createElement(d, e), z.currentNode = this.el.content, t === 2) {
295
295
  const y = this.el.content, $ = y.firstChild;
296
296
  $.remove(), y.append(...$.childNodes);
297
297
  }
298
- for (; (i = J.nextNode()) !== null && u.length < l; ) {
298
+ for (; (i = z.nextNode()) !== null && u.length < l; ) {
299
299
  if (i.nodeType === 1) {
300
300
  if (i.hasAttributes()) {
301
301
  const y = [];
@@ -316,7 +316,7 @@ class ot {
316
316
  if ($ > 0) {
317
317
  i.textContent = X ? X.emptyScript : "";
318
318
  for (let x = 0; x < $; x++)
319
- i.append(y[x], it()), J.nextNode(), u.push({ type: 2, index: ++r });
319
+ i.append(y[x], it()), z.nextNode(), u.push({ type: 2, index: ++r });
320
320
  i.append(y[$], it());
321
321
  }
322
322
  }
@@ -332,7 +332,7 @@ class ot {
332
332
  }
333
333
  }
334
334
  static createElement(s, t) {
335
- const e = z.createElement("template");
335
+ const e = J.createElement("template");
336
336
  return e.innerHTML = s, e;
337
337
  }
338
338
  }
@@ -356,17 +356,17 @@ class rs {
356
356
  }
357
357
  u(s) {
358
358
  var t;
359
- const { el: { content: e }, parts: i } = this._$AD, r = ((t = s == null ? void 0 : s.creationScope) !== null && t !== void 0 ? t : z).importNode(e, !0);
360
- J.currentNode = r;
361
- let o = J.nextNode(), l = 0, u = 0, d = i[0];
359
+ const { el: { content: e }, parts: i } = this._$AD, r = ((t = s == null ? void 0 : s.creationScope) !== null && t !== void 0 ? t : J).importNode(e, !0);
360
+ z.currentNode = r;
361
+ let o = z.nextNode(), l = 0, u = 0, d = i[0];
362
362
  for (; d !== void 0; ) {
363
363
  if (l === d.index) {
364
364
  let C;
365
365
  d.type === 2 ? C = new ht(o, o.nextSibling, this, s) : d.type === 1 ? C = new d.ctor(o, d.name, d.strings, this, s) : d.type === 6 && (C = new cs(o, this, s)), this._$AV.push(C), d = i[++u];
366
366
  }
367
- l !== (d == null ? void 0 : d.index) && (o = J.nextNode(), l++);
367
+ l !== (d == null ? void 0 : d.index) && (o = z.nextNode(), l++);
368
368
  }
369
- return J.currentNode = z, r;
369
+ return z.currentNode = J, r;
370
370
  }
371
371
  v(s) {
372
372
  let t = 0;
@@ -404,7 +404,7 @@ class ht {
404
404
  this._$AH !== s && (this._$AR(), this._$AH = this.k(s));
405
405
  }
406
406
  _(s) {
407
- this._$AH !== O && rt(this._$AH) ? this._$AA.nextSibling.data = s : this.$(z.createTextNode(s)), this._$AH = s;
407
+ this._$AH !== O && rt(this._$AH) ? this._$AA.nextSibling.data = s : this.$(J.createTextNode(s)), this._$AH = s;
408
408
  }
409
409
  g(s) {
410
410
  var t;
@@ -1291,8 +1291,8 @@ class Vs extends M {
1291
1291
  s.encodeArrayHeader(2), s.writer.u8(38), s.encodeArray(t ? this.path.slice(t.path.length) : this.path);
1292
1292
  }
1293
1293
  }
1294
- const { isArray: Js } = Array;
1295
- class zs extends M {
1294
+ const { isArray: zs } = Array;
1295
+ class Js extends M {
1296
1296
  constructor(t, e) {
1297
1297
  super(t);
1298
1298
  g(this, "type");
@@ -1306,7 +1306,7 @@ class zs extends M {
1306
1306
  }
1307
1307
  test(t) {
1308
1308
  const { val: e } = T(t, this.path);
1309
- return e === null ? this.type.indexOf("null") > -1 : Js(e) ? this.type.indexOf("array") > -1 : this.type.indexOf(typeof e) > -1 || typeof e == "number" && e === Math.round(e) && this.type.indexOf("integer") > -1;
1309
+ return e === null ? this.type.indexOf("null") > -1 : zs(e) ? this.type.indexOf("array") > -1 : this.type.indexOf(typeof e) > -1 || typeof e == "number" && e === Math.round(e) && this.type.indexOf("integer") > -1;
1310
1310
  }
1311
1311
  toJson(t) {
1312
1312
  return {
@@ -1834,7 +1834,7 @@ const rn = (n, s) => {
1834
1834
  case "type":
1835
1835
  return new nn(w(n.path), n.value);
1836
1836
  case "test_type":
1837
- return new zs(w(n.path), n.type);
1837
+ return new Js(w(n.path), n.type);
1838
1838
  case "test_string":
1839
1839
  return new Bs(w(n.path), n.pos, n.str, !!n.not);
1840
1840
  case "test_string_len":
@@ -2612,7 +2612,7 @@ var de;
2612
2612
  function ke(a, h, c) {
2613
2613
  if (!S(h))
2614
2614
  throw new TypeError();
2615
- return k(c) || (c = L(c)), Jt(a, h, c);
2615
+ return k(c) || (c = L(c)), zt(a, h, c);
2616
2616
  }
2617
2617
  s("hasMetadata", ke);
2618
2618
  function xe(a, h, c) {
@@ -2624,7 +2624,7 @@ var de;
2624
2624
  function Se(a, h, c) {
2625
2625
  if (!S(h))
2626
2626
  throw new TypeError();
2627
- return k(c) || (c = L(c)), zt(a, h, c);
2627
+ return k(c) || (c = L(c)), Jt(a, h, c);
2628
2628
  }
2629
2629
  s("getMetadata", Se);
2630
2630
  function Oe(a, h, c) {
@@ -2700,12 +2700,12 @@ var de;
2700
2700
  }
2701
2701
  return f;
2702
2702
  }
2703
- function Jt(a, h, c) {
2703
+ function zt(a, h, c) {
2704
2704
  var p = At(a, h, c);
2705
2705
  if (p)
2706
2706
  return !0;
2707
2707
  var f = Et(h);
2708
- return G(f) ? !1 : Jt(a, f, c);
2708
+ return G(f) ? !1 : zt(a, f, c);
2709
2709
  }
2710
2710
  function At(a, h, c) {
2711
2711
  var p = Z(
@@ -2716,13 +2716,13 @@ var de;
2716
2716
  );
2717
2717
  return k(p) ? !1 : De(p.has(a));
2718
2718
  }
2719
- function zt(a, h, c) {
2719
+ function Jt(a, h, c) {
2720
2720
  var p = At(a, h, c);
2721
2721
  if (p)
2722
2722
  return Bt(a, h, c);
2723
2723
  var f = Et(h);
2724
2724
  if (!G(f))
2725
- return zt(a, f, c);
2725
+ return Jt(a, f, c);
2726
2726
  }
2727
2727
  function Bt(a, h, c) {
2728
2728
  var p = Z(
@@ -2771,11 +2771,11 @@ var de;
2771
2771
  );
2772
2772
  if (k(p))
2773
2773
  return c;
2774
- for (var f = p.keys(), j = Je(f), m = 0; ; ) {
2774
+ for (var f = p.keys(), j = ze(f), m = 0; ; ) {
2775
2775
  var _ = Be(j);
2776
2776
  if (!_)
2777
2777
  return c.length = m, c;
2778
- var v = ze(_);
2778
+ var v = Je(_);
2779
2779
  try {
2780
2780
  c[m] = v;
2781
2781
  } catch (A) {
@@ -2915,7 +2915,7 @@ var de;
2915
2915
  return c;
2916
2916
  }
2917
2917
  }
2918
- function Je(a) {
2918
+ function ze(a) {
2919
2919
  var h = Yt(a, r);
2920
2920
  if (!F(h))
2921
2921
  throw new TypeError();
@@ -2924,7 +2924,7 @@ var de;
2924
2924
  throw new TypeError();
2925
2925
  return c;
2926
2926
  }
2927
- function ze(a) {
2927
+ function Je(a) {
2928
2928
  return a.value;
2929
2929
  }
2930
2930
  function Be(a) {
@@ -3389,6 +3389,7 @@ B.styles = Ze`
3389
3389
  }
3390
3390
 
3391
3391
  .banner {
3392
+ z-index: 1000;
3392
3393
  position: fixed;
3393
3394
  bottom: 12px;
3394
3395
  inset-inline: 0;
@@ -2,7 +2,7 @@
2
2
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const R=window,U=R.ShadowRoot&&(R.ShadyCSS===void 0||R.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bt=Symbol(),Jt=new WeakMap;let zt=class{constructor(s,t,e){if(this._$cssResult$=!0,e!==bt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=t}get styleSheet(){let s=this.o;const t=this.t;if(U&&s===void 0){const e=t!==void 0&&t.length===1;e&&(s=Jt.get(t)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),e&&Jt.set(t,s))}return s}toString(){return this.cssText}};const $e=n=>new zt(typeof n=="string"?n:n+"",void 0,bt),Ce=(n,...s)=>{const t=n.length===1?n[0]:s.reduce((e,i,r)=>e+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new zt(t,n,bt)},Te=(n,s)=>{U?n.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):s.forEach(t=>{const e=document.createElement("style"),i=R.litNonce;i!==void 0&&e.setAttribute("nonce",i),e.textContent=t.cssText,n.appendChild(e)})},Bt=U?n=>n:n=>n instanceof CSSStyleSheet?(s=>{let t="";for(const e of s.cssRules)t+=e.cssText;return $e(t)})(n):n;/**
5
+ */const R=window,U=R.ShadowRoot&&(R.ShadyCSS===void 0||R.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,bt=Symbol(),zt=new WeakMap;let Jt=class{constructor(s,t,e){if(this._$cssResult$=!0,e!==bt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=s,this.t=t}get styleSheet(){let s=this.o;const t=this.t;if(U&&s===void 0){const e=t!==void 0&&t.length===1;e&&(s=zt.get(t)),s===void 0&&((this.o=s=new CSSStyleSheet).replaceSync(this.cssText),e&&zt.set(t,s))}return s}toString(){return this.cssText}};const $e=n=>new Jt(typeof n=="string"?n:n+"",void 0,bt),Ce=(n,...s)=>{const t=n.length===1?n[0]:s.reduce((e,i,r)=>e+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[r+1],n[0]);return new Jt(t,n,bt)},Te=(n,s)=>{U?n.adoptedStyleSheets=s.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):s.forEach(t=>{const e=document.createElement("style"),i=R.litNonce;i!==void 0&&e.setAttribute("nonce",i),e.textContent=t.cssText,n.appendChild(e)})},Bt=U?n=>n:n=>n instanceof CSSStyleSheet?(s=>{let t="";for(const e of s.cssRules)t+=e.cssText;return $e(t)})(n):n;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
@@ -10,9 +10,9 @@
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */var Tt;const ft=window,q=ft.trustedTypes,qt=q?q.createPolicy("lit-html",{createHTML:n=>n}):void 0,kt="$lit$",J=`lit$${(Math.random()+"").slice(9)}$`,Xt="?"+J,Se=`<${Xt}>`,B=document,tt=()=>B.createComment(""),et=n=>n===null||typeof n!="object"&&typeof n!="function",Kt=Array.isArray,xe=n=>Kt(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",St=`[
13
+ */var Tt;const ft=window,q=ft.trustedTypes,qt=q?q.createPolicy("lit-html",{createHTML:n=>n}):void 0,kt="$lit$",z=`lit$${(Math.random()+"").slice(9)}$`,Xt="?"+z,Se=`<${Xt}>`,B=document,tt=()=>B.createComment(""),et=n=>n===null||typeof n!="object"&&typeof n!="function",Kt=Array.isArray,xe=n=>Kt(n)||typeof(n==null?void 0:n[Symbol.iterator])=="function",St=`[
14
14
  \f\r]`,st=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Yt=/-->/g,Zt=/>/g,W=RegExp(`>|${St}(?:([^\\s"'>=/]+)(${St}*=${St}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Qt=/'/g,te=/"/g,ee=/^(?:script|style|textarea|title)$/i,Oe=n=>(s,...t)=>({_$litType$:n,strings:s,values:t}),se=Oe(1),X=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),ne=new WeakMap,G=B.createTreeWalker(B,129,null,!1),je=(n,s)=>{const t=n.length-1,e=[];let i,r=s===2?"<svg>":"",o=st;for(let u=0;u<t;u++){const d=n[u];let T,y,$=-1,O=0;for(;O<d.length&&(o.lastIndex=O,y=o.exec(d),y!==null);)O=o.lastIndex,o===st?y[1]==="!--"?o=Yt:y[1]!==void 0?o=Zt:y[2]!==void 0?(ee.test(y[2])&&(i=RegExp("</"+y[2],"g")),o=W):y[3]!==void 0&&(o=W):o===W?y[0]===">"?(o=i??st,$=-1):y[1]===void 0?$=-2:($=o.lastIndex-y[2].length,T=y[1],o=y[3]===void 0?W:y[3]==='"'?te:Qt):o===te||o===Qt?o=W:o===Yt||o===Zt?o=st:(o=W,i=void 0);const Y=o===W&&n[u+1].startsWith("/>")?" ":"";r+=o===st?d+Se:$>=0?(e.push(T),d.slice(0,$)+kt+d.slice($)+J+Y):d+J+($===-2?(e.push(void 0),u):Y)}const l=r+(n[t]||"<?>")+(s===2?"</svg>":"");if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return[qt!==void 0?qt.createHTML(l):l,e]};class nt{constructor({strings:s,_$litType$:t},e){let i;this.parts=[];let r=0,o=0;const l=s.length-1,u=this.parts,[d,T]=je(s,t);if(this.el=nt.createElement(d,e),G.currentNode=this.el.content,t===2){const y=this.el.content,$=y.firstChild;$.remove(),y.append(...$.childNodes)}for(;(i=G.nextNode())!==null&&u.length<l;){if(i.nodeType===1){if(i.hasAttributes()){const y=[];for(const $ of i.getAttributeNames())if($.endsWith(kt)||$.startsWith(J)){const O=T[o++];if(y.push($),O!==void 0){const Y=i.getAttribute(O.toLowerCase()+kt).split(J),I=/([.?@])?(.*)/.exec(O);u.push({type:1,index:r,name:I[2],strings:Y,ctor:I[1]==="."?Re:I[1]==="?"?Le:I[1]==="@"?Pe:vt})}else u.push({type:6,index:r})}for(const $ of y)i.removeAttribute($)}if(ee.test(i.tagName)){const y=i.textContent.split(J),$=y.length-1;if($>0){i.textContent=q?q.emptyScript:"";for(let O=0;O<$;O++)i.append(y[O],tt()),G.nextNode(),u.push({type:2,index:++r});i.append(y[$],tt())}}}else if(i.nodeType===8)if(i.data===Xt)u.push({type:2,index:r});else{let y=-1;for(;(y=i.data.indexOf(J,y+1))!==-1;)u.push({type:7,index:r}),y+=J.length-1}r++}}static createElement(s,t){const e=B.createElement("template");return e.innerHTML=s,e}}function K(n,s,t=n,e){var i,r,o,l;if(s===X)return s;let u=e!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[e]:t._$Cl;const d=et(s)?void 0:s._$litDirective$;return(u==null?void 0:u.constructor)!==d&&((r=u==null?void 0:u._$AO)===null||r===void 0||r.call(u,!1),d===void 0?u=void 0:(u=new d(n),u._$AT(n,t,e)),e!==void 0?((o=(l=t)._$Co)!==null&&o!==void 0?o:l._$Co=[])[e]=u:t._$Cl=u),u!==void 0&&(s=K(n,u._$AS(n,s.values),u,e)),s}class Me{constructor(s,t){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){var t;const{el:{content:e},parts:i}=this._$AD,r=((t=s==null?void 0:s.creationScope)!==null&&t!==void 0?t:B).importNode(e,!0);G.currentNode=r;let o=G.nextNode(),l=0,u=0,d=i[0];for(;d!==void 0;){if(l===d.index){let T;d.type===2?T=new it(o,o.nextSibling,this,s):d.type===1?T=new d.ctor(o,d.name,d.strings,this,s):d.type===6&&(T=new He(o,this,s)),this._$AV.push(T),d=i[++u]}l!==(d==null?void 0:d.index)&&(o=G.nextNode(),l++)}return G.currentNode=B,r}v(s){let t=0;for(const e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(s,e,t),t+=e.strings.length-2):e._$AI(s[t])),t++}}class it{constructor(s,t,e,i){var r;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=s,this._$AB=t,this._$AM=e,this.options=i,this._$Cp=(r=i==null?void 0:i.isConnected)===null||r===void 0||r}get _$AU(){var s,t;return(t=(s=this._$AM)===null||s===void 0?void 0:s._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let s=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(s==null?void 0:s.nodeType)===11&&(s=t.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,t=this){s=K(this,s,t),et(s)?s===x||s==null||s===""?(this._$AH!==x&&this._$AR(),this._$AH=x):s!==this._$AH&&s!==X&&this._(s):s._$litType$!==void 0?this.g(s):s.nodeType!==void 0?this.$(s):xe(s)?this.T(s):this._(s)}k(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}$(s){this._$AH!==s&&(this._$AR(),this._$AH=this.k(s))}_(s){this._$AH!==x&&et(this._$AH)?this._$AA.nextSibling.data=s:this.$(B.createTextNode(s)),this._$AH=s}g(s){var t;const{values:e,_$litType$:i}=s,r=typeof i=="number"?this._$AC(s):(i.el===void 0&&(i.el=nt.createElement(i.h,this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===r)this._$AH.v(e);else{const o=new Me(r,this),l=o.u(this.options);o.v(e),this.$(l),this._$AH=o}}_$AC(s){let t=ne.get(s.strings);return t===void 0&&ne.set(s.strings,t=new nt(s)),t}T(s){Kt(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let e,i=0;for(const r of s)i===t.length?t.push(e=new it(this.k(tt()),this.k(tt()),this,this.options)):e=t[i],e._$AI(r),i++;i<t.length&&(this._$AR(e&&e._$AB.nextSibling,i),t.length=i)}_$AR(s=this._$AA.nextSibling,t){var e;for((e=this._$AP)===null||e===void 0||e.call(this,!1,!0,t);s&&s!==this._$AB;){const i=s.nextSibling;s.remove(),s=i}}setConnected(s){var t;this._$AM===void 0&&(this._$Cp=s,(t=this._$AP)===null||t===void 0||t.call(this,s))}}class vt{constructor(s,t,e,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=s,this.name=t,this._$AM=i,this.options=r,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(s,t=this,e,i){const r=this.strings;let o=!1;if(r===void 0)s=K(this,s,t,0),o=!et(s)||s!==this._$AH&&s!==X,o&&(this._$AH=s);else{const l=s;let u,d;for(s=r[0],u=0;u<r.length-1;u++)d=K(this,l[e+u],t,u),d===X&&(d=this._$AH[u]),o||(o=!et(d)||d!==this._$AH[u]),d===x?s=x:s!==x&&(s+=(d??"")+r[u+1]),this._$AH[u]=d}o&&!i&&this.j(s)}j(s){s===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,s??"")}}class Re extends vt{constructor(){super(...arguments),this.type=3}j(s){this.element[this.name]=s===x?void 0:s}}const Ne=q?q.emptyScript:"";class Le extends vt{constructor(){super(...arguments),this.type=4}j(s){s&&s!==x?this.element.setAttribute(this.name,Ne):this.element.removeAttribute(this.name)}}class Pe extends vt{constructor(s,t,e,i,r){super(s,t,e,i,r),this.type=5}_$AI(s,t=this){var e;if((s=(e=K(this,s,t,0))!==null&&e!==void 0?e:x)===X)return;const i=this._$AH,r=s===x&&i!==x||s.capture!==i.capture||s.once!==i.once||s.passive!==i.passive,o=s!==x&&(i===x||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,s),this._$AH=s}handleEvent(s){var t,e;typeof this._$AH=="function"?this._$AH.call((e=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&e!==void 0?e:this.element,s):this._$AH.handleEvent(s)}}class He{constructor(s,t,e){this.element=s,this.type=6,this._$AN=void 0,this._$AM=t,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(s){K(this,s)}}const ie=ft.litHtmlPolyfillSupport;ie==null||ie(nt,it),((Tt=ft.litHtmlVersions)!==null&&Tt!==void 0?Tt:ft.litHtmlVersions=[]).push("2.7.4");const Ue=(n,s,t)=>{var e,i;const r=(e=t==null?void 0:t.renderBefore)!==null&&e!==void 0?e:s;let o=r._$litPart$;if(o===void 0){const l=(i=t==null?void 0:t.renderBefore)!==null&&i!==void 0?i:null;r._$litPart$=o=new it(s.insertBefore(tt(),l),l,void 0,t??{})}return o._$AI(n),o};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Qt=/'/g,te=/"/g,ee=/^(?:script|style|textarea|title)$/i,Oe=n=>(s,...t)=>({_$litType$:n,strings:s,values:t}),se=Oe(1),X=Symbol.for("lit-noChange"),x=Symbol.for("lit-nothing"),ne=new WeakMap,G=B.createTreeWalker(B,129,null,!1),je=(n,s)=>{const t=n.length-1,e=[];let i,r=s===2?"<svg>":"",o=st;for(let u=0;u<t;u++){const d=n[u];let T,y,$=-1,O=0;for(;O<d.length&&(o.lastIndex=O,y=o.exec(d),y!==null);)O=o.lastIndex,o===st?y[1]==="!--"?o=Yt:y[1]!==void 0?o=Zt:y[2]!==void 0?(ee.test(y[2])&&(i=RegExp("</"+y[2],"g")),o=W):y[3]!==void 0&&(o=W):o===W?y[0]===">"?(o=i??st,$=-1):y[1]===void 0?$=-2:($=o.lastIndex-y[2].length,T=y[1],o=y[3]===void 0?W:y[3]==='"'?te:Qt):o===te||o===Qt?o=W:o===Yt||o===Zt?o=st:(o=W,i=void 0);const Y=o===W&&n[u+1].startsWith("/>")?" ":"";r+=o===st?d+Se:$>=0?(e.push(T),d.slice(0,$)+kt+d.slice($)+z+Y):d+z+($===-2?(e.push(void 0),u):Y)}const l=r+(n[t]||"<?>")+(s===2?"</svg>":"");if(!Array.isArray(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return[qt!==void 0?qt.createHTML(l):l,e]};class nt{constructor({strings:s,_$litType$:t},e){let i;this.parts=[];let r=0,o=0;const l=s.length-1,u=this.parts,[d,T]=je(s,t);if(this.el=nt.createElement(d,e),G.currentNode=this.el.content,t===2){const y=this.el.content,$=y.firstChild;$.remove(),y.append(...$.childNodes)}for(;(i=G.nextNode())!==null&&u.length<l;){if(i.nodeType===1){if(i.hasAttributes()){const y=[];for(const $ of i.getAttributeNames())if($.endsWith(kt)||$.startsWith(z)){const O=T[o++];if(y.push($),O!==void 0){const Y=i.getAttribute(O.toLowerCase()+kt).split(z),I=/([.?@])?(.*)/.exec(O);u.push({type:1,index:r,name:I[2],strings:Y,ctor:I[1]==="."?Re:I[1]==="?"?Le:I[1]==="@"?Pe:vt})}else u.push({type:6,index:r})}for(const $ of y)i.removeAttribute($)}if(ee.test(i.tagName)){const y=i.textContent.split(z),$=y.length-1;if($>0){i.textContent=q?q.emptyScript:"";for(let O=0;O<$;O++)i.append(y[O],tt()),G.nextNode(),u.push({type:2,index:++r});i.append(y[$],tt())}}}else if(i.nodeType===8)if(i.data===Xt)u.push({type:2,index:r});else{let y=-1;for(;(y=i.data.indexOf(z,y+1))!==-1;)u.push({type:7,index:r}),y+=z.length-1}r++}}static createElement(s,t){const e=B.createElement("template");return e.innerHTML=s,e}}function K(n,s,t=n,e){var i,r,o,l;if(s===X)return s;let u=e!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[e]:t._$Cl;const d=et(s)?void 0:s._$litDirective$;return(u==null?void 0:u.constructor)!==d&&((r=u==null?void 0:u._$AO)===null||r===void 0||r.call(u,!1),d===void 0?u=void 0:(u=new d(n),u._$AT(n,t,e)),e!==void 0?((o=(l=t)._$Co)!==null&&o!==void 0?o:l._$Co=[])[e]=u:t._$Cl=u),u!==void 0&&(s=K(n,u._$AS(n,s.values),u,e)),s}class Me{constructor(s,t){this._$AV=[],this._$AN=void 0,this._$AD=s,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(s){var t;const{el:{content:e},parts:i}=this._$AD,r=((t=s==null?void 0:s.creationScope)!==null&&t!==void 0?t:B).importNode(e,!0);G.currentNode=r;let o=G.nextNode(),l=0,u=0,d=i[0];for(;d!==void 0;){if(l===d.index){let T;d.type===2?T=new it(o,o.nextSibling,this,s):d.type===1?T=new d.ctor(o,d.name,d.strings,this,s):d.type===6&&(T=new He(o,this,s)),this._$AV.push(T),d=i[++u]}l!==(d==null?void 0:d.index)&&(o=G.nextNode(),l++)}return G.currentNode=B,r}v(s){let t=0;for(const e of this._$AV)e!==void 0&&(e.strings!==void 0?(e._$AI(s,e,t),t+=e.strings.length-2):e._$AI(s[t])),t++}}class it{constructor(s,t,e,i){var r;this.type=2,this._$AH=x,this._$AN=void 0,this._$AA=s,this._$AB=t,this._$AM=e,this.options=i,this._$Cp=(r=i==null?void 0:i.isConnected)===null||r===void 0||r}get _$AU(){var s,t;return(t=(s=this._$AM)===null||s===void 0?void 0:s._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let s=this._$AA.parentNode;const t=this._$AM;return t!==void 0&&(s==null?void 0:s.nodeType)===11&&(s=t.parentNode),s}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(s,t=this){s=K(this,s,t),et(s)?s===x||s==null||s===""?(this._$AH!==x&&this._$AR(),this._$AH=x):s!==this._$AH&&s!==X&&this._(s):s._$litType$!==void 0?this.g(s):s.nodeType!==void 0?this.$(s):xe(s)?this.T(s):this._(s)}k(s){return this._$AA.parentNode.insertBefore(s,this._$AB)}$(s){this._$AH!==s&&(this._$AR(),this._$AH=this.k(s))}_(s){this._$AH!==x&&et(this._$AH)?this._$AA.nextSibling.data=s:this.$(B.createTextNode(s)),this._$AH=s}g(s){var t;const{values:e,_$litType$:i}=s,r=typeof i=="number"?this._$AC(s):(i.el===void 0&&(i.el=nt.createElement(i.h,this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===r)this._$AH.v(e);else{const o=new Me(r,this),l=o.u(this.options);o.v(e),this.$(l),this._$AH=o}}_$AC(s){let t=ne.get(s.strings);return t===void 0&&ne.set(s.strings,t=new nt(s)),t}T(s){Kt(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let e,i=0;for(const r of s)i===t.length?t.push(e=new it(this.k(tt()),this.k(tt()),this,this.options)):e=t[i],e._$AI(r),i++;i<t.length&&(this._$AR(e&&e._$AB.nextSibling,i),t.length=i)}_$AR(s=this._$AA.nextSibling,t){var e;for((e=this._$AP)===null||e===void 0||e.call(this,!1,!0,t);s&&s!==this._$AB;){const i=s.nextSibling;s.remove(),s=i}}setConnected(s){var t;this._$AM===void 0&&(this._$Cp=s,(t=this._$AP)===null||t===void 0||t.call(this,s))}}class vt{constructor(s,t,e,i,r){this.type=1,this._$AH=x,this._$AN=void 0,this.element=s,this.name=t,this._$AM=i,this.options=r,e.length>2||e[0]!==""||e[1]!==""?(this._$AH=Array(e.length-1).fill(new String),this.strings=e):this._$AH=x}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(s,t=this,e,i){const r=this.strings;let o=!1;if(r===void 0)s=K(this,s,t,0),o=!et(s)||s!==this._$AH&&s!==X,o&&(this._$AH=s);else{const l=s;let u,d;for(s=r[0],u=0;u<r.length-1;u++)d=K(this,l[e+u],t,u),d===X&&(d=this._$AH[u]),o||(o=!et(d)||d!==this._$AH[u]),d===x?s=x:s!==x&&(s+=(d??"")+r[u+1]),this._$AH[u]=d}o&&!i&&this.j(s)}j(s){s===x?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,s??"")}}class Re extends vt{constructor(){super(...arguments),this.type=3}j(s){this.element[this.name]=s===x?void 0:s}}const Ne=q?q.emptyScript:"";class Le extends vt{constructor(){super(...arguments),this.type=4}j(s){s&&s!==x?this.element.setAttribute(this.name,Ne):this.element.removeAttribute(this.name)}}class Pe extends vt{constructor(s,t,e,i,r){super(s,t,e,i,r),this.type=5}_$AI(s,t=this){var e;if((s=(e=K(this,s,t,0))!==null&&e!==void 0?e:x)===X)return;const i=this._$AH,r=s===x&&i!==x||s.capture!==i.capture||s.once!==i.once||s.passive!==i.passive,o=s!==x&&(i===x||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,s),this._$AH=s}handleEvent(s){var t,e;typeof this._$AH=="function"?this._$AH.call((e=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&e!==void 0?e:this.element,s):this._$AH.handleEvent(s)}}class He{constructor(s,t,e){this.element=s,this.type=6,this._$AN=void 0,this._$AM=t,this.options=e}get _$AU(){return this._$AM._$AU}_$AI(s){K(this,s)}}const ie=ft.litHtmlPolyfillSupport;ie==null||ie(nt,it),((Tt=ft.litHtmlVersions)!==null&&Tt!==void 0?Tt:ft.litHtmlVersions=[]).push("2.7.4");const Ue=(n,s,t)=>{var e,i;const r=(e=t==null?void 0:t.renderBefore)!==null&&e!==void 0?e:s;let o=r._$litPart$;if(o===void 0){const l=(i=t==null?void 0:t.renderBefore)!==null&&i!==void 0?i:null;r._$litPart$=o=new it(s.insertBefore(tt(),l),l,void 0,t??{})}return o._$AI(n),o};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
@@ -32,7 +32,7 @@
32
32
  * @license
33
33
  * Copyright 2021 Google LLC
34
34
  * SPDX-License-Identifier: BSD-3-Clause
35
- */var Mt;((Mt=window.HTMLSlotElement)===null||Mt===void 0?void 0:Mt.prototype.assignedElements)!=null;const{isArray:Ve}=Array,Je=Object.keys,ot=n=>{if(!n)return n;if(Ve(n)){const s=[],t=n.length;for(let e=0;e<t;e++)s.push(ot(n[e]));return s}else if(typeof n=="object"){const s=Je(n),t=s.length,e={};for(let i=0;i<t;i++){const r=s[i];e[r]=ot(n[r])}return e}return n};class L{constructor(s){g(this,"path");g(this,"from");this.path=s}}const ze=/~1/g,Be=/~0/g,We=/~/g,Ge=/\//g;function Fe(n){return n.indexOf("~")===-1?n:n.replace(ze,"/").replace(Be,"~")}function qe(n){return n.indexOf("/")===-1&&n.indexOf("~")===-1?n:n.replace(We,"~0").replace(Ge,"~1")}function Xe(n){return n?n.slice(1).split("/").map(Fe):[]}function E(n){return Ke(n)?"":"/"+n.map(s=>qe(String(s))).join("/")}const w=n=>typeof n=="string"?Xe(n):n,Ke=n=>!n.length,Ye=Object.prototype.hasOwnProperty;function Ze(n,s){return Ye.call(n,s)}const{isArray:ae}=Array,C=(n,s)=>{const t=s.length;if(!t)return{val:n};let e,i;for(let o=0;o<t;o++)if(e=n,i=s[o],ae(e)){const l=e.length;if(i==="-")i=l;else if(typeof i=="string"){const u=~~i;if(""+u!==i)throw new Error("INVALID_INDEX");if(i=u,i<0)throw new Error("INVALID_INDEX")}n=e[i]}else if(typeof e=="object"&&e)n=Ze(e,i)?e[i]:void 0;else throw new Error("NOT_FOUND");return{val:n,obj:e,key:i}},at=n=>ae(n.obj)&&typeof n.key=="number",gt=n=>typeof n.obj=="object"&&typeof n.key=="string";class Rt extends L{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"add"}code(){return 0}apply(t){const{val:e,key:i,obj:r}=C(t,this.path),o=ot(this.value);if(!r)t=o;else if(typeof i=="string")r[i]=o;else{const l=r.length;if(i<l)r.splice(i,0,o);else{if(i>l)throw new Error("INVALID_INDEX");r.push(o)}}return{doc:t,old:e}}toJson(t){return{op:"add",path:E(this.path),value:this.value}}toCompact(t,e){return[e?"add":0,this.path,this.value]}encode(t){t.encodeArrayHeader(3),t.writer.u8(0),t.encodeArray(this.path),t.encodeAny(this.value)}}class he extends L{constructor(t,e){super(t);g(this,"oldValue");this.oldValue=e}op(){return"remove"}code(){return 1}apply(t){const e=C(t,this.path);if(e.val===void 0)throw new Error("NOT_FOUND");return gt(e)?delete e.obj[e.key]:at(e)?e.val!==void 0&&e.obj.splice(e.key,1):t=null,{doc:t,old:e.val}}toJson(t){const e={op:"remove",path:E(this.path)};return this.oldValue!==void 0&&(e.oldValue=this.oldValue),e}toCompact(t,e){const i=e?"remove":1;return this.oldValue===void 0?[i,this.path]:[i,this.path,this.oldValue]}encode(t,e){const i=this.oldValue!==void 0;t.encodeArrayHeader(i?3:2),t.writer.u8(1),t.encodeArray(this.path),i&&t.encodeAny(this.oldValue)}}class Qe extends L{constructor(t,e,i){super(t);g(this,"value");g(this,"oldValue");this.value=e,this.oldValue=i}op(){return"replace"}code(){return 2}apply(t){const e=C(t,this.path);if(e.val===void 0)throw new Error("NOT_FOUND");return gt(e)?e.obj[e.key]=this.value:at(e)?e.obj[e.key]=this.value:t=this.value,{doc:t,old:e.val}}toJson(t){const e={op:"replace",path:E(this.path),value:this.value};return this.oldValue!==void 0&&(e.oldValue=this.oldValue),e}toCompact(t,e){const i=e?"replace":2;return this.oldValue===void 0?[i,this.path,this.value]:[i,this.path,this.value,this.oldValue]}encode(t,e){const i=this.oldValue!==void 0;t.encodeArrayHeader(i?4:3),t.writer.u8(2),t.encodeArray(this.path),t.encodeAny(this.value),i&&t.encodeAny(this.oldValue)}}class ts extends L{constructor(t,e){super(t);g(this,"from");this.from=e}op(){return"move"}code(){return 4}apply(t){const e=new he(w(this.from),void 0).apply(t);return new Rt(this.path,e.old).apply(e.doc)}toJson(t){return{op:"move",path:E(this.path),from:E(this.from)}}toCompact(t,e){return[e?"move":4,this.path,this.from]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(4),t.encodeArray(this.path),t.encodeArray(this.from)}}class es extends L{constructor(t,e){super(t);g(this,"from");this.from=e}op(){return"copy"}code(){return 3}apply(t){const{val:e}=C(t,this.from);if(e===void 0)throw new Error("NOT_FOUND");return new Rt(this.path,ot(e)).apply(t)}toJson(t){return{op:"copy",path:E(this.path),from:E(this.from)}}toCompact(t,e){return[e?"copy":3,this.path,this.from]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(3),t.encodeArray(this.path),t.encodeArray(this.from)}}class N extends L{apply(s){if(!this.test(s))throw new Error("TEST");return{doc:s}}}const yt=(n,s)=>{if(n===s)return!0;if(n&&s&&typeof n=="object"&&typeof s=="object"){if(n.constructor!==s.constructor)return!1;let t,e,i;if(Array.isArray(n)){if(t=n.length,t!==s.length)return!1;for(e=t;e--!==0;)if(!yt(n[e],s[e]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(s).length)return!1;for(e=t;e--!==0;){const r=i[e];if(!yt(n[r],s[r]))return!1}return!0}return!1};class ss extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"not");this.value=e,this.not=i}op(){return"test"}code(){return 5}test(t){const{val:e}=C(t,this.path);if(e===void 0)return!!this.not;const i=yt(e,this.value);return this.not?!i:i}toJson(t){const e={op:"test",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.not&&(e.not=this.not),e}toCompact(t,e){const i=t?this.path.slice(t.path.length):this.path,r=e?"test":5;return this.not?[r,i,this.value,1]:[r,i,this.value]}encode(t,e){t.encodeArrayHeader(this.not?4:3),t.writer.u8(5),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeAny(this.value),this.not&&t.writer.u8(1)}}class ns extends L{constructor(s){super(s)}op(){return"flip"}code(){return 8}apply(s){const t=C(s,this.path);return t.obj?t.obj[t.key]=!t.val:s=!t.val,{doc:s,old:t.val}}toJson(s){return{op:"flip",path:E(this.path)}}toCompact(s,t){return[t?"flip":8,this.path]}encode(s,t){s.encodeArrayHeader(2),s.writer.u8(8),s.encodeArray(this.path)}}class is extends L{constructor(t,e){super(t);g(this,"inc");this.inc=e}op(){return"inc"}code(){return 9}apply(t){const e=C(t,this.path),i=this.inc+Number(e.val);return e.obj?e.obj[e.key]=i:t=i,{doc:t,old:e.val}}toJson(t){return{op:"inc",path:E(this.path),inc:this.inc}}toCompact(t,e){return[e?"inc":9,this.path,this.inc]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(9),t.encodeArray(this.path),t.encodeNumber(this.inc)}}class rs extends L{constructor(t,e,i){super(t);g(this,"pos");g(this,"str");this.pos=e,this.str=i}op(){return"str_ins"}code(){return 6}apply(t){const{val:e,key:i,obj:r}=C(t,this.path);if(typeof e!="string"){if(e!==void 0)throw new Error("NOT_A_STRING");if(this.pos!==0)throw new Error("POS")}const o=typeof e=="string"?e:"",l=Math.min(this.pos,o.length),u=o.slice(0,l),d=o.slice(l),T=u+this.str+d;return r?r[i]=T:t=T,{doc:t,old:e}}toJson(t){return{op:"str_ins",path:E(this.path),pos:this.pos,str:this.str}}toCompact(t,e){return[e?"str_ins":6,this.path,this.pos,this.str]}encode(t,e){t.encodeArrayHeader(4),t.writer.u8(6),t.encodeArray(this.path),t.encodeNumber(this.pos),t.encodeString(this.str)}}class os extends L{constructor(t,e,i,r){super(t);g(this,"pos");g(this,"str");g(this,"len");this.pos=e,this.str=i,this.len=r}op(){return"str_del"}code(){return 7}deleteLength(){return typeof this.str=="string"?this.str.length:this.len}apply(t){const{val:e,key:i,obj:r}=C(t,this.path);if(typeof e!="string")throw new Error("NOT_A_STRING");const o=e.length,l=Math.min(this.pos,e.length),u=Math.min(l,o),d=this.str!==void 0?this.str.length:this.len,T=Math.min(l+d,o),y=e.slice(0,u),$=e.substr(T),O=y+$;return r?r[i]=O:t=O,{doc:t,old:e}}toJson(t){return typeof this.str=="string"?{op:"str_del",path:E(this.path),pos:this.pos,str:this.str}:{op:"str_del",path:E(this.path),pos:this.pos,len:this.len}}toCompact(t,e){const i=e?"str_del":7;return typeof this.str=="string"?[i,this.path,this.pos,this.str]:[i,this.path,this.pos,0,this.len]}encode(t,e){const i=typeof this.str=="string";t.encodeArrayHeader(i?4:5),t.writer.u8(7),t.encodeArray(this.path),t.encodeNumber(this.pos),i?t.encodeString(this.str):(t.writer.u8(0),t.encodeNumber(this.len))}}const{isArray:as}=Array,Nt=n=>!!n&&typeof n=="object"&&typeof n.text=="string",Lt=n=>!!n&&typeof n=="object"&&as(n.children),hs=(n,s)=>{const t=new RegExp(n,s?"i":void 0);return e=>t.test(e)};class ls extends L{constructor(t,e,i){super(t);g(this,"pos");g(this,"props");this.pos=e,this.props=i}op(){return"split"}code(){return 10}apply(t){const e=C(t,this.path);if(e.val===void 0)throw new Error("NOT_FOUND");const i=this.split(e.val);return gt(e)?e.obj[e.key]=i:at(e)?(e.obj[e.key]=i[0],e.obj.splice(e.key+1,0,i[1])):t=i,{doc:t,old:e.val}}split(t){if(typeof t=="string"){const{pos:e,props:i}=this,r=t.slice(0,e),o=t.slice(e);return i?[{...i,text:r},{...i,text:o}]:[r,o]}else if(Nt(t)){const{pos:e,props:i}=this,r=t.text.slice(0,e),o=t.text.slice(e);return[{...t,...i,text:r},{...t,...i,text:o}]}else if(Lt(t)){const{pos:e,props:i}=this,r=t.children.slice(0,e),o=t.children.slice(e);return[{...t,...i,children:r},{...t,...i,children:o}]}else if(typeof t=="number"){const{pos:e}=this;return[e,t-e]}else return[t,t]}toJson(t){const e={op:"split",path:E(this.path),pos:this.pos};return this.props&&(e.props=this.props),e}toCompact(t,e){const i=e?"split":10;return this.props?[i,this.path,this.pos,this.props]:[i,this.path,this.pos]}encode(t,e){t.encodeArrayHeader(this.props?4:3),t.writer.u8(10),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeObject(this.props)}}class cs extends L{constructor(t,e,i){super(t);g(this,"pos");g(this,"props");this.pos=e,this.props=i}op(){return"merge"}code(){return 11}apply(t){const e=C(t,this.path);if(!at(e))throw new Error("INVALID_TARGET");if(e.key<=0)throw new Error("INVALID_KEY");const i=e.obj[e.key-1],r=e.obj[e.key],o=this.merge(i,r);return e.obj[e.key-1]=o,e.obj.splice(e.key,1),{doc:t,old:[i,r]}}merge(t,e){return typeof t=="string"&&typeof e=="string"||typeof t=="number"&&typeof e=="number"?t+e:Nt(t)&&Nt(e)?{...t,...e,text:t.text+e.text}:Lt(t)&&Lt(e)?{...t,...e,children:[...t.children,...e.children]}:[t,e]}toJson(t){const e={op:"merge",path:E(this.path),pos:this.pos};return this.props&&(e.props=this.props),e}toCompact(t,e){const i=e?"merge":11;return this.props?[i,this.path,this.pos,this.props]:[i,this.path,this.pos]}encode(t,e){t.encodeArrayHeader(this.props?4:3),t.writer.u8(11),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeAny(this.props)}}const{isArray:us}=Array;class ps extends L{constructor(t,e,i){super(t);g(this,"props");g(this,"deleteNull");this.props=e,this.deleteNull=i}op(){return"extend"}code(){return 12}apply(t){const e=C(t,this.path);return at(e)?e.val!==void 0&&(e.obj[e.key]=this.extend(e.val)):gt(e)?e.obj[e.key]=this.extend(e.val):t=this.extend(t),{doc:t}}extend(t){if(us(t)||typeof t!="object"||!t)return t;for(const[e,i]of Object.entries(this.props)){if(e==="__proto__")throw new Error("NO_PROTO");if(i===null&&this.deleteNull){delete t[e];continue}t[e]=i}return t}toJson(t){const e={op:"extend",path:E(this.path),props:this.props};return this.deleteNull&&(e.deleteNull=this.deleteNull),e}toCompact(t,e){const i=e?"extend":12;return this.deleteNull?[i,this.path,this.props,1]:[i,this.path,this.props]}encode(t,e){const{deleteNull:i}=this;t.encodeArrayHeader(i?4:3),t.writer.u8(12),t.encodeArray(this.path),t.encodeObject(this.props),i&&t.writer.u8(1)}}class ds extends N{constructor(s){super(s)}op(){return"defined"}code(){return 31}test(s){const{val:t}=C(s,this.path);return t!==void 0}toJson(s){return{op:"defined",path:E(s?this.path.slice(s.path.length):this.path)}}toCompact(s,t){return[t?"defined":31,s?this.path.slice(s.path.length):this.path]}encode(s,t){s.encodeArrayHeader(2),s.writer.u8(31),s.encodeArray(t?this.path.slice(t.path.length):this.path)}}class fs extends N{constructor(s){super(s)}op(){return"undefined"}code(){return 38}test(s){try{const{val:t}=C(s,this.path);return t===void 0}catch(t){if(t.message==="NOT_FOUND")return!0;throw t}}toJson(s){return{op:"undefined",path:E(s?this.path.slice(s.path.length):this.path)}}toCompact(s,t){return[t?"undefined":38,s?this.path.slice(s.path.length):this.path]}encode(s,t){s.encodeArrayHeader(2),s.writer.u8(38),s.encodeArray(t?this.path.slice(t.path.length):this.path)}}const{isArray:vs}=Array;class gs extends N{constructor(t,e){super(t);g(this,"type");this.type=e}op(){return"test_type"}code(){return 39}test(t){const{val:e}=C(t,this.path);return e===null?this.type.indexOf("null")>-1:vs(e)?this.type.indexOf("array")>-1:this.type.indexOf(typeof e)>-1||typeof e=="number"&&e===Math.round(e)&&this.type.indexOf("integer")>-1}toJson(t){return{op:"test_type",path:E(t?this.path.slice(t.path.length):this.path),type:this.type}}toCompact(t,e){return[e?"test_type":39,t?this.path.slice(t.path.length):this.path,this.type]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(39),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeArray(this.type)}}class ys extends N{constructor(t,e,i,r){super(t);g(this,"pos");g(this,"str");g(this,"not");this.pos=e,this.str=i,this.not=r}op(){return"test_string"}code(){return 40}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=e.length,r=Math.min(this.pos,i),o=Math.min(this.pos+this.str.length,i),l=e.substring(r,o)===this.str;return this.not?!l:l}toJson(t){const e={op:"test_string",path:E(t?this.path.slice(t.path.length):this.path),pos:this.pos,str:this.str};return this.not&&(e.not=this.not),e}toCompact(t,e){const i=e?"test_string":40,r=t?this.path.slice(t.path.length):this.path;return this.not?[i,r,this.pos,this.str,1]:[i,r,this.pos,this.str]}encode(t,e){t.encodeArrayHeader(this.not?5:4),t.writer.u8(40),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.pos),t.encodeString(this.str),this.not&&t.writer.u8(1)}}class ms extends N{constructor(t,e,i){super(t);g(this,"len");g(this,"not");this.len=e,this.not=i}op(){return"test_string_len"}code(){return 41}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const r=e.length>=this.len;return this.not?!r:r}toJson(t){const e={op:"test_string_len",path:E(t?this.path.slice(t.path.length):this.path),len:this.len};return this.not&&(e.not=this.not),e}toCompact(t,e){const i=e?"test_string_len":41,r=t?this.path.slice(t.path.length):this.path;return this.not?[i,r,this.len,1]:[i,r,this.len]}encode(t,e){t.encodeArrayHeader(this.not?4:3),t.writer.u8(41),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.len),this.not&&t.writer.u8(1)}}class _s extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"ignore_case");this.value=e,this.ignore_case=i}op(){return"contains"}code(){return 30}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=this.ignore_case?e.toLowerCase():e,r=this.ignore_case?this.value.toLowerCase():this.value;return i.indexOf(r)>-1}toJson(t){const e={op:"contains",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"contains":30;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(30),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}class ws extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"ignore_case");this.value=e,this.ignore_case=i}op(){return"ends"}code(){return 32}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=this.ignore_case?e.toLowerCase():e,r=this.ignore_case?this.value.toLowerCase():this.value;return i.endsWith(r)}toJson(t){const e={op:"ends",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"ends":32;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(32),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}class Es extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"ignore_case");this.value=e,this.ignore_case=i}op(){return"starts"}code(){return 37}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=this.ignore_case?e.toLowerCase():e,r=this.ignore_case?this.value.toLowerCase():this.value;return i.startsWith(r)}toJson(t){const e={op:"starts",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"starts":37;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(37),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}class bs extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"in"}code(){return 33}test(t){const{val:e}=C(t,this.path);for(const i of this.value)if(yt(e,i))return!0;return!1}toJson(t){return{op:"in",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"in":33,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(33),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeArray(this.value)}}class As extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"less"}code(){return 34}test(t){const{val:e}=C(t,this.path);return typeof e!="number"?!1:e<this.value}toJson(t){return{op:"less",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"less":34,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(34),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.value)}}class $s extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"more"}code(){return 36}test(t){const{val:e}=C(t,this.path);return typeof e!="number"?!1:e>this.value}toJson(t){return{op:"more",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"more":36,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(36),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.value)}}class Pt extends N{constructor(t,e){super(t);g(this,"ops");this.ops=e}}class Cs extends Pt{constructor(t,e){super(t,e);g(this,"ops");this.ops=e}op(){return"and"}code(){return 43}test(t){for(const e of this.ops)if(!e.test(t))return!1;return!0}toJson(t){return{op:"and",path:E(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(i=>i.toJson(this))}}toCompact(t,e){return[e?"and":43,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,e))]}encode(t,e){const i=e?this.path.slice(e.path.length):this.path;t.encodeArrayHeader(3),t.writer.u8(43),t.encodeArray(i);const r=this.ops.length;t.encodeArrayHeader(r);for(let o=0;o<r;o++)this.ops[o].encode(t,this)}}class Ts extends Pt{constructor(t,e){super(t,e);g(this,"ops");this.ops=e}op(){return"or"}code(){return 45}test(t){for(const e of this.ops)if(e.test(t))return!0;return!1}toJson(t){return{op:"or",path:E(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(i=>i.toJson(this))}}toCompact(t,e){return[e?"or":45,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,e))]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(45),t.encodeArray(e?this.path.slice(e.path.length):this.path);const i=this.ops.length;t.encodeArrayHeader(i);for(let r=0;r<i;r++)this.ops[r].encode(t,this)}}class ks extends Pt{constructor(t,e){super(t,e);g(this,"ops");this.ops=e}op(){return"not"}code(){return 44}test(t){for(const e of this.ops)if(e.test(t))return!1;return!0}toJson(t){return{op:"not",path:E(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(i=>i.toJson(this))}}toCompact(t,e){return[e?"not":44,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,e))]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(44),t.encodeArray(e?this.path.slice(e.path.length):this.path);const i=this.ops.length;t.encodeArrayHeader(i);for(let r=0;r<i;r++)this.ops[r].encode(t,this)}}class Ss extends N{constructor(t,e,i,r){super(t);g(this,"value");g(this,"ignore_case");g(this,"matcher");this.value=e,this.ignore_case=i,this.matcher=r(e,i)}op(){return"matches"}code(){return 35}test(t){const{val:e}=C(t,this.path);return typeof e!="string"?!1:this.matcher(e)}toJson(t){const e={op:"matches",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"matches":35;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(35),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}const{isArray:xs}=Array;class Os extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"type"}code(){return 42}test(t){const{val:e}=C(t,this.path);return e===null?this.value==="null":xs(e)?this.value==="array":typeof e===this.value||typeof e=="number"&&e===Math.round(e)&&this.value==="integer"}toJson(t){return{op:"type",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"type":42,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(42),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value)}}const js=(n,s)=>{switch(n.op){case"add":return new Rt(w(n.path),n.value);case"remove":return new he(w(n.path),n.oldValue);case"replace":return new Qe(w(n.path),n.value,n.oldValue);case"move":return new ts(w(n.path),w(n.from));case"copy":return new es(w(n.path),w(n.from));case"flip":return new ns(w(n.path));case"inc":return new is(w(n.path),n.inc);case"str_ins":return new rs(w(n.path),n.pos,n.str);case"str_del":return new os(w(n.path),n.pos,n.str,n.len);case"split":return new ls(w(n.path),n.pos,n.props||null);case"merge":return new cs(w(n.path),n.pos,n.props||null);case"extend":return new ps(w(n.path),n.props,!!n.deleteNull);default:return mt(n,s)}},mt=(n,s)=>{switch(n.op){case"test":return new ss(w(n.path),n.value,!!n.not);case"defined":return new ds(w(n.path));case"undefined":return new fs(w(n.path));case"type":return new Os(w(n.path),n.value);case"test_type":return new gs(w(n.path),n.type);case"test_string":return new ys(w(n.path),n.pos,n.str,!!n.not);case"test_string_len":return new ms(w(n.path),n.len,!!n.not);case"contains":return new _s(w(n.path),n.value,!!n.ignore_case);case"ends":return new ws(w(n.path),n.value,!!n.ignore_case);case"starts":return new Es(w(n.path),n.value,!!n.ignore_case);case"matches":return new Ss(w(n.path),n.value,!!n.ignore_case,s.createMatcher||hs);case"in":return new bs(w(n.path),n.value);case"less":return new As(w(n.path),n.value);case"more":return new $s(w(n.path),n.value);case"and":{const t=w(n.path);return new Cs(t,n.apply.map(e=>mt({...e,path:[...t,...w(e.path)]},s)))}case"or":{const t=w(n.path);return new Ts(t,n.apply.map(e=>mt({...e,path:[...t,...w(e.path)]},s)))}case"not":{const t=w(n.path);return new ks(t,n.apply.map(e=>mt({...e,path:[...t,...w(e.path)]},s)))}default:throw new Error("OP_UNKNOWN")}};function Ms(n,s,t){t.mutate||(n=ot(n));const e=[],i=s.length;for(let r=0;r<i;r++){const l=js(s[r],t).apply(n);n=l.doc,e.push(l)}return{doc:n,res:e}}var ht=n=>typeof n=="function"?n:function(){return n},Rs=typeof self<"u"?self:null,lt=typeof window<"u"?window:null,ct=Rs||lt||ct,Ns="2.0.0",H={connecting:0,open:1,closing:2,closed:3},Ls=1e4,Ps=1e3,P={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},D={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ht={longpoll:"longpoll",websocket:"websocket"},Hs={complete:4},_t=class{constructor(n,s,t,e){this.channel=n,this.event=s,this.payload=t||function(){return{}},this.receivedResp=null,this.timeout=e,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(n){this.timeout=n,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(n,s){return this.hasReceived(n)&&s(this.receivedResp.response),this.recHooks.push({status:n,callback:s}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:n,response:s,_ref:t}){this.recHooks.filter(e=>e.status===n).forEach(e=>e.callback(s))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,n=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=n,this.matchReceive(n)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(n){return this.receivedResp&&this.receivedResp.status===n}trigger(n,s){this.channel.trigger(this.refEvent,{status:n,response:s})}},le=class{constructor(n,s){this.callback=n,this.timerCalc=s,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Us=class{constructor(n,s,t){this.state=P.closed,this.topic=n,this.params=ht(s||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new _t(this,D.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new le(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=P.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=P.closed,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new _t(this,D.leave,ht({}),this.timeout).send(),this.state=P.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(D.reply,(e,i)=>{this.trigger(this.replyEventName(i),e)})}join(n=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=n,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(n){this.on(D.close,n)}onError(n){return this.on(D.error,s=>n(s))}on(n,s){let t=this.bindingRef++;return this.bindings.push({event:n,ref:t,callback:s}),t}off(n,s){this.bindings=this.bindings.filter(t=>!(t.event===n&&(typeof s>"u"||s===t.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(n,s,t=this.timeout){if(s=s||{},!this.joinedOnce)throw new Error(`tried to push '${n}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let e=new _t(this,n,function(){return s},t);return this.canPush()?e.send():(e.startTimeout(),this.pushBuffer.push(e)),e}leave(n=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=P.leaving;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(D.close,"leave")},t=new _t(this,D.leave,ht({}),n);return t.receive("ok",()=>s()).receive("timeout",()=>s()),t.send(),this.canPush()||t.trigger("ok",{}),t}onMessage(n,s,t){return s}isMember(n,s,t,e){return this.topic!==n?!1:e&&e!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:n,event:s,payload:t,joinRef:e}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(n=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=P.joining,this.joinPush.resend(n))}trigger(n,s,t,e){let i=this.onMessage(n,s,t,e);if(s&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===n);for(let o=0;o<r.length;o++)r[o].callback(i,t,e||this.joinRef())}replyEventName(n){return`chan_reply_${n}`}isClosed(){return this.state===P.closed}isErrored(){return this.state===P.errored}isJoined(){return this.state===P.joined}isJoining(){return this.state===P.joining}isLeaving(){return this.state===P.leaving}},wt=class{static request(n,s,t,e,i,r,o){if(ct.XDomainRequest){let l=new ct.XDomainRequest;return this.xdomainRequest(l,n,s,e,i,r,o)}else{let l=new ct.XMLHttpRequest;return this.xhrRequest(l,n,s,t,e,i,r,o)}}static xdomainRequest(n,s,t,e,i,r,o){return n.timeout=i,n.open(s,t),n.onload=()=>{let l=this.parseJSON(n.responseText);o&&o(l)},r&&(n.ontimeout=r),n.onprogress=()=>{},n.send(e),n}static xhrRequest(n,s,t,e,i,r,o,l){return n.open(s,t,!0),n.timeout=r,n.setRequestHeader("Content-Type",e),n.onerror=()=>l&&l(null),n.onreadystatechange=()=>{if(n.readyState===Hs.complete&&l){let u=this.parseJSON(n.responseText);l(u)}},o&&(n.ontimeout=o),n.send(i),n}static parseJSON(n){if(!n||n==="")return null;try{return JSON.parse(n)}catch{return console&&console.log("failed to parse JSON response",n),null}}static serialize(n,s){let t=[];for(var e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let i=s?`${s}[${e}]`:e,r=n[e];typeof r=="object"?t.push(this.serialize(r,i)):t.push(encodeURIComponent(i)+"="+encodeURIComponent(r))}return t.join("&")}static appendParams(n,s){if(Object.keys(s).length===0)return n;let t=n.match(/\?/)?"&":"?";return`${n}${t}${this.serialize(s)}`}},Ut=class{constructor(n){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(n),this.readyState=H.connecting,this.poll()}normalizeEndpoint(n){return n.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ht.websocket),"$1/"+Ht.longpoll)}endpointURL(){return wt.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(n,s,t){this.close(n,s,t),this.readyState=H.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===H.open||this.readyState===H.connecting}poll(){this.ajax("GET",null,()=>this.ontimeout(),n=>{if(n){var{status:s,token:t,messages:e}=n;this.token=t}else s=0;switch(s){case 200:e.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=H.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(n){this.ajax("POST",n,()=>this.onerror("timeout"),s=>{(!s||s.status!==200)&&(this.onerror(s&&s.status),this.closeAndRetry(1011,"internal server error",!1))})}close(n,s,t){for(let i of this.reqs)i.abort();this.readyState=H.closed;let e=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:n,reason:s,wasClean:t});typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",e)):this.onclose(e)}ajax(n,s,t,e){let i,r=()=>{this.reqs.delete(i),t()};i=wt.request(n,this.endpointURL(),"application/json",s,this.timeout,r,o=>{this.reqs.delete(i),this.isActive()&&e(o)}),this.reqs.add(i)}},Et={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(n,s){if(n.payload.constructor===ArrayBuffer)return s(this.binaryEncode(n));{let t=[n.join_ref,n.ref,n.topic,n.event,n.payload];return s(JSON.stringify(t))}},decode(n,s){if(n.constructor===ArrayBuffer)return s(this.binaryDecode(n));{let[t,e,i,r,o]=JSON.parse(n);return s({join_ref:t,ref:e,topic:i,event:r,payload:o})}},binaryEncode(n){let{join_ref:s,ref:t,event:e,topic:i,payload:r}=n,o=this.META_LENGTH+s.length+t.length+i.length+e.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),u=new DataView(l),d=0;u.setUint8(d++,this.KINDS.push),u.setUint8(d++,s.length),u.setUint8(d++,t.length),u.setUint8(d++,i.length),u.setUint8(d++,e.length),Array.from(s,y=>u.setUint8(d++,y.charCodeAt(0))),Array.from(t,y=>u.setUint8(d++,y.charCodeAt(0))),Array.from(i,y=>u.setUint8(d++,y.charCodeAt(0))),Array.from(e,y=>u.setUint8(d++,y.charCodeAt(0)));var T=new Uint8Array(l.byteLength+r.byteLength);return T.set(new Uint8Array(l),0),T.set(new Uint8Array(r),l.byteLength),T.buffer},binaryDecode(n){let s=new DataView(n),t=s.getUint8(0),e=new TextDecoder;switch(t){case this.KINDS.push:return this.decodePush(n,s,e);case this.KINDS.reply:return this.decodeReply(n,s,e);case this.KINDS.broadcast:return this.decodeBroadcast(n,s,e)}},decodePush(n,s,t){let e=s.getUint8(1),i=s.getUint8(2),r=s.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=t.decode(n.slice(o,o+e));o=o+e;let u=t.decode(n.slice(o,o+i));o=o+i;let d=t.decode(n.slice(o,o+r));o=o+r;let T=n.slice(o,n.byteLength);return{join_ref:l,ref:null,topic:u,event:d,payload:T}},decodeReply(n,s,t){let e=s.getUint8(1),i=s.getUint8(2),r=s.getUint8(3),o=s.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,u=t.decode(n.slice(l,l+e));l=l+e;let d=t.decode(n.slice(l,l+i));l=l+i;let T=t.decode(n.slice(l,l+r));l=l+r;let y=t.decode(n.slice(l,l+o));l=l+o;let $=n.slice(l,n.byteLength),O={status:y,response:$};return{join_ref:u,ref:d,topic:T,event:D.reply,payload:O}},decodeBroadcast(n,s,t){let e=s.getUint8(1),i=s.getUint8(2),r=this.HEADER_LENGTH+2,o=t.decode(n.slice(r,r+e));r=r+e;let l=t.decode(n.slice(r,r+i));r=r+i;let u=n.slice(r,n.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:u}}},Ds=class{constructor(n,s={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=s.timeout||Ls,this.transport=s.transport||ct.WebSocket||Ut,this.establishedConnections=0,this.defaultEncoder=Et.encode.bind(Et),this.defaultDecoder=Et.decode.bind(Et),this.closeWasClean=!1,this.binaryType=s.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ut?(this.encode=s.encode||this.defaultEncoder,this.decode=s.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let t=null;lt&&lt.addEventListener&&(lt.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),t=this.connectClock)}),lt.addEventListener("pageshow",e=>{t===this.connectClock&&(t=null,this.connect())})),this.heartbeatIntervalMs=s.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>s.rejoinAfterMs?s.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>s.reconnectAfterMs?s.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=s.logger||null,this.longpollerTimeout=s.longpollerTimeout||2e4,this.params=ht(s.params||{}),this.endPoint=`${n}/${Ht.websocket}`,this.vsn=s.vsn||Ns,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new le(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Ut}replaceTransport(n){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=n}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let n=wt.appendParams(wt.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return n.charAt(0)!=="/"?n:n.charAt(1)==="/"?`${this.protocol()}:${n}`:`${this.protocol()}://${location.host}${n}`}disconnect(n,s,t){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(n,s,t)}connect(n){n&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ht(n)),!this.conn&&(this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=s=>this.onConnError(s),this.conn.onmessage=s=>this.onConnMessage(s),this.conn.onclose=s=>this.onConnClose(s))}log(n,s,t){this.logger(n,s,t)}hasLogger(){return this.logger!==null}onOpen(n){let s=this.makeRef();return this.stateChangeCallbacks.open.push([s,n]),s}onClose(n){let s=this.makeRef();return this.stateChangeCallbacks.close.push([s,n]),s}onError(n){let s=this.makeRef();return this.stateChangeCallbacks.error.push([s,n]),s}onMessage(n){let s=this.makeRef();return this.stateChangeCallbacks.message.push([s,n]),s}ping(n){if(!this.isConnected())return!1;let s=this.makeRef(),t=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:s});let e=this.onMessage(i=>{i.ref===s&&(this.off([e]),n(Date.now()-t))});return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,n])=>n())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Ps,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(n,s,t){if(!this.conn)return n&&n();this.waitForBufferDone(()=>{this.conn&&(s?this.conn.close(s,t||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),n&&n()})})}waitForBufferDone(n,s=1){if(s===5||!this.conn||!this.conn.bufferedAmount){n();return}setTimeout(()=>{this.waitForBufferDone(n,s+1)},150*s)}waitForSocketClosed(n,s=1){if(s===5||!this.conn||this.conn.readyState===H.closed){n();return}setTimeout(()=>{this.waitForSocketClosed(n,s+1)},150*s)}onConnClose(n){let s=n&&n.code;this.hasLogger()&&this.log("transport","close",n),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&s!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,t])=>t(n))}onConnError(n){this.hasLogger()&&this.log("transport",n);let s=this.transport,t=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,e])=>{e(n,s,t)}),(s===this.transport||t>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(n=>{n.isErrored()||n.isLeaving()||n.isClosed()||n.trigger(D.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case H.connecting:return"connecting";case H.open:return"open";case H.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(n){this.off(n.stateChangeRefs),this.channels=this.channels.filter(s=>s.joinRef()!==n.joinRef())}off(n){for(let s in this.stateChangeCallbacks)this.stateChangeCallbacks[s]=this.stateChangeCallbacks[s].filter(([t])=>n.indexOf(t)===-1)}channel(n,s={}){let t=new Us(n,s,this);return this.channels.push(t),t}push(n){if(this.hasLogger()){let{topic:s,event:t,payload:e,ref:i,join_ref:r}=n;this.log("push",`${s} ${t} (${r}, ${i})`,e)}this.isConnected()?this.encode(n,s=>this.conn.send(s)):this.sendBuffer.push(()=>this.encode(n,s=>this.conn.send(s)))}makeRef(){let n=this.ref+1;return n===this.ref?this.ref=0:this.ref=n,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(n=>n()),this.sendBuffer=[])}onConnMessage(n){this.decode(n.data,s=>{let{topic:t,event:e,payload:i,ref:r,join_ref:o}=s;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${e} ${r&&"("+r+")"||""}`,i);for(let l=0;l<this.channels.length;l++){const u=this.channels[l];u.isMember(t,e,i,o)&&u.trigger(e,i,r,o)}for(let l=0;l<this.stateChangeCallbacks.message.length;l++){let[,u]=this.stateChangeCallbacks.message[l];u(s)}})}leaveOpenTopic(n){let s=this.channels.find(t=>t.topic===n&&(t.isJoined()||t.isJoining()));s&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${n}"`),s.leave())}};class Is{constructor(s){this.connected=!1,this.config=s,this.socket=new Ds(this.config.url,{logger:(t,e,i)=>{console.log(`${t}: ${e}`,i)}}),this.channel=this.socket.channel(this.config.topic,this.config.params),this.eventTarget=new EventTarget}connect(){this.connected||(this.socket.onError(s=>this.emitError("socket error",s)),this.socket.connect(),this.channel.onError(s=>console.log("channel error",s)),this.channel.join().receive("ok",()=>{console.log("joined")}).receive("error",s=>{this.emitError("channel join error",s)}),this.channel.on("state:change",s=>this.handleChange(s)),this.channel.on("state:patch",s=>this.handlePatch(s)),this.connected=!0)}disconnect(){this.channel&&this.channel.leave(),this.socket.disconnect(),this.connected=!1}addEventListener(s,t,e){var i;this.eventTarget.addEventListener(s,t,e),s.startsWith("livestate-")||(i=this.channel)==null||i.on(s,r=>{this.eventTarget.dispatchEvent(new CustomEvent(s,{detail:r}))})}removeEventListener(s,t,e){return this.eventTarget.removeEventListener(s,t,e)}subscribe(s){this.addEventListener("livestate-change",s)}unsubscribe(s){this.removeEventListener("livestate-change",s)}emitError(s,t){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:{kind:s,error:t}}))}handleChange({state:s,version:t}){this.state=s,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}handlePatch({patch:s,version:t}){if(this.eventTarget.dispatchEvent(new CustomEvent("livestate-patch",{detail:{patch:s,version:t}})),t===this.stateVersion+1){const{doc:e,res:i}=Ms(this.state,s,{mutate:!1});this.state=e,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}else this.channel.push("lvs_refresh")}pushEvent(s,t){this.dispatchEvent(new CustomEvent(s,{detail:t}))}dispatchEvent(s){return this.channel.push(`lvs_evt:${s.type}`,s.detail),!0}pushCustomEvent(s){this.dispatchEvent(s)}}const Vs=(n,s,{properties:t,attributes:e,events:i})=>{var r,o;s.liveState!==n&&(n.connect(),t==null||t.forEach(l=>Js(n,s,l)),e==null||e.forEach(l=>zs(n,s,l)),(r=i==null?void 0:i.send)==null||r.forEach(l=>Ws(n,s,l)),(o=i==null?void 0:i.receive)==null||o.forEach(l=>Bs(n,s,l)),s.liveState=n)},Js=(n,s,t)=>{n.addEventListener("livestate-change",({detail:{state:e}})=>{s[t]=e[t]})},zs=(n,s,t)=>{n.addEventListener("livestate-change",({detail:{state:e}})=>{s.setAttribute(t,e[t])})},Bs=(n,s,t)=>{n.addEventListener(t,({detail:e})=>{s.dispatchEvent(new CustomEvent(t,{detail:e}))})},Ws=(n,s,t)=>{s.addEventListener(t,e=>{const{detail:i}=e;n.dispatchEvent(new CustomEvent(t,{detail:i}))})};Promise.resolve();var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
35
+ */var Mt;((Mt=window.HTMLSlotElement)===null||Mt===void 0?void 0:Mt.prototype.assignedElements)!=null;const{isArray:Ve}=Array,ze=Object.keys,ot=n=>{if(!n)return n;if(Ve(n)){const s=[],t=n.length;for(let e=0;e<t;e++)s.push(ot(n[e]));return s}else if(typeof n=="object"){const s=ze(n),t=s.length,e={};for(let i=0;i<t;i++){const r=s[i];e[r]=ot(n[r])}return e}return n};class L{constructor(s){g(this,"path");g(this,"from");this.path=s}}const Je=/~1/g,Be=/~0/g,We=/~/g,Ge=/\//g;function Fe(n){return n.indexOf("~")===-1?n:n.replace(Je,"/").replace(Be,"~")}function qe(n){return n.indexOf("/")===-1&&n.indexOf("~")===-1?n:n.replace(We,"~0").replace(Ge,"~1")}function Xe(n){return n?n.slice(1).split("/").map(Fe):[]}function E(n){return Ke(n)?"":"/"+n.map(s=>qe(String(s))).join("/")}const w=n=>typeof n=="string"?Xe(n):n,Ke=n=>!n.length,Ye=Object.prototype.hasOwnProperty;function Ze(n,s){return Ye.call(n,s)}const{isArray:ae}=Array,C=(n,s)=>{const t=s.length;if(!t)return{val:n};let e,i;for(let o=0;o<t;o++)if(e=n,i=s[o],ae(e)){const l=e.length;if(i==="-")i=l;else if(typeof i=="string"){const u=~~i;if(""+u!==i)throw new Error("INVALID_INDEX");if(i=u,i<0)throw new Error("INVALID_INDEX")}n=e[i]}else if(typeof e=="object"&&e)n=Ze(e,i)?e[i]:void 0;else throw new Error("NOT_FOUND");return{val:n,obj:e,key:i}},at=n=>ae(n.obj)&&typeof n.key=="number",gt=n=>typeof n.obj=="object"&&typeof n.key=="string";class Rt extends L{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"add"}code(){return 0}apply(t){const{val:e,key:i,obj:r}=C(t,this.path),o=ot(this.value);if(!r)t=o;else if(typeof i=="string")r[i]=o;else{const l=r.length;if(i<l)r.splice(i,0,o);else{if(i>l)throw new Error("INVALID_INDEX");r.push(o)}}return{doc:t,old:e}}toJson(t){return{op:"add",path:E(this.path),value:this.value}}toCompact(t,e){return[e?"add":0,this.path,this.value]}encode(t){t.encodeArrayHeader(3),t.writer.u8(0),t.encodeArray(this.path),t.encodeAny(this.value)}}class he extends L{constructor(t,e){super(t);g(this,"oldValue");this.oldValue=e}op(){return"remove"}code(){return 1}apply(t){const e=C(t,this.path);if(e.val===void 0)throw new Error("NOT_FOUND");return gt(e)?delete e.obj[e.key]:at(e)?e.val!==void 0&&e.obj.splice(e.key,1):t=null,{doc:t,old:e.val}}toJson(t){const e={op:"remove",path:E(this.path)};return this.oldValue!==void 0&&(e.oldValue=this.oldValue),e}toCompact(t,e){const i=e?"remove":1;return this.oldValue===void 0?[i,this.path]:[i,this.path,this.oldValue]}encode(t,e){const i=this.oldValue!==void 0;t.encodeArrayHeader(i?3:2),t.writer.u8(1),t.encodeArray(this.path),i&&t.encodeAny(this.oldValue)}}class Qe extends L{constructor(t,e,i){super(t);g(this,"value");g(this,"oldValue");this.value=e,this.oldValue=i}op(){return"replace"}code(){return 2}apply(t){const e=C(t,this.path);if(e.val===void 0)throw new Error("NOT_FOUND");return gt(e)?e.obj[e.key]=this.value:at(e)?e.obj[e.key]=this.value:t=this.value,{doc:t,old:e.val}}toJson(t){const e={op:"replace",path:E(this.path),value:this.value};return this.oldValue!==void 0&&(e.oldValue=this.oldValue),e}toCompact(t,e){const i=e?"replace":2;return this.oldValue===void 0?[i,this.path,this.value]:[i,this.path,this.value,this.oldValue]}encode(t,e){const i=this.oldValue!==void 0;t.encodeArrayHeader(i?4:3),t.writer.u8(2),t.encodeArray(this.path),t.encodeAny(this.value),i&&t.encodeAny(this.oldValue)}}class ts extends L{constructor(t,e){super(t);g(this,"from");this.from=e}op(){return"move"}code(){return 4}apply(t){const e=new he(w(this.from),void 0).apply(t);return new Rt(this.path,e.old).apply(e.doc)}toJson(t){return{op:"move",path:E(this.path),from:E(this.from)}}toCompact(t,e){return[e?"move":4,this.path,this.from]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(4),t.encodeArray(this.path),t.encodeArray(this.from)}}class es extends L{constructor(t,e){super(t);g(this,"from");this.from=e}op(){return"copy"}code(){return 3}apply(t){const{val:e}=C(t,this.from);if(e===void 0)throw new Error("NOT_FOUND");return new Rt(this.path,ot(e)).apply(t)}toJson(t){return{op:"copy",path:E(this.path),from:E(this.from)}}toCompact(t,e){return[e?"copy":3,this.path,this.from]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(3),t.encodeArray(this.path),t.encodeArray(this.from)}}class N extends L{apply(s){if(!this.test(s))throw new Error("TEST");return{doc:s}}}const yt=(n,s)=>{if(n===s)return!0;if(n&&s&&typeof n=="object"&&typeof s=="object"){if(n.constructor!==s.constructor)return!1;let t,e,i;if(Array.isArray(n)){if(t=n.length,t!==s.length)return!1;for(e=t;e--!==0;)if(!yt(n[e],s[e]))return!1;return!0}if(i=Object.keys(n),t=i.length,t!==Object.keys(s).length)return!1;for(e=t;e--!==0;){const r=i[e];if(!yt(n[r],s[r]))return!1}return!0}return!1};class ss extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"not");this.value=e,this.not=i}op(){return"test"}code(){return 5}test(t){const{val:e}=C(t,this.path);if(e===void 0)return!!this.not;const i=yt(e,this.value);return this.not?!i:i}toJson(t){const e={op:"test",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.not&&(e.not=this.not),e}toCompact(t,e){const i=t?this.path.slice(t.path.length):this.path,r=e?"test":5;return this.not?[r,i,this.value,1]:[r,i,this.value]}encode(t,e){t.encodeArrayHeader(this.not?4:3),t.writer.u8(5),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeAny(this.value),this.not&&t.writer.u8(1)}}class ns extends L{constructor(s){super(s)}op(){return"flip"}code(){return 8}apply(s){const t=C(s,this.path);return t.obj?t.obj[t.key]=!t.val:s=!t.val,{doc:s,old:t.val}}toJson(s){return{op:"flip",path:E(this.path)}}toCompact(s,t){return[t?"flip":8,this.path]}encode(s,t){s.encodeArrayHeader(2),s.writer.u8(8),s.encodeArray(this.path)}}class is extends L{constructor(t,e){super(t);g(this,"inc");this.inc=e}op(){return"inc"}code(){return 9}apply(t){const e=C(t,this.path),i=this.inc+Number(e.val);return e.obj?e.obj[e.key]=i:t=i,{doc:t,old:e.val}}toJson(t){return{op:"inc",path:E(this.path),inc:this.inc}}toCompact(t,e){return[e?"inc":9,this.path,this.inc]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(9),t.encodeArray(this.path),t.encodeNumber(this.inc)}}class rs extends L{constructor(t,e,i){super(t);g(this,"pos");g(this,"str");this.pos=e,this.str=i}op(){return"str_ins"}code(){return 6}apply(t){const{val:e,key:i,obj:r}=C(t,this.path);if(typeof e!="string"){if(e!==void 0)throw new Error("NOT_A_STRING");if(this.pos!==0)throw new Error("POS")}const o=typeof e=="string"?e:"",l=Math.min(this.pos,o.length),u=o.slice(0,l),d=o.slice(l),T=u+this.str+d;return r?r[i]=T:t=T,{doc:t,old:e}}toJson(t){return{op:"str_ins",path:E(this.path),pos:this.pos,str:this.str}}toCompact(t,e){return[e?"str_ins":6,this.path,this.pos,this.str]}encode(t,e){t.encodeArrayHeader(4),t.writer.u8(6),t.encodeArray(this.path),t.encodeNumber(this.pos),t.encodeString(this.str)}}class os extends L{constructor(t,e,i,r){super(t);g(this,"pos");g(this,"str");g(this,"len");this.pos=e,this.str=i,this.len=r}op(){return"str_del"}code(){return 7}deleteLength(){return typeof this.str=="string"?this.str.length:this.len}apply(t){const{val:e,key:i,obj:r}=C(t,this.path);if(typeof e!="string")throw new Error("NOT_A_STRING");const o=e.length,l=Math.min(this.pos,e.length),u=Math.min(l,o),d=this.str!==void 0?this.str.length:this.len,T=Math.min(l+d,o),y=e.slice(0,u),$=e.substr(T),O=y+$;return r?r[i]=O:t=O,{doc:t,old:e}}toJson(t){return typeof this.str=="string"?{op:"str_del",path:E(this.path),pos:this.pos,str:this.str}:{op:"str_del",path:E(this.path),pos:this.pos,len:this.len}}toCompact(t,e){const i=e?"str_del":7;return typeof this.str=="string"?[i,this.path,this.pos,this.str]:[i,this.path,this.pos,0,this.len]}encode(t,e){const i=typeof this.str=="string";t.encodeArrayHeader(i?4:5),t.writer.u8(7),t.encodeArray(this.path),t.encodeNumber(this.pos),i?t.encodeString(this.str):(t.writer.u8(0),t.encodeNumber(this.len))}}const{isArray:as}=Array,Nt=n=>!!n&&typeof n=="object"&&typeof n.text=="string",Lt=n=>!!n&&typeof n=="object"&&as(n.children),hs=(n,s)=>{const t=new RegExp(n,s?"i":void 0);return e=>t.test(e)};class ls extends L{constructor(t,e,i){super(t);g(this,"pos");g(this,"props");this.pos=e,this.props=i}op(){return"split"}code(){return 10}apply(t){const e=C(t,this.path);if(e.val===void 0)throw new Error("NOT_FOUND");const i=this.split(e.val);return gt(e)?e.obj[e.key]=i:at(e)?(e.obj[e.key]=i[0],e.obj.splice(e.key+1,0,i[1])):t=i,{doc:t,old:e.val}}split(t){if(typeof t=="string"){const{pos:e,props:i}=this,r=t.slice(0,e),o=t.slice(e);return i?[{...i,text:r},{...i,text:o}]:[r,o]}else if(Nt(t)){const{pos:e,props:i}=this,r=t.text.slice(0,e),o=t.text.slice(e);return[{...t,...i,text:r},{...t,...i,text:o}]}else if(Lt(t)){const{pos:e,props:i}=this,r=t.children.slice(0,e),o=t.children.slice(e);return[{...t,...i,children:r},{...t,...i,children:o}]}else if(typeof t=="number"){const{pos:e}=this;return[e,t-e]}else return[t,t]}toJson(t){const e={op:"split",path:E(this.path),pos:this.pos};return this.props&&(e.props=this.props),e}toCompact(t,e){const i=e?"split":10;return this.props?[i,this.path,this.pos,this.props]:[i,this.path,this.pos]}encode(t,e){t.encodeArrayHeader(this.props?4:3),t.writer.u8(10),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeObject(this.props)}}class cs extends L{constructor(t,e,i){super(t);g(this,"pos");g(this,"props");this.pos=e,this.props=i}op(){return"merge"}code(){return 11}apply(t){const e=C(t,this.path);if(!at(e))throw new Error("INVALID_TARGET");if(e.key<=0)throw new Error("INVALID_KEY");const i=e.obj[e.key-1],r=e.obj[e.key],o=this.merge(i,r);return e.obj[e.key-1]=o,e.obj.splice(e.key,1),{doc:t,old:[i,r]}}merge(t,e){return typeof t=="string"&&typeof e=="string"||typeof t=="number"&&typeof e=="number"?t+e:Nt(t)&&Nt(e)?{...t,...e,text:t.text+e.text}:Lt(t)&&Lt(e)?{...t,...e,children:[...t.children,...e.children]}:[t,e]}toJson(t){const e={op:"merge",path:E(this.path),pos:this.pos};return this.props&&(e.props=this.props),e}toCompact(t,e){const i=e?"merge":11;return this.props?[i,this.path,this.pos,this.props]:[i,this.path,this.pos]}encode(t,e){t.encodeArrayHeader(this.props?4:3),t.writer.u8(11),t.encodeArray(this.path),t.encodeNumber(this.pos),this.props&&t.encodeAny(this.props)}}const{isArray:us}=Array;class ps extends L{constructor(t,e,i){super(t);g(this,"props");g(this,"deleteNull");this.props=e,this.deleteNull=i}op(){return"extend"}code(){return 12}apply(t){const e=C(t,this.path);return at(e)?e.val!==void 0&&(e.obj[e.key]=this.extend(e.val)):gt(e)?e.obj[e.key]=this.extend(e.val):t=this.extend(t),{doc:t}}extend(t){if(us(t)||typeof t!="object"||!t)return t;for(const[e,i]of Object.entries(this.props)){if(e==="__proto__")throw new Error("NO_PROTO");if(i===null&&this.deleteNull){delete t[e];continue}t[e]=i}return t}toJson(t){const e={op:"extend",path:E(this.path),props:this.props};return this.deleteNull&&(e.deleteNull=this.deleteNull),e}toCompact(t,e){const i=e?"extend":12;return this.deleteNull?[i,this.path,this.props,1]:[i,this.path,this.props]}encode(t,e){const{deleteNull:i}=this;t.encodeArrayHeader(i?4:3),t.writer.u8(12),t.encodeArray(this.path),t.encodeObject(this.props),i&&t.writer.u8(1)}}class ds extends N{constructor(s){super(s)}op(){return"defined"}code(){return 31}test(s){const{val:t}=C(s,this.path);return t!==void 0}toJson(s){return{op:"defined",path:E(s?this.path.slice(s.path.length):this.path)}}toCompact(s,t){return[t?"defined":31,s?this.path.slice(s.path.length):this.path]}encode(s,t){s.encodeArrayHeader(2),s.writer.u8(31),s.encodeArray(t?this.path.slice(t.path.length):this.path)}}class fs extends N{constructor(s){super(s)}op(){return"undefined"}code(){return 38}test(s){try{const{val:t}=C(s,this.path);return t===void 0}catch(t){if(t.message==="NOT_FOUND")return!0;throw t}}toJson(s){return{op:"undefined",path:E(s?this.path.slice(s.path.length):this.path)}}toCompact(s,t){return[t?"undefined":38,s?this.path.slice(s.path.length):this.path]}encode(s,t){s.encodeArrayHeader(2),s.writer.u8(38),s.encodeArray(t?this.path.slice(t.path.length):this.path)}}const{isArray:vs}=Array;class gs extends N{constructor(t,e){super(t);g(this,"type");this.type=e}op(){return"test_type"}code(){return 39}test(t){const{val:e}=C(t,this.path);return e===null?this.type.indexOf("null")>-1:vs(e)?this.type.indexOf("array")>-1:this.type.indexOf(typeof e)>-1||typeof e=="number"&&e===Math.round(e)&&this.type.indexOf("integer")>-1}toJson(t){return{op:"test_type",path:E(t?this.path.slice(t.path.length):this.path),type:this.type}}toCompact(t,e){return[e?"test_type":39,t?this.path.slice(t.path.length):this.path,this.type]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(39),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeArray(this.type)}}class ys extends N{constructor(t,e,i,r){super(t);g(this,"pos");g(this,"str");g(this,"not");this.pos=e,this.str=i,this.not=r}op(){return"test_string"}code(){return 40}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=e.length,r=Math.min(this.pos,i),o=Math.min(this.pos+this.str.length,i),l=e.substring(r,o)===this.str;return this.not?!l:l}toJson(t){const e={op:"test_string",path:E(t?this.path.slice(t.path.length):this.path),pos:this.pos,str:this.str};return this.not&&(e.not=this.not),e}toCompact(t,e){const i=e?"test_string":40,r=t?this.path.slice(t.path.length):this.path;return this.not?[i,r,this.pos,this.str,1]:[i,r,this.pos,this.str]}encode(t,e){t.encodeArrayHeader(this.not?5:4),t.writer.u8(40),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.pos),t.encodeString(this.str),this.not&&t.writer.u8(1)}}class ms extends N{constructor(t,e,i){super(t);g(this,"len");g(this,"not");this.len=e,this.not=i}op(){return"test_string_len"}code(){return 41}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const r=e.length>=this.len;return this.not?!r:r}toJson(t){const e={op:"test_string_len",path:E(t?this.path.slice(t.path.length):this.path),len:this.len};return this.not&&(e.not=this.not),e}toCompact(t,e){const i=e?"test_string_len":41,r=t?this.path.slice(t.path.length):this.path;return this.not?[i,r,this.len,1]:[i,r,this.len]}encode(t,e){t.encodeArrayHeader(this.not?4:3),t.writer.u8(41),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.len),this.not&&t.writer.u8(1)}}class _s extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"ignore_case");this.value=e,this.ignore_case=i}op(){return"contains"}code(){return 30}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=this.ignore_case?e.toLowerCase():e,r=this.ignore_case?this.value.toLowerCase():this.value;return i.indexOf(r)>-1}toJson(t){const e={op:"contains",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"contains":30;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(30),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}class ws extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"ignore_case");this.value=e,this.ignore_case=i}op(){return"ends"}code(){return 32}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=this.ignore_case?e.toLowerCase():e,r=this.ignore_case?this.value.toLowerCase():this.value;return i.endsWith(r)}toJson(t){const e={op:"ends",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"ends":32;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(32),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}class Es extends N{constructor(t,e,i){super(t);g(this,"value");g(this,"ignore_case");this.value=e,this.ignore_case=i}op(){return"starts"}code(){return 37}test(t){const{val:e}=C(t,this.path);if(typeof e!="string")return!1;const i=this.ignore_case?e.toLowerCase():e,r=this.ignore_case?this.value.toLowerCase():this.value;return i.startsWith(r)}toJson(t){const e={op:"starts",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"starts":37;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(37),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}class bs extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"in"}code(){return 33}test(t){const{val:e}=C(t,this.path);for(const i of this.value)if(yt(e,i))return!0;return!1}toJson(t){return{op:"in",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"in":33,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(33),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeArray(this.value)}}class As extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"less"}code(){return 34}test(t){const{val:e}=C(t,this.path);return typeof e!="number"?!1:e<this.value}toJson(t){return{op:"less",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"less":34,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(34),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.value)}}class $s extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"more"}code(){return 36}test(t){const{val:e}=C(t,this.path);return typeof e!="number"?!1:e>this.value}toJson(t){return{op:"more",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"more":36,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(36),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeNumber(this.value)}}class Pt extends N{constructor(t,e){super(t);g(this,"ops");this.ops=e}}class Cs extends Pt{constructor(t,e){super(t,e);g(this,"ops");this.ops=e}op(){return"and"}code(){return 43}test(t){for(const e of this.ops)if(!e.test(t))return!1;return!0}toJson(t){return{op:"and",path:E(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(i=>i.toJson(this))}}toCompact(t,e){return[e?"and":43,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,e))]}encode(t,e){const i=e?this.path.slice(e.path.length):this.path;t.encodeArrayHeader(3),t.writer.u8(43),t.encodeArray(i);const r=this.ops.length;t.encodeArrayHeader(r);for(let o=0;o<r;o++)this.ops[o].encode(t,this)}}class Ts extends Pt{constructor(t,e){super(t,e);g(this,"ops");this.ops=e}op(){return"or"}code(){return 45}test(t){for(const e of this.ops)if(e.test(t))return!0;return!1}toJson(t){return{op:"or",path:E(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(i=>i.toJson(this))}}toCompact(t,e){return[e?"or":45,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,e))]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(45),t.encodeArray(e?this.path.slice(e.path.length):this.path);const i=this.ops.length;t.encodeArrayHeader(i);for(let r=0;r<i;r++)this.ops[r].encode(t,this)}}class ks extends Pt{constructor(t,e){super(t,e);g(this,"ops");this.ops=e}op(){return"not"}code(){return 44}test(t){for(const e of this.ops)if(e.test(t))return!1;return!0}toJson(t){return{op:"not",path:E(t?this.path.slice(t.path.length):this.path),apply:this.ops.map(i=>i.toJson(this))}}toCompact(t,e){return[e?"not":44,t?this.path.slice(t.path.length):this.path,this.ops.map(r=>r.toCompact(this,e))]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(44),t.encodeArray(e?this.path.slice(e.path.length):this.path);const i=this.ops.length;t.encodeArrayHeader(i);for(let r=0;r<i;r++)this.ops[r].encode(t,this)}}class Ss extends N{constructor(t,e,i,r){super(t);g(this,"value");g(this,"ignore_case");g(this,"matcher");this.value=e,this.ignore_case=i,this.matcher=r(e,i)}op(){return"matches"}code(){return 35}test(t){const{val:e}=C(t,this.path);return typeof e!="string"?!1:this.matcher(e)}toJson(t){const e={op:"matches",path:E(t?this.path.slice(t.path.length):this.path),value:this.value};return this.ignore_case&&(e.ignore_case=this.ignore_case),e}toCompact(t,e){const i=e?"matches":35;return this.ignore_case?[i,t?this.path.slice(t.path.length):this.path,this.value,1]:[i,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){const i=this.ignore_case;t.encodeArrayHeader(i?4:3),t.writer.u8(35),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value),i&&t.writer.u8(1)}}const{isArray:xs}=Array;class Os extends N{constructor(t,e){super(t);g(this,"value");this.value=e}op(){return"type"}code(){return 42}test(t){const{val:e}=C(t,this.path);return e===null?this.value==="null":xs(e)?this.value==="array":typeof e===this.value||typeof e=="number"&&e===Math.round(e)&&this.value==="integer"}toJson(t){return{op:"type",path:E(t?this.path.slice(t.path.length):this.path),value:this.value}}toCompact(t,e){return[e?"type":42,t?this.path.slice(t.path.length):this.path,this.value]}encode(t,e){t.encodeArrayHeader(3),t.writer.u8(42),t.encodeArray(e?this.path.slice(e.path.length):this.path),t.encodeString(this.value)}}const js=(n,s)=>{switch(n.op){case"add":return new Rt(w(n.path),n.value);case"remove":return new he(w(n.path),n.oldValue);case"replace":return new Qe(w(n.path),n.value,n.oldValue);case"move":return new ts(w(n.path),w(n.from));case"copy":return new es(w(n.path),w(n.from));case"flip":return new ns(w(n.path));case"inc":return new is(w(n.path),n.inc);case"str_ins":return new rs(w(n.path),n.pos,n.str);case"str_del":return new os(w(n.path),n.pos,n.str,n.len);case"split":return new ls(w(n.path),n.pos,n.props||null);case"merge":return new cs(w(n.path),n.pos,n.props||null);case"extend":return new ps(w(n.path),n.props,!!n.deleteNull);default:return mt(n,s)}},mt=(n,s)=>{switch(n.op){case"test":return new ss(w(n.path),n.value,!!n.not);case"defined":return new ds(w(n.path));case"undefined":return new fs(w(n.path));case"type":return new Os(w(n.path),n.value);case"test_type":return new gs(w(n.path),n.type);case"test_string":return new ys(w(n.path),n.pos,n.str,!!n.not);case"test_string_len":return new ms(w(n.path),n.len,!!n.not);case"contains":return new _s(w(n.path),n.value,!!n.ignore_case);case"ends":return new ws(w(n.path),n.value,!!n.ignore_case);case"starts":return new Es(w(n.path),n.value,!!n.ignore_case);case"matches":return new Ss(w(n.path),n.value,!!n.ignore_case,s.createMatcher||hs);case"in":return new bs(w(n.path),n.value);case"less":return new As(w(n.path),n.value);case"more":return new $s(w(n.path),n.value);case"and":{const t=w(n.path);return new Cs(t,n.apply.map(e=>mt({...e,path:[...t,...w(e.path)]},s)))}case"or":{const t=w(n.path);return new Ts(t,n.apply.map(e=>mt({...e,path:[...t,...w(e.path)]},s)))}case"not":{const t=w(n.path);return new ks(t,n.apply.map(e=>mt({...e,path:[...t,...w(e.path)]},s)))}default:throw new Error("OP_UNKNOWN")}};function Ms(n,s,t){t.mutate||(n=ot(n));const e=[],i=s.length;for(let r=0;r<i;r++){const l=js(s[r],t).apply(n);n=l.doc,e.push(l)}return{doc:n,res:e}}var ht=n=>typeof n=="function"?n:function(){return n},Rs=typeof self<"u"?self:null,lt=typeof window<"u"?window:null,ct=Rs||lt||ct,Ns="2.0.0",H={connecting:0,open:1,closing:2,closed:3},Ls=1e4,Ps=1e3,P={closed:"closed",errored:"errored",joined:"joined",joining:"joining",leaving:"leaving"},D={close:"phx_close",error:"phx_error",join:"phx_join",reply:"phx_reply",leave:"phx_leave"},Ht={longpoll:"longpoll",websocket:"websocket"},Hs={complete:4},_t=class{constructor(n,s,t,e){this.channel=n,this.event=s,this.payload=t||function(){return{}},this.receivedResp=null,this.timeout=e,this.timeoutTimer=null,this.recHooks=[],this.sent=!1}resend(n){this.timeout=n,this.reset(),this.send()}send(){this.hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload(),ref:this.ref,join_ref:this.channel.joinRef()}))}receive(n,s){return this.hasReceived(n)&&s(this.receivedResp.response),this.recHooks.push({status:n,callback:s}),this}reset(){this.cancelRefEvent(),this.ref=null,this.refEvent=null,this.receivedResp=null,this.sent=!1}matchReceive({status:n,response:s,_ref:t}){this.recHooks.filter(e=>e.status===n).forEach(e=>e.callback(s))}cancelRefEvent(){this.refEvent&&this.channel.off(this.refEvent)}cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=null}startTimeout(){this.timeoutTimer&&this.cancelTimeout(),this.ref=this.channel.socket.makeRef(),this.refEvent=this.channel.replyEventName(this.ref),this.channel.on(this.refEvent,n=>{this.cancelRefEvent(),this.cancelTimeout(),this.receivedResp=n,this.matchReceive(n)}),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}hasReceived(n){return this.receivedResp&&this.receivedResp.status===n}trigger(n,s){this.channel.trigger(this.refEvent,{status:n,response:s})}},le=class{constructor(n,s){this.callback=n,this.timerCalc=s,this.timer=null,this.tries=0}reset(){this.tries=0,clearTimeout(this.timer)}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}},Us=class{constructor(n,s,t){this.state=P.closed,this.topic=n,this.params=ht(s||{}),this.socket=t,this.bindings=[],this.bindingRef=0,this.timeout=this.socket.timeout,this.joinedOnce=!1,this.joinPush=new _t(this,D.join,this.params,this.timeout),this.pushBuffer=[],this.stateChangeRefs=[],this.rejoinTimer=new le(()=>{this.socket.isConnected()&&this.rejoin()},this.socket.rejoinAfterMs),this.stateChangeRefs.push(this.socket.onError(()=>this.rejoinTimer.reset())),this.stateChangeRefs.push(this.socket.onOpen(()=>{this.rejoinTimer.reset(),this.isErrored()&&this.rejoin()})),this.joinPush.receive("ok",()=>{this.state=P.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this.joinPush.receive("error",()=>{this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.onClose(()=>{this.rejoinTimer.reset(),this.socket.hasLogger()&&this.socket.log("channel",`close ${this.topic} ${this.joinRef()}`),this.state=P.closed,this.socket.remove(this)}),this.onError(e=>{this.socket.hasLogger()&&this.socket.log("channel",`error ${this.topic}`,e),this.isJoining()&&this.joinPush.reset(),this.state=P.errored,this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.joinPush.receive("timeout",()=>{this.socket.hasLogger()&&this.socket.log("channel",`timeout ${this.topic} (${this.joinRef()})`,this.joinPush.timeout),new _t(this,D.leave,ht({}),this.timeout).send(),this.state=P.errored,this.joinPush.reset(),this.socket.isConnected()&&this.rejoinTimer.scheduleTimeout()}),this.on(D.reply,(e,i)=>{this.trigger(this.replyEventName(i),e)})}join(n=this.timeout){if(this.joinedOnce)throw new Error("tried to join multiple times. 'join' can only be called a single time per channel instance");return this.timeout=n,this.joinedOnce=!0,this.rejoin(),this.joinPush}onClose(n){this.on(D.close,n)}onError(n){return this.on(D.error,s=>n(s))}on(n,s){let t=this.bindingRef++;return this.bindings.push({event:n,ref:t,callback:s}),t}off(n,s){this.bindings=this.bindings.filter(t=>!(t.event===n&&(typeof s>"u"||s===t.ref)))}canPush(){return this.socket.isConnected()&&this.isJoined()}push(n,s,t=this.timeout){if(s=s||{},!this.joinedOnce)throw new Error(`tried to push '${n}' to '${this.topic}' before joining. Use channel.join() before pushing events`);let e=new _t(this,n,function(){return s},t);return this.canPush()?e.send():(e.startTimeout(),this.pushBuffer.push(e)),e}leave(n=this.timeout){this.rejoinTimer.reset(),this.joinPush.cancelTimeout(),this.state=P.leaving;let s=()=>{this.socket.hasLogger()&&this.socket.log("channel",`leave ${this.topic}`),this.trigger(D.close,"leave")},t=new _t(this,D.leave,ht({}),n);return t.receive("ok",()=>s()).receive("timeout",()=>s()),t.send(),this.canPush()||t.trigger("ok",{}),t}onMessage(n,s,t){return s}isMember(n,s,t,e){return this.topic!==n?!1:e&&e!==this.joinRef()?(this.socket.hasLogger()&&this.socket.log("channel","dropping outdated message",{topic:n,event:s,payload:t,joinRef:e}),!1):!0}joinRef(){return this.joinPush.ref}rejoin(n=this.timeout){this.isLeaving()||(this.socket.leaveOpenTopic(this.topic),this.state=P.joining,this.joinPush.resend(n))}trigger(n,s,t,e){let i=this.onMessage(n,s,t,e);if(s&&!i)throw new Error("channel onMessage callbacks must return the payload, modified or unmodified");let r=this.bindings.filter(o=>o.event===n);for(let o=0;o<r.length;o++)r[o].callback(i,t,e||this.joinRef())}replyEventName(n){return`chan_reply_${n}`}isClosed(){return this.state===P.closed}isErrored(){return this.state===P.errored}isJoined(){return this.state===P.joined}isJoining(){return this.state===P.joining}isLeaving(){return this.state===P.leaving}},wt=class{static request(n,s,t,e,i,r,o){if(ct.XDomainRequest){let l=new ct.XDomainRequest;return this.xdomainRequest(l,n,s,e,i,r,o)}else{let l=new ct.XMLHttpRequest;return this.xhrRequest(l,n,s,t,e,i,r,o)}}static xdomainRequest(n,s,t,e,i,r,o){return n.timeout=i,n.open(s,t),n.onload=()=>{let l=this.parseJSON(n.responseText);o&&o(l)},r&&(n.ontimeout=r),n.onprogress=()=>{},n.send(e),n}static xhrRequest(n,s,t,e,i,r,o,l){return n.open(s,t,!0),n.timeout=r,n.setRequestHeader("Content-Type",e),n.onerror=()=>l&&l(null),n.onreadystatechange=()=>{if(n.readyState===Hs.complete&&l){let u=this.parseJSON(n.responseText);l(u)}},o&&(n.ontimeout=o),n.send(i),n}static parseJSON(n){if(!n||n==="")return null;try{return JSON.parse(n)}catch{return console&&console.log("failed to parse JSON response",n),null}}static serialize(n,s){let t=[];for(var e in n){if(!Object.prototype.hasOwnProperty.call(n,e))continue;let i=s?`${s}[${e}]`:e,r=n[e];typeof r=="object"?t.push(this.serialize(r,i)):t.push(encodeURIComponent(i)+"="+encodeURIComponent(r))}return t.join("&")}static appendParams(n,s){if(Object.keys(s).length===0)return n;let t=n.match(/\?/)?"&":"?";return`${n}${t}${this.serialize(s)}`}},Ut=class{constructor(n){this.endPoint=null,this.token=null,this.skipHeartbeat=!0,this.reqs=new Set,this.onopen=function(){},this.onerror=function(){},this.onmessage=function(){},this.onclose=function(){},this.pollEndpoint=this.normalizeEndpoint(n),this.readyState=H.connecting,this.poll()}normalizeEndpoint(n){return n.replace("ws://","http://").replace("wss://","https://").replace(new RegExp("(.*)/"+Ht.websocket),"$1/"+Ht.longpoll)}endpointURL(){return wt.appendParams(this.pollEndpoint,{token:this.token})}closeAndRetry(n,s,t){this.close(n,s,t),this.readyState=H.connecting}ontimeout(){this.onerror("timeout"),this.closeAndRetry(1005,"timeout",!1)}isActive(){return this.readyState===H.open||this.readyState===H.connecting}poll(){this.ajax("GET",null,()=>this.ontimeout(),n=>{if(n){var{status:s,token:t,messages:e}=n;this.token=t}else s=0;switch(s){case 200:e.forEach(i=>{setTimeout(()=>this.onmessage({data:i}),0)}),this.poll();break;case 204:this.poll();break;case 410:this.readyState=H.open,this.onopen({}),this.poll();break;case 403:this.onerror(403),this.close(1008,"forbidden",!1);break;case 0:case 500:this.onerror(500),this.closeAndRetry(1011,"internal server error",500);break;default:throw new Error(`unhandled poll status ${s}`)}})}send(n){this.ajax("POST",n,()=>this.onerror("timeout"),s=>{(!s||s.status!==200)&&(this.onerror(s&&s.status),this.closeAndRetry(1011,"internal server error",!1))})}close(n,s,t){for(let i of this.reqs)i.abort();this.readyState=H.closed;let e=Object.assign({code:1e3,reason:void 0,wasClean:!0},{code:n,reason:s,wasClean:t});typeof CloseEvent<"u"?this.onclose(new CloseEvent("close",e)):this.onclose(e)}ajax(n,s,t,e){let i,r=()=>{this.reqs.delete(i),t()};i=wt.request(n,this.endpointURL(),"application/json",s,this.timeout,r,o=>{this.reqs.delete(i),this.isActive()&&e(o)}),this.reqs.add(i)}},Et={HEADER_LENGTH:1,META_LENGTH:4,KINDS:{push:0,reply:1,broadcast:2},encode(n,s){if(n.payload.constructor===ArrayBuffer)return s(this.binaryEncode(n));{let t=[n.join_ref,n.ref,n.topic,n.event,n.payload];return s(JSON.stringify(t))}},decode(n,s){if(n.constructor===ArrayBuffer)return s(this.binaryDecode(n));{let[t,e,i,r,o]=JSON.parse(n);return s({join_ref:t,ref:e,topic:i,event:r,payload:o})}},binaryEncode(n){let{join_ref:s,ref:t,event:e,topic:i,payload:r}=n,o=this.META_LENGTH+s.length+t.length+i.length+e.length,l=new ArrayBuffer(this.HEADER_LENGTH+o),u=new DataView(l),d=0;u.setUint8(d++,this.KINDS.push),u.setUint8(d++,s.length),u.setUint8(d++,t.length),u.setUint8(d++,i.length),u.setUint8(d++,e.length),Array.from(s,y=>u.setUint8(d++,y.charCodeAt(0))),Array.from(t,y=>u.setUint8(d++,y.charCodeAt(0))),Array.from(i,y=>u.setUint8(d++,y.charCodeAt(0))),Array.from(e,y=>u.setUint8(d++,y.charCodeAt(0)));var T=new Uint8Array(l.byteLength+r.byteLength);return T.set(new Uint8Array(l),0),T.set(new Uint8Array(r),l.byteLength),T.buffer},binaryDecode(n){let s=new DataView(n),t=s.getUint8(0),e=new TextDecoder;switch(t){case this.KINDS.push:return this.decodePush(n,s,e);case this.KINDS.reply:return this.decodeReply(n,s,e);case this.KINDS.broadcast:return this.decodeBroadcast(n,s,e)}},decodePush(n,s,t){let e=s.getUint8(1),i=s.getUint8(2),r=s.getUint8(3),o=this.HEADER_LENGTH+this.META_LENGTH-1,l=t.decode(n.slice(o,o+e));o=o+e;let u=t.decode(n.slice(o,o+i));o=o+i;let d=t.decode(n.slice(o,o+r));o=o+r;let T=n.slice(o,n.byteLength);return{join_ref:l,ref:null,topic:u,event:d,payload:T}},decodeReply(n,s,t){let e=s.getUint8(1),i=s.getUint8(2),r=s.getUint8(3),o=s.getUint8(4),l=this.HEADER_LENGTH+this.META_LENGTH,u=t.decode(n.slice(l,l+e));l=l+e;let d=t.decode(n.slice(l,l+i));l=l+i;let T=t.decode(n.slice(l,l+r));l=l+r;let y=t.decode(n.slice(l,l+o));l=l+o;let $=n.slice(l,n.byteLength),O={status:y,response:$};return{join_ref:u,ref:d,topic:T,event:D.reply,payload:O}},decodeBroadcast(n,s,t){let e=s.getUint8(1),i=s.getUint8(2),r=this.HEADER_LENGTH+2,o=t.decode(n.slice(r,r+e));r=r+e;let l=t.decode(n.slice(r,r+i));r=r+i;let u=n.slice(r,n.byteLength);return{join_ref:null,ref:null,topic:o,event:l,payload:u}}},Ds=class{constructor(n,s={}){this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.channels=[],this.sendBuffer=[],this.ref=0,this.timeout=s.timeout||Ls,this.transport=s.transport||ct.WebSocket||Ut,this.establishedConnections=0,this.defaultEncoder=Et.encode.bind(Et),this.defaultDecoder=Et.decode.bind(Et),this.closeWasClean=!1,this.binaryType=s.binaryType||"arraybuffer",this.connectClock=1,this.transport!==Ut?(this.encode=s.encode||this.defaultEncoder,this.decode=s.decode||this.defaultDecoder):(this.encode=this.defaultEncoder,this.decode=this.defaultDecoder);let t=null;lt&&lt.addEventListener&&(lt.addEventListener("pagehide",e=>{this.conn&&(this.disconnect(),t=this.connectClock)}),lt.addEventListener("pageshow",e=>{t===this.connectClock&&(t=null,this.connect())})),this.heartbeatIntervalMs=s.heartbeatIntervalMs||3e4,this.rejoinAfterMs=e=>s.rejoinAfterMs?s.rejoinAfterMs(e):[1e3,2e3,5e3][e-1]||1e4,this.reconnectAfterMs=e=>s.reconnectAfterMs?s.reconnectAfterMs(e):[10,50,100,150,200,250,500,1e3,2e3][e-1]||5e3,this.logger=s.logger||null,this.longpollerTimeout=s.longpollerTimeout||2e4,this.params=ht(s.params||{}),this.endPoint=`${n}/${Ht.websocket}`,this.vsn=s.vsn||Ns,this.heartbeatTimeoutTimer=null,this.heartbeatTimer=null,this.pendingHeartbeatRef=null,this.reconnectTimer=new le(()=>{this.teardown(()=>this.connect())},this.reconnectAfterMs)}getLongPollTransport(){return Ut}replaceTransport(n){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.sendBuffer=[],this.conn&&(this.conn.close(),this.conn=null),this.transport=n}protocol(){return location.protocol.match(/^https/)?"wss":"ws"}endPointURL(){let n=wt.appendParams(wt.appendParams(this.endPoint,this.params()),{vsn:this.vsn});return n.charAt(0)!=="/"?n:n.charAt(1)==="/"?`${this.protocol()}:${n}`:`${this.protocol()}://${location.host}${n}`}disconnect(n,s,t){this.connectClock++,this.closeWasClean=!0,this.reconnectTimer.reset(),this.teardown(n,s,t)}connect(n){n&&(console&&console.log("passing params to connect is deprecated. Instead pass :params to the Socket constructor"),this.params=ht(n)),!this.conn&&(this.connectClock++,this.closeWasClean=!1,this.conn=new this.transport(this.endPointURL()),this.conn.binaryType=this.binaryType,this.conn.timeout=this.longpollerTimeout,this.conn.onopen=()=>this.onConnOpen(),this.conn.onerror=s=>this.onConnError(s),this.conn.onmessage=s=>this.onConnMessage(s),this.conn.onclose=s=>this.onConnClose(s))}log(n,s,t){this.logger(n,s,t)}hasLogger(){return this.logger!==null}onOpen(n){let s=this.makeRef();return this.stateChangeCallbacks.open.push([s,n]),s}onClose(n){let s=this.makeRef();return this.stateChangeCallbacks.close.push([s,n]),s}onError(n){let s=this.makeRef();return this.stateChangeCallbacks.error.push([s,n]),s}onMessage(n){let s=this.makeRef();return this.stateChangeCallbacks.message.push([s,n]),s}ping(n){if(!this.isConnected())return!1;let s=this.makeRef(),t=Date.now();this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:s});let e=this.onMessage(i=>{i.ref===s&&(this.off([e]),n(Date.now()-t))});return!0}clearHeartbeats(){clearTimeout(this.heartbeatTimer),clearTimeout(this.heartbeatTimeoutTimer)}onConnOpen(){this.hasLogger()&&this.log("transport",`connected to ${this.endPointURL()}`),this.closeWasClean=!1,this.establishedConnections++,this.flushSendBuffer(),this.reconnectTimer.reset(),this.resetHeartbeat(),this.stateChangeCallbacks.open.forEach(([,n])=>n())}heartbeatTimeout(){this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null,this.hasLogger()&&this.log("transport","heartbeat timeout. Attempting to re-establish connection"),this.triggerChanError(),this.closeWasClean=!1,this.teardown(()=>this.reconnectTimer.scheduleTimeout(),Ps,"heartbeat timeout"))}resetHeartbeat(){this.conn&&this.conn.skipHeartbeat||(this.pendingHeartbeatRef=null,this.clearHeartbeats(),this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs))}teardown(n,s,t){if(!this.conn)return n&&n();this.waitForBufferDone(()=>{this.conn&&(s?this.conn.close(s,t||""):this.conn.close()),this.waitForSocketClosed(()=>{this.conn&&(this.conn.onopen=function(){},this.conn.onerror=function(){},this.conn.onmessage=function(){},this.conn.onclose=function(){},this.conn=null),n&&n()})})}waitForBufferDone(n,s=1){if(s===5||!this.conn||!this.conn.bufferedAmount){n();return}setTimeout(()=>{this.waitForBufferDone(n,s+1)},150*s)}waitForSocketClosed(n,s=1){if(s===5||!this.conn||this.conn.readyState===H.closed){n();return}setTimeout(()=>{this.waitForSocketClosed(n,s+1)},150*s)}onConnClose(n){let s=n&&n.code;this.hasLogger()&&this.log("transport","close",n),this.triggerChanError(),this.clearHeartbeats(),!this.closeWasClean&&s!==1e3&&this.reconnectTimer.scheduleTimeout(),this.stateChangeCallbacks.close.forEach(([,t])=>t(n))}onConnError(n){this.hasLogger()&&this.log("transport",n);let s=this.transport,t=this.establishedConnections;this.stateChangeCallbacks.error.forEach(([,e])=>{e(n,s,t)}),(s===this.transport||t>0)&&this.triggerChanError()}triggerChanError(){this.channels.forEach(n=>{n.isErrored()||n.isLeaving()||n.isClosed()||n.trigger(D.error)})}connectionState(){switch(this.conn&&this.conn.readyState){case H.connecting:return"connecting";case H.open:return"open";case H.closing:return"closing";default:return"closed"}}isConnected(){return this.connectionState()==="open"}remove(n){this.off(n.stateChangeRefs),this.channels=this.channels.filter(s=>s.joinRef()!==n.joinRef())}off(n){for(let s in this.stateChangeCallbacks)this.stateChangeCallbacks[s]=this.stateChangeCallbacks[s].filter(([t])=>n.indexOf(t)===-1)}channel(n,s={}){let t=new Us(n,s,this);return this.channels.push(t),t}push(n){if(this.hasLogger()){let{topic:s,event:t,payload:e,ref:i,join_ref:r}=n;this.log("push",`${s} ${t} (${r}, ${i})`,e)}this.isConnected()?this.encode(n,s=>this.conn.send(s)):this.sendBuffer.push(()=>this.encode(n,s=>this.conn.send(s)))}makeRef(){let n=this.ref+1;return n===this.ref?this.ref=0:this.ref=n,this.ref.toString()}sendHeartbeat(){this.pendingHeartbeatRef&&!this.isConnected()||(this.pendingHeartbeatRef=this.makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef}),this.heartbeatTimeoutTimer=setTimeout(()=>this.heartbeatTimeout(),this.heartbeatIntervalMs))}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(n=>n()),this.sendBuffer=[])}onConnMessage(n){this.decode(n.data,s=>{let{topic:t,event:e,payload:i,ref:r,join_ref:o}=s;r&&r===this.pendingHeartbeatRef&&(this.clearHeartbeats(),this.pendingHeartbeatRef=null,this.heartbeatTimer=setTimeout(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)),this.hasLogger()&&this.log("receive",`${i.status||""} ${t} ${e} ${r&&"("+r+")"||""}`,i);for(let l=0;l<this.channels.length;l++){const u=this.channels[l];u.isMember(t,e,i,o)&&u.trigger(e,i,r,o)}for(let l=0;l<this.stateChangeCallbacks.message.length;l++){let[,u]=this.stateChangeCallbacks.message[l];u(s)}})}leaveOpenTopic(n){let s=this.channels.find(t=>t.topic===n&&(t.isJoined()||t.isJoining()));s&&(this.hasLogger()&&this.log("transport",`leaving duplicate topic "${n}"`),s.leave())}};class Is{constructor(s){this.connected=!1,this.config=s,this.socket=new Ds(this.config.url,{logger:(t,e,i)=>{console.log(`${t}: ${e}`,i)}}),this.channel=this.socket.channel(this.config.topic,this.config.params),this.eventTarget=new EventTarget}connect(){this.connected||(this.socket.onError(s=>this.emitError("socket error",s)),this.socket.connect(),this.channel.onError(s=>console.log("channel error",s)),this.channel.join().receive("ok",()=>{console.log("joined")}).receive("error",s=>{this.emitError("channel join error",s)}),this.channel.on("state:change",s=>this.handleChange(s)),this.channel.on("state:patch",s=>this.handlePatch(s)),this.connected=!0)}disconnect(){this.channel&&this.channel.leave(),this.socket.disconnect(),this.connected=!1}addEventListener(s,t,e){var i;this.eventTarget.addEventListener(s,t,e),s.startsWith("livestate-")||(i=this.channel)==null||i.on(s,r=>{this.eventTarget.dispatchEvent(new CustomEvent(s,{detail:r}))})}removeEventListener(s,t,e){return this.eventTarget.removeEventListener(s,t,e)}subscribe(s){this.addEventListener("livestate-change",s)}unsubscribe(s){this.removeEventListener("livestate-change",s)}emitError(s,t){this.eventTarget.dispatchEvent(new CustomEvent("livestate-error",{detail:{kind:s,error:t}}))}handleChange({state:s,version:t}){this.state=s,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}handlePatch({patch:s,version:t}){if(this.eventTarget.dispatchEvent(new CustomEvent("livestate-patch",{detail:{patch:s,version:t}})),t===this.stateVersion+1){const{doc:e,res:i}=Ms(this.state,s,{mutate:!1});this.state=e,this.stateVersion=t,this.eventTarget.dispatchEvent(new CustomEvent("livestate-change",{detail:{state:this.state,version:this.stateVersion}}))}else this.channel.push("lvs_refresh")}pushEvent(s,t){this.dispatchEvent(new CustomEvent(s,{detail:t}))}dispatchEvent(s){return this.channel.push(`lvs_evt:${s.type}`,s.detail),!0}pushCustomEvent(s){this.dispatchEvent(s)}}const Vs=(n,s,{properties:t,attributes:e,events:i})=>{var r,o;s.liveState!==n&&(n.connect(),t==null||t.forEach(l=>zs(n,s,l)),e==null||e.forEach(l=>Js(n,s,l)),(r=i==null?void 0:i.send)==null||r.forEach(l=>Ws(n,s,l)),(o=i==null?void 0:i.receive)==null||o.forEach(l=>Bs(n,s,l)),s.liveState=n)},zs=(n,s,t)=>{n.addEventListener("livestate-change",({detail:{state:e}})=>{s[t]=e[t]})},Js=(n,s,t)=>{n.addEventListener("livestate-change",({detail:{state:e}})=>{s.setAttribute(t,e[t])})},Bs=(n,s,t)=>{n.addEventListener(t,({detail:e})=>{s.dispatchEvent(new CustomEvent(t,{detail:e}))})},Ws=(n,s,t)=>{s.addEventListener(t,e=>{const{detail:i}=e;n.dispatchEvent(new CustomEvent(t,{detail:i}))})};Promise.resolve();var ce=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/*! *****************************************************************************
36
36
  Copyright (C) Microsoft. All rights reserved.
37
37
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use
38
38
  this file except in compliance with the License. You may obtain a copy of the
@@ -45,7 +45,7 @@
45
45
 
46
46
  See the Apache Version 2.0 License for specific language governing permissions
47
47
  and limitations under the License.
48
- ***************************************************************************** */var ue;(function(n){(function(s){var t=typeof ce=="object"?ce:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),e=i(n);typeof t.Reflect>"u"?t.Reflect=n:e=i(t.Reflect,e),s(e);function i(r,o){return function(l,u){typeof r[l]!="function"&&Object.defineProperty(r,l,{configurable:!0,writable:!0,value:u}),o&&o(l,u)}}})(function(s){var t=Object.prototype.hasOwnProperty,e=typeof Symbol=="function",i=e&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",r=e&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!o&&!l,d={create:o?function(){return Vt(Object.create(null))}:l?function(){return Vt({__proto__:null})}:function(){return Vt({})},has:u?function(a,h){return t.call(a,h)}:function(a,h){return h in a},get:u?function(a,h){return t.call(a,h)?a[h]:void 0}:function(a,h){return a[h]}},T=Object.getPrototypeOf(Function),y=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",$=!y&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:mn(),O=!y&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:_n(),Y=!y&&typeof WeakMap=="function"?WeakMap:wn(),I=new Y;function Xs(a,h,c,p){if(S(c)){if(!we(a))throw new TypeError;if(!Ee(h))throw new TypeError;return on(a,h)}else{if(!we(a))throw new TypeError;if(!j(h))throw new TypeError;if(!j(p)&&!S(p)&&!Z(p))throw new TypeError;return Z(p)&&(p=void 0),c=V(c),an(a,h,c,p)}}s("decorate",Xs);function Ks(a,h){function c(p,f){if(!j(p))throw new TypeError;if(!S(f)&&!dn(f))throw new TypeError;ge(a,h,p,f)}return c}s("metadata",Ks);function Ys(a,h,c,p){if(!j(c))throw new TypeError;return S(p)||(p=V(p)),ge(a,h,c,p)}s("defineMetadata",Ys);function Zs(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),de(a,h,c)}s("hasMetadata",Zs);function Qs(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),Dt(a,h,c)}s("hasOwnMetadata",Qs);function tn(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),fe(a,h,c)}s("getMetadata",tn);function en(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),ve(a,h,c)}s("getOwnMetadata",en);function sn(a,h){if(!j(a))throw new TypeError;return S(h)||(h=V(h)),ye(a,h)}s("getMetadataKeys",sn);function nn(a,h){if(!j(a))throw new TypeError;return S(h)||(h=V(h)),me(a,h)}s("getOwnMetadataKeys",nn);function rn(a,h,c){if(!j(h))throw new TypeError;S(c)||(c=V(c));var p=pt(h,c,!1);if(S(p)||!p.delete(a))return!1;if(p.size>0)return!0;var f=I.get(h);return f.delete(c),f.size>0||I.delete(h),!0}s("deleteMetadata",rn);function on(a,h){for(var c=a.length-1;c>=0;--c){var p=a[c],f=p(h);if(!S(f)&&!Z(f)){if(!Ee(f))throw new TypeError;h=f}}return h}function an(a,h,c,p){for(var f=a.length-1;f>=0;--f){var M=a[f],m=M(h,c,p);if(!S(m)&&!Z(m)){if(!j(m))throw new TypeError;p=m}}return p}function pt(a,h,c){var p=I.get(a);if(S(p)){if(!c)return;p=new $,I.set(a,p)}var f=p.get(h);if(S(f)){if(!c)return;f=new $,p.set(h,f)}return f}function de(a,h,c){var p=Dt(a,h,c);if(p)return!0;var f=It(h);return Z(f)?!1:de(a,f,c)}function Dt(a,h,c){var p=pt(h,c,!1);return S(p)?!1:un(p.has(a))}function fe(a,h,c){var p=Dt(a,h,c);if(p)return ve(a,h,c);var f=It(h);if(!Z(f))return fe(a,f,c)}function ve(a,h,c){var p=pt(h,c,!1);if(!S(p))return p.get(a)}function ge(a,h,c,p){var f=pt(c,p,!0);f.set(a,h)}function ye(a,h){var c=me(a,h),p=It(a);if(p===null)return c;var f=ye(p,h);if(f.length<=0)return c;if(c.length<=0)return f;for(var M=new O,m=[],_=0,v=c;_<v.length;_++){var b=v[_],A=M.has(b);A||(M.add(b),m.push(b))}for(var z=0,Ae=f;z<Ae.length;z++){var b=Ae[z],A=M.has(b);A||(M.add(b),m.push(b))}return m}function me(a,h){var c=[],p=pt(a,h,!1);if(S(p))return c;for(var f=p.keys(),M=fn(f),m=0;;){var _=gn(M);if(!_)return c.length=m,c;var v=vn(_);try{c[m]=v}catch(b){try{yn(M)}finally{throw b}}m++}}function _e(a){if(a===null)return 1;switch(typeof a){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return a===null?1:6;default:return 6}}function S(a){return a===void 0}function Z(a){return a===null}function hn(a){return typeof a=="symbol"}function j(a){return typeof a=="object"?a!==null:typeof a=="function"}function ln(a,h){switch(_e(a)){case 0:return a;case 1:return a;case 2:return a;case 3:return a;case 4:return a;case 5:return a}var c=h===3?"string":h===5?"number":"default",p=be(a,i);if(p!==void 0){var f=p.call(a,c);if(j(f))throw new TypeError;return f}return cn(a,c==="default"?"number":c)}function cn(a,h){if(h==="string"){var c=a.toString;if(Q(c)){var p=c.call(a);if(!j(p))return p}var f=a.valueOf;if(Q(f)){var p=f.call(a);if(!j(p))return p}}else{var f=a.valueOf;if(Q(f)){var p=f.call(a);if(!j(p))return p}var M=a.toString;if(Q(M)){var p=M.call(a);if(!j(p))return p}}throw new TypeError}function un(a){return!!a}function pn(a){return""+a}function V(a){var h=ln(a,3);return hn(h)?h:pn(h)}function we(a){return Array.isArray?Array.isArray(a):a instanceof Object?a instanceof Array:Object.prototype.toString.call(a)==="[object Array]"}function Q(a){return typeof a=="function"}function Ee(a){return typeof a=="function"}function dn(a){switch(_e(a)){case 3:return!0;case 4:return!0;default:return!1}}function be(a,h){var c=a[h];if(c!=null){if(!Q(c))throw new TypeError;return c}}function fn(a){var h=be(a,r);if(!Q(h))throw new TypeError;var c=h.call(a);if(!j(c))throw new TypeError;return c}function vn(a){return a.value}function gn(a){var h=a.next();return h.done?!1:h}function yn(a){var h=a.return;h&&h.call(a)}function It(a){var h=Object.getPrototypeOf(a);if(typeof a!="function"||a===T||h!==T)return h;var c=a.prototype,p=c&&Object.getPrototypeOf(c);if(p==null||p===Object.prototype)return h;var f=p.constructor;return typeof f!="function"||f===a?h:f}function mn(){var a={},h=[],c=function(){function m(_,v,b){this._index=0,this._keys=_,this._values=v,this._selector=b}return m.prototype["@@iterator"]=function(){return this},m.prototype[r]=function(){return this},m.prototype.next=function(){var _=this._index;if(_>=0&&_<this._keys.length){var v=this._selector(this._keys[_],this._values[_]);return _+1>=this._keys.length?(this._index=-1,this._keys=h,this._values=h):this._index++,{value:v,done:!1}}return{value:void 0,done:!0}},m.prototype.throw=function(_){throw this._index>=0&&(this._index=-1,this._keys=h,this._values=h),_},m.prototype.return=function(_){return this._index>=0&&(this._index=-1,this._keys=h,this._values=h),{value:_,done:!0}},m}();return function(){function m(){this._keys=[],this._values=[],this._cacheKey=a,this._cacheIndex=-2}return Object.defineProperty(m.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),m.prototype.has=function(_){return this._find(_,!1)>=0},m.prototype.get=function(_){var v=this._find(_,!1);return v>=0?this._values[v]:void 0},m.prototype.set=function(_,v){var b=this._find(_,!0);return this._values[b]=v,this},m.prototype.delete=function(_){var v=this._find(_,!1);if(v>=0){for(var b=this._keys.length,A=v+1;A<b;A++)this._keys[A-1]=this._keys[A],this._values[A-1]=this._values[A];return this._keys.length--,this._values.length--,_===this._cacheKey&&(this._cacheKey=a,this._cacheIndex=-2),!0}return!1},m.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=a,this._cacheIndex=-2},m.prototype.keys=function(){return new c(this._keys,this._values,p)},m.prototype.values=function(){return new c(this._keys,this._values,f)},m.prototype.entries=function(){return new c(this._keys,this._values,M)},m.prototype["@@iterator"]=function(){return this.entries()},m.prototype[r]=function(){return this.entries()},m.prototype._find=function(_,v){return this._cacheKey!==_&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=_)),this._cacheIndex<0&&v&&(this._cacheIndex=this._keys.length,this._keys.push(_),this._values.push(void 0)),this._cacheIndex},m}();function p(m,_){return m}function f(m,_){return _}function M(m,_){return[m,_]}}function _n(){return function(){function a(){this._map=new $}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(h){return this._map.has(h)},a.prototype.add=function(h){return this._map.set(h,h),this},a.prototype.delete=function(h){return this._map.delete(h)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.values()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[r]=function(){return this.keys()},a}()}function wn(){var a=16,h=d.create(),c=p();return function(){function v(){this._key=p()}return v.prototype.has=function(b){var A=f(b,!1);return A!==void 0?d.has(A,this._key):!1},v.prototype.get=function(b){var A=f(b,!1);return A!==void 0?d.get(A,this._key):void 0},v.prototype.set=function(b,A){var z=f(b,!0);return z[this._key]=A,this},v.prototype.delete=function(b){var A=f(b,!1);return A!==void 0?delete A[this._key]:!1},v.prototype.clear=function(){this._key=p()},v}();function p(){var v;do v="@@WeakMap@@"+_();while(d.has(h,v));return h[v]=!0,v}function f(v,b){if(!t.call(v,c)){if(!b)return;Object.defineProperty(v,c,{value:d.create()})}return v[c]}function M(v,b){for(var A=0;A<b;++A)v[A]=Math.random()*255|0;return v}function m(v){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(v)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(v)):M(new Uint8Array(v),v):M(new Array(v),v)}function _(){var v=m(a);v[6]=v[6]&79|64,v[8]=v[8]&191|128;for(var b="",A=0;A<a;++A){var z=v[A];(A===4||A===6||A===8)&&(b+="-"),z<16&&(b+="0"),b+=z.toString(16).toLowerCase()}return b}}function Vt(a){return a.__=void 0,delete a.__,a}})})(ue||(ue={}));var Gs=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,ut=(n,s,t,e)=>{for(var i=e>1?void 0:e?Fs(s,t):s,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(e?o(s,t,i):o(i))||i);return e&&i&&Gs(s,t,i),i};k.LiveroomClientElement=class extends rt{constructor(){super(...arguments),this.users={},this._throttledDispatchMouseMove=qs(this._dispatchMouseMove.bind(this),8)}render(){var s,t;return se`
48
+ ***************************************************************************** */var ue;(function(n){(function(s){var t=typeof ce=="object"?ce:typeof self=="object"?self:typeof this=="object"?this:Function("return this;")(),e=i(n);typeof t.Reflect>"u"?t.Reflect=n:e=i(t.Reflect,e),s(e);function i(r,o){return function(l,u){typeof r[l]!="function"&&Object.defineProperty(r,l,{configurable:!0,writable:!0,value:u}),o&&o(l,u)}}})(function(s){var t=Object.prototype.hasOwnProperty,e=typeof Symbol=="function",i=e&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",r=e&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",o=typeof Object.create=="function",l={__proto__:[]}instanceof Array,u=!o&&!l,d={create:o?function(){return Vt(Object.create(null))}:l?function(){return Vt({__proto__:null})}:function(){return Vt({})},has:u?function(a,h){return t.call(a,h)}:function(a,h){return h in a},get:u?function(a,h){return t.call(a,h)?a[h]:void 0}:function(a,h){return a[h]}},T=Object.getPrototypeOf(Function),y=typeof process=="object"&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL==="true",$=!y&&typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:mn(),O=!y&&typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:_n(),Y=!y&&typeof WeakMap=="function"?WeakMap:wn(),I=new Y;function Xs(a,h,c,p){if(S(c)){if(!we(a))throw new TypeError;if(!Ee(h))throw new TypeError;return on(a,h)}else{if(!we(a))throw new TypeError;if(!j(h))throw new TypeError;if(!j(p)&&!S(p)&&!Z(p))throw new TypeError;return Z(p)&&(p=void 0),c=V(c),an(a,h,c,p)}}s("decorate",Xs);function Ks(a,h){function c(p,f){if(!j(p))throw new TypeError;if(!S(f)&&!dn(f))throw new TypeError;ge(a,h,p,f)}return c}s("metadata",Ks);function Ys(a,h,c,p){if(!j(c))throw new TypeError;return S(p)||(p=V(p)),ge(a,h,c,p)}s("defineMetadata",Ys);function Zs(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),de(a,h,c)}s("hasMetadata",Zs);function Qs(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),Dt(a,h,c)}s("hasOwnMetadata",Qs);function tn(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),fe(a,h,c)}s("getMetadata",tn);function en(a,h,c){if(!j(h))throw new TypeError;return S(c)||(c=V(c)),ve(a,h,c)}s("getOwnMetadata",en);function sn(a,h){if(!j(a))throw new TypeError;return S(h)||(h=V(h)),ye(a,h)}s("getMetadataKeys",sn);function nn(a,h){if(!j(a))throw new TypeError;return S(h)||(h=V(h)),me(a,h)}s("getOwnMetadataKeys",nn);function rn(a,h,c){if(!j(h))throw new TypeError;S(c)||(c=V(c));var p=pt(h,c,!1);if(S(p)||!p.delete(a))return!1;if(p.size>0)return!0;var f=I.get(h);return f.delete(c),f.size>0||I.delete(h),!0}s("deleteMetadata",rn);function on(a,h){for(var c=a.length-1;c>=0;--c){var p=a[c],f=p(h);if(!S(f)&&!Z(f)){if(!Ee(f))throw new TypeError;h=f}}return h}function an(a,h,c,p){for(var f=a.length-1;f>=0;--f){var M=a[f],m=M(h,c,p);if(!S(m)&&!Z(m)){if(!j(m))throw new TypeError;p=m}}return p}function pt(a,h,c){var p=I.get(a);if(S(p)){if(!c)return;p=new $,I.set(a,p)}var f=p.get(h);if(S(f)){if(!c)return;f=new $,p.set(h,f)}return f}function de(a,h,c){var p=Dt(a,h,c);if(p)return!0;var f=It(h);return Z(f)?!1:de(a,f,c)}function Dt(a,h,c){var p=pt(h,c,!1);return S(p)?!1:un(p.has(a))}function fe(a,h,c){var p=Dt(a,h,c);if(p)return ve(a,h,c);var f=It(h);if(!Z(f))return fe(a,f,c)}function ve(a,h,c){var p=pt(h,c,!1);if(!S(p))return p.get(a)}function ge(a,h,c,p){var f=pt(c,p,!0);f.set(a,h)}function ye(a,h){var c=me(a,h),p=It(a);if(p===null)return c;var f=ye(p,h);if(f.length<=0)return c;if(c.length<=0)return f;for(var M=new O,m=[],_=0,v=c;_<v.length;_++){var b=v[_],A=M.has(b);A||(M.add(b),m.push(b))}for(var J=0,Ae=f;J<Ae.length;J++){var b=Ae[J],A=M.has(b);A||(M.add(b),m.push(b))}return m}function me(a,h){var c=[],p=pt(a,h,!1);if(S(p))return c;for(var f=p.keys(),M=fn(f),m=0;;){var _=gn(M);if(!_)return c.length=m,c;var v=vn(_);try{c[m]=v}catch(b){try{yn(M)}finally{throw b}}m++}}function _e(a){if(a===null)return 1;switch(typeof a){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return a===null?1:6;default:return 6}}function S(a){return a===void 0}function Z(a){return a===null}function hn(a){return typeof a=="symbol"}function j(a){return typeof a=="object"?a!==null:typeof a=="function"}function ln(a,h){switch(_e(a)){case 0:return a;case 1:return a;case 2:return a;case 3:return a;case 4:return a;case 5:return a}var c=h===3?"string":h===5?"number":"default",p=be(a,i);if(p!==void 0){var f=p.call(a,c);if(j(f))throw new TypeError;return f}return cn(a,c==="default"?"number":c)}function cn(a,h){if(h==="string"){var c=a.toString;if(Q(c)){var p=c.call(a);if(!j(p))return p}var f=a.valueOf;if(Q(f)){var p=f.call(a);if(!j(p))return p}}else{var f=a.valueOf;if(Q(f)){var p=f.call(a);if(!j(p))return p}var M=a.toString;if(Q(M)){var p=M.call(a);if(!j(p))return p}}throw new TypeError}function un(a){return!!a}function pn(a){return""+a}function V(a){var h=ln(a,3);return hn(h)?h:pn(h)}function we(a){return Array.isArray?Array.isArray(a):a instanceof Object?a instanceof Array:Object.prototype.toString.call(a)==="[object Array]"}function Q(a){return typeof a=="function"}function Ee(a){return typeof a=="function"}function dn(a){switch(_e(a)){case 3:return!0;case 4:return!0;default:return!1}}function be(a,h){var c=a[h];if(c!=null){if(!Q(c))throw new TypeError;return c}}function fn(a){var h=be(a,r);if(!Q(h))throw new TypeError;var c=h.call(a);if(!j(c))throw new TypeError;return c}function vn(a){return a.value}function gn(a){var h=a.next();return h.done?!1:h}function yn(a){var h=a.return;h&&h.call(a)}function It(a){var h=Object.getPrototypeOf(a);if(typeof a!="function"||a===T||h!==T)return h;var c=a.prototype,p=c&&Object.getPrototypeOf(c);if(p==null||p===Object.prototype)return h;var f=p.constructor;return typeof f!="function"||f===a?h:f}function mn(){var a={},h=[],c=function(){function m(_,v,b){this._index=0,this._keys=_,this._values=v,this._selector=b}return m.prototype["@@iterator"]=function(){return this},m.prototype[r]=function(){return this},m.prototype.next=function(){var _=this._index;if(_>=0&&_<this._keys.length){var v=this._selector(this._keys[_],this._values[_]);return _+1>=this._keys.length?(this._index=-1,this._keys=h,this._values=h):this._index++,{value:v,done:!1}}return{value:void 0,done:!0}},m.prototype.throw=function(_){throw this._index>=0&&(this._index=-1,this._keys=h,this._values=h),_},m.prototype.return=function(_){return this._index>=0&&(this._index=-1,this._keys=h,this._values=h),{value:_,done:!0}},m}();return function(){function m(){this._keys=[],this._values=[],this._cacheKey=a,this._cacheIndex=-2}return Object.defineProperty(m.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),m.prototype.has=function(_){return this._find(_,!1)>=0},m.prototype.get=function(_){var v=this._find(_,!1);return v>=0?this._values[v]:void 0},m.prototype.set=function(_,v){var b=this._find(_,!0);return this._values[b]=v,this},m.prototype.delete=function(_){var v=this._find(_,!1);if(v>=0){for(var b=this._keys.length,A=v+1;A<b;A++)this._keys[A-1]=this._keys[A],this._values[A-1]=this._values[A];return this._keys.length--,this._values.length--,_===this._cacheKey&&(this._cacheKey=a,this._cacheIndex=-2),!0}return!1},m.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=a,this._cacheIndex=-2},m.prototype.keys=function(){return new c(this._keys,this._values,p)},m.prototype.values=function(){return new c(this._keys,this._values,f)},m.prototype.entries=function(){return new c(this._keys,this._values,M)},m.prototype["@@iterator"]=function(){return this.entries()},m.prototype[r]=function(){return this.entries()},m.prototype._find=function(_,v){return this._cacheKey!==_&&(this._cacheIndex=this._keys.indexOf(this._cacheKey=_)),this._cacheIndex<0&&v&&(this._cacheIndex=this._keys.length,this._keys.push(_),this._values.push(void 0)),this._cacheIndex},m}();function p(m,_){return m}function f(m,_){return _}function M(m,_){return[m,_]}}function _n(){return function(){function a(){this._map=new $}return Object.defineProperty(a.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),a.prototype.has=function(h){return this._map.has(h)},a.prototype.add=function(h){return this._map.set(h,h),this},a.prototype.delete=function(h){return this._map.delete(h)},a.prototype.clear=function(){this._map.clear()},a.prototype.keys=function(){return this._map.keys()},a.prototype.values=function(){return this._map.values()},a.prototype.entries=function(){return this._map.entries()},a.prototype["@@iterator"]=function(){return this.keys()},a.prototype[r]=function(){return this.keys()},a}()}function wn(){var a=16,h=d.create(),c=p();return function(){function v(){this._key=p()}return v.prototype.has=function(b){var A=f(b,!1);return A!==void 0?d.has(A,this._key):!1},v.prototype.get=function(b){var A=f(b,!1);return A!==void 0?d.get(A,this._key):void 0},v.prototype.set=function(b,A){var J=f(b,!0);return J[this._key]=A,this},v.prototype.delete=function(b){var A=f(b,!1);return A!==void 0?delete A[this._key]:!1},v.prototype.clear=function(){this._key=p()},v}();function p(){var v;do v="@@WeakMap@@"+_();while(d.has(h,v));return h[v]=!0,v}function f(v,b){if(!t.call(v,c)){if(!b)return;Object.defineProperty(v,c,{value:d.create()})}return v[c]}function M(v,b){for(var A=0;A<b;++A)v[A]=Math.random()*255|0;return v}function m(v){return typeof Uint8Array=="function"?typeof crypto<"u"?crypto.getRandomValues(new Uint8Array(v)):typeof msCrypto<"u"?msCrypto.getRandomValues(new Uint8Array(v)):M(new Uint8Array(v),v):M(new Array(v),v)}function _(){var v=m(a);v[6]=v[6]&79|64,v[8]=v[8]&191|128;for(var b="",A=0;A<a;++A){var J=v[A];(A===4||A===6||A===8)&&(b+="-"),J<16&&(b+="0"),b+=J.toString(16).toLowerCase()}return b}}function Vt(a){return a.__=void 0,delete a.__,a}})})(ue||(ue={}));var Gs=Object.defineProperty,Fs=Object.getOwnPropertyDescriptor,ut=(n,s,t,e)=>{for(var i=e>1?void 0:e?Fs(s,t):s,r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=(e?o(s,t,i):o(i))||i);return e&&i&&Gs(s,t,i),i};k.LiveroomClientElement=class extends rt{constructor(){super(...arguments),this.users={},this._throttledDispatchMouseMove=qs(this._dispatchMouseMove.bind(this),8)}render(){var s,t;return se`
49
49
  <div id="users-container">
50
50
  ${Object.values(this.users).map(e=>{var i;return se`
51
51
  <div
@@ -162,6 +162,7 @@
162
162
  }
163
163
 
164
164
  .banner {
165
+ z-index: 1000;
165
166
  position: fixed;
166
167
  bottom: 12px;
167
168
  inset-inline: 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "liveroom-client-element",
3
3
  "private": false,
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "type": "module",
6
6
  "main": "liveroom-client-element.js",
7
7
  "module": "liveroom-client-element.js",
@@ -24,4 +24,4 @@
24
24
  "typescript": "^5.0.2",
25
25
  "vite": "^4.3.9"
26
26
  }
27
- }
27
+ }