@xwiki/cristal-electron-authentication-github-renderer 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @xwiki/cristal-electron-authentication-github-renderer
2
2
 
3
+ ## 0.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Cristal 0.22 Release
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @xwiki/cristal-api@0.22.0
13
+ - @xwiki/cristal-authentication-api@0.22.0
14
+ - @xwiki/cristal-authentication-github-state@0.22.0
15
+
3
16
  ## 0.21.0
4
17
 
5
18
  ### Minor Changes
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../../api-extractor.json"
4
+ }
@@ -1,6 +1,6 @@
1
- import { UserDetails, AuthenticationManager } from '@xwiki/cristal-authentication-api';
2
1
  import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
3
2
  import { CristalApp } from '@xwiki/cristal-api';
3
+ import { AuthenticationManager, UserDetails } from '@xwiki/cristal-authentication-api';
4
4
  declare class GitHubAuthenticationManager implements AuthenticationManager {
5
5
  private readonly cristalApp;
6
6
  private readonly authenticationState;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
2
2
  import { Container } from 'inversify';
3
+ /**
4
+ * @beta
5
+ */
3
6
  declare class ComponentInit {
4
7
  constructor(container: Container);
5
8
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
2
2
  import { Container } from 'inversify';
3
+ /**
4
+ * @beta
5
+ */
3
6
  declare class ComponentInit {
4
7
  constructor(container: Container);
5
8
  }
package/dist/index.es.js CHANGED
@@ -1,209 +1,35 @@
1
- import { GitHubAuthenticationState as G } from "@xwiki/cristal-authentication-github-state";
2
- import { GitHubAuthenticationState as tt } from "@xwiki/cristal-authentication-github-state";
3
- function b(t, n, e) {
4
- return Reflect.getOwnMetadata(n, t, e);
5
- }
6
- function E(t, n, e, o) {
7
- Reflect.defineMetadata(n, e, t, o);
8
- }
9
- function m(t, n, e, o, r) {
10
- const i = o(b(t, n, r) ?? e());
11
- Reflect.defineMetadata(n, i, t, r);
12
- }
13
- var D, A, $;
14
- (function(t) {
15
- t.moduleId = "moduleId", t.serviceId = "serviceId";
16
- })(D || (D = {}));
17
- (function(t) {
18
- t.id = "id", t.moduleId = "moduleId", t.serviceId = "serviceId";
19
- })(A || (A = {}));
20
- (function(t) {
21
- t.moduleId = "moduleId", t.serviceId = "serviceId";
22
- })($ || ($ = {}));
23
- const w = "@inversifyjs/core/classMetadataReflectKey";
24
- function v() {
25
- return { constructorArguments: [], lifecycle: { postConstructMethodName: void 0, preDestroyMethodName: void 0 }, properties: /* @__PURE__ */ new Map(), scope: void 0 };
26
- }
27
- const F = "@inversifyjs/core/pendingClassMetadataCountReflectKey", S = Symbol.for("@inversifyjs/core/InversifyCoreError");
28
- class u extends Error {
29
- [S];
30
- kind;
31
- constructor(n, e, o) {
32
- super(e, o), this[S] = !0, this.kind = n;
33
- }
34
- static is(n) {
35
- return typeof n == "object" && n !== null && n[S] === !0;
36
- }
37
- static isErrorOfKind(n, e) {
38
- return u.is(n) && n.kind === e;
39
- }
40
- }
41
- var l, I, f;
42
- function O() {
43
- return 0;
44
- }
45
- function T(t) {
46
- return (n) => {
47
- n !== void 0 && n.kind === I.unknown && m(t, F, O, (e) => e - 1);
48
- };
49
- }
50
- function K(t, n) {
51
- return (...e) => (o) => {
52
- if (o === void 0) return t(...e);
53
- if (o.kind === f.unmanaged) throw new u(l.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
54
- return n(o, ...e);
55
- };
56
- }
57
- function P(t) {
58
- if (t.kind !== I.unknown && t.isFromTypescriptParamType !== !0) throw new u(l.injectionDecoratorConflict, "Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");
59
- }
60
- (function(t) {
61
- t[t.injectionDecoratorConflict = 0] = "injectionDecoratorConflict", t[t.missingInjectionDecorator = 1] = "missingInjectionDecorator", t[t.planning = 2] = "planning", t[t.resolution = 3] = "resolution", t[t.unknown = 4] = "unknown";
62
- })(l || (l = {})), function(t) {
63
- t[t.unknown = 32] = "unknown";
64
- }(I || (I = {})), function(t) {
65
- t[t.multipleInjection = 0] = "multipleInjection", t[t.singleInjection = 1] = "singleInjection", t[t.unmanaged = 2] = "unmanaged";
66
- }(f || (f = {}));
67
- const B = K(function(t, n, e) {
68
- return t === f.multipleInjection ? { chained: e?.chained ?? !1, kind: t, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: n } : { kind: t, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: n };
69
- }, function(t, n, e, o) {
70
- return P(t), n === f.multipleInjection ? { ...t, chained: o?.chained ?? !1, kind: n, value: e } : { ...t, kind: n, value: e };
71
- });
72
- function x(t, n) {
73
- return (e) => {
74
- const o = e.properties.get(n);
75
- return e.properties.set(n, t(o)), e;
76
- };
77
- }
78
- var d;
79
- function L(t, n, e, o) {
80
- if (u.isErrorOfKind(o, l.injectionDecoratorConflict)) {
81
- const r = function(i, a, c) {
82
- if (c === void 0) {
83
- if (a === void 0) throw new u(l.unknown, "Unexpected undefined property and index values");
84
- return { kind: d.property, property: a, targetClass: i.constructor };
85
- }
86
- return typeof c == "number" ? { index: c, kind: d.parameter, targetClass: i } : { kind: d.method, method: a, targetClass: i };
87
- }(t, n, e);
88
- throw new u(l.injectionDecoratorConflict, `Unexpected injection error.
89
-
90
- Cause:
91
-
92
- ${o.message}
93
-
94
- Details
95
-
96
- ${function(i) {
97
- switch (i.kind) {
98
- case d.method:
99
- return `[class: "${i.targetClass.name}", method: "${i.method.toString()}"]`;
100
- case d.parameter:
101
- return `[class: "${i.targetClass.name}", index: "${i.index.toString()}"]`;
102
- case d.property:
103
- return `[class: "${i.targetClass.name}", property: "${i.property.toString()}"]`;
104
- }
105
- }(r)}`, { cause: o });
106
- }
107
- throw o;
108
- }
109
- function N(t, n) {
110
- return (e, o, r) => {
111
- try {
112
- r === void 0 ? function(i, a) {
113
- const c = C(i, a);
114
- return (s, p) => {
115
- m(s.constructor, w, v, x(c(s), p));
116
- };
117
- }(t, n)(e, o) : typeof r == "number" ? function(i, a) {
118
- const c = C(i, a);
119
- return (s, p, j) => {
120
- if (!/* @__PURE__ */ function(g, h) {
121
- return typeof g == "function" && h === void 0;
122
- }(s, p)) throw new u(l.injectionDecoratorConflict, `Found an @inject decorator in a non constructor parameter.
123
- Found @inject decorator at method "${p?.toString() ?? ""}" at class "${s.constructor.name}"`);
124
- m(s, w, v, /* @__PURE__ */ function(g, h) {
125
- return (y) => {
126
- const H = y.constructorArguments[h];
127
- return y.constructorArguments[h] = g(H), y;
128
- };
129
- }(c(s), j));
130
- };
131
- }(t, n)(e, o, r) : function(i, a) {
132
- const c = C(i, a);
133
- return (s, p, j) => {
134
- if (!function(g) {
135
- return g.set !== void 0;
136
- }(j)) throw new u(l.injectionDecoratorConflict, `Found an @inject decorator in a non setter property method.
137
- Found @inject decorator at method "${p.toString()}" at class "${s.constructor.name}"`);
138
- m(s.constructor, w, v, x(c(s), p));
139
- };
140
- }(t, n)(e, o, r);
141
- } catch (i) {
142
- L(e, o, r, i);
143
- }
144
- };
145
- }
146
- function C(t, n) {
147
- return (e) => {
148
- const o = n(e);
149
- return (r) => (o(r), t(r));
150
- };
151
- }
152
- function M(t) {
153
- return N(B(f.singleInjection, t), T);
154
- }
155
- (function(t) {
156
- t[t.method = 0] = "method", t[t.parameter = 1] = "parameter", t[t.property = 2] = "property";
157
- })(d || (d = {}));
158
- const U = "@inversifyjs/core/classIsInjectableFlagReflectKey", z = [Array, BigInt, Boolean, Function, Number, Object, String];
159
- function V(t) {
160
- const n = b(t, "design:paramtypes");
161
- n !== void 0 && m(t, w, v, /* @__PURE__ */ function(e) {
162
- return (o) => (e.forEach((r, i) => {
163
- var a;
164
- o.constructorArguments[i] !== void 0 || (a = r, z.includes(a)) || (o.constructorArguments[i] = function(c) {
165
- return { isFromTypescriptParamType: !0, kind: f.singleInjection, name: void 0, optional: !1, tags: /* @__PURE__ */ new Map(), value: c };
166
- }(r));
167
- }), o);
168
- }(n));
169
- }
170
- function W(t) {
171
- return (n) => {
172
- (function(e) {
173
- if (b(e, U) !== void 0) throw new u(l.injectionDecoratorConflict, `Cannot apply @injectable decorator multiple times at class "${e.name}"`);
174
- E(e, U, !0);
175
- })(n), V(n);
176
- };
177
- }
178
- var _;
179
- (function(t) {
180
- t[t.multipleInjection = 0] = "multipleInjection", t[t.singleInjection = 1] = "singleInjection";
181
- })(_ || (_ = {}));
182
- var q = Object.getOwnPropertyDescriptor, J = (t, n, e, o) => {
183
- for (var r = o > 1 ? void 0 : o ? q(n, e) : n, i = t.length - 1, a; i >= 0; i--)
184
- (a = t[i]) && (r = a(r) || r);
185
- return r;
186
- }, R = (t, n) => (e, o) => n(e, o, t);
187
- let k = class {
188
- constructor(t, n) {
189
- this.cristalApp = t, this.authenticationState = n, this.localStorageDeviceCode = "authentication.device_code", this.localStorageUserCode = "authentication.user_code", this.localStorageExpiresIn = "authentication.expires_in", this.localStorageInterval = "authentication.interval";
1
+ import { GitHubAuthenticationState as u } from "@xwiki/cristal-authentication-github-state";
2
+ import { GitHubAuthenticationState as I } from "@xwiki/cristal-authentication-github-state";
3
+ import { injectable as g, inject as s } from "inversify";
4
+ var h = Object.getOwnPropertyDescriptor, d = (e, t, a, i) => {
5
+ for (var o = i > 1 ? void 0 : i ? h(t, a) : t, n = e.length - 1, c; n >= 0; n--)
6
+ (c = e[n]) && (o = c(o) || o);
7
+ return o;
8
+ }, l = (e, t) => (a, i) => t(a, i, e);
9
+ let r = class {
10
+ constructor(e, t) {
11
+ this.cristalApp = e, this.authenticationState = t;
190
12
  }
13
+ localStorageDeviceCode = "authentication.device_code";
14
+ localStorageUserCode = "authentication.user_code";
15
+ localStorageExpiresIn = "authentication.expires_in";
16
+ localStorageInterval = "authentication.interval";
191
17
  async start() {
192
- const t = new URL(
18
+ const e = new URL(
193
19
  `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`
194
- ), e = await (await fetch(t)).json();
20
+ ), a = await (await fetch(e)).json();
195
21
  window.localStorage.setItem(
196
22
  this.localStorageDeviceCode,
197
- e.device_code
23
+ a.device_code
198
24
  ), window.localStorage.setItem(
199
25
  this.localStorageUserCode,
200
- e.user_code
26
+ a.user_code
201
27
  ), window.localStorage.setItem(
202
28
  this.localStorageExpiresIn,
203
- e.expires_in.toString()
29
+ a.expires_in.toString()
204
30
  ), window.localStorage.setItem(
205
31
  this.localStorageInterval,
206
- e.interval.toString()
32
+ a.interval.toString()
207
33
  ), this.authenticationState.modalOpened.value = !0;
208
34
  }
209
35
  async callback() {
@@ -216,8 +42,8 @@ let k = class {
216
42
  }
217
43
  async getAuthorizationHeader() {
218
44
  if (await this.isAuthenticated()) {
219
- const { tokenType: n, accessToken: e } = await window.authenticationGitHub.getAuthorizationValue();
220
- return `${n} ${e}`;
45
+ const { tokenType: t, accessToken: a } = await window.authenticationGitHub.getAuthorizationValue();
46
+ return `${t} ${a}`;
221
47
  }
222
48
  }
223
49
  async isAuthenticated() {
@@ -230,18 +56,18 @@ let k = class {
230
56
  await window.authenticationGitHub.logout();
231
57
  }
232
58
  };
233
- k = J([
234
- W(),
235
- R(0, M("CristalApp")),
236
- R(1, M(G))
237
- ], k);
238
- class X {
239
- constructor(n) {
240
- n.bind("AuthenticationManager").to(k).inSingletonScope().whenNamed("GitHub"), n.bind(G).toSelf().inSingletonScope();
59
+ r = d([
60
+ g(),
61
+ l(0, s("CristalApp")),
62
+ l(1, s(u))
63
+ ], r);
64
+ class p {
65
+ constructor(t) {
66
+ t.bind("AuthenticationManager").to(r).inSingletonScope().whenNamed("GitHub"), t.bind(u).toSelf().inSingletonScope();
241
67
  }
242
68
  }
243
69
  export {
244
- X as ComponentInit,
245
- tt as GitHubAuthenticationState
70
+ p as ComponentInit,
71
+ I as GitHubAuthenticationState
246
72
  };
247
73
  //# 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/GitHubAuthenticationManager.ts","../src/index.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 { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\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 { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["c","r","u","i","f","a","v","h","e","S","C","N","T","j","t","n","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","q","G","de","GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":";;AAAsK,SAASA,EAAE,GAAE,GAAE,GAAE;AAAC,SAAO,QAAQ,eAAe,GAAE,GAAE,CAAC;AAAC;AAAqD,SAASC,EAAE,GAAE,GAAE,GAAEC,GAAE;AAAC,UAAQ,eAAe,GAAE,GAAE,GAAEA,CAAC;AAAC;AAAC,SAASC,EAAE,GAAE,GAAE,GAAED,GAAEE,GAAE;AAAC,QAAMC,IAAEH,EAAEF,EAAE,GAAE,GAAEI,CAAC,KAAG,EAAC,CAAE;AAAE,UAAQ,eAAe,GAAEC,GAAE,GAAED,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;AAAC,EAAAA,EAAE,KAAG,MAAKA,EAAE,WAAS,YAAWA,EAAE,YAAU;AAAW,GAAEF,MAAIA,IAAE,CAAA,EAAG;AAAA,CAAgrC,SAASE,GAAE;AAAC,EAAAA,EAAE,WAAS,YAAWA,EAAE,YAAU;AAAW,GAAED,MAAIA,IAAE,CAAA,EAAG;AAAmqB,MAAME,IAAE;AAA4C,SAASC,IAAG;AAAC,SAAM,EAAC,sBAAqB,IAAG,WAAU,EAAC,yBAAwB,QAAO,sBAAqB,OAAM,GAAE,YAAW,oBAAI,OAAI,OAAM,OAAM;AAAC;AAAC,MAAMC,IAAE,yDAA8DC,IAAE,OAAO,IAAI,sCAAsC;AAAE,M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AAK,oBAAoB;AAAA,MACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB;AAAA,IAAA;AAAA,EAE1D;AAAA,EAEA,MAAM,yBAAsD;AAE1D,QADsB,MAAM,KAAK,gBAAA,GACd;AACjB,YAAM,EAAE,WAAAC,GAAW,aAAAC,EAAA,IACjB,MAAM,OAAO,qBAAqB,sBAAA;AACpC,aAAO,GAAGD,CAAS,IAAIC,CAAW;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,kBAAoC;AACxC,WAAO,OAAO,qBAAqB,WAAA;AAAA,EACrC;AAAA,EAEA,MAAM,iBAAuC;AAC3C,WAAO,OAAO,qBAAqB,eAAA;AAAA,EACrC;AAAA,EAEA,MAAM,SAAwB;AAC5B,UAAM,OAAO,qBAAqB,OAAA;AAAA,EACpC;AACF;AA5EMN,IAANO,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAOC,CAAyB,CAAA;AAAA,GAH/BV,CAAA;ACzBN,MAAMW,EAAc;AAAA,EAClB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,GACrBY,EACG,KAAgCF,CAAyB,EACzD,OAAA,EACA,iBAAA;AAAA,EACL;AACF;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.es.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.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 { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type {\n AuthenticationManager,\n UserDetails,\n} from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\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 { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":";;;;;;;;AAoDA,IAAMA,IAAN,MAAmE;AAAA,EACjE,YACyCC,GAEtBC,GACjB;AAHuC,SAAA,aAAAD,GAEtB,KAAA,sBAAAC;AAAA,EAChB;AAAA,EAEc,yBAAyB;AAAA,EAEzB,uBAAuB;AAAA,EAEvB,wBAAwB;AAAA,EAExB,uBAAuB;AAAA,EAExC,MAAM,QAAuB;AAC3B,UAAMC,IAAmB,IAAI;AAAA,MAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB;AAAA,IAAA,GAIpDC,IAKF,OANa,MAAM,MAAMD,CAAgB,GAM1B,KAAA;AAEnB,WAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLC,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa;AAAA,IAAA,GAEf,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,WAAW,SAAA;AAAA,IAAS,GAEnC,OAAO,aAAa;AAAA,MAClB,KAAK;AAAA,MACLA,EAAa,SAAS,SAAA;AAAA,IAAS,GAEjC,KAAK,oBAAoB,YAAY,QAAQ;AAAA,EAC/C;AAAA,EAEA,MAAM,WAA0B;AAC9B,WAAO,OAAO,qBAAqB;AAAA,MACjC,KAAK,WAAW,cAAA,EAAgB;AAAA,MAChC,OAAO,aAAa,QAAQ,KAAK,sBAAsB;AAAA,MACvD,OAAO,aAAa,QAAQ,KAAK,oBAAoB;AAAA,MACrD,OAAO,aAAa,QAAQ,KAAK,qBAAqB;AAAA,IAAA;AAAA,EAE1D;AAAA,EAEA,MAAM,yBAAsD;AAE1D,QADsB,MAAM,KAAK,gBAAA,GACd;AACjB,YAAM,EAAE,WAAAC,GAAW,aAAAC,EAAA,IACjB,MAAM,OAAO,qBAAqB,sBAAA;AACpC,aAAO,GAAGD,CAAS,IAAIC,CAAW;AAAA,IACpC;AAAA,EACF;AAAA,EAEA,MAAM,kBAAoC;AACxC,WAAO,OAAO,qBAAqB,WAAA;AAAA,EACrC;AAAA,EAEA,MAAM,iBAAuC;AAC3C,WAAO,OAAO,qBAAqB,eAAA;AAAA,EACrC;AAAA,EAEA,MAAM,SAAwB;AAC5B,UAAM,OAAO,qBAAqB,OAAA;AAAA,EACpC;AACF;AA5EMN,IAANO,EAAA;AAAA,EADCC,EAAA;AAAA,EAGIC,OAAO,YAAY,CAAA;AAAA,EACnBA,OAAOC,CAAyB,CAAA;AAAA,GAH/BV,CAAA;ACxBN,MAAMW,EAAc;AAAA,EAClB,YAAYC,GAAsB;AAChC,IAAAA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,GACrBY,EACG,KAAgCF,CAAyB,EACzD,OAAA,EACA,iBAAA;AAAA,EACL;AACF;"}
package/dist/index.umd.js CHANGED
@@ -1,12 +1,2 @@
1
- (function(d,p){typeof exports=="object"&&typeof module<"u"?p(exports,require("@xwiki/cristal-authentication-github-state")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-authentication-github-state"],p):(d=typeof globalThis<"u"?globalThis:d||self,p(d["cristal_authentication-github-renderer"]={},d.cristalAuthenticationGithubState))})(this,function(d,p){"use strict";function S(t,n,e){return Reflect.getOwnMetadata(n,t,e)}function R(t,n,e,o){Reflect.defineMetadata(n,e,t,o)}function m(t,n,e,o,r){const i=o(S(t,n,r)??e());Reflect.defineMetadata(n,i,t,r)}var $,x,M;(function(t){t.moduleId="moduleId",t.serviceId="serviceId"})($||($={})),function(t){t.id="id",t.moduleId="moduleId",t.serviceId="serviceId"}(x||(x={})),function(t){t.moduleId="moduleId",t.serviceId="serviceId"}(M||(M={}));const v="@inversifyjs/core/classMetadataReflectKey";function j(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const T="@inversifyjs/core/pendingClassMetadataCountReflectKey",C=Symbol.for("@inversifyjs/core/InversifyCoreError");class u extends Error{[C];kind;constructor(n,e,o){super(e,o),this[C]=!0,this.kind=n}static is(n){return typeof n=="object"&&n!==null&&n[C]===!0}static isErrorOfKind(n,e){return u.is(n)&&n.kind===e}}var l,I,g;function E(){return 0}function F(t){return n=>{n!==void 0&&n.kind===I.unknown&&m(t,T,E,e=>e-1)}}function P(t,n){return(...e)=>o=>{if(o===void 0)return t(...e);if(o.kind===g.unmanaged)throw new u(l.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return n(o,...e)}}function K(t){if(t.kind!==I.unknown&&t.isFromTypescriptParamType!==!0)throw new u(l.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(function(t){t[t.injectionDecoratorConflict=0]="injectionDecoratorConflict",t[t.missingInjectionDecorator=1]="missingInjectionDecorator",t[t.planning=2]="planning",t[t.resolution=3]="resolution",t[t.unknown=4]="unknown"})(l||(l={})),function(t){t[t.unknown=32]="unknown"}(I||(I={})),function(t){t[t.multipleInjection=0]="multipleInjection",t[t.singleInjection=1]="singleInjection",t[t.unmanaged=2]="unmanaged"}(g||(g={}));const B=P(function(t,n,e){return t===g.multipleInjection?{chained:e?.chained??!1,kind:t,name:void 0,optional:!1,tags:new Map,value:n}:{kind:t,name:void 0,optional:!1,tags:new Map,value:n}},function(t,n,e,o){return K(t),n===g.multipleInjection?{...t,chained:o?.chained??!1,kind:n,value:e}:{...t,kind:n,value:e}});function U(t,n){return e=>{const o=e.properties.get(n);return e.properties.set(n,t(o)),e}}var f;function L(t,n,e,o){if(u.isErrorOfKind(o,l.injectionDecoratorConflict)){const r=function(i,a,c){if(c===void 0){if(a===void 0)throw new u(l.unknown,"Unexpected undefined property and index values");return{kind:f.property,property:a,targetClass:i.constructor}}return typeof c=="number"?{index:c,kind:f.parameter,targetClass:i}:{kind:f.method,method:a,targetClass:i}}(t,n,e);throw new u(l.injectionDecoratorConflict,`Unexpected injection error.
2
-
3
- Cause:
4
-
5
- ${o.message}
6
-
7
- Details
8
-
9
- ${function(i){switch(i.kind){case f.method:return`[class: "${i.targetClass.name}", method: "${i.method.toString()}"]`;case f.parameter:return`[class: "${i.targetClass.name}", index: "${i.index.toString()}"]`;case f.property:return`[class: "${i.targetClass.name}", property: "${i.property.toString()}"]`}}(r)}`,{cause:o})}throw o}function N(t,n){return(e,o,r)=>{try{r===void 0?function(i,a){const c=b(i,a);return(s,h)=>{m(s.constructor,v,j,U(c(s),h))}}(t,n)(e,o):typeof r=="number"?function(i,a){const c=b(i,a);return(s,h,D)=>{if(!function(w,y){return typeof w=="function"&&y===void 0}(s,h))throw new u(l.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
10
- Found @inject decorator at method "${h?.toString()??""}" at class "${s.constructor.name}"`);m(s,v,j,function(w,y){return A=>{const X=A.constructorArguments[y];return A.constructorArguments[y]=w(X),A}}(c(s),D))}}(t,n)(e,o,r):function(i,a){const c=b(i,a);return(s,h,D)=>{if(!function(w){return w.set!==void 0}(D))throw new u(l.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
11
- Found @inject decorator at method "${h.toString()}" at class "${s.constructor.name}"`);m(s.constructor,v,j,U(c(s),h))}}(t,n)(e,o,r)}catch(i){L(e,o,r,i)}}}function b(t,n){return e=>{const o=n(e);return r=>(o(r),t(r))}}function _(t){return N(B(g.singleInjection,t),F)}(function(t){t[t.method=0]="method",t[t.parameter=1]="parameter",t[t.property=2]="property"})(f||(f={}));const H="@inversifyjs/core/classIsInjectableFlagReflectKey",z=[Array,BigInt,Boolean,Function,Number,Object,String];function q(t){const n=S(t,"design:paramtypes");n!==void 0&&m(t,v,j,function(e){return o=>(e.forEach((r,i)=>{var a;o.constructorArguments[i]!==void 0||(a=r,z.includes(a))||(o.constructorArguments[i]=function(c){return{isFromTypescriptParamType:!0,kind:g.singleInjection,name:void 0,optional:!1,tags:new Map,value:c}}(r))}),o)}(n))}function V(t){return n=>{(function(e){if(S(e,H)!==void 0)throw new u(l.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);R(e,H,!0)})(n),q(n)}}var G;(function(t){t[t.multipleInjection=0]="multipleInjection",t[t.singleInjection=1]="singleInjection"})(G||(G={}));var W=Object.getOwnPropertyDescriptor,J=(t,n,e,o)=>{for(var r=o>1?void 0:o?W(n,e):n,i=t.length-1,a;i>=0;i--)(a=t[i])&&(r=a(r)||r);return r},O=(t,n)=>(e,o)=>n(e,o,t);let k=class{constructor(t,n){this.cristalApp=t,this.authenticationState=n,this.localStorageDeviceCode="authentication.device_code",this.localStorageUserCode="authentication.user_code",this.localStorageExpiresIn="authentication.expires_in",this.localStorageInterval="authentication.interval"}async start(){const t=new URL(`${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`),e=await(await fetch(t)).json();window.localStorage.setItem(this.localStorageDeviceCode,e.device_code),window.localStorage.setItem(this.localStorageUserCode,e.user_code),window.localStorage.setItem(this.localStorageExpiresIn,e.expires_in.toString()),window.localStorage.setItem(this.localStorageInterval,e.interval.toString()),this.authenticationState.modalOpened.value=!0}async callback(){return window.authenticationGitHub.login(this.cristalApp.getWikiConfig().authenticationBaseURL,window.localStorage.getItem(this.localStorageDeviceCode),window.localStorage.getItem(this.localStorageInterval),window.localStorage.getItem(this.localStorageExpiresIn))}async getAuthorizationHeader(){if(await this.isAuthenticated()){const{tokenType:n,accessToken:e}=await window.authenticationGitHub.getAuthorizationValue();return`${n} ${e}`}}async isAuthenticated(){return window.authenticationGitHub.isLoggedIn()}async getUserDetails(){return window.authenticationGitHub.getUserDetails()}async logout(){await window.authenticationGitHub.logout()}};k=J([V(),O(0,_("CristalApp")),O(1,_(p.GitHubAuthenticationState))],k);class Q{constructor(n){n.bind("AuthenticationManager").to(k).inSingletonScope().whenNamed("GitHub"),n.bind(p.GitHubAuthenticationState).toSelf().inSingletonScope()}}Object.defineProperty(d,"GitHubAuthenticationState",{enumerable:!0,get:()=>p.GitHubAuthenticationState}),d.ComponentInit=Q,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
1
+ (function(n,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@xwiki/cristal-authentication-github-state"),require("inversify")):typeof define=="function"&&define.amd?define(["exports","@xwiki/cristal-authentication-github-state","inversify"],a):(n=typeof globalThis<"u"?globalThis:n||self,a(n["cristal_authentication-github-renderer"]={},n.cristalAuthenticationGithubState,n.inversify))})(this,(function(n,a,r){"use strict";var d=Object.getOwnPropertyDescriptor,g=(e,t,i,o)=>{for(var c=o>1?void 0:o?d(t,i):t,l=e.length-1,h;l>=0;l--)(h=e[l])&&(c=h(c)||c);return c},u=(e,t)=>(i,o)=>t(i,o,e);let s=class{constructor(e,t){this.cristalApp=e,this.authenticationState=t}localStorageDeviceCode="authentication.device_code";localStorageUserCode="authentication.user_code";localStorageExpiresIn="authentication.expires_in";localStorageInterval="authentication.interval";async start(){const e=new URL(`${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`),i=await(await fetch(e)).json();window.localStorage.setItem(this.localStorageDeviceCode,i.device_code),window.localStorage.setItem(this.localStorageUserCode,i.user_code),window.localStorage.setItem(this.localStorageExpiresIn,i.expires_in.toString()),window.localStorage.setItem(this.localStorageInterval,i.interval.toString()),this.authenticationState.modalOpened.value=!0}async callback(){return window.authenticationGitHub.login(this.cristalApp.getWikiConfig().authenticationBaseURL,window.localStorage.getItem(this.localStorageDeviceCode),window.localStorage.getItem(this.localStorageInterval),window.localStorage.getItem(this.localStorageExpiresIn))}async getAuthorizationHeader(){if(await this.isAuthenticated()){const{tokenType:t,accessToken:i}=await window.authenticationGitHub.getAuthorizationValue();return`${t} ${i}`}}async isAuthenticated(){return window.authenticationGitHub.isLoggedIn()}async getUserDetails(){return window.authenticationGitHub.getUserDetails()}async logout(){await window.authenticationGitHub.logout()}};s=g([r.injectable(),u(0,r.inject("CristalApp")),u(1,r.inject(a.GitHubAuthenticationState))],s);class w{constructor(t){t.bind("AuthenticationManager").to(s).inSingletonScope().whenNamed("GitHub"),t.bind(a.GitHubAuthenticationState).toSelf().inSingletonScope()}}Object.defineProperty(n,"GitHubAuthenticationState",{enumerable:!0,get:()=>a.GitHubAuthenticationState}),n.ComponentInit=w,Object.defineProperty(n,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/GitHubAuthenticationManager.ts","../src/index.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 { UserDetails } from \"@xwiki/cristal-authentication-api\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\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 { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["c","r","u","i","f","a","v","h","e","S","C","N","T","j","t","n","P","A","R","B","$","D","k","F","V","O","E","o","_","U","z","K","L","G","de","GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":"yYAAsK,SAASA,EAAE,EAAE,EAAE,EAAE,CAAC,OAAO,QAAQ,eAAe,EAAE,EAAE,CAAC,CAAC,CAAqD,SAASC,EAAE,EAAE,EAAE,EAAEC,EAAE,CAAC,QAAQ,eAAe,EAAE,EAAE,EAAEA,CAAC,CAAC,CAAC,SAASC,EAAE,EAAE,EAAE,EAAED,EAAEE,EAAE,CAAC,MAAMC,EAAEH,EAAEF,EAAE,EAAE,EAAEI,CAAC,GAAG,EAAC,CAAE,EAAE,QAAQ,eAAe,EAAEC,EAAE,EAAED,CAAC,CAAC,CCA2nE,IAAIA,EAAEE,EAAEC,GAAG,SAASC,EAAE,CAACA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,GAAEJ,IAAIA,EAAE,CAAA,EAAG,EAA4oE,SAASI,EAAE,CAACA,EAAE,GAAG,KAAKA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,EAAEF,IAAIA,EAAE,CAAA,EAAG,EAAgrC,SAASE,EAAE,CAACA,EAAE,SAAS,WAAWA,EAAE,UAAU,WAAW,EAAED,IAAIA,EAAE,CAAA,EAAG,EAAmqB,MAAME,EAAE,4CAA4C,SAASC,GAAG,CAAC,MAAM,CAAC,qBAAqB,GAAG,UAAU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M,OAAO,qBAAqB,OAAA,CACpC,CACF,EA5EMN,EAANO,EAAA,CADCC,EAAA,EAGIC,MAAO,YAAY,CAAA,EACnBA,MAAOC,2BAAyB,CAAA,CAAA,EAH/BV,CAAA,ECzBN,MAAMW,CAAc,CAClB,YAAYC,EAAsB,CAChCA,EACG,KAA4B,uBAAuB,EACnD,GAAGZ,CAA2B,EAC9B,iBAAA,EACA,UAAU,QAAQ,EACrBY,EACG,KAAgCF,EAAAA,yBAAyB,EACzD,OAAA,EACA,iBAAA,CACL,CACF","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.umd.js","sources":["../src/GitHubAuthenticationManager.ts","../src/index.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 { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport { inject, injectable } from \"inversify\";\nimport type { CristalApp } from \"@xwiki/cristal-api\";\nimport type {\n AuthenticationManager,\n UserDetails,\n} from \"@xwiki/cristal-authentication-api\";\n\ninterface AuthenticationWindow extends Window {\n authenticationGitHub: {\n login: (\n baseUrl: string,\n deviceCode: string,\n interval: string,\n expiresIn: string,\n ) => Promise<void>;\n\n isLoggedIn(): Promise<boolean>;\n\n getUserDetails(): Promise<UserDetails>;\n\n getAuthorizationValue(): Promise<{\n tokenType: string;\n accessToken: string;\n }>;\n\n logout(): Promise<void>;\n };\n}\ndeclare const window: AuthenticationWindow;\n\n@injectable()\nclass GitHubAuthenticationManager implements AuthenticationManager {\n constructor(\n @inject(\"CristalApp\") private readonly cristalApp: CristalApp,\n @inject(GitHubAuthenticationState)\n private readonly authenticationState: GitHubAuthenticationState,\n ) {}\n\n private readonly localStorageDeviceCode = \"authentication.device_code\";\n\n private readonly localStorageUserCode = \"authentication.user_code\";\n\n private readonly localStorageExpiresIn = \"authentication.expires_in\";\n\n private readonly localStorageInterval = \"authentication.interval\";\n\n async start(): Promise<void> {\n const authorizationUrl = new URL(\n `${this.cristalApp.getWikiConfig().authenticationBaseURL}/device-login`,\n );\n\n const response = await fetch(authorizationUrl);\n const jsonResponse: {\n device_code: string;\n user_code: string;\n expires_in: number;\n interval: number;\n } = await response.json();\n\n window.localStorage.setItem(\n this.localStorageDeviceCode,\n jsonResponse.device_code,\n );\n window.localStorage.setItem(\n this.localStorageUserCode,\n jsonResponse.user_code,\n );\n window.localStorage.setItem(\n this.localStorageExpiresIn,\n jsonResponse.expires_in.toString(),\n );\n window.localStorage.setItem(\n this.localStorageInterval,\n jsonResponse.interval.toString(),\n );\n this.authenticationState.modalOpened.value = true;\n }\n\n async callback(): Promise<void> {\n return window.authenticationGitHub.login(\n this.cristalApp.getWikiConfig().authenticationBaseURL!,\n window.localStorage.getItem(this.localStorageDeviceCode)!,\n window.localStorage.getItem(this.localStorageInterval)!,\n window.localStorage.getItem(this.localStorageExpiresIn)!,\n );\n }\n\n async getAuthorizationHeader(): Promise<string | undefined> {\n const authenticated = await this.isAuthenticated();\n if (authenticated) {\n const { tokenType, accessToken } =\n await window.authenticationGitHub.getAuthorizationValue();\n return `${tokenType} ${accessToken}`;\n }\n }\n\n async isAuthenticated(): Promise<boolean> {\n return window.authenticationGitHub.isLoggedIn();\n }\n\n async getUserDetails(): Promise<UserDetails> {\n return window.authenticationGitHub.getUserDetails();\n }\n\n async logout(): Promise<void> {\n await window.authenticationGitHub.logout();\n }\n}\n\nexport { GitHubAuthenticationManager };\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 { GitHubAuthenticationManager } from \"./GitHubAuthenticationManager\";\nimport { GitHubAuthenticationState } from \"@xwiki/cristal-authentication-github-state\";\nimport type { AuthenticationManager } from \"@xwiki/cristal-authentication-api\";\nimport type { Container } from \"inversify\";\n\n/**\n * @beta\n */\nclass ComponentInit {\n constructor(container: Container) {\n container\n .bind<AuthenticationManager>(\"AuthenticationManager\")\n .to(GitHubAuthenticationManager)\n .inSingletonScope()\n .whenNamed(\"GitHub\");\n container\n .bind<GitHubAuthenticationState>(GitHubAuthenticationState)\n .toSelf()\n .inSingletonScope();\n }\n}\n\nexport { ComponentInit, GitHubAuthenticationState };\n"],"names":["GitHubAuthenticationManager","cristalApp","authenticationState","authorizationUrl","jsonResponse","tokenType","accessToken","__decorateClass","injectable","__decorateParam","GitHubAuthenticationState","ComponentInit","container"],"mappings":"8lBAoDA,IAAMA,EAAN,KAAmE,CACjE,YACyCC,EAEtBC,EACjB,CAHuC,KAAA,WAAAD,EAEtB,KAAA,oBAAAC,CAChB,CAEc,uBAAyB,6BAEzB,qBAAuB,2BAEvB,sBAAwB,4BAExB,qBAAuB,0BAExC,MAAM,OAAuB,CAC3B,MAAMC,EAAmB,IAAI,IAC3B,GAAG,KAAK,WAAW,cAAA,EAAgB,qBAAqB,eAAA,EAIpDC,EAKF,MAN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-authentication-github-renderer"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { Container } from 'inversify';
8
+ import { GitHubAuthenticationState } from '@xwiki/cristal-authentication-github-state';
9
+
10
+ // @beta (undocumented)
11
+ export class ComponentInit {
12
+ constructor(container: Container);
13
+ }
14
+
15
+ export { GitHubAuthenticationState }
16
+
17
+ // (No @packageDocumentation comment for this package)
18
+
19
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xwiki/cristal-electron-authentication-github-renderer",
3
- "version": "0.21.0",
3
+ "version": "0.22.0",
4
4
  "license": "LGPL 2.1",
5
5
  "author": "XWiki Org Community <contact@xwiki.org>",
6
6
  "homepage": "https://cristal.xwiki.org/",
@@ -26,28 +26,30 @@
26
26
  }
27
27
  },
28
28
  "main": "./dist/index.es.js",
29
+ "types": "./dist/index.d.ts",
29
30
  "dependencies": {
30
- "@xwiki/cristal-api": "0.21.0",
31
- "@xwiki/cristal-authentication-api": "0.21.0",
32
- "@xwiki/cristal-authentication-github-state": "0.21.0"
31
+ "@xwiki/cristal-authentication-github-state": "0.22.0",
32
+ "@xwiki/cristal-api": "0.22.0",
33
+ "@xwiki/cristal-authentication-api": "0.22.0"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "inversify": "7.x",
36
37
  "reflect-metadata": "0.x"
37
38
  },
38
39
  "devDependencies": {
39
- "inversify": "7.7.0",
40
+ "inversify": "7.9.0",
40
41
  "reflect-metadata": "0.2.2",
41
42
  "typescript": "5.9.2",
42
- "vite": "7.0.6",
43
- "vue": "3.5.18",
44
- "@xwiki/cristal-dev-config": "0.21.0"
43
+ "vite": "7.1.5",
44
+ "vue": "3.5.20",
45
+ "@xwiki/cristal-dev-config": "0.22.0"
45
46
  },
46
47
  "scripts": {
47
- "build": "tsc --project tsconfig.json && vite build",
48
+ "api-extractor:local": "api-extractor run --local",
49
+ "build": "vite build",
48
50
  "clean": "rimraf dist",
49
51
  "lint": "eslint \"./src/**/*.{ts,tsx,vue}\" --max-warnings=0",
50
- "test": "vitest --run"
51
- },
52
- "types": "./dist/index.d.ts"
52
+ "test": "vitest --run",
53
+ "typecheck": "tsc"
54
+ }
53
55
  }
@@ -18,11 +18,13 @@
18
18
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19
19
  */
20
20
 
21
- import { UserDetails } from "@xwiki/cristal-authentication-api";
22
21
  import { GitHubAuthenticationState } from "@xwiki/cristal-authentication-github-state";
23
22
  import { inject, injectable } from "inversify";
24
23
  import type { CristalApp } from "@xwiki/cristal-api";
25
- import type { AuthenticationManager } from "@xwiki/cristal-authentication-api";
24
+ import type {
25
+ AuthenticationManager,
26
+ UserDetails,
27
+ } from "@xwiki/cristal-authentication-api";
26
28
 
27
29
  interface AuthenticationWindow extends Window {
28
30
  authenticationGitHub: {
package/src/index.ts CHANGED
@@ -23,6 +23,9 @@ import { GitHubAuthenticationState } from "@xwiki/cristal-authentication-github-
23
23
  import type { AuthenticationManager } from "@xwiki/cristal-authentication-api";
24
24
  import type { Container } from "inversify";
25
25
 
26
+ /**
27
+ * @beta
28
+ */
26
29
  class ComponentInit {
27
30
  constructor(container: Container) {
28
31
  container
package/vitest.config.ts CHANGED
@@ -19,7 +19,7 @@
19
19
  */
20
20
 
21
21
  import localConfig from "./vite.config";
22
+ import { vitestVue as defaultConfig } from "@xwiki/cristal-dev-config";
22
23
  import { mergeConfig } from "vitest/config";
23
- import defaultConfig from "@xwiki/cristal-dev-config/vitest-vue.config";
24
24
 
25
25
  export default mergeConfig(defaultConfig, localConfig);