@bereasoftware/nexa 1.4.1 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/nexa.es.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Nexa v1.4.1 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/Nexa */
1
+ /*! Nexa v1.5.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/Nexa */
2
2
  //#region src/types/index.ts
3
3
  var e = (e) => ({
4
4
  ok: !0,
@@ -39,15 +39,15 @@ var i = { validate(n) {
39
39
  code: "VALIDATION_ERROR"
40
40
  });
41
41
  } }, o = { transform(e) {
42
- return m(e, ee);
42
+ return h(e, ee);
43
43
  } }, s = { transform(e) {
44
- return m(e, te);
44
+ return h(e, m);
45
45
  } }, c = { transform(e) {
46
- return h(e);
46
+ return g(e);
47
47
  } };
48
48
  function l(e) {
49
49
  return { transform(t) {
50
- return Array.isArray(t) ? t.map((t) => g(t, e)) : g(t, e);
50
+ return Array.isArray(t) ? t.map((t) => _(t, e)) : _(t, e);
51
51
  } };
52
52
  }
53
53
  function u(e) {
@@ -107,47 +107,47 @@ var d = class {
107
107
  function ee(e) {
108
108
  return e.replace(/_([a-z])/g, (e, t) => t.toUpperCase());
109
109
  }
110
- function te(e) {
110
+ function m(e) {
111
111
  return e.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
112
112
  }
113
- function m(e, t) {
113
+ function h(e, t) {
114
114
  if (!e || typeof e != "object") return e;
115
- if (Array.isArray(e)) return e.map((e) => m(e, t));
115
+ if (Array.isArray(e)) return e.map((e) => h(e, t));
116
116
  let n = {};
117
- for (let [r, i] of Object.entries(e)) n[t(r)] = m(i, t);
117
+ for (let [r, i] of Object.entries(e)) n[t(r)] = h(i, t);
118
118
  return n;
119
119
  }
120
- function h(e, t = "") {
120
+ function g(e, t = "") {
121
121
  let n = {};
122
122
  if (Array.isArray(e)) e.forEach((e, r) => {
123
123
  let i = t ? `${t}[${r}]` : `[${r}]`;
124
- Object.assign(n, h(e, i));
124
+ Object.assign(n, g(e, i));
125
125
  });
126
126
  else if (e && typeof e == "object") for (let [r, i] of Object.entries(e)) {
127
127
  let e = t ? `${t}.${r}` : r;
128
- i && typeof i == "object" && !Array.isArray(i) ? Object.assign(n, h(i, e)) : n[e] = i;
128
+ i && typeof i == "object" && !Array.isArray(i) ? Object.assign(n, g(i, e)) : n[e] = i;
129
129
  }
130
130
  return n;
131
131
  }
132
- function g(e, t) {
132
+ function _(e, t) {
133
133
  if (!e || typeof e != "object") return {};
134
134
  let n = e, r = {};
135
135
  for (let e of t) e in n && (r[e] = n[e]);
136
136
  return r;
137
137
  }
138
- function ne(e) {
138
+ function te(e) {
139
139
  let t = new AbortController(), n = setTimeout(() => t.abort(), e);
140
140
  return t.signal.addEventListener("abort", () => clearTimeout(n), { once: !0 }), t;
141
141
  }
142
- async function _(e, t = 3) {
142
+ async function v(e, t = 3) {
143
143
  try {
144
144
  return await e();
145
145
  } catch (n) {
146
146
  if (t <= 0) throw n;
147
- return _(e, t - 1);
147
+ return v(e, t - 1);
148
148
  }
149
149
  }
150
- var v = class {
150
+ var y = class {
151
151
  cache = /* @__PURE__ */ new Map();
152
152
  get(e) {
153
153
  let t = this.cache.get(e);
@@ -171,8 +171,8 @@ var v = class {
171
171
  this.cache.delete(e);
172
172
  }
173
173
  };
174
- function y(e = {}) {
175
- let t = e.cache || new v(), n = e.ttlMs || 6e4, r = e.cacheableStatuses || [200, 304];
174
+ function b(e = {}) {
175
+ let t = e.cache || new y(), n = e.ttlMs || 6e4, r = e.cacheableStatuses || [200, 304];
176
176
  return async (e, i) => {
177
177
  let a = (e.request.method || "GET").toUpperCase(), o = a === "GET", s = `${a}:${e.request.url}`;
178
178
  if (o && t.has(s)) {
@@ -185,7 +185,7 @@ function y(e = {}) {
185
185
  await i(), o && e.response && r.includes(e.response.status) && (t.set(s, e.response, n), e.state.cacheMiss = !0);
186
186
  };
187
187
  }
188
- var b = y(), x = class {
188
+ var x = b(), S = class {
189
189
  pending = /* @__PURE__ */ new Map();
190
190
  async execute(e, t) {
191
191
  if (this.pending.has(e)) return this.pending.get(e);
@@ -198,8 +198,8 @@ var b = y(), x = class {
198
198
  this.pending.clear();
199
199
  }
200
200
  };
201
- function S(e = {}) {
202
- let t = e.deduplicator || new x(), n = e.includeBody ?? !1, r = e.methods || ["GET"];
201
+ function C(e = {}) {
202
+ let t = e.deduplicator || new S(), n = e.includeBody ?? !1, r = e.methods || ["GET"];
203
203
  return async (e, i) => {
204
204
  let a = (e.request.method || "GET").toUpperCase();
205
205
  if (!r.includes(a)) {
@@ -215,8 +215,8 @@ function S(e = {}) {
215
215
  }
216
216
  };
217
217
  }
218
- var re = S();
219
- function C(e) {
218
+ var ne = C();
219
+ function w(e) {
220
220
  return async (t) => {
221
221
  let n = -1;
222
222
  async function r(i) {
@@ -228,7 +228,7 @@ function C(e) {
228
228
  await r(0);
229
229
  };
230
230
  }
231
- var ie = class {
231
+ var re = class {
232
232
  middlewares = [];
233
233
  use(e) {
234
234
  return this.middlewares.push(e), this;
@@ -236,7 +236,7 @@ var ie = class {
236
236
  async execute(e) {
237
237
  if (e && typeof e == "object" && "request" in e && "response" in e) {
238
238
  let t = e;
239
- return await C(this.middlewares.map((e) => typeof e == "function" && e.length === 2 ? e : async (t, n) => {
239
+ return await w(this.middlewares.map((e) => typeof e == "function" && e.length === 2 ? e : async (t, n) => {
240
240
  let r = e;
241
241
  t.response.body = await r(t.response.body), await n();
242
242
  }))(t), t.response.body;
@@ -249,7 +249,7 @@ var ie = class {
249
249
  this.middlewares = [];
250
250
  }
251
251
  };
252
- function w(e, t, n, r = {}) {
252
+ function ie(e, t, n, r = {}) {
253
253
  return {
254
254
  ok: e >= 200 && e < 300,
255
255
  data: t,
@@ -282,13 +282,13 @@ function T(e) {
282
282
  return i;
283
283
  };
284
284
  }
285
- function E(e) {
285
+ function ae(e) {
286
286
  return { request: async (t, n, r) => {
287
287
  let i = e[n];
288
288
  return await T(i)(t, r);
289
289
  } };
290
290
  }
291
- var D = class e {
291
+ var E = class e {
292
292
  subscribers = [];
293
293
  errorSubscribers = [];
294
294
  completeSubscribers = [];
@@ -317,7 +317,7 @@ var D = class e {
317
317
  }, (e) => n.error(e), () => n.complete()), n;
318
318
  }
319
319
  };
320
- function ae(e) {
320
+ function D(e) {
321
321
  return (t) => {
322
322
  if (!e(t)) throw TypeError("Value does not match expected type");
323
323
  return t;
@@ -326,10 +326,10 @@ function ae(e) {
326
326
  function O(e) {
327
327
  return e;
328
328
  }
329
- function oe(e) {
329
+ function k(e) {
330
330
  return O(e);
331
331
  }
332
- var se = class {
332
+ var oe = class {
333
333
  _promise;
334
334
  resolveFunc;
335
335
  rejectFunc;
@@ -351,7 +351,7 @@ var se = class {
351
351
  return this._promise;
352
352
  }
353
353
  };
354
- async function k(e, t = {}) {
354
+ async function A(e, t = {}) {
355
355
  let n = e.body?.getReader();
356
356
  if (!n) throw Error("Response body is not readable");
357
357
  let r = [], i = 0, a = parseInt(e.headers.get("content-length") || "0", 10);
@@ -360,22 +360,22 @@ async function k(e, t = {}) {
360
360
  if (e) break;
361
361
  r.push(o), i += o.length, t.onChunk && await t.onChunk(o), t.onProgress && a > 0 && t.onProgress(i, a);
362
362
  }
363
- return A(r, i);
363
+ return j(r, i);
364
364
  }
365
- function A(e, t) {
365
+ function j(e, t) {
366
366
  let n = new Uint8Array(t), r = 0;
367
367
  for (let t of e) n.set(t, r), r += t.byteLength;
368
368
  return n;
369
369
  }
370
- async function ce(e, t) {
371
- let n = await k(e);
370
+ async function se(e, t) {
371
+ let n = await A(e);
372
372
  if (typeof window > "u") await (await import("fs").then((e) => e.promises)).writeFile(t, n);
373
373
  else {
374
374
  let e = new Blob([n.buffer], { type: "application/octet-stream" }), r = URL.createObjectURL(e), i = document.createElement("a");
375
375
  i.href = r, i.download = t, i.click(), URL.revokeObjectURL(r);
376
376
  }
377
377
  }
378
- function j(e = {}) {
378
+ function M(e = {}) {
379
379
  return async (t, n) => {
380
380
  if (await n(), t.response && t.response.body && typeof t.response.body == "object" && "getReader" in t.response.body) {
381
381
  let n = t.response.body.getReader(), r = [], i = 0, a = parseInt(t.response.headers?.["content-length"] || "0", 10);
@@ -385,7 +385,7 @@ function j(e = {}) {
385
385
  if (o) break;
386
386
  r.push(s), i += s.length, e.onChunk && await e.onChunk(s), e.onProgress && a > 0 && e.onProgress(i, a), t.state.streamedChunks = t.state.streamedChunks || [], t.state.streamedChunks.push(s);
387
387
  }
388
- let o = A(r, i);
388
+ let o = j(r, i);
389
389
  t.response.body = o, t.state.streaming = !0, t.state.streamedBytes = i;
390
390
  } finally {
391
391
  n.releaseLock();
@@ -393,15 +393,15 @@ function j(e = {}) {
393
393
  }
394
394
  };
395
395
  }
396
- var le = j({ onProgress: (e, t) => {
396
+ var ce = M({ onProgress: (e, t) => {
397
397
  if (t > 0) {
398
398
  let n = Math.round(e / t * 100);
399
399
  console.warn(`Streaming: ${n}% (${e}/${t} bytes)`);
400
400
  }
401
- } }), M = class {
401
+ } }), N = class {
402
402
  plugins = [];
403
- cache = new v();
404
- deduplicator = new x();
403
+ cache = new y();
404
+ deduplicator = new S();
405
405
  middlewares = [];
406
406
  listeners = /* @__PURE__ */ new Map();
407
407
  register(e) {
@@ -417,7 +417,7 @@ var le = j({ onProgress: (e, t) => {
417
417
  return this.deduplicator;
418
418
  }
419
419
  getPipeline() {
420
- return C(this.middlewares);
420
+ return w(this.middlewares);
421
421
  }
422
422
  async executePipeline(e) {
423
423
  await this.getPipeline()(e);
@@ -440,7 +440,7 @@ var le = j({ onProgress: (e, t) => {
440
440
  clear() {
441
441
  this.plugins = [], this.middlewares = [], this.listeners.clear(), this.cache.clear(), this.deduplicator.clear();
442
442
  }
443
- }, ue = {
443
+ }, le = {
444
444
  name: "logger",
445
445
  setup(e) {
446
446
  e.on("request:start", (...e) => {
@@ -454,7 +454,7 @@ var le = j({ onProgress: (e, t) => {
454
454
  console.error(`❌ Request failed: ${t}`, n);
455
455
  });
456
456
  }
457
- }, N = class {
457
+ }, ue = class {
458
458
  name = "metrics";
459
459
  metrics = {
460
460
  requests: 0,
@@ -471,22 +471,22 @@ var le = j({ onProgress: (e, t) => {
471
471
  getMetrics() {
472
472
  return { ...this.metrics };
473
473
  }
474
- }, P = class {
474
+ }, de = class {
475
475
  name = "cache";
476
476
  ttlMs;
477
477
  constructor(e = 6e4) {
478
478
  this.ttlMs = e;
479
479
  }
480
480
  setup(e) {
481
- e.addMiddleware(y({ ttlMs: this.ttlMs }));
481
+ e.addMiddleware(b({ ttlMs: this.ttlMs }));
482
482
  }
483
- }, F = class {
483
+ }, fe = class {
484
484
  name = "dedupe";
485
485
  setup(e) {
486
- e.addMiddleware(S());
486
+ e.addMiddleware(C());
487
487
  }
488
- }, I = class {
489
- store = new v();
488
+ }, pe = class {
489
+ store = new y();
490
490
  get(e) {
491
491
  return this.store.get(e);
492
492
  }
@@ -499,7 +499,7 @@ var le = j({ onProgress: (e, t) => {
499
499
  clear() {
500
500
  this.store.clear();
501
501
  }
502
- }, L = class {
502
+ }, P = class {
503
503
  maxAttempts;
504
504
  baseDelayMs;
505
505
  constructor(e = 3, t = 100) {
@@ -513,7 +513,7 @@ var le = j({ onProgress: (e, t) => {
513
513
  let t = this.baseDelayMs * 2 ** (e - 1), n = Math.random() * t * .1;
514
514
  return Math.min(t + n, 3e4);
515
515
  }
516
- }, R = class {
516
+ }, F = class {
517
517
  running = 0;
518
518
  queue = [];
519
519
  maxConcurrent;
@@ -543,7 +543,7 @@ var le = j({ onProgress: (e, t) => {
543
543
  return this.running;
544
544
  }
545
545
  };
546
- function z(e) {
546
+ function I(e) {
547
547
  return e == null ? {
548
548
  serialized: void 0,
549
549
  contentType: null
@@ -567,14 +567,14 @@ function z(e) {
567
567
  contentType: "application/json"
568
568
  };
569
569
  }
570
- function B(e, t) {
570
+ function L(e, t) {
571
571
  return t ? e.replace(/:([a-zA-Z_][a-zA-Z0-9_]*)/g, (e, n) => {
572
572
  let r = t[n];
573
573
  if (r === void 0) throw Error(`Missing path parameter: :${n}`);
574
574
  return encodeURIComponent(String(r));
575
575
  }) : e;
576
576
  }
577
- var V = class n {
577
+ var R = class n {
578
578
  requestInterceptors = [];
579
579
  responseInterceptors = [];
580
580
  cache;
@@ -588,12 +588,12 @@ var V = class n {
588
588
  defaultHeaders: e.defaultHeaders ?? { "Content-Type": "application/json" },
589
589
  defaultTimeout: e.defaultTimeout ?? 3e4,
590
590
  validateStatus: e.validateStatus ?? ((e) => e >= 200 && e < 300),
591
- cacheStrategy: e.cacheStrategy ?? new I(),
591
+ cacheStrategy: e.cacheStrategy ?? new pe(),
592
592
  maxConcurrent: e.maxConcurrent ?? 0,
593
593
  defaultResponseType: e.defaultResponseType ?? "auto",
594
594
  defaultHooks: e.defaultHooks ?? {},
595
595
  adapter: e.adapter
596
- }, this.cache = this.config.cacheStrategy, this.requestQueue = this.config.maxConcurrent > 0 ? new R(this.config.maxConcurrent) : null, this.devTracker = e.devTracker ?? null;
596
+ }, this.cache = this.config.cacheStrategy, this.requestQueue = this.config.maxConcurrent > 0 ? new F(this.config.maxConcurrent) : null, this.devTracker = e.devTracker ?? null;
597
597
  }
598
598
  async request(n) {
599
599
  if (!this.requestInterceptors.length && !this.responseInterceptors.length && !n.cache?.enabled && !n.hooks && !Object.keys(this.config.defaultHooks).length && !n.retry && !n.validate && !n.transform && !this.requestQueue && !n.onDownloadProgress && !n.signal) return this.fastPath(n);
@@ -711,7 +711,7 @@ var V = class n {
711
711
  }
712
712
  }
713
713
  async fastPath(n) {
714
- let r = B(n.url, n.params), i = this.buildUrl(r, n.query), { serialized: a, contentType: o } = z(n.body), s = {
714
+ let r = L(n.url, n.params), i = this.buildUrl(r, n.query), { serialized: a, contentType: o } = I(n.body), s = {
715
715
  ...this.config.defaultHeaders,
716
716
  ...n.headers
717
717
  };
@@ -938,7 +938,7 @@ var V = class n {
938
938
  });
939
939
  }
940
940
  buildRequest(e) {
941
- let t = B(e.url, e.params);
941
+ let t = L(e.url, e.params);
942
942
  return {
943
943
  url: this.buildUrl(t, e.query),
944
944
  method: e.method ?? "GET",
@@ -963,11 +963,11 @@ var V = class n {
963
963
  return n;
964
964
  }
965
965
  getCacheKey(e) {
966
- let t = B(e.url, e.params), n = e.query ? JSON.stringify(e.query) : "";
966
+ let t = L(e.url, e.params), n = e.query ? JSON.stringify(e.query) : "";
967
967
  return `${e.method ?? "GET"}:${t}${n ? ":" + n : ""}`;
968
968
  }
969
969
  fetchWithTimeout(e, t, n) {
970
- let { serialized: r, contentType: i } = z(e.body), a = { ...e.headers };
970
+ let { serialized: r, contentType: i } = I(e.body), a = { ...e.headers };
971
971
  return i ? a["Content-Type"] = i : r instanceof FormData && delete a["Content-Type"], new Promise((i, o) => {
972
972
  let s = setTimeout(() => {
973
973
  n.abort(), o(new DOMException("Request timed out", "TimeoutError"));
@@ -1072,7 +1072,7 @@ var V = class n {
1072
1072
  return e ? "maxAttempts" in e ? e.maxAttempts ?? 1 : 100 : 1;
1073
1073
  }
1074
1074
  getRetryStrategy(e) {
1075
- return e ? "shouldRetry" in e ? e : new L(e.maxAttempts, e.backoffMs) : {
1075
+ return e ? "shouldRetry" in e ? e : new P(e.maxAttempts, e.backoffMs) : {
1076
1076
  shouldRetry: () => !1,
1077
1077
  delayMs: () => 0
1078
1078
  };
@@ -1086,7 +1086,7 @@ var V = class n {
1086
1086
  trackDev(e) {
1087
1087
  this.devTracker && this.devTracker.track(e);
1088
1088
  }
1089
- }, H = class extends Error {
1089
+ }, z = class extends Error {
1090
1090
  status;
1091
1091
  code;
1092
1092
  response;
@@ -1094,18 +1094,18 @@ var V = class n {
1094
1094
  super(e), this.name = "HttpError", this.status = t, this.code = n, this.response = r;
1095
1095
  }
1096
1096
  };
1097
- function U(e) {
1098
- return e instanceof H;
1097
+ function B(e) {
1098
+ return e instanceof z;
1099
1099
  }
1100
- function de(e) {
1101
- return new V(e);
1100
+ function me(e) {
1101
+ return new R(e);
1102
1102
  }
1103
1103
  //#endregion
1104
1104
  //#region src/realtime/websocket-client.ts
1105
- function W() {
1105
+ function V() {
1106
1106
  return typeof window > "u" && typeof process < "u" && process.versions?.node !== void 0;
1107
1107
  }
1108
- var fe = class {
1108
+ var he = class {
1109
1109
  url;
1110
1110
  options;
1111
1111
  pluginManager;
@@ -1127,7 +1127,7 @@ var fe = class {
1127
1127
  message: /* @__PURE__ */ new Set()
1128
1128
  };
1129
1129
  constructor(e, t = {}) {
1130
- this.url = e, this.options = t, this.pluginManager = new M();
1130
+ this.url = e, this.options = t, this.pluginManager = new N();
1131
1131
  }
1132
1132
  updateStatus(e) {
1133
1133
  this.status = e, e === "open" ? this.connectionStartTime = Date.now() : e === "closed" && this.connectionStartTime > 0 && (this.stats.connectionTime += Date.now() - this.connectionStartTime, this.connectionStartTime = 0);
@@ -1204,7 +1204,7 @@ var fe = class {
1204
1204
  cleanup() {
1205
1205
  this.reconnectTimer &&= (clearTimeout(this.reconnectTimer), null), this.stopHeartbeat();
1206
1206
  }
1207
- }, G = class extends fe {
1207
+ }, H = class extends he {
1208
1208
  socket = null;
1209
1209
  messageTypeListeners = /* @__PURE__ */ new Map();
1210
1210
  constructor(e, t = {}) {
@@ -1263,9 +1263,9 @@ var fe = class {
1263
1263
  }
1264
1264
  return e;
1265
1265
  }
1266
- }, pe = class extends G {
1266
+ }, ge = class extends H {
1267
1267
  async connect() {
1268
- if (W()) try {
1268
+ if (V()) try {
1269
1269
  let { default: e } = await import("ws");
1270
1270
  return super.connect();
1271
1271
  } catch {
@@ -1274,15 +1274,15 @@ var fe = class {
1274
1274
  return super.connect();
1275
1275
  }
1276
1276
  };
1277
- function me(e, t = {}) {
1278
- return W() ? new pe(e, t) : new G(e, t);
1277
+ function _e(e, t = {}) {
1278
+ return V() ? new ge(e, t) : new H(e, t);
1279
1279
  }
1280
1280
  //#endregion
1281
1281
  //#region src/realtime/sse-client.ts
1282
- function K() {
1282
+ function U() {
1283
1283
  return typeof window > "u" && typeof process < "u" && process.versions?.node !== void 0;
1284
1284
  }
1285
- var q = class {
1285
+ var W = class {
1286
1286
  url;
1287
1287
  options;
1288
1288
  _source = null;
@@ -1306,7 +1306,7 @@ var q = class {
1306
1306
  };
1307
1307
  _lastEventId = null;
1308
1308
  constructor(e, t = {}) {
1309
- this.url = e, this.options = t, this.pluginManager = new M();
1309
+ this.url = e, this.options = t, this.pluginManager = new N();
1310
1310
  }
1311
1311
  updateStatus(e) {
1312
1312
  this.status = e, e === "open" ? this.connectionStartTime = Date.now() : e === "closed" && this.connectionStartTime > 0 && (this.stats.connectionTime += Date.now() - this.connectionStartTime, this.connectionStartTime = 0);
@@ -1427,18 +1427,18 @@ var q = class {
1427
1427
  return e;
1428
1428
  }
1429
1429
  }
1430
- }, he = class extends q {
1430
+ }, ve = class extends W {
1431
1431
  async connect() {
1432
- if (K()) throw Error("SSE client for Node.js requires a polyfill or custom implementation. Consider using a library like \"eventsource\" or implement using fetch with streaming.");
1432
+ if (U()) throw Error("SSE client for Node.js requires a polyfill or custom implementation. Consider using a library like \"eventsource\" or implement using fetch with streaming.");
1433
1433
  return super.connect();
1434
1434
  }
1435
1435
  };
1436
- function ge(e, t = {}) {
1437
- return K() ? new he(e, t) : new q(e, t);
1436
+ function ye(e, t = {}) {
1437
+ return U() ? new ve(e, t) : new W(e, t);
1438
1438
  }
1439
1439
  //#endregion
1440
1440
  //#region src/realtime/plugin.ts
1441
- var _e = class {
1441
+ var be = class {
1442
1442
  name = "realtime";
1443
1443
  setup(e) {
1444
1444
  e.on("websocket:connect:start", (...t) => {
@@ -1462,12 +1462,28 @@ var _e = class {
1462
1462
  });
1463
1463
  }
1464
1464
  };
1465
- function ve() {
1466
- return new _e();
1465
+ function xe() {
1466
+ return new be();
1467
1467
  }
1468
1468
  //#endregion
1469
1469
  //#region src/dev-overlay/tracker.ts
1470
- var J = class {
1470
+ var G = "nexa.devOverlay.config";
1471
+ function K() {
1472
+ try {
1473
+ if (typeof localStorage > "u") return {};
1474
+ let e = localStorage.getItem(G);
1475
+ return e ? JSON.parse(e) : {};
1476
+ } catch {
1477
+ return {};
1478
+ }
1479
+ }
1480
+ function Se(e) {
1481
+ try {
1482
+ if (typeof localStorage > "u") return;
1483
+ localStorage.setItem(G, JSON.stringify(e));
1484
+ } catch {}
1485
+ }
1486
+ var q = class {
1471
1487
  history = [];
1472
1488
  maxHistory;
1473
1489
  listeners = /* @__PURE__ */ new Set();
@@ -1479,7 +1495,11 @@ var J = class {
1479
1495
  maxHistory: this.maxHistory,
1480
1496
  keyboardShortcut: e.keyboardShortcut ?? "ctrl+shift+n",
1481
1497
  position: e.position ?? "bottom-right",
1482
- theme: e.theme ?? "dark"
1498
+ theme: e.theme ?? "dark",
1499
+ devOnly: e.devOnly ?? !0,
1500
+ floatingButtonSize: e.floatingButtonSize ?? 48,
1501
+ floatingButtonOffset: e.floatingButtonOffset ?? 24,
1502
+ floatingButtonTheme: e.floatingButtonTheme ?? "inherit"
1483
1503
  };
1484
1504
  }
1485
1505
  track(e) {
@@ -1518,10 +1538,21 @@ var J = class {
1518
1538
  getConfig() {
1519
1539
  return this.config;
1520
1540
  }
1541
+ updateConfig(e) {
1542
+ this.config = {
1543
+ ...this.config,
1544
+ ...e
1545
+ }, this.maxHistory = this.config.maxHistory;
1546
+ try {
1547
+ Se(this.config);
1548
+ } catch {}
1549
+ return this.config;
1550
+ }
1521
1551
  generateId() {
1522
1552
  return `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
1523
1553
  }
1524
- }, Y = {
1554
+ }, J = {
1555
+ gear: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 48 48\" fill=\"currentColor\" xmlns=\"http://www.w3.org/2000/svg\">\n<path d=\"M 24 4 C 22.423103 4 20.902664 4.1994284 19.451172 4.5371094 A 1.50015 1.50015 0 0 0 18.300781 5.8359375 L 17.982422 8.7382812 C 17.878304 9.6893592 17.328913 10.530853 16.5 11.009766 C 15.672739 11.487724 14.66862 11.540667 13.792969 11.15625 L 13.791016 11.15625 L 11.125 9.9824219 A 1.50015 1.50015 0 0 0 9.4257812 10.330078 C 7.3532865 12.539588 5.7626807 15.215064 4.859375 18.201172 A 1.50015 1.50015 0 0 0 5.4082031 19.845703 L 7.7734375 21.580078 C 8.5457929 22.147918 9 23.042801 9 24 C 9 24.95771 8.5458041 25.853342 7.7734375 26.419922 L 5.4082031 28.152344 A 1.50015 1.50015 0 0 0 4.859375 29.796875 C 5.7625845 32.782665 7.3519262 35.460112 9.4257812 37.669922 A 1.50015 1.50015 0 0 0 11.125 38.015625 L 13.791016 36.841797 C 14.667094 36.456509 15.672169 36.511947 16.5 36.990234 C 17.328913 37.469147 17.878304 38.310641 17.982422 39.261719 L 18.300781 42.164062 A 1.50015 1.50015 0 0 0 19.449219 43.460938 C 20.901371 43.799844 22.423103 44 24 44 C 25.576897 44 27.097336 43.800572 28.548828 43.462891 A 1.50015 1.50015 0 0 0 29.699219 42.164062 L 30.017578 39.261719 C 30.121696 38.310641 30.671087 37.469147 31.5 36.990234 C 32.327261 36.512276 33.33138 36.45738 34.207031 36.841797 L 36.875 38.015625 A 1.50015 1.50015 0 0 0 38.574219 37.669922 C 40.646713 35.460412 42.237319 32.782983 43.140625 29.796875 A 1.50015 1.50015 0 0 0 42.591797 28.152344 L 40.226562 26.419922 C 39.454197 25.853342 39 24.95771 39 24 C 39 23.04229 39.454197 22.146658 40.226562 21.580078 L 42.591797 19.847656 A 1.50015 1.50015 0 0 0 43.140625 18.203125 C 42.237319 15.217017 40.646713 12.539588 38.574219 10.330078 A 1.50015 1.50015 0 0 0 36.875 9.984375 L 34.207031 11.158203 C 33.33138 11.54262 32.327261 11.487724 31.5 11.009766 C 30.671087 10.530853 30.121696 9.6893592 30.017578 8.7382812 L 29.699219 5.8359375 A 1.50015 1.50015 0 0 0 28.550781 4.5390625 C 27.098629 4.2001555 25.576897 4 24 4 z M 24 7 C 24.974302 7 25.90992 7.1748796 26.847656 7.3398438 L 27.035156 9.0644531 C 27.243038 10.963375 28.346913 12.652335 30 13.607422 C 31.654169 14.563134 33.668094 14.673009 35.416016 13.904297 L 37.001953 13.207031 C 38.219788 14.669402 39.183985 16.321182 39.857422 18.130859 L 38.451172 19.162109 C 36.911538 20.291529 36 22.08971 36 24 C 36 25.91029 36.911538 27.708471 38.451172 28.837891 L 39.857422 29.869141 C 39.183985 31.678818 38.219788 33.330598 37.001953 34.792969 L 35.416016 34.095703 C 33.668094 33.326991 31.654169 33.436866 30 34.392578 C 28.346913 35.347665 27.243038 37.036625 27.035156 38.935547 L 26.847656 40.660156 C 25.910002 40.82466 24.973817 41 24 41 C 23.025698 41 22.09008 40.82512 21.152344 40.660156 L 20.964844 38.935547 C 20.756962 37.036625 19.653087 35.347665 18 34.392578 C 16.345831 33.436866 14.331906 33.326991 12.583984 34.095703 L 10.998047 34.792969 C 9.7799772 33.330806 8.8159425 31.678964 8.1425781 29.869141 L 9.5488281 28.837891 C 11.088462 27.708471 12 25.91029 12 24 C 12 22.08971 11.087719 20.290363 9.5488281 19.160156 L 8.1425781 18.128906 C 8.8163325 16.318532 9.7814501 14.667839 11 13.205078 L 12.583984 13.902344 C 14.331906 14.671056 16.345831 14.563134 18 13.607422 C 19.653087 12.652335 20.756962 10.963375 20.964844 9.0644531 L 21.152344 7.3398438 C 22.089998 7.1753403 23.026183 7 24 7 z M 24 16 C 19.599487 16 16 19.59949 16 24 C 16 28.40051 19.599487 32 24 32 C 28.400513 32 32 28.40051 32 24 C 32 19.59949 28.400513 16 24 16 z M 24 19 C 26.779194 19 29 21.220808 29 24 C 29 26.779192 26.779194 29 24 29 C 21.220806 29 19 26.779192 19 24 C 19 21.220808 21.220806 19 24 19 z\"></path>\n</svg>",
1525
1556
  close: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6L6 18M6 6l12 12\"/></svg>",
1526
1557
  chevron: "<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 18l6-6-6-6\"/></svg>",
1527
1558
  back: "<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M19 12H5M12 19l-7-7 7-7\"/></svg>",
@@ -1530,35 +1561,40 @@ var J = class {
1530
1561
  search: "<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"M21 21l-4.35-4.35\"/></svg>",
1531
1562
  clock: "<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><circle cx=\"12\" cy=\"12\" r=\"10\"/><path d=\"M12 6v6l4 2\"/></svg>",
1532
1563
  zap: "<svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polygon points=\"13 2 3 14 12 14 11 22 21 10 12 10 13 2\"/></svg>"
1533
- }, X = {
1534
- bg: "#09090b",
1535
- bgElevated: "#18181b",
1536
- border: "#27272a",
1537
- borderFocus: "#3f3f46",
1538
- text: "#fafafa",
1539
- textMuted: "#a1a1aa",
1540
- textDim: "#71717a",
1541
- accent: "#3b82f6",
1542
- accentHover: "#2563eb",
1543
- success: "#22c55e",
1544
- successBg: "rgba(34, 197, 94, 0.1)",
1545
- error: "#ef4444",
1546
- errorBg: "rgba(239, 68, 68, 0.1)",
1547
- warning: "#f59e0b",
1548
- get: "#22c55e",
1549
- post: "#3b82f6",
1550
- put: "#f59e0b",
1551
- patch: "#a855f7",
1552
- delete: "#ef4444"
1553
- }, Z = `
1564
+ }, Y = {
1565
+ bg: "#0b1120",
1566
+ bgElevated: "#111827",
1567
+ bgSurface: "#172033",
1568
+ border: "#24324a",
1569
+ borderFocus: "#35507a",
1570
+ text: "#e5eefb",
1571
+ textMuted: "#b4c4dd",
1572
+ textDim: "#7f93b3",
1573
+ accent: "#38bdf8",
1574
+ accentHover: "#0ea5e9",
1575
+ accentSoft: "rgba(56, 189, 248, 0.18)",
1576
+ success: "#34d399",
1577
+ successBg: "rgba(52, 211, 153, 0.16)",
1578
+ error: "#fb7185",
1579
+ errorBg: "rgba(251, 113, 133, 0.16)",
1580
+ warning: "#fbbf24",
1581
+ warningBg: "rgba(251, 191, 36, 0.16)",
1582
+ info: "#a78bfa",
1583
+ infoBg: "rgba(167, 139, 250, 0.16)",
1584
+ get: "#34d399",
1585
+ post: "#38bdf8",
1586
+ put: "#fbbf24",
1587
+ patch: "#a78bfa",
1588
+ delete: "#fb7185"
1589
+ }, Ce = `
1554
1590
  #nexa-dev-overlay * { margin: 0; padding: 0; box-sizing: border-box; }
1555
1591
  #nexa-dev-overlay {
1556
1592
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
1557
- background: ${X.bg};
1558
- color: ${X.text};
1559
- border: 1px solid ${X.border};
1593
+ background: ${Y.bg};
1594
+ color: ${Y.text};
1595
+ border: 1px solid ${Y.border};
1560
1596
  border-radius: 16px;
1561
- box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.03);
1597
+ box-shadow: 0 28px 60px -24px rgba(2, 6, 23, 0.78), 0 0 0 1px rgba(148, 163, 184, 0.08);
1562
1598
  overflow: hidden;
1563
1599
  }
1564
1600
  #nexa-dev-overlay .nexa-header {
@@ -1566,8 +1602,8 @@ var J = class {
1566
1602
  align-items: center;
1567
1603
  justify-content: space-between;
1568
1604
  padding: 16px 20px;
1569
- border-bottom: 1px solid ${X.border};
1570
- background: ${X.bgElevated};
1605
+ border-bottom: 1px solid ${Y.border};
1606
+ background: ${Y.bgElevated};
1571
1607
  }
1572
1608
  #nexa-dev-overlay .nexa-header-left {
1573
1609
  display: flex;
@@ -1580,7 +1616,7 @@ var J = class {
1580
1616
  display: flex;
1581
1617
  align-items: center;
1582
1618
  justify-content: center;
1583
- background: ${X.bgElevated};
1619
+ background: linear-gradient(135deg, ${Y.accentSoft}, rgba(255,255,255,0.02));
1584
1620
  border-radius: 8px;
1585
1621
  overflow: hidden;
1586
1622
  }
@@ -1602,20 +1638,20 @@ var J = class {
1602
1638
  background: transparent;
1603
1639
  border: none;
1604
1640
  border-radius: 8px;
1605
- color: ${X.textMuted};
1641
+ color: ${Y.textMuted};
1606
1642
  cursor: pointer;
1607
1643
  transition: all 0.15s;
1608
1644
  }
1609
1645
  #nexa-dev-overlay .nexa-icon-btn:hover {
1610
- background: ${X.border};
1611
- color: ${X.text};
1646
+ background: ${Y.bgSurface};
1647
+ color: ${Y.text};
1612
1648
  }
1613
1649
  #nexa-dev-overlay .nexa-metrics-bar {
1614
1650
  display: flex;
1615
1651
  gap: 4px;
1616
1652
  padding: 12px 16px;
1617
- background: ${X.bg};
1618
- border-bottom: 1px solid ${X.border};
1653
+ background: ${Y.bg};
1654
+ border-bottom: 1px solid ${Y.border};
1619
1655
  }
1620
1656
  #nexa-dev-overlay .nexa-metric {
1621
1657
  flex: 1;
@@ -1624,30 +1660,30 @@ var J = class {
1624
1660
  align-items: center;
1625
1661
  gap: 2px;
1626
1662
  padding: 8px 12px;
1627
- background: ${X.bgElevated};
1663
+ background: ${Y.bgSurface};
1628
1664
  border-radius: 10px;
1629
1665
  transition: all 0.2s;
1630
1666
  }
1631
1667
  #nexa-dev-overlay .nexa-metric:hover {
1632
- background: ${X.border};
1668
+ background: rgba(53, 80, 122, 0.3);
1633
1669
  }
1634
1670
  #nexa-dev-overlay .nexa-metric-value {
1635
1671
  font-size: 18px;
1636
1672
  font-weight: 700;
1637
1673
  letter-spacing: -0.03em;
1638
- color: ${X.text};
1674
+ color: ${Y.text};
1639
1675
  }
1640
- #nexa-dev-overlay .nexa-metric-ok .nexa-metric-value { color: ${X.success}; }
1641
- #nexa-dev-overlay .nexa-metric-err .nexa-metric-value { color: ${X.error}; }
1676
+ #nexa-dev-overlay .nexa-metric-ok .nexa-metric-value { color: ${Y.success}; }
1677
+ #nexa-dev-overlay .nexa-metric-err .nexa-metric-value { color: ${Y.error}; }
1642
1678
  #nexa-dev-overlay .nexa-metric-label {
1643
1679
  font-size: 11px;
1644
- color: ${X.textDim};
1680
+ color: ${Y.textDim};
1645
1681
  text-transform: uppercase;
1646
1682
  letter-spacing: 0.05em;
1647
1683
  }
1648
1684
  #nexa-dev-overlay .nexa-search {
1649
1685
  padding: 12px 16px;
1650
- border-bottom: 1px solid ${X.border};
1686
+ border-bottom: 1px solid ${Y.border};
1651
1687
  position: relative;
1652
1688
  }
1653
1689
  #nexa-dev-overlay .nexa-search-icon {
@@ -1655,29 +1691,29 @@ var J = class {
1655
1691
  left: 28px;
1656
1692
  top: 50%;
1657
1693
  transform: translateY(-50%);
1658
- color: ${X.textDim};
1694
+ color: ${Y.textDim};
1659
1695
  }
1660
1696
  #nexa-dev-overlay .nexa-search-input {
1661
1697
  width: 100%;
1662
1698
  padding: 10px 12px 10px 38px;
1663
- background: ${X.bg};
1664
- border: 1px solid ${X.border};
1699
+ background: ${Y.bg};
1700
+ border: 1px solid ${Y.border};
1665
1701
  border-radius: 10px;
1666
- color: ${X.text};
1702
+ color: ${Y.text};
1667
1703
  font-size: 13px;
1668
1704
  outline: none;
1669
1705
  transition: all 0.15s;
1670
1706
  }
1671
1707
  #nexa-dev-overlay .nexa-search-input:focus {
1672
- border-color: ${X.accent};
1673
- box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
1708
+ border-color: ${Y.accent};
1709
+ box-shadow: 0 0 0 3px ${Y.accentSoft};
1674
1710
  }
1675
- #nexa-dev-overlay .nexa-search-input::placeholder { color: ${X.textDim}; }
1711
+ #nexa-dev-overlay .nexa-search-input::placeholder { color: ${Y.textDim}; }
1676
1712
  #nexa-dev-overlay .nexa-tabs {
1677
1713
  display: flex;
1678
1714
  gap: 4px;
1679
1715
  padding: 8px 16px;
1680
- border-bottom: 1px solid ${X.border};
1716
+ border-bottom: 1px solid ${Y.border};
1681
1717
  }
1682
1718
  #nexa-dev-overlay .nexa-tab {
1683
1719
  display: flex;
@@ -1687,18 +1723,18 @@ var J = class {
1687
1723
  background: transparent;
1688
1724
  border: none;
1689
1725
  border-radius: 8px;
1690
- color: ${X.textMuted};
1726
+ color: ${Y.textMuted};
1691
1727
  font-size: 13px;
1692
1728
  font-weight: 500;
1693
1729
  cursor: pointer;
1694
1730
  transition: all 0.15s;
1695
1731
  }
1696
- #nexa-dev-overlay .nexa-tab:hover { color: ${X.text}; background: ${X.bgElevated}; }
1697
- #nexa-dev-overlay .nexa-tab-active { color: ${X.text}; background: ${X.accent} !important; }
1732
+ #nexa-dev-overlay .nexa-tab:hover { color: ${Y.text}; background: ${Y.bgElevated}; }
1733
+ #nexa-dev-overlay .nexa-tab-active { color: ${Y.text}; background: ${Y.accent} !important; }
1698
1734
  #nexa-dev-overlay .nexa-tab-count {
1699
1735
  font-size: 11px;
1700
1736
  padding: 2px 6px;
1701
- background: rgba(255,255,255,0.1);
1737
+ background: rgba(148, 163, 184, 0.14);
1702
1738
  border-radius: 10px;
1703
1739
  }
1704
1740
  #nexa-dev-overlay .nexa-body { flex: 1; overflow: hidden; display: flex; }
@@ -1715,7 +1751,7 @@ var J = class {
1715
1751
  align-items: center;
1716
1752
  justify-content: space-between;
1717
1753
  padding: 12px 14px;
1718
- background: ${X.bgElevated};
1754
+ background: ${Y.bgSurface};
1719
1755
  border: 1px solid transparent;
1720
1756
  border-radius: 12px;
1721
1757
  cursor: pointer;
@@ -1725,8 +1761,8 @@ var J = class {
1725
1761
  }
1726
1762
  @keyframes nexaFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
1727
1763
  #nexa-dev-overlay .nexa-request-item:hover {
1728
- background: ${X.border};
1729
- border-color: ${X.borderFocus};
1764
+ background: rgba(23, 32, 51, 0.92);
1765
+ border-color: ${Y.borderFocus};
1730
1766
  transform: translateX(2px);
1731
1767
  }
1732
1768
  #nexa-dev-overlay .nexa-req-left {
@@ -1742,11 +1778,11 @@ var J = class {
1742
1778
  text-transform: uppercase;
1743
1779
  letter-spacing: 0.03em;
1744
1780
  }
1745
- #nexa-dev-overlay .nexa-method-get { background: ${X.successBg}; color: ${X.get}; }
1746
- #nexa-dev-overlay .nexa-method-post { background: rgba(59, 130, 246, 0.15); color: ${X.post}; }
1747
- #nexa-dev-overlay .nexa-method-put { background: rgba(245, 158, 11, 0.15); color: ${X.put}; }
1748
- #nexa-dev-overlay .nexa-method-patch { background: rgba(168, 85, 247, 0.15); color: ${X.patch}; }
1749
- #nexa-dev-overlay .nexa-method-delete { background: ${X.errorBg}; color: ${X.delete}; }
1781
+ #nexa-dev-overlay .nexa-method-get { background: ${Y.successBg}; color: ${Y.get}; }
1782
+ #nexa-dev-overlay .nexa-method-post { background: ${Y.accentSoft}; color: ${Y.post}; }
1783
+ #nexa-dev-overlay .nexa-method-put { background: ${Y.warningBg}; color: ${Y.put}; }
1784
+ #nexa-dev-overlay .nexa-method-patch { background: ${Y.infoBg}; color: ${Y.patch}; }
1785
+ #nexa-dev-overlay .nexa-method-delete { background: ${Y.errorBg}; color: ${Y.delete}; }
1750
1786
  #nexa-dev-overlay .nexa-status {
1751
1787
  font-size: 12px;
1752
1788
  font-weight: 600;
@@ -1755,11 +1791,11 @@ var J = class {
1755
1791
  min-width: 36px;
1756
1792
  text-align: center;
1757
1793
  }
1758
- #nexa-dev-overlay .nexa-ok { background: ${X.successBg}; color: ${X.success}; }
1759
- #nexa-dev-overlay .nexa-err { background: ${X.errorBg}; color: ${X.error}; }
1794
+ #nexa-dev-overlay .nexa-ok { background: ${Y.successBg}; color: ${Y.success}; }
1795
+ #nexa-dev-overlay .nexa-err { background: ${Y.errorBg}; color: ${Y.error}; }
1760
1796
  #nexa-dev-overlay .nexa-url {
1761
1797
  font-size: 13px;
1762
- color: ${X.textMuted};
1798
+ color: ${Y.textMuted};
1763
1799
  max-width: 180px;
1764
1800
  overflow: hidden;
1765
1801
  text-overflow: ellipsis;
@@ -1778,15 +1814,15 @@ var J = class {
1778
1814
  text-transform: uppercase;
1779
1815
  letter-spacing: 0.03em;
1780
1816
  }
1781
- #nexa-dev-overlay .nexa-badge-cache { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
1782
- #nexa-dev-overlay .nexa-badge-retry { background: rgba(245, 158, 11, 0.15); color: ${X.warning}; }
1817
+ #nexa-dev-overlay .nexa-badge-cache { background: ${Y.infoBg}; color: ${Y.info}; }
1818
+ #nexa-dev-overlay .nexa-badge-retry { background: ${Y.warningBg}; color: ${Y.warning}; }
1783
1819
  #nexa-dev-overlay .nexa-duration {
1784
1820
  font-size: 12px;
1785
1821
  font-weight: 600;
1786
- color: ${X.textDim};
1822
+ color: ${Y.textDim};
1787
1823
  font-variant-numeric: tabular-nums;
1788
1824
  }
1789
- #nexa-dev-overlay .nexa-slow { color: ${X.warning}; }
1825
+ #nexa-dev-overlay .nexa-slow { color: ${Y.warning}; }
1790
1826
  #nexa-dev-overlay .nexa-empty {
1791
1827
  display: flex;
1792
1828
  flex-direction: column;
@@ -1794,11 +1830,11 @@ var J = class {
1794
1830
  justify-content: center;
1795
1831
  padding: 48px 24px;
1796
1832
  text-align: center;
1797
- color: ${X.textDim};
1833
+ color: ${Y.textDim};
1798
1834
  }
1799
1835
  #nexa-dev-overlay .nexa-empty svg { margin-bottom: 16px; opacity: 0.4; }
1800
- #nexa-dev-overlay .nexa-empty p { font-size: 14px; color: ${X.textMuted}; margin-bottom: 4px; }
1801
- #nexa-dev-overlay .nexa-empty span { font-size: 12px; color: ${X.textDim}; }
1836
+ #nexa-dev-overlay .nexa-empty p { font-size: 14px; color: ${Y.textMuted}; margin-bottom: 4px; }
1837
+ #nexa-dev-overlay .nexa-empty span { font-size: 12px; color: ${Y.textDim}; }
1802
1838
  #nexa-dev-overlay .nexa-detail {
1803
1839
  flex-direction: column;
1804
1840
  padding: 16px;
@@ -1818,21 +1854,21 @@ var J = class {
1818
1854
  align-items: center;
1819
1855
  gap: 6px;
1820
1856
  padding: 8px 14px;
1821
- background: ${X.bgElevated};
1822
- border: 1px solid ${X.border};
1857
+ background: ${Y.bgSurface};
1858
+ border: 1px solid ${Y.border};
1823
1859
  border-radius: 8px;
1824
- color: ${X.textMuted};
1860
+ color: ${Y.textMuted};
1825
1861
  font-size: 13px;
1826
1862
  font-weight: 500;
1827
1863
  cursor: pointer;
1828
1864
  transition: all 0.15s;
1829
1865
  }
1830
- #nexa-dev-overlay .nexa-btn:hover { background: ${X.border}; color: ${X.text}; }
1831
- #nexa-dev-overlay .nexa-btn-retry { background: ${X.successBg}; border-color: transparent; color: ${X.success}; }
1832
- #nexa-dev-overlay .nexa-btn-retry:hover { background: ${X.success}; color: white; }
1866
+ #nexa-dev-overlay .nexa-btn:hover { background: rgba(53, 80, 122, 0.24); color: ${Y.text}; }
1867
+ #nexa-dev-overlay .nexa-btn-retry { background: ${Y.successBg}; border-color: transparent; color: ${Y.success}; }
1868
+ #nexa-dev-overlay .nexa-btn-retry:hover { background: ${Y.success}; color: #052e26; }
1833
1869
  #nexa-dev-overlay .nexa-card {
1834
- background: ${X.bgElevated};
1835
- border: 1px solid ${X.border};
1870
+ background: ${Y.bgSurface};
1871
+ border: 1px solid ${Y.border};
1836
1872
  border-radius: 12px;
1837
1873
  padding: 16px;
1838
1874
  margin-bottom: 12px;
@@ -1840,7 +1876,7 @@ var J = class {
1840
1876
  #nexa-dev-overlay .nexa-card h3 {
1841
1877
  font-size: 12px;
1842
1878
  font-weight: 600;
1843
- color: ${X.textDim};
1879
+ color: ${Y.textDim};
1844
1880
  text-transform: uppercase;
1845
1881
  letter-spacing: 0.05em;
1846
1882
  margin-bottom: 12px;
@@ -1851,20 +1887,20 @@ var J = class {
1851
1887
  align-items: center;
1852
1888
  padding: 6px 0;
1853
1889
  font-size: 13px;
1854
- border-bottom: 1px solid ${X.border};
1890
+ border-bottom: 1px solid ${Y.border};
1855
1891
  }
1856
1892
  #nexa-dev-overlay .nexa-row:last-child { border-bottom: none; }
1857
- #nexa-dev-overlay .nexa-row span { color: ${X.textMuted}; }
1858
- #nexa-dev-overlay .nexa-row strong { color: ${X.text}; font-weight: 500; font-variant-numeric: tabular-nums; }
1859
- #nexa-dev-overlay .nexa-row .nexa-ok { color: ${X.success}; }
1860
- #nexa-dev-overlay .nexa-row .nexa-err { color: ${X.error}; }
1893
+ #nexa-dev-overlay .nexa-row span { color: ${Y.textMuted}; }
1894
+ #nexa-dev-overlay .nexa-row strong { color: ${Y.text}; font-weight: 500; font-variant-numeric: tabular-nums; }
1895
+ #nexa-dev-overlay .nexa-row .nexa-ok { color: ${Y.success}; }
1896
+ #nexa-dev-overlay .nexa-row .nexa-err { color: ${Y.error}; }
1861
1897
  #nexa-dev-overlay .nexa-code {
1862
- background: ${X.bg};
1898
+ background: ${Y.bg};
1863
1899
  border-radius: 8px;
1864
1900
  padding: 12px;
1865
1901
  font-size: 11px;
1866
1902
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
1867
- color: ${X.textMuted};
1903
+ color: ${Y.textMuted};
1868
1904
  overflow-x: auto;
1869
1905
  white-space: pre;
1870
1906
  max-height: 200px;
@@ -1873,7 +1909,7 @@ var J = class {
1873
1909
  #nexa-dev-overlay .nexa-url-full {
1874
1910
  font-size: 12px;
1875
1911
  word-break: break-all;
1876
- color: ${X.accent};
1912
+ color: ${Y.accent};
1877
1913
  }
1878
1914
  #nexa-dev-overlay .nexa-metrics-content {
1879
1915
  padding: 16px;
@@ -1881,13 +1917,130 @@ var J = class {
1881
1917
  flex-direction: column;
1882
1918
  gap: 12px;
1883
1919
  }
1920
+ /* Settings modal (overlays the content area without shifting layout) */
1921
+ #nexa-dev-overlay .nexa-settings-panel {
1922
+ position: absolute;
1923
+ top: 72px;
1924
+ left: 16px;
1925
+ right: 16px;
1926
+ bottom: 16px;
1927
+ z-index: 2147483650;
1928
+ display: none;
1929
+ flex-direction: column;
1930
+ gap: 12px;
1931
+ padding: 16px;
1932
+ border-radius: 12px;
1933
+ background: ${Y.bgElevated};
1934
+ border: 1px solid ${Y.border};
1935
+ box-shadow: 0 28px 60px -24px rgba(2, 6, 23, 0.76);
1936
+ overflow: auto;
1937
+ }
1938
+ #nexa-dev-overlay .nexa-settings-row { display:flex;align-items:center;gap:8px;margin-bottom:8px }
1939
+ #nexa-dev-overlay .nexa-settings-row label{font-size:13px;color:${Y.textDim};min-width:70px}
1940
+ #nexa-dev-overlay .nexa-settings-row select{padding:6px 8px;border-radius:8px;border:1px solid ${Y.border};background:${Y.bg};color:${Y.text}}
1941
+
1942
+ #nexa-dev-overlay.nexa-theme-light {
1943
+ background: #f8fbff;
1944
+ color: #0f172a;
1945
+ border-color: #d8e4f2;
1946
+ box-shadow: 0 28px 60px -24px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(148, 163, 184, 0.16);
1947
+ }
1948
+ #nexa-dev-overlay.nexa-theme-light .nexa-header,
1949
+ #nexa-dev-overlay.nexa-theme-light .nexa-metrics-bar,
1950
+ #nexa-dev-overlay.nexa-theme-light .nexa-search,
1951
+ #nexa-dev-overlay.nexa-theme-light .nexa-tabs {
1952
+ background: #f8fbff;
1953
+ border-color: #d8e4f2;
1954
+ }
1955
+ #nexa-dev-overlay.nexa-theme-light .nexa-logo,
1956
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric,
1957
+ #nexa-dev-overlay.nexa-theme-light .nexa-request-item,
1958
+ #nexa-dev-overlay.nexa-theme-light .nexa-btn,
1959
+ #nexa-dev-overlay.nexa-theme-light .nexa-card,
1960
+ #nexa-dev-overlay.nexa-theme-light .nexa-settings-panel {
1961
+ background: #ffffff;
1962
+ border-color: #d8e4f2;
1963
+ }
1964
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric:hover,
1965
+ #nexa-dev-overlay.nexa-theme-light .nexa-icon-btn:hover,
1966
+ #nexa-dev-overlay.nexa-theme-light .nexa-btn:hover,
1967
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab:hover,
1968
+ #nexa-dev-overlay.nexa-theme-light .nexa-request-item:hover {
1969
+ background: #eef6ff;
1970
+ }
1971
+ #nexa-dev-overlay.nexa-theme-light .nexa-request-item:hover {
1972
+ border-color: #93c5fd;
1973
+ }
1974
+ #nexa-dev-overlay.nexa-theme-light .nexa-search-icon,
1975
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric-label,
1976
+ #nexa-dev-overlay.nexa-theme-light .nexa-duration,
1977
+ #nexa-dev-overlay.nexa-theme-light .nexa-empty,
1978
+ #nexa-dev-overlay.nexa-theme-light .nexa-empty span,
1979
+ #nexa-dev-overlay.nexa-theme-light .nexa-row span,
1980
+ #nexa-dev-overlay.nexa-theme-light .nexa-settings-row label {
1981
+ color: #64748b;
1982
+ }
1983
+ #nexa-dev-overlay.nexa-theme-light .nexa-url,
1984
+ #nexa-dev-overlay.nexa-theme-light .nexa-empty p,
1985
+ #nexa-dev-overlay.nexa-theme-light .nexa-icon-btn,
1986
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab,
1987
+ #nexa-dev-overlay.nexa-theme-light .nexa-btn,
1988
+ #nexa-dev-overlay.nexa-theme-light .nexa-code {
1989
+ color: #334155;
1990
+ }
1991
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric-value,
1992
+ #nexa-dev-overlay.nexa-theme-light .nexa-title,
1993
+ #nexa-dev-overlay.nexa-theme-light .nexa-row strong {
1994
+ color: #0f172a;
1995
+ }
1996
+ #nexa-dev-overlay.nexa-theme-light .nexa-search-input,
1997
+ #nexa-dev-overlay.nexa-theme-light .nexa-settings-row select,
1998
+ #nexa-dev-overlay.nexa-theme-light .nexa-code {
1999
+ background: #ffffff;
2000
+ color: #0f172a;
2001
+ border-color: #d8e4f2;
2002
+ }
2003
+ #nexa-dev-overlay.nexa-theme-light .nexa-search-input:focus {
2004
+ border-color: #38bdf8;
2005
+ box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
2006
+ }
2007
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab-active {
2008
+ color: #ffffff;
2009
+ background: #0ea5e9 !important;
2010
+ }
2011
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab-count {
2012
+ background: rgba(14, 165, 233, 0.12);
2013
+ color: #075985;
2014
+ }
2015
+ #nexa-dev-overlay.nexa-theme-light .nexa-code,
2016
+ #nexa-dev-overlay.nexa-theme-light .nexa-detail,
2017
+ #nexa-dev-overlay.nexa-theme-light .nexa-row {
2018
+ border-color: #d8e4f2;
2019
+ }
1884
2020
  #nexa-dev-overlay .nexa-slow-req {
1885
2021
  display: flex;
1886
2022
  align-items: center;
1887
2023
  gap: 8px;
1888
2024
  }
1889
- `, ye = class {
2025
+ `;
2026
+ function X() {
2027
+ try {
2028
+ if (typeof process < "u") {
2029
+ let e = process;
2030
+ if (e.env && typeof e.env.NODE_ENV == "string") return e.env.NODE_ENV === "development";
2031
+ }
2032
+ } catch {}
2033
+ try {
2034
+ if (typeof location < "u" && location.hostname) {
2035
+ let e = location.hostname;
2036
+ if (e === "localhost" || e === "127.0.0.1" || e === "0.0.0.0") return !0;
2037
+ }
2038
+ } catch {}
2039
+ return !1;
2040
+ }
2041
+ var we = class {
1890
2042
  panel = null;
2043
+ floatingIcon = null;
1891
2044
  tracker;
1892
2045
  visible = !1;
1893
2046
  selectedRequest = null;
@@ -1902,18 +2055,18 @@ var J = class {
1902
2055
  show() {
1903
2056
  this.panel && (this.panel.style.display = "flex", this.panel.style.opacity = "0", this.panel.style.transform = "scale(0.96) translateY(8px)", (typeof requestAnimationFrame == "function" ? requestAnimationFrame : (e) => setTimeout(e, 0))(() => {
1904
2057
  this.panel.style.transition = "all 0.25s cubic-bezier(0.16, 1, 0.3, 1)", this.panel.style.opacity = "1", this.panel.style.transform = "scale(1) translateY(0)";
1905
- }), this.visible = !0);
2058
+ }), this.visible = !0, this.hideFloatingIcon());
1906
2059
  }
1907
2060
  hide() {
1908
2061
  this.panel && (this.panel.style.transition = "all 0.15s ease-out", this.panel.style.opacity = "0", this.panel.style.transform = "scale(0.96) translateY(8px)", setTimeout(() => {
1909
2062
  this.panel && (this.panel.style.display = "none");
1910
- }, 150), this.visible = !1);
2063
+ }, 150), this.visible = !1, this.config.enabled && (!this.config.devOnly || X()) && this.showFloatingIcon());
1911
2064
  }
1912
2065
  toggle() {
1913
2066
  this.visible ? this.hide() : this.show();
1914
2067
  }
1915
2068
  destroy() {
1916
- this.keyboardShortcutHandler &&= (document.removeEventListener("keydown", this.keyboardShortcutHandler), null), this.globalKeyboardHandler &&= (document.removeEventListener("keydown", this.globalKeyboardHandler), null), this.removeTrackerListener?.(), this.removeTrackerListener = null, this.panel?.remove(), this.panel = null, this.visible = !1, this.selectedRequest = null;
2069
+ this.keyboardShortcutHandler &&= (document.removeEventListener("keydown", this.keyboardShortcutHandler), null), this.globalKeyboardHandler &&= (document.removeEventListener("keydown", this.globalKeyboardHandler), null), this.removeTrackerListener?.(), this.removeTrackerListener = null, this.panel?.remove(), this.panel = null, this.visible = !1, this.selectedRequest = null, this.floatingIcon &&= (this.floatingIcon.remove(), null);
1917
2070
  }
1918
2071
  setupKeyboardShortcut() {
1919
2072
  let e = this.config.keyboardShortcut.split("+"), t = new Set(e.map((e) => e.toLowerCase()));
@@ -1930,30 +2083,58 @@ var J = class {
1930
2083
  }
1931
2084
  createPanel() {
1932
2085
  if (!this.canUseDOM()) return;
2086
+ try {
2087
+ let e = document.getElementById("nexa-dev-overlay");
2088
+ e && e.remove();
2089
+ } catch {}
1933
2090
  this.panel = document.createElement("div"), this.panel.id = "nexa-dev-overlay";
1934
- let e = this.config.position, t = e.includes("bottom"), n = e.includes("right");
2091
+ let e = this.config.position, t = e.includes("bottom"), n = e.includes("right"), r = `${this.config.floatingButtonOffset ?? 24}px`;
1935
2092
  this.panel.style.cssText = `
1936
2093
  position: fixed;
1937
- ${t ? "bottom: 24px;" : "top: 24px;"}
1938
- ${n ? "right: 24px;" : "left: 24px;"}
2094
+ ${t ? `bottom: ${r};` : `top: ${r};`}
2095
+ ${n ? `right: ${r};` : `left: ${r};`}
1939
2096
  width: 420px;
1940
2097
  max-height: 70vh;
1941
- z-index: 2147483647;
2098
+ z-index: 2147483649;
1942
2099
  display: flex;
1943
2100
  flex-direction: column;
1944
2101
  overflow: hidden;
1945
- `, this.panel.innerHTML = `<style>${Z}</style>
2102
+ `, this.panel.innerHTML = `<style>${Ce}</style>
1946
2103
 
1947
2104
  <div class="nexa-header">
1948
- <div class="nexa-header-left">
2105
+ <div class="nexa-header-left">
1949
2106
  <div class="nexa-logo">
1950
- <span style="display:flex;align-items:center;justify-content:center;font-size:14px;font-weight:700;color:#fff;background:linear-gradient(135deg,#3b82f6,#238636);width:18px;height:18px;border-radius:4px;">N</span>
2107
+ <img src="https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png" alt="Nexa" style="width:100%;height:auto;object-fit:cover;border-radius:8px;display:block;" />
1951
2108
  </div>
1952
2109
  <span class="nexa-title">Nexa DevTools</span>
1953
2110
  </div>
1954
2111
  <div class="nexa-header-actions">
1955
- <button class="nexa-icon-btn nexa-btn-clear" title="Clear history">${Y.clear}</button>
1956
- <button class="nexa-icon-btn nexa-btn-close" title="Close (Esc)">${Y.close}</button>
2112
+ <button class="nexa-icon-btn nexa-btn-settings" title="Settings">${J.gear}</button>
2113
+ <button class="nexa-icon-btn nexa-btn-clear" title="Clear history">${J.clear}</button>
2114
+ <button class="nexa-icon-btn nexa-btn-close" title="Close (Esc)">${J.close}</button>
2115
+ </div>
2116
+ </div>
2117
+
2118
+ <div class="nexa-settings-panel" style="display:none">
2119
+ <div class="nexa-settings-row">
2120
+ <label for="nexa-pos">Position</label>
2121
+ <select id="nexa-pos" data-setting="position">
2122
+ <option value="top-right">Top Right</option>
2123
+ <option value="top-left">Top Left</option>
2124
+ <option value="bottom-right">Bottom Right</option>
2125
+ <option value="bottom-left">Bottom Left</option>
2126
+ </select>
2127
+ </div>
2128
+ <div class="nexa-settings-row">
2129
+ <label for="nexa-theme">Theme</label>
2130
+ <select id="nexa-theme" data-setting="theme">
2131
+ <option value="dark">Dark</option>
2132
+ <option value="light">Light</option>
2133
+ </select>
2134
+ </div>
2135
+ <div style="display:flex;gap:8px;margin-top:8px">
2136
+ <button class="nexa-btn nexa-btn-save">Save</button>
2137
+ <button class="nexa-btn nexa-btn-cancel">Cancel</button>
1957
2138
  </div>
1958
2139
  </div>
1959
2140
 
@@ -1966,7 +2147,7 @@ var J = class {
1966
2147
  </div>
1967
2148
 
1968
2149
  <div class="nexa-search">
1969
- <span class="nexa-search-icon">${Y.search}</span>
2150
+ <span class="nexa-search-icon">${J.search}</span>
1970
2151
  <input type="text" class="nexa-search-input" placeholder="Filter by URL, method, or status..." />
1971
2152
  </div>
1972
2153
 
@@ -1982,12 +2163,14 @@ var J = class {
1982
2163
 
1983
2164
  <div class="nexa-detail" style="display:none">
1984
2165
  <div class="nexa-detail-header">
1985
- <button class="nexa-btn nexa-btn-back">${Y.back} Back</button>
1986
- <button class="nexa-btn nexa-btn-retry">${Y.retry} Retry</button>
2166
+ <button class="nexa-btn nexa-btn-back">${J.back} Back</button>
2167
+ <button class="nexa-btn nexa-btn-retry">${J.retry} Retry</button>
1987
2168
  </div>
1988
2169
  <div class="nexa-detail-body"></div>
1989
2170
  </div>
1990
- `, document.body.appendChild(this.panel), this.bindEvents(), this.removeTrackerListener = this.tracker.onChange(() => this.render()), this.hide(), this.globalKeyboardHandler = (e) => {
2171
+ `, document.body.appendChild(this.panel), this.config.theme === "light" ? this.panel.classList.add("nexa-theme-light") : this.panel.classList.remove("nexa-theme-light"), this.bindEvents(), this.removeTrackerListener = this.tracker.onChange(() => this.render());
2172
+ let i = !this.config.devOnly || X();
2173
+ this.config.enabled && i && this.createFloatingIcon(), this.hide(), this.globalKeyboardHandler = (e) => {
1991
2174
  if (e.key === "Escape" && this.visible) {
1992
2175
  this.hide();
1993
2176
  return;
@@ -2008,6 +2191,21 @@ var J = class {
2008
2191
  e.addEventListener("click", () => {
2009
2192
  this.panel.querySelectorAll(".nexa-tab").forEach((e) => e.classList.remove("nexa-tab-active")), this.panel.querySelectorAll(".nexa-panel").forEach((e) => e.classList.remove("nexa-panel-active")), e.classList.add("nexa-tab-active"), this.panel.querySelector(`[data-panel="${e.dataset.tab}"]`)?.classList.add("nexa-panel-active"), e.dataset.tab === "metrics" && this.renderMetrics();
2010
2193
  });
2194
+ }), this.panel.querySelector(".nexa-btn-settings")?.addEventListener("click", () => {
2195
+ let e = this.panel.querySelector(".nexa-settings-panel");
2196
+ if (!e) return;
2197
+ let t = this.panel.querySelector("[data-setting=\"position\"]"), n = this.panel.querySelector("[data-setting=\"theme\"]"), r = e.style.display === "flex";
2198
+ e.style.display = r ? "none" : "flex", r || (this.hideFloatingIcon(), t && (t.value = this.config.position), n && (n.value = this.config.theme), t?.focus());
2199
+ }), this.panel.querySelector(".nexa-btn-save")?.addEventListener("click", () => {
2200
+ let e = this.panel.querySelector("[data-setting=\"position\"]"), t = this.panel.querySelector("[data-setting=\"theme\"]"), n = e?.value, r = t?.value, i = {};
2201
+ n !== void 0 && (i.position = n), r !== void 0 && (i.theme = r);
2202
+ let a = this.tracker.updateConfig(i);
2203
+ this.applyConfigToUI(a);
2204
+ let o = this.panel.querySelector(".nexa-settings-panel");
2205
+ o && (o.style.display = "none");
2206
+ }), this.panel.querySelector(".nexa-btn-cancel")?.addEventListener("click", () => {
2207
+ let e = this.panel.querySelector(".nexa-settings-panel");
2208
+ e && (e.style.display = "none");
2011
2209
  }));
2012
2210
  }
2013
2211
  render() {
@@ -2043,7 +2241,7 @@ var J = class {
2043
2241
  ${e.cached ? "<span class=\"nexa-badge nexa-badge-cache\">Cache</span>" : ""}
2044
2242
  ${e.retryCount > 0 ? `<span class="nexa-badge nexa-badge-retry">${e.retryCount}R</span>` : ""}
2045
2243
  <span class="nexa-duration ${e.duration > 500 ? "nexa-slow" : ""}">${e.duration.toFixed(0)}ms</span>
2046
- ${Y.chevron}
2244
+ ${J.chevron}
2047
2245
  </div>
2048
2246
  </div>
2049
2247
  `).join(""), e.querySelectorAll(".nexa-request-item").forEach((e) => {
@@ -2091,7 +2289,7 @@ var J = class {
2091
2289
  !t || !n || !r || (t.style.display = "none", n.style.display = "flex", r.innerHTML = `
2092
2290
  <div class="nexa-card">
2093
2291
  <h3>Request</h3>
2094
- <div class="nexa-row"><span>Method</span><strong style="color:${e.method === "GET" ? X.get : e.method === "POST" ? X.post : e.method === "DELETE" ? X.delete : X.warning}">${e.method}</strong></div>
2292
+ <div class="nexa-row"><span>Method</span><strong style="color:${e.method === "GET" ? Y.get : e.method === "POST" ? Y.post : e.method === "DELETE" ? Y.delete : Y.warning}">${e.method}</strong></div>
2095
2293
  <div class="nexa-row"><span>URL</span><span class="nexa-url-full">${e.url}</span></div>
2096
2294
  <div class="nexa-row"><span>Status</span><strong class="${e.ok ? "nexa-ok" : "nexa-err"}">${e.status || "N/A"}</strong></div>
2097
2295
  <div class="nexa-row"><span>Duration</span><strong>${e.duration.toFixed(1)}ms</strong></div>
@@ -2151,26 +2349,103 @@ var J = class {
2151
2349
  canUseDOM() {
2152
2350
  return typeof document < "u" && typeof document.createElement == "function" && !!document.body;
2153
2351
  }
2154
- }, Q = null, $ = null;
2155
- function be(e = {}) {
2156
- return Q ? {
2157
- tracker: $,
2158
- ui: Q
2159
- } : ($ = new J(e), Q = new ye($), Q.show(), {
2160
- tracker: $,
2161
- ui: Q
2162
- });
2352
+ createFloatingIcon() {
2353
+ if (!this.canUseDOM()) return;
2354
+ try {
2355
+ let e = document.getElementById("nexa-dev-overlay-floating");
2356
+ e && e.remove();
2357
+ } catch {}
2358
+ this.floatingIcon &&= (this.floatingIcon.remove(), null);
2359
+ let e = document.createElement("button");
2360
+ e.id = "nexa-dev-overlay-floating", e.title = "Toggle Nexa DevTools";
2361
+ let t = this.config.floatingButtonSize ?? 48, n = this.config.floatingButtonOffset ?? 24, r = this.config.position || "bottom-right", i = r.includes("bottom"), a = r.includes("right"), o = `${i ? `bottom: ${n}px;` : `top: ${n}px;`} ${a ? `right: ${n}px;` : `left: ${n}px;`}`, s = this.config.floatingButtonTheme === "inherit" ? this.config.theme : this.config.floatingButtonTheme, c = "linear-gradient(135deg,#0ea5e9,#8b5cf6)", l = "#ffffff", u = "0 16px 36px rgba(2,6,23,0.34)", d = "none";
2362
+ s === "light" && (c = "linear-gradient(135deg,#f8fbff,#e0f2fe)", l = "#0f172a", u = "0 14px 30px rgba(15,23,42,0.16)", d = "1px solid #d8e4f2"), e.style.cssText = `
2363
+ position: fixed;
2364
+ ${o}
2365
+ width: ${t}px;
2366
+ height: ${t}px;
2367
+ border-radius: 50%;
2368
+ border: ${d};
2369
+ display: flex;
2370
+ align-items: center;
2371
+ justify-content: center;
2372
+ z-index: 2147483648;
2373
+ cursor: pointer;
2374
+ box-shadow: ${u};
2375
+ background: ${c};
2376
+ color: ${l};
2377
+ font-weight: 700;
2378
+ font-size: ${Math.max(12, Math.floor(t / 3))}px;
2379
+ `, e.innerHTML = `<img src="https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png" alt="Nexa" style="width:${t - 10}px;height:auto;object-fit:cover;border-radius:999px;display:block;" />`, e.addEventListener("click", (e) => {
2380
+ e.stopPropagation(), this.toggle();
2381
+ }), e.addEventListener("mousedown", (e) => e.preventDefault()), document.body.appendChild(e), e.style.display = this.visible ? "none" : "flex", this.floatingIcon = e;
2382
+ }
2383
+ showFloatingIcon() {
2384
+ if (!this.floatingIcon) {
2385
+ this.config.enabled && this.createFloatingIcon();
2386
+ return;
2387
+ }
2388
+ this.floatingIcon.style.display = "flex";
2389
+ }
2390
+ hideFloatingIcon() {
2391
+ this.floatingIcon && (this.floatingIcon.style.display = "none");
2392
+ }
2393
+ applyConfigToUI(e) {
2394
+ this.config = e ?? this.tracker.getConfig();
2395
+ let t = this.config.position, n = t.includes("bottom"), r = t.includes("right"), i = `${this.config.floatingButtonOffset ?? 24}px`;
2396
+ this.panel && (this.panel.style.bottom = n ? i : "", this.panel.style.top = n ? "" : i, this.panel.style.right = r ? i : "", this.panel.style.left = r ? "" : i, this.config.theme === "light" ? this.panel.classList.add("nexa-theme-light") : this.panel.classList.remove("nexa-theme-light")), this.floatingIcon &&= (this.floatingIcon.remove(), null), this.config.enabled && (!this.config.devOnly || X()) && this.createFloatingIcon();
2397
+ }
2398
+ refreshConfig(e) {
2399
+ this.applyConfigToUI(e);
2400
+ }
2401
+ }, Z = null, Q = null, $ = {
2402
+ enabled: !0,
2403
+ maxHistory: 500,
2404
+ keyboardShortcut: "ctrl+shift+n",
2405
+ position: "bottom-right",
2406
+ theme: "dark",
2407
+ devOnly: !0,
2408
+ floatingButtonSize: 48,
2409
+ floatingButtonOffset: 24,
2410
+ floatingButtonTheme: "inherit"
2411
+ };
2412
+ function Te(e = {}) {
2413
+ if (Z && Q) {
2414
+ let t = K(), n = {
2415
+ ...$,
2416
+ ...e,
2417
+ ...t
2418
+ }, r = Q.updateConfig(n);
2419
+ try {
2420
+ Z.refreshConfig(r);
2421
+ } catch {}
2422
+ return {
2423
+ tracker: Q,
2424
+ ui: Z,
2425
+ config: r
2426
+ };
2427
+ }
2428
+ let t = K();
2429
+ return Q = new q({
2430
+ ...$,
2431
+ ...e,
2432
+ ...t
2433
+ }), Z = new we(Q), {
2434
+ tracker: Q,
2435
+ ui: Z,
2436
+ config: Q.getConfig()
2437
+ };
2163
2438
  }
2164
- function xe() {
2439
+ function Ee() {
2165
2440
  return {
2166
- tracker: $,
2167
- ui: Q
2441
+ tracker: Q,
2442
+ ui: Z
2168
2443
  };
2169
2444
  }
2170
- function Se() {
2171
- Q?.destroy(), Q = null, $ = null;
2445
+ function De() {
2446
+ Z?.destroy(), Z = null, Q = null;
2172
2447
  }
2173
2448
  //#endregion
2174
- export { d as AggressiveRetry, P as CachePlugin, v as CacheStore, p as CircuitBreakerRetry, f as ConservativeRetry, F as DedupePlugin, se as Defer, t as Err, V as HttpClient, H as HttpError, ue as LoggerPlugin, N as MetricsPlugin, ie as MiddlewarePipeline, e as Ok, M as PluginManager, x as RequestDeduplicator, J as RequestTracker, D as TypedObservable, b as cacheMiddleware, oe as createApiUrl, y as createCacheMiddleware, S as createDedupeMiddleware, be as createDevOverlay, de as createHttpClient, C as createPipeline, l as createProjectionTransformer, ve as createRealtimePlugin, r as createRequiredFieldsValidator, ge as createSSEClient, n as createSchemaValidator, j as createStreamingMiddleware, ae as createTypeGuard, E as createTypedApiClient, T as createTypedRequest, w as createTypedResponse, O as createUrl, me as createWebSocketClient, u as createWrapperTransformer, re as dedupeMiddleware, Se as destroyDevOverlay, xe as getDevOverlay, k as handleStream, U as isHttpError, _ as retry, ce as streamToFile, le as streamingMiddleware, s as transformCamelToSnake, c as transformFlatten, o as transformSnakeToCamel, i as validatorIsArray, a as validatorIsObject, ne as withTimeout };
2449
+ export { d as AggressiveRetry, de as CachePlugin, y as CacheStore, p as CircuitBreakerRetry, f as ConservativeRetry, fe as DedupePlugin, oe as Defer, t as Err, R as HttpClient, z as HttpError, le as LoggerPlugin, ue as MetricsPlugin, re as MiddlewarePipeline, e as Ok, N as PluginManager, S as RequestDeduplicator, q as RequestTracker, E as TypedObservable, x as cacheMiddleware, k as createApiUrl, b as createCacheMiddleware, C as createDedupeMiddleware, Te as createDevOverlay, me as createHttpClient, w as createPipeline, l as createProjectionTransformer, xe as createRealtimePlugin, r as createRequiredFieldsValidator, ye as createSSEClient, n as createSchemaValidator, M as createStreamingMiddleware, D as createTypeGuard, ae as createTypedApiClient, T as createTypedRequest, ie as createTypedResponse, O as createUrl, _e as createWebSocketClient, u as createWrapperTransformer, ne as dedupeMiddleware, De as destroyDevOverlay, Ee as getDevOverlay, A as handleStream, B as isHttpError, v as retry, se as streamToFile, ce as streamingMiddleware, s as transformCamelToSnake, c as transformFlatten, o as transformSnakeToCamel, i as validatorIsArray, a as validatorIsObject, te as withTimeout };
2175
2450
 
2176
2451
  //# sourceMappingURL=nexa.es.js.map