@micro-lc/preview 0.5.0-rc5 → 0.5.0-rc7

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.
@@ -2403,65 +2403,82 @@ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof win
2403
2403
  const [imports, exports] = load.a;
2404
2404
  const source = load.S;
2405
2405
  let resolvedSource = edge && lastLoad ? `import '${lastLoad}';` : "";
2406
- if (!imports.length) {
2407
- resolvedSource += source;
2408
- } else {
2409
- let pushStringTo = function(originalIndex) {
2410
- while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
2411
- const dynamicImportEnd = dynamicImportEndStack.pop();
2412
- resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
2413
- lastIndex = dynamicImportEnd;
2414
- }
2415
- resolvedSource += source.slice(lastIndex, originalIndex);
2416
- lastIndex = originalIndex;
2417
- };
2418
- let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
2419
- for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
2420
- if (dynamicImportIndex === -1) {
2421
- let depLoad = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
2422
- if (cycleShell) {
2423
- if (!(blobUrl = depLoad.s)) {
2424
- blobUrl = depLoad.s = createBlob(`export function u$_(m){${depLoad.a[1].map(({ s: s3, e: e3 }, i3) => {
2425
- const q = depLoad.S[s3] === '"' || depLoad.S[s3] === "'";
2426
- return `e$_${i3}=m${q ? `[` : "."}${depLoad.S.slice(s3, e3)}${q ? `]` : ""}`;
2427
- }).join(",")}}${depLoad.a[1].length ? `let ${depLoad.a[1].map((_2, i3) => `e$_${i3}`).join(",")};` : ""}export {${depLoad.a[1].map(({ s: s3, e: e3 }, i3) => `e$_${i3} as ${depLoad.S.slice(s3, e3)}`).join(",")}}
2406
+ let lastIndex = 0, depIndex = 0, dynamicImportEndStack = [];
2407
+ function pushStringTo(originalIndex) {
2408
+ while (dynamicImportEndStack[dynamicImportEndStack.length - 1] < originalIndex) {
2409
+ const dynamicImportEnd = dynamicImportEndStack.pop();
2410
+ resolvedSource += `${source.slice(lastIndex, dynamicImportEnd)}, ${urlJsString(load.r)}`;
2411
+ lastIndex = dynamicImportEnd;
2412
+ }
2413
+ resolvedSource += source.slice(lastIndex, originalIndex);
2414
+ lastIndex = originalIndex;
2415
+ }
2416
+ for (const { s: start, ss: statementStart, se: statementEnd, d: dynamicImportIndex } of imports) {
2417
+ if (dynamicImportIndex === -1) {
2418
+ let depLoad = load.d[depIndex++], blobUrl = depLoad.b, cycleShell = !blobUrl;
2419
+ if (cycleShell) {
2420
+ if (!(blobUrl = depLoad.s)) {
2421
+ blobUrl = depLoad.s = createBlob(`export function u$_(m){${depLoad.a[1].map(({ s: s3, e: e3 }, i3) => {
2422
+ const q = depLoad.S[s3] === '"' || depLoad.S[s3] === "'";
2423
+ return `e$_${i3}=m${q ? `[` : "."}${depLoad.S.slice(s3, e3)}${q ? `]` : ""}`;
2424
+ }).join(",")}}${depLoad.a[1].length ? `let ${depLoad.a[1].map((_2, i3) => `e$_${i3}`).join(",")};` : ""}export {${depLoad.a[1].map(({ s: s3, e: e3 }, i3) => `e$_${i3} as ${depLoad.S.slice(s3, e3)}`).join(",")}}
2428
2425
  //# sourceURL=${depLoad.r}?cycle`);
2429
- }
2430
- }
2431
- pushStringTo(start - 1);
2432
- resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
2433
- if (!cycleShell && depLoad.s) {
2434
- resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
2435
- depLoad.s = void 0;
2436
2426
  }
2437
- lastIndex = statementEnd;
2438
- } else if (dynamicImportIndex === -2) {
2439
- load.m = { url: load.r, resolve: metaResolve };
2440
- metaHook(load.m, load.u);
2441
- pushStringTo(start);
2442
- resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
2443
- lastIndex = statementEnd;
2444
- } else {
2445
- pushStringTo(statementStart + 6);
2446
- resolvedSource += `Shim(`;
2447
- dynamicImportEndStack.push(statementEnd - 1);
2448
- lastIndex = start;
2449
2427
  }
2428
+ pushStringTo(start - 1);
2429
+ resolvedSource += `/*${source.slice(start - 1, statementEnd)}*/${urlJsString(blobUrl)}`;
2430
+ if (!cycleShell && depLoad.s) {
2431
+ resolvedSource += `;import*as m$_${depIndex} from'${depLoad.b}';import{u$_ as u$_${depIndex}}from'${depLoad.s}';u$_${depIndex}(m$_${depIndex})`;
2432
+ depLoad.s = void 0;
2433
+ }
2434
+ lastIndex = statementEnd;
2435
+ } else if (dynamicImportIndex === -2) {
2436
+ load.m = { url: load.r, resolve: metaResolve };
2437
+ metaHook(load.m, load.u);
2438
+ pushStringTo(start);
2439
+ resolvedSource += `importShim._r[${urlJsString(load.u)}].m`;
2440
+ lastIndex = statementEnd;
2441
+ } else {
2442
+ pushStringTo(statementStart + 6);
2443
+ resolvedSource += `Shim(`;
2444
+ dynamicImportEndStack.push(statementEnd - 1);
2445
+ lastIndex = start;
2450
2446
  }
2451
- if (load.s)
2452
- resolvedSource += `
2447
+ }
2448
+ if (load.s)
2449
+ resolvedSource += `
2453
2450
  ;import{u$_}from'${load.s}';try{u$_({${exports.filter((e3) => e3.ln).map(({ s: s3, e: e3, ln }) => `${source.slice(s3, e3)}:${ln}`).join(",")}})}catch(_){};
