@ws-ui/http-handlers-editor 1.11.3-rc2 → 1.11.3-rc4

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/index.es.js CHANGED
@@ -1,44 +1,45 @@
1
- import { jsx as e, jsxs as o, Fragment as G } from "react/jsx-runtime";
2
- import { useSensors as he, useSensor as X, PointerSensor as me, KeyboardSensor as ge, DndContext as xe, closestCenter as fe, DragOverlay as ye } from "@dnd-kit/core";
3
- import { useSortable as be, sortableKeyboardCoordinates as ve, SortableContext as Ne, verticalListSortingStrategy as we, arrayMove as Ee } from "@dnd-kit/sortable";
4
- import { FdWarningDanger as j, FdRegex as Ce, FdUnRegex as De, FdDuplicate as te, FdPen as Te, FdTrash as He, FdCloseNaked as q, FdInfoCircle as ne, FdCheckCircle as Re, FdClose as Pe, FdDragHandle as Se, FdDown as K, FdEmpty as J, FdCode as Ie, FdPlus as Y } from "@ws-ui/icons";
5
- import { useAppDispatch as B, switchEditor as ke, useAppSelector as W, selectCatalog as re, openModal as ae, selectTabByPath as Ae, setContent as _e, ReduxProvider as Le, getStore as Fe } from "@ws-ui/store";
6
- import { createContext as Oe, useReducer as $e, useEffect as O, useContext as je, useState as _, Fragment as se, useMemo as Ge } from "react";
7
- import { generate as V } from "short-uuid";
8
- import { z as A } from "zod";
9
- import { ToolbarIcon as qe, Tooltip as E, ModalColor as le, ModalType as ie, useHotkeys as Be, ControlledSwitch as Ue, HTTP_HANDLERS_TAB_PATH as ze } from "@ws-ui/shared";
10
- import { CSS as Me } from "@dnd-kit/utilities";
11
- import { Combobox as S, Transition as oe } from "@headlessui/react";
1
+ import { jsx as e, jsxs as o, Fragment as O } from "react/jsx-runtime";
2
+ import { useSensors as fe, useSensor as Z, PointerSensor as ye, KeyboardSensor as ve, DndContext as be, closestCenter as Ne, DragOverlay as we } from "@dnd-kit/core";
3
+ import { useSortable as Ee, sortableKeyboardCoordinates as Ce, SortableContext as Te, verticalListSortingStrategy as De, arrayMove as He } from "@dnd-kit/sortable";
4
+ import { FdWarningDanger as q, FdRegex as Se, FdUnRegex as Pe, FdDuplicate as re, FdPen as Re, FdTrash as Ie, FdCloseNaked as B, FdInfoCircle as ae, FdCheckCircle as Ae, FdClose as ke, FdDragHandle as _e, FdDown as Q, FdEmpty as X, FdCode as Le, FdPlus as ee } from "@ws-ui/icons";
5
+ import { useAppDispatch as $, switchEditor as Oe, useAppSelector as M, selectCatalog as se, openModal as le, selectTabByPath as ie, setContent as oe, selectModals as Fe, editModal as $e, closeModal as je, ReduxProvider as Ge, getStore as Me } from "@ws-ui/store";
6
+ import { createContext as qe, useReducer as Be, useEffect as F, useContext as Ue, useState as _, Fragment as de, useMemo as ze } from "react";
7
+ import { generate as W } from "short-uuid";
8
+ import { z as k } from "zod";
9
+ import { ToolbarIcon as Je, Tooltip as E, ModalColor as ce, ModalType as pe, useHotkeys as Ke, ControlledSwitch as We, Modal as Ve, TipsProvider as Qe, HTTP_HANDLERS_TAB_PATH as K, useDidMountEffect as Xe } from "@ws-ui/shared";
10
+ import { CSS as Ye } from "@dnd-kit/utilities";
11
+ import { Combobox as R, Transition as ue } from "@headlessui/react";
12
12
  import C from "classnames";
