@flaxia/node 0.3.4 → 0.3.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"SignalingClient.d.ts","sourceRoot":"","sources":["../../src/client/SignalingClient.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA2RD,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,SAsBhD,CAAC"}
1
+ {"version":3,"file":"SignalingClient.d.ts","sourceRoot":"","sources":["../../src/client/SignalingClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAK5D,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA2RD,eAAO,MAAM,cAAc,GAAI,QAAQ,UAAU,SAkChD,CAAC"}
@@ -5,7 +5,7 @@ interface ConsentConfig {
5
5
  }
6
6
  export declare class ConsentUI {
7
7
  private shadow;
8
- constructor(container: HTMLElement, config: ConsentConfig, onConsent: () => void);
8
+ constructor(container: HTMLElement, config: ConsentConfig, onConsent: () => void, onReject?: () => void);
9
9
  private render;
10
10
  }
11
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"ConsentUI.d.ts","sourceRoot":"","sources":["../../src/consent/ConsentUI.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAa;gBAEf,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI;IAKhF,OAAO,CAAC,MAAM;CA+Cf"}
1
+ {"version":3,"file":"ConsentUI.d.ts","sourceRoot":"","sources":["../../src/consent/ConsentUI.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,cAAc,GAAG,aAAa,GAAG,WAAW,GAAG,UAAU,CAAC;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAa;gBAGzB,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,IAAI,EACrB,QAAQ,CAAC,EAAE,MAAM,IAAI;IAMvB,OAAO,CAAC,MAAM;CAyFf"}
@@ -3,6 +3,8 @@ declare function safeSet(key: string, value: string): void;
3
3
  declare function safeRemove(key: string): void;
4
4
  export declare const hasConsent: () => boolean;
5
5
  export declare const saveConsent: () => void;
6
+ export declare const hasDenial: () => boolean;
7
+ export declare const saveDenial: () => void;
6
8
  export declare const safeLocalStorageGet: typeof safeGet;
7
9
  export declare const safeLocalStorageSet: typeof safeSet;
8
10
  export declare const safeLocalStorageRemove: typeof safeRemove;
@@ -1 +1 @@
1
- {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/consent/storage.ts"],"names":[],"mappings":"AAWA,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM3C;AAED,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMjD;AAED,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMrC;AAED,eAAO,MAAM,UAAU,QAAO,OAgB7B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,IAG9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAAU,CAAC;AAC3C,eAAO,MAAM,mBAAmB,gBAAU,CAAC;AAC3C,eAAO,MAAM,sBAAsB,mBAAa,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,MAajC,CAAC"}
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/consent/storage.ts"],"names":[],"mappings":"AAYA,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAM3C;AAED,iBAAS,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAMjD;AAED,iBAAS,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAMrC;AAED,eAAO,MAAM,UAAU,QAAO,OAgB7B,CAAC;AAEF,eAAO,MAAM,WAAW,QAAO,IAG9B,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,OAE5B,CAAC;AAEF,eAAO,MAAM,UAAU,QAAO,IAE7B,CAAC;AAEF,eAAO,MAAM,mBAAmB,gBAAU,CAAC;AAC3C,eAAO,MAAM,mBAAmB,gBAAU,CAAC;AAC3C,eAAO,MAAM,sBAAsB,mBAAa,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,MAajC,CAAC"}
package/dist/index.js CHANGED
@@ -1,18 +1,19 @@
1
1
  import { r as e, t } from "./assets/memoryProbe.js";
2
2
  //#region src/consent/ConsentUI.ts
3
3
  var n = class {
4
- constructor(e, t, n) {
5
- this.shadow = e.attachShadow({ mode: "open" }), this.render(t, n);
4
+ constructor(e, t, n, r) {
5
+ this.shadow = e.attachShadow({ mode: "open" }), this.render(t, n, r);
6
6
  }
7
- render(e, t) {
8
- let { brandName: n, position: r, accentColor: i = "#6366f1" } = e, [a, o] = r.split("-"), s = document.createElement("style");
9
- s.textContent = `
7
+ render(e, t, n) {
8
+ let { brandName: r, position: i, accentColor: a = "#6366f1" } = e, [o, s] = i.split("-"), c = document.createElement("style");
9
+ c.textContent = `
10
10
  .overlay {
11
11
  position: fixed;
12
- ${a}: 20px;
13
12
  ${o}: 20px;
13
+ ${s}: 20px;
14
14
  padding: 20px;
15
15
  background: #fff;
16
+ color: #1f2937;
16
17
  border: 1px solid #ccc;
17
18
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
18
19
  z-index: 9999;
@@ -20,8 +21,19 @@ var n = class {
20
21
  max-width: 300px;
21
22
  font-family: sans-serif;
22
23
  }
24
+ .overlay h3 {
25
+ margin: 0 0 8px;
26
+ color: #111827;
27
+ font-size: 16px;
28
+ }
29
+ .overlay p {
30
+ margin: 0 0 12px;
31
+ color: #4b5563;
32
+ font-size: 14px;
33
+ line-height: 1.4;
34
+ }
23
35
  button {
24
- background: ${i};
36
+ background: ${a};
25
37
  color: white;
26
38
  border: none;
27
39
  padding: 10px 15px;
@@ -29,50 +41,79 @@ var n = class {
29
41
  cursor: pointer;
30
42
  margin-top: 10px;
31
43
  width: 100%;
44
+ font-size: 14px;
45
+ }
46
+ button.reject {
47
+ background: transparent;
48
+ color: #4b5563;
49
+ border: 1px solid #ccc;
50
+ }
51
+ @media (prefers-color-scheme: dark) {
52
+ .overlay {
53
+ background: #1f2937;
54
+ color: #f9fafb;
55
+ border-color: #374151;
56
+ box-shadow: 0 4px 6px rgba(0,0,0,0.4);
57
+ }
58
+ .overlay h3 {
59
+ color: #f9fafb;
60
+ }
61
+ .overlay p {
62
+ color: #d1d5db;
63
+ }
64
+ button.reject {
65
+ color: #d1d5db;
66
+ border-color: #4b5563;
67
+ }
32
68
  }
33
69
  `;
34
- let c = document.createElement("div");
35
- c.className = "overlay", c.innerHTML = `
36
- <h3>${n}</h3>
70
+ let l = document.createElement("div");
71
+ l.className = "overlay", l.innerHTML = `
72
+ <h3>${r}</h3>
37
73
  <p>サイトのパフォーマンス向上にご協力ください。</p>
38
74
  <button id="consent-btn">同意して開始</button>
39
- `, c.querySelector("#consent-btn")?.addEventListener("click", () => {
40
- c.remove(), t();
41
- }), this.shadow.appendChild(s), this.shadow.appendChild(c);
75
+ <button id="reject-btn" class="reject">拒否</button>
76
+ `, l.querySelector("#consent-btn")?.addEventListener("click", () => {
77
+ l.remove(), t();
78
+ }), l.querySelector("#reject-btn")?.addEventListener("click", () => {
79
+ l.remove(), n?.();
80
+ }), this.shadow.appendChild(c), this.shadow.appendChild(l);
42
81
  }
43
- }, r = "flaxia_consent_granted", i = "flaxia_consent_expiry", a = 720 * 60 * 60 * 1e3, o = /* @__PURE__ */ new Map();
44
- function s(e) {
82
+ }, r = "flaxia_consent_granted", i = "flaxia_consent_expiry", a = "flaxia_consent_denied", o = 720 * 60 * 60 * 1e3, s = /* @__PURE__ */ new Map();
83
+ function c(e) {
45
84
  try {
46
85
  return localStorage.getItem(e);
47
86
  } catch {
48
- return o.get(e) ?? null;
87
+ return s.get(e) ?? null;
49
88
  }
50
89
  }
51
- function c(e, t) {
90
+ function l(e, t) {
52
91
  try {
53
92
  localStorage.setItem(e, t);
54
93
  } catch {
55
- o.set(e, t);
94
+ s.set(e, t);
56
95
  }
57
96
  }
58
- function l(e) {
97
+ function u(e) {
59
98
  try {
60
99
  localStorage.removeItem(e);
61
100
  } catch {
62
- o.delete(e);
101
+ s.delete(e);
63
102
  }
64
103
  }
65
- var u = () => {
66
- if (s(r) !== "true") return !1;
67
- let e = s(i);
104
+ var d = () => {
105
+ if (c(r) !== "true") return !1;
106
+ let e = c(i);
68
107
  if (e) {
69
108
  let t = parseInt(e, 10);
70
- if (!Number.isFinite(t) || Date.now() > t) return l(r), l(i), !1;
109
+ if (!Number.isFinite(t) || Date.now() > t) return u(r), u(i), !1;
71
110
  }
72
111
  return !0;
73
- }, d = () => {
74
- c(r, "true"), c(i, String(Date.now() + a));
75
- }, f = s, p = c, m = () => {
112
+ }, f = () => {
113
+ l(r, "true"), l(i, String(Date.now() + o));
114
+ }, p = () => c(a) === "true", m = () => {
115
+ l(a, "true");
116
+ }, h = c, g = l, _ = () => {
76
117
  try {
77
118
  if (typeof crypto < "u" && typeof crypto.randomUUID == "function") return crypto.randomUUID();
78
119
  } catch {}
@@ -80,7 +121,7 @@ var u = () => {
80
121
  let t = Math.random() * 16 | 0;
81
122
  return (e === "x" ? t : t & 3 | 8).toString(16);
82
123
  });
83
- }, h = (...e) => console.log("[flaxia-node]", ...e), g = class {
124
+ }, v = (...e) => console.log("[flaxia-node]", ...e), y = class {
84
125
  constructor(e, t = 3e5) {
85
126
  this.worker = null, this.queue = [], this.active = null, this._lastCpuLoad = 0, this.workerUrl = e || "/worker.js", this.defaultTimeoutMs = t, this.initWorker();
86
127
  }
@@ -100,7 +141,7 @@ var u = () => {
100
141
  return;
101
142
  }
102
143
  let c = () => this.execute(e, t, n, r, i, a, o, s);
103
- this.active ? (h(`task queued id=${e} workload=${t} (active task running)`), this.queue.push(c)) : c();
144
+ this.active ? (v(`task queued id=${e} workload=${t} (active task running)`), this.queue.push(c)) : c();
104
145
  });
105
146
  }
106
147
  execute(e, t, n, r, i, a, o, s) {
@@ -110,7 +151,7 @@ var u = () => {
110
151
  return;
111
152
  }
112
153
  let l = r ?? this.defaultTimeoutMs, u = !1, d = performance.now();
113
- h(`task start id=${e} workload=${t} timeoutMs=${l}`);
154
+ v(`task start id=${e} workload=${t} timeoutMs=${l}`);
114
155
  let f = (e) => {
115
156
  if (u) return;
116
157
  u = !0;
@@ -127,16 +168,16 @@ var u = () => {
127
168
  typeof p == "number" && Number.isFinite(p) && (this._lastCpuLoad = Math.min(1, Math.max(0, p)));
128
169
  return;
129
170
  }
130
- a === "done" ? (h(`task done id=${e} workload=${t} durationMs=${Math.round(performance.now() - d)}`), f(() => o(c))) : a === "error" ? (h(`task failed id=${e} workload=${t} error=${l}`), f(() => s(Error(l)))) : (h(`task unknown-message id=${e} type=${String(a)}`), f(() => s(/* @__PURE__ */ Error(`Unknown message type: ${String(a)}`))));
171
+ a === "done" ? (v(`task done id=${e} workload=${t} durationMs=${Math.round(performance.now() - d)}`), f(() => o(c))) : a === "error" ? (v(`task failed id=${e} workload=${t} error=${l}`), f(() => s(Error(l)))) : (v(`task unknown-message id=${e} type=${String(a)}`), f(() => s(/* @__PURE__ */ Error(`Unknown message type: ${String(a)}`))));
131
172
  }
132
- }, m = () => c.removeEventListener("message", p), g = setTimeout(() => {
133
- h(`task timeout id=${e} workload=${t} (worker terminated after ${l}ms)`), this.cleanupWorker(), f(() => s(/* @__PURE__ */ Error("TIMEOUT")));
173
+ }, m = () => c.removeEventListener("message", p), h = setTimeout(() => {
174
+ v(`task timeout id=${e} workload=${t} (worker terminated after ${l}ms)`), this.cleanupWorker(), f(() => s(/* @__PURE__ */ Error("TIMEOUT")));
134
175
  }, l);
135
176
  this.active = {
136
177
  id: e,
137
178
  resolve: o,
138
179
  reject: s,
139
- timer: g,
180
+ timer: h,
140
181
  worker: c,
141
182
  removeListener: m
142
183
  }, c.addEventListener("message", p);
@@ -153,7 +194,7 @@ var u = () => {
153
194
  }
154
195
  }
155
196
  handleWorkerError(e) {
156
- h(`worker error error=${e.message}`);
197
+ v(`worker error error=${e.message}`);
157
198
  let t = this.active;
158
199
  this.cleanupWorker(), t && (clearTimeout(t.timer), this.active = null, t.reject(e), this.dequeue());
159
200
  }
@@ -173,13 +214,13 @@ var u = () => {
173
214
  get lastCpuLoad() {
174
215
  return this._lastCpuLoad;
175
216
  }
176
- }, _ = (...e) => console.log("[flaxia-node]", ...e), v = (...e) => console.error("[flaxia-node]", ...e), y = "flaxia_node_id", b = "flaxia_node_token", x = class {
217
+ }, b = (...e) => console.log("[flaxia-node]", ...e), x = (...e) => console.error("[flaxia-node]", ...e), S = "flaxia_node_id", C = "flaxia_node_token", w = class {
177
218
  constructor(e, t, n) {
178
219
  this.config = e, this.workerPool = t, this.nodeId = n, this.ws = null, this.reconnectAttempts = 0, this.MAX_RECONNECT_DELAY = 3e4, this.destroyed = !1, this.suspended = !1, this.visibilityHandler = null, this.inflightTasks = /* @__PURE__ */ new Set();
179
220
  }
180
221
  async connect() {
181
222
  if (this.destroyed) return;
182
- if (_(`connect nodeId=${this.nodeId}`), this.ws) {
223
+ if (b(`connect nodeId=${this.nodeId}`), this.ws) {
183
224
  let e = this.ws;
184
225
  e.onclose = null;
185
226
  try {
@@ -190,14 +231,14 @@ var u = () => {
190
231
  this.setupVisibilityHandler();
191
232
  let e = await this.obtainToken();
192
233
  if (!e) {
193
- v("token acquisition failed; scheduling reconnect"), this.scheduleReconnect();
234
+ x("token acquisition failed; scheduling reconnect"), this.scheduleReconnect();
194
235
  return;
195
236
  }
196
237
  let t = this.config.orchestratorUrl.replace(/\/+$/, "").replace(/^http/, "ws"), n = new URL(`${t}/crowd/signal`);
197
238
  n.searchParams.set("token", e.token);
198
239
  let r = new WebSocket(n.toString());
199
240
  this.ws = r, r.onopen = () => {
200
- this.reconnectAttempts = 0, _(`signal connected ${n.toString()}`);
241
+ this.reconnectAttempts = 0, b(`signal connected ${n.toString()}`);
201
242
  }, r.onmessage = async (e) => {
202
243
  let t;
203
244
  try {
@@ -214,12 +255,12 @@ var u = () => {
214
255
  }
215
256
  if (t.type === "task") {
216
257
  let e = t;
217
- _(`task received taskId=${e.taskId} workload=${e.workload} timeoutMs=${e.timeoutMs ?? "default"}`);
258
+ b(`task received taskId=${e.taskId} workload=${e.workload} timeoutMs=${e.timeoutMs ?? "default"}`);
218
259
  try {
219
260
  await this.handleTask(e);
220
261
  } catch (n) {
221
262
  let r = n instanceof Error ? n.message : String(n);
222
- v(`task failed taskId=${e.taskId} workload=${e.workload} error=${r}`), this.send({
263
+ x(`task failed taskId=${e.taskId} workload=${e.workload} error=${r}`), this.send({
223
264
  type: "error",
224
265
  taskId: String(t.taskId ?? ""),
225
266
  error: r
@@ -227,7 +268,7 @@ var u = () => {
227
268
  }
228
269
  }
229
270
  }, r.onclose = () => {
230
- r.onclose = null, this.ws === r && (this.ws = null, !this.destroyed && (_(`signal disconnected; scheduling reconnect attempt=${this.reconnectAttempts + 1}`), this.scheduleReconnect()));
271
+ r.onclose = null, this.ws === r && (this.ws = null, !this.destroyed && (b(`signal disconnected; scheduling reconnect attempt=${this.reconnectAttempts + 1}`), this.scheduleReconnect()));
231
272
  };
232
273
  }
233
274
  scheduleReconnect() {
@@ -237,13 +278,13 @@ var u = () => {
237
278
  }, e);
238
279
  }
239
280
  disconnect() {
240
- _(`disconnect nodeId=${this.nodeId}`), this.destroyed = !0, this.suspended = !1, this.removeVisibilityHandler();
281
+ b(`disconnect nodeId=${this.nodeId}`), this.destroyed = !0, this.suspended = !1, this.removeVisibilityHandler();
241
282
  try {
242
283
  this.ws?.close();
243
284
  } catch {}
244
285
  this.ws = null;
245
286
  try {
246
- delete window[C];
287
+ delete window[E];
247
288
  } catch {}
248
289
  try {
249
290
  this.workerPool.terminate();
@@ -251,7 +292,7 @@ var u = () => {
251
292
  }
252
293
  suspend() {
253
294
  if (!(this.suspended || this.destroyed)) {
254
- if (_("suspended (visibility or manual)"), this.suspended = !0, this.ws) {
295
+ if (b("suspended (visibility or manual)"), this.suspended = !0, this.ws) {
255
296
  let e = this.ws;
256
297
  e.onclose = null;
257
298
  try {
@@ -263,17 +304,17 @@ var u = () => {
263
304
  }
264
305
  }
265
306
  resume() {
266
- !this.suspended || this.destroyed || (_("resumed"), this.suspended = !1, this.workerPool.resume(), this.connect());
307
+ !this.suspended || this.destroyed || (b("resumed"), this.suspended = !1, this.workerPool.resume(), this.connect());
267
308
  }
268
309
  async obtainToken() {
269
310
  try {
270
- let n = f(b);
311
+ let n = h(C);
271
312
  if (n) try {
272
313
  let e = JSON.parse(n);
273
- if (e.token && e.nodeId && e.expiresAt > Date.now() + 6e4) return _(`token cached nodeId=${e.nodeId} expiresIn=${Math.round((e.expiresAt - Date.now()) / 1e3)}s`), e;
314
+ if (e.token && e.nodeId && e.expiresAt > Date.now() + 6e4) return b(`token cached nodeId=${e.nodeId} expiresIn=${Math.round((e.expiresAt - Date.now()) / 1e3)}s`), e;
274
315
  } catch {}
275
316
  let r = e(), i = r >= t, a = i ? this.config.capabilities ?? ["ai-inference", "image-process"] : [];
276
- _(`register capability probe capable=${i} wasmMemoryBytes=${r} capabilities=${JSON.stringify(a)}`);
317
+ b(`register capability probe capable=${i} wasmMemoryBytes=${r} capabilities=${JSON.stringify(a)}`);
277
318
  let o = this.config.orchestratorUrl.replace(/\/+$/, ""), s = await fetch(`${o}/crowd/nodes/register`, {
278
319
  method: "POST",
279
320
  headers: { "Content-Type": "application/json" },
@@ -285,16 +326,16 @@ var u = () => {
285
326
  deviceMemory: typeof navigator.deviceMemory == "number" ? navigator.deviceMemory : null
286
327
  })
287
328
  });
288
- if (!s.ok) return v(`node register failed HTTP ${s.status} (${o}/crowd/nodes/register)`), null;
329
+ if (!s.ok) return x(`node register failed HTTP ${s.status} (${o}/crowd/nodes/register)`), null;
289
330
  let c = await s.json();
290
- if (!c.token) return v("node register returned no token"), null;
291
- _(`node registered nodeId=${this.nodeId} expiresIn=${Math.round((c.expiresAt - Date.now()) / 1e3)}s`);
331
+ if (!c.token) return x("node register returned no token"), null;
332
+ b(`node registered nodeId=${this.nodeId} expiresIn=${Math.round((c.expiresAt - Date.now()) / 1e3)}s`);
292
333
  try {
293
- p(b, JSON.stringify(c));
334
+ g(C, JSON.stringify(c));
294
335
  } catch {}
295
336
  return c;
296
337
  } catch (e) {
297
- return v("node register threw", e instanceof Error ? e.message : e), null;
338
+ return x("node register threw", e instanceof Error ? e.message : e), null;
298
339
  }
299
340
  }
300
341
  send(e) {
@@ -316,7 +357,7 @@ var u = () => {
316
357
  type: "result",
317
358
  taskId: e.taskId,
318
359
  payload: r
319
- }), _(`task result sent taskId=${e.taskId} workload=${e.workload} durationMs=${Math.round(performance.now() - t)}`);
360
+ }), b(`task result sent taskId=${e.taskId} workload=${e.workload} durationMs=${Math.round(performance.now() - t)}`);
320
361
  } finally {
321
362
  this.inflightTasks.delete(e.taskId);
322
363
  }
@@ -329,23 +370,26 @@ var u = () => {
329
370
  removeVisibilityHandler() {
330
371
  this.visibilityHandler &&= (document.removeEventListener("visibilitychange", this.visibilityHandler), null);
331
372
  }
332
- }, S = "__flaxia_node_signal_client", C = "__flaxia_node_init_started", w = (e) => {
333
- let t = window[S];
373
+ }, T = "__flaxia_node_signal_client", E = "__flaxia_node_init_started", D = (e) => {
374
+ let t = window[T];
334
375
  t && t.disconnect();
335
- let n = new URL("./worker.js", "" + import.meta.url).href, r = new g(n), i = f(y);
336
- i || (i = m(), p(y, i));
337
- let a = new x(e, r, i);
338
- window[S] = a, a.connect();
339
- }, T = (e) => {
340
- if (window[C]) return;
341
- if (window[C] = !0, u()) {
342
- w(e);
376
+ let n = new URL("./worker.js", "" + import.meta.url).href, r = new y(n), i = h(S);
377
+ i || (i = _(), g(S, i));
378
+ let a = new w(e, r, i);
379
+ window[T] = a, a.connect();
380
+ }, O = (e) => {
381
+ if (window[E]) return;
382
+ if (window[E] = !0, d()) {
383
+ D(e);
343
384
  return;
344
385
  }
386
+ if (p()) return;
345
387
  let t = document.createElement("div");
346
388
  t.id = "flaxia-consent-container", document.body.appendChild(t), new n(t, e.consent, () => {
347
- d(), t.remove(), w(e);
389
+ f(), t.remove(), D(e);
390
+ }, () => {
391
+ m(), t.remove();
348
392
  });
349
393
  };
350
394
  //#endregion
351
- export { T as initFlaxiaNode };
395
+ export { O as initFlaxiaNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flaxia/node",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "./dist/index.d.ts",