2454
2451
  `;
2455
- pushStringTo(source.length);
2456
- }
2457
- let hasSourceURL = false;
2458
- resolvedSource = resolvedSource.replace(sourceMapURLRegEx, (match, isMapping, url) => (hasSourceURL = !isMapping, match.replace(url, () => new URL(url, load.r))));
2459
- if (!hasSourceURL)
2460
- resolvedSource += "\n//# sourceURL=" + load.r;
2452
+ function pushSourceURL(commentPrefix, commentStart) {
2453
+ const urlStart = commentStart + commentPrefix.length;
2454
+ const commentEnd = source.indexOf("\n", urlStart);
2455
+ const urlEnd = commentEnd !== -1 ? commentEnd : source.length;
2456
+ pushStringTo(urlStart);
2457
+ resolvedSource += new URL(source.slice(urlStart, urlEnd), load.r).href;
2458
+ lastIndex = urlEnd;
2459
+ }
2460
+ let sourceURLCommentStart = source.lastIndexOf(sourceURLCommentPrefix);
2461
+ let sourceMapURLCommentStart = source.lastIndexOf(sourceMapURLCommentPrefix);
2462
+ if (sourceURLCommentStart < lastIndex)
2463
+ sourceURLCommentStart = -1;
2464
+ if (sourceMapURLCommentStart < lastIndex)
2465
+ sourceMapURLCommentStart = -1;
2466
+ if (sourceURLCommentStart !== -1 && (sourceMapURLCommentStart === -1 || sourceMapURLCommentStart > sourceURLCommentStart)) {
2467
+ pushSourceURL(sourceURLCommentPrefix, sourceURLCommentStart);
2468
+ }
2469
+ if (sourceMapURLCommentStart !== -1) {
2470
+ pushSourceURL(sourceMapURLCommentPrefix, sourceMapURLCommentStart);
2471
+ if (sourceURLCommentStart !== -1 && sourceURLCommentStart > sourceMapURLCommentStart)
2472
+ pushSourceURL(sourceURLCommentPrefix, sourceURLCommentStart);
2473
+ }
2474
+ pushStringTo(source.length);
2475
+ if (sourceURLCommentStart === -1)
2476
+ resolvedSource += sourceURLCommentPrefix + load.r;
2461
2477
  load.b = lastLoad = createBlob(resolvedSource);
2462
2478
  load.S = void 0;
2463
2479
  }
2464
- const sourceMapURLRegEx = /\n\/\/# source(Mapping)?URL=([^\n]+)\s*((;|\/\/[^#][^\n]*)\s*)*$/;
2480
+ const sourceURLCommentPrefix = "\n//# sourceURL=";
2481
+ const sourceMapURLCommentPrefix = "\n//# sourceMappingURL=";
2465
2482
  const jsContentType = /^(text|application)\/(x-)?javascript(;|$)/;
2466
2483
  const jsonContentType = /^(text|application)\/json(;|$)/;
2467
2484
  const cssContentType = /^(text|application)\/css(;|$)/;
@@ -4941,8 +4958,29 @@ function parse(input, context, preserveUnknown = false) {
4941
4958
  return acc;
4942
4959
  }
4943
4960
  const compileObject = (obj, context) => Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, parse(value, context)]));
4961
+ var DebugMessage = /* @__PURE__ */ ((DebugMessage2) => {
4962
+ DebugMessage2[DebugMessage2["Default"] = 0] = "Default";
4963
+ DebugMessage2[DebugMessage2["Skip"] = 1] = "Skip";
4964
+ return DebugMessage2;
4965
+ })(DebugMessage || {});
4944
4966
  const MIA_PREVIEW_ID = "__mia_preview_id";
4945
4967
  const OVERLAY_Z_INDEX = 1e6;
4968
+ const keys = {
4969
+ "click-element": 0,
4970
+ "ctrl-space": 0,
4971
+ "focus-element": 0,
4972
+ mousedown: 0,
4973
+ mousemove: 1,
4974
+ "new-configuration": 0,
4975
+ notification: 0,
4976
+ options: 0,
4977
+ "request-resource": 0,
4978
+ "set-source-map": 0,
4979
+ "tag-info": 0,
4980
+ update: 0,
4981
+ updated: 0
4982
+ /* Default */
4983
+ };
4946
4984
  var t;
4947
4985
  const i = window, s = i.trustedTypes, e = s ? s.createPolicy("lit-html", { createHTML: (t2) => t2 }) : void 0, o = "$lit$", n = `lit$${(Math.random() + "").slice(9)}$`, l = "?" + n, h = `<${l}>`, r = document, d = () => r.createComment(""), u = (t2) => null === t2 || "object" != typeof t2 && "function" != typeof t2, c = Array.isArray, v = (t2) => c(t2) || "function" == typeof (null == t2 ? void 0 : t2[Symbol.iterator]), a = "[ \n\f\r]", f = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, _ = /-->/g, m = />/g, p = RegExp(`>|${a}(?:([^\\s"'>=/]+)(${a}*=${a}*(?:[^
4948
4986
  \f\r"'\`<>=]|("|')|))|$)`, "g"), g = /'/g, $ = /"/g, y = /^(?:script|style|textarea|title)$/i, w = (t2) => (i2, ...s2) => ({ _$litType$: t2, strings: i2, values: s2 }), x = w(1), T = Symbol.for("lit-noChange"), A = Symbol.for("lit-nothing"), E = /* @__PURE__ */ new WeakMap(), C = r.createTreeWalker(r, 129, null, false), P = (t2, i2) => {
@@ -5747,8 +5785,8 @@ var PostChannel = class {
5747
5785
  this.__instance = instance;
5748
5786
  const color = generateDarkColorHex();
5749
5787
  this.__colors = {
5750
- bg: color,
5751
- fg: `${color}22`
5788
+ bg: `${color}22`,
5789
+ fg: color
5752
5790
  };
5753
5791
  this.__receiver = to;
5754
5792
  this.__connect(
@@ -5951,27 +5989,42 @@ const parentMakeListener = (self2, channels) => (message) => {
5951
5989
  channels.focus.next(data.content);
5952
5990
  break;
5953
5991
  case "set-source-map": {
5954
- const { dictionary, ...rest } = data.content;
5955
- channels.setSourceMap.next({
5956
- ...rest,
5957
- dictionary: Object.entries(dictionary).reduce((acc, [from2, to]) => {
5958
- try {
5959
- const { href: fromUrl } = new URL(from2, self2.location.href);
5960
- const obj = typeof to === "string" ? { headers: {}, query: {}, to } : to;
5961
- acc[fromUrl] = {
5962
- originalFrom: from2,
5963
- ...obj
5964
- };
5965
- } catch (e2) {
5966
- }
5967
- return acc;
5968
- }, {})
5969
- });
5992
+ const { content } = data;
5993
+ channels.setSourceMap.next(Object.entries(content).reduce((acc, [from2, to]) => {
5994
+ try {
5995
+ const { href: fromUrl } = new URL(from2, self2.location.href);
5996
+ const obj = typeof to === "string" ? { headers: {}, query: {}, to } : to;
5997
+ acc[fromUrl] = {
5998
+ originalFrom: from2,
5999
+ ...obj
6000
+ };
6001
+ } catch (e2) {
6002
+ }
6003
+ return acc;
6004
+ }, {}));
5970
6005
  break;
5971
6006
  }
5972
6007
  }
5973
6008
  };
5974
- const registerParent = (self2, channels) => new src_default(parentMakeListener(self2, channels), self2, fromWindowToReceiver(self2.parent));
6009
+ const registerParent = (self2, channels) => new src_default(
6010
+ parentMakeListener(self2, channels),
6011
+ self2,
6012
+ fromWindowToReceiver(self2.parent),
6013
+ {
6014
+ log(message) {
6015
+ {
6016
+ console.assert(self2.parent !== self2);
6017
+ }
6018
+ if (keys[message.type] !== DebugMessage.Skip) {
6019
+ const style = { background: this.colors.bg, color: this.colors.fg };
6020
+ console.groupCollapsed(`%c Msg from ${self2.origin} (inner) `, Object.entries(style).map(([key, val]) => `${key}: ${val}`).join("; "));
6021
+ console.info(`window '${self2.origin}' is sending a message of type %c ${message.type} `, "background: lightgreen; color: darkgreen");
6022
+ console.log(message.content);
6023
+ console.groupEnd();
6024
+ }
6025
+ }
6026
+ }
6027
+ );
5975
6028
  const ctrlSpaceFactory = (channels) => {
5976
6029
  return (evt) => {
5977
6030
  if (evt.ctrlKey && evt.key === " ") {
@@ -6662,6 +6715,7 @@ function registerCleanups(window2, fns) {
6662
6715
  parentWindowSenderCleanup,
6663
6716
  serviceWorkerSenderCleanup,
6664
6717
  () => parentWindowRegistration.disconnect(),
6718
+ () => swRegistration.send({ content: {}, type: "unload-client" }),
6665
6719
  () => swRegistration.disconnect()
6666
6720
  ]
6667
6721
  );
@@ -17,7 +17,7 @@
17
17
  </style>
18
18
  <script src="https://unpkg.com/zone.js"></script>
19
19
 
20
- <script type="module" crossorigin src="./assets/index-243486eb.js"></script>
20
+ <script type="module" crossorigin src="./assets/index-49595118.js"></script>
21
21
  </head>
22
22
  <body></body>
23
23
  </html>
@@ -8,7 +8,7 @@
8
8
  "dynamicImports": [
9
9
  "../../.yarn/__virtual__/@micro-lc-composer-virtual-1e9d239e46/0/cache/@micro-lc-composer-npm-2.0.3-7d85cea61f-88452090ec.zip/node_modules/@micro-lc/composer/dist/lib/logger/errors.js"
10
10
  ],
11
- "file": "assets/index-243486eb.js",
11
+ "file": "assets/index-49595118.js",
12
12
  "isEntry": true,
13
13
  "src": "index.html"
14
14
  }
@@ -1438,7 +1438,7 @@
1438
1438
  }
1439
1439
  function fromAsyncIterable(asyncIterable) {
1440
1440
  return new Observable(function(subscriber) {
1441
- process(asyncIterable, subscriber).catch(function(err) {
1441
+ process2(asyncIterable, subscriber).catch(function(err) {
1442
1442
  return subscriber.error(err);
1443
1443
  });
1444
1444
  });
@@ -1446,7 +1446,7 @@
1446
1446
  function fromReadableStreamLike(readableStream) {
1447
1447
  return fromAsyncIterable(readableStreamLikeToAsyncGenerator(readableStream));
1448
1448
  }
1449
- function process(asyncIterable, subscriber) {
1449
+ function process2(asyncIterable, subscriber) {
1450
1450
  var asyncIterable_1, asyncIterable_1_1;
1451
1451
  var e_2, _a;
1452
1452
  return __awaiter(this, void 0, void 0, function() {
@@ -1925,8 +1925,8 @@
1925
1925
  this.__instance = instance;
1926
1926
  const color = generateDarkColorHex();
1927
1927
  this.__colors = {
1928
- bg: color,
1929
- fg: `${color}22`
1928
+ bg: `${color}22`,
1929
+ fg: color
1930
1930
  };
1931
1931
  this.__receiver = to;
1932
1932
  this.__connect(
@@ -1979,7 +1979,6 @@
1979
1979
 
1980
1980
  // service-worker.ts
1981
1981
  var openChannels = /* @__PURE__ */ new Map();
1982
- var clientIdsToScope = /* @__PURE__ */ new Map();
1983
1982
  var sourceMap = /* @__PURE__ */ new Map();
1984
1983
  var tosMap = /* @__PURE__ */ new Map();
1985
1984
  var isAvailable = (key, map2) => {
@@ -2005,27 +2004,23 @@
2005
2004
  const workerMessageData = data;
2006
2005
  switch (workerMessageData.type) {
2007
2006
  case "set-source-map": {
2008
- const { content: { scope, dictionary } } = workerMessageData;
2009
- const scopedId = scope ?? clientId;
2010
- const clientMaps = Object.entries(dictionary).reduce((maps, [key, value]) => {
2007
+ const { content } = workerMessageData;
2008
+ const clientMaps = Object.entries(content).reduce((maps, [key, value]) => {
2011
2009
  const { clientSourceMap, clientTosMap } = maps;
2012
- if (Object.keys(value.headers).length > 0) {
2013
- clientTosMap.set(encodeURI(value.to), value.headers);
2010
+ const { headers = {} } = value;
2011
+ if (Object.keys(headers).length > 0) {
2012
+ clientTosMap.set(encodeURI(value.to), headers);
2014
2013
  }
2015
2014
  clientSourceMap.set(encodeURI(key), value);
2016
2015
  return maps;
2017
2016
  }, { clientSourceMap: /* @__PURE__ */ new Map(), clientTosMap: /* @__PURE__ */ new Map() });
2018
- if (scope) {
2019
- clientIdsToScope.set(clientId, scope);
2020
- } else {
2021
- clientIdsToScope.delete(clientId);
2022
- }
2023
- sourceMap.set(scopedId, clientMaps.clientSourceMap);
2024
- tosMap.set(scopedId, clientMaps.clientTosMap);
2017
+ sourceMap.set(clientId, clientMaps.clientSourceMap);
2018
+ tosMap.set(clientId, clientMaps.clientTosMap);
2025
2019
  break;
2026
2020
  }
2027
2021
  case "unload-client": {
2028
- clientIdsToScope.delete(clientId);
2022
+ sourceMap.delete(clientId);
2023
+ tosMap.delete(clientId);
2029
2024
  openChannels.delete(clientId);
2030
2025
  this.disconnect();
2031
2026
  break;
@@ -2076,13 +2071,11 @@
2076
2071
  });
2077
2072
  self.addEventListener("fetch", (event) => {
2078
2073
  const clientId = event.clientId !== "" ? event.clientId : event.resultingClientId;
2079
- const scope = clientIdsToScope.get(clientId);
2080
- const scopedId = scope ?? clientId;
2081
- const clientSourceMap = sourceMap.get(scopedId);
2074
+ const clientSourceMap = sourceMap.get(clientId);
2082
2075
  if (!clientSourceMap) {
2083
2076
  return event.respondWith(self.fetch(event.request));
2084
2077
  }
2085
- const clientTosMap = tosMap.get(scopedId);
2078
+ const clientTosMap = tosMap.get(clientId);
2086
2079
  let { request: { url } } = event;
2087
2080
  const key = isAvailable(url, clientSourceMap);
2088
2081
  const to = isAvailable(url, clientTosMap);
@@ -2090,14 +2083,14 @@
2090
2083
  let extraQuery = {};
2091
2084
  if (key !== void 0) {
2092
2085
  const value = clientSourceMap.get(key)?.to;
2093
- const extraHeaders = clientSourceMap.get(key)?.headers;
2086
+ const extraHeaders = clientSourceMap.get(key)?.headers ?? {};
2094
2087
  const rest = url.substring(key.length);
2095
- extraQuery = clientSourceMap.get(key)?.query;
2088
+ extraQuery = clientSourceMap.get(key)?.query ?? {};
2096
2089
  url = `${value}${rest}`;
2097
2090
  Object.entries(extraHeaders).forEach(([headerKey, headerValue]) => headers.set(headerKey, headerValue));
2098
2091
  }
2099
2092
  if (to !== void 0) {
2100
- const extraHeaders = clientTosMap.get(to);
2093
+ const extraHeaders = clientTosMap.get(to) ?? {};
2101
2094
  Object.entries(extraHeaders).forEach(([headerKey, headerValue]) => headers.set(headerKey, headerValue));
2102
2095
  }
2103
2096
  let finalUrl;
@@ -2108,7 +2101,14 @@
2108
2101
  } catch {
2109
2102
  finalUrl = url;
2110
2103
  }
2111
- console.log({ clientId, clientSourceMap, finalUrl });
2104
+ const channel = openChannels.get(clientId)?.channel;
2105
+ if (channel !== void 0 && true) {
2106
+ const style = { background: channel.colors.bg, color: channel.colors.fg };
2107
+ console.groupCollapsed(`%c Fetch from Service Worker `, Object.entries(style).map(([styleKey, styleValue]) => `${styleKey}: ${styleValue}`).join("; "));
2108
+ console.info(`sw is fetching %c ${finalUrl}`, "background: lightgreen; color: darkgreen");
2109
+ console.log({ clientId, clientSourceMap });
2110
+ console.groupEnd();
2111
+ }
2112
2112
  event.respondWith(
2113
2113
  self.fetch(finalUrl, { ...event.request, headers }).catch((error) => {
2114
2114
  console.error(error);
@@ -17,7 +17,7 @@
17
17
  </style>
18
18
  <script src="https://unpkg.com/zone.js"></script>
19
19
 
20
- <script type="module" crossorigin src="./assets/index-1fa72460.js"></script>
20
+ <script type="module" crossorigin src="./assets/index-11acce20.js"></script>
21
21
  </head>
22
22
  <body></body>
23
23
  </html>
@@ -8,7 +8,7 @@
8
8
  "dynamicImports": [
9
9
  "../../.yarn/__virtual__/@micro-lc-composer-virtual-1e9d239e46/0/cache/@micro-lc-composer-npm-2.0.3-7d85cea61f-88452090ec.zip/node_modules/@micro-lc/composer/dist/lib/logger/errors.js"
10
10
  ],
11
- "file": "assets/index-1fa72460.js",
11
+ "file": "assets/index-11acce20.js",
12
12
  "isEntry": true,
13
13
  "src": "index.html"
14
14
  }
@@ -1,3 +1,3 @@
1
- "use strict";(()=>{var Z=function(r,t){return Z=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])},Z(r,t)};function v(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Z(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function dr(r,t,e,o){function n(i){return i instanceof e?i:new e(function(s){s(i)})}return new(e||(e=Promise))(function(i,s){function a(u){try{c(o.next(u))}catch(h){s(h)}}function f(u){try{c(o.throw(u))}catch(h){s(h)}}function c(u){u.done?i(u.value):n(u.value).then(a,f)}c((o=o.apply(r,t||[])).next())})}function N(r,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return f([c,u])}}function f(c){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(e=0)),e;)try{if(o=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,n=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){e.label=c[1];break}if(c[0]===6&&e.label<i[1]){e.label=i[1],i=c;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(c);break}i[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(r,e)}catch(u){c=[6,u],n=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function E(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],o=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var o=e.call(r),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(s)throw s.error}}return i}function _(r,t,e){if(e||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return r.concat(i||Array.prototype.slice.call(t))}function I(r){return this instanceof I?(this.v=r,this):new I(r)}function hr(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=e.apply(r,t||[]),n,i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(l){o[l]&&(n[l]=function(m){return new Promise(function(y,d){i.push([l,m,y,d])>1||a(l,m)})})}function a(l,m){try{f(o[l](m))}catch(y){h(i[0][3],y)}}function f(l){l.value instanceof I?Promise.resolve(l.value.v).then(c,u):h(i[0][2],l)}function c(l){a("next",l)}function u(l){a("throw",l)}function h(l,m){l(m),i.shift(),i.length&&a(i[0][0],i[0][1])}}function vr(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof E=="function"?E(r):r[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(i){e[i]=r[i]&&function(s){return new Promise(function(a,f){s=r[i](s),n(a,f,s.done,s.value)})}}function n(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function p(r){return typeof r=="function"}function j(r){var t=function(o){Error.call(o),o.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var z=j(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription:
1
+ "use strict";(()=>{var X=function(r,t){return X=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n])},X(r,t)};function v(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");X(r,t);function e(){this.constructor=r}r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)}function hr(r,t,e,o){function n(i){return i instanceof e?i:new e(function(s){s(i)})}return new(e||(e=Promise))(function(i,s){function a(u){try{c(o.next(u))}catch(m){s(m)}}function f(u){try{c(o.throw(u))}catch(m){s(m)}}function c(u){u.done?i(u.value):n(u.value).then(a,f)}c((o=o.apply(r,t||[])).next())})}function B(r,t){var e={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,n,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return f([c,u])}}function f(c){if(o)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(e=0)),e;)try{if(o=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return e.label++,{value:c[1],done:!1};case 5:e.label++,n=c[1],c=[0];continue;case 7:c=e.ops.pop(),e.trys.pop();continue;default:if(i=e.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){e=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){e.label=c[1];break}if(c[0]===6&&e.label<i[1]){e.label=i[1],i=c;break}if(i&&e.label<i[2]){e.label=i[2],e.ops.push(c);break}i[2]&&e.ops.pop(),e.trys.pop();continue}c=t.call(r,e)}catch(u){c=[6,u],n=0}finally{o=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function E(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],o=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&o>=r.length&&(r=void 0),{value:r&&r[o++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var o=e.call(r),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(e=o.return)&&e.call(o)}finally{if(s)throw s.error}}return i}function _(r,t,e){if(e||arguments.length===2)for(var o=0,n=t.length,i;o<n;o++)(i||!(o in t))&&(i||(i=Array.prototype.slice.call(t,0,o)),i[o]=t[o]);return r.concat(i||Array.prototype.slice.call(t))}function P(r){return this instanceof P?(this.v=r,this):new P(r)}function vr(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var o=e.apply(r,t||[]),n,i=[];return n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n;function s(l){o[l]&&(n[l]=function(d){return new Promise(function(x,h){i.push([l,d,x,h])>1||a(l,d)})})}function a(l,d){try{f(o[l](d))}catch(x){m(i[0][3],x)}}function f(l){l.value instanceof P?Promise.resolve(l.value.v).then(c,u):m(i[0][2],l)}function c(l){a("next",l)}function u(l){a("throw",l)}function m(l,d){l(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function br(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof E=="function"?E(r):r[Symbol.iterator](),e={},o("next"),o("throw"),o("return"),e[Symbol.asyncIterator]=function(){return this},e);function o(i){e[i]=r[i]&&function(s){return new Promise(function(a,f){s=r[i](s),n(a,f,s.done,s.value)})}}function n(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function p(r){return typeof r=="function"}function j(r){var t=function(o){Error.call(o),o.stack=new Error().stack},e=r(t);return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var N=j(function(r){return function(e){r(this),this.message=e?e.length+` errors occurred during unsubscription:
2
2
  `+e.map(function(o,n){return n+1+") "+o.toString()}).join(`
3
- `):"",this.name="UnsubscriptionError",this.errors=e}});function P(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var g=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,o,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=E(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(d){t={error:d}}finally{try{f&&!f.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(p(u))try{u()}catch(d){i=d instanceof z?d.errors:[d]}var h=this._finalizers;if(h){this._finalizers=null;try{for(var l=E(h),m=l.next();!m.done;m=l.next()){var y=m.value;try{br(y)}catch(d){i=i??[],d instanceof z?i=_(_([],x(i)),x(d.errors)):i.push(d)}}}catch(d){o={error:d}}finally{try{m&&!m.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}}if(i)throw new z(i)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)br(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&P(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&P(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var rr=g.EMPTY;function G(r){return r instanceof g||r&&"closed"in r&&p(r.remove)&&p(r.add)&&p(r.unsubscribe)}function br(r){p(r)?r():r.unsubscribe()}var w={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var C={setTimeout:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=C.delegate;return n?.setTimeout?n.setTimeout.apply(n,_([r,t],x(e))):setTimeout.apply(void 0,_([r,t],x(e)))},clearTimeout:function(r){var t=C.delegate;return(t?.clearTimeout||clearTimeout)(r)},delegate:void 0};function K(r){C.setTimeout(function(){var t=w.onUnhandledError;if(t)t(r);else throw r})}function er(){}var yr=function(){return tr("C",void 0,void 0)}();function xr(r){return tr("E",void 0,r)}function _r(r){return tr("N",r,void 0)}function tr(r,t,e){return{kind:r,value:t,error:e}}var A=null;function k(r){if(w.useDeprecatedSynchronousErrorHandling){var t=!A;if(t&&(A={errorThrown:!1,error:null}),r(),t){var e=A,o=e.errorThrown,n=e.error;if(A=null,o)throw n}}else r()}function gr(r){w.useDeprecatedSynchronousErrorHandling&&A&&(A.errorThrown=!0,A.error=r)}var $=function(r){v(t,r);function t(e){var o=r.call(this)||this;return o.isStopped=!1,e?(o.destination=e,G(e)&&e.add(o)):o.destination=ne,o}return t.create=function(e,o,n){return new R(e,o,n)},t.prototype.next=function(e){this.isStopped?nr(_r(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?nr(xr(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?nr(yr,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(g);var ee=Function.prototype.bind;function or(r,t){return ee.call(r,t)}var te=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(o){J(o)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(o){J(o)}else J(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){J(e)}},r}(),R=function(r){v(t,r);function t(e,o,n){var i=r.call(this)||this,s;if(p(e)||!e)s={next:e??void 0,error:o??void 0,complete:n??void 0};else{var a;i&&w.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return i.unsubscribe()},s={next:e.next&&or(e.next,a),error:e.error&&or(e.error,a),complete:e.complete&&or(e.complete,a)}):s=e}return i.destination=new te(s),i}return t}($);function J(r){w.useDeprecatedSynchronousErrorHandling?gr(r):K(r)}function oe(r){throw r}function nr(r,t){var e=w.onStoppedNotification;e&&C.setTimeout(function(){return e(r,t)})}var ne={closed:!0,next:er,error:oe,complete:er};var W=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function wr(r){return r}function Sr(r){return r.length===0?wr:r.length===1?r[0]:function(e){return r.reduce(function(o,n){return n(o)},e)}}var b=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,o){var n=this,i=se(t)?t:new R(t,e,o);return k(function(){var s=n,a=s.operator,f=s.source;i.add(a?a.call(i,f):f?n._subscribe(i):n._trySubscribe(i))}),i},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var o=this;return e=Er(e),new e(function(n,i){var s=new R({next:function(a){try{t(a)}catch(f){i(f),s.unsubscribe()}},error:i,complete:n});o.subscribe(s)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[W]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Sr(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Er(t),new t(function(o,n){var i;e.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)})})},r.create=function(t){return new r(t)},r}();function Er(r){var t;return(t=r??w.Promise)!==null&&t!==void 0?t:Promise}function ie(r){return r&&p(r.next)&&p(r.error)&&p(r.complete)}function se(r){return r&&r instanceof $||ie(r)&&G(r)}function ae(r){return p(r?.lift)}function M(r){return function(t){if(ae(t))return t.lift(function(e){try{return r(e,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function O(r,t,e,o,n){return new ce(r,t,e,o,n)}var ce=function(r){v(t,r);function t(e,o,n,i,s,a){var f=r.call(this,e)||this;return f.onFinalize=s,f.shouldUnsubscribe=a,f._next=o?function(c){try{o(c)}catch(u){e.error(u)}}:r.prototype._next,f._error=i?function(c){try{i(c)}catch(u){e.error(u)}finally{this.unsubscribe()}}:r.prototype._error,f._complete=n?function(){try{n()}catch(c){e.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,f}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}($);var Or=j(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var ir=function(r){v(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var o=new Tr(this,this);return o.operator=e,o},t.prototype._throwIfClosed=function(){if(this.closed)throw new Or},t.prototype.next=function(e){var o=this;k(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=E(o.currentObservers),a=s.next();!a.done;a=s.next()){var f=a.value;f.next(e)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var o=this;k(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=e;for(var n=o.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;k(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var o=e.observers;o.length;)o.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?rr:(this.currentObservers=null,a.push(e),new g(function(){o.currentObservers=null,P(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?e.error(i):s&&e.complete()},t.prototype.asObservable=function(){var e=new b;return e.source=this,e},t.create=function(e,o){return new Tr(e,o)},t}(b);var Tr=function(r){v(t,r);function t(e,o){var n=r.call(this)||this;return n.destination=e,n.source=o,n}return t.prototype.next=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,e)},t.prototype.error=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,e)},t.prototype.complete=function(){var e,o;(o=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||o===void 0||o.call(e)},t.prototype._subscribe=function(e){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(e))!==null&&n!==void 0?n:rr},t}(ir);var q={now:function(){return(q.delegate||Date).now()},delegate:void 0};var F=function(r){v(t,r);function t(e,o,n){e===void 0&&(e=1/0),o===void 0&&(o=1/0),n===void 0&&(n=q);var i=r.call(this)||this;return i._bufferSize=e,i._windowTime=o,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=o===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,o),i}return t.prototype.next=function(e){var o=this,n=o.isStopped,i=o._buffer,s=o._infiniteTimeWindow,a=o._timestampProvider,f=o._windowTime;n||(i.push(e),!s&&i.push(a.now()+f)),this._trimBuffer(),r.prototype.next.call(this,e)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(e),n=this,i=n._infiniteTimeWindow,s=n._buffer,a=s.slice(),f=0;f<a.length&&!e.closed;f+=i?1:2)e.next(a[f]);return this._checkFinalizedStatuses(e),o},t.prototype._trimBuffer=function(){var e=this,o=e._bufferSize,n=e._timestampProvider,i=e._buffer,s=e._infiniteTimeWindow,a=(s?1:2)*o;if(o<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var f=n.now(),c=0,u=1;u<i.length&&i[u]<=f;u+=2)c=u;c&&i.splice(0,c+1)}},t}(ir);var Mr=function(r){v(t,r);function t(e,o){return r.call(this)||this}return t.prototype.schedule=function(e,o){return o===void 0&&(o=0),this},t}(g);var V={setInterval:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=V.delegate;return n?.setInterval?n.setInterval.apply(n,_([r,t],x(e))):setInterval.apply(void 0,_([r,t],x(e)))},clearInterval:function(r){var t=V.delegate;return(t?.clearInterval||clearInterval)(r)},delegate:void 0};var Ir=function(r){v(t,r);function t(e,o){var n=r.call(this,e,o)||this;return n.scheduler=e,n.work=o,n.pending=!1,n}return t.prototype.schedule=function(e,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=e;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(s,this.id,o),this},t.prototype.requestAsyncId=function(e,o,n){return n===void 0&&(n=0),V.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&V.clearInterval(o)},t.prototype.execute=function(e,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,o){var n=!1,i;try{this.work(e)}catch(s){n=!0,i=s||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,o=e.id,n=e.scheduler,i=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,P(i,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},t}(Mr);var sr=function(){function r(t,e){e===void 0&&(e=r.now),this.schedulerActionCtor=t,this.now=e}return r.prototype.schedule=function(t,e,o){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(o,e)},r.now=q.now,r}();var Pr=function(r){v(t,r);function t(e,o){o===void 0&&(o=sr.now);var n=r.call(this,e,o)||this;return n.actions=[],n._active=!1,n}return t.prototype.flush=function(e){var o=this.actions;if(this._active){o.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=o.shift());if(this._active=!1,n){for(;e=o.shift();)e.unsubscribe();throw n}},t}(sr);var ar=new Pr(Ir),Ar=ar;var jr=new b(function(r){return r.complete()});function Cr(r){return r&&p(r.schedule)}var Q=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function kr(r){return p(r?.then)}function Rr(r){return p(r[W])}function Wr(r){return Symbol.asyncIterator&&p(r?.[Symbol.asyncIterator])}function Fr(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fe(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Ur=fe();function Lr(r){return p(r?.[Ur])}function Dr(r){return hr(this,arguments,function(){var e,o,n,i;return N(this,function(s){switch(s.label){case 0:e=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,I(e.read())];case 3:return o=s.sent(),n=o.value,i=o.done,i?[4,I(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,I(n)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function $r(r){return p(r?.getReader)}function U(r){if(r instanceof b)return r;if(r!=null){if(Rr(r))return ue(r);if(Q(r))return pe(r);if(kr(r))return le(r);if(Wr(r))return qr(r);if(Lr(r))return me(r);if($r(r))return de(r)}throw Fr(r)}function ue(r){return new b(function(t){var e=r[W]();if(p(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function pe(r){return new b(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()})}function le(r){return new b(function(t){r.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,K)})}function me(r){return new b(function(t){var e,o;try{for(var n=E(r),i=n.next();!i.done;i=n.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){e={error:a}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(e)throw e.error}}t.complete()})}function qr(r){return new b(function(t){he(r,t).catch(function(e){return t.error(e)})})}function de(r){return qr(Dr(r))}function he(r,t){var e,o,n,i;return dr(this,void 0,void 0,function(){var s,a;return N(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),e=vr(r),f.label=1;case 1:return[4,e.next()];case 2:if(o=f.sent(),!!o.done)return[3,4];if(s=o.value,t.next(s),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=f.sent(),n={error:a},[3,11];case 6:return f.trys.push([6,,9,10]),o&&!o.done&&(i=e.return)?[4,i.call(e)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Vr(r,t,e,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=t.schedule(function(){e(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(i),!n)return i}var Hr=j(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function cr(r,t){var e=typeof t=="object";return new Promise(function(o,n){var i=new R({next:function(s){o(s),i.unsubscribe()},error:n,complete:function(){e?o(t.defaultValue):n(new Hr)}});r.subscribe(i)})}function Yr(r){return r instanceof Date&&!isNaN(r)}function T(r,t){return M(function(e,o){var n=0;e.subscribe(O(o,function(i){o.next(r.call(t,i,n++))}))})}var ve=Array.isArray;function be(r,t){return ve(t)?r.apply(void 0,_([],x(t))):r(t)}function Br(r){return T(function(t){return be(r,t)})}function Nr(r,t,e,o,n,i,s,a){var f=[],c=0,u=0,h=!1,l=function(){h&&!f.length&&!c&&t.complete()},m=function(d){return c<o?y(d):f.push(d)},y=function(d){i&&t.next(d),c++;var Y=!1;U(e(d,u++)).subscribe(O(t,function(D){n?.(D),i?m(D):t.next(D)},function(){Y=!0},void 0,function(){if(Y)try{c--;for(var D=function(){var B=f.shift();s?Vr(t,s,function(){return y(B)}):y(B)};f.length&&c<o;)D();l()}catch(B){t.error(B)}}))};return r.subscribe(O(t,m,function(){h=!0,l()})),function(){a?.()}}function fr(r,t,e){return e===void 0&&(e=1/0),p(t)?fr(function(o,n){return T(function(i,s){return t(o,i,n,s)})(U(r(o,n)))},e):(typeof t=="number"&&(e=t),M(function(o,n){return Nr(o,n,r,e)}))}var ye=["addListener","removeListener"],xe=["addEventListener","removeEventListener"],_e=["on","off"];function H(r,t,e,o){if(p(e)&&(o=e,e=void 0),o)return H(r,t,e).pipe(Br(o));var n=x(Se(r)?xe.map(function(a){return function(f){return r[a](t,f,e)}}):ge(r)?ye.map(zr(r,t)):we(r)?_e.map(zr(r,t)):[],2),i=n[0],s=n[1];if(!i&&Q(r))return fr(function(a){return H(a,t,e)})(U(r));if(!i)throw new TypeError("Invalid event target");return new b(function(a){var f=function(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];return a.next(1<c.length?c:c[0])};return i(f),function(){return s(f)}})}function zr(r,t){return function(e){return function(o){return r[e](t,o)}}}function ge(r){return p(r.addListener)&&p(r.removeListener)}function we(r){return p(r.on)&&p(r.off)}function Se(r){return p(r.addEventListener)&&p(r.removeEventListener)}function Gr(r,t,e){r===void 0&&(r=0),e===void 0&&(e=Ar);var o=-1;return t!=null&&(Cr(t)?e=t:o=t),new b(function(n){var i=Yr(r)?+r-e.now():r;i<0&&(i=0);var s=0;return e.schedule(function(){n.closed||(n.next(s++),0<=o?this.schedule(void 0,o):n.complete())},i)})}function ur(r,t){return r===void 0&&(r=0),t===void 0&&(t=ar),r<0&&(r=0),Gr(r,r,t)}function S(r,t){return M(function(e,o){var n=0;e.subscribe(O(o,function(i){return r.call(t,i,n++)&&o.next(i)}))})}function L(r){return r<=0?function(){return jr}:M(function(t,e){var o=0;t.subscribe(O(e,function(n){++o<=r&&(e.next(n),r<=o&&e.complete())}))})}var Kr=(r,t)=>e=>({postMessage:o=>{let{errorCatcher:n=()=>()=>{},...i}=t??{};r.clients.get(e).then(s=>s?.postMessage(o,i)).catch(n(e,o))}});var Jr=(r=>(r.Ack="ack",r.Syn="syn",r))(Jr||{}),Ee=Object.values(Jr),pr=r=>r.data,lr=r=>t=>t.type===r.toString(),Oe=r=>{let t=r.data;return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"instance"in t&&typeof t.instance=="string"&&"content"in t},Te=()=>{let r="#";for(let t=0;t<3;t++)r+=`0${Math.floor(Math.random()*Math.pow(16,2)/2).toString(16)}`.slice(-2);return r},Me=class{__generateId;__instance;__colors;__listener;__log;__receiver;__subscription;__okToWrite;__write$;__recv$;__connect(r,t){let e=ur(t).subscribe(()=>this.__receiver.postMessage({content:r,instance:r,type:"syn".toString()}));this.__subscription.add(e),this.__subscription.add(this.__recv$.pipe(T(pr),S(lr("ack")),S(({content:o})=>o===r),L(1)).subscribe(({instance:o})=>{this.__okToWrite.next(0),this.__subscription.add(this.__recv$.pipe(S(({data:{type:n,instance:i}})=>!Ee.includes(n)&&i===o)).subscribe(n=>{this.__listener(n);let{data:i}=n;i._id!==void 0&&this.__receiver.postMessage({...i,content:i,instance:r,type:"ack"})})),e.unsubscribe()})),this.__subscription.add(this.__recv$.pipe(T(pr),S(lr("syn")),S(({instance:o})=>o!==r),L(1)).subscribe(({content:o})=>{this.__receiver.postMessage({content:o,instance:r,type:"ack"})}))}__write(r,t){let e={};t!==void 0&&(e._id=t),this.__subscription.add(this.__write$.subscribe(()=>{let o=Object.assign(r,{instance:this.__instance,...e});this.__receiver.postMessage(o),this.__log?.(o)}))}constructor(r,t,e,o){this.__generateId=()=>globalThis.crypto.randomUUID();let n=this.__generateId(),i=new F,s=H(t,"message").pipe(S(Oe)).subscribe(i);this.__subscription=new g,this.__subscription.add(s),this.__okToWrite=new F(1),this.__write$=this.__okToWrite.pipe(L(1)),this.__recv$=i.asObservable(),this.__listener=r,this.__log=o?.log&&o.log.bind(this),this.__instance=n;let a=Te();this.__colors={bg:a,fg:`${a}22`},this.__receiver=e,this.__connect(n,o?.period?o.period:10)}disconnect(){this.__subscription.unsubscribe()}send(r){this.__write(r)}ackSend(r){let t,e=new Promise(n=>{t=n}),o=this.__generateId();return this.__subscription.add(this.__recv$.pipe(T(pr),S(lr("ack")),S(({_id:n})=>n===o),L(1)).subscribe(()=>t())),this.__write(r,o),e}get instance(){return this.__instance}get colors(){return this.__colors}get ready(){return cr(this.__write$).then(()=>{})}},Qr=Me;var mr=new Map,X=new Map,Zr=new Map,re=new Map,Xr=(r,t)=>{let e=t.keys(),o,{done:n=!1,value:i}=e.next();for(;!n&&o===void 0;){i!==void 0&&r.startsWith(i)&&(o=i,n=!0);let{value:s,done:a=!1}=e.next();n=a,i=s}return o},Ie=r=>r!==null&&"id"in r,Pe=r=>t=>console.error(`[SW]: error on ${r} - ${String(t)}`),Ae=Kr(self,{errorCatcher:Pe}),je=r=>function({data:e}){let o=e;switch(o.type){case"set-source-map":{let{content:{scope:n,dictionary:i}}=o,s=n??r,a=Object.entries(i).reduce((f,[c,u])=>{let{clientSourceMap:h,clientTosMap:l}=f;return Object.keys(u.headers).length>0&&l.set(encodeURI(u.to),u.headers),h.set(encodeURI(c),u),f},{clientSourceMap:new Map,clientTosMap:new Map});n?X.set(r,n):X.delete(r),Zr.set(s,a.clientSourceMap),re.set(s,a.clientTosMap);break}case"unload-client":{X.delete(r),mr.delete(r),this.disconnect();break}default:break}},Ce=r=>{let t=new Map,e=new F,o={addEventListener(n,i){t.set(i,e.subscribe(s=>i(s)))},removeEventListener(n,i){t.get(i)?.unsubscribe(),t.delete(i)}};return{buffer:e,channel:new Qr(je(r),o,Ae(r))}},ke=r=>{let t=mr.get(r);return t||(t=Ce(r),mr.set(r,t)),t};self.addEventListener("install",()=>{self.skipWaiting().catch(r=>console.error(`[SW] error while skipWaiting - ${String(r)}`))});self.addEventListener("activate",r=>{r.waitUntil(self.clients.claim())});self.addEventListener("message",r=>{let{source:t}=r;if(!Ie(t))return;let{id:e}=t;ke(e).buffer.next(r)});self.addEventListener("fetch",r=>{let t=r.clientId!==""?r.clientId:r.resultingClientId,o=X.get(t)??t,n=Zr.get(o);if(!n)return r.respondWith(self.fetch(r.request));let i=re.get(o),{request:{url:s}}=r,a=Xr(s,n),f=Xr(s,i),c=new Headers(r.request.headers),u={};if(a!==void 0){let l=n.get(a)?.to,m=n.get(a)?.headers,y=s.substring(a.length);u=n.get(a)?.query,s=`${l}${y}`,Object.entries(m).forEach(([d,Y])=>c.set(d,Y))}if(f!==void 0){let l=i.get(f);Object.entries(l).forEach(([m,y])=>c.set(m,y))}let h;try{let l=new URL(s);Object.entries(u).forEach(([m,y])=>l.searchParams.set(m,y)),h=l.href}catch{h=s}console.log({clientId:t,clientSourceMap:n,finalUrl:h}),r.respondWith(self.fetch(h,{...r.request,headers:c}).catch(l=>(console.error(l),Promise.reject(l))))});})();
3
+ `):"",this.name="UnsubscriptionError",this.errors=e}});function I(r,t){if(r){var e=r.indexOf(t);0<=e&&r.splice(e,1)}}var g=function(){function r(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var t,e,o,n,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=E(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(h){t={error:h}}finally{try{f&&!f.done&&(e=a.return)&&e.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(p(u))try{u()}catch(h){i=h instanceof N?h.errors:[h]}var m=this._finalizers;if(m){this._finalizers=null;try{for(var l=E(m),d=l.next();!d.done;d=l.next()){var x=d.value;try{yr(x)}catch(h){i=i??[],h instanceof N?i=_(_([],y(i)),y(h.errors)):i.push(h)}}}catch(h){o={error:h}}finally{try{d&&!d.done&&(n=l.return)&&n.call(l)}finally{if(o)throw o.error}}}if(i)throw new N(i)}},r.prototype.add=function(t){var e;if(t&&t!==this)if(this.closed)yr(t);else{if(t instanceof r){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(e=this._finalizers)!==null&&e!==void 0?e:[]).push(t)}},r.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},r.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},r.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&I(e,t)},r.prototype.remove=function(t){var e=this._finalizers;e&&I(e,t),t instanceof r&&t._removeParent(this)},r.EMPTY=function(){var t=new r;return t.closed=!0,t}(),r}();var Z=g.EMPTY;function z(r){return r instanceof g||r&&"closed"in r&&p(r.remove)&&p(r.add)&&p(r.unsubscribe)}function yr(r){p(r)?r():r.unsubscribe()}var w={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var k={setTimeout:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=k.delegate;return n?.setTimeout?n.setTimeout.apply(n,_([r,t],y(e))):setTimeout.apply(void 0,_([r,t],y(e)))},clearTimeout:function(r){var t=k.delegate;return(t?.clearTimeout||clearTimeout)(r)},delegate:void 0};function G(r){k.setTimeout(function(){var t=w.onUnhandledError;if(t)t(r);else throw r})}function rr(){}var xr=function(){return er("C",void 0,void 0)}();function _r(r){return er("E",void 0,r)}function gr(r){return er("N",r,void 0)}function er(r,t,e){return{kind:r,value:t,error:e}}var A=null;function C(r){if(w.useDeprecatedSynchronousErrorHandling){var t=!A;if(t&&(A={errorThrown:!1,error:null}),r(),t){var e=A,o=e.errorThrown,n=e.error;if(A=null,o)throw n}}else r()}function wr(r){w.useDeprecatedSynchronousErrorHandling&&A&&(A.errorThrown=!0,A.error=r)}var $=function(r){v(t,r);function t(e){var o=r.call(this)||this;return o.isStopped=!1,e?(o.destination=e,z(e)&&e.add(o)):o.destination=oe,o}return t.create=function(e,o,n){return new R(e,o,n)},t.prototype.next=function(e){this.isStopped?or(gr(e),this):this._next(e)},t.prototype.error=function(e){this.isStopped?or(_r(e),this):(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped?or(xr,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(g);var re=Function.prototype.bind;function tr(r,t){return re.call(r,t)}var ee=function(){function r(t){this.partialObserver=t}return r.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(o){K(o)}},r.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(o){K(o)}else K(t)},r.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(e){K(e)}},r}(),R=function(r){v(t,r);function t(e,o,n){var i=r.call(this)||this,s;if(p(e)||!e)s={next:e??void 0,error:o??void 0,complete:n??void 0};else{var a;i&&w.useDeprecatedNextContext?(a=Object.create(e),a.unsubscribe=function(){return i.unsubscribe()},s={next:e.next&&tr(e.next,a),error:e.error&&tr(e.error,a),complete:e.complete&&tr(e.complete,a)}):s=e}return i.destination=new ee(s),i}return t}($);function K(r){w.useDeprecatedSynchronousErrorHandling?wr(r):G(r)}function te(r){throw r}function or(r,t){var e=w.onStoppedNotification;e&&k.setTimeout(function(){return e(r,t)})}var oe={closed:!0,next:rr,error:te,complete:rr};var W=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Sr(r){return r}function Er(r){return r.length===0?Sr:r.length===1?r[0]:function(e){return r.reduce(function(o,n){return n(o)},e)}}var b=function(){function r(t){t&&(this._subscribe=t)}return r.prototype.lift=function(t){var e=new r;return e.source=this,e.operator=t,e},r.prototype.subscribe=function(t,e,o){var n=this,i=ie(t)?t:new R(t,e,o);return C(function(){var s=n,a=s.operator,f=s.source;i.add(a?a.call(i,f):f?n._subscribe(i):n._trySubscribe(i))}),i},r.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},r.prototype.forEach=function(t,e){var o=this;return e=Or(e),new e(function(n,i){var s=new R({next:function(a){try{t(a)}catch(f){i(f),s.unsubscribe()}},error:i,complete:n});o.subscribe(s)})},r.prototype._subscribe=function(t){var e;return(e=this.source)===null||e===void 0?void 0:e.subscribe(t)},r.prototype[W]=function(){return this},r.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Er(t)(this)},r.prototype.toPromise=function(t){var e=this;return t=Or(t),new t(function(o,n){var i;e.subscribe(function(s){return i=s},function(s){return n(s)},function(){return o(i)})})},r.create=function(t){return new r(t)},r}();function Or(r){var t;return(t=r??w.Promise)!==null&&t!==void 0?t:Promise}function ne(r){return r&&p(r.next)&&p(r.error)&&p(r.complete)}function ie(r){return r&&r instanceof $||ne(r)&&z(r)}function se(r){return p(r?.lift)}function M(r){return function(t){if(se(t))return t.lift(function(e){try{return r(e,this)}catch(o){this.error(o)}});throw new TypeError("Unable to lift unknown Observable type")}}function O(r,t,e,o,n){return new ae(r,t,e,o,n)}var ae=function(r){v(t,r);function t(e,o,n,i,s,a){var f=r.call(this,e)||this;return f.onFinalize=s,f.shouldUnsubscribe=a,f._next=o?function(c){try{o(c)}catch(u){e.error(u)}}:r.prototype._next,f._error=i?function(c){try{i(c)}catch(u){e.error(u)}finally{this.unsubscribe()}}:r.prototype._error,f._complete=n?function(){try{n()}catch(c){e.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,f}return t.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var o=this.closed;r.prototype.unsubscribe.call(this),!o&&((e=this.onFinalize)===null||e===void 0||e.call(this))}},t}($);var Tr=j(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var nr=function(r){v(t,r);function t(){var e=r.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return t.prototype.lift=function(e){var o=new Mr(this,this);return o.operator=e,o},t.prototype._throwIfClosed=function(){if(this.closed)throw new Tr},t.prototype.next=function(e){var o=this;C(function(){var n,i;if(o._throwIfClosed(),!o.isStopped){o.currentObservers||(o.currentObservers=Array.from(o.observers));try{for(var s=E(o.currentObservers),a=s.next();!a.done;a=s.next()){var f=a.value;f.next(e)}}catch(c){n={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}}})},t.prototype.error=function(e){var o=this;C(function(){if(o._throwIfClosed(),!o.isStopped){o.hasError=o.isStopped=!0,o.thrownError=e;for(var n=o.observers;n.length;)n.shift().error(e)}})},t.prototype.complete=function(){var e=this;C(function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var o=e.observers;o.length;)o.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return((e=this.observers)===null||e===void 0?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(e){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,e)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var o=this,n=this,i=n.hasError,s=n.isStopped,a=n.observers;return i||s?Z:(this.currentObservers=null,a.push(e),new g(function(){o.currentObservers=null,I(a,e)}))},t.prototype._checkFinalizedStatuses=function(e){var o=this,n=o.hasError,i=o.thrownError,s=o.isStopped;n?e.error(i):s&&e.complete()},t.prototype.asObservable=function(){var e=new b;return e.source=this,e},t.create=function(e,o){return new Mr(e,o)},t}(b);var Mr=function(r){v(t,r);function t(e,o){var n=r.call(this)||this;return n.destination=e,n.source=o,n}return t.prototype.next=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.next)===null||n===void 0||n.call(o,e)},t.prototype.error=function(e){var o,n;(n=(o=this.destination)===null||o===void 0?void 0:o.error)===null||n===void 0||n.call(o,e)},t.prototype.complete=function(){var e,o;(o=(e=this.destination)===null||e===void 0?void 0:e.complete)===null||o===void 0||o.call(e)},t.prototype._subscribe=function(e){var o,n;return(n=(o=this.source)===null||o===void 0?void 0:o.subscribe(e))!==null&&n!==void 0?n:Z},t}(nr);var q={now:function(){return(q.delegate||Date).now()},delegate:void 0};var F=function(r){v(t,r);function t(e,o,n){e===void 0&&(e=1/0),o===void 0&&(o=1/0),n===void 0&&(n=q);var i=r.call(this)||this;return i._bufferSize=e,i._windowTime=o,i._timestampProvider=n,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=o===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,o),i}return t.prototype.next=function(e){var o=this,n=o.isStopped,i=o._buffer,s=o._infiniteTimeWindow,a=o._timestampProvider,f=o._windowTime;n||(i.push(e),!s&&i.push(a.now()+f)),this._trimBuffer(),r.prototype.next.call(this,e)},t.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var o=this._innerSubscribe(e),n=this,i=n._infiniteTimeWindow,s=n._buffer,a=s.slice(),f=0;f<a.length&&!e.closed;f+=i?1:2)e.next(a[f]);return this._checkFinalizedStatuses(e),o},t.prototype._trimBuffer=function(){var e=this,o=e._bufferSize,n=e._timestampProvider,i=e._buffer,s=e._infiniteTimeWindow,a=(s?1:2)*o;if(o<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var f=n.now(),c=0,u=1;u<i.length&&i[u]<=f;u+=2)c=u;c&&i.splice(0,c+1)}},t}(nr);var Pr=function(r){v(t,r);function t(e,o){return r.call(this)||this}return t.prototype.schedule=function(e,o){return o===void 0&&(o=0),this},t}(g);var V={setInterval:function(r,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var n=V.delegate;return n?.setInterval?n.setInterval.apply(n,_([r,t],y(e))):setInterval.apply(void 0,_([r,t],y(e)))},clearInterval:function(r){var t=V.delegate;return(t?.clearInterval||clearInterval)(r)},delegate:void 0};var Ir=function(r){v(t,r);function t(e,o){var n=r.call(this,e,o)||this;return n.scheduler=e,n.work=o,n.pending=!1,n}return t.prototype.schedule=function(e,o){var n;if(o===void 0&&(o=0),this.closed)return this;this.state=e;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,o)),this.pending=!0,this.delay=o,this.id=(n=this.id)!==null&&n!==void 0?n:this.requestAsyncId(s,this.id,o),this},t.prototype.requestAsyncId=function(e,o,n){return n===void 0&&(n=0),V.setInterval(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,o,n){if(n===void 0&&(n=0),n!=null&&this.delay===n&&this.pending===!1)return o;o!=null&&V.clearInterval(o)},t.prototype.execute=function(e,o){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,o);if(n)return n;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(e,o){var n=!1,i;try{this.work(e)}catch(s){n=!0,i=s||new Error("Scheduled action threw falsy error")}if(n)return this.unsubscribe(),i},t.prototype.unsubscribe=function(){if(!this.closed){var e=this,o=e.id,n=e.scheduler,i=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,I(i,this),o!=null&&(this.id=this.recycleAsyncId(n,o,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},t}(Pr);var ir=function(){function r(t,e){e===void 0&&(e=r.now),this.schedulerActionCtor=t,this.now=e}return r.prototype.schedule=function(t,e,o){return e===void 0&&(e=0),new this.schedulerActionCtor(this,t).schedule(o,e)},r.now=q.now,r}();var Ar=function(r){v(t,r);function t(e,o){o===void 0&&(o=ir.now);var n=r.call(this,e,o)||this;return n.actions=[],n._active=!1,n}return t.prototype.flush=function(e){var o=this.actions;if(this._active){o.push(e);return}var n;this._active=!0;do if(n=e.execute(e.state,e.delay))break;while(e=o.shift());if(this._active=!1,n){for(;e=o.shift();)e.unsubscribe();throw n}},t}(ir);var sr=new Ar(Ir),jr=sr;var kr=new b(function(r){return r.complete()});function Cr(r){return r&&p(r.schedule)}var J=function(r){return r&&typeof r.length=="number"&&typeof r!="function"};function Rr(r){return p(r?.then)}function Wr(r){return p(r[W])}function Fr(r){return Symbol.asyncIterator&&p(r?.[Symbol.asyncIterator])}function Ur(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function ce(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Lr=ce();function Dr(r){return p(r?.[Lr])}function $r(r){return vr(this,arguments,function(){var e,o,n,i;return B(this,function(s){switch(s.label){case 0:e=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,P(e.read())];case 3:return o=s.sent(),n=o.value,i=o.done,i?[4,P(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,P(n)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}})})}function qr(r){return p(r?.getReader)}function U(r){if(r instanceof b)return r;if(r!=null){if(Wr(r))return fe(r);if(J(r))return ue(r);if(Rr(r))return pe(r);if(Fr(r))return Vr(r);if(Dr(r))return le(r);if(qr(r))return me(r)}throw Ur(r)}function fe(r){return new b(function(t){var e=r[W]();if(p(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ue(r){return new b(function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()})}function pe(r){return new b(function(t){r.then(function(e){t.closed||(t.next(e),t.complete())},function(e){return t.error(e)}).then(null,G)})}function le(r){return new b(function(t){var e,o;try{for(var n=E(r),i=n.next();!i.done;i=n.next()){var s=i.value;if(t.next(s),t.closed)return}}catch(a){e={error:a}}finally{try{i&&!i.done&&(o=n.return)&&o.call(n)}finally{if(e)throw e.error}}t.complete()})}function Vr(r){return new b(function(t){de(r,t).catch(function(e){return t.error(e)})})}function me(r){return Vr($r(r))}function de(r,t){var e,o,n,i;return hr(this,void 0,void 0,function(){var s,a;return B(this,function(f){switch(f.label){case 0:f.trys.push([0,5,6,11]),e=br(r),f.label=1;case 1:return[4,e.next()];case 2:if(o=f.sent(),!!o.done)return[3,4];if(s=o.value,t.next(s),t.closed)return[2];f.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=f.sent(),n={error:a},[3,11];case 6:return f.trys.push([6,,9,10]),o&&!o.done&&(i=e.return)?[4,i.call(e)]:[3,8];case 7:f.sent(),f.label=8;case 8:return[3,10];case 9:if(n)throw n.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function Hr(r,t,e,o,n){o===void 0&&(o=0),n===void 0&&(n=!1);var i=t.schedule(function(){e(),n?r.add(this.schedule(null,o)):this.unsubscribe()},o);if(r.add(i),!n)return i}var Yr=j(function(r){return function(){r(this),this.name="EmptyError",this.message="no elements in sequence"}});function ar(r,t){var e=typeof t=="object";return new Promise(function(o,n){var i=new R({next:function(s){o(s),i.unsubscribe()},error:n,complete:function(){e?o(t.defaultValue):n(new Yr)}});r.subscribe(i)})}function Br(r){return r instanceof Date&&!isNaN(r)}function T(r,t){return M(function(e,o){var n=0;e.subscribe(O(o,function(i){o.next(r.call(t,i,n++))}))})}var he=Array.isArray;function ve(r,t){return he(t)?r.apply(void 0,_([],y(t))):r(t)}function Nr(r){return T(function(t){return ve(r,t)})}function zr(r,t,e,o,n,i,s,a){var f=[],c=0,u=0,m=!1,l=function(){m&&!f.length&&!c&&t.complete()},d=function(h){return c<o?x(h):f.push(h)},x=function(h){i&&t.next(h),c++;var dr=!1;U(e(h,u++)).subscribe(O(t,function(D){n?.(D),i?d(D):t.next(D)},function(){dr=!0},void 0,function(){if(dr)try{c--;for(var D=function(){var Y=f.shift();s?Hr(t,s,function(){return x(Y)}):x(Y)};f.length&&c<o;)D();l()}catch(Y){t.error(Y)}}))};return r.subscribe(O(t,d,function(){m=!0,l()})),function(){a?.()}}function cr(r,t,e){return e===void 0&&(e=1/0),p(t)?cr(function(o,n){return T(function(i,s){return t(o,i,n,s)})(U(r(o,n)))},e):(typeof t=="number"&&(e=t),M(function(o,n){return zr(o,n,r,e)}))}var be=["addListener","removeListener"],ye=["addEventListener","removeEventListener"],xe=["on","off"];function H(r,t,e,o){if(p(e)&&(o=e,e=void 0),o)return H(r,t,e).pipe(Nr(o));var n=y(we(r)?ye.map(function(a){return function(f){return r[a](t,f,e)}}):_e(r)?be.map(Gr(r,t)):ge(r)?xe.map(Gr(r,t)):[],2),i=n[0],s=n[1];if(!i&&J(r))return cr(function(a){return H(a,t,e)})(U(r));if(!i)throw new TypeError("Invalid event target");return new b(function(a){var f=function(){for(var c=[],u=0;u<arguments.length;u++)c[u]=arguments[u];return a.next(1<c.length?c:c[0])};return i(f),function(){return s(f)}})}function Gr(r,t){return function(e){return function(o){return r[e](t,o)}}}function _e(r){return p(r.addListener)&&p(r.removeListener)}function ge(r){return p(r.on)&&p(r.off)}function we(r){return p(r.addEventListener)&&p(r.removeEventListener)}function Kr(r,t,e){r===void 0&&(r=0),e===void 0&&(e=jr);var o=-1;return t!=null&&(Cr(t)?e=t:o=t),new b(function(n){var i=Br(r)?+r-e.now():r;i<0&&(i=0);var s=0;return e.schedule(function(){n.closed||(n.next(s++),0<=o?this.schedule(void 0,o):n.complete())},i)})}function fr(r,t){return r===void 0&&(r=0),t===void 0&&(t=sr),r<0&&(r=0),Kr(r,r,t)}function S(r,t){return M(function(e,o){var n=0;e.subscribe(O(o,function(i){return r.call(t,i,n++)&&o.next(i)}))})}function L(r){return r<=0?function(){return kr}:M(function(t,e){var o=0;t.subscribe(O(e,function(n){++o<=r&&(e.next(n),r<=o&&e.complete())}))})}var Jr=(r,t)=>e=>({postMessage:o=>{let{errorCatcher:n=()=>()=>{},...i}=t??{};r.clients.get(e).then(s=>s?.postMessage(o,i)).catch(n(e,o))}});var Qr=(r=>(r.Ack="ack",r.Syn="syn",r))(Qr||{}),Se=Object.values(Qr),ur=r=>r.data,pr=r=>t=>t.type===r.toString(),Ee=r=>{let t=r.data;return typeof t=="object"&&t!==null&&"type"in t&&typeof t.type=="string"&&"instance"in t&&typeof t.instance=="string"&&"content"in t},Oe=()=>{let r="#";for(let t=0;t<3;t++)r+=`0${Math.floor(Math.random()*Math.pow(16,2)/2).toString(16)}`.slice(-2);return r},Te=class{__generateId;__instance;__colors;__listener;__log;__receiver;__subscription;__okToWrite;__write$;__recv$;__connect(r,t){let e=fr(t).subscribe(()=>this.__receiver.postMessage({content:r,instance:r,type:"syn".toString()}));this.__subscription.add(e),this.__subscription.add(this.__recv$.pipe(T(ur),S(pr("ack")),S(({content:o})=>o===r),L(1)).subscribe(({instance:o})=>{this.__okToWrite.next(0),this.__subscription.add(this.__recv$.pipe(S(({data:{type:n,instance:i}})=>!Se.includes(n)&&i===o)).subscribe(n=>{this.__listener(n);let{data:i}=n;i._id!==void 0&&this.__receiver.postMessage({...i,content:i,instance:r,type:"ack"})})),e.unsubscribe()})),this.__subscription.add(this.__recv$.pipe(T(ur),S(pr("syn")),S(({instance:o})=>o!==r),L(1)).subscribe(({content:o})=>{this.__receiver.postMessage({content:o,instance:r,type:"ack"})}))}__write(r,t){let e={};t!==void 0&&(e._id=t),this.__subscription.add(this.__write$.subscribe(()=>{let o=Object.assign(r,{instance:this.__instance,...e});this.__receiver.postMessage(o),this.__log?.(o)}))}constructor(r,t,e,o){this.__generateId=()=>globalThis.crypto.randomUUID();let n=this.__generateId(),i=new F,s=H(t,"message").pipe(S(Ee)).subscribe(i);this.__subscription=new g,this.__subscription.add(s),this.__okToWrite=new F(1),this.__write$=this.__okToWrite.pipe(L(1)),this.__recv$=i.asObservable(),this.__listener=r,this.__log=o?.log&&o.log.bind(this),this.__instance=n;let a=Oe();this.__colors={bg:`${a}22`,fg:a},this.__receiver=e,this.__connect(n,o?.period?o.period:10)}disconnect(){this.__subscription.unsubscribe()}send(r){this.__write(r)}ackSend(r){let t,e=new Promise(n=>{t=n}),o=this.__generateId();return this.__subscription.add(this.__recv$.pipe(T(ur),S(pr("ack")),S(({_id:n})=>n===o),L(1)).subscribe(()=>t())),this.__write(r,o),e}get instance(){return this.__instance}get colors(){return this.__colors}get ready(){return ar(this.__write$).then(()=>{})}},Xr=Te;var Q=new Map,lr=new Map,mr=new Map,Zr=(r,t)=>{let e=t.keys(),o,{done:n=!1,value:i}=e.next();for(;!n&&o===void 0;){i!==void 0&&r.startsWith(i)&&(o=i,n=!0);let{value:s,done:a=!1}=e.next();n=a,i=s}return o},Me=r=>r!==null&&"id"in r,Pe=r=>t=>console.error(`[SW]: error on ${r} - ${String(t)}`),Ie=Jr(self,{errorCatcher:Pe}),Ae=r=>function({data:e}){let o=e;switch(o.type){case"set-source-map":{let{content:n}=o,i=Object.entries(n).reduce((s,[a,f])=>{let{clientSourceMap:c,clientTosMap:u}=s,{headers:m={}}=f;return Object.keys(m).length>0&&u.set(encodeURI(f.to),m),c.set(encodeURI(a),f),s},{clientSourceMap:new Map,clientTosMap:new Map});lr.set(r,i.clientSourceMap),mr.set(r,i.clientTosMap);break}case"unload-client":{lr.delete(r),mr.delete(r),Q.delete(r),this.disconnect();break}default:break}},je=r=>{let t=new Map,e=new F,o={addEventListener(n,i){t.set(i,e.subscribe(s=>i(s)))},removeEventListener(n,i){t.get(i)?.unsubscribe(),t.delete(i)}};return{buffer:e,channel:new Xr(Ae(r),o,Ie(r))}},ke=r=>{let t=Q.get(r);return t||(t=je(r),Q.set(r,t)),t};self.addEventListener("install",()=>{self.skipWaiting().catch(r=>console.error(`[SW] error while skipWaiting - ${String(r)}`))});self.addEventListener("activate",r=>{r.waitUntil(self.clients.claim())});self.addEventListener("message",r=>{let{source:t}=r;if(!Me(t))return;let{id:e}=t;ke(e).buffer.next(r)});self.addEventListener("fetch",r=>{let t=r.clientId!==""?r.clientId:r.resultingClientId,e=lr.get(t);if(!e)return r.respondWith(self.fetch(r.request));let o=mr.get(t),{request:{url:n}}=r,i=Zr(n,e),s=Zr(n,o),a=new Headers(r.request.headers),f={};if(i!==void 0){let m=e.get(i)?.to,l=e.get(i)?.headers??{},d=n.substring(i.length);f=e.get(i)?.query??{},n=`${m}${d}`,Object.entries(l).forEach(([x,h])=>a.set(x,h))}if(s!==void 0){let m=o.get(s)??{};Object.entries(m).forEach(([l,d])=>a.set(l,d))}let c;try{let m=new URL(n);Object.entries(f).forEach(([l,d])=>m.searchParams.set(l,d)),c=m.href}catch{c=n}let u=Q.get(t)?.channel;if(u!==void 0&&process.env.MODE==="development"){let m={background:u.colors.bg,color:u.colors.fg};console.groupCollapsed("%c Fetch from Service Worker ",Object.entries(m).map(([l,d])=>`${l}: ${d}`).join("; ")),console.info(`sw is fetching %c ${c}`,"background: lightgreen; color: darkgreen"),console.log({clientId:t,clientSourceMap:e}),console.groupEnd()}r.respondWith(self.fetch(c,{...r.request,headers:a}).catch(m=>(console.error(m),Promise.reject(m))))});})();