@kong-ui-public/entities-routes 3.16.26-pr.2701.377d8f5a8.0 → 3.16.27

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.
Files changed (64) hide show
  1. package/dist/RouteFormExpressionsEditor-F5bIgjiX.js +64 -0
  2. package/dist/entities-routes.es.js +20 -0
  3. package/dist/entities-routes.umd.js +1 -0
  4. package/dist/index-CL0sBDYW.js +2615 -0
  5. package/dist/style.css +1 -0
  6. package/dist/types/components/RouteConfigCard.vue.d.ts +77 -0
  7. package/dist/types/components/RouteConfigCard.vue.d.ts.map +1 -0
  8. package/dist/types/components/RouteForm.vue.d.ts +175 -0
  9. package/dist/types/components/RouteForm.vue.d.ts.map +1 -0
  10. package/dist/types/components/RouteFormExpressionsEditor.vue.d.ts +34 -0
  11. package/dist/types/components/RouteFormExpressionsEditor.vue.d.ts.map +1 -0
  12. package/dist/types/components/RouteFormExpressionsEditorLoader.vue.d.ts +40 -0
  13. package/dist/types/components/RouteFormExpressionsEditorLoader.vue.d.ts.map +1 -0
  14. package/dist/types/components/RouteFormRulesComposer.vue.d.ts +55 -0
  15. package/dist/types/components/RouteFormRulesComposer.vue.d.ts.map +1 -0
  16. package/dist/types/components/RouteList.vue.d.ts +143 -0
  17. package/dist/types/components/RouteList.vue.d.ts.map +1 -0
  18. package/dist/types/components/rules-composer/ExpressionsRules.vue.d.ts +42 -0
  19. package/dist/types/components/rules-composer/ExpressionsRules.vue.d.ts.map +1 -0
  20. package/dist/types/components/rules-composer/RulesComposer.vue.d.ts +40 -0
  21. package/dist/types/components/rules-composer/RulesComposer.vue.d.ts.map +1 -0
  22. package/dist/types/components/rules-composer/TraditionalRules.vue.d.ts +30 -0
  23. package/dist/types/components/rules-composer/TraditionalRules.vue.d.ts.map +1 -0
  24. package/dist/types/components/rules-composer/rules/DestinationRules.vue.d.ts +15 -0
  25. package/dist/types/components/rules-composer/rules/DestinationRules.vue.d.ts.map +1 -0
  26. package/dist/types/components/rules-composer/rules/HeaderRules.vue.d.ts +15 -0
  27. package/dist/types/components/rules-composer/rules/HeaderRules.vue.d.ts.map +1 -0
  28. package/dist/types/components/rules-composer/rules/HostRules.vue.d.ts +14 -0
  29. package/dist/types/components/rules-composer/rules/HostRules.vue.d.ts.map +1 -0
  30. package/dist/types/components/rules-composer/rules/MethodRules.vue.d.ts +23 -0
  31. package/dist/types/components/rules-composer/rules/MethodRules.vue.d.ts.map +1 -0
  32. package/dist/types/components/rules-composer/rules/PathRules.vue.d.ts +14 -0
  33. package/dist/types/components/rules-composer/rules/PathRules.vue.d.ts.map +1 -0
  34. package/dist/types/components/rules-composer/rules/RuleControlsAdd.vue.d.ts +10 -0
  35. package/dist/types/components/rules-composer/rules/RuleControlsAdd.vue.d.ts.map +1 -0
  36. package/dist/types/components/rules-composer/rules/RuleControlsRemove.vue.d.ts +11 -0
  37. package/dist/types/components/rules-composer/rules/RuleControlsRemove.vue.d.ts.map +1 -0
  38. package/dist/types/components/rules-composer/rules/SniRules.vue.d.ts +14 -0
  39. package/dist/types/components/rules-composer/rules/SniRules.vue.d.ts.map +1 -0
  40. package/dist/types/components/rules-composer/rules/SourceRules.vue.d.ts +15 -0
  41. package/dist/types/components/rules-composer/rules/SourceRules.vue.d.ts.map +1 -0
  42. package/dist/types/composables/index.d.ts +6 -0
  43. package/dist/types/composables/index.d.ts.map +1 -0
  44. package/dist/types/composables/useI18n.d.ts +9 -0
  45. package/dist/types/composables/useI18n.d.ts.map +1 -0
  46. package/dist/types/constants.d.ts +65 -0
  47. package/dist/types/constants.d.ts.map +1 -0
  48. package/dist/types/index.d.ts +9 -0
  49. package/dist/types/index.d.ts.map +1 -0
  50. package/dist/types/routes-endpoints.d.ts +58 -0
  51. package/dist/types/routes-endpoints.d.ts.map +1 -0
  52. package/dist/types/types/index.d.ts +4 -0
  53. package/dist/types/types/index.d.ts.map +1 -0
  54. package/dist/types/types/route-config-card.d.ts +31 -0
  55. package/dist/types/types/route-config-card.d.ts.map +1 -0
  56. package/dist/types/types/route-form.d.ts +148 -0
  57. package/dist/types/types/route-form.d.ts.map +1 -0
  58. package/dist/types/types/route-list.d.ts +34 -0
  59. package/dist/types/types/route-list.d.ts.map +1 -0
  60. package/dist/types/utilities/helpers.d.ts +2 -0
  61. package/dist/types/utilities/helpers.d.ts.map +1 -0
  62. package/dist/types/utilities/index.d.ts +2 -0
  63. package/dist/types/utilities/index.d.ts.map +1 -0
  64. package/package.json +9 -9
