@kosdev-code/kos-ui-plugin 0.1.0-dev.5099 → 0.1.0-dev.5101

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- var W = Object.defineProperty;
2
- var G = (n, t, e) => t in n ? W(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
- var C = (n, t, e) => (G(n, typeof t != "symbol" ? t + "" : t, e), e);
4
- import { z as w } from "zod";
5
- function z(n, t) {
1
+ var Y = Object.defineProperty;
2
+ var Q = (n, t, e) => t in n ? Y(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
3
+ var _ = (n, t, e) => (Q(n, typeof t != "symbol" ? t + "" : t, e), e);
4
+ import { z as S } from "zod";
5
+ function X(n, t) {
6
6
  for (var e = 0; e < t.length; e++) {
7
7
  const i = t[e];
8
8
  if (typeof i != "string" && !Array.isArray(i)) {
@@ -18,29 +18,29 @@ function z(n, t) {
18
18
  }
19
19
  return Object.freeze(Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }));
20
20
  }
21
- var F = {}, E = {};
22
- Object.defineProperty(E, "__esModule", { value: !0 });
23
- E.loadRemoteModule = E.setRemoteDefinitions = E.setRemoteUrlResolver = void 0;
24
- let R, D;
25
- const O = /* @__PURE__ */ new Map(), U = /* @__PURE__ */ new Map();
26
- let N = !1;
27
- function J(n) {
28
- D = n;
21
+ var U = {}, C = {};
22
+ Object.defineProperty(C, "__esModule", { value: !0 });
23
+ C.loadRemoteModule = C.setRemoteDefinitions = C.setRemoteUrlResolver = void 0;
24
+ let O, K;
25
+ const j = /* @__PURE__ */ new Map(), V = /* @__PURE__ */ new Map();
26
+ let z = !1;
27
+ function ee(n) {
28
+ K = n;
29
29
  }
30
- E.setRemoteUrlResolver = J;
31
- function Z(n) {
32
- R = n;
30
+ C.setRemoteUrlResolver = ee;
31
+ function te(n) {
32
+ O = n;
33
33
  }
34
- E.setRemoteDefinitions = Z;
35
- async function Y(n, t) {
34
+ C.setRemoteDefinitions = te;
35
+ async function ne(n, t) {
36
36
  const e = `${n}:${t}`;
37
- if (O.has(e))
38
- return O.get(e);
39
- const o = (await (U.has(n) ? U.get(n) : await X(n)).get(t))();
40
- return O.set(e, o), o;
37
+ if (j.has(e))
38
+ return j.get(e);
39
+ const o = (await (V.has(n) ? V.get(n) : await se(n)).get(t))();
40
+ return j.set(e, o), o;
41
41
  }
42
- E.loadRemoteModule = Y;
43
- const Q = (n, t) => new Promise((e, i) => {
42
+ C.loadRemoteModule = ne;
43
+ const ie = (n, t) => new Promise((e, i) => {
44
44
  const s = document.createElement("script");
45
45
  s.src = n, s.type = "text/javascript", s.async = !0, s.onload = () => {
46
46
  e({
@@ -55,19 +55,19 @@ const Q = (n, t) => new Promise((e, i) => {
55
55
  });
56
56
  }, s.onerror = () => i(new Error(`Remote ${t} not found`)), document.head.appendChild(s);
57
57
  });
58
- async function X(n) {
59
- if (!D && !R)
58
+ async function se(n) {
59
+ if (!K && !O)
60
60
  throw new Error("Call setRemoteDefinitions or setRemoteUrlResolver to allow Dynamic Federation to find the remote apps correctly.");
61
- N || (N = !0, await __webpack_init_sharing__("default"));
62
- const t = R ? R[n] : await D(n);
61
+ z || (z = !0, await __webpack_init_sharing__("default"));
62
+ const t = O ? O[n] : await K(n);
63
63
  let e = t;
64
64
  !t.endsWith(".mjs") && !t.endsWith(".js") && (e = `${t}${t.endsWith("/") ? "" : "/"}remoteEntry.js`);
65
- const i = await Q(e, n);
66
- return await i.init(__webpack_share_scopes__.default), U.set(n, i), i;
65
+ const i = await ie(e, n);
66
+ return await i.init(__webpack_share_scopes__.default), V.set(n, i), i;
67
67
  }
68
68
  (function(n) {
69
69
  Object.defineProperty(n, "__esModule", { value: !0 }), n.setRemoteUrlResolver = n.setRemoteDefinitions = n.loadRemoteModule = void 0;
70
- var t = E;
70
+ var t = C;
71
71
  Object.defineProperty(n, "loadRemoteModule", { enumerable: !0, get: function() {
72
72
  return t.loadRemoteModule;
73
73
  } }), Object.defineProperty(n, "setRemoteDefinitions", { enumerable: !0, get: function() {
@@ -75,20 +75,20 @@ async function X(n) {
75
75
  } }), Object.defineProperty(n, "setRemoteUrlResolver", { enumerable: !0, get: function() {
76
76
  return t.setRemoteUrlResolver;
77
77
  } });
78
- })(F);
79
- const Ne = /* @__PURE__ */ z({
78
+ })(U);
79
+ const Me = /* @__PURE__ */ X({
80
80
  __proto__: null
81
- }, [F]), V = [];
82
- function ee(n) {
83
- V.push(n);
81
+ }, [U]), H = [];
82
+ function oe(n) {
83
+ H.push(n);
84
84
  }
85
- function te(n, t, e) {
86
- return V.reduce(
85
+ function re(n, t, e) {
86
+ return H.reduce(
87
87
  (i, s) => s(i, t, e),
88
88
  n
89
89
  );
90
90
  }
91
- function ne(n) {
91
+ function ae(n) {
92
92
  var t;
93
93
  try {
94
94
  if ("shape" in n) {
@@ -113,9 +113,9 @@ function ne(n) {
113
113
  return console.warn("Failed to extract schema field info:", e), [];
114
114
  }
115
115
  }
116
- class ie {
116
+ class ce {
117
117
  constructor() {
118
- C(this, "issues", []);
118
+ _(this, "issues", []);
119
119
  }
120
120
  addError(t) {
121
121
  this.issues.push({ type: "error", message: t });
@@ -136,9 +136,9 @@ class ie {
136
136
  return [...this.issues];
137
137
  }
138
138
  }
139
- class se {
139
+ class le {
140
140
  constructor() {
141
- C(this, "cache", /* @__PURE__ */ new Map());
141
+ _(this, "cache", /* @__PURE__ */ new Map());
142
142
  }
143
143
  set(t, e) {
144
144
  this.cache.set(t, e);
@@ -150,13 +150,13 @@ class se {
150
150
  this.cache.clear();
151
151
  }
152
152
  }
153
- const I = new se();
154
- function Ke(n) {
155
- return I.get(n);
153
+ const T = new le();
154
+ function Le(n) {
155
+ return T.get(n);
156
156
  }
157
- class oe {
157
+ class ue {
158
158
  constructor() {
159
- C(this, "extensionPoints", /* @__PURE__ */ new Map());
159
+ _(this, "extensionPoints", /* @__PURE__ */ new Map());
160
160
  }
161
161
  define(t) {
162
162
  if (this.extensionPoints.has(t.id))
@@ -172,17 +172,17 @@ class oe {
172
172
  return;
173
173
  }
174
174
  const i = this.createReducer(t);
175
- ee(i), e.isRegistered = !0;
175
+ oe(i), e.isRegistered = !0;
176
176
  }
177
177
  };
178
- return t.schema && (e.getSchemaFieldInfo = () => ne(t.schema)), this.extensionPoints.set(t.id, e), e;
178
+ return t.schema && (e.getSchemaFieldInfo = () => ae(t.schema)), this.extensionPoints.set(t.id, e), e;
179
179
  }
180
180
  createReducer(t) {
181
181
  return (e, i, s) => {
182
182
  const o = i[t.contributionKey];
183
183
  return !o || typeof o != "object" || Object.entries(o).forEach(
184
184
  ([a, r]) => {
185
- var f, h;
185
+ var g, y;
186
186
  if (!r)
187
187
  return;
188
188
  const c = {
@@ -192,12 +192,12 @@ class oe {
192
192
  contributions: i
193
193
  };
194
194
  if (t.validate) {
195
- const d = new ie();
195
+ const d = new ce();
196
196
  if (t.validate(
197
197
  r,
198
198
  d
199
199
  ) === "skip") {
200
- I.set(a, [
200
+ T.set(a, [
201
201
  {
202
202
  type: "warning",
203
203
  message: "Plugin marked to skip processing"
@@ -206,19 +206,19 @@ class oe {
206
206
  return;
207
207
  }
208
208
  if (d.hasIssues()) {
209
- const x = d.getIssues().map((m) => ({
210
- ...m,
211
- message: `Extension point validation: ${m.message}`
209
+ const E = d.getIssues().map((v) => ({
210
+ ...v,
211
+ message: `Extension point validation: ${v.message}`
212
212
  }));
213
- if (I.set(a, x), d.hasErrors()) {
213
+ if (T.set(a, E), d.hasErrors()) {
214
214
  console.error(
215
215
  `Validation failed for ${t.id} contribution "${a}":`,
216
- x.filter((m) => m.type === "error").map((m) => m.message).join(", ")
216
+ E.filter((v) => v.type === "error").map((v) => v.message).join(", ")
217
217
  );
218
218
  return;
219
219
  }
220
220
  } else
221
- I.set(a, []);
221
+ T.set(a, []);
222
222
  }
223
223
  const l = t.transform ? t.transform(r, c) : r;
224
224
  e[t.id] || (e[t.id] = {});
@@ -229,7 +229,7 @@ class oe {
229
229
  remote: c.remote,
230
230
  sectionId: c.sectionId
231
231
  };
232
- if (t.isRankable && typeof r.rank == "number" && (u.rank = r.rank), l && typeof l == "object" && ("component" in l && (u.component = l.component), "view" in l && (u.view = l.view), "location" in l && (u.location = l.location)), e[t.id][a] = u, t.hasView && ((f = t.relatedPoints) != null && f.view)) {
232
+ if (t.isRankable && typeof r.rank == "number" && (u.rank = r.rank), l && typeof l == "object" && ("component" in l && (u.component = l.component), "view" in l && (u.view = l.view), "location" in l && (u.location = l.location)), e[t.id][a] = u, t.hasView && ((g = t.relatedPoints) != null && g.view)) {
233
233
  const d = r.experienceId, p = s == null ? void 0 : s[d];
234
234
  p && (e[t.relatedPoints.view] || (e[t.relatedPoints.view] = {}), e[t.relatedPoints.view][a] = {
235
235
  id: a,
@@ -239,7 +239,7 @@ class oe {
239
239
  sectionId: c.sectionId
240
240
  });
241
241
  }
242
- (h = t.relatedPoints) != null && h.definition && (e[t.relatedPoints.definition] || (e[t.relatedPoints.definition] = {}), e[t.relatedPoints.definition][a] = {
242
+ (y = t.relatedPoints) != null && y.definition && (e[t.relatedPoints.definition] || (e[t.relatedPoints.definition] = {}), e[t.relatedPoints.definition][a] = {
243
243
  id: a,
244
244
  type: `${t.contributionKey}.definition`,
245
245
  data: l,
@@ -285,14 +285,14 @@ class oe {
285
285
  return e == null ? void 0 : e.config.schema;
286
286
  }
287
287
  }
288
- const A = new oe();
289
- function b() {
290
- return A;
288
+ const M = new ue();
289
+ function w() {
290
+ return M;
291
291
  }
292
- function Ve(n) {
293
- return A.getExtensionPointSchema(n);
292
+ function qe(n) {
293
+ return M.getExtensionPointSchema(n);
294
294
  }
295
- function re(n = {}) {
295
+ function de(n = {}) {
296
296
  const {
297
297
  experienceIdProperty: t = "experienceId",
298
298
  flattenComponentProperties: e = !0,
@@ -308,16 +308,16 @@ function re(n = {}) {
308
308
  return e && r && (r.component && (c.component = r.component), r.location && (c.location = r.location)), i && (c = i(s, r, o) || c), c;
309
309
  };
310
310
  }
311
- function ae(n) {
312
- return A.define(n);
311
+ function pe(n) {
312
+ return M.define(n);
313
313
  }
314
- const ce = {
314
+ const fe = {
315
315
  $timestamp: () => Date.now(),
316
316
  $date: () => (/* @__PURE__ */ new Date()).toISOString(),
317
317
  $packageVersion: () => process.env.npm_package_version || "0.0.0",
318
318
  $env: () => process.env.NODE_ENV || "development"
319
319
  };
320
- function le(n) {
320
+ function ge(n) {
321
321
  const t = {
322
322
  id: n.id,
323
323
  displayName: n.displayName,
@@ -328,25 +328,25 @@ function le(n) {
328
328
  relatedPoints: n.relatedPoints,
329
329
  metadata: n.metadata ? {
330
330
  ...n.metadata,
331
- exportName: n.metadata.exportName || ue(n.id)
331
+ exportName: n.metadata.exportName || me(n.id)
332
332
  } : void 0
333
333
  };
334
- return n.schema && (t.schema = de(n.schema, {
334
+ return n.schema && (t.schema = he(n.schema, {
335
335
  hasView: n.hasView,
336
336
  isRankable: n.isRankable
337
- })), n.validation && (t.validate = fe(n.validation)), n.transform ? t.transform = Pe(n.transform) : n.hasView && (t.transform = re()), t;
337
+ })), n.validation && (t.validate = be(n.validation)), n.transform ? t.transform = Ce(n.transform) : n.hasView && (t.transform = de()), t;
338
338
  }
339
- function ue(n) {
339
+ function me(n) {
340
340
  return n.split(".").map((t) => t.charAt(0).toUpperCase() + t.slice(1)).join("") + "Extension";
341
341
  }
342
- function de(n, t) {
342
+ function he(n, t) {
343
343
  try {
344
344
  const { z: e } = require("zod");
345
345
  if (n.properties) {
346
346
  const i = {};
347
347
  i.id = e.string().min(1), i.title = e.string().min(1), i.namespace = e.string().min(1), t != null && t.hasView && (i.experienceId = e.string().min(1)), t != null && t.isRankable && (i.rank = e.number().min(0).max(1e3).optional());
348
348
  for (const [o, a] of Object.entries(n.properties))
349
- i[o] = pe(a, e);
349
+ i[o] = ye(a, e);
350
350
  let s = e.object(i);
351
351
  return n.additionalProperties || (s = s.strict()), s;
352
352
  }
@@ -356,7 +356,7 @@ function de(n, t) {
356
356
  return;
357
357
  }
358
358
  }
359
- function pe(n, t) {
359
+ function ye(n, t) {
360
360
  let e;
361
361
  switch (n.type) {
362
362
  case "string":
@@ -379,38 +379,38 @@ function pe(n, t) {
379
379
  }
380
380
  return n.description && (e = e.describe(n.description)), n.default !== void 0 && (e = e.default(n.default)), e;
381
381
  }
382
- function fe(n) {
383
- return n.module ? Ee(n.module) : (t, e) => {
382
+ function be(n) {
383
+ return n.module ? ke(n.module) : (t, e) => {
384
384
  if (!n.rules)
385
385
  return;
386
386
  const i = t;
387
387
  for (const s of n.rules)
388
- me(s, i, e);
388
+ xe(s, i, e);
389
389
  };
390
390
  }
391
- function me(n, t, e) {
391
+ function xe(n, t, e) {
392
392
  switch (n.type) {
393
393
  case "required":
394
- ge(n, t, e);
394
+ ve(n, t, e);
395
395
  break;
396
396
  case "range":
397
- he(n, t, e);
397
+ Ee(n, t, e);
398
398
  break;
399
399
  case "pattern":
400
- ye(n, t, e);
400
+ Pe(n, t, e);
401
401
  break;
402
402
  case "dependency":
403
- be(n, t, e);
403
+ we(n, t, e);
404
404
  break;
405
405
  case "custom":
406
- xe(n, t, e);
406
+ $e(n, t, e);
407
407
  break;
408
408
  }
409
409
  }
410
- function ge(n, t, e) {
410
+ function ve(n, t, e) {
411
411
  n.field && !t[n.field] && e.addError(n.message || `Field '${n.field}' is required`);
412
412
  }
413
- function he(n, t, e) {
413
+ function Ee(n, t, e) {
414
414
  if (n.field && typeof t[n.field] == "number") {
415
415
  const i = t[n.field];
416
416
  n.min !== void 0 && i < n.min && e.addError(
@@ -420,42 +420,42 @@ function he(n, t, e) {
420
420
  );
421
421
  }
422
422
  }
423
- function ye(n, t, e) {
423
+ function Pe(n, t, e) {
424
424
  n.field && n.pattern && typeof t[n.field] == "string" && (new RegExp(n.pattern).test(t[n.field]) || e.addError(
425
425
  n.message || `Field '${n.field}' does not match pattern ${n.pattern}`
426
426
  ));
427
427
  }
428
- function be(n, t, e) {
428
+ function we(n, t, e) {
429
429
  if (n.field && n.dependsOn && n.expression)
430
430
  try {
431
- S(n.expression, t) || e.addError(
431
+ A(n.expression, t) || e.addError(
432
432
  n.message || `Field '${n.field}' dependency validation failed`
433
433
  );
434
434
  } catch (i) {
435
435
  e.addWarning(`Failed to evaluate dependency expression: ${i}`);
436
436
  }
437
437
  }
438
- function xe(n, t, e) {
438
+ function $e(n, t, e) {
439
439
  if (n.expression)
440
440
  try {
441
- S(n.expression, t) || e.addError(n.message || "Custom validation failed");
441
+ A(n.expression, t) || e.addError(n.message || "Custom validation failed");
442
442
  } catch (i) {
443
443
  e.addWarning(`Failed to evaluate custom expression: ${i}`);
444
444
  }
445
445
  }
446
- function Ee(n) {
446
+ function ke(n) {
447
447
  return (t, e) => {
448
448
  console.warn(`External validation module not implemented: ${n}`), e.addWarning(
449
449
  `External validation module not yet supported: ${n}`
450
450
  );
451
451
  };
452
452
  }
453
- function Pe(n) {
454
- return n.module ? we(n.module) : (t, e) => {
453
+ function Ce(n) {
454
+ return n.module ? Re(n.module) : (t, e) => {
455
455
  const i = { ...t };
456
456
  if (n.addFields)
457
457
  for (const [s, o] of Object.entries(n.addFields))
458
- i[s] = ve(o);
458
+ i[s] = Ie(o);
459
459
  if (n.removeFields)
460
460
  for (const s of n.removeFields)
461
461
  delete i[s];
@@ -466,25 +466,25 @@ function Pe(n) {
466
466
  s in i && (i[o] = i[s], delete i[s]);
467
467
  if (n.normalizeFields)
468
468
  for (const { field: s, operation: o } of n.normalizeFields)
469
- s in i && typeof i[s] == "string" && (i[s] = $e(
469
+ s in i && typeof i[s] == "string" && (i[s] = Se(
470
470
  i[s],
471
471
  o
472
472
  ));
473
473
  return i;
474
474
  };
475
475
  }
476
- function we(n) {
476
+ function Re(n) {
477
477
  return (t, e) => (console.warn(`External transform module not implemented: ${n}`), t);
478
478
  }
479
- function ve(n) {
479
+ function Ie(n) {
480
480
  if (typeof n == "string" && n.startsWith("$")) {
481
- const t = ce[n];
481
+ const t = fe[n];
482
482
  if (t)
483
483
  return t();
484
484
  }
485
485
  return n;
486
486
  }
487
- function $e(n, t) {
487
+ function Se(n, t) {
488
488
  switch (t) {
489
489
  case "trim":
490
490
  return n.trim();
@@ -493,20 +493,20 @@ function $e(n, t) {
493
493
  case "uppercase":
494
494
  return n.toUpperCase();
495
495
  case "camelCase":
496
- return ke(n);
496
+ return Fe(n);
497
497
  case "kebabCase":
498
- return Ce(n);
498
+ return De(n);
499
499
  default:
500
500
  return n;
501
501
  }
502
502
  }
503
- function ke(n) {
503
+ function Fe(n) {
504
504
  return n.replace(/[-_\s]+(.)?/g, (t, e) => e ? e.toUpperCase() : "").replace(/^./, (t) => t.toLowerCase());
505
505
  }
506
- function Ce(n) {
506
+ function De(n) {
507
507
  return n.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
508
508
  }
509
- function S(n, t) {
509
+ function A(n, t) {
510
510
  try {
511
511
  let e = n;
512
512
  for (const [i, s] of Object.entries(t)) {
@@ -524,12 +524,12 @@ function S(n, t) {
524
524
  const [i, s] = e.split("===").map((o) => o.trim());
525
525
  return i === s;
526
526
  }
527
- return e.includes("||") ? e.split("||").map((s) => s.trim()).some((s) => S(s, t)) : e.includes("&&") ? e.split("&&").map((s) => s.trim()).every((s) => S(s, t)) : !1;
527
+ return e.includes("||") ? e.split("||").map((s) => s.trim()).some((s) => A(s, t)) : e.includes("&&") ? e.split("&&").map((s) => s.trim()).every((s) => A(s, t)) : !1;
528
528
  } catch (e) {
529
529
  return console.error("Expression evaluation failed:", e), !1;
530
530
  }
531
531
  }
532
- const Re = (n) => (t, e) => {
532
+ const _e = (n) => (t, e) => {
533
533
  var c;
534
534
  const i = n[e].remote, s = n[e].section || "default", o = ((c = n[e].contributes) == null ? void 0 : c.experiences) ?? {};
535
535
  return Object.keys(o).forEach((l) => {
@@ -539,16 +539,16 @@ const Re = (n) => (t, e) => {
539
539
  remote: i,
540
540
  sectionId: s
541
541
  };
542
- }), b().getAllExtensionPoints().forEach((l) => {
543
- var h;
544
- const { contributionKey: u } = l.config, f = (h = n[e].contributes) == null ? void 0 : h[u];
545
- f && (t[u] || (t[u] = {}), Array.isArray(f) ? f.forEach((d) => {
542
+ }), w().getAllExtensionPoints().forEach((l) => {
543
+ var y;
544
+ const { contributionKey: u } = l.config, g = (y = n[e].contributes) == null ? void 0 : y[u];
545
+ g && (t[u] || (t[u] = {}), Array.isArray(g) ? g.forEach((d) => {
546
546
  d && d.id && (t[u][d.id] = {
547
547
  ...d,
548
548
  remote: i,
549
549
  sectionId: s
550
550
  });
551
- }) : typeof f == "object" && Object.entries(f).forEach(([d, p]) => {
551
+ }) : typeof g == "object" && Object.entries(g).forEach(([d, p]) => {
552
552
  t[u][d] = {
553
553
  ...p,
554
554
  id: d,
@@ -558,7 +558,7 @@ const Re = (n) => (t, e) => {
558
558
  }));
559
559
  }), t;
560
560
  };
561
- async function Ie(n) {
561
+ async function Oe(n) {
562
562
  const t = n ?? window.KosPlugins.__dynamicRemotes;
563
563
  if (window.KosPlugins.extensions) {
564
564
  const o = window.KosPlugins.extensions;
@@ -569,7 +569,7 @@ async function Ie(n) {
569
569
  extensions: window.KosPlugins.__extensions
570
570
  };
571
571
  }
572
- const e = window.KosPlugins.__extensions ?? await Fe(t), i = {};
572
+ const e = window.KosPlugins.__extensions ?? await Ae(t), i = {};
573
573
  if (e)
574
574
  for (const o of Object.keys(e))
575
575
  i[o] = Object.values(
@@ -577,29 +577,29 @@ async function Ie(n) {
577
577
  );
578
578
  return window.KosPlugins.extensions = i, { extensionPoints: i, getExtensions: (o) => i[o] || [], remotes: t, extensions: e };
579
579
  }
580
- const K = {
580
+ const B = {
581
581
  controlPourDefinitions: {},
582
582
  experiences: {}
583
583
  };
584
- function Se(n) {
585
- return n ? Object.keys(n).reduce(Re(n), {
586
- ...K
587
- }) : K;
584
+ function Te(n) {
585
+ return n ? Object.keys(n).reduce(_e(n), {
586
+ ...B
587
+ }) : B;
588
588
  }
589
- async function Fe(n) {
589
+ async function Ae(n) {
590
590
  if (!n)
591
591
  return window.KosPlugins = window.KosPlugins || {}, {};
592
592
  for (const o of Object.values(n)) {
593
593
  try {
594
594
  if (o.extensions && Array.isArray(o.extensions)) {
595
- const a = o.extensions.filter((r) => r && typeof r == "object" && "id" in r).map((r) => le(r));
595
+ const a = o.extensions.filter((r) => r && typeof r == "object" && "id" in r).map((r) => ge(r));
596
596
  if (a.length > 0) {
597
597
  console.info(
598
598
  `Registering ${a.length} JSON extension point(s) from ${o.remote}`
599
599
  );
600
600
  for (const r of a)
601
601
  try {
602
- ae(r).register(), console.debug(`Registered JSON extension point: ${r.id}`);
602
+ pe(r).register(), console.debug(`Registered JSON extension point: ${r.id}`);
603
603
  } catch (c) {
604
604
  console.error(
605
605
  `Failed to register JSON extension point '${r.id}' from ${o.remote}:`,
@@ -616,7 +616,7 @@ async function Fe(n) {
616
616
  }
617
617
  if (o.init)
618
618
  try {
619
- const a = await F.loadRemoteModule(
619
+ const a = await U.loadRemoteModule(
620
620
  o.remote,
621
621
  "./InitPlugin"
622
622
  );
@@ -628,80 +628,154 @@ async function Fe(n) {
628
628
  console.warn(`Failed to load InitPlugin from ${o.remote}:`, a);
629
629
  }
630
630
  }
631
- const t = Se(n), e = t.experiences, s = te(
631
+ const t = Te(n), e = t.experiences, s = re(
632
632
  {},
633
633
  t,
634
634
  e
635
635
  );
636
636
  return window.KosPlugins = window.KosPlugins || {}, window.KosPlugins.__extensions = s, s;
637
637
  }
638
- async function Me(n) {
639
- const { getExtensions: t } = await Ie();
638
+ async function ze(n) {
639
+ const { getExtensions: t } = await Oe();
640
640
  return t(n);
641
641
  }
642
- const _e = (n = null) => (n || window.location.search.replace("?", "")).split("&").map((t) => {
642
+ const W = (n = null) => (n || window.location.search.replace("?", "")).split("&").map((t) => {
643
643
  const [e, i] = t.split("=");
644
644
  return [e, decodeURIComponent(i || "")];
645
- }).reduce((t, [e, i]) => (t[e] = i, t), {}), Oe = () => {
646
- const n = window.location.origin, t = _e();
645
+ }).reduce((t, [e, i]) => (t[e] = i, t), {}), Ue = () => {
646
+ const n = window.location.origin, t = W();
647
647
  return (t == null ? void 0 : t.host) || n;
648
- }, Le = async (n) => {
649
- var x;
650
- const t = Oe(), e = n ?? {}, {
648
+ }, Be = async (n) => {
649
+ var q;
650
+ const t = Ue(), e = n ?? {}, {
651
651
  pluginBaseUrl: i = t,
652
652
  pluginApiPath: s,
653
653
  overrides: o = {},
654
654
  pluginContext: a
655
- } = e, r = s ? `${i}${s}` : `${i}/api/kos/ui/plugins/contexts`;
655
+ } = e;
656
+ console.log("[initialize-plugins] Config received:", {
657
+ propsPluginBaseUrl: n == null ? void 0 : n.pluginBaseUrl,
658
+ defaultHost: t,
659
+ resolvedPluginBaseUrl: i,
660
+ pluginApiPath: s
661
+ });
662
+ const r = s ? `${i}${s}` : `${i}/api/kos/ui/plugins/contexts`;
656
663
  console.log(
657
664
  `initialize-plugins: Using Plugin Framework. Fetching plugins from ${r}`
658
665
  );
659
- const l = await (await fetch(r)).json(), u = typeof (a == null ? void 0 : a.context) == "string" ? [a.context] : (a == null ? void 0 : a.context) || [], f = (x = l.data) == null ? void 0 : x.filter((m) => u.length === 0 || u.includes(m.name)).flatMap(
660
- (m) => m.plugins.map((g) => ({ ...g, name: m.name })) ?? []
661
- ), h = a == null ? void 0 : a.group, d = f == null ? void 0 : f.reduce((m, g) => {
662
- const _ = (o == null ? void 0 : o[g.id]) ?? `${i}${g.path}`;
663
- if (g.descriptor) {
664
- const j = (g.descriptor.extensions || []).reduce((P, y) => {
665
- const k = y.groups || [];
666
- return (!h || k.includes(h)) && P.push(y), P;
667
- }, []), v = g.descriptor.contributes || {};
668
- let $ = !1;
669
- const L = Object.keys(v).reduce(
670
- (P, y) => {
671
- if (Array.isArray(v[y])) {
672
- const k = (v[y] || []).filter((B) => {
673
- const H = B.groups || [];
674
- return !h || H.includes(h);
666
+ const l = await (await fetch(r)).json(), u = W(), g = u.pluginDevServers ? u.pluginDevServers.split(",").map((h) => h.trim()) : [];
667
+ if (g.length > 0) {
668
+ console.log(
669
+ "[initialize-plugins] Detected third-party plugin dev servers:",
670
+ g
671
+ );
672
+ const f = (await Promise.all(
673
+ g.map(async (m) => {
674
+ try {
675
+ console.log(
676
+ `[initialize-plugins] Fetching from dev server: ${m}`
677
+ );
678
+ const P = await fetch(
679
+ `${m}/api/kos/ui/plugins/contexts`
680
+ );
681
+ if (!P.ok)
682
+ return console.warn(
683
+ `[initialize-plugins] Dev server ${m} returned ${P.status}`
684
+ ), null;
685
+ const R = await P.json();
686
+ return { serverUrl: m, data: R };
687
+ } catch (P) {
688
+ return console.warn(
689
+ `[initialize-plugins] Failed to fetch from dev server ${m}:`,
690
+ P
691
+ ), null;
692
+ }
693
+ })
694
+ )).filter(
695
+ (m) => m !== null && m.data && m.data.status === 200
696
+ );
697
+ if (f.length > 0) {
698
+ console.log(
699
+ `[initialize-plugins] Merging ${f.length} dev server plugin(s)`
700
+ );
701
+ const m = {};
702
+ f.forEach(({ serverUrl: P, data: R }) => {
703
+ var $;
704
+ ($ = R.data) == null || $.forEach((k) => {
705
+ var F;
706
+ let I = (F = l.data) == null ? void 0 : F.find(
707
+ (b) => b.name === k.name
708
+ );
709
+ I || (I = { name: k.name, plugins: [] }, l.data = l.data || [], l.data.push(I)), k.plugins.forEach((b) => {
710
+ var x;
711
+ I.plugins.push(b), m[b.id] = `${P}/`, console.log(
712
+ `[initialize-plugins] Added dev plugin: ${(x = b.descriptor) == null ? void 0 : x.id} from ${P}`
713
+ );
714
+ });
715
+ });
716
+ }), l.overrides = {
717
+ ...l.overrides || {},
718
+ ...m
719
+ }, console.log(
720
+ "[initialize-plugins] Dev server overrides:",
721
+ m
722
+ );
723
+ }
724
+ }
725
+ const y = {
726
+ ...o,
727
+ ...l.overrides || {}
728
+ };
729
+ l.overrides && console.log(
730
+ "[initialize-plugins] Using overrides from response:",
731
+ l.overrides
732
+ ), Object.keys(y).length > 0 && console.log("[initialize-plugins] Merged overrides:", y);
733
+ const d = typeof (a == null ? void 0 : a.context) == "string" ? [a.context] : (a == null ? void 0 : a.context) || [], p = (q = l.data) == null ? void 0 : q.filter((h) => d.length === 0 || d.includes(h.name)).flatMap(
734
+ (h) => h.plugins.map((f) => ({ ...f, name: h.name })) ?? []
735
+ ), E = a == null ? void 0 : a.group, v = p == null ? void 0 : p.reduce((h, f) => {
736
+ const m = (y == null ? void 0 : y[f.id]) ?? `${i}${f.path}`;
737
+ if (f.descriptor) {
738
+ const R = (f.descriptor.extensions || []).reduce((b, x) => {
739
+ const D = x.groups || [];
740
+ return (!E || D.includes(E)) && b.push(x), b;
741
+ }, []), $ = f.descriptor.contributes || {};
742
+ let k = !1;
743
+ const I = Object.keys($).reduce(
744
+ (b, x) => {
745
+ if (Array.isArray($[x])) {
746
+ const D = ($[x] || []).filter((J) => {
747
+ const Z = J.groups || [];
748
+ return !E || Z.includes(E);
675
749
  });
676
- $ = $ || k.length > 0, P[y] = k;
750
+ k = k || D.length > 0, b[x] = D;
677
751
  } else
678
- P[y] = v[y], $ = Object.keys(v[y]).length > 0;
679
- return P;
752
+ b[x] = $[x], k = Object.keys($[x]).length > 0;
753
+ return b;
680
754
  },
681
755
  {}
682
- ), q = !!g.descriptor.init && (j.length > 0 || $);
683
- m[g.id] = {
684
- section: g.name,
685
- basePath: `${_}remoteEntry.js`,
686
- extensions: j,
687
- contributes: L,
688
- remote: g.descriptor.id,
689
- init: q
756
+ ), F = !!f.descriptor.init && (R.length > 0 || k);
757
+ h[f.id] = {
758
+ section: f.name,
759
+ basePath: `${m}remoteEntry.js`,
760
+ extensions: R,
761
+ contributes: I,
762
+ remote: f.descriptor.id,
763
+ init: F
690
764
  };
691
765
  } else
692
766
  console.error(
693
- `initialize-plugins: Plugin ${g.id} does not have a descriptor`
767
+ `initialize-plugins: Plugin ${f.id} does not have a descriptor`
694
768
  );
695
- return m;
769
+ return h;
696
770
  }, {});
697
- window.KosPlugins = window.KosPlugins || {}, window.KosPlugins.__dynamicRemotes = d;
698
- const p = Object.keys(d).reduce((m, g) => {
699
- const _ = d[g].remote;
700
- return m[_] = d[g].basePath, m;
771
+ window.KosPlugins = window.KosPlugins || {}, window.KosPlugins.__dynamicRemotes = v;
772
+ const L = Object.keys(v).reduce((h, f) => {
773
+ const m = v[f].remote;
774
+ return h[m] = v[f].basePath, h;
701
775
  }, {});
702
- return F.setRemoteDefinitions(p), p;
776
+ return U.setRemoteDefinitions(L), L;
703
777
  };
704
- function qe(n, t, e = !1) {
778
+ function He(n, t, e = !1) {
705
779
  return !n || Object.keys(n).length === 0 ? null : e ? t && n[t] ? n[t] : null : t && n[t] ? n[t] : Object.values(n).filter((s) => typeof s.id == "string").sort((s, o) => {
706
780
  const a = typeof s.rank == "number" ? s.rank : 1 / 0, r = typeof o.rank == "number" ? o.rank : 1 / 0;
707
781
  if (a === r) {
@@ -711,37 +785,37 @@ function qe(n, t, e = !1) {
711
785
  return a - r;
712
786
  })[0] ?? null;
713
787
  }
714
- const M = w.object({
715
- id: w.string().min(1, "ID is required").describe("Unique identifier for this extension"),
716
- title: w.string().min(1, "Title is required").describe("Display title shown in the interface"),
717
- namespace: w.string().min(1, "Namespace is required").describe("Namespace for organizing related extensions"),
718
- experienceId: w.string().min(1, "Experience ID is required").describe("Reference to the UI component experience for rendering")
719
- }), Te = M.extend({
720
- rank: w.number().int().min(0).optional().describe("Optional ranking for ordering (higher = preferred)")
788
+ const G = S.object({
789
+ id: S.string().min(1, "ID is required").describe("Unique identifier for this extension"),
790
+ title: S.string().min(1, "Title is required").describe("Display title shown in the interface"),
791
+ namespace: S.string().min(1, "Namespace is required").describe("Namespace for organizing related extensions"),
792
+ experienceId: S.string().min(1, "Experience ID is required").describe("Reference to the UI component experience for rendering")
793
+ }), je = G.extend({
794
+ rank: S.number().int().min(0).optional().describe("Optional ranking for ordering (higher = preferred)")
721
795
  });
722
- function Be(n, t, e) {
796
+ function We(n, t, e) {
723
797
  const i = n.safeParse(t);
724
798
  return i.success ? !0 : (i.error.errors.forEach((s) => {
725
799
  e.addError(`${s.path.join(".")}: ${s.message}`);
726
800
  }), !1);
727
801
  }
728
- function He(n, t, e) {
802
+ function Ge(n, t, e) {
729
803
  t && !t.includes(".") && e.addWarning(
730
804
  `${n} '${t}' should typically include dot notation (e.g., 'category.item')`
731
805
  );
732
806
  }
733
- function De(n, t, e = 1e3) {
807
+ function Ne(n, t, e = 1e3) {
734
808
  n !== void 0 && n > e && t.addWarning(
735
809
  `Rank ${n} seems unusually high - consider using lower values for better ordering`
736
810
  );
737
811
  }
738
- function We(n, t = {}) {
739
- return (t.rankable ? Te : M).extend(n);
812
+ function Je(n, t = {}) {
813
+ return (t.rankable ? je : G).extend(n);
740
814
  }
741
- function Ge(n, t, e = 1e3) {
742
- typeof n == "object" && n !== null && "rank" in n && De(n.rank, t, e);
815
+ function Ze(n, t, e = 1e3) {
816
+ typeof n == "object" && n !== null && "rank" in n && Ne(n.rank, t, e);
743
817
  }
744
- class T {
818
+ class N {
745
819
  /**
746
820
  * Get all extension points with their plugin information
747
821
  */
@@ -749,7 +823,7 @@ class T {
749
823
  const {
750
824
  includeLegacyExtensions: i = !0,
751
825
  includeEmptyExtensionPoints: s = !0
752
- } = e, a = b().getAllExtensionPoints(), r = [];
826
+ } = e, a = w().getAllExtensionPoints(), r = [];
753
827
  return a.forEach((c) => {
754
828
  const l = Object.values((t == null ? void 0 : t[c.id]) || {});
755
829
  !s && l.length === 0 || r.push({
@@ -762,7 +836,7 @@ class T {
762
836
  plugins: l
763
837
  });
764
838
  }), i && t && Object.entries(t).forEach(([c, l]) => {
765
- if (r.some((f) => f.id === c))
839
+ if (r.some((g) => g.id === c))
766
840
  return;
767
841
  const u = Object.values(l || {});
768
842
  !s && u.length === 0 || r.push({
@@ -783,7 +857,7 @@ class T {
783
857
  return t.filter(
784
858
  (s) => {
785
859
  var o, a, r, c, l, u;
786
- return s.id.toLowerCase().includes(i) || ((o = s.displayName) == null ? void 0 : o.toLowerCase().includes(i)) || ((a = s.description) == null ? void 0 : a.toLowerCase().includes(i)) || ((c = (r = s.metadata) == null ? void 0 : r.category) == null ? void 0 : c.toLowerCase().includes(i)) || ((u = (l = s.metadata) == null ? void 0 : l.tags) == null ? void 0 : u.some((f) => f.toLowerCase().includes(i)));
860
+ return s.id.toLowerCase().includes(i) || ((o = s.displayName) == null ? void 0 : o.toLowerCase().includes(i)) || ((a = s.description) == null ? void 0 : a.toLowerCase().includes(i)) || ((c = (r = s.metadata) == null ? void 0 : r.category) == null ? void 0 : c.toLowerCase().includes(i)) || ((u = (l = s.metadata) == null ? void 0 : l.tags) == null ? void 0 : u.some((g) => g.toLowerCase().includes(i)));
787
861
  }
788
862
  );
789
863
  }
@@ -919,7 +993,7 @@ class T {
919
993
  incompatibleTypes: [],
920
994
  suggestions: []
921
995
  };
922
- const r = b(), c = new Set(
996
+ const r = w(), c = new Set(
923
997
  e.map((l) => l.id)
924
998
  );
925
999
  return Object.entries(t.contributes).forEach(
@@ -934,13 +1008,13 @@ class T {
934
1008
  const d = r.getAllExtensionPoints().find(
935
1009
  (p) => p.config.contributionKey === l
936
1010
  );
937
- d && u.length > 0 && u.forEach((p, x) => {
1011
+ d && u.length > 0 && u.forEach((p, E) => {
938
1012
  d.config.isRankable && typeof p.rank != "number" && (i.push(
939
- `${l}[${x}]: Extension point '${d.id}' expects 'rank' property`
1013
+ `${l}[${E}]: Extension point '${d.id}' expects 'rank' property`
940
1014
  ), a.push(
941
1015
  "Add 'rank' property with numeric value for ordering"
942
1016
  )), d.config.hasView && !p.experienceId && (i.push(
943
- `${l}[${x}]: Extension point '${d.id}' expects 'experienceId' for view-based contributions`
1017
+ `${l}[${E}]: Extension point '${d.id}' expects 'experienceId' for view-based contributions`
944
1018
  ), a.push(
945
1019
  "Add 'experienceId' property linking to an experience definition"
946
1020
  ));
@@ -993,7 +1067,7 @@ class T {
993
1067
  };
994
1068
  }
995
1069
  }
996
- class ze {
1070
+ class Ye {
997
1071
  /**
998
1072
  * Generate complete documentation for all extension points
999
1073
  */
@@ -1003,13 +1077,13 @@ class ze {
1003
1077
  includeTypeDefinitions: s = !0,
1004
1078
  includeLegacyExtensions: o = !0,
1005
1079
  includePluginHealth: a = !0
1006
- } = e, r = T.getExtensionPoints(
1080
+ } = e, r = N.getExtensionPoints(
1007
1081
  t,
1008
1082
  {
1009
1083
  includeLegacyExtensions: o,
1010
1084
  includeEmptyExtensionPoints: !0
1011
1085
  }
1012
- ), c = T.calculateHealthStats(r);
1086
+ ), c = N.calculateHealthStats(r);
1013
1087
  let l = this.generateHeader(c);
1014
1088
  return l += this.generateTableOfContents(r), l += this.generateOverviewSection(r, c), r.forEach((u) => {
1015
1089
  l += this.generateExtensionPointSection(u, {
@@ -1220,7 +1294,7 @@ No plugins currently registered for this extension point.
1220
1294
  `), s.sectionId && (i += `- **Section**: ${s.sectionId}
1221
1295
  `), s.rank !== void 0 && (i += `- **Rank**: ${s.rank}
1222
1296
  `), e) {
1223
- const o = T.analyzePlugin(s);
1297
+ const o = N.analyzePlugin(s);
1224
1298
  i += `- **Health**: ${this.getHealthEmoji(o.healthStatus)} ${o.healthStatus}
1225
1299
  `, o.capabilities.length > 0 && (i += `- **Capabilities**: ${o.capabilities.join(", ")}
1226
1300
  `);
@@ -1235,7 +1309,7 @@ No plugins currently registered for this extension point.
1235
1309
  static generateSchemaFieldsSection(t) {
1236
1310
  if (t.source !== "simplified")
1237
1311
  return "";
1238
- const i = b().getExtensionPoint(t.id);
1312
+ const i = w().getExtensionPoint(t.id);
1239
1313
  if (!(i != null && i.getSchemaFieldInfo))
1240
1314
  return "";
1241
1315
  const s = i.getSchemaFieldInfo();
@@ -1435,7 +1509,7 @@ console.log(validation.warnings); // Check for warnings
1435
1509
  // Helper methods
1436
1510
  static getExtensionPointImportName(t) {
1437
1511
  var a;
1438
- const i = b().getExtensionPoint(t);
1512
+ const i = w().getExtensionPoint(t);
1439
1513
  if ((a = i == null ? void 0 : i.config.metadata) != null && a.exportName)
1440
1514
  return i.config.metadata.exportName;
1441
1515
  const s = t.split(".");
@@ -1463,7 +1537,7 @@ console.log(validation.warnings); // Check for warnings
1463
1537
  }
1464
1538
  static inferContributionKey(t) {
1465
1539
  if (t.source === "simplified") {
1466
- const a = b().getExtensionPoint(t.id);
1540
+ const a = w().getExtensionPoint(t.id);
1467
1541
  if (a != null && a.config.contributionKey)
1468
1542
  return a.config.contributionKey;
1469
1543
  }
@@ -1481,7 +1555,7 @@ console.log(validation.warnings); // Check for warnings
1481
1555
  }
1482
1556
  static isViewBasedExtensionPoint(t) {
1483
1557
  if (t.source === "simplified") {
1484
- const i = b().getExtensionPoint(t.id);
1558
+ const i = w().getExtensionPoint(t.id);
1485
1559
  return (i == null ? void 0 : i.config.hasView) || !1;
1486
1560
  }
1487
1561
  return t.plugins.some(
@@ -1490,7 +1564,7 @@ console.log(validation.warnings); // Check for warnings
1490
1564
  }
1491
1565
  static isRankableExtensionPoint(t) {
1492
1566
  if (t.source === "simplified") {
1493
- const i = b().getExtensionPoint(t.id);
1567
+ const i = w().getExtensionPoint(t.id);
1494
1568
  return (i == null ? void 0 : i.config.isRankable) || !1;
1495
1569
  }
1496
1570
  return t.plugins.some(
@@ -1503,7 +1577,7 @@ console.log(validation.warnings); // Check for warnings
1503
1577
  static getSchemaFieldsForContribution(t) {
1504
1578
  if (t.source !== "simplified")
1505
1579
  return [];
1506
- const i = b().getExtensionPoint(t.id);
1580
+ const i = w().getExtensionPoint(t.id);
1507
1581
  return i != null && i.getSchemaFieldInfo ? i.getSchemaFieldInfo() : [];
1508
1582
  }
1509
1583
  static getSpecificFields(t) {
@@ -1532,29 +1606,29 @@ console.log(validation.warnings); // Check for warnings
1532
1606
  }
1533
1607
  }
1534
1608
  export {
1535
- M as B,
1536
- ze as D,
1537
- T as P,
1538
- Te as R,
1539
- Le as a,
1540
- Ie as b,
1541
- b as c,
1542
- Re as d,
1543
- Se as e,
1544
- Me as f,
1545
- Ke as g,
1546
- ae as h,
1547
- Ne as i,
1548
- Ve as j,
1549
- A as k,
1550
- Fe as l,
1551
- F as m,
1552
- re as n,
1553
- He as o,
1554
- De as p,
1555
- We as q,
1556
- qe as r,
1557
- Ge as s,
1558
- Be as v
1609
+ G as B,
1610
+ Ye as D,
1611
+ N as P,
1612
+ je as R,
1613
+ Be as a,
1614
+ Oe as b,
1615
+ w as c,
1616
+ _e as d,
1617
+ Te as e,
1618
+ ze as f,
1619
+ Le as g,
1620
+ pe as h,
1621
+ Me as i,
1622
+ qe as j,
1623
+ M as k,
1624
+ Ae as l,
1625
+ U as m,
1626
+ de as n,
1627
+ Ge as o,
1628
+ Ne as p,
1629
+ Je as q,
1630
+ He as r,
1631
+ Ze as s,
1632
+ We as v
1559
1633
  };
1560
- //# sourceMappingURL=documentation-generator-auruIa_o.js.map
1634
+ //# sourceMappingURL=documentation-generator-vDywn3tb.js.map