@xwiki/cristal-navigation-tree-xwiki 0.21.0 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @xwiki/cristal-navigation-tree-xwiki
2
2
 
3
+ ## 0.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Cristal 0.21.1 Release
8
+ - Updated dependencies
9
+ - @xwiki/cristal-api@0.21.1
10
+ - @xwiki/cristal-authentication-api@0.21.1
11
+ - @xwiki/cristal-model-api@0.21.1
12
+ - @xwiki/cristal-model-reference-api@0.21.1
13
+ - @xwiki/cristal-model-remote-url-api@0.21.1
14
+ - @xwiki/cristal-navigation-tree-api@0.21.1
15
+
3
16
  ## 0.21.0
4
17
 
5
18
  ### Minor Changes
package/dist/index.es.js CHANGED
@@ -1,300 +1,101 @@
1
- import { name as _ } from "@xwiki/cristal-navigation-tree-api";
2
- function D(n, t, e) {
3
- return Reflect.getOwnMetadata(t, n, e);
4
- }
5
- function L(n, t, e, o) {
6
- Reflect.defineMetadata(t, e, n, o);
7
- }
8
- function h(n, t, e, o, i) {
9
- const r = o(D(n, t, i) ?? e());
10
- Reflect.defineMetadata(t, r, n, i);
11
- }
12
- var M, R, x;
13
- (function(n) {
14
- n.moduleId = "moduleId", n.serviceId = "serviceId";
15
- })(M || (M = {}));
16
- (function(n) {
17
- n.id = "id", n.moduleId = "moduleId", n.serviceId = "serviceId";
18
- })(R || (R = {}));
19
- (function(n) {
20
- n.moduleId = "moduleId", n.serviceId = "serviceId";
21
- })(x || (x = {}));
22
- const k = "@inversifyjs/core/classMetadataReflectKey";
23
- function y() {
24
- return { constructorArguments: [], lifecycle: { postConstructMethodName: void 0, preDestroyMethodName: void 0 }, properties: /* @__PURE__ */ new Map(), scope: void 0 };
25
- }
26
- const W = "@inversifyjs/core/pendingClassMetadataCountReflectKey", $ = Symbol.for("@inversifyjs/core/InversifyCoreError");
27
- class u extends Error {
28
- [$];
29
- kind;
30
- constructor(t, e, o) {
31
- super(e, o), this[$] = !0, this.kind = t;
32
- }
33
- static is(t) {
34
- return typeof t == "object" && t !== null && t[$] === !0;
35
- }
36
- static isErrorOfKind(t, e) {
37
- return u.is(t) && t.kind === e;
38
- }
39
- }
40
- var d, w, p;
41
- function T() {
42
- return 0;
43
- }
44
- function O(n) {
45
- return (t) => {
46
- t !== void 0 && t.kind === w.unknown && h(n, W, T, (e) => e - 1);
47
- };
48
- }
49
- function X(n, t) {
50
- return (...e) => (o) => {
51
- if (o === void 0) return n(...e);
52
- if (o.kind === p.unmanaged) throw new u(d.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
53
- return t(o, ...e);
54
- };
55
- }
56
- function E(n) {
57
- if (n.kind !== w.unknown && n.isFromTypescriptParamType !== !0) throw new u(d.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
58
- }
59
- (function(n) {
60
- n[n.injectionDecoratorConflict = 0] = "injectionDecoratorConflict", n[n.missingInjectionDecorator = 1] = "missingInjectionDecorator", n[n.planning = 2] = "planning", n[n.resolution = 3] = "resolution", n[n.unknown = 4] = "unknown";
61
- })(d || (d = {})), function(n) {
62
- n[n.unknown = 32] = "unknown";
63
- }(w || (w = {})), function(n) {
64
- n[n.multipleInjection = 0] = "multipleInjection", n[n.singleInjection = 1] = "singleInjection", n[n.unmanaged = 2] = "unmanaged";
65
- }(p || (p = {}));
66
- const K = X(function(n, t, e) {
67
- return n === p.multipleInjection ? { chained: e?.chained ?? !1, kind: n, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: t } : { kind: n, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: t };
68
- }, function(n, t, e, o) {
69
- return E(n), t === p.multipleInjection ? { ...n, chained: o?.chained ?? !1, kind: t, value: e } : { ...n, kind: t, value: e };
70
- });
71
- function A(n, t) {
72
- return (e) => {
73
- const o = e.properties.get(t);
74
- return e.properties.set(t, n(o)), e;
75
- };
76
- }
77
- var f;
78
- function H(n, t, e, o) {
79
- if (u.isErrorOfKind(o, d.injectionDecoratorConflict)) {
80
- const i = function(r, c, s) {
81
- if (s === void 0) {
82
- if (c === void 0) throw new u(d.unknown, "Unexpected undefined property and index values");
83
- return { kind: f.property, property: c, targetClass: r.constructor };
84
- }
85
- return typeof s == "number" ? { index: s, kind: f.parameter, targetClass: r } : { kind: f.method, method: c, targetClass: r };
86
- }(n, t, e);
87
- throw new u(d.injectionDecoratorConflict, `Unexpected injection error.
88
-
89
- Cause:
90
-
91
- ${o.message}
92
-
93
- Details
94
-
95
- ${function(r) {
96
- switch (r.kind) {
97
- case f.method:
98
- return `[class: "${r.targetClass.name}", method: "${r.method.toString()}"]`;
99
- case f.parameter:
100
- return `[class: "${r.targetClass.name}", index: "${r.index.toString()}"]`;
101
- case f.property:
102
- return `[class: "${r.targetClass.name}", property: "${r.property.toString()}"]`;
103
- }
104
- }(i)}`, { cause: o });
105
- }
106
- throw o;
107
- }
108
- function z(n, t) {
109
- return (e, o, i) => {
110
- try {
111
- i === void 0 ? function(r, c) {
112
- const s = S(r, c);
113
- return (a, l) => {
114
- h(a.constructor, k, y, A(s(a), l));
115
- };
116
- }(n, t)(e, o) : typeof i == "number" ? function(r, c) {
117
- const s = S(r, c);
118
- return (a, l, I) => {
119
- if (!/* @__PURE__ */ function(g, j) {
120
- return typeof g == "function" && j === void 0;
121
- }(a, l)) throw new u(d.injectionDecoratorConflict, `Found an @inject decorator in a non constructor parameter.
122
- Found @inject decorator at method "${l?.toString() ?? ""}" at class "${a.constructor.name}"`);
123
- h(a, k, y, /* @__PURE__ */ function(g, j) {
124
- return (C) => {
125
- const F = C.constructorArguments[j];
126
- return C.constructorArguments[j] = g(F), C;
127
- };
128
- }(s(a), I));
129
- };
130
- }(n, t)(e, o, i) : function(r, c) {
131
- const s = S(r, c);
132
- return (a, l, I) => {
133
- if (!function(g) {
134
- return g.set !== void 0;
135
- }(I)) throw new u(d.injectionDecoratorConflict, `Found an @inject decorator in a non setter property method.
136
- Found @inject decorator at method "${l.toString()}" at class "${a.constructor.name}"`);
137
- h(a.constructor, k, y, A(s(a), l));
138
- };
139
- }(n, t)(e, o, i);
140
- } catch (r) {
141
- H(e, o, i, r);
142
- }
143
- };
144
- }
145
- function S(n, t) {
146
- return (e) => {
147
- const o = t(e);
148
- return (i) => (o(i), n(i));
149
- };
150
- }
151
- function v(n) {
152
- return z(K(p.singleInjection, n), O);
153
- }
154
- (function(n) {
155
- n[n.method = 0] = "method", n[n.parameter = 1] = "parameter", n[n.property = 2] = "property";
156
- })(f || (f = {}));
157
- const P = "@inversifyjs/core/classIsInjectableFlagReflectKey", B = [Array, BigInt, Boolean, Function, Number, Object, String];
158
- function q(n) {
159
- const t = D(n, "design:paramtypes");
160
- t !== void 0 && h(n, k, y, /* @__PURE__ */ function(e) {
161
- return (o) => (e.forEach((i, r) => {
162
- var c;
163
- o.constructorArguments[r] !== void 0 || (c = i, B.includes(c)) || (o.constructorArguments[r] = function(s) {
164
- return { isFromTypescriptParamType: !0, kind: p.singleInjection, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: s };
165
- }(i));
166
- }), o);
167
- }(t));
168
- }
169
- function G(n) {
170
- return (t) => {
171
- (function(e) {
172
- if (D(e, P) !== void 0) throw new u(d.injectionDecoratorConflict, `Cannot apply @injectable decorator multiple times at class "${e.name}"`);
173
- L(e, P, !0);
174
- })(t), q(t);
175
- };
176
- }
177
- function V(n) {
178
- return (t) => {
179
- t === void 0 && h(n, W, T, (e) => e + 1);
180
- };
181
- }
182
- function Y(n) {
183
- return (t) => {
184
- const e = t ?? { kind: w.unknown, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map() };
185
- if (e.kind === p.unmanaged) throw new u(d.injectionDecoratorConflict, "Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");
186
- return n(e);
187
- };
188
- }
189
- function N(n) {
190
- const t = Y(/* @__PURE__ */ function(e) {
191
- return (o) => {
192
- if (o.name !== void 0) throw new u(d.injectionDecoratorConflict, "Unexpected duplicated named decorator");
193
- return o.name = e, o;
194
- };
195
- }(n));
196
- return z(t, V);
197
- }
198
- var U;
199
- (function(n) {
200
- n[n.multipleInjection = 0] = "multipleInjection", n[n.singleInjection = 1] = "singleInjection";
201
- })(U || (U = {}));
202
- var Z = Object.getOwnPropertyDescriptor, J = (n, t, e, o) => {
203
- for (var i = o > 1 ? void 0 : o ? Z(t, e) : t, r = n.length - 1, c; r >= 0; r--)
204
- (c = n[r]) && (i = c(i) || i);
205
- return i;
206
- }, m = (n, t) => (e, o) => t(e, o, n);
207
- let b = class {
208
- constructor(n, t, e, o, i) {
209
- this.logger = n, this.cristalApp = t, this.authenticationManagerProvider = e, this.urlParser = o, this.referenceSerializer = i, this.logger.setModule(
1
+ import { name as g } from "@xwiki/cristal-navigation-tree-api";
2
+ import { injectable as f, inject as c, named as u } from "inversify";
3
+ var m = Object.getOwnPropertyDescriptor, w = (t, i, a, e) => {
4
+ for (var r = e > 1 ? void 0 : e ? m(i, a) : i, o = t.length - 1, l; o >= 0; o--)
5
+ (l = t[o]) && (r = l(r) || r);
6
+ return r;
7
+ }, s = (t, i) => (a, e) => i(a, e, t);
8
+ let h = class {
9
+ constructor(t, i, a, e, r) {
10
+ this.logger = t, this.cristalApp = i, this.authenticationManagerProvider = a, this.urlParser = e, this.referenceSerializer = r, this.logger.setModule(
210
11
  "navigation-tree-xwiki.components.XWikiNavigationTreeSource"
211
12
  );
212
13
  }
213
14
  // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
214
15
  // eslint-disable-next-line max-statements
215
- async getChildNodes(n) {
216
- const t = n || "#", e = [];
16
+ async getChildNodes(t) {
17
+ const i = t || "#", a = [];
217
18
  try {
218
- const o = await this.authenticationManagerProvider.get()?.getAuthorizationHeader(), i = {
19
+ const e = await this.authenticationManagerProvider.get()?.getAuthorizationHeader(), r = {
219
20
  Accept: "application/json"
220
21
  };
221
- o && (i.Authorization = o), e.push(...await this.fetchNodes(t, i, 0));
222
- } catch (o) {
223
- this.logger.error(o), this.logger.debug("Could not load navigation tree.");
22
+ e && (r.Authorization = e), a.push(...await this.fetchNodes(i, r, 0));
23
+ } catch (e) {
24
+ this.logger.error(e), this.logger.debug("Could not load navigation tree.");
224
25
  }
225
- return e;
26
+ return a;
226
27
  }
227
- getParentNodesId(n, t = !0, e) {
228
- const o = e ? [""] : [];
229
- if (n.space) {
230
- let i = "";
231
- for (const r of n.space.names)
232
- i += r, o.push(`document:xwiki:${i}.WebHome`), i += ".";
233
- n.name != "WebHome" && t && o.push(
234
- `document:xwiki:${this.referenceSerializer.serialize(n)}`
28
+ getParentNodesId(t, i = !0, a) {
29
+ const e = a ? [""] : [];
30
+ if (t.space) {
31
+ let r = "";
32
+ for (const o of t.space.names)
33
+ r += o, e.push(`document:xwiki:${r}.WebHome`), r += ".";
34
+ t.name != "WebHome" && i && e.push(
35
+ `document:xwiki:${this.referenceSerializer.serialize(t)}`
235
36
  );
236
37
  }
237
- return o;
38
+ return e;
238
39
  }
239
40
  // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.
240
41
  // eslint-disable-next-line max-statements
241
- async fetchNodes(n, t, e) {
242
- const o = [], i = this.cristalApp.getWikiConfig().baseURL.replace(/\/[^/]*$/, ""), r = new URL(
42
+ async fetchNodes(t, i, a) {
43
+ const e = [], r = this.cristalApp.getWikiConfig().baseURL.replace(/\/[^/]*$/, ""), o = new URL(
243
44
  `${this.cristalApp.getWikiConfig().baseURL}/bin/get`
244
45
  );
245
- r.search = new URLSearchParams([
246
- ["id", n],
46
+ o.search = new URLSearchParams([
47
+ ["id", t],
247
48
  ["outputSyntax", "plain"],
248
49
  ["sheet", "XWiki.DocumentTree"],
249
50
  ["data", "children"],
250
51
  ["compact", "true"],
251
- ["offset", e.toString()],
52
+ ["offset", a.toString()],
252
53
  ["showTranslations", "false"],
253
54
  ["showAttachments", "false"]
254
55
  ]).toString();
255
- const s = await (await fetch(r, { headers: t })).json();
256
- for (const a of s)
257
- if (a.id == "pagination:wiki:xwiki")
258
- o.push(
259
- ...await this.fetchNodes(n, t, a.data.offset)
56
+ const d = await (await fetch(o, { headers: i })).json();
57
+ for (const n of d)
58
+ if (n.id == "pagination:wiki:xwiki")
59
+ e.push(
60
+ ...await this.fetchNodes(t, i, n.data.offset)
260
61
  );
261
- else if (!["attachments", "translations"].includes(a.data.type) && a.a_attr) {
262
- const l = this.urlParser.parse(
263
- `${i}${a.a_attr.href}`
62
+ else if (!["attachments", "translations"].includes(n.data.type) && n.a_attr) {
63
+ const p = this.urlParser.parse(
64
+ `${r}${n.a_attr.href}`
264
65
  );
265
- o.push({
266
- id: a.id,
267
- label: a.text,
268
- location: l.space,
66
+ e.push({
67
+ id: n.id,
68
+ label: n.text,
69
+ location: p.space,
269
70
  url: this.cristalApp.getRouter().resolve({
270
71
  name: "view",
271
72
  params: {
272
- page: this.referenceSerializer.serialize(l)
73
+ page: this.referenceSerializer.serialize(p)
273
74
  }
274
75
  }).href,
275
- has_children: a.children,
276
- is_terminal: !a.id.endsWith(".WebHome")
76
+ has_children: n.children,
77
+ is_terminal: !n.id.endsWith(".WebHome")
277
78
  });
278
79
  }
279
- return o;
80
+ return e;
280
81
  }
281
82
  };
282
- b = J([
283
- G(),
284
- m(0, v("Logger")),
285
- m(1, v("CristalApp")),
286
- m(2, v("AuthenticationManagerProvider")),
287
- m(3, v("RemoteURLParser")),
288
- m(3, N("XWiki")),
289
- m(4, v("ModelReferenceSerializer")),
290
- m(4, N("XWiki"))
291
- ], b);
292
- class nn {
293
- constructor(t) {
294
- t.bind(_).to(b).inSingletonScope().whenNamed("XWiki");
83
+ h = w([
84
+ f(),
85
+ s(0, c("Logger")),
86
+ s(1, c("CristalApp")),
87
+ s(2, c("AuthenticationManagerProvider")),
88
+ s(3, c("RemoteURLParser")),
89
+ s(3, u("XWiki")),
90
+ s(4, c("ModelReferenceSerializer")),
91
+ s(4, u("XWiki"))
92
+ ], h);
93
+ class W {
94
+ constructor(i) {
95
+ i.bind(g).to(h).inSingletonScope().whenNamed("XWiki");
295
96
  }
296
97
  }
297
98
  export {
298
- nn as ComponentInit
99
+ W as ComponentInit
299
100
  };
300
101
  //# sourceMappingURL=index.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.3.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/esm/index.js","../../../../node_modules/.pnpm/@inversifyjs+core@6.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/esm/index.js","../src/components/componentsInit.ts"],"sourcesContent":["function t(t){return n=>(n.push(...t),n)}function n(t){return n=>(n.push(t),n)}function e(t,n){return e=>(e[n]=t,e)}function u(){return[]}function f(){return new Map}function c(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function a(t,n,e){return Reflect.getMetadata(n,t,e)}function r(t,n,e,u){Reflect.defineMetadata(n,e,t,u)}function i(t,n,e,u,f){const a=u(c(t,n,f)??e());Reflect.defineMetadata(n,a,t,f)}function o(t,n,e,u,f){const c=u(a(t,n,f)??e());Reflect.defineMetadata(n,c,t,f)}export{t as buildArrayMetadataWithArray,n as buildArrayMetadataWithElement,e as buildArrayMetadataWithIndex,u as buildEmptyArrayMetadata,f as buildEmptyMapMetadata,c as getOwnReflectMetadata,a as getReflectMetadata,r as setReflectMetadata,i as updateOwnReflectMetadata,o as updateReflectMetadata};\n//# sourceMappingURL=index.js.map\n","import{getOwnReflectMetadata as e,setReflectMetadata as t,updateOwnReflectMetadata as n}from\"@inversifyjs/reflect-metadata-utils\";import{getBaseType as i}from\"@inversifyjs/prototype-utils\";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as s}from\"@inversifyjs/common\";const a=\"@inversifyjs/container/bindingId\";function c(){const i=e(Object,a)??0;return i===Number.MAX_SAFE_INTEGER?t(Object,a,Number.MIN_SAFE_INTEGER):n(Object,a,()=>i,e=>e+1),i}const d={Request:\"Request\",Singleton:\"Singleton\",Transient:\"Transient\"},u={ConstantValue:\"ConstantValue\",DynamicValue:\"DynamicValue\",Factory:\"Factory\",Instance:\"Instance\",Provider:\"Provider\",ResolvedValue:\"ResolvedValue\",ServiceRedirection:\"ServiceRedirection\"};function*l(...e){for(const t of e)yield*t}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=this.#r(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error(\"Expecting model relation, none found\");for(const o of i)o[e]===t&&this.#d(n,o);this.#e.delete(n)}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#u(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting model to be cloned, none found\");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting relation to be cloned, none found\");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#u(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#u(o,n),e)}}#d(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n])}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var f,v,h;!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(f||(f={}));class g{#f;#v;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new g(e)}add(e,t){this.#f.add(e,t)}clone(){return new g(this.#v,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e)}}function m(e){return e.isRight?{isRight:!0,value:e.value}:e}function y(e){switch(e.type){case u.ConstantValue:case u.DynamicValue:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case u.Factory:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Instance:return function(e){return{cache:m(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Provider:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ResolvedValue:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id=\"id\",e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(v||(v={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}class I{#h;#v;constructor(e,t){this.#h=t??new M({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new I(e)}clone(){return new I(this.#v,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#v()?.get(e)}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#v();void 0!==n&&(yield*n.getChained(e))}getBoundServices(){const e=new Set(this.#h.getAllKeys(v.serviceId)),t=this.#v();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#h.get(v.id,e)??this.#v()?.getById(e)}getByModuleId(e){return this.#h.get(v.moduleId,e)??this.#v()?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(v.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(v.serviceId)}removeById(e){this.#h.removeByRelation(v.id,e)}removeAllByModuleId(e){this.#h.removeByRelation(v.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(v.serviceId,e)}set(e){const t={[v.id]:e.id,[v.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[v.moduleId]=e.moduleId),this.#h.add(e,t)}}!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(h||(h={}));class w{#g;#v;constructor(e,t){this.#g=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new w(e)}add(e,t){this.#g.add(e,t)}clone(){return new w(this.#v,this.#g.clone())}get(e){const t=[],n=this.#g.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#g.removeByRelation(h.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(h.serviceId,e)}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if(\"number\"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const S=\"@inversifyjs/core/classMetadataReflectKey\";function C(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N=\"@inversifyjs/core/pendingClassMetadataCountReflectKey\";const T=Symbol.for(\"@inversifyjs/core/InversifyCoreError\");class j extends Error{[T];kind;constructor(e,t,n){super(t,n),this[T]=!0,this.kind=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[T]}static isErrorOfKind(e,t){return j.is(e)&&e.kind===t}}var P,A,R;function x(t){const n=e(t,S)??C();if(!function(t){const n=e(t,N);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\". \"${e.name}\" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\" at constructor indexes \"${n.join('\", \"')}\".\\n\\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==A.unknown||n.push(` - Missing or incomplete metadata for type \"${e.name}\" at constructor argument with index ${i.toString()}.\\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===A.unknown&&n.push(` - Missing or incomplete metadata for type \"${e.name}\" at property \"${i.toString()}\".\\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new j(P.unknown,`Unexpected class metadata for type \"${e.name}\" with uncompletion traces.\\nThis might be caused by one of the following reasons:\\n\\n1. A third party library is targeting inversify reflection metadata.\\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new j(P.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\\n\\n${n.join(\"\\n\\n\")}`)}(t,n)}function B(){return 0}function $(e){return t=>{void 0!==t&&t.kind===A.unknown&&n(e,N,B,e=>e-1)}}function D(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\");return t(i,...n)}}function k(e){if(e.kind!==A.unknown&&!0!==e.isFromTypescriptParamType)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\")}!function(e){e[e.injectionDecoratorConflict=0]=\"injectionDecoratorConflict\",e[e.missingInjectionDecorator=1]=\"missingInjectionDecorator\",e[e.planning=2]=\"planning\",e[e.resolution=3]=\"resolution\",e[e.unknown=4]=\"unknown\"}(P||(P={})),function(e){e[e.unknown=32]=\"unknown\"}(A||(A={})),function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\",e[e.unmanaged=2]=\"unmanaged\"}(R||(R={}));const F=D(function(e,t,n){return e===R.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return k(e),t===R.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function V(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var O;function E(e,t,n,i){if(j.isErrorOfKind(i,P.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new j(P.unknown,\"Unexpected undefined property and index values\");return{kind:O.property,property:t,targetClass:e.constructor}}return\"number\"==typeof n?{index:n,kind:O.parameter,targetClass:e}:{kind:O.method,method:t,targetClass:e}}(e,t,n);throw new j(P.injectionDecoratorConflict,`Unexpected injection error.\\n\\nCause:\\n\\n${i.message}\\n\\nDetails\\n\\n${function(e){switch(e.kind){case O.method:return`[class: \"${e.targetClass.name}\", method: \"${e.method.toString()}\"]`;case O.parameter:return`[class: \"${e.targetClass.name}\", index: \"${e.index.toString()}\"]`;case O.property:return`[class: \"${e.targetClass.name}\", property: \"${e.property.toString()}\"]`}}(o)}`,{cause:i})}throw i}function _(e,t){return(i,o,r)=>{try{void 0===r?function(e,t){const i=U(e,t);return(e,t)=>{n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o):\"number\"==typeof r?function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e,t){return\"function\"==typeof e&&void 0===t}(e,t))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\\nFound @inject decorator at method \"${t?.toString()??\"\"}\" at class \"${e.constructor.name}\"`);n(e,S,C,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,t)(i,o,r):function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\\nFound @inject decorator at method \"${t.toString()}\" at class \"${e.constructor.name}\"`);n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o,r)}catch(e){E(i,o,r,e)}}}function U(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function z(e){return _(F(R.singleInjection,e),$)}!function(e){e[e.method=0]=\"method\",e[e.parameter=1]=\"parameter\",e[e.property=2]=\"property\"}(O||(O={}));const K=\"@inversifyjs/core/classIsInjectableFlagReflectKey\";const L=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const i=e(t,\"design:paramtypes\");void 0!==i&&n(t,S,C,function(e){return t=>(e.forEach((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,L.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:R.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(i))}function G(i){return o=>{!function(n){if(void 0!==e(n,K))throw new j(P.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class \"${n.name}\"`);t(n,K,!0)}(o),q(o),void 0!==i&&n(o,S,C,e=>({...e,scope:i}))}}function W(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{i[t]=e})):i=n.constructorArguments,i}function X(e,t,n){let i;return i=e.extendProperties??!0?new Map(l(t.properties,n.properties)):n.properties,i}function H(e){return t=>{const i=x(e.type);n(t,S,C,function(e,t){const n=n=>({constructorArguments:W(e,t,n),lifecycle:n.lifecycle,properties:X(e,t,n),scope:n.scope});return n}(e,i))}}function J(e){return t=>{const n=i(t);if(void 0===n)throw new j(P.injectionDecoratorConflict,`Expected base type for type \"${t.name}\", none found.`);H({...e,type:n})(t)}}function Q(e,t){return _(F(R.multipleInjection,e,t),$)}function Y(e){return t=>{void 0===t&&n(e,N,B,e=>e+1)}}function Z(e){return t=>{const n=t??{kind:A.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return e(n)}}function ee(e){const t=Z(function(e){return t=>{if(void 0!==t.name)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated named decorator\");return t.name=e,t}}(e));return _(t,Y)}function te(e){if(e.optional)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated optional decorator\");return e.optional=!0,e}function ne(){return _(Z(te),Y)}function ie(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated postConstruct decorator\");return e.lifecycle.postConstructMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function oe(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated preDestroy decorator\");return e.lifecycle.preDestroyMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function re(e,t){const n=Z(function(e,t){return n=>{if(n.tags.has(e))throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated tag decorator with existing tag\");return n.tags.set(e,t),n}}(e,t));return _(n,Y)}function se(){return{kind:R.unmanaged}}const ae=D(se,function(e){if(k(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return se()});function ce(){return _(ae(),$)}var de;!function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\"}(de||(de={}));class ue{#m;constructor(e){this.#m=e}get name(){return this.#m.elem.name}get serviceIdentifier(){return this.#m.elem.serviceIdentifier}get tags(){return this.#m.elem.tags}getAncestor(){if(this.#m.elem.getAncestorsCalled=!0,void 0!==this.#m.previous)return new ue(this.#m.previous)}}function le(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===o.length&&void 0!==e.autobindOptions&&\"function\"==typeof i){const t=function(e,t){const n=x(t),i=n.scope??e.scope;return{cache:{isRight:!1,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:u.Instance}}(e.autobindOptions,i);e.operations.setBinding(t),o.push(t)}return o}class pe{last;constructor(e){this.last=e}concat(e){return new pe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function fe(e){return void 0!==e.redirections}function ve(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=s[s.length-1]??n,a=`Ambiguous bindings found for service: \"${o(t)}\".${ye(s)}\\n\\nRegistered bindings:\\n\\n${e.map(e=>function(e){switch(e.type){case u.Instance:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\", implementationType: \"${e.implementationType.name}\" ]`;case u.ServiceRedirection:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", redirection: \"${o(e.targetServiceIdentifier)}\" ]`;default:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\" ]`}}(e.binding)).join(\"\\n\")}\\n\\nTrying to resolve bindings for \"${ge(n,i)}\".${me(r)}`;throw new j(P.planning,a)}t||he(n,i,r,s)}(e,t,r,s,n.elem,i):function(e,t,n,i,o,r){void 0!==e||t||he(n,i,o,r)}(e,t,r,s,n.elem,i)}function he(e,t,n,i){const r=i[i.length-1]??e,s=`No bindings found for service: \"${o(r)}\".\\n\\nTrying to resolve bindings for \"${ge(e,t)}\".${ye(i)}${me(n)}`;throw new j(P.planning,s)}function ge(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function me(e){const t=0===e.tags.size?\"\":`\\n- tags:\\n - ${[...e.tags.keys()].map(e=>e.toString()).join(\"\\n - \")}`;return`\\n\\nBinding constraints:\\n- service identifier: ${o(e.serviceIdentifier)}\\n- name: ${e.name?.toString()??\"-\"}${t}`}function ye(e){return 0===e.length?\"\":`\\n\\n- service redirections:\\n - ${e.map(e=>o(e)).join(\"\\n - \")}`}function Me(e,t,n,i){if(1===e.redirections.length){const[o]=e.redirections;return void(fe(o)&&Me(o,t,n,[...i,o.binding.targetServiceIdentifier]))}ve(e.redirections,t,n,i)}function Ie(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(fe(i)&&Me(i,t,n,[i.binding.targetServiceIdentifier]))}ve(e.bindings,t,n,[])}function we(e){return r.is(e)?e.unwrap():e}function be(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||\"InternalError\"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return\"(No dependency trace)\";return t.map(o).join(\" -> \")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new j(P.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}const Se=Symbol.for(\"@inversifyjs/core/LazyPlanServiceNode\");class Ce{[Se];_serviceIdentifier;_serviceNode;constructor(e){this[Se]=!0,this._serviceIdentifier=e.serviceIdentifier,this._serviceNode=e}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[Se]}invalidate(){this._serviceNode=void 0}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}function Ne(e,t,n){if(void 0!==e&&n.isContextFree){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n)}class Te extends Ce{#y;constructor(e,t){super(t),this.#y=e}_buildPlanServiceNode(){return Ae(this.#y)}}class je extends Ce{#y;#M;#I;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#I=n}_buildPlanServiceNode(){return Be(this.#y,this.#M,this.#I)}}class Pe extends Ce{#y;#M;#w;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#w=n}_buildPlanServiceNode(){return $e(this.#y,this.#M,this.#w)}}function Ae(e){const t=function(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new pe({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}(e),n=new ue(t.last),i=!!e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=le(e,n,{chained:i}),r=[],s={bindings:r,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ke(e,t,o,s,i)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){Ie(s,e.rootConstraints.isOptional??!1,t.last);const[n]=r;s.bindings=n}return s}function Re(e){try{const t=function(e){return e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}}(e),n=e.operations.getPlan(t);if(void 0!==n)return n;const i=Ae(e),o={tree:{root:new Te(e,i)}};return e.operations.setPlan(t,o),o}catch(t){be(e,t)}}function xe(e,t,n){const i={binding:t,classMetadata:e.operations.getClassMetadata(t.implementationType),constructorParams:[],propertyParams:new Map};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function Be(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===R.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===R.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function $e(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===de.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===de.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function De(e,t,n){const i={binding:t,params:[]};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function ke(e,t,n,i,o){const r=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(r);const s=[];for(const i of n)switch(i.type){case u.Instance:s.push(xe(e,i,t));break;case u.ResolvedValue:s.push(De(e,i,t));break;case u.ServiceRedirection:{const n=Fe(e,t,i,o);s.push(n);break}default:s.push({binding:i})}return e.servicesBranch.pop(),s}function Fe(e,t,n,i){const o={binding:n,redirections:[]},r=le(e,new ue(t.last),{chained:i,customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...ke(e,t,r,o,i)),o}function Ve(e,t,n){if(n.kind===R.unmanaged)return;const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===R.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=Be(e,t,n),s=new je(e,t,n,o);return Ne(i,e.operations,s),s}function Oe(e,t,n){const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===de.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=$e(e,t,n),s=new Pe(e,t,n,o);return Ne(i,e.operations,s),s}function Ee(e,t){return e.node.binding.type===u.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Ve(e,n,r);for(const[o,r]of i.properties){const i=Ve(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Oe(e,n,r);return e.node}(e,e.node,t)}class _e{#b;#S;#C;constructor(){this.#b=[],this.#S=8,this.#C=1024}*[Symbol.iterator](){let e=0;for(const t of this.#b){const n=t.deref();void 0===n?++e:yield n}this.#b.length>=this.#S&&this.#N(e)&&this.#T(e)}push(e){const t=new WeakRef(e);if(this.#b.push(t),this.#b.length>=this.#S&&this.#b.length%this.#C===0){let e=0;for(const t of this.#b)void 0===t.deref()&&++e;this.#N(e)&&this.#T(e)}}#T(e){const t=new Array(this.#b.length-e);let n=0;for(const e of this.#b)e.deref()&&(t[n++]=e);this.#b=t}#N(e){return e>=.5*this.#b.length}}class Ue{#j;#P;#A;#R;#x;#B;constructor(){this.#j=new Map,this.#P=this.#$(),this.#A=this.#$(),this.#R=this.#$(),this.#x=this.#$(),this.#B=new _e}clearCache(){for(const e of this.#D())e.clear();for(const e of this.#B)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#k(this.#P,e).get(e.serviceIdentifier):this.#k(this.#x,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#k(this.#A,e).get(e.serviceIdentifier)?.get(e.name):this.#k(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateService(e){this.#F(e),this.#V(e),this.#O(e),this.#E(e),this.#_(e);for(const t of this.#B)t.invalidateService(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#k(this.#P,e).set(e.serviceIdentifier,t):this.#U(this.#U(this.#k(this.#x,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#U(this.#k(this.#A,e),e.serviceIdentifier).set(e.name,t):this.#U(this.#U(this.#U(this.#k(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e){let t=this.#j.get(e.serviceIdentifier);void 0===t&&(t=new Set,this.#j.set(e.serviceIdentifier,t)),t.add(e)}subscribe(e){this.#B.push(e)}#$(){const e=new Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#U(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#k(e,t){return e[this.#z(t)]}#D(){return[this.#j,...this.#P,...this.#A,...this.#R,...this.#x]}#z(e){return e.isMultiple?(e.chained?4:0)|(e.optional?1:0)|2:e.optional?1:0}#V(e){for(const t of this.#A){const n=t.get(e);if(void 0!==n)for(const e of n.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#O(e){for(const t of this.#R){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())for(const e of t.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#L(e){switch(e.binding.type){case u.ServiceRedirection:for(const t of e.redirections)this.#L(t);break;case u.Instance:for(const t of e.constructorParams)void 0!==t&&this.#q(t);for(const t of e.propertyParams.values())this.#q(t);break;case u.ResolvedValue:for(const t of e.params)this.#q(t)}}#q(e){const t=this.#j.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#K(e))}#K(e){if(void 0!==e.bindings)if(Array.isArray(e.bindings))for(const t of e.bindings)this.#L(t);else this.#L(e.bindings)}#_(e){const t=this.#j.get(e);if(void 0!==t)for(const e of t)Ce.is(e)&&(this.#K(e),e.invalidate())}#F(e){for(const t of this.#P){const n=t.get(e);void 0!==n&&Ce.is(n.tree.root)&&(this.#K(n.tree.root),n.tree.root.invalidate())}}#E(e){for(const t of this.#x){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())Ce.is(t.tree.root)&&(this.#K(t.tree.root),t.tree.root.invalidate())}}}function ze(e,t){return s(t)?(e.cache={isRight:!0,value:t},t.then(t=>Ke(e,t))):Ke(e,t)}function Ke(e,t){return e.cache={isRight:!0,value:t},t}function Le(e,t,n){const i=e.getActivations(t);return void 0===i?n:s(n)?qe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(s(t))return qe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function qe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ge(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=s(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return Le(e,t.serviceIdentifier,i)}function We(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return ze(n,Ge(t,n,e(t,n)))}}const Xe=We(function(e,t){return t.value});function He(e){return e}function Je(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case d.Singleton:if(o.cache.isRight)return o.cache.value;return ze(o,Ge(n,o,t(n,i)));case d.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ge(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case d.Transient:return Ge(n,o,t(n,i))}}}const Qe=(e=>Je(He,e))(function(e,t){return t.value(e.context)});const Ye=We(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new j(P.resolution,`Expecting a \"${n.toString()}\" property when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, none found.`);if(\"function\"!=typeof e[n])throw new j(P.resolution,`Expecting a \"${n.toString()}\" method when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new j(P.resolution,`Unexpected error found when calling \"${n.toString()}\" @postConstruct decorated method on class \"${t.implementationType.name}\"`,{cause:e})}if(s(i))return async function(e,t,n){try{await n}catch(n){throw new j(P.resolution,`Unexpected error found when calling \"${t.toString()}\" @postConstruct decorated method on class \"${e.implementationType.name}\"`,{cause:n})}}(t,n,i)}}(e,t,n);return s(i)?i.then(()=>e):e}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return s(r)?r.then(()=>Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const tt=We(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const ot=function(e){return(t,n,i)=>{const o=[];for(const[r,a]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new j(P.resolution,`Expecting metadata at property \"${r.toString()}\", none found`);c.kind!==R.unmanaged&&void 0!==a.bindings&&(n[r]=e(t,a),s(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(pt),rt=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(lt),st=function(e,t,n){return(i,o)=>{const r=e(i,o);return s(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(et(ot)),et(ot)),at=function(e){return(t,n)=>{const i=e(t,n);return s(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt)),ct=(e=>Je(nt,e))(st),dt=(e=>Je(it,e))(at);function ut(e){return pt(e,e.planResult.tree.root)}function lt(e,t){switch(t.binding.type){case u.ConstantValue:return Xe(e,t.binding);case u.DynamicValue:return Qe(e,t.binding);case u.Factory:return Ye(e,t.binding);case u.Instance:return ct(e,t);case u.Provider:return tt(e,t.binding);case u.ResolvedValue:return dt(e,t)}}function pt(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)fe(i)?n.push(...rt(e,i)):n.push(lt(e,i));if(n.some(s))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(fe(t)){const n=rt(e,t);if(1===n.length)return n[0];throw new j(P.resolution,\"Unexpected multiple resolved values on single injection\")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function vt(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&\"function\"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function ht(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return s(n)?gt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(s(i))return gt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function gt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===u.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return s(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?yt(e,t):n.then(()=>yt(e,t))}function yt(e,t){const n=t.cache;return s(n.value)?n.value.then(n=>Mt(e,t,n)):Mt(e,t,n.value)}function Mt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?ht(e,t.serviceIdentifier,n):i.then(()=>ht(e,t.serviceIdentifier,n))}function It(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===d.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=mt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function wt(e,t){const n=e.getBindingsFromModule(t);return It(e,n)}function bt(e,t){const n=e.getBindings(t);return It(e,n)}export{g as ActivationsService,I as BindingService,R as ClassElementMetadataKind,w as DeactivationsService,Ue as PlanResultCacheService,de as ResolvedValueElementMetadataKind,d as bindingScopeValues,u as bindingTypeValues,b as decorate,c as getBindingId,x as getClassMetadata,z as inject,J as injectFromBase,G as injectable,Q as multiInject,ee as named,ne as optional,Re as plan,ie as postConstruct,oe as preDestroy,ut as resolve,It as resolveBindingsDeactivations,wt as resolveModuleDeactivations,bt as resolveServiceDeactivations,re as tagged,ce as unmanaged};\n//# sourceMappingURL=index.js.map\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { Container, inject, injectable, named } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/cristal-authentication-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type { ModelReferenceSerializer } from \"@xwiki/cristal-model-reference-api\";\nimport type { RemoteURLParser } from \"@xwiki/cristal-model-remote-url-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the XWiki backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass XWikiNavigationTreeSource implements NavigationTreeSource {\n constructor(\n @inject(\"Logger\") private readonly logger: Logger,\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"RemoteURLParser\")\n @named(\"XWiki\")\n private readonly urlParser: RemoteURLParser,\n @inject(\"ModelReferenceSerializer\")\n @named(\"XWiki\")\n private readonly referenceSerializer: ModelReferenceSerializer,\n ) {\n this.logger.setModule(\n \"navigation-tree-xwiki.components.XWikiNavigationTreeSource\",\n );\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"#\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n try {\n const authorization = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: { Accept: string; Authorization?: string } = {\n Accept: \"application/json\",\n };\n\n if (authorization) {\n headers.Authorization = authorization;\n }\n\n navigationTree.push(...(await this.fetchNodes(currentId, headers, 0)));\n } catch (error) {\n this.logger.error(error);\n this.logger.debug(\"Could not load navigation tree.\");\n }\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n includeTerminal: boolean = true,\n includeRootNode?: boolean,\n ): Array<string> {\n const result = includeRootNode ? [\"\"] : [];\n if (page.space) {\n let currentParent = \"\";\n for (const parent of page.space!.names) {\n currentParent += parent;\n // TODO: Support subwikis.\n result.push(`document:xwiki:${currentParent}.WebHome`);\n currentParent += \".\";\n }\n if (page.name != \"WebHome\" && includeTerminal) {\n result.push(\n `document:xwiki:${this.referenceSerializer.serialize(page)}`,\n );\n }\n }\n return result;\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n private async fetchNodes(\n currentId: string,\n headers: { Accept: string; Authorization?: string },\n offset: number,\n ): Promise<Array<NavigationTreeNode>> {\n const nodes: Array<NavigationTreeNode> = [];\n const baseXWikiURL = this.cristalApp\n .getWikiConfig()\n .baseURL.replace(/\\/[^/]*$/, \"\");\n\n const navigationTreeRequestUrl = new URL(\n `${this.cristalApp.getWikiConfig().baseURL}/bin/get`,\n );\n navigationTreeRequestUrl.search = new URLSearchParams([\n [\"id\", currentId],\n [\"outputSyntax\", \"plain\"],\n [\"sheet\", \"XWiki.DocumentTree\"],\n [\"data\", \"children\"],\n [\"compact\", \"true\"],\n [\"offset\", offset.toString()],\n [\"showTranslations\", \"false\"],\n [\"showAttachments\", \"false\"],\n ]).toString();\n\n const response = await fetch(navigationTreeRequestUrl, { headers });\n const jsonResponse: [\n {\n id: string;\n text: string;\n children: boolean;\n data: { type: string; offset: number };\n a_attr?: { href: string };\n },\n ] = await response.json();\n for (const treeNode of jsonResponse) {\n if (treeNode.id == \"pagination:wiki:xwiki\") {\n nodes.push(\n ...(await this.fetchNodes(currentId, headers, treeNode.data.offset)),\n );\n } else if (\n ![\"attachments\", \"translations\"].includes(treeNode.data.type) &&\n treeNode.a_attr\n ) {\n const documentReference = this.urlParser.parse(\n `${baseXWikiURL}${treeNode.a_attr.href}`,\n )! as DocumentReference;\n nodes.push({\n id: treeNode.id,\n label: treeNode.text,\n location: documentReference.space!,\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: this.referenceSerializer.serialize(documentReference),\n },\n }).href,\n has_children: treeNode.children,\n is_terminal: !treeNode.id.endsWith(\".WebHome\"),\n });\n }\n }\n\n return nodes;\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(XWikiNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"XWiki\");\n }\n}\n"],"names":["c","t","n","r","u","i","f","a","v","h","e","S","C","N","T","j","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","Y","Z","ee","de","XWikiNavigationTreeSource","logger","cristalApp","authenticationManagerProvider","urlParser","referenceSerializer","id","currentId","navigationTree","authorization","headers","error","page","includeTerminal","includeRootNode","result","currentParent","parent","offset","nodes","baseXWikiURL","navigationTreeRequestUrl","jsonResponse","treeNode","documentReference","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":";AAAsK,SAASA,EAAEC,GAAEC,GAAE,GAAE;AAAC,SAAO,QAAQ,eAAeA,GAAED,GAAE,CAAC;AAAC;AAAqD,SAASE,EAAEF,GAAEC,GAAE,GAAEE,GAAE;AAAC,UAAQ,eAAeF,GAAE,GAAED,GAAEG,CAAC;AAAC;AAAC,SAASC,EAAEJ,GAAEC,GAAE,GAAEE,GAAEE,GAAE;AAAC,QAAMC,IAAEH,EAAEJ,EAAEC,GAAEC,GAAEI,CAAC,KAAG,EAAC,CAAE;AAAE,UAAQ,eAAeJ,GAAEK,GAAEN,GAAEK,CAAC;AAAC;ACA2nE,IAAIA,GAAEE,GAAEC;AAAA,CAAG,SAASC,GAAE;AAAC,EAAAA,EAAE,WAAS,YAAWA,EAAE,YAAU;AAAW,GAAEJ,MAAIA,IAAE,CAAA,EAAG;AAAA,CAA4oE,SAASI,GAAE;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AAiB;AAAA,YAAA;AAAA,UAC5D,CACD,EAAE;AAAA,UACH,cAAcD,EAAS;AAAA,UACvB,aAAa,CAACA,EAAS,GAAG,SAAS,UAAU;AAAA,QAAA,CAC9C;AAAA,MACH;AAGF,WAAOJ;AAAA,EACT;AACF;AArIMnB,IAANyB,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAO,+BAA+B,CAAA;AAAA,EAEtCA,OAAO,iBAAiB,CAAA;AAAA,EACxBA,OAAM,OAAO,CAAA;AAAA,EAEbA,OAAO,0BAA0B,CAAA;AAAA,EACjCA,OAAM,OAAO,CAAA;AAAA,GAVZ3B,CAAA;AAuIC,MAAM4B,GAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA2BC,CAAwB,EACnD,GAAG9B,CAAyB,EAC5B,iBAAA,EACA,UAAU,OAAO;AAAA,EACtB;AACF;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.es.js","sources":["../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { Container, inject, injectable, named } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/cristal-authentication-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type { ModelReferenceSerializer } from \"@xwiki/cristal-model-reference-api\";\nimport type { RemoteURLParser } from \"@xwiki/cristal-model-remote-url-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the XWiki backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass XWikiNavigationTreeSource implements NavigationTreeSource {\n constructor(\n @inject(\"Logger\") private readonly logger: Logger,\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"RemoteURLParser\")\n @named(\"XWiki\")\n private readonly urlParser: RemoteURLParser,\n @inject(\"ModelReferenceSerializer\")\n @named(\"XWiki\")\n private readonly referenceSerializer: ModelReferenceSerializer,\n ) {\n this.logger.setModule(\n \"navigation-tree-xwiki.components.XWikiNavigationTreeSource\",\n );\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"#\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n try {\n const authorization = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: { Accept: string; Authorization?: string } = {\n Accept: \"application/json\",\n };\n\n if (authorization) {\n headers.Authorization = authorization;\n }\n\n navigationTree.push(...(await this.fetchNodes(currentId, headers, 0)));\n } catch (error) {\n this.logger.error(error);\n this.logger.debug(\"Could not load navigation tree.\");\n }\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n includeTerminal: boolean = true,\n includeRootNode?: boolean,\n ): Array<string> {\n const result = includeRootNode ? [\"\"] : [];\n if (page.space) {\n let currentParent = \"\";\n for (const parent of page.space!.names) {\n currentParent += parent;\n // TODO: Support subwikis.\n result.push(`document:xwiki:${currentParent}.WebHome`);\n currentParent += \".\";\n }\n if (page.name != \"WebHome\" && includeTerminal) {\n result.push(\n `document:xwiki:${this.referenceSerializer.serialize(page)}`,\n );\n }\n }\n return result;\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n private async fetchNodes(\n currentId: string,\n headers: { Accept: string; Authorization?: string },\n offset: number,\n ): Promise<Array<NavigationTreeNode>> {\n const nodes: Array<NavigationTreeNode> = [];\n const baseXWikiURL = this.cristalApp\n .getWikiConfig()\n .baseURL.replace(/\\/[^/]*$/, \"\");\n\n const navigationTreeRequestUrl = new URL(\n `${this.cristalApp.getWikiConfig().baseURL}/bin/get`,\n );\n navigationTreeRequestUrl.search = new URLSearchParams([\n [\"id\", currentId],\n [\"outputSyntax\", \"plain\"],\n [\"sheet\", \"XWiki.DocumentTree\"],\n [\"data\", \"children\"],\n [\"compact\", \"true\"],\n [\"offset\", offset.toString()],\n [\"showTranslations\", \"false\"],\n [\"showAttachments\", \"false\"],\n ]).toString();\n\n const response = await fetch(navigationTreeRequestUrl, { headers });\n const jsonResponse: [\n {\n id: string;\n text: string;\n children: boolean;\n data: { type: string; offset: number };\n a_attr?: { href: string };\n },\n ] = await response.json();\n for (const treeNode of jsonResponse) {\n if (treeNode.id == \"pagination:wiki:xwiki\") {\n nodes.push(\n ...(await this.fetchNodes(currentId, headers, treeNode.data.offset)),\n );\n } else if (\n ![\"attachments\", \"translations\"].includes(treeNode.data.type) &&\n treeNode.a_attr\n ) {\n const documentReference = this.urlParser.parse(\n `${baseXWikiURL}${treeNode.a_attr.href}`,\n )! as DocumentReference;\n nodes.push({\n id: treeNode.id,\n label: treeNode.text,\n location: documentReference.space!,\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: this.referenceSerializer.serialize(documentReference),\n },\n }).href,\n has_children: treeNode.children,\n is_terminal: !treeNode.id.endsWith(\".WebHome\"),\n });\n }\n }\n\n return nodes;\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(XWikiNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"XWiki\");\n }\n}\n"],"names":["XWikiNavigationTreeSource","logger","cristalApp","authenticationManagerProvider","urlParser","referenceSerializer","id","currentId","navigationTree","authorization","headers","error","page","includeTerminal","includeRootNode","result","currentParent","parent","offset","nodes","baseXWikiURL","navigationTreeRequestUrl","jsonResponse","treeNode","documentReference","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":";;;;;;;AAsCA,IAAMA,IAAN,MAAgE;AAAA,EAC9D,YACqCC,GACIC,GAE/BC,GAGSC,GAGAC,GACjB;AAVmC,SAAA,SAAAJ,GACI,KAAA,aAAAC,GAE/B,KAAA,gCAAAC,GAGS,KAAA,YAAAC,GAGA,KAAA,sBAAAC,GAEjB,KAAK,OAAO;AAAA,MACV;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA,EAIA,MAAM,cAAcC,GAAiD;AACnE,UAAMC,IAAYD,KAAU,KACtBE,IAA4C,CAAA;AAElD,QAAI;AACF,YAAMC,IAAgB,MAAM,KAAK,8BAC9B,IAAA,GACC,uBAAA,GACEC,IAAsD;AAAA,QAC1D,QAAQ;AAAA,MAAA;AAGV,MAAID,MACFC,EAAQ,gBAAgBD,IAG1BD,EAAe,KAAK,GAAI,MAAM,KAAK,WAAWD,GAAWG,GAAS,CAAC,CAAE;AAAA,IACvE,SAASC,GAAO;AACd,WAAK,OAAO,MAAMA,CAAK,GACvB,KAAK,OAAO,MAAM,iCAAiC;AAAA,IACrD;AACA,WAAOH;AAAA,EACT;AAAA,EAEA,iBACEI,GACAC,IAA2B,IAC3BC,GACe;AACf,UAAMC,IAASD,IAAkB,CAAC,EAAE,IAAI,CAAA;AACxC,QAAIF,EAAK,OAAO;AACd,UAAII,IAAgB;AACpB,iBAAWC,K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,EAAM,KAAK;AAAA,UACT,IAAII,EAAS;AAAA,UACb,OAAOA,EAAS;AAAA,UAChB,UAAUC,EAAkB;AAAA,UAC5B,KAAK,KAAK,WAAW,UAAA,EAAY,QAAQ;AAAA,YACvC,MAAM;AAAA,YACN,QAAQ;AAAA,cACN,MAAM,KAAK,oBAAoB,UAAUA,CAAiB;AAAA,YAAA;AAAA,UAC5D,CACD,EAAE;AAAA,UACH,cAAcD,EAAS;AAAA,UACvB,aAAa,CAACA,EAAS,GAAG,SAAS,UAAU;AAAA,QAAA,CAC9C;AAAA,MACH;AAGF,WAAOJ;AAAA,EACT;AACF;AArIMnB,IAANyB,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,QAAQ,CAAA;AAAA,EACfA,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAO,+BAA+B,CAAA;AAAA,EAEtCA,OAAO,iBAAiB,CAAA;AAAA,EACxBA,OAAM,OAAO,CAAA;AAAA,EAEbA,OAAO,0BAA0B,CAAA;AAAA,EACjCA,OAAM,OAAO,CAAA;AAAA,GAVZ3B,CAAA;AAuIC,MAAM4B,EAAc;AAAA,EACzB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA2BC,CAAwB,EACnD,GAAG9B,CAAyB,EAC5B,iBAAA,EACA,UAAU,OAAO;AAAA,EACtB;AACF;"}
package/dist/index.umd.js CHANGED
@@ -1,12 +1,2 @@
1
- (function(m,v){typeof exports=="object"&&typeof module<"u"?v(exports,require("@xwiki/cristal-navigation-tree-api")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-navigation-tree-api"],v):(m=typeof globalThis<"u"?globalThis:m||self,v(m["cristal_navigation-tree-xwiki"]={},m.cristalNavigationTreeApi))})(this,function(m,v){"use strict";function x(n,e,t){return Reflect.getOwnMetadata(e,n,t)}function O(n,e,t,i){Reflect.defineMetadata(e,t,n,i)}function h(n,e,t,i,r){const o=i(x(n,e,r)??t());Reflect.defineMetadata(e,o,n,r)}var R,A,P;(function(n){n.moduleId="moduleId",n.serviceId="serviceId"})(R||(R={})),function(n){n.id="id",n.moduleId="moduleId",n.serviceId="serviceId"}(A||(A={})),function(n){n.moduleId="moduleId",n.serviceId="serviceId"}(P||(P={}));const y="@inversifyjs/core/classMetadataReflectKey";function I(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N="@inversifyjs/core/pendingClassMetadataCountReflectKey",S=Symbol.for("@inversifyjs/core/InversifyCoreError");class u extends Error{[S];kind;constructor(e,t,i){super(t,i),this[S]=!0,this.kind=e}static is(e){return typeof e=="object"&&e!==null&&e[S]===!0}static isErrorOfKind(e,t){return u.is(e)&&e.kind===t}}var d,w,f;function T(){return 0}function L(n){return e=>{e!==void 0&&e.kind===w.unknown&&h(n,N,T,t=>t-1)}}function X(n,e){return(...t)=>i=>{if(i===void 0)return n(...t);if(i.kind===f.unmanaged)throw new u(d.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return e(i,...t)}}function E(n){if(n.kind!==w.unknown&&n.isFromTypescriptParamType!==!0)throw new u(d.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(function(n){n[n.injectionDecoratorConflict=0]="injectionDecoratorConflict",n[n.missingInjectionDecorator=1]="missingInjectionDecorator",n[n.planning=2]="planning",n[n.resolution=3]="resolution",n[n.unknown=4]="unknown"})(d||(d={})),function(n){n[n.unknown=32]="unknown"}(w||(w={})),function(n){n[n.multipleInjection=0]="multipleInjection",n[n.singleInjection=1]="singleInjection",n[n.unmanaged=2]="unmanaged"}(f||(f={}));const K=X(function(n,e,t){return n===f.multipleInjection?{chained:t?.chained??!1,kind:n,name:void 0,optional:!1,tags:new Map,value:e}:{kind:n,name:void 0,optional:!1,tags:new Map,value:e}},function(n,e,t,i){return E(n),e===f.multipleInjection?{...n,chained:i?.chained??!1,kind:e,value:t}:{...n,kind:e,value:t}});function U(n,e){return t=>{const i=t.properties.get(e);return t.properties.set(e,n(i)),t}}var p;function H(n,e,t,i){if(u.isErrorOfKind(i,d.injectionDecoratorConflict)){const r=function(o,c,s){if(s===void 0){if(c===void 0)throw new u(d.unknown,"Unexpected undefined property and index values");return{kind:p.property,property:c,targetClass:o.constructor}}return typeof s=="number"?{index:s,kind:p.parameter,targetClass:o}:{kind:p.method,method:c,targetClass:o}}(n,e,t);throw new u(d.injectionDecoratorConflict,`Unexpected injection error.
2
-
3
- Cause:
4
-
5
- ${i.message}
6
-
7
- Details
8
-
9
- ${function(o){switch(o.kind){case p.method:return`[class: "${o.targetClass.name}", method: "${o.method.toString()}"]`;case p.parameter:return`[class: "${o.targetClass.name}", index: "${o.index.toString()}"]`;case p.property:return`[class: "${o.targetClass.name}", property: "${o.property.toString()}"]`}}(r)}`,{cause:i})}throw i}function W(n,e){return(t,i,r)=>{try{r===void 0?function(o,c){const s=$(o,c);return(a,l)=>{h(a.constructor,y,I,U(s(a),l))}}(n,e)(t,i):typeof r=="number"?function(o,c){const s=$(o,c);return(a,l,M)=>{if(!function(k,C){return typeof k=="function"&&C===void 0}(a,l))throw new u(d.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
10
- Found @inject decorator at method "${l?.toString()??""}" at class "${a.constructor.name}"`);h(a,y,I,function(k,C){return D=>{const nn=D.constructorArguments[C];return D.constructorArguments[C]=k(nn),D}}(s(a),M))}}(n,e)(t,i,r):function(o,c){const s=$(o,c);return(a,l,M)=>{if(!function(k){return k.set!==void 0}(M))throw new u(d.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
11
- Found @inject decorator at method "${l.toString()}" at class "${a.constructor.name}"`);h(a.constructor,y,I,U(s(a),l))}}(n,e)(t,i,r)}catch(o){H(t,i,r,o)}}}function $(n,e){return t=>{const i=e(t);return r=>(i(r),n(r))}}function j(n){return W(K(f.singleInjection,n),L)}(function(n){n[n.method=0]="method",n[n.parameter=1]="parameter",n[n.property=2]="property"})(p||(p={}));const _="@inversifyjs/core/classIsInjectableFlagReflectKey",q=[Array,BigInt,Boolean,Function,Number,Object,String];function B(n){const e=x(n,"design:paramtypes");e!==void 0&&h(n,y,I,function(t){return i=>(t.forEach((r,o)=>{var c;i.constructorArguments[o]!==void 0||(c=r,q.includes(c))||(i.constructorArguments[o]=function(s){return{isFromTypescriptParamType:!0,kind:f.singleInjection,name:void 0,optional:!1,tags:new Map,value:s}}(r))}),i)}(e))}function G(n){return e=>{(function(t){if(x(t,_)!==void 0)throw new u(d.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${t.name}"`);O(t,_,!0)})(e),B(e)}}function V(n){return e=>{e===void 0&&h(n,N,T,t=>t+1)}}function Y(n){return e=>{const t=e??{kind:w.unknown,name:void 0,optional:!1,tags:new Map};if(t.kind===f.unmanaged)throw new u(d.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return n(t)}}function z(n){const e=Y(function(t){return i=>{if(i.name!==void 0)throw new u(d.injectionDecoratorConflict,"Unexpected duplicated named decorator");return i.name=t,i}}(n));return W(e,V)}var F;(function(n){n[n.multipleInjection=0]="multipleInjection",n[n.singleInjection=1]="singleInjection"})(F||(F={}));var Z=Object.getOwnPropertyDescriptor,J=(n,e,t,i)=>{for(var r=i>1?void 0:i?Z(e,t):e,o=n.length-1,c;o>=0;o--)(c=n[o])&&(r=c(r)||r);return r},g=(n,e)=>(t,i)=>e(t,i,n);let b=class{constructor(n,e,t,i,r){this.logger=n,this.cristalApp=e,this.authenticationManagerProvider=t,this.urlParser=i,this.referenceSerializer=r,this.logger.setModule("navigation-tree-xwiki.components.XWikiNavigationTreeSource")}async getChildNodes(n){const e=n||"#",t=[];try{const i=await this.authenticationManagerProvider.get()?.getAuthorizationHeader(),r={Accept:"application/json"};i&&(r.Authorization=i),t.push(...await this.fetchNodes(e,r,0))}catch(i){this.logger.error(i),this.logger.debug("Could not load navigation tree.")}return t}getParentNodesId(n,e=!0,t){const i=t?[""]:[];if(n.space){let r="";for(const o of n.space.names)r+=o,i.push(`document:xwiki:${r}.WebHome`),r+=".";n.name!="WebHome"&&e&&i.push(`document:xwiki:${this.referenceSerializer.serialize(n)}`)}return i}async fetchNodes(n,e,t){const i=[],r=this.cristalApp.getWikiConfig().baseURL.replace(/\/[^/]*$/,""),o=new URL(`${this.cristalApp.getWikiConfig().baseURL}/bin/get`);o.search=new URLSearchParams([["id",n],["outputSyntax","plain"],["sheet","XWiki.DocumentTree"],["data","children"],["compact","true"],["offset",t.toString()],["showTranslations","false"],["showAttachments","false"]]).toString();const s=await(await fetch(o,{headers:e})).json();for(const a of s)if(a.id=="pagination:wiki:xwiki")i.push(...await this.fetchNodes(n,e,a.data.offset));else if(!["attachments","translations"].includes(a.data.type)&&a.a_attr){const l=this.urlParser.parse(`${r}${a.a_attr.href}`);i.push({id:a.id,label:a.text,location:l.space,url:this.cristalApp.getRouter().resolve({name:"view",params:{page:this.referenceSerializer.serialize(l)}}).href,has_children:a.children,is_terminal:!a.id.endsWith(".WebHome")})}return i}};b=J([G(),g(0,j("Logger")),g(1,j("CristalApp")),g(2,j("AuthenticationManagerProvider")),g(3,j("RemoteURLParser")),g(3,z("XWiki")),g(4,j("ModelReferenceSerializer")),g(4,z("XWiki"))],b);class Q{constructor(e){e.bind(v.name).to(b).inSingletonScope().whenNamed("XWiki")}}m.ComponentInit=Q,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
1
+ (function(o,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@xwiki/cristal-navigation-tree-api"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-navigation-tree-api","inversify"],h):(o=typeof globalThis<"u"?globalThis:o||self,h(o["cristal_navigation-tree-xwiki"]={},o.cristalNavigationTreeApi,o.inversify))})(this,function(o,h,s){"use strict";var f=Object.getOwnPropertyDescriptor,g=(t,i,r,e)=>{for(var n=e>1?void 0:e?f(i,r):i,c=t.length-1,d;c>=0;c--)(d=t[c])&&(n=d(n)||n);return n},l=(t,i)=>(r,e)=>i(r,e,t);let u=class{constructor(t,i,r,e,n){this.logger=t,this.cristalApp=i,this.authenticationManagerProvider=r,this.urlParser=e,this.referenceSerializer=n,this.logger.setModule("navigation-tree-xwiki.components.XWikiNavigationTreeSource")}async getChildNodes(t){const i=t||"#",r=[];try{const e=await this.authenticationManagerProvider.get()?.getAuthorizationHeader(),n={Accept:"application/json"};e&&(n.Authorization=e),r.push(...await this.fetchNodes(i,n,0))}catch(e){this.logger.error(e),this.logger.debug("Could not load navigation tree.")}return r}getParentNodesId(t,i=!0,r){const e=r?[""]:[];if(t.space){let n="";for(const c of t.space.names)n+=c,e.push(`document:xwiki:${n}.WebHome`),n+=".";t.name!="WebHome"&&i&&e.push(`document:xwiki:${this.referenceSerializer.serialize(t)}`)}return e}async fetchNodes(t,i,r){const e=[],n=this.cristalApp.getWikiConfig().baseURL.replace(/\/[^/]*$/,""),c=new URL(`${this.cristalApp.getWikiConfig().baseURL}/bin/get`);c.search=new URLSearchParams([["id",t],["outputSyntax","plain"],["sheet","XWiki.DocumentTree"],["data","children"],["compact","true"],["offset",r.toString()],["showTranslations","false"],["showAttachments","false"]]).toString();const w=await(await fetch(c,{headers:i})).json();for(const a of w)if(a.id=="pagination:wiki:xwiki")e.push(...await this.fetchNodes(t,i,a.data.offset));else if(!["attachments","translations"].includes(a.data.type)&&a.a_attr){const p=this.urlParser.parse(`${n}${a.a_attr.href}`);e.push({id:a.id,label:a.text,location:p.space,url:this.cristalApp.getRouter().resolve({name:"view",params:{page:this.referenceSerializer.serialize(p)}}).href,has_children:a.children,is_terminal:!a.id.endsWith(".WebHome")})}return e}};u=g([s.injectable(),l(0,s.inject("Logger")),l(1,s.inject("CristalApp")),l(2,s.inject("AuthenticationManagerProvider")),l(3,s.inject("RemoteURLParser")),l(3,s.named("XWiki")),l(4,s.inject("ModelReferenceSerializer")),l(4,s.named("XWiki"))],u);class m{constructor(i){i.bind(h.name).to(u).inSingletonScope().whenNamed("XWiki")}}o.ComponentInit=m,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
12
2
  //# sourceMappingURL=index.umd.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.umd.js","sources":["../../../../node_modules/.pnpm/@inversifyjs+reflect-metadata-utils@1.3.0_reflect-metadata@0.2.2/node_modules/@inversifyjs/reflect-metadata-utils/lib/esm/index.js","../../../../node_modules/.pnpm/@inversifyjs+core@6.0.1_reflect-metadata@0.2.2/node_modules/@inversifyjs/core/lib/esm/index.js","../src/components/componentsInit.ts"],"sourcesContent":["function t(t){return n=>(n.push(...t),n)}function n(t){return n=>(n.push(t),n)}function e(t,n){return e=>(e[n]=t,e)}function u(){return[]}function f(){return new Map}function c(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function a(t,n,e){return Reflect.getMetadata(n,t,e)}function r(t,n,e,u){Reflect.defineMetadata(n,e,t,u)}function i(t,n,e,u,f){const a=u(c(t,n,f)??e());Reflect.defineMetadata(n,a,t,f)}function o(t,n,e,u,f){const c=u(a(t,n,f)??e());Reflect.defineMetadata(n,c,t,f)}export{t as buildArrayMetadataWithArray,n as buildArrayMetadataWithElement,e as buildArrayMetadataWithIndex,u as buildEmptyArrayMetadata,f as buildEmptyMapMetadata,c as getOwnReflectMetadata,a as getReflectMetadata,r as setReflectMetadata,i as updateOwnReflectMetadata,o as updateReflectMetadata};\n//# sourceMappingURL=index.js.map\n","import{getOwnReflectMetadata as e,setReflectMetadata as t,updateOwnReflectMetadata as n}from\"@inversifyjs/reflect-metadata-utils\";import{getBaseType as i}from\"@inversifyjs/prototype-utils\";import{stringifyServiceIdentifier as o,LazyServiceIdentifier as r,isPromise as s}from\"@inversifyjs/common\";const a=\"@inversifyjs/container/bindingId\";function c(){const i=e(Object,a)??0;return i===Number.MAX_SAFE_INTEGER?t(Object,a,Number.MIN_SAFE_INTEGER):n(Object,a,()=>i,e=>e+1),i}const d={Request:\"Request\",Singleton:\"Singleton\",Transient:\"Transient\"},u={ConstantValue:\"ConstantValue\",DynamicValue:\"DynamicValue\",Factory:\"Factory\",Instance:\"Instance\",Provider:\"Provider\",ResolvedValue:\"ResolvedValue\",ServiceRedirection:\"ServiceRedirection\"};function*l(...e){for(const t of e)yield*t}class p{#e;#t;#n;constructor(e){this.#e=new Map,this.#t={};for(const t of Reflect.ownKeys(e))this.#t[t]=new Map;this.#n=e}add(e,t){this.#i(e).push(t);for(const n of Reflect.ownKeys(t))this.#o(n,t[n]).push(e)}clone(){const e=this.#r(),t=this.#s(),n=Reflect.ownKeys(this.#n),i=this._buildNewInstance(this.#n);this.#a(this.#e,i.#e,e,t);for(const t of n)this.#c(this.#t[t],i.#t[t],e);return i}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){const n=this.get(e,t);if(void 0===n)return;const i=new Set(n);for(const n of i){const i=this.#e.get(n);if(void 0===i)throw new Error(\"Expecting model relation, none found\");for(const o of i)o[e]===t&&this.#d(n,o);this.#e.delete(n)}}_buildNewInstance(e){return new p(e)}_cloneModel(e){return e}_cloneRelation(e){return e}#r(){const e=new Map;for(const t of this.#e.keys()){const n=this._cloneModel(t);e.set(t,n)}return e}#s(){const e=new Map;for(const t of this.#e.values())for(const n of t){const t=this._cloneRelation(n);e.set(n,t)}return e}#i(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let n=this.#t[e].get(t);return void 0===n&&(n=[],this.#t[e].set(t,n)),n}#u(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting model to be cloned, none found\");return n}#l(e,t){const n=t.get(e);if(void 0===n)throw new Error(\"Expecting relation to be cloned, none found\");return n}#c(e,t,n){for(const[i,o]of e){const e=new Array;for(const t of o)e.push(this.#u(t,n));t.set(i,e)}}#a(e,t,n,i){for(const[o,r]of e){const e=new Array;for(const t of r)e.push(this.#l(t,i));t.set(this.#u(o,n),e)}}#d(e,t){for(const n of Reflect.ownKeys(t))this.#p(e,n,t[n])}#p(e,t,n){const i=this.#t[t].get(n);if(void 0!==i){const o=i.indexOf(e);-1!==o&&i.splice(o,1),0===i.length&&this.#t[t].delete(n)}}}var f,v,h;!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(f||(f={}));class g{#f;#v;constructor(e,t){this.#f=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new g(e)}add(e,t){this.#f.add(e,t)}clone(){return new g(this.#v,this.#f.clone())}get(e){const t=[],n=this.#f.get(f.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#f.removeByRelation(f.moduleId,e)}removeAllByServiceId(e){this.#f.removeByRelation(f.serviceId,e)}}function m(e){return e.isRight?{isRight:!0,value:e.value}:e}function y(e){switch(e.type){case u.ConstantValue:case u.DynamicValue:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type,value:e.value}}(e);case u.Factory:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Instance:return function(e){return{cache:m(e.cache),id:e.id,implementationType:e.implementationType,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.Provider:return function(e){return{cache:m(e.cache),id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,provider:e.provider,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ResolvedValue:return function(e){return{cache:m(e.cache),factory:e.factory,id:e.id,isSatisfiedBy:e.isSatisfiedBy,metadata:e.metadata,moduleId:e.moduleId,onActivation:e.onActivation,onDeactivation:e.onDeactivation,scope:e.scope,serviceIdentifier:e.serviceIdentifier,type:e.type}}(e);case u.ServiceRedirection:return function(e){return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}(e)}}!function(e){e.id=\"id\",e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(v||(v={}));class M extends p{_buildNewInstance(e){return new M(e)}_cloneModel(e){return y(e)}}class I{#h;#v;constructor(e,t){this.#h=t??new M({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new I(e)}clone(){return new I(this.#v,this.#h.clone())}get(e){return this.getNonParentBindings(e)??this.#v()?.get(e)}*getChained(e){const t=this.getNonParentBindings(e);void 0!==t&&(yield*t);const n=this.#v();void 0!==n&&(yield*n.getChained(e))}getBoundServices(){const e=new Set(this.#h.getAllKeys(v.serviceId)),t=this.#v();if(void 0!==t)for(const n of t.getBoundServices())e.add(n);return e}getById(e){return this.#h.get(v.id,e)??this.#v()?.getById(e)}getByModuleId(e){return this.#h.get(v.moduleId,e)??this.#v()?.getByModuleId(e)}getNonParentBindings(e){return this.#h.get(v.serviceId,e)}getNonParentBoundServices(){return this.#h.getAllKeys(v.serviceId)}removeById(e){this.#h.removeByRelation(v.id,e)}removeAllByModuleId(e){this.#h.removeByRelation(v.moduleId,e)}removeAllByServiceId(e){this.#h.removeByRelation(v.serviceId,e)}set(e){const t={[v.id]:e.id,[v.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[v.moduleId]=e.moduleId),this.#h.add(e,t)}}!function(e){e.moduleId=\"moduleId\",e.serviceId=\"serviceId\"}(h||(h={}));class w{#g;#v;constructor(e,t){this.#g=t??new p({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#v=e}static build(e){return new w(e)}add(e,t){this.#g.add(e,t)}clone(){return new w(this.#v,this.#g.clone())}get(e){const t=[],n=this.#g.get(h.serviceId,e);void 0!==n&&t.push(n);const i=this.#v()?.get(e);if(void 0!==i&&t.push(i),0!==t.length)return l(...t)}removeAllByModuleId(e){this.#g.removeByRelation(h.moduleId,e)}removeAllByServiceId(e){this.#g.removeByRelation(h.serviceId,e)}}function b(e,t,n){const i=Array.isArray(e)?e:[e];if(void 0!==n)if(\"number\"!=typeof n)Reflect.decorate(i,t.prototype,n);else for(const e of i)e(t,void 0,n);else Reflect.decorate(i,t)}const S=\"@inversifyjs/core/classMetadataReflectKey\";function C(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const N=\"@inversifyjs/core/pendingClassMetadataCountReflectKey\";const T=Symbol.for(\"@inversifyjs/core/InversifyCoreError\");class j extends Error{[T];kind;constructor(e,t,n){super(t,n),this[T]=!0,this.kind=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[T]}static isErrorOfKind(e,t){return j.is(e)&&e.kind===t}}var P,A,R;function x(t){const n=e(t,S)??C();if(!function(t){const n=e(t,N);return void 0!==n&&0!==n}(t))return function(e,t){const n=[];if(t.length<e.length)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\". \"${e.name}\" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.\\nAre you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`);for(let e=0;e<t.length;++e)void 0===t[e]&&n.push(e);if(n.length>0)throw new j(P.missingInjectionDecorator,`Found unexpected missing metadata on type \"${e.name}\" at constructor indexes \"${n.join('\", \"')}\".\\n\\nAre you using @inject, @multiInject or @unmanaged decorators at those indexes?\\n\\nIf you're using typescript and want to rely on auto injection, set \"emitDecoratorMetadata\" compiler option to true`)}(t,n.constructorArguments),n;!function(e,t){const n=[];for(let i=0;i<t.constructorArguments.length;++i){const o=t.constructorArguments[i];void 0!==o&&o.kind!==A.unknown||n.push(` - Missing or incomplete metadata for type \"${e.name}\" at constructor argument with index ${i.toString()}.\\nEvery constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(const[i,o]of t.properties)o.kind===A.unknown&&n.push(` - Missing or incomplete metadata for type \"${e.name}\" at property \"${i.toString()}\".\\nThis property must be decorated either with @inject or @multiInject decorator.`);if(0===n.length)throw new j(P.unknown,`Unexpected class metadata for type \"${e.name}\" with uncompletion traces.\\nThis might be caused by one of the following reasons:\\n\\n1. A third party library is targeting inversify reflection metadata.\\n2. A bug is causing the issue. Consider submiting an issue to fix it.`);throw new j(P.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:\\n\\n${n.join(\"\\n\\n\")}`)}(t,n)}function B(){return 0}function $(e){return t=>{void 0!==t&&t.kind===A.unknown&&n(e,N,B,e=>e-1)}}function D(e,t){return(...n)=>i=>{if(void 0===i)return e(...n);if(i.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\");return t(i,...n)}}function k(e){if(e.kind!==A.unknown&&!0!==e.isFromTypescriptParamType)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found\")}!function(e){e[e.injectionDecoratorConflict=0]=\"injectionDecoratorConflict\",e[e.missingInjectionDecorator=1]=\"missingInjectionDecorator\",e[e.planning=2]=\"planning\",e[e.resolution=3]=\"resolution\",e[e.unknown=4]=\"unknown\"}(P||(P={})),function(e){e[e.unknown=32]=\"unknown\"}(A||(A={})),function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\",e[e.unmanaged=2]=\"unmanaged\"}(R||(R={}));const F=D(function(e,t,n){return e===R.multipleInjection?{chained:n?.chained??!1,kind:e,name:void 0,optional:!1,tags:new Map,value:t}:{kind:e,name:void 0,optional:!1,tags:new Map,value:t}},function(e,t,n,i){return k(e),t===R.multipleInjection?{...e,chained:i?.chained??!1,kind:t,value:n}:{...e,kind:t,value:n}});function V(e,t){return n=>{const i=n.properties.get(t);return n.properties.set(t,e(i)),n}}var O;function E(e,t,n,i){if(j.isErrorOfKind(i,P.injectionDecoratorConflict)){const o=function(e,t,n){if(void 0===n){if(void 0===t)throw new j(P.unknown,\"Unexpected undefined property and index values\");return{kind:O.property,property:t,targetClass:e.constructor}}return\"number\"==typeof n?{index:n,kind:O.parameter,targetClass:e}:{kind:O.method,method:t,targetClass:e}}(e,t,n);throw new j(P.injectionDecoratorConflict,`Unexpected injection error.\\n\\nCause:\\n\\n${i.message}\\n\\nDetails\\n\\n${function(e){switch(e.kind){case O.method:return`[class: \"${e.targetClass.name}\", method: \"${e.method.toString()}\"]`;case O.parameter:return`[class: \"${e.targetClass.name}\", index: \"${e.index.toString()}\"]`;case O.property:return`[class: \"${e.targetClass.name}\", property: \"${e.property.toString()}\"]`}}(o)}`,{cause:i})}throw i}function _(e,t){return(i,o,r)=>{try{void 0===r?function(e,t){const i=U(e,t);return(e,t)=>{n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o):\"number\"==typeof r?function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e,t){return\"function\"==typeof e&&void 0===t}(e,t))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.\\nFound @inject decorator at method \"${t?.toString()??\"\"}\" at class \"${e.constructor.name}\"`);n(e,S,C,function(e,t){return n=>{const i=n.constructorArguments[t];return n.constructorArguments[t]=e(i),n}}(i(e),o))}}(e,t)(i,o,r):function(e,t){const i=U(e,t);return(e,t,o)=>{if(!function(e){return void 0!==e.set}(o))throw new j(P.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.\\nFound @inject decorator at method \"${t.toString()}\" at class \"${e.constructor.name}\"`);n(e.constructor,S,C,V(i(e),t))}}(e,t)(i,o,r)}catch(e){E(i,o,r,e)}}}function U(e,t){return n=>{const i=t(n);return t=>(i(t),e(t))}}function z(e){return _(F(R.singleInjection,e),$)}!function(e){e[e.method=0]=\"method\",e[e.parameter=1]=\"parameter\",e[e.property=2]=\"property\"}(O||(O={}));const K=\"@inversifyjs/core/classIsInjectableFlagReflectKey\";const L=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const i=e(t,\"design:paramtypes\");void 0!==i&&n(t,S,C,function(e){return t=>(e.forEach((e,n)=>{var i;void 0!==t.constructorArguments[n]||(i=e,L.includes(i))||(t.constructorArguments[n]=function(e){return{isFromTypescriptParamType:!0,kind:R.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}}(e))}),t)}(i))}function G(i){return o=>{!function(n){if(void 0!==e(n,K))throw new j(P.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class \"${n.name}\"`);t(n,K,!0)}(o),q(o),void 0!==i&&n(o,S,C,e=>({...e,scope:i}))}}function W(e,t,n){let i;return e.extendConstructorArguments??!0?(i=[...t.constructorArguments],n.constructorArguments.map((e,t)=>{i[t]=e})):i=n.constructorArguments,i}function X(e,t,n){let i;return i=e.extendProperties??!0?new Map(l(t.properties,n.properties)):n.properties,i}function H(e){return t=>{const i=x(e.type);n(t,S,C,function(e,t){const n=n=>({constructorArguments:W(e,t,n),lifecycle:n.lifecycle,properties:X(e,t,n),scope:n.scope});return n}(e,i))}}function J(e){return t=>{const n=i(t);if(void 0===n)throw new j(P.injectionDecoratorConflict,`Expected base type for type \"${t.name}\", none found.`);H({...e,type:n})(t)}}function Q(e,t){return _(F(R.multipleInjection,e,t),$)}function Y(e){return t=>{void 0===t&&n(e,N,B,e=>e+1)}}function Z(e){return t=>{const n=t??{kind:A.unknown,name:void 0,optional:!1,tags:new Map};if(n.kind===R.unmanaged)throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return e(n)}}function ee(e){const t=Z(function(e){return t=>{if(void 0!==t.name)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated named decorator\");return t.name=e,t}}(e));return _(t,Y)}function te(e){if(e.optional)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated optional decorator\");return e.optional=!0,e}function ne(){return _(Z(te),Y)}function ie(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.postConstructMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated postConstruct decorator\");return e.lifecycle.postConstructMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function oe(){return(e,t,i)=>{try{n(e.constructor,S,C,(o=t,e=>{if(void 0!==e.lifecycle.preDestroyMethodName)throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated preDestroy decorator\");return e.lifecycle.preDestroyMethodName=o,e}))}catch(n){E(e,t,void 0,n)}var o}}function re(e,t){const n=Z(function(e,t){return n=>{if(n.tags.has(e))throw new j(P.injectionDecoratorConflict,\"Unexpected duplicated tag decorator with existing tag\");return n.tags.set(e,t),n}}(e,t));return _(n,Y)}function se(){return{kind:R.unmanaged}}const ae=D(se,function(e){if(k(e),function(e){return void 0!==e.name||e.optional||e.tags.size>0}(e))throw new j(P.injectionDecoratorConflict,\"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections\");return se()});function ce(){return _(ae(),$)}var de;!function(e){e[e.multipleInjection=0]=\"multipleInjection\",e[e.singleInjection=1]=\"singleInjection\"}(de||(de={}));class ue{#m;constructor(e){this.#m=e}get name(){return this.#m.elem.name}get serviceIdentifier(){return this.#m.elem.serviceIdentifier}get tags(){return this.#m.elem.tags}getAncestor(){if(this.#m.elem.getAncestorsCalled=!0,void 0!==this.#m.previous)return new ue(this.#m.previous)}}function le(e,t,n){const i=n?.customServiceIdentifier??t.serviceIdentifier,o=(!0===n?.chained?[...e.operations.getBindingsChained(i)]:[...e.operations.getBindings(i)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===o.length&&void 0!==e.autobindOptions&&\"function\"==typeof i){const t=function(e,t){const n=x(t),i=n.scope??e.scope;return{cache:{isRight:!1,value:void 0},id:c(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:u.Instance}}(e.autobindOptions,i);e.operations.setBinding(t),o.push(t)}return o}class pe{last;constructor(e){this.last=e}concat(e){return new pe({elem:e,previous:this.last})}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};const t=e.elem;return e=e.previous,{done:!1,value:t}}}}}function fe(e){return void 0!==e.redirections}function ve(e,t,n,i){const r=n.elem.serviceIdentifier,s=n.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,n,i,r,s){if(0!==e.length){const t=s[s.length-1]??n,a=`Ambiguous bindings found for service: \"${o(t)}\".${ye(s)}\\n\\nRegistered bindings:\\n\\n${e.map(e=>function(e){switch(e.type){case u.Instance:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\", implementationType: \"${e.implementationType.name}\" ]`;case u.ServiceRedirection:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", redirection: \"${o(e.targetServiceIdentifier)}\" ]`;default:return`[ type: \"${e.type}\", serviceIdentifier: \"${o(e.serviceIdentifier)}\", scope: \"${e.scope}\" ]`}}(e.binding)).join(\"\\n\")}\\n\\nTrying to resolve bindings for \"${ge(n,i)}\".${me(r)}`;throw new j(P.planning,a)}t||he(n,i,r,s)}(e,t,r,s,n.elem,i):function(e,t,n,i,o,r){void 0!==e||t||he(n,i,o,r)}(e,t,r,s,n.elem,i)}function he(e,t,n,i){const r=i[i.length-1]??e,s=`No bindings found for service: \"${o(r)}\".\\n\\nTrying to resolve bindings for \"${ge(e,t)}\".${ye(i)}${me(n)}`;throw new j(P.planning,s)}function ge(e,t){return void 0===t?`${o(e)} (Root service)`:o(t)}function me(e){const t=0===e.tags.size?\"\":`\\n- tags:\\n - ${[...e.tags.keys()].map(e=>e.toString()).join(\"\\n - \")}`;return`\\n\\nBinding constraints:\\n- service identifier: ${o(e.serviceIdentifier)}\\n- name: ${e.name?.toString()??\"-\"}${t}`}function ye(e){return 0===e.length?\"\":`\\n\\n- service redirections:\\n - ${e.map(e=>o(e)).join(\"\\n - \")}`}function Me(e,t,n,i){if(1===e.redirections.length){const[o]=e.redirections;return void(fe(o)&&Me(o,t,n,[...i,o.binding.targetServiceIdentifier]))}ve(e.redirections,t,n,i)}function Ie(e,t,n){if(Array.isArray(e.bindings)&&1===e.bindings.length){const[i]=e.bindings;return void(fe(i)&&Me(i,t,n,[i.binding.targetServiceIdentifier]))}ve(e.bindings,t,n,[])}function we(e){return r.is(e)?e.unwrap():e}function be(e,t){if(function(e){return e instanceof Error&&(e instanceof RangeError&&/stack space|call stack|too much recursion/i.test(e.message)||\"InternalError\"===e.name&&/too much recursion/.test(e.message))}(t)){const n=function(e){const t=[...e];if(0===t.length)return\"(No dependency trace)\";return t.map(o).join(\" -> \")}(function(e){const t=new Set;for(const n of e.servicesBranch){if(t.has(n))return[...t,n];t.add(n)}return[...t]}(e));throw new j(P.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}const Se=Symbol.for(\"@inversifyjs/core/LazyPlanServiceNode\");class Ce{[Se];_serviceIdentifier;_serviceNode;constructor(e){this[Se]=!0,this._serviceIdentifier=e.serviceIdentifier,this._serviceNode=e}get bindings(){return this._getNode().bindings}get isContextFree(){return this._getNode().isContextFree}get serviceIdentifier(){return this._serviceIdentifier}set bindings(e){this._getNode().bindings=e}set isContextFree(e){this._getNode().isContextFree=e}static is(e){return\"object\"==typeof e&&null!==e&&!0===e[Se]}invalidate(){this._serviceNode=void 0}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}}function Ne(e,t,n){if(void 0!==e&&n.isContextFree){const i={tree:{root:n}};t.setPlan(e,i)}else t.setNonCachedServiceNode(n)}class Te extends Ce{#y;constructor(e,t){super(t),this.#y=e}_buildPlanServiceNode(){return Ae(this.#y)}}class je extends Ce{#y;#M;#I;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#I=n}_buildPlanServiceNode(){return Be(this.#y,this.#M,this.#I)}}class Pe extends Ce{#y;#M;#w;constructor(e,t,n,i){super(i),this.#y=e,this.#M=t,this.#w=n}_buildPlanServiceNode(){return $e(this.#y,this.#M,this.#w)}}function Ae(e){const t=function(e){const t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new pe({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0})}(e),n=new ue(t.last),i=!!e.rootConstraints.isMultiple&&e.rootConstraints.chained,o=le(e,n,{chained:i}),r=[],s={bindings:r,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(r.push(...ke(e,t,o,s,i)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){Ie(s,e.rootConstraints.isOptional??!1,t.last);const[n]=r;s.bindings=n}return s}function Re(e){try{const t=function(e){return e.rootConstraints.isMultiple?{chained:e.rootConstraints.chained,isMultiple:!0,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}:{isMultiple:!1,name:e.rootConstraints.name,optional:e.rootConstraints.isOptional??!1,serviceIdentifier:e.rootConstraints.serviceIdentifier,tag:e.rootConstraints.tag}}(e),n=e.operations.getPlan(t);if(void 0!==n)return n;const i=Ae(e),o={tree:{root:new Te(e,i)}};return e.operations.setPlan(t,o),o}catch(t){be(e,t)}}function xe(e,t,n){const i={binding:t,classMetadata:e.operations.getClassMetadata(t.implementationType),constructorParams:[],propertyParams:new Map};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function Be(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===R.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===R.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function $e(e,t,n){const i=we(n.value),o=t.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:i,tags:n.tags}),r=new ue(o.last),s=n.kind===de.multipleInjection&&n.chained,a=le(e,r,{chained:s}),c=[],d={bindings:c,isContextFree:!0,serviceIdentifier:i};if(c.push(...ke(e,o,a,d,s)),d.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===de.singleInjection){Ie(d,n.optional,o.last);const[e]=c;d.bindings=e}return d}function De(e,t,n){const i={binding:t,params:[]};return Ee({autobindOptions:e.autobindOptions,node:i,operations:e.operations,servicesBranch:e.servicesBranch},n)}function ke(e,t,n,i,o){const r=fe(i)?i.binding.targetServiceIdentifier:i.serviceIdentifier;e.servicesBranch.push(r);const s=[];for(const i of n)switch(i.type){case u.Instance:s.push(xe(e,i,t));break;case u.ResolvedValue:s.push(De(e,i,t));break;case u.ServiceRedirection:{const n=Fe(e,t,i,o);s.push(n);break}default:s.push({binding:i})}return e.servicesBranch.pop(),s}function Fe(e,t,n,i){const o={binding:n,redirections:[]},r=le(e,new ue(t.last),{chained:i,customServiceIdentifier:n.targetServiceIdentifier});return o.redirections.push(...ke(e,t,r,o,i)),o}function Ve(e,t,n){if(n.kind===R.unmanaged)return;const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===R.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=Be(e,t,n),s=new je(e,t,n,o);return Ne(i,e.operations,s),s}function Oe(e,t,n){const i=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;{const[n,i]=e.tags.entries().next().value;t={key:n,value:i}}}const n=r.is(e.value)?e.value.unwrap():e.value;return e.kind===de.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:n,tag:t}}(n);if(void 0!==i){const t=e.operations.getPlan(i);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}const o=$e(e,t,n),s=new Pe(e,t,n,o);return Ne(i,e.operations,s),s}function Ee(e,t){return e.node.binding.type===u.Instance?function(e,t,n){const i=t.classMetadata;for(const[o,r]of i.constructorArguments.entries())t.constructorParams[o]=Ve(e,n,r);for(const[o,r]of i.properties){const i=Ve(e,n,r);void 0!==i&&t.propertyParams.set(o,i)}return e.node}(e,e.node,t):function(e,t,n){const i=t.binding.metadata;for(const[o,r]of i.arguments.entries())t.params[o]=Oe(e,n,r);return e.node}(e,e.node,t)}class _e{#b;#S;#C;constructor(){this.#b=[],this.#S=8,this.#C=1024}*[Symbol.iterator](){let e=0;for(const t of this.#b){const n=t.deref();void 0===n?++e:yield n}this.#b.length>=this.#S&&this.#N(e)&&this.#T(e)}push(e){const t=new WeakRef(e);if(this.#b.push(t),this.#b.length>=this.#S&&this.#b.length%this.#C===0){let e=0;for(const t of this.#b)void 0===t.deref()&&++e;this.#N(e)&&this.#T(e)}}#T(e){const t=new Array(this.#b.length-e);let n=0;for(const e of this.#b)e.deref()&&(t[n++]=e);this.#b=t}#N(e){return e>=.5*this.#b.length}}class Ue{#j;#P;#A;#R;#x;#B;constructor(){this.#j=new Map,this.#P=this.#$(),this.#A=this.#$(),this.#R=this.#$(),this.#x=this.#$(),this.#B=new _e}clearCache(){for(const e of this.#D())e.clear();for(const e of this.#B)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#k(this.#P,e).get(e.serviceIdentifier):this.#k(this.#x,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#k(this.#A,e).get(e.serviceIdentifier)?.get(e.name):this.#k(this.#R,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateService(e){this.#F(e),this.#V(e),this.#O(e),this.#E(e),this.#_(e);for(const t of this.#B)t.invalidateService(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#k(this.#P,e).set(e.serviceIdentifier,t):this.#U(this.#U(this.#k(this.#x,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#U(this.#k(this.#A,e),e.serviceIdentifier).set(e.name,t):this.#U(this.#U(this.#U(this.#k(this.#R,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e){let t=this.#j.get(e.serviceIdentifier);void 0===t&&(t=new Set,this.#j.set(e.serviceIdentifier,t)),t.add(e)}subscribe(e){this.#B.push(e)}#$(){const e=new Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#U(e,t){let n=e.get(t);return void 0===n&&(n=new Map,e.set(t,n)),n}#k(e,t){return e[this.#z(t)]}#D(){return[this.#j,...this.#P,...this.#A,...this.#R,...this.#x]}#z(e){return e.isMultiple?(e.chained?4:0)|(e.optional?1:0)|2:e.optional?1:0}#V(e){for(const t of this.#A){const n=t.get(e);if(void 0!==n)for(const e of n.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#O(e){for(const t of this.#R){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())for(const e of t.values())Ce.is(e.tree.root)&&(this.#K(e.tree.root),e.tree.root.invalidate())}}#L(e){switch(e.binding.type){case u.ServiceRedirection:for(const t of e.redirections)this.#L(t);break;case u.Instance:for(const t of e.constructorParams)void 0!==t&&this.#q(t);for(const t of e.propertyParams.values())this.#q(t);break;case u.ResolvedValue:for(const t of e.params)this.#q(t)}}#q(e){const t=this.#j.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#K(e))}#K(e){if(void 0!==e.bindings)if(Array.isArray(e.bindings))for(const t of e.bindings)this.#L(t);else this.#L(e.bindings)}#_(e){const t=this.#j.get(e);if(void 0!==t)for(const e of t)Ce.is(e)&&(this.#K(e),e.invalidate())}#F(e){for(const t of this.#P){const n=t.get(e);void 0!==n&&Ce.is(n.tree.root)&&(this.#K(n.tree.root),n.tree.root.invalidate())}}#E(e){for(const t of this.#x){const n=t.get(e);if(void 0!==n)for(const e of n.values())for(const t of e.values())Ce.is(t.tree.root)&&(this.#K(t.tree.root),t.tree.root.invalidate())}}}function ze(e,t){return s(t)?(e.cache={isRight:!0,value:t},t.then(t=>Ke(e,t))):Ke(e,t)}function Ke(e,t){return e.cache={isRight:!0,value:t},t}function Le(e,t,n){const i=e.getActivations(t);return void 0===i?n:s(n)?qe(e,n,i[Symbol.iterator]()):function(e,t,n){let i=t,o=n.next();for(;!0!==o.done;){const t=o.value(e.context,i);if(s(t))return qe(e,t,n);i=t,o=n.next()}return i}(e,n,i[Symbol.iterator]())}async function qe(e,t,n){let i=await t,o=n.next();for(;!0!==o.done;)i=await o.value(e.context,i),o=n.next();return i}function Ge(e,t,n){let i=n;if(void 0!==t.onActivation){const n=t.onActivation;i=s(i)?i.then(t=>n(e.context,t)):n(e.context,i)}return Le(e,t.serviceIdentifier,i)}function We(e){return(t,n)=>{if(n.cache.isRight)return n.cache.value;return ze(n,Ge(t,n,e(t,n)))}}const Xe=We(function(e,t){return t.value});function He(e){return e}function Je(e,t){return(n,i)=>{const o=e(i);switch(o.scope){case d.Singleton:if(o.cache.isRight)return o.cache.value;return ze(o,Ge(n,o,t(n,i)));case d.Request:{if(n.requestScopeCache.has(o.id))return n.requestScopeCache.get(o.id);const e=Ge(n,o,t(n,i));return n.requestScopeCache.set(o.id,e),e}case d.Transient:return Ge(n,o,t(n,i))}}}const Qe=(e=>Je(He,e))(function(e,t){return t.value(e.context)});const Ye=We(function(e,t){return t.factory(e.context)});function Ze(e,t,n){const i=function(e,t,n){if(void 0===n)return;if(!(n in e))throw new j(P.resolution,`Expecting a \"${n.toString()}\" property when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, none found.`);if(\"function\"!=typeof e[n])throw new j(P.resolution,`Expecting a \"${n.toString()}\" method when resolving \"${t.implementationType.name}\" class @postConstruct decorated method, a non function property was found instead.`);{let i;try{i=e[n]()}catch(e){throw new j(P.resolution,`Unexpected error found when calling \"${n.toString()}\" @postConstruct decorated method on class \"${t.implementationType.name}\"`,{cause:e})}if(s(i))return async function(e,t,n){try{await n}catch(n){throw new j(P.resolution,`Unexpected error found when calling \"${t.toString()}\" @postConstruct decorated method on class \"${e.implementationType.name}\"`,{cause:n})}}(t,n,i)}}(e,t,n);return s(i)?i.then(()=>e):e}function et(e){return(t,n,i)=>{const o=new i.binding.implementationType(...t),r=e(n,o,i);return s(r)?r.then(()=>Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)):Ze(o,i.binding,i.classMetadata.lifecycle.postConstructMethodName)}}const tt=We(function(e,t){return t.provider(e.context)});function nt(e){return e.binding}function it(e){return e.binding}const ot=function(e){return(t,n,i)=>{const o=[];for(const[r,a]of i.propertyParams){const c=i.classMetadata.properties.get(r);if(void 0===c)throw new j(P.resolution,`Expecting metadata at property \"${r.toString()}\", none found`);c.kind!==R.unmanaged&&void 0!==a.bindings&&(n[r]=e(t,a),s(n[r])&&o.push((async()=>{n[r]=await n[r]})()))}if(o.length>0)return Promise.all(o).then(()=>{})}}(pt),rt=function(e){return function t(n,i){const o=[];for(const r of i.redirections)fe(r)?o.push(...t(n,r)):o.push(e(n,r));return o}}(lt),st=function(e,t,n){return(i,o)=>{const r=e(i,o);return s(r)?t(r,i,o):n(r,i,o)}}(function(e){return(t,n)=>{const i=[];for(const o of n.constructorParams)void 0===o?i.push(void 0):i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt),function(e){return async(t,n,i)=>{const o=await t;return e(o,n,i)}}(et(ot)),et(ot)),at=function(e){return(t,n)=>{const i=e(t,n);return s(i)?i.then(e=>n.binding.factory(...e)):n.binding.factory(...i)}}(function(e){return(t,n)=>{const i=[];for(const o of n.params)i.push(e(t,o));return i.some(s)?Promise.all(i):i}}(pt)),ct=(e=>Je(nt,e))(st),dt=(e=>Je(it,e))(at);function ut(e){return pt(e,e.planResult.tree.root)}function lt(e,t){switch(t.binding.type){case u.ConstantValue:return Xe(e,t.binding);case u.DynamicValue:return Qe(e,t.binding);case u.Factory:return Ye(e,t.binding);case u.Instance:return ct(e,t);case u.Provider:return tt(e,t.binding);case u.ResolvedValue:return dt(e,t)}}function pt(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){const n=[];for(const i of t)fe(i)?n.push(...rt(e,i)):n.push(lt(e,i));if(n.some(s))return Promise.all(n);return n}(e,t.bindings):function(e,t){if(fe(t)){const n=rt(e,t);if(1===n.length)return n[0];throw new j(P.resolution,\"Unexpected multiple resolved values on single injection\")}return lt(e,t)}(e,t.bindings)}function ft(e){return void 0!==e.scope}function vt(e,t){if(void 0!==e.lifecycle.preDestroyMethodName&&\"function\"==typeof t[e.lifecycle.preDestroyMethodName])return t[e.lifecycle.preDestroyMethodName]()}function ht(e,t,n){const i=e.getDeactivations(t);if(void 0!==i)return s(n)?gt(n,i[Symbol.iterator]()):function(e,t){let n=t.next();for(;!0!==n.done;){const i=n.value(e);if(s(i))return gt(e,t);n=t.next()}}(n,i[Symbol.iterator]())}async function gt(e,t){const n=await e;let i=t.next();for(;!0!==i.done;)await i.value(n),i=t.next()}function mt(e,t){const n=function(e,t){if(t.type===u.Instance){const n=e.getClassMetadata(t.implementationType),i=t.cache.value;return s(i)?i.then(e=>vt(n,e)):vt(n,i)}}(e,t);return void 0===n?yt(e,t):n.then(()=>yt(e,t))}function yt(e,t){const n=t.cache;return s(n.value)?n.value.then(n=>Mt(e,t,n)):Mt(e,t,n.value)}function Mt(e,t,n){let i;if(void 0!==t.onDeactivation){i=(0,t.onDeactivation)(n)}return void 0===i?ht(e,t.serviceIdentifier,n):i.then(()=>ht(e,t.serviceIdentifier,n))}function It(e,t){if(void 0===t)return;const n=function(e){const t=[];for(const n of e)ft(n)&&n.scope===d.Singleton&&n.cache.isRight&&t.push(n);return t}(t),i=[];for(const t of n){const n=mt(e,t);void 0!==n&&i.push(n)}return i.length>0?Promise.all(i).then(()=>{}):void 0}function wt(e,t){const n=e.getBindingsFromModule(t);return It(e,n)}function bt(e,t){const n=e.getBindings(t);return It(e,n)}export{g as ActivationsService,I as BindingService,R as ClassElementMetadataKind,w as DeactivationsService,Ue as PlanResultCacheService,de as ResolvedValueElementMetadataKind,d as bindingScopeValues,u as bindingTypeValues,b as decorate,c as getBindingId,x as getClassMetadata,z as inject,J as injectFromBase,G as injectable,Q as multiInject,ee as named,ne as optional,Re as plan,ie as postConstruct,oe as preDestroy,ut as resolve,It as resolveBindingsDeactivations,wt as resolveModuleDeactivations,bt as resolveServiceDeactivations,re as tagged,ce as unmanaged};\n//# sourceMappingURL=index.js.map\n","/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { Container, inject, injectable, named } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/cristal-authentication-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type { ModelReferenceSerializer } from \"@xwiki/cristal-model-reference-api\";\nimport type { RemoteURLParser } from \"@xwiki/cristal-model-remote-url-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the XWiki backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass XWikiNavigationTreeSource implements NavigationTreeSource {\n constructor(\n @inject(\"Logger\") private readonly logger: Logger,\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"RemoteURLParser\")\n @named(\"XWiki\")\n private readonly urlParser: RemoteURLParser,\n @inject(\"ModelReferenceSerializer\")\n @named(\"XWiki\")\n private readonly referenceSerializer: ModelReferenceSerializer,\n ) {\n this.logger.setModule(\n \"navigation-tree-xwiki.components.XWikiNavigationTreeSource\",\n );\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"#\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n try {\n const authorization = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: { Accept: string; Authorization?: string } = {\n Accept: \"application/json\",\n };\n\n if (authorization) {\n headers.Authorization = authorization;\n }\n\n navigationTree.push(...(await this.fetchNodes(currentId, headers, 0)));\n } catch (error) {\n this.logger.error(error);\n this.logger.debug(\"Could not load navigation tree.\");\n }\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n includeTerminal: boolean = true,\n includeRootNode?: boolean,\n ): Array<string> {\n const result = includeRootNode ? [\"\"] : [];\n if (page.space) {\n let currentParent = \"\";\n for (const parent of page.space!.names) {\n currentParent += parent;\n // TODO: Support subwikis.\n result.push(`document:xwiki:${currentParent}.WebHome`);\n currentParent += \".\";\n }\n if (page.name != \"WebHome\" && includeTerminal) {\n result.push(\n `document:xwiki:${this.referenceSerializer.serialize(page)}`,\n );\n }\n }\n return result;\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n private async fetchNodes(\n currentId: string,\n headers: { Accept: string; Authorization?: string },\n offset: number,\n ): Promise<Array<NavigationTreeNode>> {\n const nodes: Array<NavigationTreeNode> = [];\n const baseXWikiURL = this.cristalApp\n .getWikiConfig()\n .baseURL.replace(/\\/[^/]*$/, \"\");\n\n const navigationTreeRequestUrl = new URL(\n `${this.cristalApp.getWikiConfig().baseURL}/bin/get`,\n );\n navigationTreeRequestUrl.search = new URLSearchParams([\n [\"id\", currentId],\n [\"outputSyntax\", \"plain\"],\n [\"sheet\", \"XWiki.DocumentTree\"],\n [\"data\", \"children\"],\n [\"compact\", \"true\"],\n [\"offset\", offset.toString()],\n [\"showTranslations\", \"false\"],\n [\"showAttachments\", \"false\"],\n ]).toString();\n\n const response = await fetch(navigationTreeRequestUrl, { headers });\n const jsonResponse: [\n {\n id: string;\n text: string;\n children: boolean;\n data: { type: string; offset: number };\n a_attr?: { href: string };\n },\n ] = await response.json();\n for (const treeNode of jsonResponse) {\n if (treeNode.id == \"pagination:wiki:xwiki\") {\n nodes.push(\n ...(await this.fetchNodes(currentId, headers, treeNode.data.offset)),\n );\n } else if (\n ![\"attachments\", \"translations\"].includes(treeNode.data.type) &&\n treeNode.a_attr\n ) {\n const documentReference = this.urlParser.parse(\n `${baseXWikiURL}${treeNode.a_attr.href}`,\n )! as DocumentReference;\n nodes.push({\n id: treeNode.id,\n label: treeNode.text,\n location: documentReference.space!,\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: this.referenceSerializer.serialize(documentReference),\n },\n }).href,\n has_children: treeNode.children,\n is_terminal: !treeNode.id.endsWith(\".WebHome\"),\n });\n }\n }\n\n return nodes;\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(XWikiNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"XWiki\");\n }\n}\n"],"names":["c","t","n","e","r","u","i","f","a","v","h","S","C","T","j","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","q","Y","Z","ee","de","XWikiNavigationTreeSource","logger","cristalApp","authenticationManagerProvider","urlParser","referenceSerializer","id","currentId","navigationTree","authorization","headers","error","page","includeTerminal","includeRootNode","result","currentParent","parent","offset","nodes","baseXWikiURL","navigationTreeRequestUrl","jsonResponse","treeNode","documentReference","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":"wWAAsK,SAASA,EAAEC,EAAEC,EAAEC,EAAE,CAAC,OAAO,QAAQ,eAAeD,EAAED,EAAEE,CAAC,CAAC,CAAqD,SAASC,EAAEH,EAAEC,EAAEC,EAAEE,EAAE,CAAC,QAAQ,eAAeH,EAAEC,EAAEF,EAAEI,CAAC,CAAC,CAAC,SAASC,EAAEL,EAAEC,EAAEC,EAAEE,EAAEE,EAAE,CAAC,MAAMC,EAAEH,EAAEL,EAAEC,EAAEC,EAAEK,CAAC,GAAGJ,EAAC,CAAE,EAAE,QAAQ,eAAeD,EAAEM,EAAEP,EAAEM,CAAC,CAAC,CCA2nE,IAAIA,EAAEE,EAAEC,GAAG,SAASP,EAAE,CAACA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,GAAEI,IAAIA,EAAE,CAAA,EAAG,EAA4oE,SAASJ,EAAE,CAACA,EAAE,GAAG,KAAKA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,EAAEM,IAAIA,EAAE,CAAA,EAAG,EAAgrC,SAASN,E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AM,KACJ,GAAI,MAAM,KAAK,WAAWZ,EAAWG,EAASa,EAAS,KAAK,MAAM,CAAA,UAGpE,CAAC,CAAC,cAAe,cAAc,EAAE,SAASA,EAAS,KAAK,IAAI,GAC5DA,EAAS,OACT,CACA,MAAMC,EAAoB,KAAK,UAAU,MACvC,GAAGJ,CAAY,GAAGG,EAAS,OAAO,IAAI,EAAA,EAExCJ,EAAM,KAAK,CACT,GAAII,EAAS,GACb,MAAOA,EAAS,KAChB,SAAUC,EAAkB,MAC5B,IAAK,KAAK,WAAW,UAAA,EAAY,QAAQ,CACvC,KAAM,OACN,OAAQ,CACN,KAAM,KAAK,oBAAoB,UAAUA,CAAiB,CAAA,CAC5D,CACD,EAAE,KACH,aAAcD,EAAS,SACvB,YAAa,CAACA,EAAS,GAAG,SAAS,UAAU,CAAA,CAC9C,CACH,CAGF,OAAOJ,CACT,CACF,EArIMnB,EAANyB,EAAA,CADCC,EAAA,EAGIC,MAAO,QAAQ,CAAA,EACfA,MAAO,YAAY,CAAA,EACnBA,MAAO,+BAA+B,CAAA,EAEtCA,MAAO,iBAAiB,CAAA,EACxBA,MAAM,OAAO,CAAA,EAEbA,MAAO,0BAA0B,CAAA,EACjCA,MAAM,OAAO,CAAA,CAAA,EAVZ3B,CAAA,EAuIC,MAAM4B,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAA2BC,EAAAA,IAAwB,EACnD,GAAG9B,CAAyB,EAC5B,iBAAA,EACA,UAAU,OAAO,CACtB,CACF","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/components/componentsInit.ts"],"sourcesContent":["/**\n * See the LICENSE file distributed with this work for additional\n * information regarding copyright ownership.\n *\n * This is free software; you can redistribute it and/or modify it\n * under the terms of the GNU Lesser General Public License as\n * published by the Free Software Foundation; either version 2.1 of\n * the License, or (at your option) any later version.\n *\n * This software is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this software; if not, write to the Free\n * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA\n * 02110-1301 USA, or see the FSF site: http://www.fsf.org.\n */\n\nimport { name as NavigationTreeSourceName } from \"@xwiki/cristal-navigation-tree-api\";\nimport { Container, inject, injectable, named } from \"inversify\";\nimport type { CristalApp, Logger } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManagerProvider } from \"@xwiki/cristal-authentication-api\";\nimport type { DocumentReference } from \"@xwiki/cristal-model-api\";\nimport type { ModelReferenceSerializer } from \"@xwiki/cristal-model-reference-api\";\nimport type { RemoteURLParser } from \"@xwiki/cristal-model-remote-url-api\";\nimport type {\n NavigationTreeNode,\n NavigationTreeSource,\n} from \"@xwiki/cristal-navigation-tree-api\";\n\n/**\n * Implementation of NavigationTreeSource for the XWiki backend.\n *\n * @since 0.10\n **/\n@injectable()\nclass XWikiNavigationTreeSource implements NavigationTreeSource {\n constructor(\n @inject(\"Logger\") private readonly logger: Logger,\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(\"AuthenticationManagerProvider\")\n private authenticationManagerProvider: AuthenticationManagerProvider,\n @inject(\"RemoteURLParser\")\n @named(\"XWiki\")\n private readonly urlParser: RemoteURLParser,\n @inject(\"ModelReferenceSerializer\")\n @named(\"XWiki\")\n private readonly referenceSerializer: ModelReferenceSerializer,\n ) {\n this.logger.setModule(\n \"navigation-tree-xwiki.components.XWikiNavigationTreeSource\",\n );\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n async getChildNodes(id?: string): Promise<Array<NavigationTreeNode>> {\n const currentId = id ? id : \"#\";\n const navigationTree: Array<NavigationTreeNode> = [];\n\n try {\n const authorization = await this.authenticationManagerProvider\n .get()\n ?.getAuthorizationHeader();\n const headers: { Accept: string; Authorization?: string } = {\n Accept: \"application/json\",\n };\n\n if (authorization) {\n headers.Authorization = authorization;\n }\n\n navigationTree.push(...(await this.fetchNodes(currentId, headers, 0)));\n } catch (error) {\n this.logger.error(error);\n this.logger.debug(\"Could not load navigation tree.\");\n }\n return navigationTree;\n }\n\n getParentNodesId(\n page: DocumentReference,\n includeTerminal: boolean = true,\n includeRootNode?: boolean,\n ): Array<string> {\n const result = includeRootNode ? [\"\"] : [];\n if (page.space) {\n let currentParent = \"\";\n for (const parent of page.space!.names) {\n currentParent += parent;\n // TODO: Support subwikis.\n result.push(`document:xwiki:${currentParent}.WebHome`);\n currentParent += \".\";\n }\n if (page.name != \"WebHome\" && includeTerminal) {\n result.push(\n `document:xwiki:${this.referenceSerializer.serialize(page)}`,\n );\n }\n }\n return result;\n }\n\n // TODO: reduce the number of statements in the following method and reactivate the disabled eslint rule.\n // eslint-disable-next-line max-statements\n private async fetchNodes(\n currentId: string,\n headers: { Accept: string; Authorization?: string },\n offset: number,\n ): Promise<Array<NavigationTreeNode>> {\n const nodes: Array<NavigationTreeNode> = [];\n const baseXWikiURL = this.cristalApp\n .getWikiConfig()\n .baseURL.replace(/\\/[^/]*$/, \"\");\n\n const navigationTreeRequestUrl = new URL(\n `${this.cristalApp.getWikiConfig().baseURL}/bin/get`,\n );\n navigationTreeRequestUrl.search = new URLSearchParams([\n [\"id\", currentId],\n [\"outputSyntax\", \"plain\"],\n [\"sheet\", \"XWiki.DocumentTree\"],\n [\"data\", \"children\"],\n [\"compact\", \"true\"],\n [\"offset\", offset.toString()],\n [\"showTranslations\", \"false\"],\n [\"showAttachments\", \"false\"],\n ]).toString();\n\n const response = await fetch(navigationTreeRequestUrl, { headers });\n const jsonResponse: [\n {\n id: string;\n text: string;\n children: boolean;\n data: { type: string; offset: number };\n a_attr?: { href: string };\n },\n ] = await response.json();\n for (const treeNode of jsonResponse) {\n if (treeNode.id == \"pagination:wiki:xwiki\") {\n nodes.push(\n ...(await this.fetchNodes(currentId, headers, treeNode.data.offset)),\n );\n } else if (\n ![\"attachments\", \"translations\"].includes(treeNode.data.type) &&\n treeNode.a_attr\n ) {\n const documentReference = this.urlParser.parse(\n `${baseXWikiURL}${treeNode.a_attr.href}`,\n )! as DocumentReference;\n nodes.push({\n id: treeNode.id,\n label: treeNode.text,\n location: documentReference.space!,\n url: this.cristalApp.getRouter().resolve({\n name: \"view\",\n params: {\n page: this.referenceSerializer.serialize(documentReference),\n },\n }).href,\n has_children: treeNode.children,\n is_terminal: !treeNode.id.endsWith(\".WebHome\"),\n });\n }\n }\n\n return nodes;\n }\n}\n\nexport class ComponentInit {\n constructor(container: Container) {\n container\n .bind<NavigationTreeSource>(NavigationTreeSourceName)\n .to(XWikiNavigationTreeSource)\n .inSingletonScope()\n .whenNamed(\"XWiki\");\n }\n}\n"],"names":["XWikiNavigationTreeSource","logger","cristalApp","authenticationManagerProvider","urlParser","referenceSerializer","id","currentId","navigationTree","authorization","headers","error","page","includeTerminal","includeRootNode","result","currentParent","parent","offset","nodes","baseXWikiURL","navigationTreeRequestUrl","jsonResponse","treeNode","documentReference","__decorateClass","injectable","__decorateParam","ComponentInit","container","NavigationTreeSourceName"],"mappings":"4jBAsCA,IAAMA,EAAN,KAAgE,CAC9D,YACqCC,EACIC,EAE/BC,EAGSC,EAGAC,EACjB,CAVmC,KAAA,OAAAJ,EACI,KAAA,WAAAC,EAE/B,KAAA,8BAAAC,EAGS,KAAA,UAAAC,EAGA,KAAA,oBAAAC,EAEjB,KAAK,OAAO,UACV,4DAAA,CAEJ,CAIA,MAAM,cAAcC,EAAiD,CACnE,MAAMC,EAAYD,GAAU,IACtBE,EAA4C,CAAA,EAElD,GAAI,CACF,MAAMC,EAAgB,MAAM,KAAK,8BAC9B,IAAA,GACC,uBAAA,EACEC,EAAsD,CAC1D,OAAQ,kBAAA,EAGND,IACFC,EAAQ,cAAgBD,GAG1BD,EAAe,KAAK,GAAI,MAAM,KAAK,WAAWD,EAAWG,EAAS,CAAC,CAAE,CACvE,OAASC,EAAO,CACd,KA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vC,GAAGJ,CAAY,GAAGG,EAAS,OAAO,IAAI,EAAA,EAExCJ,EAAM,KAAK,CACT,GAAII,EAAS,GACb,MAAOA,EAAS,KAChB,SAAUC,EAAkB,MAC5B,IAAK,KAAK,WAAW,UAAA,EAAY,QAAQ,CACvC,KAAM,OACN,OAAQ,CACN,KAAM,KAAK,oBAAoB,UAAUA,CAAiB,CAAA,CAC5D,CACD,EAAE,KACH,aAAcD,EAAS,SACvB,YAAa,CAACA,EAAS,GAAG,SAAS,UAAU,CAAA,CAC9C,CACH,CAGF,OAAOJ,CACT,CACF,EArIMnB,EAANyB,EAAA,CADCC,aAAA,EAGIC,aAAO,QAAQ,CAAA,EACfA,aAAO,YAAY,CAAA,EACnBA,aAAO,+BAA+B,CAAA,EAEtCA,aAAO,iBAAiB,CAAA,EACxBA,YAAM,OAAO,CAAA,EAEbA,aAAO,0BAA0B,CAAA,EACjCA,YAAM,OAAO,CAAA,CAAA,EAVZ3B,CAAA,EAuIC,MAAM4B,CAAc,CACzB,YAAYC,EAAsB,CAChCA,EACG,KAA2BC,EAAAA,IAAwB,EACnD,GAAG9B,CAAyB,EAC5B,iBAAA,EACA,UAAU,OAAO,CACtB,CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-navigation-tree-xwiki",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -27,12 +27,12 @@
27
27
  },
28
28
  "main": "./dist/index.es.js",
29
29
  "dependencies": {
30
- "@xwiki/cristal-api": "0.21.0",
31
- "@xwiki/cristal-model-remote-url-api": "0.21.0",
32
- "@xwiki/cristal-navigation-tree-api": "0.21.0",
33
- "@xwiki/cristal-authentication-api": "0.21.0",
34
- "@xwiki/cristal-model-api": "0.21.0",
35
- "@xwiki/cristal-model-reference-api": "0.21.0"
30
+ "@xwiki/cristal-api": "0.21.1",
31
+ "@xwiki/cristal-authentication-api": "0.21.1",
32
+ "@xwiki/cristal-model-api": "0.21.1",
33
+ "@xwiki/cristal-model-remote-url-api": "0.21.1",
34
+ "@xwiki/cristal-navigation-tree-api": "0.21.1",
35
+ "@xwiki/cristal-model-reference-api": "0.21.1"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "inversify": "7.x",
@@ -43,7 +43,7 @@
43
43
  "reflect-metadata": "0.2.2",
44
44
  "typescript": "5.9.2",
45
45
  "vite": "7.0.6",
46
- "@xwiki/cristal-dev-config": "0.21.0"
46
+ "@xwiki/cristal-dev-config": "0.21.1"
47
47
  },
48
48
  "scripts": {
49
49
  "build": "tsc --project tsconfig.json && vite build",