@@ -0,0 +1,2615 @@
1
+ import { defineComponent as z, ref as B, computed as M, resolveComponent as H, createElementBlock as O, openBlock as m, createVNode as d, unref as o, withCtx as n, createBlock as x, toDisplayString as k, inject as xe, createCommentVNode as P, createElementVNode as V, mergeModels as Y, useModel as X, createTextVNode as U, TransitionGroup as me, Fragment as G, renderList as le, nextTick as st, defineAsyncComponent as lt, h as Fe, onMounted as Qe, renderSlot as Pe, resolveDynamicComponent as Ke, watch as ye, reactive as Ne, onBeforeMount as Ye, provide as rt, createSlots as qe, withModifiers as ke, Teleport as it } from "vue";
2
+ import { useAxios as Le, ConfigurationSchemaType as fe, ConfigurationSchemaSection as ce, EntityBaseConfigCard as at, SupportedEntityType as Ze, InternalLinkItem as nt, useErrors as dt, useGatewayFeatureSupported as ut, EntityBaseFormType as Be, useDebouncedFilter as ct, EntityBaseForm as pt, EntityFormSection as Ge, useTableState as ft, useFetcher as mt, useDeleteUrlBuilder as vt, FetcherStatus as ht, EntityBaseTable as gt, PermissionsWrapper as He, TableTags as yt, EntityFilter as St, EntityDeleteModal as bt, EntityTypes as _t } from "@kong-ui-public/entities-shared";
3
+ import { createI18n as Tt, i18nTComponent as It } from "@kong-ui-public/i18n";
4
+ import We from "lodash.isequal";
5
+ import { useRouter as et } from "vue-router";
6
+ import { AddIcon as $e, CloseIcon as Et, RocketIcon as Rt, InfoIcon as At, BookIcon as je, ForwardIcon as Ot } from "@kong/icons";
7
+ import { BadgeMethodAppearances as kt } from "@kong/kongponents";
8
+ const te = "/v2/control-planes/{controlPlaneId}/core-entities", oe = "/{workspace}", Se = {
9
+ list: {
10
+ konnect: {
11
+ all: `${te}/routes`,
12
+ forGatewayService: `${te}/services/{serviceId}/routes`
13
+ },
14
+ kongManager: {
15
+ all: `${oe}/routes`,
16
+ forGatewayService: `${oe}/services/{serviceId}/routes`
17
+ }
18
+ },
19
+ form: {
20
+ konnect: {
21
+ services: `${te}/services`,
22
+ create: {
23
+ all: `${te}/routes`,
24
+ forGatewayService: `${te}/services/{serviceId}/routes`
25
+ },
26
+ fetch: {
27
+ all: `${te}/routes/{id}`,
28
+ forGatewayService: `${te}/services/{serviceId}/routes/{id}`
29
+ },
30
+ edit: {
31
+ all: `${te}/routes/{id}`,
32
+ forGatewayService: `${te}/services/{serviceId}/routes/{id}`
33
+ }
34
+ },
35
+ kongManager: {
36
+ services: `${oe}/services`,
37
+ create: {
38
+ all: `${oe}/routes`,
39
+ forGatewayService: `${oe}/services/{serviceId}/routes`
40
+ },
41
+ fetch: {
42
+ all: `${oe}/routes/{id}`,
43
+ forGatewayService: `${oe}/services/{serviceId}/routes/{id}`
44
+ },
45
+ edit: {
46
+ all: `${oe}/routes/{id}`,
47
+ forGatewayService: `${oe}/services/{serviceId}/routes/{id}`
48
+ }
49
+ }
50
+ },
51
+ item: {
52
+ konnect: {
53
+ getService: `${te}/services/{serviceId}`,
54
+ all: `${te}/routes/{id}`,
55
+ forGatewayService: `${te}/services/{serviceId}/routes/{id}`
56
+ },
57
+ kongManager: {
58
+ getService: `${oe}/services/{serviceId}`,
59
+ all: `${oe}/routes/{id}`,
60
+ forGatewayService: `${oe}/services/{serviceId}/routes/{id}`
61
+ }
62
+ }
63
+ }, Ht = {
64
+ create: "New route",
65
+ copy_id: "Copy ID",
66
+ copy_json: "Copy JSON",
67
+ edit: "Edit",
68
+ delete: "Delete",
69
+ clear: "Clear",
70
+ view: "View Details",
71
+ loading: "Loading..."
72
+ }, Nt = {
73
+ placeholder: {
74
+ konnect: "Filter by name",
75
+ exact: "Filter by exact name or ID",
76
+ kongManager: "Filter by exact name or ID"
77
+ },
78
+ no_results: "No results found"
79
+ }, Ct = {
80
+ title: "Routes",
81
+ list: {
82
+ toolbar_actions: {
83
+ new_route: "New route"
84
+ },
85
+ table_headers: {
86
+ name: "Name",
87
+ protocols: "Protocols",
88
+ hosts: "Hosts",
89
+ methods: "Methods",
90
+ paths: "Paths",
91
+ expression: "Expression",
92
+ id: "ID",
93
+ tags: "Tags",
94
+ created_at: "Created At",
95
+ updated_at: "Last Modified"
96
+ },
97
+ empty_state: {
98
+ title: "Configure a New Route",
99
+ description: "Routes proxy requests to an associated Service."
100
+ },
101
+ empty_state_v2: {
102
+ title: "Configure your first route",
103
+ group: "Routes created in gateways within this group will automatically appear here.",
104
+ description: "Routes direct incoming API requests to the appropriate gateway service based on paths, methods, and headers, ensuring efficient traffic flow.",
105
+ learn_more: "Learn more"
106
+ }
107
+ }
108
+ }, xt = {
109
+ general: "Routes could not be retrieved",
110
+ delete: "The route could not be deleted at this time.",
111
+ copy: "Failed to copy to clipboard",
112
+ services: {
113
+ fetch: "Could not fetch available services"
114
+ }
115
+ }, wt = {
116
+ success: "Copied {val} to clipboard",
117
+ success_brief: "Successfully copied to clipboard"
118
+ }, Vt = {
119
+ config_flavor: {
120
+ label: "Define by"
121
+ },
122
+ config_types: {
123
+ basic: {
124
+ description: "Quickly set up a route with HTTP & HTTPS protocol with the essentials: path, method, and host.",
125
+ label: "Basic"
126
+ },
127
+ advanced: {
128
+ description: "Define complex route logic with other protocols or additional paths or attributes such as headers.",
129
+ label: "Advanced"
130
+ }
131
+ },
132
+ protocols: {
133
+ grpc: "GRPC",
134
+ grpcs: "GRPCS",
135
+ "grpc,grpcs": "GRPC, GRPCS",
136
+ http: "HTTP",
137
+ https: "HTTPS",
138
+ "http,https": "HTTP, HTTPS",
139
+ tls: "TLS",
140
+ tcp: "TCP",
141
+ udp: "UDP",
142
+ "tls,udp": "TLS, UDP",
143
+ "tcp,udp": "TCP, UDP",
144
+ "tcp,tls": "TCP, TLS",
145
+ "tcp,tls,udp": "TCP, TLS, UDP",
146
+ ws: "WS",
147
+ wss: "WSS",
148
+ "ws,wss": "WS, WSS",
149
+ tls_passthrough: "TLS_PASSTHROUGH"
150
+ },
151
+ sections: {
152
+ general: {
153
+ title: "General Information",
154
+ description: "General information will help you identify and manage this route"
155
+ },
156
+ config: {
157
+ title: "Route Configuration",
158
+ description: "Route configuration determines how this route will handle incoming requests"
159
+ },
160
+ routingRules: {
161
+ title: "Routing Rules"
162
+ },
163
+ routingExpression: {
164
+ title: "Routing Expression"
165
+ }
166
+ },
167
+ fields: {
168
+ service_id: {
169
+ label: "Service",
170
+ placeholder: "Select a service"
171
+ },
172
+ name: {
173
+ label: "Name",
174
+ placeholder: "Enter a unique name",
175
+ tooltip: "The name of the Route. Route names must be unique, and they are case sensitive. For example, there can be two different Routes named 'test' and 'Test'."
176
+ },
177
+ service: {
178
+ label: "Gateway Service",
179
+ tooltip: "The Service this Route is associated to. This is where the Route proxies traffic to."
180
+ },
181
+ tags: {
182
+ label: "Tags",
183
+ tooltip: "An optional set of strings associated with the Route for grouping and filtering.",
184
+ placeholder: "Enter a list of tags separated by commas",
185
+ help: "e.g. tag1, tag2, tag3"
186
+ },
187
+ protocols: {
188
+ label: "Protocols",
189
+ tooltip: "The protocols this route supports."
190
+ },
191
+ path_handling: {
192
+ label: "Path Handling",
193
+ tooltip: "Controls how Kong modifies the request path before proxying to the upstream service. Use v1 for standardized, predictable path behavior. Use v0 for legacy compatibility."
194
+ },
195
+ https_redirect_status_code: {
196
+ label: "HTTPS Redirect Status Code",
197
+ tooltip: "Specifies the HTTP status code for redirecting requests from HTTP to HTTPS. Use <code>301</code> or <code>308</code> for permanent redirects, <code>302</code> or <code>307</code> for temporary redirects."
198
+ },
199
+ regex_priority: {
200
+ label: "Regex Priority",
201
+ tooltip: "Regex priority is determined by length first (longer patterns win), and when lengths are the same, more specific regexes are preferred. When two routes match the path and have the same <code>regex_priority</code>, the older one (lowest <code>created_at</code>) is used."
202
+ },
203
+ strip_path: {
204
+ label: "Strip Path",
205
+ tooltip: "When enabled, Kong removes the portion of the request path that matches the route's path before forwarding the request to the upstream. If the request exactly matches the route, the result is <code>/</code>. Disable if that's not desired."
206
+ },
207
+ preserve_host: {
208
+ label: "Preserve Host",
209
+ tooltip: "Keeps the original <code>Host</code> header when proxying requests. Enable this if the upstream service requires the client's <code>Host</code> value. Disable if the service expects its own hostname."
210
+ },
211
+ paths: {
212
+ add: "Add a path",
213
+ label: "Paths",
214
+ label_singular: "Path",
215
+ placeholder: "e.g. /api/v1",
216
+ singular: "path",
217
+ tooltip: "Match specific URL paths, such as <code>/api/v1</code>. Prefix with <code>~</code> to enable regex-based matching."
218
+ },
219
+ snis: {
220
+ add: "Add an SNI",
221
+ label: "SNIs",
222
+ placeholder: "e.g. api.example.com",
223
+ singular: "SNI",
224
+ tooltip: "SNIs (Server Name Indications) that match the route when using stream routing."
225
+ },
226
+ hosts: {
227
+ add: "Add a host",
228
+ label: "Hosts",
229
+ label_singular: "Host",
230
+ placeholder: "e.g. example.com",
231
+ singular: "host",
232
+ tooltip: "Match specific domain names, such as <code>api.example.com</code>."
233
+ },
234
+ methods: {
235
+ label: "Methods",
236
+ placeholder: "Select methods",
237
+ search_placeholder: "Search for a method or enter a custom method",
238
+ singular: "method",
239
+ tooltip: "Match specific HTTP methods, such as GET or POST. If no method is selected, all methods are included.",
240
+ custom: {
241
+ label: "Custom",
242
+ placeholder: "Enter a custom method",
243
+ tooltip: "Custom methods can be used with default selections. Uppercase characters are required."
244
+ }
245
+ },
246
+ headers: {
247
+ add: "Add a header",
248
+ label: "Headers",
249
+ singular: "header",
250
+ tooltip: "Match specific headers, such as <code>x-api-version</code> or <code>x-region</code>. Doesn't accept the <code>Host</code> header. Provide only one entry and prefix with <code>~</code> to enable regex-based matching.",
251
+ name: {
252
+ placeholder: "e.g. x-api-version"
253
+ },
254
+ values: {
255
+ placeholder: "e.g. v1"
256
+ }
257
+ },
258
+ sources: {
259
+ add: "Add a source",
260
+ label: "Sources",
261
+ singular: "source",
262
+ tooltip: "A list of IP sources of incoming connections that match this Route when using stream routing.",
263
+ ip: {
264
+ placeholder: "Enter a source IP"
265
+ },
266
+ port: {
267
+ placeholder: "Enter a source port"
268
+ }
269
+ },
270
+ destinations: {
271
+ add: "Add a destination",
272
+ label: "Destinations",
273
+ singular: "destination",
274
+ tooltip: "A list of IP destinations of incoming connections that match this Route when using stream routing.",
275
+ ip: {
276
+ placeholder: "Enter a destination IP"
277
+ },
278
+ port: {
279
+ placeholder: "Enter a destination port"
280
+ }
281
+ },
282
+ response_buffering: {
283
+ label: "Response buffering",
284
+ tooltip: "Reads and buffers the full response from the upstream service before sending it to the client. Enable buffering if the client expects the complete response at once. Disable for faster streaming of large or chunked responses."
285
+ },
286
+ request_buffering: {
287
+ label: "Request buffering",
288
+ tooltip: "Reads and buffers the full request body before proxying. Enable buffering if the upstream service requires the complete request before processing. Disable for faster streaming of large or chunked requests."
289
+ },
290
+ expression: {
291
+ label: "Expression",
292
+ tooltip: "The route expression."
293
+ },
294
+ priority: {
295
+ label: "Priority",
296
+ tooltip: "A number used to choose which route resolves a given request when several routes match it using expression simultaneously."
297
+ }
298
+ },
299
+ flavors: {
300
+ traditional: "Traditional Form",
301
+ expressions: "Expressions Editor"
302
+ },
303
+ show_more: "Show more",
304
+ hint: {
305
+ rules_message: "Choose at least one {routingRules} option.",
306
+ single_rule: "{routingRules}",
307
+ multiple_rules: "{routingRules} or {lastRoutingRule}",
308
+ advanced: "To add more than one, use the Advanced options."
309
+ },
310
+ warning: {
311
+ cannotChangeFlavor: {
312
+ create: "The format of the route cannot be changed once created.",
313
+ edit: "This route was configured in the {format} format, and cannot be changed after creation. You can switch to the {format} tab to edit, or create a new route in a different format instead."
314
+ }
315
+ },
316
+ expressions_editor: {
317
+ loading: "Loading the Expressions editor…",
318
+ error: "Error occurred while loading the Expressions editor. Please view the console for more details."
319
+ },
320
+ expression_playground: {
321
+ test_link: "Test with Router Playground",
322
+ supported_protocols_hint: "Currently only supports the following protocols: {protocols}"
323
+ }
324
+ }, Mt = {
325
+ actions: Ht,
326
+ search: Nt,
327
+ routes: Ct,
328
+ delete: {
329
+ title: "Delete a Route",
330
+ description: "Deleting this route will also remove any associated plugins. This action cannot be reversed."
331
+ },
332
+ errors: xt,
333
+ copy: wt,
334
+ form: Vt
335
+ };
336
+ function Dt() {
337
+ const e = Tt("en-us", Mt);
338
+ return {
339
+ i18n: e,
340
+ i18nT: It(e)
341
+ // Translation component <i18n-t>
342
+ };
343
+ }
344
+ const J = {
345
+ useI18n: Dt
346
+ }, $t = { class: "kong-ui-entities-route-entity-config-card" }, Ut = { key: 2 }, us = /* @__PURE__ */ z({
347
+ __name: "RouteConfigCard",
348
+ props: {
349
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
350
+ config: {
351
+ type: Object,
352
+ required: !0,
353
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || e.app === "konnect" && !e.controlPlaneId || e.app === "kongManager" && typeof e.workspace != "string" || !e.entityId)
354
+ },
355
+ /**
356
+ * External link for documentation that determines visibility of Documentation button
357
+ */
358
+ configCardDoc: {
359
+ type: String,
360
+ default: "",
361
+ required: !1
362
+ },
363
+ /**
364
+ * Control visibility of card title content
365
+ */
366
+ hideTitle: {
367
+ type: Boolean,
368
+ default: !1
369
+ },
370
+ /** The id of the service with which the route is associated */
371
+ serviceId: {
372
+ type: String,
373
+ required: !1,
374
+ default: ""
375
+ }
376
+ },
377
+ emits: ["loading", "fetch:error", "fetch:success", "navigation-click"],
378
+ setup(e, { emit: C }) {
379
+ var F;
380
+ const f = C, l = e, { axiosInstance: a } = Le((F = l.config) == null ? void 0 : F.axiosRequestConfig), { i18n: { t: v } } = J.useI18n(), i = B(""), A = B(""), h = B(!1), g = M(
381
+ () => {
382
+ var r, u;
383
+ return (u = Se.item[(r = l.config) == null ? void 0 : r.app]) == null ? void 0 : u[l.serviceId ? "forGatewayService" : "all"].replace(/{serviceId}/gi, l.serviceId);
384
+ }
385
+ ), p = M(() => {
386
+ var r;
387
+ return (r = Se.item[l.config.app]) == null ? void 0 : r.getService;
388
+ }), y = async (r) => {
389
+ var S, D, se;
390
+ if (i.value = l.serviceId || ((S = r == null ? void 0 : r.service) == null ? void 0 : S.id), f("fetch:success", r), !i.value)
391
+ return;
392
+ let u = `${l.config.apiBaseUrl}${p.value}`;
393
+ l.config.app === "konnect" ? u = u.replace(/{controlPlaneId}/gi, ((D = l.config) == null ? void 0 : D.controlPlaneId) || "").replace(/{serviceId}/gi, i.value || "") : l.config.app === "kongManager" && (u = u.replace(/\/{workspace}/gi, (se = l.config) != null && se.workspace ? `/${l.config.workspace}` : "").replace(/{serviceId}/gi, i.value || ""));
394
+ try {
395
+ h.value = !0;
396
+ const { data: j } = await a.get(u);
397
+ A.value = (j == null ? void 0 : j.name) || (j == null ? void 0 : j.id);
398
+ } catch (j) {
399
+ f("fetch:error", j);
400
+ } finally {
401
+ h.value = !1;
402
+ }
403
+ }, w = B({
404
+ id: {},
405
+ name: {
406
+ tooltip: v("form.fields.name.tooltip")
407
+ },
408
+ created_at: {},
409
+ updated_at: {},
410
+ service: {
411
+ label: v("form.fields.service.label"),
412
+ section: ce.Basic,
413
+ tooltip: v("form.fields.service.tooltip"),
414
+ order: 5
415
+ },
416
+ tags: {
417
+ tooltip: v("form.fields.tags.tooltip"),
418
+ order: 6
419
+ },
420
+ protocols: {
421
+ section: ce.Basic,
422
+ tooltip: v("form.fields.protocols.tooltip"),
423
+ type: fe.BadgeTag,
424
+ order: 7
425
+ },
426
+ paths: {
427
+ section: ce.Basic,
428
+ tooltip: v("form.fields.paths.tooltip"),
429
+ type: fe.CopyBadge,
430
+ order: 8
431
+ },
432
+ hosts: {
433
+ section: ce.Basic,
434
+ tooltip: v("form.fields.hosts.tooltip"),
435
+ type: fe.CopyBadge,
436
+ order: 9
437
+ },
438
+ snis: {
439
+ label: v("form.fields.snis.label"),
440
+ tooltip: v("form.fields.snis.tooltip"),
441
+ order: 10
442
+ },
443
+ headers: {
444
+ section: ce.Basic,
445
+ tooltip: v("form.fields.headers.tooltip"),
446
+ order: 11
447
+ },
448
+ methods: {
449
+ section: ce.Basic,
450
+ tooltip: v("form.fields.methods.tooltip"),
451
+ type: fe.BadgeMethod,
452
+ order: 12
453
+ },
454
+ sources: {
455
+ section: ce.Basic,
456
+ tooltip: v("form.fields.sources.tooltip"),
457
+ type: fe.JsonArray,
458
+ order: 13
459
+ },
460
+ destinations: {
461
+ section: ce.Basic,
462
+ tooltip: v("form.fields.destinations.tooltip"),
463
+ type: fe.JsonArray,
464
+ order: 14
465
+ },
466
+ // advanced fields
467
+ https_redirect_status_code: {
468
+ tooltip: v("form.fields.https_redirect_status_code.tooltip"),
469
+ order: 1
470
+ },
471
+ regex_priority: {
472
+ tooltip: v("form.fields.regex_priority.tooltip"),
473
+ order: 2
474
+ },
475
+ strip_path: {
476
+ tooltip: v("form.fields.strip_path.tooltip"),
477
+ order: 3
478
+ },
479
+ preserve_host: {
480
+ tooltip: v("form.fields.preserve_host.tooltip"),
481
+ order: 4
482
+ },
483
+ request_buffering: {
484
+ tooltip: v("form.fields.request_buffering.tooltip"),
485
+ order: 5
486
+ },
487
+ response_buffering: {
488
+ tooltip: v("form.fields.response_buffering.tooltip"),
489
+ order: 6
490
+ },
491
+ path_handling: {
492
+ tooltip: v("form.fields.path_handling.tooltip"),
493
+ order: 7
494
+ }
495
+ });
496
+ return (r, u) => {
497
+ const S = H("KSkeleton");
498
+ return m(), O("div", $t, [
499
+ d(o(at), {
500
+ config: e.config,
501
+ "config-card-doc": e.configCardDoc,
502
+ "config-schema": w.value,
503
+ "entity-type": o(Ze).Route,
504
+ "fetch-url": g.value,
505
+ "hide-title": e.hideTitle,
506
+ "onFetch:error": u[0] || (u[0] = (D) => r.$emit("fetch:error", D)),
507
+ "onFetch:success": y,
508
+ onLoading: u[1] || (u[1] = (D) => r.$emit("loading", D))
509
+ }, {
510
+ service: n(({ row: D }) => [
511
+ h.value ? (m(), x(S, {
512
+ key: 0,
513
+ "data-testid": "service-name-loader",
514
+ type: "spinner"
515
+ })) : D.value && D.value.id === i.value && A.value ? (m(), x(o(nt), {
516
+ key: 1,
517
+ item: {
518
+ key: D.value.id,
519
+ value: A.value,
520
+ type: o(fe).LinkInternal
521
+ },
522
+ onNavigationClick: () => r.$emit("navigation-click", D.value.id, "services")
523
+ }, null, 8, ["item", "onNavigationClick"])) : (m(), O("div", Ut, k("-")))
524
+ ]),
525
+ _: 1
526
+ }, 8, ["config", "config-card-doc", "config-schema", "entity-type", "fetch-url", "hide-title"])
527
+ ]);
528
+ };
529
+ }
530
+ });
531
+ var q = /* @__PURE__ */ ((e) => (e.TRADITIONAL = "traditional", e.EXPRESSIONS = "expressions", e))(q || {}), s = /* @__PURE__ */ ((e) => (e.PATHS = "paths", e.SNIS = "snis", e.HOSTS = "hosts", e.METHODS = "methods", e.HEADERS = "headers", e.SOURCES = "sources", e.DESTINATIONS = "destinations", e))(s || {}), ge = /* @__PURE__ */ ((e) => (e.LOADING = "loading", e.ERROR = "error", e.READY = "ready", e))(ge || {}), be = /* @__PURE__ */ ((e) => (e.GET = "GET", e.PUT = "PUT", e.POST = "POST", e.PATCH = "PATCH", e.DELETE = "DELETE", e.OPTIONS = "OPTIONS", e.HEAD = "HEAD", e.CONNECT = "CONNECT", e.TRACE = "TRACE", e))(be || {});
532
+ const Xe = (e) => e.routeFlavors.traditional === !0, ze = (e) => e.routeFlavors.expressions === !0, W = {
533
+ [s.PATHS]: [""],
534
+ [s.SNIS]: [""],
535
+ [s.HOSTS]: [""],
536
+ [s.METHODS]: [],
537
+ [s.HEADERS]: [{ header: "", values: "" }],
538
+ [s.SOURCES]: [{ ip: "", port: null }],
539
+ [s.DESTINATIONS]: [{ ip: "", port: null }]
540
+ }, Ue = {
541
+ http: [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS],
542
+ https: [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS, s.SNIS],
543
+ "http,https": [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS, s.SNIS],
544
+ "https,http": [s.PATHS, s.METHODS, s.HOSTS, s.HEADERS, s.SNIS],
545
+ grpc: [s.PATHS, s.HOSTS, s.HEADERS],
546
+ grpcs: [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
547
+ "grpc,grpcs": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
548
+ "grpcs,grpc": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
549
+ udp: [s.SOURCES, s.DESTINATIONS],
550
+ tls: [s.SOURCES, s.DESTINATIONS, s.SNIS],
551
+ tcp: [s.SOURCES, s.DESTINATIONS],
552
+ "tls,udp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
553
+ "udp,tls": [s.SOURCES, s.DESTINATIONS, s.SNIS],
554
+ "tcp,udp": [s.SOURCES, s.DESTINATIONS],
555
+ "udp,tcp": [s.SOURCES, s.DESTINATIONS],
556
+ "tcp,tls": [s.SOURCES, s.DESTINATIONS, s.SNIS],
557
+ "tls,tcp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
558
+ "tcp,tls,udp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
559
+ "tls,udp,tcp": [s.SOURCES, s.DESTINATIONS, s.SNIS],
560
+ "udp,tcp,tls": [s.SOURCES, s.DESTINATIONS, s.SNIS],
561
+ tls_passthrough: [s.SNIS],
562
+ ws: [s.PATHS, s.HOSTS, s.HEADERS],
563
+ wss: [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
564
+ "ws,wss": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS],
565
+ "wss,ws": [s.PATHS, s.HOSTS, s.HEADERS, s.SNIS]
566
+ }, tt = [
567
+ { label: "426", value: 426 },
568
+ { label: "301", value: 301 },
569
+ { label: "302", value: 302 },
570
+ { label: "307", value: 307 },
571
+ { label: "308", value: 308 }
572
+ ], Pt = [
573
+ { label: "v0", value: "v0" },
574
+ { label: "v1", value: "v1" }
575
+ ], Ce = {
576
+ https_redirect_status_code: 426,
577
+ strip_path: !0,
578
+ preserve_host: !1,
579
+ request_buffering: !0,
580
+ response_buffering: !0
581
+ }, Lt = {
582
+ ...Ce,
583
+ paths: [""],
584
+ regex_priority: 0,
585
+ path_handling: "v0",
586
+ expression: "",
587
+ priority: 0
588
+ }, Ft = /* @__PURE__ */ z({
589
+ __name: "RuleControlsAdd",
590
+ props: {
591
+ routingRulesEntity: {}
592
+ },
593
+ emits: ["add"],
594
+ setup(e, { emit: C }) {
595
+ const f = e, l = C, a = xe("configType", "basic"), { i18n: { t: v } } = J.useI18n(), i = M(() => v(`form.fields.${f.routingRulesEntity}.add`));
596
+ return (A, h) => {
597
+ const g = H("KButton");
598
+ return o(a) !== "basic" ? (m(), x(g, {
599
+ key: 0,
600
+ appearance: "tertiary",
601
+ class: "routing-rule-add-item-button",
602
+ "data-testid": `add-${e.routingRulesEntity}`,
603
+ onClick: h[0] || (h[0] = (p) => l("add"))
604
+ }, {
605
+ default: n(() => [
606
+ d(o($e)),
607
+ V("span", null, k(i.value), 1)
608
+ ]),
609
+ _: 1
610
+ }, 8, ["data-testid"])) : P("", !0);
611
+ };
612
+ }
613
+ }), Z = (e, C) => {
614
+ const f = e.__vccOpts || e;
615
+ for (const [l, a] of C)
616
+ f[l] = a;
617
+ return f;
618
+ }, _e = /* @__PURE__ */ Z(Ft, [["__scopeId", "data-v-f1f4cfc9"]]), Kt = "#afb7c5", qt = "#0044f4", Bt = "16px", Te = /* @__PURE__ */ z({
619
+ __name: "RuleControlsRemove",
620
+ props: {
621
+ disabled: { type: Boolean },
622
+ routingRulesEntity: {}
623
+ },
624
+ emits: ["remove"],
625
+ setup(e, { emit: C }) {
626
+ const f = C, l = xe("configType", "basic");
627
+ return (a, v) => {
628
+ const i = H("KButton");
629
+ return o(l) !== "basic" ? (m(), x(i, {
630
+ key: 0,
631
+ appearance: "tertiary",
632
+ "data-testid": `remove-${e.routingRulesEntity}`,
633
+ disabled: e.disabled,
634
+ icon: "",
635
+ onClick: v[0] || (v[0] = (A) => f("remove"))
636
+ }, {
637
+ default: n(() => [
638
+ d(o(Et), {
639
+ color: e.disabled ? o(Kt) : o(qt)
640
+ }, null, 8, ["color"])
641
+ ]),
642
+ _: 1
643
+ }, 8, ["data-testid", "disabled"])) : P("", !0);
644
+ };
645
+ }
646
+ }), Gt = { class: "routing-rule-container" }, Wt = ["innerHTML"], jt = /* @__PURE__ */ z({
647
+ __name: "DestinationRules",
648
+ props: {
649
+ modelValue: { required: !0 },
650
+ modelModifiers: {}
651
+ },
652
+ emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
653
+ setup(e, { emit: C }) {
654
+ const { i18n: { t: f } } = J.useI18n(), l = X(e, "modelValue"), a = C;
655
+ return (v, i) => {
656
+ const A = H("KLabel"), h = H("KInput");
657
+ return m(), O("div", Gt, [
658
+ d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
659
+ tooltip: n(() => [
660
+ V("span", {
661
+ innerHTML: o(f)("form.fields.destinations.tooltip")
662
+ }, null, 8, Wt)
663
+ ]),
664
+ default: n(() => [
665
+ U(" " + k(o(f)("form.fields.destinations.label")), 1)
666
+ ]),
667
+ _: 1
668
+ }),
669
+ d(me, { name: "appear" }, {
670
+ default: n(() => [
671
+ (m(!0), O(G, null, le(l.value, (g, p) => (m(), O("div", {
672
+ key: p,
673
+ class: "routing-rule-input"
674
+ }, [
675
+ d(h, {
676
+ modelValue: l.value[p].ip,
677
+ "onUpdate:modelValue": (y) => l.value[p].ip = y,
678
+ modelModifiers: { trim: !0 },
679
+ "data-testid": `route-form-destinations-ip-input-${p + 1}`,
680
+ placeholder: o(f)("form.fields.destinations.ip.placeholder")
681
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
682
+ d(h, {
683
+ modelValue: l.value[p].port,
684
+ "onUpdate:modelValue": (y) => l.value[p].port = y,
685
+ modelModifiers: { number: !0 },
686
+ "data-testid": `route-form-destinations-port-input-${p + 1}`,
687
+ max: "65535",
688
+ min: "0",
689
+ placeholder: o(f)("form.fields.destinations.port.placeholder"),
690
+ type: "number"
691
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
692
+ d(Te, {
693
+ disabled: l.value.length === 1,
694
+ "routing-rules-entity": o(s).DESTINATIONS,
695
+ onRemove: (y) => a("remove", p)
696
+ }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
697
+ ]))), 128))
698
+ ]),
699
+ _: 1
700
+ }),
701
+ d(_e, {
702
+ "routing-rules-entity": o(s).DESTINATIONS,
703
+ onAdd: i[0] || (i[0] = (g) => a("add"))
704
+ }, null, 8, ["routing-rules-entity"])
705
+ ]);
706
+ };
707
+ }
708
+ }), Xt = /* @__PURE__ */ Z(jt, [["__scopeId", "data-v-3eb40a37"]]), zt = { class: "routing-rule-container" }, Jt = ["innerHTML"], Qt = /* @__PURE__ */ z({
709
+ __name: "HeaderRules",
710
+ props: {
711
+ modelValue: { required: !0 },
712
+ modelModifiers: {}
713
+ },
714
+ emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
715
+ setup(e, { emit: C }) {
716
+ const { i18n: { t: f } } = J.useI18n(), l = X(e, "modelValue"), a = C;
717
+ return (v, i) => {
718
+ const A = H("KLabel"), h = H("KInput");
719
+ return m(), O("div", zt, [
720
+ d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
721
+ tooltip: n(() => [
722
+ V("span", {
723
+ innerHTML: o(f)("form.fields.headers.tooltip")
724
+ }, null, 8, Jt)
725
+ ]),
726
+ default: n(() => [
727
+ U(" " + k(o(f)("form.fields.headers.label")), 1)
728
+ ]),
729
+ _: 1
730
+ }),
731
+ d(me, { name: "appear" }, {
732
+ default: n(() => [
733
+ (m(!0), O(G, null, le(l.value, (g, p) => (m(), O("div", {
734
+ key: p,
735
+ class: "routing-rule-input"
736
+ }, [
737
+ d(h, {
738
+ modelValue: l.value[p].header,
739
+ "onUpdate:modelValue": (y) => l.value[p].header = y,
740
+ modelModifiers: { trim: !0 },
741
+ "data-testid": `route-form-headers-name-input-${p + 1}`,
742
+ placeholder: o(f)("form.fields.headers.name.placeholder")
743
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
744
+ d(h, {
745
+ modelValue: l.value[p].values,
746
+ "onUpdate:modelValue": (y) => l.value[p].values = y,
747
+ modelModifiers: { trim: !0 },
748
+ "data-testid": `route-form-headers-values-input-${p + 1}`,
749
+ placeholder: o(f)("form.fields.headers.values.placeholder")
750
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
751
+ d(Te, {
752
+ disabled: l.value.length === 1,
753
+ "routing-rules-entity": o(s).HEADERS,
754
+ onRemove: (y) => a("remove", p)
755
+ }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
756
+ ]))), 128))
757
+ ]),
758
+ _: 1
759
+ }),
760
+ d(_e, {
761
+ "routing-rules-entity": o(s).HEADERS,
762
+ onAdd: i[0] || (i[0] = (g) => a("add"))
763
+ }, null, 8, ["routing-rules-entity"])
764
+ ]);
765
+ };
766
+ }
767
+ }), Yt = /* @__PURE__ */ Z(Qt, [["__scopeId", "data-v-d3bede0b"]]), Zt = { class: "routing-rule-container" }, eo = ["innerHTML"], to = /* @__PURE__ */ z({
768
+ __name: "HostRules",
769
+ props: {
770
+ modelValue: { required: !0 },
771
+ modelModifiers: {}
772
+ },
773
+ emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
774
+ setup(e, { emit: C }) {
775
+ const { i18n: { t: f } } = J.useI18n(), l = X(e, "modelValue"), a = C, v = xe("configType", "basic");
776
+ return (i, A) => {
777
+ const h = H("KLabel"), g = H("KInput");
778
+ return m(), O("div", Zt, [
779
+ d(h, { "tooltip-attributes": { maxWidth: "320" } }, {
780
+ tooltip: n(() => [
781
+ V("span", {
782
+ innerHTML: o(f)("form.fields.hosts.tooltip")
783
+ }, null, 8, eo)
784
+ ]),
785
+ default: n(() => [
786
+ U(" " + k(o(v) === "basic" ? o(f)("form.fields.hosts.label_singular") : o(f)("form.fields.hosts.label")), 1)
787
+ ]),
788
+ _: 1
789
+ }),
790
+ d(me, { name: "appear" }, {
791
+ default: n(() => [
792
+ (m(!0), O(G, null, le(o(v) === "basic" ? l.value.slice(0, 1) : l.value, (p, y) => (m(), O("div", {
793
+ key: y,
794
+ class: "routing-rule-input"
795
+ }, [
796
+ d(g, {
797
+ modelValue: l.value[y],
798
+ "onUpdate:modelValue": (w) => l.value[y] = w,
799
+ modelModifiers: { trim: !0 },
800
+ "data-testid": `route-form-hosts-input-${y + 1}`,
801
+ placeholder: o(f)("form.fields.hosts.placeholder")
802
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
803
+ d(Te, {
804
+ disabled: l.value.length === 1,
805
+ "routing-rules-entity": o(s).HOSTS,
806
+ onRemove: (w) => a("remove", y)
807
+ }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
808
+ ]))), 128))
809
+ ]),
810
+ _: 1
811
+ }),
812
+ d(_e, {
813
+ "routing-rules-entity": o(s).HOSTS,
814
+ onAdd: A[0] || (A[0] = (p) => a("add"))
815
+ }, null, 8, ["routing-rules-entity"])
816
+ ]);
817
+ };
818
+ }
819
+ }), oo = /* @__PURE__ */ Z(to, [["__scopeId", "data-v-dccd9082"]]), so = {
820
+ class: "routing-rule-container",
821
+ "data-testid": "route-form-methods"
822
+ }, lo = ["innerHTML"], ro = { class: "routing-rule-input" }, io = /* @__PURE__ */ z({
823
+ __name: "MethodRules",
824
+ props: {
825
+ methods: { required: !0 },
826
+ methodsModifiers: {},
827
+ customMethods: { required: !0 },
828
+ customMethodsModifiers: {}
829
+ },
830
+ emits: ["update:methods", "update:customMethods"],
831
+ setup(e) {
832
+ const { i18n: { t: C } } = J.useI18n(), f = X(e, "methods"), l = X(e, "customMethods"), a = M(() => f.value.filter((g) => Object.keys(be).includes(g)).concat(l.value.map((g) => g.value))), v = M(() => Object.keys(be).map((g) => ({
833
+ label: g,
834
+ value: g
835
+ })).concat(l.value.map((g) => ({
836
+ label: g.label,
837
+ value: g.value,
838
+ custom: !0
839
+ })))), i = (g) => !v.value.map((p) => p.value.toLowerCase()).includes(g.toLowerCase()), A = (g, p) => {
840
+ p ? l.value.push(g) : l.value = l.value.filter((y) => y.value !== g.value);
841
+ }, h = (g) => {
842
+ f.value = g;
843
+ };
844
+ return (g, p) => {
845
+ const y = H("KLabel"), w = H("KMultiselect");
846
+ return m(), O("div", so, [
847
+ d(y, { "tooltip-attributes": { maxWidth: "320" } }, {
848
+ tooltip: n(() => [
849
+ V("span", {
850
+ innerHTML: o(C)("form.fields.methods.tooltip")
851
+ }, null, 8, lo)
852
+ ]),
853
+ default: n(() => [
854
+ U(" " + k(o(C)("form.fields.methods.label")), 1)
855
+ ]),
856
+ _: 1
857
+ }),
858
+ V("div", ro, [
859
+ d(w, {
860
+ "enable-item-creation": "",
861
+ "item-creation-validator": i,
862
+ items: v.value,
863
+ "model-value": a.value,
864
+ placeholder: o(C)("form.fields.methods.placeholder"),
865
+ "search-placeholder": o(C)("form.fields.methods.search_placeholder"),
866
+ onItemAdded: p[0] || (p[0] = (F) => A(F, !0)),
867
+ onItemRemoved: p[1] || (p[1] = (F) => A(F, !1)),
868
+ "onUpdate:modelValue": h
869
+ }, null, 8, ["items", "model-value", "placeholder", "search-placeholder"])
870
+ ])
871
+ ]);
872
+ };
873
+ }
874
+ }), ao = /* @__PURE__ */ Z(io, [["__scopeId", "data-v-6c94d6d2"]]), no = { class: "routing-rule-container" }, uo = ["innerHTML"], co = /* @__PURE__ */ z({
875
+ __name: "PathRules",
876
+ props: {
877
+ modelValue: { required: !0 },
878
+ modelModifiers: {}
879
+ },
880
+ emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
881
+ setup(e, { emit: C }) {
882
+ const { i18n: { t: f } } = J.useI18n(), l = X(e, "modelValue"), a = C, v = xe("configType", "basic");
883
+ return (i, A) => {
884
+ const h = H("KLabel"), g = H("KInput");
885
+ return m(), O("div", no, [
886
+ d(h, { "tooltip-attributes": { maxWidth: "320" } }, {
887
+ tooltip: n(() => [
888
+ V("span", {
889
+ innerHTML: o(f)("form.fields.paths.tooltip")
890
+ }, null, 8, uo)
891
+ ]),
892
+ default: n(() => [
893
+ U(" " + k(o(v) === "basic" ? o(f)("form.fields.paths.label_singular") : o(f)("form.fields.paths.label")), 1)
894
+ ]),
895
+ _: 1
896
+ }),
897
+ d(me, { name: "appear" }, {
898
+ default: n(() => [
899
+ (m(!0), O(G, null, le(o(v) === "basic" ? l.value.slice(0, 1) : l.value, (p, y) => (m(), O("div", {
900
+ key: y,
901
+ class: "routing-rule-input"
902
+ }, [
903
+ d(g, {
904
+ modelValue: l.value[y],
905
+ "onUpdate:modelValue": (w) => l.value[y] = w,
906
+ modelModifiers: { trim: !0 },
907
+ "data-testid": `route-form-paths-input-${y + 1}`,
908
+ placeholder: o(f)("form.fields.paths.placeholder")
909
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
910
+ d(Te, {
911
+ disabled: l.value.length === 1,
912
+ "routing-rules-entity": o(s).PATHS,
913
+ onRemove: (w) => a("remove", y)
914
+ }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
915
+ ]))), 128))
916
+ ]),
917
+ _: 1
918
+ }),
919
+ d(_e, {
920
+ "routing-rules-entity": o(s).PATHS,
921
+ onAdd: A[0] || (A[0] = (p) => a("add"))
922
+ }, null, 8, ["routing-rules-entity"])
923
+ ]);
924
+ };
925
+ }
926
+ }), po = /* @__PURE__ */ Z(co, [["__scopeId", "data-v-eb440a9e"]]), fo = { class: "routing-rule-container" }, mo = ["innerHTML"], vo = /* @__PURE__ */ z({
927
+ __name: "SniRules",
928
+ props: {
929
+ modelValue: { required: !0 },
930
+ modelModifiers: {}
931
+ },
932
+ emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
933
+ setup(e, { emit: C }) {
934
+ const { i18n: { t: f } } = J.useI18n(), l = X(e, "modelValue"), a = C;
935
+ return (v, i) => {
936
+ const A = H("KLabel"), h = H("KInput");
937
+ return m(), O("div", fo, [
938
+ d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
939
+ tooltip: n(() => [
940
+ V("span", {
941
+ innerHTML: o(f)("form.fields.snis.tooltip")
942
+ }, null, 8, mo)
943
+ ]),
944
+ default: n(() => [
945
+ U(" " + k(o(f)("form.fields.snis.label")), 1)
946
+ ]),
947
+ _: 1
948
+ }),
949
+ d(me, { name: "appear" }, {
950
+ default: n(() => [
951
+ (m(!0), O(G, null, le(l.value, (g, p) => (m(), O("div", {
952
+ key: p,
953
+ class: "routing-rule-input"
954
+ }, [
955
+ d(h, {
956
+ modelValue: l.value[p],
957
+ "onUpdate:modelValue": (y) => l.value[p] = y,
958
+ modelModifiers: { trim: !0 },
959
+ "data-testid": `route-form-snis-input-${p + 1}`,
960
+ placeholder: o(f)("form.fields.snis.placeholder")
961
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
962
+ d(Te, {
963
+ disabled: l.value.length === 1,
964
+ "routing-rules-entity": o(s).SNIS,
965
+ onRemove: (y) => a("remove", p)
966
+ }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
967
+ ]))), 128))
968
+ ]),
969
+ _: 1
970
+ }),
971
+ d(_e, {
972
+ "routing-rules-entity": o(s).SNIS,
973
+ onAdd: i[0] || (i[0] = (g) => a("add"))
974
+ }, null, 8, ["routing-rules-entity"])
975
+ ]);
976
+ };
977
+ }
978
+ }), ho = /* @__PURE__ */ Z(vo, [["__scopeId", "data-v-e6782e08"]]), go = { class: "routing-rule-container" }, yo = ["innerHTML"], So = /* @__PURE__ */ z({
979
+ __name: "SourceRules",
980
+ props: {
981
+ modelValue: { required: !0 },
982
+ modelModifiers: {}
983
+ },
984
+ emits: /* @__PURE__ */ Y(["add", "remove"], ["update:modelValue"]),
985
+ setup(e, { emit: C }) {
986
+ const { i18n: { t: f } } = J.useI18n(), l = X(e, "modelValue"), a = C;
987
+ return (v, i) => {
988
+ const A = H("KLabel"), h = H("KInput");
989
+ return m(), O("div", go, [
990
+ d(A, { "tooltip-attributes": { maxWidth: "320" } }, {
991
+ tooltip: n(() => [
992
+ V("span", {
993
+ innerHTML: o(f)("form.fields.sources.tooltip")
994
+ }, null, 8, yo)
995
+ ]),
996
+ default: n(() => [
997
+ U(" " + k(o(f)("form.fields.sources.label")), 1)
998
+ ]),
999
+ _: 1
1000
+ }),
1001
+ d(me, { name: "appear" }, {
1002
+ default: n(() => [
1003
+ (m(!0), O(G, null, le(l.value, (g, p) => (m(), O("div", {
1004
+ key: p,
1005
+ class: "routing-rule-input"
1006
+ }, [
1007
+ d(h, {
1008
+ modelValue: l.value[p].ip,
1009
+ "onUpdate:modelValue": (y) => l.value[p].ip = y,
1010
+ modelModifiers: { trim: !0 },
1011
+ "data-testid": `route-form-sources-ip-input-${p + 1}`,
1012
+ placeholder: o(f)("form.fields.sources.ip.placeholder")
1013
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
1014
+ d(h, {
1015
+ modelValue: l.value[p].port,
1016
+ "onUpdate:modelValue": (y) => l.value[p].port = y,
1017
+ modelModifiers: { number: !0 },
1018
+ "data-testid": `route-form-sources-port-input-${p + 1}`,
1019
+ max: "65535",
1020
+ min: "0",
1021
+ placeholder: o(f)("form.fields.sources.port.placeholder"),
1022
+ type: "number"
1023
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "data-testid", "placeholder"]),
1024
+ d(Te, {
1025
+ disabled: l.value.length === 1,
1026
+ "routing-rules-entity": o(s).SOURCES,
1027
+ onRemove: (y) => a("remove", p)
1028
+ }, null, 8, ["disabled", "routing-rules-entity", "onRemove"])
1029
+ ]))), 128))
1030
+ ]),
1031
+ _: 1
1032
+ }),
1033
+ d(_e, {
1034
+ "routing-rules-entity": o(s).SOURCES,
1035
+ onAdd: i[0] || (i[0] = (g) => a("add"))
1036
+ }, null, 8, ["routing-rules-entity"])
1037
+ ]);
1038
+ };
1039
+ }
1040
+ }), bo = /* @__PURE__ */ Z(So, [["__scopeId", "data-v-448078c1"]]), _o = { class: "traditional-rules-hint" }, To = { key: 0 }, Io = ["innerHTML"], Eo = {
1041
+ key: 0,
1042
+ class: "route-form-fields-container route-form-advanced-fields-container"
1043
+ }, Ro = ["innerHTML"], Ao = ["innerHTML"], Oo = ["innerHTML"], ko = ["innerHTML"], Ho = ["innerHTML"], No = ["innerHTML"], Co = /* @__PURE__ */ z({
1044
+ __name: "TraditionalRules",
1045
+ props: /* @__PURE__ */ Y({
1046
+ protocols: {},
1047
+ hideAdvanced: { type: Boolean },
1048
+ readonly: { type: Boolean },
1049
+ configType: {}
1050
+ }, {
1051
+ fields: { required: !0 },
1052
+ fieldsModifiers: {},
1053
+ customMethods: { required: !0 },
1054
+ customMethodsModifiers: {}
1055
+ }),
1056
+ emits: ["update:fields", "update:customMethods"],
1057
+ setup(e) {
1058
+ const { i18nT: C, i18n: f, i18n: { t: l } } = J.useI18n(), a = f.source.form.protocols, v = e, i = X(e, "fields"), A = X(e, "customMethods"), h = (r) => {
1059
+ switch (r) {
1060
+ case s.PATHS:
1061
+ Array.isArray(i.value.paths) ? i.value.paths.push([...W[s.PATHS]][0]) : i.value.paths = [...W[s.PATHS]];
1062
+ break;
1063
+ case s.SNIS:
1064
+ Array.isArray(i.value.snis) ? i.value.snis.push([...W[s.SNIS]][0]) : i.value.snis = [...W[s.SNIS]];
1065
+ break;
1066
+ case s.HOSTS:
1067
+ Array.isArray(i.value.hosts) ? i.value.hosts.push([...W[s.HOSTS]][0]) : i.value.hosts = [...W[s.HOSTS]];
1068
+ break;
1069
+ case s.METHODS:
1070
+ i.value.methods || (i.value.methods = { ...W[s.METHODS] });
1071
+ break;
1072
+ case s.HEADERS:
1073
+ Array.isArray(i.value.headers) ? i.value.headers.push({ ...W[s.HEADERS][0] }) : i.value.headers = [{ ...W[s.HEADERS][0] }];
1074
+ break;
1075
+ case s.SOURCES:
1076
+ Array.isArray(i.value.sources) ? i.value.sources.push({ ...W[s.SOURCES][0] }) : i.value.sources = [{ ...W[s.SOURCES][0] }];
1077
+ break;
1078
+ case s.DESTINATIONS:
1079
+ Array.isArray(i.value.destinations) ? i.value.destinations.push({ ...W[s.DESTINATIONS][0] }) : i.value.destinations = [{ ...W[s.DESTINATIONS][0] }];
1080
+ break;
1081
+ }
1082
+ }, g = async (r, u) => {
1083
+ if (typeof u < "u") {
1084
+ const S = i.value[r];
1085
+ if (Array.isArray(S) && (S.splice(u, 1), S.length > 0))
1086
+ return;
1087
+ }
1088
+ await st(() => {
1089
+ delete i.value[r];
1090
+ });
1091
+ }, p = (r) => r.some((u) => v.protocols.includes(u)), y = M(() => new Set(Ue[v.protocols])), w = M(() => {
1092
+ if (p(["tls_passthrough"]))
1093
+ return [F(s.SNIS)];
1094
+ const r = (v.configType === "basic" ? [s.PATHS, s.METHODS, s.HOSTS] : Ue[v.protocols]).map((u) => F(u));
1095
+ return [[...r].splice(0, r.length - 1).join(", "), r[r.length - 1]];
1096
+ }), F = (r) => {
1097
+ var S;
1098
+ return ((S = f.source.form.fields[r]) == null ? void 0 : S.singular) || "";
1099
+ };
1100
+ return (r, u) => {
1101
+ const S = H("KCheckbox"), D = H("KSelect"), se = H("KInput"), j = H("KCard");
1102
+ return m(), x(j, null, {
1103
+ default: n(() => {
1104
+ var E;
1105
+ return [
1106
+ V("span", _o, [
1107
+ d(o(C), { keypath: "form.hint.rules_message" }, {
1108
+ protocol: n(() => [
1109
+ V("b", null, k(o(a)[e.protocols]), 1)
1110
+ ]),
1111
+ routingRules: n(() => [
1112
+ d(o(C), {
1113
+ keypath: w.value[1] ? "form.hint.multiple_rules" : "form.hint.single_rule"
1114
+ }, {
1115
+ routingRules: n(() => [
1116
+ U(k(w.value[0]), 1)
1117
+ ]),
1118
+ lastRoutingRule: n(() => [
1119
+ U(k(w.value[1]), 1)
1120
+ ]),
1121
+ _: 1
1122
+ }, 8, ["keypath"])
1123
+ ]),
1124
+ _: 1
1125
+ }),
1126
+ e.configType === "basic" ? (m(), O("span", To, k(o(l)("form.hint.advanced")), 1)) : P("", !0)
1127
+ ]),
1128
+ d(me, { name: "appear" }, {
1129
+ default: n(() => {
1130
+ var b;
1131
+ return [
1132
+ i.value.paths && y.value.has(o(s).PATHS) ? (m(), x(po, {
1133
+ key: "paths-container",
1134
+ modelValue: i.value.paths,
1135
+ "onUpdate:modelValue": u[0] || (u[0] = (_) => i.value.paths = _),
1136
+ onAdd: u[1] || (u[1] = (_) => h(o(s).PATHS)),
1137
+ onRemove: u[2] || (u[2] = (_) => g(o(s).PATHS, _))
1138
+ }, null, 8, ["modelValue"])) : P("", !0),
1139
+ p(["http", "https", "ws", "wss"]) ? (m(), x(S, {
1140
+ key: 1,
1141
+ modelValue: i.value.strip_path,
1142
+ "onUpdate:modelValue": u[3] || (u[3] = (_) => i.value.strip_path = _),
1143
+ class: "route-form-strip-path",
1144
+ "data-testid": "route-form-strip-path",
1145
+ disabled: !((b = i.value.paths) != null && b.some(Boolean)),
1146
+ label: o(l)("form.fields.strip_path.label"),
1147
+ "label-attributes": {
1148
+ tooltipAttributes: { maxWidth: "320" }
1149
+ }
1150
+ }, {
1151
+ tooltip: n(() => [
1152
+ V("span", {
1153
+ innerHTML: o(l)("form.fields.strip_path.tooltip")
1154
+ }, null, 8, Io)
1155
+ ]),
1156
+ _: 1
1157
+ }, 8, ["modelValue", "disabled", "label"])) : P("", !0),
1158
+ i.value.methods && y.value.has(o(s).METHODS) ? (m(), x(ao, {
1159
+ key: "methods-container",
1160
+ "custom-methods": A.value,
1161
+ "onUpdate:customMethods": u[4] || (u[4] = (_) => A.value = _),
1162
+ methods: i.value.methods,
1163
+ "onUpdate:methods": u[5] || (u[5] = (_) => i.value.methods = _)
1164
+ }, null, 8, ["custom-methods", "methods"])) : P("", !0),
1165
+ i.value.hosts && y.value.has(o(s).HOSTS) ? (m(), x(oo, {
1166
+ key: "hosts-container",
1167
+ modelValue: i.value.hosts,
1168
+ "onUpdate:modelValue": u[6] || (u[6] = (_) => i.value.hosts = _),
1169
+ onAdd: u[7] || (u[7] = (_) => h(o(s).HOSTS)),
1170
+ onRemove: u[8] || (u[8] = (_) => g(o(s).HOSTS, _))
1171
+ }, null, 8, ["modelValue"])) : P("", !0),
1172
+ i.value.headers && e.configType === "advanced" && y.value.has(o(s).HEADERS) ? (m(), x(Yt, {
1173
+ key: "headers-container",
1174
+ modelValue: i.value.headers,
1175
+ "onUpdate:modelValue": u[9] || (u[9] = (_) => i.value.headers = _),
1176
+ onAdd: u[10] || (u[10] = (_) => h(o(s).HEADERS)),
1177
+ onRemove: u[11] || (u[11] = (_) => g(o(s).HEADERS, _))
1178
+ }, null, 8, ["modelValue"])) : P("", !0),
1179
+ i.value.sources && y.value.has(o(s).SOURCES) ? (m(), x(bo, {
1180
+ key: "sources-container",
1181
+ modelValue: i.value.sources,
1182
+ "onUpdate:modelValue": u[12] || (u[12] = (_) => i.value.sources = _),
1183
+ onAdd: u[13] || (u[13] = (_) => h(o(s).SOURCES)),
1184
+ onRemove: u[14] || (u[14] = (_) => g(o(s).SOURCES, _))
1185
+ }, null, 8, ["modelValue"])) : P("", !0),
1186
+ i.value.destinations && y.value.has(o(s).DESTINATIONS) ? (m(), x(Xt, {
1187
+ key: "destinations-container",
1188
+ modelValue: i.value.destinations,
1189
+ "onUpdate:modelValue": u[15] || (u[15] = (_) => i.value.destinations = _),
1190
+ onAdd: u[16] || (u[16] = (_) => h(o(s).DESTINATIONS)),
1191
+ onRemove: u[17] || (u[17] = (_) => g(o(s).DESTINATIONS, _))
1192
+ }, null, 8, ["modelValue"])) : P("", !0),
1193
+ i.value.snis && e.configType === "advanced" && y.value.has(o(s).SNIS) ? (m(), x(ho, {
1194
+ key: "snis-container",
1195
+ modelValue: i.value.snis,
1196
+ "onUpdate:modelValue": u[18] || (u[18] = (_) => i.value.snis = _),
1197
+ onAdd: u[19] || (u[19] = (_) => h(o(s).SNIS)),
1198
+ onRemove: u[20] || (u[20] = (_) => g(o(s).SNIS, _))
1199
+ }, null, 8, ["modelValue"])) : P("", !0)
1200
+ ];
1201
+ }),
1202
+ _: 1
1203
+ }),
1204
+ e.hideAdvanced ? P("", !0) : (m(), O("div", Eo, [
1205
+ (E = i.value.paths) != null && E.some(Boolean) ? (m(), x(D, {
1206
+ key: 0,
1207
+ modelValue: i.value.path_handling,
1208
+ "onUpdate:modelValue": u[21] || (u[21] = (b) => i.value.path_handling = b),
1209
+ "data-testid": "route-form-path-handling",
1210
+ items: o(Pt),
1211
+ label: o(l)("form.fields.path_handling.label"),
1212
+ "label-attributes": {
1213
+ tooltipAttributes: { maxWidth: "320" }
1214
+ },
1215
+ readonly: e.readonly,
1216
+ width: "100%"
1217
+ }, {
1218
+ "label-tooltip": n(() => [
1219
+ V("span", {
1220
+ innerHTML: o(l)("form.fields.path_handling.tooltip")
1221
+ }, null, 8, Ro)
1222
+ ]),
1223
+ _: 1
1224
+ }, 8, ["modelValue", "items", "label", "readonly"])) : P("", !0),
1225
+ d(D, {
1226
+ modelValue: i.value.https_redirect_status_code,
1227
+ "onUpdate:modelValue": u[22] || (u[22] = (b) => i.value.https_redirect_status_code = b),
1228
+ "data-testid": "route-form-http-redirect-status-code",
1229
+ items: o(tt),
1230
+ label: o(l)("form.fields.https_redirect_status_code.label"),
1231
+ "label-attributes": {
1232
+ tooltipAttributes: { maxWidth: "320" }
1233
+ },
1234
+ readonly: e.readonly,
1235
+ width: "100%"
1236
+ }, {
1237
+ "label-tooltip": n(() => [
1238
+ V("span", {
1239
+ innerHTML: o(l)("form.fields.https_redirect_status_code.tooltip")
1240
+ }, null, 8, Ao)
1241
+ ]),
1242
+ _: 1
1243
+ }, 8, ["modelValue", "items", "label", "readonly"]),
1244
+ d(se, {
1245
+ modelValue: i.value.regex_priority,
1246
+ "onUpdate:modelValue": u[23] || (u[23] = (b) => i.value.regex_priority = b),
1247
+ autocomplete: "off",
1248
+ "data-testid": "route-form-regex-priority",
1249
+ label: o(l)("form.fields.regex_priority.label"),
1250
+ "label-attributes": {
1251
+ tooltipAttributes: { maxWidth: "320" }
1252
+ },
1253
+ readonly: e.readonly,
1254
+ type: "number"
1255
+ }, {
1256
+ "label-tooltip": n(() => [
1257
+ V("span", {
1258
+ innerHTML: o(l)("form.fields.regex_priority.tooltip")
1259
+ }, null, 8, Oo)
1260
+ ]),
1261
+ _: 1
1262
+ }, 8, ["modelValue", "label", "readonly"]),
1263
+ d(S, {
1264
+ modelValue: i.value.preserve_host,
1265
+ "onUpdate:modelValue": u[24] || (u[24] = (b) => i.value.preserve_host = b),
1266
+ "data-testid": "route-form-preserve-host",
1267
+ label: o(l)("form.fields.preserve_host.label"),
1268
+ "label-attributes": {
1269
+ tooltipAttributes: { maxWidth: "320" }
1270
+ }
1271
+ }, {
1272
+ tooltip: n(() => [
1273
+ V("span", {
1274
+ innerHTML: o(l)("form.fields.preserve_host.tooltip")
1275
+ }, null, 8, ko)
1276
+ ]),
1277
+ _: 1
1278
+ }, 8, ["modelValue", "label"]),
1279
+ d(S, {
1280
+ modelValue: i.value.request_buffering,
1281
+ "onUpdate:modelValue": u[25] || (u[25] = (b) => i.value.request_buffering = b),
1282
+ "data-testid": "route-form-request-buffering",
1283
+ label: o(l)("form.fields.request_buffering.label"),
1284
+ "label-attributes": {
1285
+ tooltipAttributes: { maxWidth: "320" }
1286
+ }
1287
+ }, {
1288
+ tooltip: n(() => [
1289
+ V("span", {
1290
+ innerHTML: o(l)("form.fields.request_buffering.tooltip")
1291
+ }, null, 8, Ho)
1292
+ ]),
1293
+ _: 1
1294
+ }, 8, ["modelValue", "label"]),
1295
+ d(S, {
1296
+ modelValue: i.value.response_buffering,
1297
+ "onUpdate:modelValue": u[26] || (u[26] = (b) => i.value.response_buffering = b),
1298
+ "data-testid": "route-form-response-buffering",
1299
+ label: o(l)("form.fields.response_buffering.label"),
1300
+ "label-attributes": {
1301
+ tooltipAttributes: { maxWidth: "320" }
1302
+ }
1303
+ }, {
1304
+ tooltip: n(() => [
1305
+ V("span", {
1306
+ innerHTML: o(l)("form.fields.response_buffering.tooltip")
1307
+ }, null, 8, No)
1308
+ ]),
1309
+ _: 1
1310
+ }, 8, ["modelValue", "label"])
1311
+ ]))
1312
+ ];
1313
+ }),
1314
+ _: 1
1315
+ });
1316
+ };
1317
+ }
1318
+ }), Je = /* @__PURE__ */ Z(Co, [["__scopeId", "data-v-f3fa9614"]]), xo = /* @__PURE__ */ z({
1319
+ __name: "RouteFormExpressionsEditorLoader",
1320
+ props: /* @__PURE__ */ Y({
1321
+ protocol: {},
1322
+ showExpressionsModalEntry: { type: Boolean }
1323
+ }, {
1324
+ modelValue: { required: !0 },
1325
+ modelModifiers: {}
1326
+ }),
1327
+ emits: /* @__PURE__ */ Y(["notify"], ["update:modelValue"]),
1328
+ setup(e, { emit: C }) {
1329
+ const { i18n: { t: f } } = J.useI18n(), l = {
1330
+ render: () => Fe("div", f("form.expressions_editor.loading"))
1331
+ }, a = {
1332
+ render: () => Fe("div", f("form.expressions_editor.error"))
1333
+ }, v = lt({
1334
+ loader: async () => import("./RouteFormExpressionsEditor-F5bIgjiX.js"),
1335
+ loadingComponent: l,
1336
+ errorComponent: a
1337
+ }), i = e, A = C, h = B(ge.LOADING), g = X(e, "modelValue"), p = (y) => {
1338
+ g.value = y;
1339
+ };
1340
+ return Qe(async () => {
1341
+ try {
1342
+ await (await import("@kong-ui-public/expressions")).asyncInit, h.value = ge.READY;
1343
+ } catch (y) {
1344
+ h.value = ge.ERROR, console.error(y);
1345
+ }
1346
+ }), (y, w) => (m(), O(G, null, [
1347
+ h.value === o(ge).ERROR ? (m(), x(Ke(a), {
1348
+ key: 0,
1349
+ "data-testid": "route-form-expressions-editor-loader-error"
1350
+ })) : h.value === o(ge).LOADING ? (m(), x(Ke(l), {
1351
+ key: 1,
1352
+ "data-testid": "route-form-expressions-editor-loader-loading"
1353
+ })) : (m(), x(o(v), {
1354
+ key: 2,
1355
+ modelValue: g.value,
1356
+ "onUpdate:modelValue": w[0] || (w[0] = (F) => g.value = F),
1357
+ protocol: i.protocol,
1358
+ "show-expressions-modal-entry": e.showExpressionsModalEntry,
1359
+ onNotify: w[1] || (w[1] = (F) => A("notify", F))
1360
+ }, {
1361
+ default: n(() => [
1362
+ d(o(Rt), { size: o(Bt) }, null, 8, ["size"]),
1363
+ V("span", null, k(o(f)("form.expression_playground.test_link")), 1)
1364
+ ]),
1365
+ _: 1
1366
+ }, 8, ["modelValue", "protocol", "show-expressions-modal-entry"])),
1367
+ Pe(y.$slots, "after-editor", {
1368
+ expression: { value: g.value, update: p },
1369
+ state: h.value
1370
+ })
1371
+ ], 64));
1372
+ }
1373
+ }), wo = { class: "route-form-routing-rules-title-container" }, Vo = { class: "routing-rules-title" }, Mo = { class: "route-form-fields-container route-form-advanced-fields-container" }, Do = /* @__PURE__ */ z({
1374
+ __name: "ExpressionsRules",
1375
+ props: /* @__PURE__ */ Y({
1376
+ protocols: {},
1377
+ hideAdvanced: { type: Boolean },
1378
+ readonly: { type: Boolean },
1379
+ showExpressionsModalEntry: { type: Boolean }
1380
+ }, {
1381
+ fields: { required: !0 },
1382
+ fieldsModifiers: {}
1383
+ }),
1384
+ emits: /* @__PURE__ */ Y(["notify"], ["update:fields"]),
1385
+ setup(e, { emit: C }) {
1386
+ const { i18n: { t: f } } = J.useI18n(), l = e, a = X(e, "fields"), v = C, i = B(!0), A = M(() => l.protocols.split(",") || []), h = (g) => g.some((p) => l.protocols.includes(p));
1387
+ return (g, p) => {
1388
+ const y = H("KCard"), w = H("KSelect"), F = H("KInput"), r = H("KCheckbox"), u = H("KCollapse");
1389
+ return m(), O(G, null, [
1390
+ d(y, null, {
1391
+ title: n(() => [
1392
+ V("div", wo, [
1393
+ (m(!0), O(G, null, le(A.value, (S) => (m(), O("span", {
1394
+ key: S,
1395
+ class: "protocol-title"
1396
+ }, k(S.toUpperCase()), 1))), 128)),
1397
+ V("span", Vo, k(o(f)("form.sections.routingExpression.title")), 1)
1398
+ ])
1399
+ ]),
1400
+ default: n(() => [
1401
+ d(xo, {
1402
+ modelValue: a.value.expression,
1403
+ "onUpdate:modelValue": p[0] || (p[0] = (S) => a.value.expression = S),
1404
+ protocol: A.value[0],
1405
+ "show-expressions-modal-entry": e.showExpressionsModalEntry,
1406
+ onNotify: p[1] || (p[1] = (S) => v("notify", S))
1407
+ }, {
1408
+ "after-editor": n((S) => [
1409
+ Pe(g.$slots, "after-expressions-editor", {
1410
+ expression: S.expression,
1411
+ state: S.state
1412
+ }, void 0, !0)
1413
+ ]),
1414
+ _: 3
1415
+ }, 8, ["modelValue", "protocol", "show-expressions-modal-entry"])
1416
+ ]),
1417
+ _: 3
1418
+ }),
1419
+ d(u, {
1420
+ modelValue: i.value,
1421
+ "onUpdate:modelValue": p[8] || (p[8] = (S) => i.value = S),
1422
+ class: "route-form-advanced-fields-collapse",
1423
+ "trigger-alignment": "leading",
1424
+ "trigger-label": o(f)("form.show_more")
1425
+ }, {
1426
+ default: n(() => [
1427
+ d(y, null, {
1428
+ default: n(() => [
1429
+ V("div", Mo, [
1430
+ d(w, {
1431
+ modelValue: a.value.https_redirect_status_code,
1432
+ "onUpdate:modelValue": p[2] || (p[2] = (S) => a.value.https_redirect_status_code = S),
1433
+ "data-testid": "route-form-http-redirect-status-code",
1434
+ items: o(tt),
1435
+ label: o(f)("form.fields.https_redirect_status_code.label"),
1436
+ readonly: e.readonly,
1437
+ width: "100%"
1438
+ }, null, 8, ["modelValue", "items", "label", "readonly"]),
1439
+ d(F, {
1440
+ modelValue: a.value.priority,
1441
+ "onUpdate:modelValue": p[3] || (p[3] = (S) => a.value.priority = S),
1442
+ autocomplete: "off",
1443
+ "data-testid": "route-form-priority",
1444
+ label: o(f)("form.fields.priority.label"),
1445
+ "label-attributes": {
1446
+ info: o(f)("form.fields.priority.tooltip"),
1447
+ tooltipAttributes: { maxWidth: "400" }
1448
+ },
1449
+ readonly: e.readonly,
1450
+ type: "number"
1451
+ }, null, 8, ["modelValue", "label", "label-attributes", "readonly"]),
1452
+ h(["http", "https", "ws", "wss", "tls", "tcp", "udp", "tls_passthrough"]) ? (m(), x(r, {
1453
+ key: 0,
1454
+ modelValue: a.value.strip_path,
1455
+ "onUpdate:modelValue": p[4] || (p[4] = (S) => a.value.strip_path = S),
1456
+ "data-testid": "route-form-strip-path",
1457
+ label: o(f)("form.fields.strip_path.label")
1458
+ }, null, 8, ["modelValue", "label"])) : P("", !0),
1459
+ d(r, {
1460
+ modelValue: a.value.preserve_host,
1461
+ "onUpdate:modelValue": p[5] || (p[5] = (S) => a.value.preserve_host = S),
1462
+ "data-testid": "route-form-preserve-host",
1463
+ label: o(f)("form.fields.preserve_host.label")
1464
+ }, null, 8, ["modelValue", "label"]),
1465
+ d(r, {
1466
+ modelValue: a.value.request_buffering,
1467
+ "onUpdate:modelValue": p[6] || (p[6] = (S) => a.value.request_buffering = S),
1468
+ "data-testid": "route-form-request-buffering",
1469
+ label: o(f)("form.fields.request_buffering.label")
1470
+ }, null, 8, ["modelValue", "label"]),
1471
+ d(r, {
1472
+ modelValue: a.value.response_buffering,
1473
+ "onUpdate:modelValue": p[7] || (p[7] = (S) => a.value.response_buffering = S),
1474
+ "data-testid": "route-form-response-buffering",
1475
+ label: o(f)("form.fields.response_buffering.label")
1476
+ }, null, 8, ["modelValue", "label"])
1477
+ ])
1478
+ ]),
1479
+ _: 1
1480
+ })
1481
+ ]),
1482
+ _: 1
1483
+ }, 8, ["modelValue", "trigger-label"])
1484
+ ], 64);
1485
+ };
1486
+ }
1487
+ }), $o = /* @__PURE__ */ Z(Do, [["__scopeId", "data-v-e7571a47"]]), Uo = { class: "config-type-container" }, Po = {
1488
+ key: 0,
1489
+ class: "config-flavor"
1490
+ }, Lo = /* @__PURE__ */ z({
1491
+ __name: "RouteFormRulesComposer",
1492
+ props: /* @__PURE__ */ Y({
1493
+ protocols: {},
1494
+ routeFlavors: {},
1495
+ readonly: { type: Boolean },
1496
+ recordFlavor: {},
1497
+ showExpressionsModalEntry: { type: Boolean },
1498
+ tooltips: {},
1499
+ isWsSupported: { type: Boolean },
1500
+ hideProtocols: { type: Boolean }
1501
+ }, {
1502
+ configType: { required: !0 },
1503
+ configTypeModifiers: {},
1504
+ configFlavor: { required: !0 },
1505
+ configFlavorModifiers: {},
1506
+ fields: {
1507
+ default: () => Ne({
1508
+ ...Ce,
1509
+ paths: [""],
1510
+ regex_priority: 0,
1511
+ path_handling: "v0",
1512
+ expression: "",
1513
+ priority: 0
1514
+ })
1515
+ },
1516
+ fieldsModifiers: {},
1517
+ customMethods: { default: () => Ne([]) },
1518
+ customMethodsModifiers: {}
1519
+ }),
1520
+ emits: /* @__PURE__ */ Y(["notify", "update:payload", "update:protocols"], ["update:configType", "update:configFlavor", "update:fields", "update:customMethods"]),
1521
+ setup(e, { emit: C }) {
1522
+ const f = e, l = X(e, "configType"), a = X(e, "configFlavor"), v = X(e, "fields"), i = X(e, "customMethods"), A = C, { i18n: { t: h } } = J.useI18n(), g = [
1523
+ {
1524
+ value: q.TRADITIONAL,
1525
+ label: h("form.flavors.traditional")
1526
+ },
1527
+ {
1528
+ value: q.EXPRESSIONS,
1529
+ label: h("form.flavors.expressions")
1530
+ }
1531
+ ], p = M(() => [
1532
+ { label: h("form.protocols.grpc"), value: "grpc" },
1533
+ { label: h("form.protocols.grpcs"), value: "grpcs" },
1534
+ { label: h("form.protocols.grpc,grpcs"), value: "grpc,grpcs" },
1535
+ { label: h("form.protocols.http"), value: "http" },
1536
+ { label: h("form.protocols.https"), value: "https" },
1537
+ { label: h("form.protocols.http,https"), value: "http,https" },
1538
+ { label: h("form.protocols.tcp"), value: "tcp" },
1539
+ { label: h("form.protocols.tls"), value: "tls" },
1540
+ { label: h("form.protocols.tls,udp"), value: "tls,udp" },
1541
+ { label: h("form.protocols.tcp,udp"), value: "tcp,udp" },
1542
+ { label: h("form.protocols.tcp,tls"), value: "tcp,tls" },
1543
+ { label: h("form.protocols.tcp,tls,udp"), value: "tcp,tls,udp" },
1544
+ { label: h("form.protocols.tls_passthrough"), value: "tls_passthrough" },
1545
+ { label: h("form.protocols.udp"), value: "udp" },
1546
+ ...f.isWsSupported ? [
1547
+ { label: h("form.protocols.ws"), value: "ws" },
1548
+ { label: h("form.protocols.wss"), value: "wss" },
1549
+ { label: h("form.protocols.ws,wss"), value: "ws,wss" }
1550
+ ] : []
1551
+ ]), y = M(() => f.recordFlavor ? f.recordFlavor : a.value), w = (E, b) => {
1552
+ if (!new Set(Ue[f.protocols]).has(E))
1553
+ return [];
1554
+ if ([s.PATHS, s.HOSTS, s.METHODS, s.SNIS].includes(E))
1555
+ return [...b].filter((K) => !!K);
1556
+ if (E === s.SOURCES || E === s.DESTINATIONS)
1557
+ return [...b].filter((K) => !!K.ip || !!K.port).map((K) => ({
1558
+ ip: K.ip || void 0,
1559
+ port: !K.port && K.port !== 0 ? void 0 : K.port
1560
+ }));
1561
+ if (E === s.HEADERS)
1562
+ return [...b].filter((K) => !!K.header);
1563
+ }, F = (E) => E.some((b) => f.protocols.includes(b)), r = () => {
1564
+ if (y.value !== q.TRADITIONAL)
1565
+ return null;
1566
+ const E = v.value, b = w(s.HEADERS, E.headers || []) || W[s.HEADERS];
1567
+ return b.length === 0 ? null : b.reduce((_, K) => (_[K.header] = K.values.split(","), _), {});
1568
+ }, u = M(() => (v.value.methods || []).filter((_) => Object.keys(be).includes(_)).concat(i.value.map((_) => _.label.toUpperCase()))), S = (E) => E != null && E.length ? E : null, D = M(() => ({
1569
+ https_redirect_status_code: v.value.https_redirect_status_code,
1570
+ strip_path: F(["http", "https", "ws", "wss"]) ? v.value.strip_path : !1,
1571
+ preserve_host: v.value.preserve_host,
1572
+ request_buffering: v.value.request_buffering,
1573
+ response_buffering: v.value.response_buffering
1574
+ })), se = M(() => {
1575
+ switch (y.value) {
1576
+ case q.TRADITIONAL: {
1577
+ const E = v.value, b = S(w(s.PATHS, E.paths || [])), _ = S(w(s.HOSTS, E.hosts || [])), K = {
1578
+ ...D.value,
1579
+ methods: S(w(s.METHODS, u.value)),
1580
+ hosts: l.value === "basic" && _ ? _.slice(0, 1) : _,
1581
+ paths: l.value === "basic" && b ? b.slice(0, 1) : b,
1582
+ headers: l.value === "basic" ? null : r(),
1583
+ regex_priority: Number(E.regex_priority),
1584
+ path_handling: E.path_handling,
1585
+ sources: S(w(s.SOURCES, E.sources || [])),
1586
+ destinations: S(w(s.DESTINATIONS, E.destinations || [])),
1587
+ snis: l.value === "basic" ? null : S(w(s.SNIS, E.snis || []))
1588
+ };
1589
+ return {
1590
+ type: y.value,
1591
+ payload: K
1592
+ };
1593
+ }
1594
+ case q.EXPRESSIONS: {
1595
+ const E = v.value;
1596
+ return {
1597
+ type: y.value,
1598
+ payload: {
1599
+ ...D.value,
1600
+ expression: E.expression,
1601
+ priority: Number(E.priority)
1602
+ }
1603
+ };
1604
+ }
1605
+ default:
1606
+ return;
1607
+ }
1608
+ }), j = (E) => {
1609
+ E && A("update:protocols", E);
1610
+ };
1611
+ return ye([() => f.recordFlavor, () => f.routeFlavors], ([E, b]) => {
1612
+ if (E) {
1613
+ a.value = E;
1614
+ return;
1615
+ }
1616
+ a.value = !b.traditional && b.expressions ? q.EXPRESSIONS : q.TRADITIONAL;
1617
+ }, { immediate: !0, deep: !0 }), ye(l, (E) => {
1618
+ E === "basic" && (a.value = q.TRADITIONAL, A("update:protocols", "http,https"));
1619
+ }), ye(se, (E) => {
1620
+ A("update:payload", E);
1621
+ }, { deep: !0, immediate: !0 }), (E, b) => {
1622
+ const _ = H("KRadio"), K = H("KLabel"), Ie = H("KTooltip"), ne = H("KSegmentedControl"), ee = H("KAlert"), ve = H("KSelect");
1623
+ return m(), O(G, null, [
1624
+ V("div", Uo, [
1625
+ d(_, {
1626
+ modelValue: l.value,
1627
+ "onUpdate:modelValue": b[0] || (b[0] = ($) => l.value = $),
1628
+ card: "",
1629
+ "card-orientation": "horizontal",
1630
+ "data-testid": "route-form-config-type-basic",
1631
+ description: o(h)("form.config_types.basic.description"),
1632
+ disabled: !e.routeFlavors.traditional || e.recordFlavor === o(q).EXPRESSIONS,
1633
+ label: o(h)("form.config_types.basic.label"),
1634
+ "selected-value": "basic"
1635
+ }, null, 8, ["modelValue", "description", "disabled", "label"]),
1636
+ d(_, {
1637
+ modelValue: l.value,
1638
+ "onUpdate:modelValue": b[1] || (b[1] = ($) => l.value = $),
1639
+ card: "",
1640
+ "card-orientation": "horizontal",
1641
+ "data-testid": "route-form-config-type-advanced",
1642
+ description: o(h)("form.config_types.advanced.description"),
1643
+ label: o(h)("form.config_types.advanced.label"),
1644
+ "selected-value": "advanced"
1645
+ }, null, 8, ["modelValue", "description", "label"])
1646
+ ]),
1647
+ l.value === "basic" ? (m(), x(Je, {
1648
+ key: 0,
1649
+ "custom-methods": i.value,
1650
+ "onUpdate:customMethods": b[2] || (b[2] = ($) => i.value = $),
1651
+ fields: v.value,
1652
+ "onUpdate:fields": b[3] || (b[3] = ($) => v.value = $),
1653
+ "config-type": "basic",
1654
+ "hide-advanced": "",
1655
+ protocols: e.protocols,
1656
+ readonly: e.readonly
1657
+ }, null, 8, ["custom-methods", "fields", "protocols", "readonly"])) : (m(), O(G, { key: 1 }, [
1658
+ e.routeFlavors.traditional && e.routeFlavors.expressions ? (m(), O("div", Po, [
1659
+ d(K, { class: "config-flavor-label" }, {
1660
+ default: n(() => [
1661
+ U(k(o(h)("form.config_flavor.label")), 1)
1662
+ ]),
1663
+ _: 1
1664
+ }),
1665
+ d(ne, {
1666
+ modelValue: a.value,
1667
+ "onUpdate:modelValue": b[4] || (b[4] = ($) => a.value = $),
1668
+ class: "config-flavor-control",
1669
+ "data-testid": "route-form-config-flavor",
1670
+ options: g
1671
+ }, {
1672
+ "option-label": n(({ option: $ }) => {
1673
+ var pe, de;
1674
+ return [
1675
+ V("span", null, k($.label), 1),
1676
+ (pe = e.tooltips) != null && pe[$.value] ? (m(), x(Ie, {
1677
+ key: 0,
1678
+ class: "route-form-config-tabs-tooltip",
1679
+ text: (de = e.tooltips) == null ? void 0 : de[$.value],
1680
+ "tooltip-id": `route-form-config-tabs-tooltip-${$.value}`
1681
+ }, {
1682
+ default: n(() => [
1683
+ d(o(At))
1684
+ ]),
1685
+ _: 1
1686
+ }, 8, ["text", "tooltip-id"])) : P("", !0)
1687
+ ];
1688
+ }),
1689
+ _: 1
1690
+ }, 8, ["modelValue"])
1691
+ ])) : P("", !0),
1692
+ e.routeFlavors.traditional && e.routeFlavors.expressions && (!e.recordFlavor || e.recordFlavor !== a.value) ? (m(), x(ee, {
1693
+ key: 1,
1694
+ appearance: e.recordFlavor ? "warning" : "info",
1695
+ class: "route-form-config-type-immutable-alert",
1696
+ "data-testid": "route-config-type-immutable-alert"
1697
+ }, {
1698
+ default: n(() => [
1699
+ e.recordFlavor ? e.recordFlavor !== a.value ? (m(), O(G, { key: 1 }, [
1700
+ U(k(o(h)("form.warning.cannotChangeFlavor.edit", { format: o(h)(`form.flavors.${e.recordFlavor}`) })), 1)
1701
+ ], 64)) : P("", !0) : (m(), O(G, { key: 0 }, [
1702
+ U(k(o(h)("form.warning.cannotChangeFlavor.create")), 1)
1703
+ ], 64))
1704
+ ]),
1705
+ _: 1
1706
+ }, 8, ["appearance"])) : P("", !0),
1707
+ !e.recordFlavor || !(e.routeFlavors.traditional && e.routeFlavors.expressions && e.recordFlavor !== a.value) ? (m(), O(G, { key: 2 }, [
1708
+ e.hideProtocols ? P("", !0) : (m(), x(ve, {
1709
+ key: 0,
1710
+ "data-testid": "route-form-protocols",
1711
+ items: p.value,
1712
+ label: o(h)("form.fields.protocols.label"),
1713
+ "label-attributes": {
1714
+ info: o(h)("form.fields.protocols.tooltip"),
1715
+ tooltipAttributes: { maxWidth: "400" }
1716
+ },
1717
+ "model-value": e.protocols,
1718
+ readonly: e.readonly,
1719
+ required: "",
1720
+ width: "100%",
1721
+ "onUpdate:modelValue": j
1722
+ }, null, 8, ["items", "label", "label-attributes", "model-value", "readonly"])),
1723
+ a.value === o(q).TRADITIONAL ? (m(), x(Je, {
1724
+ key: 1,
1725
+ "custom-methods": i.value,
1726
+ "onUpdate:customMethods": b[5] || (b[5] = ($) => i.value = $),
1727
+ fields: v.value,
1728
+ "onUpdate:fields": b[6] || (b[6] = ($) => v.value = $),
1729
+ "config-type": "advanced",
1730
+ protocols: e.protocols,
1731
+ readonly: e.readonly
1732
+ }, null, 8, ["custom-methods", "fields", "protocols", "readonly"])) : (m(), x($o, {
1733
+ key: 2,
1734
+ fields: v.value,
1735
+ "onUpdate:fields": b[7] || (b[7] = ($) => v.value = $),
1736
+ protocols: e.protocols,
1737
+ readonly: e.readonly,
1738
+ "show-expressions-modal-entry": e.showExpressionsModalEntry,
1739
+ onNotify: b[8] || (b[8] = ($) => A("notify", $))
1740
+ }, null, 8, ["fields", "protocols", "readonly", "show-expressions-modal-entry"]))
1741
+ ], 64)) : P("", !0)
1742
+ ], 64))
1743
+ ], 64);
1744
+ };
1745
+ }
1746
+ }), Fo = /* @__PURE__ */ Z(Lo, [["__scopeId", "data-v-cbda4882"]]), Ko = (e) => {
1747
+ var f, l, a, v, i;
1748
+ return !(typeof e.expression == "string" && e.expression.length > 0 || (e.protocols || []).sort().join(",") !== "http,https" || ((f = e[s.PATHS]) == null ? void 0 : f.length) > 1 || ((l = e[s.HOSTS]) == null ? void 0 : l.length) > 1 || e[s.HEADERS] && typeof e[s.HEADERS] == "object" || ((a = e[s.SNIS]) == null ? void 0 : a.length) > 0 || ((v = e[s.SOURCES]) == null ? void 0 : v.length) > 0 || ((i = e[s.DESTINATIONS]) == null ? void 0 : i.length) > 0 || [
1749
+ "path_handling",
1750
+ "regex_priority",
1751
+ "https_redirect_status_code",
1752
+ "preserve_host",
1753
+ "request_buffering",
1754
+ "response_buffering"
1755
+ ].some((A) => e[A] !== Lt[A]));
1756
+ }, qo = { class: "kong-ui-entities-route-form" }, Bo = { key: 1 }, Go = { "data-testid": "no-search-results" }, Wo = { class: "route-form-service-dropdown-item" }, jo = { class: "select-item-label" }, Xo = { class: "select-item-description" }, zo = /* @__PURE__ */ z({
1757
+ __name: "RouteForm",
1758
+ props: {
1759
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
1760
+ config: {
1761
+ type: Object,
1762
+ required: !0,
1763
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || (e == null ? void 0 : e.app) === "konnect" && !(e != null && e.controlPlaneId) || (e == null ? void 0 : e.app) === "kongManager" && typeof (e == null ? void 0 : e.workspace) != "string" || !(e != null && e.cancelRoute))
1764
+ },
1765
+ /** If a valid routeId is provided, it will put the form in Edit mode instead of Create */
1766
+ routeId: {
1767
+ type: String,
1768
+ required: !1,
1769
+ default: ""
1770
+ },
1771
+ /** If valid serviceId is provided, don't show service select field */
1772
+ serviceId: {
1773
+ type: String,
1774
+ required: !1,
1775
+ default: ""
1776
+ },
1777
+ /** Whether show or hide EntityFormSection info column */
1778
+ hideSectionsInfo: {
1779
+ type: Boolean,
1780
+ required: !1,
1781
+ default: !1
1782
+ },
1783
+ /** Whether show or hide Route name field */
1784
+ hideNameField: {
1785
+ type: Boolean,
1786
+ required: !1,
1787
+ default: !1
1788
+ },
1789
+ /** Whether show or hide Service Select field */
1790
+ hideServiceField: {
1791
+ type: Boolean,
1792
+ required: !1,
1793
+ default: !1
1794
+ },
1795
+ /** Route flavors to be enabled for this form */
1796
+ routeFlavors: {
1797
+ type: Object,
1798
+ required: !1,
1799
+ default: () => ({
1800
+ traditional: !0
1801
+ })
1802
+ },
1803
+ /** Tooltips to show on config tabs */
1804
+ configTabTooltips: {
1805
+ type: Object,
1806
+ required: !1,
1807
+ default: () => {
1808
+ }
1809
+ },
1810
+ /** Whether to show the expressions modal entry */
1811
+ showExpressionsModalEntry: {
1812
+ type: Boolean,
1813
+ required: !1,
1814
+ default: !1
1815
+ }
1816
+ },
1817
+ emits: ["update", "error", "loading", "model-updated", "notify"],
1818
+ setup(e, { expose: C, emit: f }) {
1819
+ var Ae;
1820
+ const l = e, a = f, v = B("basic"), i = B(
1821
+ !l.routeFlavors.traditional && l.routeFlavors.expressions ? q.EXPRESSIONS : q.TRADITIONAL
1822
+ ), A = B(void 0), h = M(() => {
1823
+ if (A.value)
1824
+ return A.value;
1825
+ if (i.value)
1826
+ return i.value;
1827
+ if (l.routeFlavors.traditional)
1828
+ return q.TRADITIONAL;
1829
+ if (l.routeFlavors.expressions)
1830
+ return q.EXPRESSIONS;
1831
+ }), { i18n: { t: g } } = J.useI18n(), p = et(), { axiosInstance: y } = Le((Ae = l.config) == null ? void 0 : Ae.axiosRequestConfig), { getMessageFromError: w } = dt(), F = (t) => t.name ? `${t.name} - ${t.value}` : t.value, r = Ne({
1832
+ routeFlavors: l.routeFlavors,
1833
+ fields: {
1834
+ name: "",
1835
+ protocols: "http,https",
1836
+ tags: "",
1837
+ service_id: "",
1838
+ ...Ce,
1839
+ paths: [""],
1840
+ snis: [""],
1841
+ hosts: [""],
1842
+ methods: [],
1843
+ headers: [{ ...W[s.HEADERS][0] }],
1844
+ sources: [{ ...W[s.SOURCES][0] }],
1845
+ destinations: [{ ...W[s.DESTINATIONS][0] }],
1846
+ regex_priority: 0,
1847
+ path_handling: "v0",
1848
+ expression: "",
1849
+ priority: 0
1850
+ },
1851
+ isReadonly: !1,
1852
+ errorMessage: ""
1853
+ });
1854
+ ye(() => l.routeFlavors, (t) => {
1855
+ r.routeFlavors = t, t.traditional || (v.value = "advanced");
1856
+ }, { immediate: !0, deep: !0 });
1857
+ const u = B(), S = B([]), D = B([]), se = Ne({
1858
+ name: "",
1859
+ protocols: "http,https",
1860
+ tags: "",
1861
+ service_id: "",
1862
+ ...Ce,
1863
+ path_handling: "v0",
1864
+ regex_priority: 0,
1865
+ expression: "",
1866
+ priority: 0
1867
+ }), j = l.config.app === "konnect" || ut({
1868
+ gatewayInfo: l.config.gatewayInfo,
1869
+ // 'ws' and 'wss' are not valid values for the protocol field in Gateway Community Edition or before Gateway Enterprise Edition 3.0
1870
+ supportedRange: {
1871
+ enterprise: ["3.0"]
1872
+ }
1873
+ }), E = M(() => l.routeId ? Be.Edit : Be.Create), b = M(() => {
1874
+ var t, c, T;
1875
+ return (T = (c = Se.form[(t = l.config) == null ? void 0 : t.app]) == null ? void 0 : c.fetch) == null ? void 0 : T[l.serviceId ? "forGatewayService" : "all"].replace(/{serviceId}/gi, l.serviceId || "");
1876
+ }), _ = () => {
1877
+ var t;
1878
+ p.push((t = l.config) == null ? void 0 : t.cancelRoute);
1879
+ }, K = (t) => {
1880
+ a("loading", t);
1881
+ }, Ie = (t) => {
1882
+ a("error", t);
1883
+ }, ne = (t) => Object.entries(t).map((c) => {
1884
+ var T;
1885
+ return { header: c[0], values: (T = c[1]) == null ? void 0 : T.join() };
1886
+ }), ee = (t) => t.some((c) => r.fields.protocols.includes(c)), ve = (t) => {
1887
+ var T, N;
1888
+ if (l.routeId) {
1889
+ const R = typeof t.expression == "string" && t.expression.length > 0 ? q.EXPRESSIONS : q.TRADITIONAL;
1890
+ A.value = R, Ko(t) || (v.value = "advanced");
1891
+ }
1892
+ (T = t == null ? void 0 : t.service) != null && T.id && (r.fields.service_id = t.service.id), r.fields.name = (t == null ? void 0 : t.name) || "";
1893
+ const c = (t == null ? void 0 : t.tags) || [];
1894
+ r.fields.tags = (c == null ? void 0 : c.join(", ")) || "", r.fields.preserve_host = typeof (t == null ? void 0 : t.preserve_host) > "u" ? !1 : t == null ? void 0 : t.preserve_host, r.fields.https_redirect_status_code = (t == null ? void 0 : t.https_redirect_status_code) || 426, (N = t == null ? void 0 : t.protocols) != null && N.length && (t.protocols.length > 1 ? r.fields.protocols = t.protocols.join() : r.fields.protocols = t.protocols[0]), r.fields.request_buffering = typeof (t == null ? void 0 : t.request_buffering) > "u" ? !0 : t == null ? void 0 : t.request_buffering, r.fields.response_buffering = typeof (t == null ? void 0 : t.response_buffering) > "u" ? !0 : t == null ? void 0 : t.response_buffering, r.fields.strip_path = typeof (t == null ? void 0 : t.strip_path) > "u" ? !0 : t == null ? void 0 : t.strip_path, Xe(r) && (r.fields.regex_priority = (t == null ? void 0 : t.regex_priority) || 0, r.fields.path_handling = (t == null ? void 0 : t.path_handling) || "v0", t != null && t.paths && (r.fields.paths = t.paths), t != null && t.snis && (r.fields.snis = t.snis), t != null && t.hosts && (r.fields.hosts = t.hosts), t != null && t.methods && (r.fields.methods = t.methods.filter((R) => Object.keys(be).includes(R)), S.value = t.methods.filter((R) => !Object.keys(be).includes(R)).map((R) => ({ label: R, value: R })), D.value = [...S.value]), t != null && t.headers && (r.fields.headers = ne(t.headers)), t != null && t.sources && (r.fields.sources = t.sources), t != null && t.destinations && (r.fields.destinations = t.destinations)), ze(r) && (r.fields.expression = (t == null ? void 0 : t.expression) || "", r.fields.priority = (t == null ? void 0 : t.priority) || 0), Object.assign(se, JSON.parse(JSON.stringify(r.fields)));
1895
+ }, $ = M(() => {
1896
+ switch (h.value) {
1897
+ case q.TRADITIONAL: {
1898
+ if (Xe(r)) {
1899
+ const t = r.fields.hosts ? !!r.fields.hosts.filter(Boolean).length : null, c = r.fields.paths ? !!r.fields.paths.filter(Boolean).length : null, T = r.fields.headers ? r.fields.headers.some(({ header: ie }) => !!ie) : null, N = r.fields.snis ? !!r.fields.snis.filter(Boolean).length : null, R = r.fields.destinations ? r.fields.destinations.some(({ ip: ie, port: I }) => !!ie || !!I) : null, ae = r.fields.sources ? r.fields.sources.some(({ ip: ie, port: I }) => !!ie || !!I) : null, re = r.fields.methods ? !!r.fields.methods.filter(Boolean).length : null;
1900
+ return !!r.fields.protocols && (ee(["http"]) && !!(t || re || c || T) || ee(["https"]) && !!(t || re || c || T || N) || ee(["grpc"]) && !!(t || c || T) || ee(["grpcs", "wss"]) && !!(t || c || T || N) || ee(["udp", "tls"]) && !!(R || ae || N) || ee(["tcp"]) && !!(R || ae) || ee(["tls_passthrough"]) && !!N || ee(["ws"]) && !!(t || c || T));
1901
+ }
1902
+ break;
1903
+ }
1904
+ case q.EXPRESSIONS: {
1905
+ if (ze(r))
1906
+ return r.fields.expression.length > 0;
1907
+ break;
1908
+ }
1909
+ }
1910
+ return !0;
1911
+ }), pe = M(() => !We(r.fields, se) || !We(S.value, D.value)), de = M(() => {
1912
+ var c, T;
1913
+ let t = `${l.config.apiBaseUrl}${Se.form[l.config.app][E.value][l.serviceId ? "forGatewayService" : "all"]}`;
1914
+ return l.config.app === "konnect" ? t = t.replace(/{controlPlaneId}/gi, ((c = l.config) == null ? void 0 : c.controlPlaneId) || "").replace(/{serviceId}/gi, l.serviceId || "") : l.config.app === "kongManager" && (t = t.replace(/\/{workspace}/gi, (T = l.config) != null && T.workspace ? `/${l.config.workspace}` : "").replace(/{serviceId}/gi, l.serviceId || "")), t = t.replace(/{id}/gi, l.routeId), t;
1915
+ });
1916
+ ye(() => r.fields, () => {
1917
+ a("model-updated", Q.value);
1918
+ }, { deep: !0 });
1919
+ const Q = M(() => {
1920
+ var t, c, T;
1921
+ return {
1922
+ ...!l.hideNameField && { name: r.fields.name || null },
1923
+ protocols: r.fields.protocols.split(","),
1924
+ tags: (c = (t = r.fields.tags.split(",")) == null ? void 0 : t.map((N) => String(N || "").trim())) == null ? void 0 : c.filter((N) => N !== ""),
1925
+ service: r.fields.service_id ? { id: r.fields.service_id } : null,
1926
+ ...(T = u.value) == null ? void 0 : T.payload
1927
+ };
1928
+ }), he = (t) => {
1929
+ switch (h.value) {
1930
+ case q.TRADITIONAL: {
1931
+ if (!("regex_priority" in t && "path_handling" in t))
1932
+ return !1;
1933
+ break;
1934
+ }
1935
+ case q.EXPRESSIONS: {
1936
+ if (!("priority" in t))
1937
+ return !1;
1938
+ break;
1939
+ }
1940
+ }
1941
+ return "service" in t && "tags" in t && "protocols" in t;
1942
+ }, ue = async (t) => {
1943
+ var T;
1944
+ const c = t && he(t) ? t : Q.value;
1945
+ try {
1946
+ r.isReadonly = !0;
1947
+ let N;
1948
+ E.value === "create" ? N = await y.post(de.value, c) : E.value === "edit" && (N = ((T = l.config) == null ? void 0 : T.app) === "konnect" ? await y.put(de.value, c) : await y.patch(de.value, c)), ve(N == null ? void 0 : N.data), a("update", N == null ? void 0 : N.data);
1949
+ } catch (N) {
1950
+ r.errorMessage = w(N), a("error", N);
1951
+ } finally {
1952
+ r.isReadonly = !1;
1953
+ }
1954
+ }, {
1955
+ debouncedQueryChange: Oe,
1956
+ loading: we,
1957
+ error: Ve,
1958
+ loadItems: Me,
1959
+ results: De
1960
+ } = ct(l.config, Se.form[l.config.app].services, void 0, {
1961
+ fetchedItemsKey: "data",
1962
+ searchKeys: ["id", "name"]
1963
+ }), Ee = M(() => Ve.value ? g("errors.services.fetch") : ""), Re = M(() => {
1964
+ var t;
1965
+ return (t = De.value) == null ? void 0 : t.map((c) => ({ label: c.id, name: c.name, value: c.id }));
1966
+ });
1967
+ return Ye(async () => {
1968
+ !l.hideServiceField && !l.serviceId ? await Me() : r.fields.service_id = l.serviceId;
1969
+ }), Qe(() => {
1970
+ a("model-updated", Q.value);
1971
+ }), C({ saveFormData: ue, payload: Q }), rt("configType", v), (t, c) => {
1972
+ const T = H("KInput"), N = H("KSelect");
1973
+ return m(), O("div", qo, [
1974
+ d(o(pt), {
1975
+ "can-submit": $.value && pe.value,
1976
+ config: e.config,
1977
+ "edit-id": e.routeId,
1978
+ "entity-type": o(Ze).Route,
1979
+ "error-message": r.errorMessage || Ee.value,
1980
+ "fetch-url": b.value,
1981
+ "form-fields": Q.value,
1982
+ "is-readonly": r.isReadonly,
1983
+ onCancel: _,
1984
+ "onFetch:error": Ie,
1985
+ "onFetch:success": ve,
1986
+ onLoading: K,
1987
+ onSubmit: ue
1988
+ }, {
1989
+ "form-actions": n(() => [
1990
+ Pe(t.$slots, "form-actions", {
1991
+ canSubmit: $.value && pe.value,
1992
+ cancel: _,
1993
+ submit: ue
1994
+ }, void 0, !0)
1995
+ ]),
1996
+ default: n(() => [
1997
+ d(o(Ge), {
1998
+ description: o(g)("form.sections.general.description"),
1999
+ "hide-info-header": e.hideSectionsInfo,
2000
+ title: o(g)("form.sections.general.title")
2001
+ }, {
2002
+ default: n(() => [
2003
+ e.hideNameField ? P("", !0) : (m(), x(T, {
2004
+ key: 0,
2005
+ modelValue: r.fields.name,
2006
+ "onUpdate:modelValue": c[0] || (c[0] = (R) => r.fields.name = R),
2007
+ modelModifiers: { trim: !0 },
2008
+ autocomplete: "off",
2009
+ "data-testid": "route-form-name",
2010
+ label: o(g)("form.fields.name.label"),
2011
+ placeholder: o(g)("form.fields.name.placeholder"),
2012
+ readonly: r.isReadonly,
2013
+ type: "text"
2014
+ }, null, 8, ["modelValue", "label", "placeholder", "readonly"])),
2015
+ !e.hideServiceField && !e.serviceId ? (m(), O("div", Bo, [
2016
+ d(N, {
2017
+ modelValue: r.fields.service_id,
2018
+ "onUpdate:modelValue": c[1] || (c[1] = (R) => r.fields.service_id = R),
2019
+ clearable: "",
2020
+ "data-testid": "route-form-service-id",
2021
+ "enable-filtering": "",
2022
+ "filter-function": () => !0,
2023
+ items: Re.value,
2024
+ label: o(g)("form.fields.service_id.label"),
2025
+ loading: o(we),
2026
+ placeholder: o(g)("form.fields.service_id.placeholder"),
2027
+ readonly: r.isReadonly,
2028
+ "reuse-item-template": "",
2029
+ width: "100%",
2030
+ onQueryChange: o(Oe)
2031
+ }, {
2032
+ loading: n(() => [
2033
+ V("div", null, k(o(g)("actions.loading")), 1)
2034
+ ]),
2035
+ empty: n(() => [
2036
+ V("div", Go, k(o(g)("search.no_results")), 1)
2037
+ ]),
2038
+ "selected-item-template": n(({ item: R }) => [
2039
+ U(k(F(R)), 1)
2040
+ ]),
2041
+ "item-template": n(({ item: R }) => [
2042
+ V("div", Wo, [
2043
+ V("span", jo, k(R.name), 1),
2044
+ V("span", Xo, k(R.value), 1)
2045
+ ])
2046
+ ]),
2047
+ _: 1
2048
+ }, 8, ["modelValue", "items", "label", "loading", "placeholder", "readonly", "onQueryChange"])
2049
+ ])) : P("", !0),
2050
+ d(T, {
2051
+ modelValue: r.fields.tags,
2052
+ "onUpdate:modelValue": c[2] || (c[2] = (R) => r.fields.tags = R),
2053
+ modelModifiers: { trim: !0 },
2054
+ autocomplete: "off",
2055
+ "data-testid": "route-form-tags",
2056
+ help: o(g)("form.fields.tags.help"),
2057
+ label: o(g)("form.fields.tags.label"),
2058
+ placeholder: o(g)("form.fields.tags.placeholder"),
2059
+ readonly: r.isReadonly,
2060
+ type: "text"
2061
+ }, null, 8, ["modelValue", "help", "label", "placeholder", "readonly"])
2062
+ ]),
2063
+ _: 1
2064
+ }, 8, ["description", "hide-info-header", "title"]),
2065
+ d(o(Ge), {
2066
+ description: o(g)("form.sections.config.description"),
2067
+ "hide-info-header": e.hideSectionsInfo,
2068
+ title: o(g)("form.sections.config.title")
2069
+ }, {
2070
+ default: n(() => [
2071
+ d(Fo, {
2072
+ "config-flavor": i.value,
2073
+ "onUpdate:configFlavor": c[3] || (c[3] = (R) => i.value = R),
2074
+ "config-type": v.value,
2075
+ "onUpdate:configType": c[4] || (c[4] = (R) => v.value = R),
2076
+ "custom-methods": S.value,
2077
+ "onUpdate:customMethods": c[5] || (c[5] = (R) => S.value = R),
2078
+ fields: r.fields,
2079
+ "onUpdate:fields": c[6] || (c[6] = (R) => r.fields = R),
2080
+ "is-ws-supported": o(j),
2081
+ protocols: r.fields.protocols,
2082
+ readonly: r.isReadonly,
2083
+ "record-flavor": A.value,
2084
+ "route-flavors": e.routeFlavors,
2085
+ "show-expressions-modal-entry": e.showExpressionsModalEntry,
2086
+ tooltips: e.configTabTooltips,
2087
+ onNotify: c[7] || (c[7] = (R) => a("notify", R)),
2088
+ "onUpdate:payload": c[8] || (c[8] = (R) => u.value = R),
2089
+ "onUpdate:protocols": c[9] || (c[9] = (R) => r.fields.protocols = R)
2090
+ }, null, 8, ["config-flavor", "config-type", "custom-methods", "fields", "is-ws-supported", "protocols", "readonly", "record-flavor", "route-flavors", "show-expressions-modal-entry", "tooltips"])
2091
+ ]),
2092
+ _: 1
2093
+ }, 8, ["description", "hide-info-header", "title"])
2094
+ ]),
2095
+ _: 3
2096
+ }, 8, ["can-submit", "config", "edit-id", "entity-type", "error-message", "fetch-url", "form-fields", "is-readonly"])
2097
+ ]);
2098
+ };
2099
+ }
2100
+ }), cs = /* @__PURE__ */ Z(zo, [["__scopeId", "data-v-5be17e8c"]]), Jo = { class: "kong-ui-entities-routes-list" }, Qo = { class: "button-row" }, Yo = { key: 1 }, Zo = { key: 1 }, es = { key: 1 }, ts = { class: "route-list-cell-expression" }, os = /* @__PURE__ */ z({
2101
+ __name: "RouteList",
2102
+ props: {
2103
+ /** The base konnect or kongManger config. Pass additional config props in the shared entity component as needed. */
2104
+ config: {
2105
+ type: Object,
2106
+ required: !0,
2107
+ validator: (e) => !(!e || !["konnect", "kongManager"].includes(e == null ? void 0 : e.app) || !e.createRoute || !e.getViewRoute || !e.getEditRoute || e.app === "kongManager" && !e.isExactMatch && !e.filterSchema)
2108
+ },
2109
+ // used to override the default identifier for the cache entry
2110
+ cacheIdentifier: {
2111
+ type: String,
2112
+ default: ""
2113
+ },
2114
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can create a new entity */
2115
+ canCreate: {
2116
+ type: Function,
2117
+ required: !1,
2118
+ default: async () => !0
2119
+ },
2120
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can delete a given entity */
2121
+ canDelete: {
2122
+ type: Function,
2123
+ required: !1,
2124
+ default: async () => !0
2125
+ },
2126
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can edit a given entity */
2127
+ canEdit: {
2128
+ type: Function,
2129
+ required: !1,
2130
+ default: async () => !0
2131
+ },
2132
+ /** A synchronous or asynchronous function, that returns a boolean, that evaluates if the user can retrieve (view details) a given entity */
2133
+ canRetrieve: {
2134
+ type: Function,
2135
+ required: !1,
2136
+ default: async () => !0
2137
+ },
2138
+ title: {
2139
+ type: String,
2140
+ default: ""
2141
+ },
2142
+ titleTag: {
2143
+ type: String,
2144
+ default: "h2"
2145
+ },
2146
+ /** default to false, setting to true will teleport the toolbar button to the destination in the consuming app */
2147
+ useActionOutside: {
2148
+ type: Boolean,
2149
+ default: !1
2150
+ },
2151
+ hideTraditionalColumns: {
2152
+ type: Boolean,
2153
+ default: !1
2154
+ },
2155
+ hasExpressionColumn: {
2156
+ type: Boolean,
2157
+ default: !1
2158
+ }
2159
+ },
2160
+ emits: ["error", "click:learn-more", "copy:success", "copy:error", "delete:success"],
2161
+ setup(e, { emit: C }) {
2162
+ var Ae;
2163
+ const f = C, l = e, { i18n: { t: a, formatUnixTimeStamp: v } } = J.useI18n(), i = et(), { axiosInstance: A } = Le((Ae = l.config) == null ? void 0 : Ae.axiosRequestConfig), { handleStateChange: h, hasRecords: g } = ft(() => D.value), p = M(() => g.value && l.config.app === "konnect"), y = M(() => !!l.config.serviceId), w = M(() => l.config.app !== "kongManager" || !!l.config.disableSorting), F = {
2164
+ // the Name column is non-hidable
2165
+ name: { label: a("routes.list.table_headers.name"), searchable: !0, sortable: !0, hidable: !1 },
2166
+ protocols: { label: a("routes.list.table_headers.protocols"), searchable: !0 },
2167
+ ...!l.hideTraditionalColumns && {
2168
+ hosts: { label: a("routes.list.table_headers.hosts"), searchable: !0 },
2169
+ methods: { label: a("routes.list.table_headers.methods"), searchable: !0 },
2170
+ paths: { label: a("routes.list.table_headers.paths"), searchable: !0 }
2171
+ },
2172
+ ...l.hasExpressionColumn && {
2173
+ expression: { label: a("routes.list.table_headers.expression"), tooltip: !0 }
2174
+ },
2175
+ tags: { label: a("routes.list.table_headers.tags"), sortable: !1 },
2176
+ updated_at: { label: a("routes.list.table_headers.updated_at"), sortable: !0 },
2177
+ created_at: { label: a("routes.list.table_headers.created_at"), sortable: !0 }
2178
+ }, r = {
2179
+ columnVisibility: {
2180
+ created_at: !1
2181
+ }
2182
+ }, u = F, S = M(() => {
2183
+ var c, T, N, R;
2184
+ let t = `${l.config.apiBaseUrl}${Se.list[l.config.app][l.config.serviceId ? "forGatewayService" : "all"]}`;
2185
+ return l.config.app === "konnect" ? t = t.replace(/{controlPlaneId}/gi, ((c = l.config) == null ? void 0 : c.controlPlaneId) || "").replace(/{serviceId}/gi, ((T = l.config) == null ? void 0 : T.serviceId) || "") : l.config.app === "kongManager" && (t = t.replace(/\/{workspace}/gi, (N = l.config) != null && N.workspace ? `/${l.config.workspace}` : "").replace(/{serviceId}/gi, ((R = l.config) == null ? void 0 : R.serviceId) || "")), t;
2186
+ }), D = B(""), se = M(() => {
2187
+ const t = l.config.app === "konnect" || l.config.isExactMatch;
2188
+ if (t)
2189
+ return {
2190
+ isExactMatch: t,
2191
+ // force exact placeholder if `props.config.isExactMatch` is true
2192
+ placeholder: a(`search.placeholder.${l.config.isExactMatch ? "exact" : l.config.app}`)
2193
+ };
2194
+ const { name: c, protocols: T, hosts: N, methods: R, paths: ae, expression: re } = F, ie = {
2195
+ name: c,
2196
+ protocols: T,
2197
+ hosts: N,
2198
+ methods: R,
2199
+ paths: ae,
2200
+ ...l.hasExpressionColumn && { expression: re }
2201
+ };
2202
+ return {
2203
+ isExactMatch: t,
2204
+ fields: ie,
2205
+ schema: l.config.filterSchema
2206
+ };
2207
+ }), {
2208
+ fetcher: j,
2209
+ fetcherState: E,
2210
+ fetcherCacheKey: b
2211
+ } = mt(M(() => ({ ...l.config, cacheIdentifier: l.cacheIdentifier })), S), _ = (t) => t.headerKey === "expression" ? {
2212
+ style: {
2213
+ maxWidth: "250px",
2214
+ overflowX: "hidden",
2215
+ textOverflow: "ellipsis"
2216
+ }
2217
+ } : {}, K = () => {
2218
+ D.value = "";
2219
+ }, Ie = () => {
2220
+ b.value++;
2221
+ }, ne = B(null), ee = async (t, c) => {
2222
+ if (!await c(t.id)) {
2223
+ f("copy:error", {
2224
+ entity: t,
2225
+ field: "id",
2226
+ message: a("errors.copy")
2227
+ });
2228
+ return;
2229
+ }
2230
+ f("copy:success", {
2231
+ entity: t,
2232
+ field: "id",
2233
+ message: a("copy.success", { val: t.id })
2234
+ });
2235
+ }, ve = async (t, c) => {
2236
+ const T = JSON.stringify(t);
2237
+ if (!await c(T)) {
2238
+ f("copy:error", {
2239
+ entity: t,
2240
+ message: a("errors.copy")
2241
+ });
2242
+ return;
2243
+ }
2244
+ f("copy:success", {
2245
+ entity: t,
2246
+ message: a("copy.success_brief")
2247
+ });
2248
+ }, $ = async (t) => {
2249
+ var T;
2250
+ await ((T = l.canRetrieve) == null ? void 0 : T.call(l, t)) && i.push(l.config.getViewRoute(t.id));
2251
+ }, pe = (t) => ({
2252
+ label: a("actions.view"),
2253
+ to: l.config.getViewRoute(t)
2254
+ }), de = (t) => ({
2255
+ label: a("actions.edit"),
2256
+ to: l.config.getEditRoute(t)
2257
+ }), Q = B(void 0), he = B(!1), ue = B(!1), Oe = B(""), we = vt(l.config, S.value), Ve = (t) => {
2258
+ Q.value = t, he.value = !0;
2259
+ }, Me = () => {
2260
+ he.value = !1;
2261
+ }, De = async () => {
2262
+ var t, c, T;
2263
+ if ((t = Q.value) != null && t.id) {
2264
+ ue.value = !0;
2265
+ try {
2266
+ await A.delete(we(Q.value.id)), ue.value = !1, he.value = !1, b.value++, f("delete:success", Q.value);
2267
+ } catch (N) {
2268
+ Oe.value = ((T = (c = N.response) == null ? void 0 : c.data) == null ? void 0 : T.message) || N.message || a("errors.delete"), f("error", N);
2269
+ } finally {
2270
+ ue.value = !1;
2271
+ }
2272
+ }
2273
+ };
2274
+ ye(E, (t) => {
2275
+ var c, T, N;
2276
+ if (t.status === ht.Error) {
2277
+ ne.value = {
2278
+ title: a("errors.general")
2279
+ }, (N = (T = (c = t.error) == null ? void 0 : c.response) == null ? void 0 : T.data) != null && N.message && (ne.value.message = t.error.response.data.message), f("error", t.error);
2280
+ return;
2281
+ }
2282
+ ne.value = null;
2283
+ });
2284
+ const Ee = B({
2285
+ ctaPath: l.config.createRoute,
2286
+ ctaText: void 0,
2287
+ message: `${a("routes.list.empty_state.description")}${l.config.additionMessageForEmptyState ? ` ${l.config.additionMessageForEmptyState}` : ""}`,
2288
+ title: a("routes.title")
2289
+ }), Re = B(!1);
2290
+ return Ye(async () => {
2291
+ Re.value = await l.canCreate(), Re.value && (Ee.value.title = a("routes.list.empty_state.title"), Ee.value.ctaText = a("actions.create"));
2292
+ }), (t, c) => {
2293
+ const T = H("KButton"), N = H("KEmptyState"), R = H("KBadge"), ae = H("KTruncate"), re = H("KDropdownItem"), ie = H("KClipboardProvider");
2294
+ return m(), O("div", Jo, [
2295
+ d(o(gt), {
2296
+ "cache-identifier": e.cacheIdentifier,
2297
+ "cell-attributes": _,
2298
+ "default-table-preferences": r,
2299
+ "disable-sorting": w.value,
2300
+ "empty-state-options": Ee.value,
2301
+ "enable-entity-actions": "",
2302
+ "error-message": ne.value,
2303
+ fetcher: o(j),
2304
+ "fetcher-cache-key": o(b),
2305
+ "pagination-type": "offset",
2306
+ "preferences-storage-key": "kong-ui-entities-routes-list",
2307
+ query: D.value,
2308
+ "table-headers": o(u),
2309
+ title: e.title,
2310
+ "title-tag": e.titleTag,
2311
+ onClearSearchInput: K,
2312
+ "onClick:row": c[7] || (c[7] = (I) => $(I)),
2313
+ onSort: Ie,
2314
+ onState: o(h)
2315
+ }, qe({
2316
+ "toolbar-filter": n(() => [
2317
+ d(o(St), {
2318
+ modelValue: D.value,
2319
+ "onUpdate:modelValue": c[0] || (c[0] = (I) => D.value = I),
2320
+ config: se.value
2321
+ }, null, 8, ["modelValue", "config"])
2322
+ ]),
2323
+ "toolbar-button": n(() => [
2324
+ (m(), x(it, {
2325
+ disabled: !e.useActionOutside,
2326
+ to: "#kong-ui-app-page-header-action-button"
2327
+ }, [
2328
+ V("div", Qo, [
2329
+ !y.value && p.value ? (m(), x(T, {
2330
+ key: 0,
2331
+ appearance: "secondary",
2332
+ class: "open-learning-hub",
2333
+ "data-testid": "routes-learn-more-button",
2334
+ icon: "",
2335
+ onClick: c[1] || (c[1] = (I) => t.$emit("click:learn-more"))
2336
+ }, {
2337
+ default: n(() => [
2338
+ d(o(je), { decorative: "" })
2339
+ ]),
2340
+ _: 1
2341
+ })) : P("", !0),
2342
+ d(o(He), {
2343
+ "auth-function": () => e.canCreate()
2344
+ }, {
2345
+ default: n(() => [
2346
+ d(T, {
2347
+ appearance: "primary",
2348
+ "data-testid": "toolbar-add-route",
2349
+ size: e.useActionOutside ? "medium" : "large",
2350
+ to: e.config.createRoute
2351
+ }, {
2352
+ default: n(() => [
2353
+ d(o($e)),
2354
+ U(" " + k(o(a)("routes.list.toolbar_actions.new_route")), 1)
2355
+ ]),
2356
+ _: 1
2357
+ }, 8, ["size", "to"])
2358
+ ]),
2359
+ _: 1
2360
+ }, 8, ["auth-function"])
2361
+ ])
2362
+ ], 8, ["disabled"]))
2363
+ ]),
2364
+ name: n(({ rowValue: I }) => [
2365
+ V("b", null, k(I ?? "-"), 1)
2366
+ ]),
2367
+ protocols: n(({ rowValue: I }) => [
2368
+ d(ae, null, {
2369
+ default: n(() => [
2370
+ (m(!0), O(G, null, le(I, (L) => (m(), x(R, {
2371
+ key: L,
2372
+ appearance: "neutral",
2373
+ onClick: c[3] || (c[3] = ke(() => {
2374
+ }, ["stop"]))
2375
+ }, {
2376
+ default: n(() => [
2377
+ U(k(L), 1)
2378
+ ]),
2379
+ _: 2
2380
+ }, 1024))), 128))
2381
+ ]),
2382
+ _: 2
2383
+ }, 1024)
2384
+ ]),
2385
+ hosts: n(({ rowValue: I }) => [
2386
+ (I == null ? void 0 : I.length) > 0 ? (m(), x(ae, { key: 0 }, {
2387
+ default: n(() => [
2388
+ (m(!0), O(G, null, le(I, (L) => (m(), x(R, {
2389
+ key: L,
2390
+ appearance: "neutral",
2391
+ tooltip: L,
2392
+ "truncation-tooltip": "",
2393
+ onClick: c[4] || (c[4] = ke(() => {
2394
+ }, ["stop"]))
2395
+ }, {
2396
+ default: n(() => [
2397
+ U(k(L), 1)
2398
+ ]),
2399
+ _: 2
2400
+ }, 1032, ["tooltip"]))), 128))
2401
+ ]),
2402
+ _: 2
2403
+ }, 1024)) : (m(), O("span", Yo, "-"))
2404
+ ]),
2405
+ methods: n(({ rowValue: I }) => [
2406
+ (I == null ? void 0 : I.length) > 0 ? (m(), x(ae, { key: 0 }, {
2407
+ default: n(() => [
2408
+ (m(!0), O(G, null, le(I, (L) => (m(), x(R, {
2409
+ key: L,
2410
+ appearance: Object.values(o(kt)).includes(L.toLowerCase()) ? L.toLowerCase() : "custom",
2411
+ onClick: c[5] || (c[5] = ke(() => {
2412
+ }, ["stop"]))
2413
+ }, {
2414
+ default: n(() => [
2415
+ U(k(L), 1)
2416
+ ]),
2417
+ _: 2
2418
+ }, 1032, ["appearance"]))), 128))
2419
+ ]),
2420
+ _: 2
2421
+ }, 1024)) : (m(), O("span", Zo, "-"))
2422
+ ]),
2423
+ paths: n(({ rowValue: I }) => [
2424
+ (I == null ? void 0 : I.length) > 0 ? (m(), x(ae, { key: 0 }, {
2425
+ default: n(() => [
2426
+ (m(!0), O(G, null, le(I, (L) => (m(), x(R, {
2427
+ key: L,
2428
+ appearance: "neutral",
2429
+ tooltip: L,
2430
+ "truncation-tooltip": "",
2431
+ onClick: c[6] || (c[6] = ke(() => {
2432
+ }, ["stop"]))
2433
+ }, {
2434
+ default: n(() => [
2435
+ U(k(L), 1)
2436
+ ]),
2437
+ _: 2
2438
+ }, 1032, ["tooltip"]))), 128))
2439
+ ]),
2440
+ _: 2
2441
+ }, 1024)) : (m(), O("span", es, "-"))
2442
+ ]),
2443
+ tags: n(({ rowValue: I }) => [
2444
+ d(o(yt), { tags: I }, null, 8, ["tags"])
2445
+ ]),
2446
+ expression: n(({ rowValue: I }) => [
2447
+ V("span", ts, k(I || "-"), 1)
2448
+ ]),
2449
+ created_at: n(({ rowValue: I }) => [
2450
+ U(k(o(v)(I)), 1)
2451
+ ]),
2452
+ updated_at: n(({ row: I, rowValue: L }) => [
2453
+ U(k(o(v)(L ?? I.created_at)), 1)
2454
+ ]),
2455
+ actions: n(({ row: I }) => [
2456
+ d(ie, null, {
2457
+ default: n(({ copyToClipboard: L }) => [
2458
+ d(re, {
2459
+ "data-testid": "action-entity-copy-id",
2460
+ onClick: (ot) => ee(I, L)
2461
+ }, {
2462
+ default: n(() => [
2463
+ U(k(o(a)("actions.copy_id")), 1)
2464
+ ]),
2465
+ _: 1
2466
+ }, 8, ["onClick"])
2467
+ ]),
2468
+ _: 2
2469
+ }, 1024),
2470
+ d(ie, null, {
2471
+ default: n(({ copyToClipboard: L }) => [
2472
+ d(re, {
2473
+ "data-testid": "action-entity-copy-json",
2474
+ onClick: (ot) => ve(I, L)
2475
+ }, {
2476
+ default: n(() => [
2477
+ U(k(o(a)("actions.copy_json")), 1)
2478
+ ]),
2479
+ _: 1
2480
+ }, 8, ["onClick"])
2481
+ ]),
2482
+ _: 2
2483
+ }, 1024),
2484
+ d(o(He), {
2485
+ "auth-function": () => e.canRetrieve(I)
2486
+ }, {
2487
+ default: n(() => [
2488
+ d(re, {
2489
+ "data-testid": "action-entity-view",
2490
+ "has-divider": "",
2491
+ item: pe(I.id)
2492
+ }, null, 8, ["item"])
2493
+ ]),
2494
+ _: 2
2495
+ }, 1032, ["auth-function"]),
2496
+ d(o(He), {
2497
+ "auth-function": () => e.canEdit(I)
2498
+ }, {
2499
+ default: n(() => [
2500
+ d(re, {
2501
+ "data-testid": "action-entity-edit",
2502
+ item: de(I.id)
2503
+ }, null, 8, ["item"])
2504
+ ]),
2505
+ _: 2
2506
+ }, 1032, ["auth-function"]),
2507
+ d(o(He), {
2508
+ "auth-function": () => e.canDelete(I)
2509
+ }, {
2510
+ default: n(() => [
2511
+ d(re, {
2512
+ danger: "",
2513
+ "data-testid": "action-entity-delete",
2514
+ "has-divider": "",
2515
+ onClick: (L) => Ve(I)
2516
+ }, {
2517
+ default: n(() => [
2518
+ U(k(o(a)("actions.delete")), 1)
2519
+ ]),
2520
+ _: 1
2521
+ }, 8, ["onClick"])
2522
+ ]),
2523
+ _: 2
2524
+ }, 1032, ["auth-function"])
2525
+ ]),
2526
+ _: 2
2527
+ }, [
2528
+ !D.value && e.config.app === "konnect" ? {
2529
+ name: "empty-state",
2530
+ fn: n(() => {
2531
+ var I;
2532
+ return [
2533
+ d(N, {
2534
+ "data-testid": e.config.serviceId ? "nested-routes-entity-empty-state" : "routes-entity-empty-state",
2535
+ "icon-background": "",
2536
+ message: o(a)("routes.list.empty_state_v2.description"),
2537
+ title: o(a)("routes.list.empty_state_v2.title")
2538
+ }, qe({
2539
+ icon: n(() => [
2540
+ d(o(Ot), { decorative: "" })
2541
+ ]),
2542
+ action: n(() => [
2543
+ Re.value ? (m(), x(T, {
2544
+ key: 0,
2545
+ "data-testid": "entity-create-button",
2546
+ to: e.config.createRoute
2547
+ }, {
2548
+ default: n(() => [
2549
+ d(o($e), { decorative: "" }),
2550
+ U(" " + k(o(a)("routes.list.toolbar_actions.new_route")), 1)
2551
+ ]),
2552
+ _: 1
2553
+ }, 8, ["to"])) : P("", !0),
2554
+ d(T, {
2555
+ appearance: "secondary",
2556
+ "data-testid": "entity-learn-more-button",
2557
+ onClick: c[2] || (c[2] = (L) => t.$emit("click:learn-more"))
2558
+ }, {
2559
+ default: n(() => [
2560
+ d(o(je), { decorative: "" }),
2561
+ U(" " + k(o(a)("routes.list.empty_state_v2.learn_more")), 1)
2562
+ ]),
2563
+ _: 1
2564
+ })
2565
+ ]),
2566
+ _: 2
2567
+ }, [
2568
+ (I = e.config) != null && I.isControlPlaneGroup ? {
2569
+ name: "default",
2570
+ fn: n(() => [
2571
+ U(k(o(a)("routes.list.empty_state_v2.group")), 1)
2572
+ ]),
2573
+ key: "0"
2574
+ } : void 0
2575
+ ]), 1032, ["data-testid", "message", "title"])
2576
+ ];
2577
+ }),
2578
+ key: "0"
2579
+ } : void 0
2580
+ ]), 1032, ["cache-identifier", "disable-sorting", "empty-state-options", "error-message", "fetcher", "fetcher-cache-key", "query", "table-headers", "title", "title-tag", "onState"]),
2581
+ d(o(bt), {
2582
+ "action-pending": ue.value,
2583
+ description: o(a)("delete.description"),
2584
+ "entity-name": Q.value && (Q.value.name || Q.value.id),
2585
+ "entity-type": o(_t).Route,
2586
+ error: Oe.value,
2587
+ title: o(a)("delete.title"),
2588
+ visible: he.value,
2589
+ onCancel: Me,
2590
+ onProceed: De
2591
+ }, null, 8, ["action-pending", "description", "entity-name", "entity-type", "error", "title", "visible"])
2592
+ ]);
2593
+ };
2594
+ }
2595
+ }), ps = /* @__PURE__ */ Z(os, [["__scopeId", "data-v-c68bbf3f"]]);
2596
+ export {
2597
+ ge as E,
2598
+ tt as H,
2599
+ W as I,
2600
+ be as M,
2601
+ Ue as P,
2602
+ cs as R,
2603
+ us as _,
2604
+ Fo as a,
2605
+ ps as b,
2606
+ J as c,
2607
+ Pt as d,
2608
+ Ce as e,
2609
+ Lt as f,
2610
+ q as g,
2611
+ s as h,
2612
+ ze as i,
2613
+ Ko as j,
2614
+ Xe as s
2615
+ };