13
- import { useMultipleSelection as F, useCombobox as L } from "downshift";
14
- import { omit as de, isEqual as Ve } from "lodash";
15
- import { Subject as Ke } from "rxjs";
16
- import Z from "randexp";
17
- const Je = ({
13
+ import { useMultipleSelection as j, useCombobox as L } from "downshift";
14
+ import { omit as he, isEqual as V } from "lodash";
15
+ import { Subject as Ze } from "rxjs";
16
+ import te from "randexp";
17
+ import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as et } from "./common.es.js";
18
+ const tt = ({
18
19
  label: t,
19
20
  Icon: a,
20
- tab: r,
21
- editor: i,
22
- onBeforeClick: c
21
+ tab: n,
22
+ editor: s,
23
+ onBeforeClick: d
23
24
  }) => {
24
- const x = B();
25
+ const p = $();
25
26
  return /* @__PURE__ */ e(
26
- qe,
27
+ Je,
27
28
  {
28
29
  label: t,
29
30
  Icon: a,
30
31
  as: "button",
31
32
  onClick: () => {
32
- c == null || c(), x(
33
- ke({
34
- tab: r,
35
- editor: i
33
+ d == null || d(), p(
34
+ Oe({
35
+ tab: n,
36
+ editor: s
36
37
  })
37
38
  );
38
39
  }
39
40
  }
40
41
  );
41
- }, ce = Oe(void 0), $ = new Ke(), We = (t, a) => {
42
+ }, me = qe(void 0), G = new Ze(), nt = (t, a) => {
42
43
  switch (a.type) {
43
44
  case "UPDATE_HANDLERS":
44
45
  return {
@@ -47,15 +48,15 @@ const Je = ({
47
48
  };
48
49
  case "SET_EDITING_HANDLER": {
49
50
  if (a.payload && a.payload !== t.editing) {
50
- const r = t.content.find(
51
- (i) => i.id === t.editing
51
+ const n = t.content.find(
52
+ (s) => s.id === t.editing
52
53
  );
53
- if (r && !Object.values(
54
- de(r, ["id", "verbs", "asRegex", "isExpanded"])
55
- ).some(Boolean) && r.verbs.length === 0)
54
+ if (n && !Object.values(
55
+ he(n, ["id", "verbs", "asRegex", "isExpanded"])
56
+ ).some(Boolean) && n.verbs.length === 0)
56
57
  return {
57
58
  ...t,
58
- content: t.content.filter((c) => c.id !== r.id),
59
+ content: t.content.filter((d) => d.id !== n.id),
59
60
  editing: a.payload
60
61
  };
61
62
  }
@@ -65,112 +66,112 @@ const Je = ({
65
66
  };
66
67
  }
67
68
  case "ADD_HANDLER": {
68
- const r = V();
69
+ const n = W();
69
70
  return {
70
71
  ...t,
71
- content: [...t.content, { ...a.payload, id: r }],
72
- editing: r,
73
- newlyCreatedHandlerID: r
72
+ content: [...t.content, { ...a.payload, id: n }],
73
+ editing: n,
74
+ newlyCreatedHandlerID: n
74
75
  };
75
76
  }
76
77
  case "UPDATE_HANDLER":
77
78
  return {
78
79
  ...t,
79
80
  content: t.content.map(
80
- (r) => r.id === a.id ? { ...r, ...a.payload } : r
81
+ (n) => n.id === a.id ? { ...n, ...a.payload } : n
81
82
  ),
82
83
  newlyCreatedHandlerID: null
83
84
  };
84
85
  case "DELETE_HANDLER":
85
86
  return {
86
87
  ...t,
87
- content: t.content.filter((r) => r.id !== a.id)
88
+ content: t.content.filter((n) => n.id !== a.id)
88
89
  };
89
90
  case "TOGGLE_EXPANDED":
90
91
  return {
91
92
  ...t,
92
93
  content: t.content.map(
93
- (r) => r.id === a.id ? { ...r, isExpanded: !r.isExpanded } : r
94
+ (n) => n.id === a.id ? { ...n, isExpanded: !n.isExpanded } : n
94
95
  )
95
96
  };
96
97
  case "DUPLICATE_HANDLER": {
97
- const r = t.content.find(
98
- (i) => i.id === a.id
98
+ const n = t.content.find(
99
+ (s) => s.id === a.id
99
100
  );
100
- return r ? {
101
+ return n ? {
101
102
  ...t,
102
103
  content: [
103
104
  ...t.content,
104
- { ...r, id: V(), isExpanded: !0 }
105
+ { ...n, id: W(), isExpanded: !0 }
105
106
  ]
106
107
  } : t;
107
108
  }
108
109
  case "TOGGLE_ALL_EXPANDED":
109
110
  return {
110
111
  ...t,
111
- content: t.content.map((r) => ({
112
- ...r,
112
+ content: t.content.map((n) => ({
113
+ ...n,
113
114
  isExpanded: a.payload
114
115
  }))
115
116
  };
116
117
  case "SYNC_DATA":
117
118
  return {
118
119
  ...t,
119
- content: a.payload.map((r) => {
120
- const i = t.content.find((c) => c.id === r.id);
121
- return i ? {
122
- ...r,
123
- ...i
124
- } : r;
120
+ content: a.payload.map((n) => {
121
+ const s = t.content.find((d) => d.id === n.id);
122
+ return s ? {
123
+ ...n,
124
+ ...s
125
+ } : n;
125
126
  })
126
127
  };
127
128
  default:
128
129
  throw new Error("Unknown action type");
129
130
  }
130
- }, Qe = ({
131
+ }, rt = ({
131
132
  children: t,
132
133
  content: a
133
134
  }) => {
134
- const r = {
135
+ const n = {
135
136
  content: a,
136
137
  editing: null,
137
138
  newlyCreatedHandlerID: null
138
- }, [i, c] = $e(We, r);
139
- return O(() => {
140
- c({
139
+ }, [s, d] = Be(nt, n);
140
+ return F(() => {
141
+ d({
141
142
  type: "SYNC_DATA",
142
143
  payload: a
143
144
  });
144
- }, [a]), /* @__PURE__ */ e(ce.Provider, { value: { state: i, dispatch: c }, children: t });
145
- }, Q = () => {
146
- const t = je(ce);
145
+ }, [a]), /* @__PURE__ */ e(me.Provider, { value: { state: s, dispatch: d }, children: t });
146
+ }, Y = () => {
147
+ const t = Ue(me);
147
148
  if (!t)
148
149
  throw new Error("useHTTPHandlers must be used within a HandlerProvider");
149
150
  return t;
150
- }, Xe = ({ initialSelectedItems: t, onChange: a, touched: r, onBlur: i }) => {
151
- const c = ["GET", "POST", "PUT", "DELETE"];
152
- function x(h, u) {
153
- const N = u.toLowerCase();
154
- return c.filter(function(s) {
155
- return !h.includes(s) && s.toLowerCase().includes(N);
151
+ }, at = ({ initialSelectedItems: t, onChange: a, touched: n, onBlur: s }) => {
152
+ const d = ["GET", "POST", "PUT", "DELETE"];
153
+ function p(g, h) {
154
+ const N = h.toLowerCase();
155
+ return d.filter(function(l) {
156
+ return !g.includes(l) && l.toLowerCase().includes(N);
156
157
  });
157
158
  }
158
- const [f, g] = _(""), [d, n] = _(t);
159
- O(() => {
160
- n(t);
159
+ const [m, f] = _(""), [c, r] = _(t);
160
+ F(() => {
161
+ r(t);
161
162
  }, [t]);
162
- const l = Ge(
163
- () => x(d, f),
164
- [d, f]
165
- ), { getSelectedItemProps: p, getDropdownProps: b, removeSelectedItem: v } = F({
166
- selectedItems: d,
167
- onStateChange({ selectedItems: h = [], type: u }) {
168
- switch (u) {
169
- case F.stateChangeTypes.SelectedItemKeyDownBackspace:
170
- case F.stateChangeTypes.SelectedItemKeyDownDelete:
171
- case F.stateChangeTypes.DropdownKeyDownBackspace:
172
- case F.stateChangeTypes.FunctionRemoveSelectedItem:
173
- n(h);
163
+ const i = ze(
164
+ () => p(c, m),
165
+ [c, m]
166
+ ), { getSelectedItemProps: u, getDropdownProps: v, removeSelectedItem: b } = j({
167
+ selectedItems: c,
168
+ onStateChange({ selectedItems: g = [], type: h }) {
169
+ switch (h) {
170
+ case j.stateChangeTypes.SelectedItemKeyDownBackspace:
171
+ case j.stateChangeTypes.SelectedItemKeyDownDelete:
172
+ case j.stateChangeTypes.DropdownKeyDownBackspace:
173
+ case j.stateChangeTypes.FunctionRemoveSelectedItem:
174
+ r(g);
174
175
  break;
175
176
  }
176
177
  }
@@ -178,21 +179,21 @@ const Je = ({
178
179
  isOpen: y,
179
180
  getToggleButtonProps: w,
180
181
  getMenuProps: I,
181
- getInputProps: D,
182
- highlightedIndex: T,
182
+ getInputProps: T,
183
+ highlightedIndex: D,
183
184
  getItemProps: H,
184
- selectedItem: R
185
+ selectedItem: S
185
186
  } = L({
186
- items: l,
187
- itemToString(h) {
188
- return h || "";
187
+ items: i,
188
+ itemToString(g) {
189
+ return g || "";
189
190
  },
190
191
  defaultHighlightedIndex: 0,
191
192
  // after selection, highlight the first item.
192
193
  selectedItem: null,
193
- inputValue: f,
194
- stateReducer(h, u) {
195
- const { changes: N, type: P } = u;
194
+ inputValue: m,
195
+ stateReducer(g, h) {
196
+ const { changes: N, type: P } = h;
196
197
  switch (P) {
197
198
  case L.stateChangeTypes.InputKeyDownEnter:
198
199
  case L.stateChangeTypes.ItemClick:
@@ -208,82 +209,82 @@ const Je = ({
208
209
  }
209
210
  },
210
211
  onStateChange({
211
- inputValue: h = "",
212
- type: u,
212
+ inputValue: g = "",
213
+ type: h,
213
214
  selectedItem: N
214
215
  }) {
215
- switch (u) {
216
+ switch (h) {
216
217
  case L.stateChangeTypes.InputKeyDownEnter:
217
218
  case L.stateChangeTypes.ItemClick:
218
219
  case L.stateChangeTypes.InputBlur:
219
- N && (n([...d, N]), g(""));
220
+ N && (r([...c, N]), f(""));
220
221
  break;
221
222
  case L.stateChangeTypes.InputChange:
222
- g(h);
223
+ f(g);
223
224
  break;
224
225
  }
225
226
  }
226
227
  });
227
- return O(() => {
228
- a(d);
229
- }, [d]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
228
+ return F(() => {
229
+ a(c);
230
+ }, [c]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
230
231
  /* @__PURE__ */ o(
231
232
  "div",
232
233
  {
233
234
  className: C(
234
235
  "bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative flex items-center w-full cursor-default overflow-hidden rounded p-px text-left focus:outline-none",
235
236
  {
236
- "ring-1 ring-primary-dark rounded-b-none": y && l.length,
237
- "ring-1 ring-red-400 overflow-visible": d.length === 0 && r
237
+ "ring-1 ring-primary-dark rounded-b-none": y && i.length,
238
+ "ring-1 ring-red-400 overflow-visible": c.length === 0 && n
238
239
  }
239
240
  ),
240
- onBlur: i,
241
+ onBlur: s,
241
242
  children: [
242
- d.length === 0 && !y && r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: d.length === 0 && "At least one HTTP verb is required" }),
243
- d.map(
244
- function(u, N) {
243
+ c.length === 0 && !y && n && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: c.length === 0 && "At least one HTTP verb is required" }),
244
+ c.map(
245
+ function(h, N) {
245
246
  return /* @__PURE__ */ o(
246
247
  "span",
247
248
  {
248
249
  className: C(
249
250
  "bg-grey-600 text-s mr-1 flex items-center rounded px-1 py-0.5 uppercase",
250
251
  {
251
- "bg-red-400": !c.includes(u)
252
+ "bg-red-400": !d.includes(h)
252
253
  }
253
254
  ),
254
- ...p({
255
- selectedItem: u,
255
+ ...u({
256
+ selectedItem: h,
256
257
  index: N
257
258
  }),
258
259
  children: [
259
- u,
260
+ h,
260
261
  /* @__PURE__ */ e(
261
262
  "span",
262
263
  {
263
264
  onClick: (P) => {
264
- P.stopPropagation(), v(u);
265
+ P.stopPropagation(), b(h);
265
266
  },
266
267
  className: "hover:bg-primary-hover ml-2 inline-block cursor-pointer rounded p-0.5 text-gray-100 hover:text-white active:outline-none",
267
- children: /* @__PURE__ */ e(q, {})
268
+ children: /* @__PURE__ */ e(B, {})
268
269
  }
269
270
  )
270
271
  ]
271
272
  },
272
- `selected-item-${N}-${u}`
273
+ `selected-item-${N}-${h}`
273
274
  );
274
275
  }
275
276
  ),
276
277
  /* @__PURE__ */ e(
277
278
  "input",
278
279
  {
279
- ...D(
280
- b(
280
+ ...T(
281
+ v(
281
282
  { preventKeyAction: y },
282
283
  { suppressRefError: !0 }
283
284
  )
284
285
  ),
285
286
  className: "flex-grow border-none bg-transparent px-1 py-1 text-xs outline-none",
286
- placeholder: d.length === 0 ? "Select HTTP verbs" : "",
287
+ placeholder: c.length === 0 ? "Select HTTP verbs" : "",
287
288
  size: 1
288
289
  }
289
290
  ),
@@ -293,7 +294,7 @@ const Je = ({
293
294
  className: "absolute inset-y-0 right-0 flex items-center pr-2",
294
295
  type: "button",
295
296
  ...w(),
296
- children: /* @__PURE__ */ e(K, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
297
+ children: /* @__PURE__ */ e(Q, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
297
298
  }
298
299
  )
299
300
  ]
@@ -302,76 +303,76 @@ const Je = ({
302
303
  /* @__PURE__ */ e(
303
304
  "ul",
304
305
  {
305
- className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y && l.length) && "hidden"}`,
306
+ className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y && i.length) && "hidden"}`,
306
307
  ...I(),
307
- children: y && l.map((h, u) => /* @__PURE__ */ e(
308
+ children: y && i.map((g, h) => /* @__PURE__ */ e(
308
309
  "li",
309
310
  {
310
311
  className: C(
311
- T === u && "bg-primary-hover",
312
- R === h && "font-bold",
312
+ D === h && "bg-primary-hover",
313
+ S === g && "font-bold",
313
314
  "flex flex-col p-1 shadow-sm"
314
315
  ),
315
- ...H({ item: h, index: u }),
316
- children: /* @__PURE__ */ e("span", { children: h })
316
+ ...H({ item: g, index: h }),
317
+ children: /* @__PURE__ */ e("span", { children: g })
317
318
  },
318
- `${h}${u}`
319
+ `${g}${h}`
319
320
  ))
320
321
  }
321
322
  )
322
323
  ] });
323
- }, Ye = ({
324
+ }, st = ({
324
325
  value: t,
325
326
  options: a,
326
- errorMessage: r = "",
327
- onChange: i,
328
- onBlur: c
327
+ errorMessage: n = "",
328
+ onChange: s,
329
+ onBlur: d
329
330
  }) => {
330
- const [x, f] = _(""), g = a.find((n) => n.name === t), d = x === "" ? a : a.filter((n) => n.name.toLowerCase().includes(x.toLowerCase()));
331
+ const [p, m] = _(""), f = a.find((r) => r.name === t), c = p === "" ? a : a.filter((r) => r.name.toLowerCase().includes(p.toLowerCase()));
331
332
  return /* @__PURE__ */ e(
332
- S,
333
+ R,
333
334
  {
334
335
  value: { name: t },
335
- onChange: (n) => i(n.name),
336
- children: ({ open: n }) => /* @__PURE__ */ o("div", { className: "relative w-full", children: [
336
+ onChange: (r) => s(r.name),
337
+ children: ({ open: r }) => /* @__PURE__ */ o("div", { className: "relative w-full", children: [
337
338
  /* @__PURE__ */ o(
338
339
  "div",
339
340
  {
340
341
  className: C(
341
342
  "bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
342
343
  {
343
- "ring-1 ring-red-400": !g && t || r,
344
- "ring-1 ring-primary-dark rounded-b-none": n,
345
- "overflow-visible": !g && !n && r
344
+ "ring-1 ring-red-400": !f && t || n,
345
+ "ring-1 ring-primary-dark rounded-b-none": r,
346
+ "overflow-visible": !f && !r && n
346
347
  }
347
348
  ),
348
349
  children: [
349
350
  /* @__PURE__ */ e(
350
- S.Input,
351
+ R.Input,
351
352
  {
352
353
  className: C(
353
354
  "bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none rounded",
354
355
  {
355
- "!text-red-400": !g
356
+ "!text-red-400": !f
356
357
  }
357
358
  ),
358
- displayValue: (l) => l.name,
359
- onChange: (l) => f(l.target.value),
359
+ displayValue: (i) => i.name,
360
+ onChange: (i) => m(i.target.value),
360
361
  style: { caretColor: "white" },
361
- onBlur: c
362
+ onBlur: d
362
363
  }
363
364
  ),
364
365
  /* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
365
- !g && !n && r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: r }),
366
- t ? /* @__PURE__ */ o(G, { children: [
366
+ !f && !r && n && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: n }),
367
+ t ? /* @__PURE__ */ o(O, { children: [
367
368
  /* @__PURE__ */ e(
368
369
  "button",
369
370
  {
370
371
  onClick: () => {
371
- f(""), i("");
372
+ m(""), s("");
372
373
  },
373
374
  children: /* @__PURE__ */ e(
374
- q,
375
+ B,
375
376
  {
376
377
  className: "text-grey-50 h-3 w-3",
377
378
  "aria-hidden": "true"
@@ -381,36 +382,36 @@ const Je = ({
381
382
  ),
382
383
  /* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
383
384
  ] }) : null,
384
- /* @__PURE__ */ e(S.Button, { children: /* @__PURE__ */ e(K, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
385
+ /* @__PURE__ */ e(R.Button, { children: /* @__PURE__ */ e(Q, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
385
386
  ] })
386
387
  ]
387
388
  }
388
389
  ),
389
390
  /* @__PURE__ */ e(
390
- oe,
391
+ ue,
391
392
  {
392
- as: se,
393
+ as: de,
393
394
  leave: "transition ease-in durati pb-0.5on-100",
394
395
  leaveFrom: "opacity-100",
395
396
  leaveTo: "opacity-0",
396
- afterLeave: () => f(""),
397
- children: /* @__PURE__ */ e(S.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: d.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
398
- /* @__PURE__ */ e(J, { className: "inline h-4 w-4" }),
397
+ afterLeave: () => m(""),
398
+ children: /* @__PURE__ */ e(R.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: c.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
399
+ /* @__PURE__ */ e(X, { className: "inline h-4 w-4" }),
399
400
  " Nothing found."
400
- ] }) : d.map((l, p) => /* @__PURE__ */ e(
401
- S.Option,
401
+ ] }) : c.map((i, u) => /* @__PURE__ */ e(
402
+ R.Option,
402
403
  {
403
- className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
404
- value: l,
405
- children: ({ selected: b }) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ e(
404
+ className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
405
+ value: i,
406
+ children: ({ selected: v }) => /* @__PURE__ */ e(O, { children: /* @__PURE__ */ e(
406
407
  "span",
407
408
  {
408
- className: `block truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
409
- children: l.name
409
+ className: `block truncate p-2 py-1 ${v ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
410
+ children: i.name
410
411
  }
411
412
  ) })
412
413
  },
413
- p
414
+ u
414
415
  )) })
415
416
  }
416
417
  )
@@ -418,64 +419,64 @@ const Je = ({
418
419
  },
419
420
  t
420
421
  );
421
- }, Ze = ({
422
+ }, lt = ({
422
423
  value: t,
423
424
  options: a,
424
- onChange: r,
425
- errorMessage: i,
426
- onBlur: c
425
+ onChange: n,
426
+ errorMessage: s,
427
+ onBlur: d
427
428
  }) => {
428
- const [x, f] = _(""), g = a.find((l) => l.name === t), d = g && g.exposed, n = x === "" ? a : a.filter((l) => l.name.toLowerCase().includes(x.toLowerCase()));
429
- return /* @__PURE__ */ e(S, { value: { name: t }, onChange: (l) => r(l.name), children: ({ open: l }) => /* @__PURE__ */ o("div", { className: "relative", children: [
429
+ const [p, m] = _(""), f = a.find((i) => i.name === t), c = f && f.exposed, r = p === "" ? a : a.filter((i) => i.name.toLowerCase().includes(p.toLowerCase()));
430
+ return /* @__PURE__ */ e(R, { value: { name: t }, onChange: (i) => n(i.name), children: ({ open: i }) => /* @__PURE__ */ o("div", { className: "relative", children: [
430
431
  /* @__PURE__ */ o(
431
432
  "div",
432
433
  {
433
434
  className: C(
434
435
  "bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
435
436
  {
436
- "ring-1 ring-red-400": i,
437
- "ring-1 ring-yellow-500": d,
438
- "ring-1 ring-primary-dark rounded-b-none": l,
439
- "overflow-visible": !l && i
437
+ "ring-1 ring-red-400": s,
438
+ "ring-1 ring-yellow-500": c,
439
+ "ring-1 ring-primary-dark rounded-b-none": i,
440
+ "overflow-visible": !i && s
440
441
  }
441
442
  ),
442
443
  children: [
443
444
  /* @__PURE__ */ e(
444
- S.Input,
445
+ R.Input,
445
446
  {
446
447
  className: C(
447
448
  "bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none truncate rounded",
448
449
  {
449
- "!text-red-400": i,
450
- "!text-yellow-500": d
450
+ "!text-red-400": s,
451
+ "!text-yellow-500": c
451
452
  }
452
453
  ),
453
454
  style: { caretColor: "white" },
454
- displayValue: (p) => p.name,
455
- onChange: (p) => f(p.target.value),
456
- onBlur: c
455
+ displayValue: (u) => u.name,
456
+ onChange: (u) => m(u.target.value),
457
+ onBlur: d
457
458
  }
458
459
  ),
459
- !l && i && /* @__PURE__ */ e(
460
+ !i && s && /* @__PURE__ */ e(
460
461
  "div",
461
462
  {
462
463
  className: C(
463
464
  "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600",
464
- { "!text-yellow-500 ring-yellow-500 bg-white": d }
465
+ { "!text-yellow-500 ring-yellow-500 bg-white": c }
465
466
  ),
466
- children: i
467
+ children: s
467
468
  }
468
469
  ),
469
470
  /* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
470
- t ? /* @__PURE__ */ o(G, { children: [
471
+ t ? /* @__PURE__ */ o(O, { children: [
471
472
  /* @__PURE__ */ e(
472
473
  "button",
473
474
  {
474
475
  onClick: () => {
475
- f(""), r("");
476
+ m(""), n("");
476
477
  },
477
478
  children: /* @__PURE__ */ e(
478
- q,
479
+ B,
479
480
  {
480
481
  className: "text-grey-50 h-3 w-3",
481
482
  "aria-hidden": "true"
@@ -485,126 +486,126 @@ const Je = ({
485
486
  ),
486
487
  /* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
487
488
  ] }) : null,
488
- /* @__PURE__ */ e(S.Button, { children: /* @__PURE__ */ e(K, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
489
+ /* @__PURE__ */ e(R.Button, { children: /* @__PURE__ */ e(Q, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
489
490
  ] })
490
491
  ]
491
492
  }
492
493
  ),
493
494
  /* @__PURE__ */ e(
494
- oe,
495
+ ue,
495
496
  {
496
- as: se,
497
+ as: de,
497
498
  leave: "transition ease-in duration-100",
498
499
  leaveFrom: "opacity-100",
499
500
  leaveTo: "opacity-0",
500
- afterLeave: () => f(""),
501
- children: /* @__PURE__ */ e(S.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: n.length ? n.map((p, b) => /* @__PURE__ */ e(
502
- S.Option,
501
+ afterLeave: () => m(""),
502
+ children: /* @__PURE__ */ e(R.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: r.length ? r.map((u, v) => /* @__PURE__ */ e(
503
+ R.Option,
503
504
  {
504
- className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
505
- value: p,
506
- children: ({ selected: v }) => /* @__PURE__ */ e(G, { children: /* @__PURE__ */ o(
505
+ className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
506
+ value: u,
507
+ children: ({ selected: b }) => /* @__PURE__ */ e(O, { children: /* @__PURE__ */ o(
507
508
  "span",
508
509
  {
509
- className: `text-s flex items-center gap-2 truncate p-2 py-1 ${v ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
510
+ className: `text-s flex items-center gap-2 truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
510
511
  children: [
511
- p.exposed && /* @__PURE__ */ e(j, { className: "text-yellow-500" }),
512
- /* @__PURE__ */ e("span", { className: "flex-1 truncate", title: p.name, children: p.name })
512
+ u.exposed && /* @__PURE__ */ e(q, { className: "text-yellow-500" }),
513
+ /* @__PURE__ */ e("span", { className: "flex-1 truncate", title: u.name, children: u.name })
513
514
  ]
514
515
  }
515
516
  ) })
516
517
  },
517
- b
518
+ v
518
519
  )) : /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5", children: [
519
- /* @__PURE__ */ e(J, { className: "inline h-4 w-4" }),
520
+ /* @__PURE__ */ e(X, { className: "inline h-4 w-4" }),
520
521
  " Nothing found."
521
522
  ] }) })
522
523
  }
523
524
  )
524
525
  ] }) });
525
- }, pe = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(Se, {}) }), ue = (t) => {
526
- var r;
526
+ }, ge = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(_e, {}) }), xe = (t) => {
527
+ var n;
527
528
  if (!t) return "";
528
529
  let a;
529
- Z.prototype.max = 8;
530
+ te.prototype.max = 8;
530
531
  try {
531
- a = (r = new Z(t)) == null ? void 0 : r.gen();
532
+ a = (n = new te(t)) == null ? void 0 : n.gen();
532
533
  } catch {
533
534
  a = "";
534
535
  }
535
536
  return `Requests matching regex will be handled example: ${a}`;
536
- }, et = ({
537
+ }, it = ({
537
538
  id: t,
538
539
  class: a,
539
- method: r,
540
- pattern: i,
541
- verbs: c,
542
- regexPattern: x,
543
- asRegex: f,
544
- listeners: g,
545
- attributes: d
540
+ method: n,
541
+ pattern: s,
542
+ verbs: d,
543
+ regexPattern: p,
544
+ asRegex: m,
545
+ listeners: f,
546
+ attributes: c
546
547
  }) => {
547
548
  var P;
548
- const [n, l] = _({
549
+ const [r, i] = _({
549
550
  className: a,
550
- method: r,
551
- pattern: i,
552
- verbs: c,
553
- asRegex: f,
554
- regexPattern: x
555
- }), p = W(re), b = Object.values((p == null ? void 0 : p.singletons) || {}), v = (P = b.find((s) => s.name === n.className)) == null ? void 0 : P.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), {
551
+ method: n,
552
+ pattern: s,
553
+ verbs: d,
554
+ asRegex: m,
555
+ regexPattern: p
556
+ }), u = M(se), v = Object.values((u == null ? void 0 : u.singletons) || {}), b = (P = v.find((l) => l.name === r.className)) == null ? void 0 : P.methods.map(({ name: l, exposed: x }) => ({ name: l, exposed: x })), {
556
557
  dispatch: y,
557
558
  state: { newlyCreatedHandlerID: w }
558
- } = Q(), I = B();
559
- function D() {
560
- const { className: s, method: m, asRegex: k, regexPattern: U, pattern: z, verbs: M } = n;
561
- return !!(s && m && (k ? U : !z.endsWith("/")) && M.length);
562
- }
559
+ } = Y(), I = $();
563
560
  function T() {
564
- if (D()) {
565
- const { className: s, method: m, asRegex: k, regexPattern: U, pattern: z, verbs: M } = n;
561
+ const { className: l, method: x, asRegex: A, regexPattern: U, pattern: z, verbs: J } = r;
562
+ return !!(l && x && (A ? U : !z.endsWith("/")) && J.length);
563
+ }
564
+ function D() {
565
+ if (T()) {
566
+ const { className: l, method: x, asRegex: A, regexPattern: U, pattern: z, verbs: J } = r;
566
567
  y({
567
568
  type: "UPDATE_HANDLER",
568
569
  id: t,
569
570
  payload: {
570
- class: s,
571
- method: m,
572
- verbs: M,
573
- asRegex: k,
574
- ...k ? { regexPattern: U } : { pattern: z }
571
+ class: l,
572
+ method: x,
573
+ verbs: J,
574
+ asRegex: A,
575
+ ...A ? { regexPattern: U } : { pattern: z }
575
576
  }
576
577
  }), y({ type: "SET_EDITING_HANDLER", payload: null });
577
578
  }
578
579
  }
579
580
  const H = async () => {
580
- const s = {
581
+ const l = {
581
582
  className: a,
582
- method: r,
583
- pattern: i,
584
- regexPattern: x,
585
- verbs: c
586
- }, m = de(n, ["id", "isExpanded"]);
587
- if (!D()) {
583
+ method: n,
584
+ pattern: s,
585
+ regexPattern: p,
586
+ verbs: d
587
+ }, x = he(r, ["id", "isExpanded"]);
588
+ if (!T()) {
588
589
  y({ type: "DELETE_HANDLER", id: `${w}` }), y({ type: "SET_EDITING_HANDLER", payload: null });
589
590
  return;
590
591
  }
591
- if (!Ve(s, m)) {
592
- const { confirmed: k } = await I(
593
- ae({
592
+ if (!V(l, x)) {
593
+ const { confirmed: A } = await I(
594
+ le({
594
595
  title: "Cancel Changes",
595
- type: ie.CONFIRM,
596
- color: le.DANGER,
596
+ type: pe.CONFIRM,
597
+ color: ce.DANGER,
597
598
  message: "Are you sure you want to cancel changes made to this Handler?",
598
599
  icon: "FdWarningDanger"
599
600
  })
600
601
  ).unwrap();
601
- if (k) {
602
+ if (A) {
602
603
  w === t && y({ type: "DELETE_HANDLER", id: t }), y({ type: "SET_EDITING_HANDLER", payload: null });
603
604
  return;
604
605
  }
605
606
  }
606
607
  };
607
- Be(
608
+ Ke(
608
609
  "esc",
609
610
  () => {
610
611
  setTimeout(() => {
@@ -612,74 +613,74 @@ const Je = ({
612
613
  }, 100);
613
614
  },
614
615
  []
615
- ), O(() => {
616
- $.subscribe((s) => {
617
- s === t && T();
616
+ ), F(() => {
617
+ G.subscribe((l) => {
618
+ l === t && D();
618
619
  });
619
- }, [n, t]);
620
- const [R, h] = _({ className: !1, method: !1, pattern: !1, verbs: !1 }), u = () => {
621
- if (R.method && !n.method)
620
+ }, [r, t]);
621
+ const [S, g] = _({ className: !1, method: !1, pattern: !1, verbs: !1 }), h = () => {
622
+ if (S.method && !r.method)
622
623
  return "Method is required";
623
- if (v) {
624
- const s = v == null ? void 0 : v.find(
625
- (m) => m.name === n.method
624
+ if (b) {
625
+ const l = b == null ? void 0 : b.find(
626
+ (x) => x.name === r.method
626
627
  );
627
- if (n.method && !s)
628
- return `The method "${n.method}" doesn't exist.`;
629
- if (s && s.exposed)
630
- return `Method "${n.method}" is already exposed`;
628
+ if (r.method && !l)
629
+ return `The method "${r.method}" doesn't exist.`;
630
+ if (l && l.exposed)
631
+ return `Method "${r.method}" is already exposed`;
631
632
  }
632
633
  }, N = () => {
633
- if (R.pattern) {
634
- if (n.asRegex && !n.regexPattern)
634
+ if (S.pattern) {
635
+ if (r.asRegex && !r.regexPattern)
635
636
  return "Pattern is required";
636
- if (!n.asRegex && n.pattern.endsWith("/"))
637
+ if (!r.asRegex && r.pattern.endsWith("/"))
637
638
  return 'Pattern should not end with a "/"';
638
639
  }
639
640
  };
640
641
  return /* @__PURE__ */ o("div", { className: "flex items-center gap-2 rounded-b py-2", children: [
641
642
  /* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1", children: [
642
643
  /* @__PURE__ */ e(
643
- pe,
644
+ ge,
644
645
  {
645
- listeners: g,
646
- attributes: d
646
+ listeners: f,
647
+ attributes: c
647
648
  },
648
649
  "grab-handle"
649
650
  ),
650
651
  /* @__PURE__ */ e(
651
- Ye,
652
+ st,
652
653
  {
653
- value: n.className,
654
- onChange: (s) => {
655
- l((m) => ({ ...m, className: s }));
654
+ value: r.className,
655
+ onChange: (l) => {
656
+ i((x) => ({ ...x, className: l }));
656
657
  },
657
- onBlur: () => h((s) => ({ ...s, className: !0 })),
658
- options: b,
659
- errorMessage: R.className && !n.className ? "Class name is required" : n.className !== "" && !b.find((s) => s.name === n.className) ? `The singleton "${n.className}" doesn't exist.` : void 0
658
+ onBlur: () => g((l) => ({ ...l, className: !0 })),
659
+ options: v,
660
+ errorMessage: S.className && !r.className ? "Class name is required" : r.className !== "" && !v.find((l) => l.name === r.className) ? `The singleton "${r.className}" doesn't exist.` : void 0
660
661
  },
661
662
  a
662
663
  )
663
664
  ] }),
664
665
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0", children: /* @__PURE__ */ e(
665
- Ze,
666
+ lt,
666
667
  {
667
- value: n.method,
668
- onChange: (s) => {
669
- l((m) => ({ ...m, method: s }));
668
+ value: r.method,
669
+ onChange: (l) => {
670
+ i((x) => ({ ...x, method: l }));
670
671
  },
671
- options: v || [],
672
- errorMessage: u(),
673
- onBlur: () => h((s) => ({ ...s, method: !0 }))
672
+ options: b || [],
673
+ errorMessage: h(),
674
+ onBlur: () => g((l) => ({ ...l, method: !0 }))
674
675
  }
675
676
  ) }),
676
677
  /* @__PURE__ */ o("div", { className: "relative w-60 flex-shrink-0 flex items-center gap-1 overflow-visible", children: [
677
678
  /* @__PURE__ */ e(
678
679
  E,
679
680
  {
680
- label: n.asRegex ? ue(n.regexPattern) : n.pattern && !n.pattern.endsWith("/") ? `Requests starting with /${n.pattern}/ will be handled` : "",
681
+ label: r.asRegex ? xe(r.regexPattern) : r.pattern && !r.pattern.endsWith("/") ? `Requests starting with /${r.pattern}/ will be handled` : "",
681
682
  children: /* @__PURE__ */ o("div", { className: "relative w-full", children: [
682
- !n.asRegex && /* @__PURE__ */ e("span", { className: "absolute text-s inset-y-0 left-1 flex items-center gap-2", children: "/" }),
683
+ !r.asRegex && /* @__PURE__ */ e("span", { className: "absolute text-s inset-y-0 left-1 flex items-center gap-2", children: "/" }),
683
684
  /* @__PURE__ */ e(
684
685
  "input",
685
686
  {
@@ -687,36 +688,36 @@ const Je = ({
687
688
  className: C(
688
689
  "bg-grey-300 text-s block w-full rounded p-1 pl-3 focus:outline-none focus:ring-1 focus:ring-primary-dark",
689
690
  {
690
- "focus:ring-red-400 ring-1 ring-red-400": R.pattern && n.asRegex && !n.regexPattern
691
+ "focus:ring-red-400 ring-1 ring-red-400": S.pattern && r.asRegex && !r.regexPattern
691
692
  }
692
693
  ),
693
- value: n.asRegex ? n.regexPattern : n.pattern,
694
- onChange: (s) => {
695
- l((m) => ({
696
- ...m,
697
- [n.asRegex ? "regexPattern" : "pattern"]: s.target.value
694
+ value: r.asRegex ? r.regexPattern : r.pattern,
695
+ onChange: (l) => {
696
+ i((x) => ({
697
+ ...x,
698
+ [r.asRegex ? "regexPattern" : "pattern"]: l.target.value
698
699
  }));
699
700
  },
700
- onBlur: () => h((s) => ({ ...s, pattern: !0 })),
701
- placeholder: n.asRegex ? "Required" : ""
701
+ onBlur: () => g((l) => ({ ...l, pattern: !0 })),
702
+ placeholder: r.asRegex ? "Required" : ""
702
703
  }
703
704
  ),
704
705
  N() && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: N() })
705
706
  ] })
706
707
  }
707
708
  ),
708
- (f ? x : i) && /* @__PURE__ */ e(
709
+ (m ? p : s) && /* @__PURE__ */ e(
709
710
  "button",
710
711
  {
711
- onClick: (s) => {
712
- s.stopPropagation(), l((m) => ({
713
- ...m,
714
- [n.asRegex ? "regexPattern" : "pattern"]: ""
712
+ onClick: (l) => {
713
+ l.stopPropagation(), i((x) => ({
714
+ ...x,
715
+ [r.asRegex ? "regexPattern" : "pattern"]: ""
715
716
  }));
716
717
  },
717
718
  className: "absolute inset-y-0 right-6 flex items-center gap-2 pr-2",
718
719
  children: /* @__PURE__ */ e(
719
- q,
720
+ B,
720
721
  {
721
722
  className: "text-grey-200 h-3 w-3",
722
723
  "aria-hidden": "true"
@@ -727,28 +728,28 @@ const Je = ({
727
728
  /* @__PURE__ */ e(
728
729
  E,
729
730
  {
730
- label: n.asRegex ? "Requests matching this regex will be handled. Check the match with the __[Match regex command](https://developer.4d.com/docs/commands/match-regex)__" : `Prefixes are considered as regular expressions already containing starting and ending /
731
+ label: r.asRegex ? "Requests matching this regex will be handled. Check the match with the __[Match regex command](https://developer.4d.com/docs/commands/match-regex)__" : `Prefixes are considered as regular expressions already containing starting and ending /
731
732
 
732
733
  __[documentation](https://developer.qodly.com/docs/studio/httpHandlers)__`,
733
- children: /* @__PURE__ */ e("span", { className: "rounded hover:bg-gray-400/30 w-6 h-6 flex items-center content-center justify-center", children: /* @__PURE__ */ e(ne, { className: "inline h-4 w-4 text-gray-100" }) })
734
+ children: /* @__PURE__ */ e("span", { className: "rounded hover:bg-gray-400/30 w-6 h-6 flex items-center content-center justify-center", children: /* @__PURE__ */ e(ae, { className: "inline h-4 w-4 text-gray-100" }) })
734
735
  }
735
736
  )
736
737
  ] }),
737
738
  /* @__PURE__ */ e("div", { className: "w-20 px-2 flex justify-center", children: /* @__PURE__ */ e(
738
- Ue,
739
+ We,
739
740
  {
740
- value: !!n.asRegex,
741
- onChange: (s) => {
742
- const m = s ? { regexPattern: i, asRegex: s } : { pattern: x, asRegex: s };
743
- l((k) => ({ ...k, ...m }));
741
+ value: !!r.asRegex,
742
+ onChange: (l) => {
743
+ const x = l ? { regexPattern: s, asRegex: l } : { pattern: p, asRegex: l };
744
+ i((A) => ({ ...A, ...x }));
744
745
  },
745
- className: `${n.asRegex ? "bg-primary-dark" : "bg-grey-300"}
746
+ className: `${r.asRegex ? "bg-primary-dark" : "bg-grey-300"}
746
747
  relative inline-flex h-5 w-8 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,
747
748
  children: /* @__PURE__ */ e(
748
749
  "span",
749
750
  {
750
751
  "aria-hidden": "true",
751
- className: `${n.asRegex ? "translate-x-3" : "translate-x-0"}
752
+ className: `${r.asRegex ? "translate-x-3" : "translate-x-0"}
752
753
  pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0 transition duration-200 ease-in-out`
753
754
  }
754
755
  )
@@ -756,14 +757,14 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
756
757
  ) }),
757
758
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
758
759
  /* @__PURE__ */ e(
759
- Xe,
760
+ at,
760
761
  {
761
- initialSelectedItems: n.verbs || [],
762
- onChange: (s) => {
763
- l((m) => ({ ...m, verbs: s }));
762
+ initialSelectedItems: r.verbs || [],
763
+ onChange: (l) => {
764
+ i((x) => ({ ...x, verbs: l }));
764
765
  },
765
- touched: R.verbs,
766
- onBlur: () => h((s) => ({ ...s, verbs: !0 }))
766
+ touched: S.verbs,
767
+ onBlur: () => g((l) => ({ ...l, verbs: !0 }))
767
768
  }
768
769
  ),
769
770
  /* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
@@ -773,7 +774,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
773
774
  className: C(
774
775
  "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none opacity-50 cursor-not-allowed"
775
776
  ),
776
- children: /* @__PURE__ */ e(te, {})
777
+ children: /* @__PURE__ */ e(re, {})
777
778
  }
778
779
  ) }),
779
780
  /* @__PURE__ */ e(E, { label: "Confirm Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
@@ -782,11 +783,11 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
782
783
  className: C(
783
784
  "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
784
785
  {
785
- "opacity-50 cursor-not-allowed": !D()
786
+ "opacity-50 cursor-not-allowed": !T()
786
787
  }
787
788
  ),
788
- onClick: T,
789
- children: /* @__PURE__ */ e(Re, {})
789
+ onClick: D,
790
+ children: /* @__PURE__ */ e(Ae, {})
790
791
  }
791
792
  ) }),
792
793
  /* @__PURE__ */ e(E, { label: "Cancel Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
@@ -794,60 +795,60 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
794
795
  {
795
796
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
796
797
  onClick: H,
797
- children: /* @__PURE__ */ e(Pe, {})
798
+ children: /* @__PURE__ */ e(ke, {})
798
799
  }
799
800
  ) })
800
801
  ] })
801
802
  ] })
802
803
  ] });
803
- }, ee = ({
804
+ }, ne = ({
804
805
  id: t,
805
806
  class: a,
806
- method: r,
807
- pattern: i,
808
- verbs: c,
809
- isExpanded: x,
810
- regexPattern: f,
811
- asRegex: g
807
+ method: n,
808
+ pattern: s,
809
+ verbs: d,
810
+ isExpanded: p,
811
+ regexPattern: m,
812
+ asRegex: f
812
813
  }) => {
813
814
  var P;
814
- const { attributes: d, listeners: n, setNodeRef: l, transform: p, transition: b } = be({ id: t }), v = {
815
- transform: Me.Transform.toString(p),
816
- transition: b
815
+ const { attributes: c, listeners: r, setNodeRef: i, transform: u, transition: v } = Ee({ id: t }), b = {
816
+ transform: Ye.Transform.toString(u),
817
+ transition: v
817
818
  }, {
818
819
  dispatch: y,
819
820
  state: { editing: w }
820
- } = Q(), I = B(), D = g ? f : i, T = W(re), H = Object.values((T == null ? void 0 : T.singletons) || {}), R = (P = H == null ? void 0 : H.find((s) => s.name === a)) == null ? void 0 : P.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), h = H == null ? void 0 : H.find(
821
- (s) => s.name === a
822
- ), u = R == null ? void 0 : R.find((s) => s.name === r), N = u && u.exposed;
823
- return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: l, style: v, children: w === t ? /* @__PURE__ */ e(
824
- et,
821
+ } = Y(), I = $(), T = f ? m : s, D = M(se), H = Object.values((D == null ? void 0 : D.singletons) || {}), S = (P = H == null ? void 0 : H.find((l) => l.name === a)) == null ? void 0 : P.methods.map(({ name: l, exposed: x }) => ({ name: l, exposed: x })), g = H == null ? void 0 : H.find(
822
+ (l) => l.name === a
823
+ ), h = S == null ? void 0 : S.find((l) => l.name === n), N = h && h.exposed;
824
+ return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: i, style: b, children: w === t ? /* @__PURE__ */ e(
825
+ it,
825
826
  {
826
827
  id: t,
827
828
  class: a,
828
- method: r,
829
- pattern: i,
830
- verbs: c,
831
- isExpanded: x,
832
- regexPattern: f,
833
- asRegex: g,
834
- listeners: n,
835
- attributes: d
829
+ method: n,
830
+ pattern: s,
831
+ verbs: d,
832
+ isExpanded: p,
833
+ regexPattern: m,
834
+ asRegex: f,
835
+ listeners: r,
836
+ attributes: c
836
837
  }
837
838
  ) : /* @__PURE__ */ o(
838
839
  "div",
839
840
  {
840
841
  className: "flex items-center gap-2 rounded-b py-2.5 text-grey-50",
841
842
  onDoubleClick: () => {
842
- $.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
843
+ G.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
843
844
  },
844
845
  children: [
845
846
  /* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1 ", children: [
846
847
  /* @__PURE__ */ e(
847
- pe,
848
+ ge,
848
849
  {
849
- listeners: n,
850
- attributes: d
850
+ listeners: r,
851
+ attributes: c
851
852
  },
852
853
  "grab-handle"
853
854
  ),
@@ -856,15 +857,15 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
856
857
  {
857
858
  className: C(
858
859
  "flex items-center gap-2",
859
- !h && "text-red-400"
860
+ !g && "text-red-400"
860
861
  ),
861
862
  children: [
862
- !h && /* @__PURE__ */ e(
863
+ !g && /* @__PURE__ */ e(
863
864
  E,
864
865
  {
865
866
  label: `The singleton "${a}" doesn't exist.`,
866
867
  className: "!bg-red-300 !text-red-400",
867
- children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(j, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
868
+ children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
868
869
  }
869
870
  ),
870
871
  " ",
@@ -873,54 +874,54 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
873
874
  }
874
875
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) })
875
876
  ] }),
876
- /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 ", children: /* @__PURE__ */ e("div", { className: "text-s w-full", children: r ? /* @__PURE__ */ o(
877
+ /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 ", children: /* @__PURE__ */ e("div", { className: "text-s w-full", children: n ? /* @__PURE__ */ o(
877
878
  "div",
878
879
  {
879
880
  className: C(
880
881
  "flex items-center gap-2",
881
- !u && "text-red-400",
882
+ !h && "text-red-400",
882
883
  N && "text-yellow-400"
883
884
  ),
884
885
  children: [
885
- !u && /* @__PURE__ */ e(
886
+ !h && /* @__PURE__ */ e(
886
887
  E,
887
888
  {
888
- label: `The method "${r}" doesn't exist.`,
889
+ label: `The method "${n}" doesn't exist.`,
889
890
  className: "!bg-red-300 !text-red-400",
890
- children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(j, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
891
+ children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
891
892
  }
892
893
  ),
893
894
  " ",
894
895
  N && /* @__PURE__ */ e(
895
896
  E,
896
897
  {
897
- label: `Method "${r}" is already exposed`,
898
+ label: `Method "${n}" is already exposed`,
898
899
  className: "!bg-yellow-100 !text-yellow-500",
899
- children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(j, { className: "inline h-4 w-4 pb-0.5 text-yellow-500" }) })
900
+ children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-yellow-500" }) })
900
901
  }
901
902
  ),
902
903
  " ",
903
- r
904
+ n
904
905
  ]
905
906
  }
906
907
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }) }),
907
- /* @__PURE__ */ e("div", { className: "text-s relative w-60 flex-shrink-0 ", children: D ? /* @__PURE__ */ e(
908
+ /* @__PURE__ */ e("div", { className: "text-s relative w-60 flex-shrink-0 ", children: T ? /* @__PURE__ */ e(
908
909
  E,
909
910
  {
910
- label: g ? ue(D) : `Requests starting with /${D}/ will be handled`,
911
- children: /* @__PURE__ */ e("span", { children: D })
911
+ label: f ? xe(T) : `Requests starting with /${T}/ will be handled`,
912
+ children: /* @__PURE__ */ e("span", { children: T })
912
913
  }
913
914
  ) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "/" }) }),
914
- /* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: g ? /* @__PURE__ */ e(Ce, {}) : /* @__PURE__ */ e(De, {}) }),
915
+ /* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: f ? /* @__PURE__ */ e(Se, {}) : /* @__PURE__ */ e(Pe, {}) }),
915
916
  /* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
916
- /* @__PURE__ */ e("div", { className: "text-s w-full", children: c.length ? c.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
917
+ /* @__PURE__ */ e("div", { className: "text-s w-full", children: d.length ? d.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
917
918
  /* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
918
919
  /* @__PURE__ */ e(E, { label: "Duplicate Handler", className: "px-1 py-3", children: /* @__PURE__ */ e(
919
920
  "button",
920
921
  {
921
922
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
922
923
  onClick: () => y({ type: "DUPLICATE_HANDLER", id: t }),
923
- children: /* @__PURE__ */ e(te, {})
924
+ children: /* @__PURE__ */ e(re, {})
924
925
  }
925
926
  ) }),
926
927
  /* @__PURE__ */ e(E, { label: "Edit Handler", className: "px-1 py-3", children: /* @__PURE__ */ e(
@@ -928,9 +929,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
928
929
  {
929
930
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
930
931
  onClick: () => {
931
- $.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
932
+ G.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
932
933
  },
933
- children: /* @__PURE__ */ e(Te, {})
934
+ children: /* @__PURE__ */ e(Re, {})
934
935
  }
935
936
  ) }),
936
937
  /* @__PURE__ */ e(E, { label: "Delete Handler", className: "px-1 py-3", placement: "top-end", children: /* @__PURE__ */ e(
@@ -938,18 +939,18 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
938
939
  {
939
940
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
940
941
  onClick: async () => {
941
- const { confirmed: s } = await I(
942
- ae({
942
+ const { confirmed: l } = await I(
943
+ le({
943
944
  title: "Delete Handler",
944
- type: ie.CONFIRM,
945
- color: le.DANGER,
945
+ type: pe.CONFIRM,
946
+ color: ce.DANGER,
946
947
  message: "Are you sure you want to remove this Handler?",
947
948
  icon: "FdWarningDanger"
948
949
  })
949
950
  ).unwrap();
950
- s && y({ type: "DELETE_HANDLER", id: t });
951
+ l && y({ type: "DELETE_HANDLER", id: t });
951
952
  },
952
- children: /* @__PURE__ */ e(He, {})
953
+ children: /* @__PURE__ */ e(Ie, {})
953
954
  }
954
955
  ) })
955
956
  ] })
@@ -957,52 +958,52 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
957
958
  ]
958
959
  }
959
960
  ) });
960
- }, tt = A.object({
961
- class: A.string().optional(),
962
- method: A.string().optional(),
963
- verbs: A.string().optional(),
964
- id: A.string().optional(),
965
- pattern: A.string().optional(),
966
- regexPattern: A.string().optional()
967
- }), nt = A.array(tt), rt = ({ path: t }) => {
968
- const a = W(Ae(t)), {
969
- dispatch: r,
970
- state: { content: i, editing: c }
971
- } = Q(), x = he(
972
- X(me),
973
- X(ge, {
974
- coordinateGetter: ve
961
+ }, ot = k.object({
962
+ class: k.string().optional(),
963
+ method: k.string().optional(),
964
+ verbs: k.string().optional(),
965
+ id: k.string().optional(),
966
+ pattern: k.string().optional(),
967
+ regexPattern: k.string().optional()
968
+ }), dt = k.array(ot), ct = ({ path: t }) => {
969
+ const a = M(ie(t)), {
970
+ dispatch: n,
971
+ state: { content: s, editing: d }
972
+ } = Y(), p = fe(
973
+ Z(ye),
974
+ Z(ve, {
975
+ coordinateGetter: Ce
975
976
  })
976
- ), [f, g] = _(null), d = i.find((l) => l.id === f), n = B();
977
- return O(() => {
978
- const l = JSON.stringify(
979
- i.map(
980
- ({ isExpanded: b, asRegex: v, pattern: y, regexPattern: w, ...I }) => {
981
- var T;
982
- const D = v ? { regexPattern: w } : { pattern: y };
977
+ ), [m, f] = _(null), c = s.find((i) => i.id === m), r = $();
978
+ return F(() => {
979
+ const i = JSON.stringify(
980
+ s.map(
981
+ ({ isExpanded: v, asRegex: b, pattern: y, regexPattern: w, ...I }) => {
982
+ var D;
983
+ const T = b ? { regexPattern: w } : { pattern: y };
983
984
  return {
984
985
  ...I,
985
- verbs: (T = I.verbs) == null ? void 0 : T.join(","),
986
- ...D
986
+ verbs: (D = I.verbs) == null ? void 0 : D.join(","),
987
+ ...T
987
988
  };
988
989
  }
989
990
  ),
990
991
  null,
991
992
  2
992
- ), p = typeof (a == null ? void 0 : a.content) == "string" ? a.content : JSON.stringify(a == null ? void 0 : a.content, null, 2);
993
- l !== p && n(
994
- _e({
993
+ ), u = typeof (a == null ? void 0 : a.content) == "string" ? a.content : JSON.stringify(a == null ? void 0 : a.content, null, 2);
994
+ i !== u && r(
995
+ oe({
995
996
  path: t,
996
- content: l
997
+ content: i
997
998
  })
998
999
  );
999
- }, [i]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
1000
+ }, [s]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
1000
1001
  /* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-black p-2", children: [
1001
1002
  a && /* @__PURE__ */ e(
1002
- Je,
1003
+ tt,
1003
1004
  {
1004
1005
  label: "Switch to text Editor",
1005
- Icon: Ie,
1006
+ Icon: Le,
1006
1007
  tab: a,
1007
1008
  editor: {
1008
1009
  config: { language: "json" },
@@ -1011,11 +1012,11 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1011
1012
  }
1012
1013
  ),
1013
1014
  /* @__PURE__ */ o("p", { className: "text-grey-100 text-s flex items-center gap-1", children: [
1014
- /* @__PURE__ */ e(ne, { className: "inline text-base text-white" }),
1015
+ /* @__PURE__ */ e(ae, { className: "inline text-base text-white" }),
1015
1016
  " HTTP handlers are evaluated in the order they are declared"
1016
1017
  ] })
1017
1018
  ] }),
1018
- /* @__PURE__ */ e("div", { className: "mt-1 flex flex-1 flex-col overflow-x-auto px-4", children: i.length ? /* @__PURE__ */ o("div", { className: "flex h-full min-w-[1200px] flex-1 flex-col", children: [
1019
+ /* @__PURE__ */ e("div", { className: "mt-1 flex flex-1 flex-col overflow-x-auto px-4", children: s.length ? /* @__PURE__ */ o("div", { className: "flex h-full min-w-[1200px] flex-1 flex-col", children: [
1019
1020
  /* @__PURE__ */ o("div", { className: "mb-3 flex items-center gap-2 border-b", children: [
1020
1021
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 text-xs", children: /* @__PURE__ */ e("span", { className: "pl-6", children: "Class" }) }),
1021
1022
  /* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0 text-xs", children: "Method" }),
@@ -1026,9 +1027,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1026
1027
  /* @__PURE__ */ e("div", { className: "flex items-center gap-2 text-2xl", children: /* @__PURE__ */ e(E, { label: "Add a new HTTP Handler", children: /* @__PURE__ */ e(
1027
1028
  "button",
1028
1029
  {
1029
- disabled: !!c,
1030
+ disabled: !!d,
1030
1031
  onClick: () => {
1031
- $.next(c), r({
1032
+ G.next(d), n({
1032
1033
  type: "ADD_HANDLER",
1033
1034
  payload: {
1034
1035
  class: "",
@@ -1041,44 +1042,44 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1041
1042
  });
1042
1043
  },
1043
1044
  className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none disabled:cursor-not-allowed disabled:opacity-30",
1044
- children: /* @__PURE__ */ e(Y, { className: "h-5 w-5" })
1045
+ children: /* @__PURE__ */ e(ee, { className: "h-5 w-5" })
1045
1046
  }
1046
1047
  ) }) })
1047
1048
  ] })
1048
1049
  ] }),
1049
1050
  /* @__PURE__ */ e("div", { className: "py-3", children: /* @__PURE__ */ o(
1050
- xe,
1051
+ be,
1051
1052
  {
1052
- sensors: x,
1053
- collisionDetection: fe,
1054
- onDragStart: (l) => {
1055
- g(l.active.id);
1053
+ sensors: p,
1054
+ collisionDetection: Ne,
1055
+ onDragStart: (i) => {
1056
+ f(i.active.id);
1056
1057
  },
1057
- onDragEnd: (l) => {
1058
- const { active: p, over: b } = l;
1059
- if (g(null), !(!p || !b) && p.id !== (b == null ? void 0 : b.id)) {
1060
- const v = i.map((w) => w.id).indexOf(p.id), y = i.map((w) => w.id).indexOf(b.id);
1061
- r({
1058
+ onDragEnd: (i) => {
1059
+ const { active: u, over: v } = i;
1060
+ if (f(null), !(!u || !v) && u.id !== (v == null ? void 0 : v.id)) {
1061
+ const b = s.map((w) => w.id).indexOf(u.id), y = s.map((w) => w.id).indexOf(v.id);
1062
+ n({
1062
1063
  type: "UPDATE_HANDLERS",
1063
- payload: Ee(i, v, y)
1064
+ payload: He(s, b, y)
1064
1065
  });
1065
1066
  }
1066
1067
  },
1067
1068
  children: [
1068
1069
  /* @__PURE__ */ e(
1069
- Ne,
1070
+ Te,
1070
1071
  {
1071
- items: i,
1072
- strategy: we,
1073
- children: i.map(({ id: l, ...p }) => /* @__PURE__ */ e(ee, { id: l, ...p }, l))
1072
+ items: s,
1073
+ strategy: De,
1074
+ children: s.map(({ id: i, ...u }) => /* @__PURE__ */ e(ne, { id: i, ...u }, i))
1074
1075
  }
1075
1076
  ),
1076
- /* @__PURE__ */ e(ye, { children: f && d ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ee, { ...d }) }) : null })
1077
+ /* @__PURE__ */ e(we, { children: m && c ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ne, { ...c }) }) : null })
1077
1078
  ]
1078
1079
  }
1079
1080
  ) })
1080
1081
  ] }) : /* @__PURE__ */ o("div", { className: "mt-6", children: [
1081
- /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(J, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
1082
+ /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(X, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
1082
1083
  /* @__PURE__ */ o("div", { className: "text-s text-grey-200 mx-auto mt-3 max-w-sm text-center", children: [
1083
1084
  "There are no http handlers configured yet ",
1084
1085
  /* @__PURE__ */ e("br", {}),
@@ -1088,7 +1089,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1088
1089
  "button",
1089
1090
  {
1090
1091
  onClick: () => {
1091
- $.next(c), r({
1092
+ G.next(d), n({
1092
1093
  type: "ADD_HANDLER",
1093
1094
  payload: {
1094
1095
  class: "",
@@ -1102,47 +1103,101 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
1102
1103
  },
1103
1104
  className: "bg-primary-dark text-s rounded px-2 py-1 flex items-center gap-1",
1104
1105
  children: [
1105
- /* @__PURE__ */ e(Y, { className: "inline text-white h-4 w-4" }),
1106
+ /* @__PURE__ */ e(ee, { className: "inline text-white h-4 w-4" }),
1106
1107
  " Add New Handler"
1107
1108
  ]
1108
1109
  }
1109
1110
  ) })
1110
1111
  ] }) })
1111
1112
  ] });
1112
- }, at = ({ content: t, path: a }) => {
1113
- const [r, i] = _(null);
1114
- function c(d) {
1115
- let n;
1113
+ }, pt = ({ content: t, path: a }) => {
1114
+ const [n, s] = _(null);
1115
+ function d(c) {
1116
+ let r;
1116
1117
  try {
1117
- n = JSON.parse(d);
1118
+ r = JSON.parse(c);
1118
1119
  } catch {
1119
- i("HTTP Handler JSON is invalid"), n = [];
1120
+ s("HTTP Handler JSON is invalid"), r = [];
1120
1121
  }
1121
- return n;
1122
+ return r;
1122
1123
  }
1123
- const x = typeof t == "string" ? c(t) : t;
1124
- if (!nt.safeParse(x).success || r)
1124
+ const p = typeof t == "string" ? d(t) : t;
1125
+ if (!dt.safeParse(p).success || n)
1125
1126
  throw new Error("Invalid JSON");
1126
- const g = x.map((d) => {
1127
- var l;
1128
- const n = !!d.regexPattern;
1127
+ const f = p.map((c) => {
1128
+ var i;
1129
+ const r = !!c.regexPattern;
1129
1130
  return {
1130
- ...d,
1131
- id: d.id ?? V(),
1132
- verbs: (l = d.verbs) == null ? void 0 : l.split(",").map((p) => p.toLocaleUpperCase()).filter(Boolean),
1133
- asRegex: n
1131
+ ...c,
1132
+ id: c.id ?? W(),
1133
+ verbs: (i = c.verbs) == null ? void 0 : i.split(",").map((u) => u.toLocaleUpperCase()).filter(Boolean),
1134
+ asRegex: r
1134
1135
  };
1135
1136
  });
1136
- return /* @__PURE__ */ e(Qe, { content: g, children: /* @__PURE__ */ e(rt, { path: a }) });
1137
- }, wt = (t) => /* @__PURE__ */ e(Le, { store: Fe(), children: /* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
1138
- at,
1139
- {
1140
- path: ze,
1141
- ...t
1142
- }
1143
- ) }) });
1137
+ return /* @__PURE__ */ e(rt, { content: f, children: /* @__PURE__ */ e(ct, { path: a }) });
1138
+ }, ut = () => document.querySelector(`.${et}`) || document.body, ht = () => {
1139
+ const t = M(Fe), a = $();
1140
+ return /* @__PURE__ */ e(O, { children: t.map((n, s) => /* @__PURE__ */ e(
1141
+ Ve,
1142
+ {
1143
+ hasOverlay: s === 0,
1144
+ ...n,
1145
+ onClose: (d) => a(je(d)),
1146
+ onEdit: (d) => a($e(d)),
1147
+ container: ut()
1148
+ },
1149
+ n.id
1150
+ )) });
1151
+ }, mt = ({
1152
+ initialValue: t = [],
1153
+ onChange: a,
1154
+ ...n
1155
+ }) => {
1156
+ const s = M(
1157
+ ie(K),
1158
+ (p, m) => V(p, m)
1159
+ ), d = $();
1160
+ return F(() => {
1161
+ if (t)
1162
+ try {
1163
+ const p = typeof t == "string" ? JSON.parse(t) : t;
1164
+ if (V(p, s == null ? void 0 : s.content))
1165
+ return;
1166
+ d(
1167
+ oe({
1168
+ path: K,
1169
+ content: p
1170
+ })
1171
+ );
1172
+ } catch (p) {
1173
+ console.error(
1174
+ "[HTTP Handlers Editor Standalone] Error while parsing the initial value:",
1175
+ p
1176
+ );
1177
+ }
1178
+ }, [t]), Xe(() => {
1179
+ if (s != null && s.flags.touched && a)
1180
+ try {
1181
+ const p = JSON.stringify(s == null ? void 0 : s.content, null, 2);
1182
+ a(p);
1183
+ } catch (p) {
1184
+ console.error("[HTTP Handlers Editor Standalone] Error on value stringify:", p);
1185
+ }
1186
+ }, [s == null ? void 0 : s.content]), /* @__PURE__ */ o(O, { children: [
1187
+ /* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
1188
+ pt,
1189
+ {
1190
+ path: K,
1191
+ content: t,
1192
+ ...n
1193
+ }
1194
+ ) }),
1195
+ /* @__PURE__ */ e(ht, {})
1196
+ ] });
1197
+ }, kt = (t) => /* @__PURE__ */ e(Ge, { store: Me(), children: /* @__PURE__ */ e(Qe, { children: /* @__PURE__ */ e(mt, { ...t }) }) });
1144
1198
  export {
1145
- at as HTTPHandlersEditor,
1146
- wt as Standalone
1199
+ pt as HTTPHandlersEditor,
1200
+ et as HTTP_HANDLERS_EDITOR_SCOPE_CLASS,
1201
+ kt as Standalone
1147
1202
  };
1148
1203
  //# sourceMappingURL=index.es.js.map