@bereasoftware/nexa 1.4.1 → 1.6.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.6.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,13 @@ 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",
1503
+ branding: e.branding ?? "Nexa DevTools",
1504
+ icon: e.icon ?? "https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png"
1483
1505
  };
1484
1506
  }
1485
1507
  track(e) {
@@ -1518,10 +1540,21 @@ var J = class {
1518
1540
  getConfig() {
1519
1541
  return this.config;
1520
1542
  }
1543
+ updateConfig(e) {
1544
+ this.config = {
1545
+ ...this.config,
1546
+ ...e
1547
+ }, this.maxHistory = this.config.maxHistory;
1548
+ try {
1549
+ Se(this.config);
1550
+ } catch {}
1551
+ return this.config;
1552
+ }
1521
1553
  generateId() {
1522
1554
  return `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
1523
1555
  }
1524
- }, Y = {
1556
+ }, J = {
1557
+ 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
1558
  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
1559
  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
1560
  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>",
@@ -1529,36 +1562,43 @@ var J = class {
1529
1562
  clear: "<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=\"M3 6h18M19 6v14a2 2 0 01-2 2H7a2 2 0 01-2-2V6m3 0V4a2 2 0 012-2h4a2 2 0 012 2v2\"/></svg>",
1530
1563
  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
1564
  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
- 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 = `
1565
+ 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>",
1566
+ download: "<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=\"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v4\"/><polyline points=\"7 10 12 15 17 10\"/><line x1=\"12\" y1=\"15\" x2=\"12\" y2=\"3\"/></svg>",
1567
+ copy: "<svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1\"/></svg>"
1568
+ }, Y = {
1569
+ bg: "#0b1120",
1570
+ bgElevated: "#111827",
1571
+ bgSurface: "#172033",
1572
+ border: "#24324a",
1573
+ borderFocus: "#35507a",
1574
+ text: "#e5eefb",
1575
+ textMuted: "#b4c4dd",
1576
+ textDim: "#7f93b3",
1577
+ accent: "#38bdf8",
1578
+ accentHover: "#0ea5e9",
1579
+ accentSoft: "rgba(56, 189, 248, 0.18)",
1580
+ success: "#34d399",
1581
+ successBg: "rgba(52, 211, 153, 0.16)",
1582
+ error: "#fb7185",
1583
+ errorBg: "rgba(251, 113, 133, 0.16)",
1584
+ warning: "#fbbf24",
1585
+ warningBg: "rgba(251, 191, 36, 0.16)",
1586
+ info: "#a78bfa",
1587
+ infoBg: "rgba(167, 139, 250, 0.16)",
1588
+ get: "#34d399",
1589
+ post: "#38bdf8",
1590
+ put: "#fbbf24",
1591
+ patch: "#a78bfa",
1592
+ delete: "#fb7185"
1593
+ }, Ce = `
1554
1594
  #nexa-dev-overlay * { margin: 0; padding: 0; box-sizing: border-box; }
1555
1595
  #nexa-dev-overlay {
1556
1596
  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};
1597
+ background: ${Y.bg};
1598
+ color: ${Y.text};
1599
+ border: 1px solid ${Y.border};
1560
1600
  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);
1601
+ box-shadow: 0 28px 60px -24px rgba(2, 6, 23, 0.78), 0 0 0 1px rgba(148, 163, 184, 0.08);
1562
1602
  overflow: hidden;
1563
1603
  }
1564
1604
  #nexa-dev-overlay .nexa-header {
@@ -1566,8 +1606,8 @@ var J = class {
1566
1606
  align-items: center;
1567
1607
  justify-content: space-between;
1568
1608
  padding: 16px 20px;
1569
- border-bottom: 1px solid ${X.border};
1570
- background: ${X.bgElevated};
1609
+ border-bottom: 1px solid ${Y.border};
1610
+ background: ${Y.bgElevated};
1571
1611
  }
1572
1612
  #nexa-dev-overlay .nexa-header-left {
1573
1613
  display: flex;
@@ -1580,7 +1620,7 @@ var J = class {
1580
1620
  display: flex;
1581
1621
  align-items: center;
1582
1622
  justify-content: center;
1583
- background: ${X.bgElevated};
1623
+ background: linear-gradient(135deg, ${Y.accentSoft}, rgba(255,255,255,0.02));
1584
1624
  border-radius: 8px;
1585
1625
  overflow: hidden;
1586
1626
  }
@@ -1602,20 +1642,20 @@ var J = class {
1602
1642
  background: transparent;
1603
1643
  border: none;
1604
1644
  border-radius: 8px;
1605
- color: ${X.textMuted};
1645
+ color: ${Y.textMuted};
1606
1646
  cursor: pointer;
1607
1647
  transition: all 0.15s;
1608
1648
  }
1609
1649
  #nexa-dev-overlay .nexa-icon-btn:hover {
1610
- background: ${X.border};
1611
- color: ${X.text};
1650
+ background: ${Y.bgSurface};
1651
+ color: ${Y.text};
1612
1652
  }
1613
1653
  #nexa-dev-overlay .nexa-metrics-bar {
1614
1654
  display: flex;
1615
1655
  gap: 4px;
1616
1656
  padding: 12px 16px;
1617
- background: ${X.bg};
1618
- border-bottom: 1px solid ${X.border};
1657
+ background: ${Y.bg};
1658
+ border-bottom: 1px solid ${Y.border};
1619
1659
  }
1620
1660
  #nexa-dev-overlay .nexa-metric {
1621
1661
  flex: 1;
@@ -1624,30 +1664,30 @@ var J = class {
1624
1664
  align-items: center;
1625
1665
  gap: 2px;
1626
1666
  padding: 8px 12px;
1627
- background: ${X.bgElevated};
1667
+ background: ${Y.bgSurface};
1628
1668
  border-radius: 10px;
1629
1669
  transition: all 0.2s;
1630
1670
  }
1631
1671
  #nexa-dev-overlay .nexa-metric:hover {
1632
- background: ${X.border};
1672
+ background: rgba(53, 80, 122, 0.3);
1633
1673
  }
1634
1674
  #nexa-dev-overlay .nexa-metric-value {
1635
1675
  font-size: 18px;
1636
1676
  font-weight: 700;
1637
1677
  letter-spacing: -0.03em;
1638
- color: ${X.text};
1678
+ color: ${Y.text};
1639
1679
  }
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}; }
1680
+ #nexa-dev-overlay .nexa-metric-ok .nexa-metric-value { color: ${Y.success}; }
1681
+ #nexa-dev-overlay .nexa-metric-err .nexa-metric-value { color: ${Y.error}; }
1642
1682
  #nexa-dev-overlay .nexa-metric-label {
1643
1683
  font-size: 11px;
1644
- color: ${X.textDim};
1684
+ color: ${Y.textDim};
1645
1685
  text-transform: uppercase;
1646
1686
  letter-spacing: 0.05em;
1647
1687
  }
1648
1688
  #nexa-dev-overlay .nexa-search {
1649
1689
  padding: 12px 16px;
1650
- border-bottom: 1px solid ${X.border};
1690
+ border-bottom: 1px solid ${Y.border};
1651
1691
  position: relative;
1652
1692
  }
1653
1693
  #nexa-dev-overlay .nexa-search-icon {
@@ -1655,29 +1695,57 @@ var J = class {
1655
1695
  left: 28px;
1656
1696
  top: 50%;
1657
1697
  transform: translateY(-50%);
1658
- color: ${X.textDim};
1698
+ color: ${Y.textDim};
1659
1699
  }
1660
1700
  #nexa-dev-overlay .nexa-search-input {
1661
1701
  width: 100%;
1662
1702
  padding: 10px 12px 10px 38px;
1663
- background: ${X.bg};
1664
- border: 1px solid ${X.border};
1703
+ background: ${Y.bg};
1704
+ border: 1px solid ${Y.border};
1665
1705
  border-radius: 10px;
1666
- color: ${X.text};
1706
+ color: ${Y.text};
1667
1707
  font-size: 13px;
1668
1708
  outline: none;
1669
1709
  transition: all 0.15s;
1670
1710
  }
1671
1711
  #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);
1712
+ border-color: ${Y.accent};
1713
+ box-shadow: 0 0 0 3px ${Y.accentSoft};
1714
+ }
1715
+ #nexa-dev-overlay .nexa-search-input::placeholder { color: ${Y.textDim}; }
1716
+ #nexa-dev-overlay .nexa-filters {
1717
+ display: flex;
1718
+ gap: 6px;
1719
+ padding: 12px 16px 12px 16px;
1720
+ border-bottom: 1px solid ${Y.border};
1721
+ overflow-x: auto;
1722
+ scrollbar-width: none;
1723
+ min-height: 50px;
1724
+ }
1725
+ #nexa-dev-overlay .nexa-filters::-webkit-scrollbar { display: none; }
1726
+ #nexa-dev-overlay .nexa-filter-chip {
1727
+ padding: 4px 10px;
1728
+ background: ${Y.bgSurface};
1729
+ border: 1px solid ${Y.border};
1730
+ border-radius: 20px;
1731
+ color: ${Y.textDim};
1732
+ font-size: 11px;
1733
+ font-weight: 600;
1734
+ white-space: nowrap;
1735
+ cursor: pointer;
1736
+ transition: all 0.15s;
1737
+ }
1738
+ #nexa-dev-overlay .nexa-filter-chip:hover { border-color: ${Y.borderFocus}; color: ${Y.textMuted}; }
1739
+ #nexa-dev-overlay .nexa-filter-chip-active {
1740
+ background: ${Y.accentSoft};
1741
+ border-color: ${Y.accent};
1742
+ color: ${Y.accent};
1674
1743
  }
1675
- #nexa-dev-overlay .nexa-search-input::placeholder { color: ${X.textDim}; }
1676
1744
  #nexa-dev-overlay .nexa-tabs {
1677
1745
  display: flex;
1678
1746
  gap: 4px;
1679
1747
  padding: 8px 16px;
1680
- border-bottom: 1px solid ${X.border};
1748
+ border-bottom: 1px solid ${Y.border};
1681
1749
  }
1682
1750
  #nexa-dev-overlay .nexa-tab {
1683
1751
  display: flex;
@@ -1687,18 +1755,18 @@ var J = class {
1687
1755
  background: transparent;
1688
1756
  border: none;
1689
1757
  border-radius: 8px;
1690
- color: ${X.textMuted};
1758
+ color: ${Y.textMuted};
1691
1759
  font-size: 13px;
1692
1760
  font-weight: 500;
1693
1761
  cursor: pointer;
1694
1762
  transition: all 0.15s;
1695
1763
  }
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; }
1764
+ #nexa-dev-overlay .nexa-tab:hover { color: ${Y.text}; background: ${Y.bgElevated}; }
1765
+ #nexa-dev-overlay .nexa-tab-active { color: ${Y.text}; background: ${Y.accent} !important; }
1698
1766
  #nexa-dev-overlay .nexa-tab-count {
1699
1767
  font-size: 11px;
1700
1768
  padding: 2px 6px;
1701
- background: rgba(255,255,255,0.1);
1769
+ background: rgba(148, 163, 184, 0.14);
1702
1770
  border-radius: 10px;
1703
1771
  }
1704
1772
  #nexa-dev-overlay .nexa-body { flex: 1; overflow: hidden; display: flex; }
@@ -1715,7 +1783,7 @@ var J = class {
1715
1783
  align-items: center;
1716
1784
  justify-content: space-between;
1717
1785
  padding: 12px 14px;
1718
- background: ${X.bgElevated};
1786
+ background: ${Y.bgSurface};
1719
1787
  border: 1px solid transparent;
1720
1788
  border-radius: 12px;
1721
1789
  cursor: pointer;
@@ -1725,8 +1793,8 @@ var J = class {
1725
1793
  }
1726
1794
  @keyframes nexaFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
1727
1795
  #nexa-dev-overlay .nexa-request-item:hover {
1728
- background: ${X.border};
1729
- border-color: ${X.borderFocus};
1796
+ background: rgba(23, 32, 51, 0.92);
1797
+ border-color: ${Y.borderFocus};
1730
1798
  transform: translateX(2px);
1731
1799
  }
1732
1800
  #nexa-dev-overlay .nexa-req-left {
@@ -1742,11 +1810,11 @@ var J = class {
1742
1810
  text-transform: uppercase;
1743
1811
  letter-spacing: 0.03em;
1744
1812
  }
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}; }
1813
+ #nexa-dev-overlay .nexa-method-get { background: ${Y.successBg}; color: ${Y.get}; }
1814
+ #nexa-dev-overlay .nexa-method-post { background: ${Y.accentSoft}; color: ${Y.post}; }
1815
+ #nexa-dev-overlay .nexa-method-put { background: ${Y.warningBg}; color: ${Y.put}; }
1816
+ #nexa-dev-overlay .nexa-method-patch { background: ${Y.infoBg}; color: ${Y.patch}; }
1817
+ #nexa-dev-overlay .nexa-method-delete { background: ${Y.errorBg}; color: ${Y.delete}; }
1750
1818
  #nexa-dev-overlay .nexa-status {
1751
1819
  font-size: 12px;
1752
1820
  font-weight: 600;
@@ -1755,11 +1823,11 @@ var J = class {
1755
1823
  min-width: 36px;
1756
1824
  text-align: center;
1757
1825
  }
1758
- #nexa-dev-overlay .nexa-ok { background: ${X.successBg}; color: ${X.success}; }
1759
- #nexa-dev-overlay .nexa-err { background: ${X.errorBg}; color: ${X.error}; }
1826
+ #nexa-dev-overlay .nexa-ok { background: ${Y.successBg}; color: ${Y.success}; }
1827
+ #nexa-dev-overlay .nexa-err { background: ${Y.errorBg}; color: ${Y.error}; }
1760
1828
  #nexa-dev-overlay .nexa-url {
1761
1829
  font-size: 13px;
1762
- color: ${X.textMuted};
1830
+ color: ${Y.textMuted};
1763
1831
  max-width: 180px;
1764
1832
  overflow: hidden;
1765
1833
  text-overflow: ellipsis;
@@ -1778,15 +1846,15 @@ var J = class {
1778
1846
  text-transform: uppercase;
1779
1847
  letter-spacing: 0.03em;
1780
1848
  }
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}; }
1849
+ #nexa-dev-overlay .nexa-badge-cache { background: ${Y.infoBg}; color: ${Y.info}; }
1850
+ #nexa-dev-overlay .nexa-badge-retry { background: ${Y.warningBg}; color: ${Y.warning}; }
1783
1851
  #nexa-dev-overlay .nexa-duration {
1784
1852
  font-size: 12px;
1785
1853
  font-weight: 600;
1786
- color: ${X.textDim};
1854
+ color: ${Y.textDim};
1787
1855
  font-variant-numeric: tabular-nums;
1788
1856
  }
1789
- #nexa-dev-overlay .nexa-slow { color: ${X.warning}; }
1857
+ #nexa-dev-overlay .nexa-slow { color: ${Y.warning}; }
1790
1858
  #nexa-dev-overlay .nexa-empty {
1791
1859
  display: flex;
1792
1860
  flex-direction: column;
@@ -1794,11 +1862,11 @@ var J = class {
1794
1862
  justify-content: center;
1795
1863
  padding: 48px 24px;
1796
1864
  text-align: center;
1797
- color: ${X.textDim};
1865
+ color: ${Y.textDim};
1798
1866
  }
1799
1867
  #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}; }
1868
+ #nexa-dev-overlay .nexa-empty p { font-size: 14px; color: ${Y.textMuted}; margin-bottom: 4px; }
1869
+ #nexa-dev-overlay .nexa-empty span { font-size: 12px; color: ${Y.textDim}; }
1802
1870
  #nexa-dev-overlay .nexa-detail {
1803
1871
  flex-direction: column;
1804
1872
  padding: 16px;
@@ -1813,26 +1881,32 @@ var J = class {
1813
1881
  justify-content: space-between;
1814
1882
  margin-bottom: 16px;
1815
1883
  }
1884
+ #nexa-dev-overlay .nexa-btn-group {
1885
+ display: flex;
1886
+ gap: 8px;
1887
+ }
1816
1888
  #nexa-dev-overlay .nexa-btn {
1817
1889
  display: flex;
1818
1890
  align-items: center;
1819
1891
  gap: 6px;
1820
1892
  padding: 8px 14px;
1821
- background: ${X.bgElevated};
1822
- border: 1px solid ${X.border};
1893
+ background: ${Y.bgSurface};
1894
+ border: 1px solid ${Y.border};
1823
1895
  border-radius: 8px;
1824
- color: ${X.textMuted};
1896
+ color: ${Y.textMuted};
1825
1897
  font-size: 13px;
1826
1898
  font-weight: 500;
1827
1899
  cursor: pointer;
1828
1900
  transition: all 0.15s;
1829
1901
  }
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; }
1902
+ #nexa-dev-overlay .nexa-btn:hover { background: rgba(53, 80, 122, 0.24); color: ${Y.text}; }
1903
+ #nexa-dev-overlay .nexa-btn-retry { background: ${Y.successBg}; border-color: transparent; color: ${Y.success}; }
1904
+ #nexa-dev-overlay .nexa-btn-retry:hover { background: ${Y.success}; color: #052e26; }
1905
+ #nexa-dev-overlay .nexa-btn-copy { background: ${Y.accentSoft}; border-color: transparent; color: ${Y.accent}; }
1906
+ #nexa-dev-overlay .nexa-btn-copy:hover { background: ${Y.accent}; color: #ffffff; }
1833
1907
  #nexa-dev-overlay .nexa-card {
1834
- background: ${X.bgElevated};
1835
- border: 1px solid ${X.border};
1908
+ background: ${Y.bgSurface};
1909
+ border: 1px solid ${Y.border};
1836
1910
  border-radius: 12px;
1837
1911
  padding: 16px;
1838
1912
  margin-bottom: 12px;
@@ -1840,31 +1914,53 @@ var J = class {
1840
1914
  #nexa-dev-overlay .nexa-card h3 {
1841
1915
  font-size: 12px;
1842
1916
  font-weight: 600;
1843
- color: ${X.textDim};
1917
+ color: ${Y.textDim};
1844
1918
  text-transform: uppercase;
1845
1919
  letter-spacing: 0.05em;
1846
1920
  margin-bottom: 12px;
1847
1921
  }
1922
+ #nexa-dev-overlay .nexa-notification {
1923
+ position: absolute;
1924
+ bottom: 24px;
1925
+ left: 50%;
1926
+ transform: translateX(-50%) translateY(20px);
1927
+ background: ${Y.bgElevated};
1928
+ color: ${Y.text};
1929
+ padding: 10px 18px;
1930
+ border-radius: 12px;
1931
+ border: 1px solid ${Y.borderFocus};
1932
+ font-size: 13px;
1933
+ font-weight: 500;
1934
+ box-shadow: 0 12px 32px rgba(0,0,0,0.4);
1935
+ z-index: 2147483651;
1936
+ opacity: 0;
1937
+ pointer-events: none;
1938
+ transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
1939
+ }
1940
+ #nexa-dev-overlay .nexa-notification-show {
1941
+ opacity: 1;
1942
+ transform: translateX(-50%) translateY(0);
1943
+ }
1848
1944
  #nexa-dev-overlay .nexa-row {
1849
1945
  display: flex;
1850
1946
  justify-content: space-between;
1851
1947
  align-items: center;
1852
1948
  padding: 6px 0;
1853
1949
  font-size: 13px;
1854
- border-bottom: 1px solid ${X.border};
1950
+ border-bottom: 1px solid ${Y.border};
1855
1951
  }
1856
1952
  #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}; }
1953
+ #nexa-dev-overlay .nexa-row span { color: ${Y.textMuted}; }
1954
+ #nexa-dev-overlay .nexa-row strong { color: ${Y.text}; font-weight: 500; font-variant-numeric: tabular-nums; }
1955
+ #nexa-dev-overlay .nexa-row .nexa-ok { color: ${Y.success}; }
1956
+ #nexa-dev-overlay .nexa-row .nexa-err { color: ${Y.error}; }
1861
1957
  #nexa-dev-overlay .nexa-code {
1862
- background: ${X.bg};
1958
+ background: ${Y.bg};
1863
1959
  border-radius: 8px;
1864
1960
  padding: 12px;
1865
1961
  font-size: 11px;
1866
1962
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
1867
- color: ${X.textMuted};
1963
+ color: ${Y.textMuted};
1868
1964
  overflow-x: auto;
1869
1965
  white-space: pre;
1870
1966
  max-height: 200px;
@@ -1873,7 +1969,7 @@ var J = class {
1873
1969
  #nexa-dev-overlay .nexa-url-full {
1874
1970
  font-size: 12px;
1875
1971
  word-break: break-all;
1876
- color: ${X.accent};
1972
+ color: ${Y.accent};
1877
1973
  }
1878
1974
  #nexa-dev-overlay .nexa-metrics-content {
1879
1975
  padding: 16px;
@@ -1881,18 +1977,148 @@ var J = class {
1881
1977
  flex-direction: column;
1882
1978
  gap: 12px;
1883
1979
  }
1980
+ #nexa-dev-overlay .nexa-settings-panel {
1981
+ position: absolute;
1982
+ top: 72px;
1983
+ left: 16px;
1984
+ right: 16px;
1985
+ bottom: 16px;
1986
+ z-index: 2147483650;
1987
+ display: none;
1988
+ flex-direction: column;
1989
+ gap: 12px;
1990
+ padding: 16px;
1991
+ border-radius: 12px;
1992
+ background: ${Y.bgElevated};
1993
+ border: 1px solid ${Y.border};
1994
+ box-shadow: 0 28px 60px -24px rgba(2, 6, 23, 0.76);
1995
+ overflow: auto;
1996
+ }
1997
+ #nexa-dev-overlay .nexa-settings-row { display:flex;align-items:center;gap:8px;margin-bottom:8px }
1998
+ #nexa-dev-overlay .nexa-settings-row label{font-size:13px;color:${Y.textDim};min-width:70px}
1999
+ #nexa-dev-overlay .nexa-settings-row select{padding:6px 8px;border-radius:8px;border:1px solid ${Y.border};background:${Y.bg};color:${Y.text}}
2000
+
2001
+ #nexa-dev-overlay.nexa-theme-light {
2002
+ background: #f8fbff;
2003
+ color: #0f172a;
2004
+ border-color: #d8e4f2;
2005
+ box-shadow: 0 28px 60px -24px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(148, 163, 184, 0.16);
2006
+ }
2007
+ #nexa-dev-overlay.nexa-theme-light .nexa-header,
2008
+ #nexa-dev-overlay.nexa-theme-light .nexa-metrics-bar,
2009
+ #nexa-dev-overlay.nexa-theme-light .nexa-search,
2010
+ #nexa-dev-overlay.nexa-theme-light .nexa-tabs {
2011
+ background: #f8fbff;
2012
+ border-color: #d8e4f2;
2013
+ }
2014
+ #nexa-dev-overlay.nexa-theme-light .nexa-logo,
2015
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric,
2016
+ #nexa-dev-overlay.nexa-theme-light .nexa-request-item,
2017
+ #nexa-dev-overlay.nexa-theme-light .nexa-btn,
2018
+ #nexa-dev-overlay.nexa-theme-light .nexa-card,
2019
+ #nexa-dev-overlay.nexa-theme-light .nexa-settings-panel,
2020
+ #nexa-dev-overlay.nexa-theme-light .nexa-notification {
2021
+ background: #ffffff;
2022
+ border-color: #d8e4f2;
2023
+ }
2024
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric:hover,
2025
+ #nexa-dev-overlay.nexa-theme-light .nexa-icon-btn:hover,
2026
+ #nexa-dev-overlay.nexa-theme-light .nexa-btn:hover,
2027
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab:hover,
2028
+ #nexa-dev-overlay.nexa-theme-light .nexa-request-item:hover {
2029
+ background: #eef6ff;
2030
+ }
2031
+ #nexa-dev-overlay.nexa-theme-light .nexa-request-item:hover {
2032
+ border-color: #93c5fd;
2033
+ }
2034
+ #nexa-dev-overlay.nexa-theme-light .nexa-search-icon,
2035
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric-label,
2036
+ #nexa-dev-overlay.nexa-theme-light .nexa-duration,
2037
+ #nexa-dev-overlay.nexa-theme-light .nexa-empty,
2038
+ #nexa-dev-overlay.nexa-theme-light .nexa-empty span,
2039
+ #nexa-dev-overlay.nexa-theme-light .nexa-row span,
2040
+ #nexa-dev-overlay.nexa-theme-light .nexa-settings-row label,
2041
+ #nexa-dev-overlay.nexa-theme-light .nexa-notification {
2042
+ color: #64748b;
2043
+ }
2044
+ #nexa-dev-overlay.nexa-theme-light .nexa-notification {
2045
+ box-shadow: 0 12px 32px rgba(15,23,42,0.12);
2046
+ border-color: #e2e8f0;
2047
+ }
2048
+ #nexa-dev-overlay.nexa-theme-light .nexa-url,
2049
+ #nexa-dev-overlay.nexa-theme-light .nexa-empty p,
2050
+ #nexa-dev-overlay.nexa-theme-light .nexa-icon-btn,
2051
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab,
2052
+ #nexa-dev-overlay.nexa-theme-light .nexa-btn,
2053
+ #nexa-dev-overlay.nexa-theme-light .nexa-code {
2054
+ color: #334155;
2055
+ }
2056
+ #nexa-dev-overlay.nexa-theme-light .nexa-metric-value,
2057
+ #nexa-dev-overlay.nexa-theme-light .nexa-title,
2058
+ #nexa-dev-overlay.nexa-theme-light .nexa-row strong {
2059
+ color: #0f172a;
2060
+ }
2061
+ #nexa-dev-overlay.nexa-theme-light .nexa-search-input,
2062
+ #nexa-dev-overlay.nexa-theme-light .nexa-settings-row select,
2063
+ #nexa-dev-overlay.nexa-theme-light .nexa-code {
2064
+ background: #ffffff;
2065
+ color: #0f172a;
2066
+ border-color: #d8e4f2;
2067
+ }
2068
+ #nexa-dev-overlay.nexa-theme-light .nexa-search-input:focus {
2069
+ border-color: #38bdf8;
2070
+ box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.16);
2071
+ }
2072
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab-active {
2073
+ color: #ffffff;
2074
+ background: #0ea5e9 !important;
2075
+ }
2076
+ #nexa-dev-overlay.nexa-theme-light .nexa-tab-count {
2077
+ background: rgba(14, 165, 233, 0.12);
2078
+ color: #075985;
2079
+ }
2080
+ #nexa-dev-overlay.nexa-theme-light .nexa-code,
2081
+ #nexa-dev-overlay.nexa-theme-light .nexa-detail,
2082
+ #nexa-dev-overlay.nexa-theme-light .nexa-row {
2083
+ border-color: #d8e4f2;
2084
+ }
1884
2085
  #nexa-dev-overlay .nexa-slow-req {
1885
2086
  display: flex;
1886
2087
  align-items: center;
1887
2088
  gap: 8px;
1888
2089
  }
1889
- `, ye = class {
2090
+ #nexa-dev-overlay.nexa-view-detail .nexa-metrics-bar,
2091
+ #nexa-dev-overlay.nexa-view-detail .nexa-search,
2092
+ #nexa-dev-overlay.nexa-view-detail .nexa-filters,
2093
+ #nexa-dev-overlay.nexa-view-detail .nexa-tabs,
2094
+ #nexa-dev-overlay.nexa-view-detail .nexa-body {
2095
+ display: none !important;
2096
+ }
2097
+ `;
2098
+ function X() {
2099
+ try {
2100
+ if (typeof process < "u") {
2101
+ let e = process;
2102
+ if (e.env && typeof e.env.NODE_ENV == "string") return e.env.NODE_ENV === "development";
2103
+ }
2104
+ } catch {}
2105
+ try {
2106
+ if (typeof location < "u" && location.hostname) {
2107
+ let e = location.hostname;
2108
+ if (e === "localhost" || e === "127.0.0.1" || e === "0.0.0.0") return !0;
2109
+ }
2110
+ } catch {}
2111
+ return !1;
2112
+ }
2113
+ var we = class {
1890
2114
  panel = null;
2115
+ floatingIcon = null;
1891
2116
  tracker;
1892
2117
  visible = !1;
1893
2118
  selectedRequest = null;
1894
2119
  config;
1895
2120
  searchQuery = "";
2121
+ filterType = "all";
1896
2122
  removeTrackerListener = null;
1897
2123
  keyboardShortcutHandler = null;
1898
2124
  globalKeyboardHandler = null;
@@ -1902,18 +2128,18 @@ var J = class {
1902
2128
  show() {
1903
2129
  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
2130
  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);
2131
+ }), this.visible = !0, this.hideFloatingIcon());
1906
2132
  }
1907
2133
  hide() {
1908
2134
  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
2135
  this.panel && (this.panel.style.display = "none");
1910
- }, 150), this.visible = !1);
2136
+ }, 150), this.visible = !1, this.config.enabled && (!this.config.devOnly || X()) && this.showFloatingIcon());
1911
2137
  }
1912
2138
  toggle() {
1913
2139
  this.visible ? this.hide() : this.show();
1914
2140
  }
1915
2141
  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;
2142
+ 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
2143
  }
1918
2144
  setupKeyboardShortcut() {
1919
2145
  let e = this.config.keyboardShortcut.split("+"), t = new Set(e.map((e) => e.toLowerCase()));
@@ -1930,30 +2156,61 @@ var J = class {
1930
2156
  }
1931
2157
  createPanel() {
1932
2158
  if (!this.canUseDOM()) return;
2159
+ try {
2160
+ let e = document.getElementById("nexa-dev-overlay");
2161
+ e && e.remove();
2162
+ } catch {}
1933
2163
  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");
2164
+ let e = this.config.position, t = e.includes("bottom"), n = e.includes("right"), r = `${this.config.floatingButtonOffset ?? 24}px`, i = this.config.branding || "Nexa DevTools", a = this.config.icon || "https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png";
1935
2165
  this.panel.style.cssText = `
1936
2166
  position: fixed;
1937
- ${t ? "bottom: 24px;" : "top: 24px;"}
1938
- ${n ? "right: 24px;" : "left: 24px;"}
2167
+ ${t ? `bottom: ${r};` : `top: ${r};`}
2168
+ ${n ? `right: ${r};` : `left: ${r};`}
1939
2169
  width: 420px;
1940
2170
  max-height: 70vh;
1941
- z-index: 2147483647;
2171
+ z-index: 2147483649;
1942
2172
  display: flex;
1943
2173
  flex-direction: column;
1944
2174
  overflow: hidden;
1945
- `, this.panel.innerHTML = `<style>${Z}</style>
2175
+ `, this.panel.innerHTML = `<style>${Ce}</style>
1946
2176
 
1947
2177
  <div class="nexa-header">
1948
- <div class="nexa-header-left">
2178
+ <div class="nexa-header-left">
1949
2179
  <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>
2180
+ <img src="${a}" alt="${i}" style="width:100%;height:auto;object-fit:cover;border-radius:8px;display:block;" />
1951
2181
  </div>
1952
- <span class="nexa-title">Nexa DevTools</span>
2182
+ <span class="nexa-title">${i}</span>
1953
2183
  </div>
1954
2184
  <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>
2185
+ <button class="nexa-icon-btn nexa-btn-export" title="Export history (JSON)">${J.download}</button>
2186
+ <button class="nexa-icon-btn nexa-btn-settings" title="Settings">${J.gear}</button>
2187
+ <button class="nexa-icon-btn nexa-btn-clear" title="Clear history">${J.clear}</button>
2188
+ <button class="nexa-icon-btn nexa-btn-close" title="Close (Esc)">${J.close}</button>
2189
+ </div>
2190
+ </div>
2191
+
2192
+ <div class="nexa-notification"></div>
2193
+
2194
+ <div class="nexa-settings-panel" style="display:none">
2195
+ <div class="nexa-settings-row">
2196
+ <label for="nexa-pos">Position</label>
2197
+ <select id="nexa-pos" data-setting="position">
2198
+ <option value="top-right">Top Right</option>
2199
+ <option value="top-left">Top Left</option>
2200
+ <option value="bottom-right">Bottom Right</option>
2201
+ <option value="bottom-left">Bottom Left</option>
2202
+ </select>
2203
+ </div>
2204
+ <div class="nexa-settings-row">
2205
+ <label for="nexa-theme">Theme</label>
2206
+ <select id="nexa-theme" data-setting="theme">
2207
+ <option value="dark">Dark</option>
2208
+ <option value="light">Light</option>
2209
+ </select>
2210
+ </div>
2211
+ <div style="display:flex;gap:8px;margin-top:8px">
2212
+ <button class="nexa-btn nexa-btn-save">Save</button>
2213
+ <button class="nexa-btn nexa-btn-cancel">Cancel</button>
1957
2214
  </div>
1958
2215
  </div>
1959
2216
 
@@ -1966,10 +2223,17 @@ var J = class {
1966
2223
  </div>
1967
2224
 
1968
2225
  <div class="nexa-search">
1969
- <span class="nexa-search-icon">${Y.search}</span>
2226
+ <span class="nexa-search-icon">${J.search}</span>
1970
2227
  <input type="text" class="nexa-search-input" placeholder="Filter by URL, method, or status..." />
1971
2228
  </div>
1972
2229
 
2230
+ <div class="nexa-filters">
2231
+ <div class="nexa-filter-chip nexa-filter-chip-active" data-filter="all">All</div>
2232
+ <div class="nexa-filter-chip" data-filter="err">Errors</div>
2233
+ <div class="nexa-filter-chip" data-filter="xhr">JSON</div>
2234
+ <div class="nexa-filter-chip" data-filter="slow">Slow</div>
2235
+ </div>
2236
+
1973
2237
  <div class="nexa-tabs">
1974
2238
  <button class="nexa-tab nexa-tab-active" data-tab="requests"><span>Requests</span><span class="nexa-tab-count" data-count="requests">0</span></button>
1975
2239
  <button class="nexa-tab" data-tab="metrics"><span>Metrics</span></button>
@@ -1982,12 +2246,17 @@ var J = class {
1982
2246
 
1983
2247
  <div class="nexa-detail" style="display:none">
1984
2248
  <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>
2249
+ <button class="nexa-btn nexa-btn-back">${J.back} Back</button>
2250
+ <div class="nexa-btn-group">
2251
+ <button class="nexa-btn nexa-btn-copy">${J.copy} Copy as fetch</button>
2252
+ <button class="nexa-btn nexa-btn-retry">${J.retry} Retry</button>
2253
+ </div>
1987
2254
  </div>
1988
2255
  <div class="nexa-detail-body"></div>
1989
2256
  </div>
1990
- `, document.body.appendChild(this.panel), this.bindEvents(), this.removeTrackerListener = this.tracker.onChange(() => this.render()), this.hide(), this.globalKeyboardHandler = (e) => {
2257
+ `, 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());
2258
+ let o = !this.config.devOnly || X();
2259
+ this.config.enabled && o && this.createFloatingIcon(), this.hide(), this.globalKeyboardHandler = (e) => {
1991
2260
  if (e.key === "Escape" && this.visible) {
1992
2261
  this.hide();
1993
2262
  return;
@@ -2000,14 +2269,33 @@ var J = class {
2000
2269
  }, document.addEventListener("keydown", this.globalKeyboardHandler);
2001
2270
  }
2002
2271
  bindEvents() {
2003
- this.panel && (this.panel.querySelector(".nexa-btn-close")?.addEventListener("click", () => this.hide()), this.panel.querySelector(".nexa-btn-clear")?.addEventListener("click", () => {
2272
+ this.panel && (this.panel.querySelector(".nexa-btn-close")?.addEventListener("click", () => this.hide()), this.panel.querySelector(".nexa-btn-export")?.addEventListener("click", () => this.exportHistory()), this.panel.querySelector(".nexa-btn-copy")?.addEventListener("click", () => this.copyAsFetch()), this.panel.querySelector(".nexa-btn-clear")?.addEventListener("click", () => {
2004
2273
  this.tracker.clear(), this.render();
2005
2274
  }), this.panel.querySelector(".nexa-btn-back")?.addEventListener("click", () => this.showMainView()), this.panel.querySelector(".nexa-btn-retry")?.addEventListener("click", () => this.retrySelected()), this.panel.querySelector(".nexa-search-input")?.addEventListener("input", (e) => {
2006
2275
  this.searchQuery = e.target.value.toLowerCase(), this.renderRequestList();
2276
+ }), this.panel.querySelectorAll(".nexa-filter-chip").forEach((e) => {
2277
+ e.addEventListener("click", () => {
2278
+ this.panel.querySelectorAll(".nexa-filter-chip").forEach((e) => e.classList.remove("nexa-filter-chip-active")), e.classList.add("nexa-filter-chip-active"), this.filterType = e.dataset.filter, this.renderRequestList();
2279
+ });
2007
2280
  }), this.panel.querySelectorAll(".nexa-tab").forEach((e) => {
2008
2281
  e.addEventListener("click", () => {
2009
2282
  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
2283
  });
2284
+ }), this.panel.querySelector(".nexa-btn-settings")?.addEventListener("click", () => {
2285
+ let e = this.panel.querySelector(".nexa-settings-panel");
2286
+ if (!e) return;
2287
+ let t = this.panel.querySelector("[data-setting=\"position\"]"), n = this.panel.querySelector("[data-setting=\"theme\"]"), r = e.style.display === "flex";
2288
+ e.style.display = r ? "none" : "flex", r || (this.hideFloatingIcon(), t && (t.value = this.config.position), n && (n.value = this.config.theme), t?.focus());
2289
+ }), this.panel.querySelector(".nexa-btn-save")?.addEventListener("click", () => {
2290
+ let e = this.panel.querySelector("[data-setting=\"position\"]"), t = this.panel.querySelector("[data-setting=\"theme\"]"), n = e?.value, r = t?.value, i = {};
2291
+ n !== void 0 && (i.position = n), r !== void 0 && (i.theme = r);
2292
+ let a = this.tracker.updateConfig(i);
2293
+ this.applyConfigToUI(a);
2294
+ let o = this.panel.querySelector(".nexa-settings-panel");
2295
+ o && (o.style.display = "none");
2296
+ }), this.panel.querySelector(".nexa-btn-cancel")?.addEventListener("click", () => {
2297
+ let e = this.panel.querySelector(".nexa-settings-panel");
2298
+ e && (e.style.display = "none");
2011
2299
  }));
2012
2300
  }
2013
2301
  render() {
@@ -2021,7 +2309,7 @@ var J = class {
2021
2309
  let e = this.panel?.querySelector(".nexa-request-list");
2022
2310
  if (!e) return;
2023
2311
  let t = this.tracker.getHistory();
2024
- if (this.searchQuery && (t = t.filter((e) => e.url.toLowerCase().includes(this.searchQuery) || e.method.toLowerCase().includes(this.searchQuery) || String(e.status).includes(this.searchQuery))), t.length === 0) {
2312
+ if (this.filterType === "err" ? t = t.filter((e) => !e.ok) : this.filterType === "xhr" ? t = t.filter((e) => e.headers["content-type"] && e.headers["content-type"].includes("json") || e.responseHeaders && e.responseHeaders["content-type"] && e.responseHeaders["content-type"].includes("json")) : this.filterType === "slow" && (t = t.filter((e) => e.duration > 500)), this.searchQuery && (t = t.filter((e) => e.url.toLowerCase().includes(this.searchQuery) || e.method.toLowerCase().includes(this.searchQuery) || String(e.status).includes(this.searchQuery))), t.length === 0) {
2025
2313
  e.innerHTML = `
2026
2314
  <div class="nexa-empty">
2027
2315
  <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
@@ -2043,7 +2331,7 @@ var J = class {
2043
2331
  ${e.cached ? "<span class=\"nexa-badge nexa-badge-cache\">Cache</span>" : ""}
2044
2332
  ${e.retryCount > 0 ? `<span class="nexa-badge nexa-badge-retry">${e.retryCount}R</span>` : ""}
2045
2333
  <span class="nexa-duration ${e.duration > 500 ? "nexa-slow" : ""}">${e.duration.toFixed(0)}ms</span>
2046
- ${Y.chevron}
2334
+ ${J.chevron}
2047
2335
  </div>
2048
2336
  </div>
2049
2337
  `).join(""), e.querySelectorAll(".nexa-request-item").forEach((e) => {
@@ -2086,12 +2374,12 @@ var J = class {
2086
2374
  ` : ""}`;
2087
2375
  }
2088
2376
  showDetail(e) {
2089
- this.selectedRequest = e;
2090
- let t = this.panel?.querySelector(".nexa-body"), n = this.panel?.querySelector(".nexa-detail"), r = this.panel?.querySelector(".nexa-detail-body");
2091
- !t || !n || !r || (t.style.display = "none", n.style.display = "flex", r.innerHTML = `
2377
+ if (this.selectedRequest = e, !this.panel) return;
2378
+ let t = this.panel.querySelector(".nexa-body"), n = this.panel.querySelector(".nexa-detail"), r = this.panel.querySelector(".nexa-detail-body");
2379
+ !t || !n || !r || (this.panel.classList.add("nexa-view-detail"), t.style.display = "none", n.style.display = "flex", r.innerHTML = `
2092
2380
  <div class="nexa-card">
2093
2381
  <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>
2382
+ <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
2383
  <div class="nexa-row"><span>URL</span><span class="nexa-url-full">${e.url}</span></div>
2096
2384
  <div class="nexa-row"><span>Status</span><strong class="${e.ok ? "nexa-ok" : "nexa-err"}">${e.status || "N/A"}</strong></div>
2097
2385
  <div class="nexa-row"><span>Duration</span><strong>${e.duration.toFixed(1)}ms</strong></div>
@@ -2113,6 +2401,7 @@ var J = class {
2113
2401
  ` : ""}`);
2114
2402
  }
2115
2403
  showMainView() {
2404
+ this.panel && this.panel.classList.remove("nexa-view-detail");
2116
2405
  let e = this.panel?.querySelector(".nexa-body"), t = this.panel?.querySelector(".nexa-detail");
2117
2406
  e && (e.style.display = "flex"), t && (t.style.display = "none"), this.selectedRequest = null;
2118
2407
  }
@@ -2133,6 +2422,27 @@ var J = class {
2133
2422
  }, this.showDetail(this.selectedRequest));
2134
2423
  }).catch(() => {});
2135
2424
  }
2425
+ exportHistory() {
2426
+ let e = this.tracker.getHistory(), t = JSON.stringify(e, null, 2), n = new Blob([t], { type: "application/json" }), r = URL.createObjectURL(n), i = document.createElement("a");
2427
+ i.href = r, i.download = `nexa-history-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 19).replace(/[:]/g, "-")}.json`, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(r), this.showNotification("History exported as JSON");
2428
+ }
2429
+ copyAsFetch() {
2430
+ if (!this.selectedRequest) return;
2431
+ let e = this.selectedRequest, t = { ...e.headers };
2432
+ delete t.host;
2433
+ let n = `fetch("${e.url}", {\n`;
2434
+ n += ` "method": "${e.method}",\n`, Object.keys(t).length > 0 && (n += ` "headers": ${JSON.stringify(t, null, 4).replace(/\n/g, "\n ")},\n`), e.body && (n += ` "body": ${JSON.stringify(e.body, null, 4).replace(/\n/g, "\n ")},\n`), n += "});", navigator.clipboard.writeText(n).then(() => {
2435
+ this.showNotification("Copied as fetch to clipboard");
2436
+ }).catch(() => {
2437
+ this.showNotification("Failed to copy to clipboard");
2438
+ });
2439
+ }
2440
+ showNotification(e) {
2441
+ let t = this.panel?.querySelector(".nexa-notification");
2442
+ t && (t.textContent = e, t.classList.add("nexa-notification-show"), setTimeout(() => {
2443
+ t.classList.remove("nexa-notification-show");
2444
+ }, 2500));
2445
+ }
2136
2446
  truncateUrl(e, t = 35) {
2137
2447
  try {
2138
2448
  let t = new URL(e);
@@ -2151,26 +2461,112 @@ var J = class {
2151
2461
  canUseDOM() {
2152
2462
  return typeof document < "u" && typeof document.createElement == "function" && !!document.body;
2153
2463
  }
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
- });
2464
+ createFloatingIcon() {
2465
+ if (!this.canUseDOM()) return;
2466
+ try {
2467
+ let e = document.getElementById("nexa-dev-overlay-floating");
2468
+ e && e.remove();
2469
+ } catch {}
2470
+ this.floatingIcon &&= (this.floatingIcon.remove(), null);
2471
+ let e = document.createElement("button");
2472
+ e.id = "nexa-dev-overlay-floating", e.title = "Toggle Nexa DevTools";
2473
+ 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";
2474
+ s === "light" && (c = "linear-gradient(135deg,#f8fbff,#e0f2fe)", l = "#0f172a", u = "0 14px 30px rgba(15,23,42,0.16)", d = "1px solid #d8e4f2");
2475
+ let f = this.config.branding || "Nexa DevTools", p = this.config.icon || "https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png";
2476
+ e.style.cssText = `
2477
+ position: fixed;
2478
+ ${o}
2479
+ width: ${t}px;
2480
+ height: ${t}px;
2481
+ border-radius: 50%;
2482
+ border: ${d};
2483
+ display: flex;
2484
+ align-items: center;
2485
+ justify-content: center;
2486
+ z-index: 2147483648;
2487
+ cursor: pointer;
2488
+ box-shadow: ${u};
2489
+ background: ${c};
2490
+ color: ${l};
2491
+ font-weight: 700;
2492
+ font-size: ${Math.max(12, Math.floor(t / 3))}px;
2493
+ `, e.innerHTML = `<img src="${p}" alt="${f}" style="width:${t - 10}px;height:auto;object-fit:cover;border-radius:999px;display:block;" />`, e.addEventListener("click", (e) => {
2494
+ e.stopPropagation(), this.toggle();
2495
+ }), e.addEventListener("mousedown", (e) => e.preventDefault()), document.body.appendChild(e), e.style.display = this.visible ? "none" : "flex", this.floatingIcon = e;
2496
+ }
2497
+ showFloatingIcon() {
2498
+ if (!this.floatingIcon) {
2499
+ this.config.enabled && this.createFloatingIcon();
2500
+ return;
2501
+ }
2502
+ this.floatingIcon.style.display = "flex";
2503
+ }
2504
+ hideFloatingIcon() {
2505
+ this.floatingIcon && (this.floatingIcon.style.display = "none");
2506
+ }
2507
+ applyConfigToUI(e) {
2508
+ this.config = e ?? this.tracker.getConfig();
2509
+ let t = this.config.position, n = t.includes("bottom"), r = t.includes("right"), i = `${this.config.floatingButtonOffset ?? 24}px`;
2510
+ if (this.panel) {
2511
+ 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");
2512
+ let e = this.panel.querySelector(".nexa-logo img"), t = this.panel.querySelector(".nexa-title"), a = this.config.branding || "Nexa DevTools", o = this.config.icon || "https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png";
2513
+ e && (e.src = o, e.alt = a), t && (t.textContent = a);
2514
+ }
2515
+ this.floatingIcon &&= (this.floatingIcon.remove(), null), this.config.enabled && (!this.config.devOnly || X()) && this.createFloatingIcon();
2516
+ }
2517
+ refreshConfig(e) {
2518
+ this.applyConfigToUI(e);
2519
+ }
2520
+ }, Z = null, Q = null, $ = {
2521
+ enabled: !0,
2522
+ maxHistory: 500,
2523
+ keyboardShortcut: "ctrl+shift+n",
2524
+ position: "bottom-right",
2525
+ theme: "dark",
2526
+ devOnly: !0,
2527
+ floatingButtonSize: 48,
2528
+ floatingButtonOffset: 24,
2529
+ floatingButtonTheme: "inherit",
2530
+ branding: "Nexa DevTools",
2531
+ icon: "https://raw.githubusercontent.com/Berea-Soft/nexa/refs/heads/main/src/assets/faviconNew.png"
2532
+ };
2533
+ function Te(e = {}) {
2534
+ if (Z && Q) {
2535
+ let t = K(), n = {
2536
+ ...$,
2537
+ ...e,
2538
+ ...t
2539
+ }, r = Q.updateConfig(n);
2540
+ try {
2541
+ Z.refreshConfig(r);
2542
+ } catch {}
2543
+ return {
2544
+ tracker: Q,
2545
+ ui: Z,
2546
+ config: r
2547
+ };
2548
+ }
2549
+ let t = K();
2550
+ return Q = new q({
2551
+ ...$,
2552
+ ...e,
2553
+ ...t
2554
+ }), Z = new we(Q), {
2555
+ tracker: Q,
2556
+ ui: Z,
2557
+ config: Q.getConfig()
2558
+ };
2163
2559
  }
2164
- function xe() {
2560
+ function Ee() {
2165
2561
  return {
2166
- tracker: $,
2167
- ui: Q
2562
+ tracker: Q,
2563
+ ui: Z
2168
2564
  };
2169
2565
  }
2170
- function Se() {
2171
- Q?.destroy(), Q = null, $ = null;
2566
+ function De() {
2567
+ Z?.destroy(), Z = null, Q = null;
2172
2568
  }
2173
2569
  //#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 };
2570
+ 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
2571
 
2176
2572
  //# sourceMappingURL=nexa.es.js.map