-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathinversify.js
More file actions
75 lines (49 loc) · 79.9 KB
/
inversify.js
File metadata and controls
75 lines (49 loc) · 79.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
let e,t,i,n,r,o,s,a,c;function d(e,t,i){return Reflect.getOwnMetadata(t,e,i)}var l,u,h,f,v="@inversifyjs/container/bindingId",g="Instance",p="ResolvedValue",m="ServiceRedirection";(y=f||={}).moduleId="moduleId",y.serviceId="serviceId";var y,b,w=Symbol.for("@inversifyjs/core/InversifyCoreError"),I=class e extends Error{[w];kind;constructor(e,t,i){super(t,i),this[w]=!0,this.kind=e}static is(e){return"object"==typeof e&&!!e&&!0===e[w]}static isErrorOfKind(t,i){return e.is(t)&&t.kind===i}};function S(e){return("object"==typeof e&&!!e||"function"==typeof e)&&"function"==typeof e.then}function C(e){switch(typeof e){case"string":case"symbol":return e.toString();case"function":return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}(eD=b||={})[eD.injectionDecoratorConflict=0]="injectionDecoratorConflict",eD[eD.missingInjectionDecorator=1]="missingInjectionDecorator",eD[eD.planning=2]="planning",eD[eD.planningMaxDepthExceeded=3]="planningMaxDepthExceeded",eD[eD.resolution=4]="resolution",eD[eD.unknown=5]="unknown",(eE=eY||={})[eE.unknown=32]="unknown",(eT=eZ||={}).id="id",eT.moduleId="moduleId",eT.serviceId="serviceId",(eF=e0||={}).moduleId="moduleId",eF.serviceId="serviceId",(e_=e1||={})[e_.multipleInjection=0]="multipleInjection",e_[e_.singleInjection=1]="singleInjection",e_[e_.unmanaged=2]="unmanaged",(eU=e2||={})[eU.method=0]="method",eU[eU.parameter=1]="parameter",eU[eU.property=2]="property",(eK=e3||={})[eK.multipleInjection=0]="multipleInjection",eK[eK.singleInjection=1]="singleInjection";var A=Symbol.for("@inversifyjs/common/islazyServiceIdentifier"),x=class{[A];#e;constructor(e){this.#e=e,this[A]=!0}static is(e){return"object"==typeof e&&!!e&&!0===e[A]}unwrap(){return this.#e()}},j=Symbol.for("@inversifyjs/core/LazyPlanServiceNode"),M=class{[j];_serviceIdentifier;_serviceNode;constructor(e,t){this[j]=!0,this._serviceNode=e,this._serviceIdentifier=t}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&&!!e&&!0===e[j]}invalidate(){this._serviceNode=void 0}isExpanded(){return void 0!==this._serviceNode}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}},B=class e{#e;constructor(e){this.#e=e}get name(){return this.#e.elem.name}get serviceIdentifier(){return this.#e.elem.serviceIdentifier}get tags(){return this.#e.elem.tags}getAncestor(){if(this.#e.elem.getAncestorsCalled=!0,void 0!==this.#e.previous)return new e(this.#e.previous)}};function R(e,t,i){let n=i?.customServiceIdentifier??t.serviceIdentifier,r=(i?.chained===!0?[...e.operations.getBindingsChained(n)]:[...e.operations.getBindings(n)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===r.length&&void 0!==e.autobindOptions&&"function"==typeof n){var o;let i,s=(o=e.autobindOptions,i=function(e){let t,i=d(e,"@inversifyjs/core/classMetadataReflectKey")??{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0};if(void 0===(t=d(e,"@inversifyjs/core/pendingClassMetadataCountReflectKey"))||0===t)return function(e,t){let i=[];if(t.length<e.length)throw new I(b.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.
Are you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?
If 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]&&i.push(e);if(i.length>0)throw new I(b.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${i.join('", "')}".
Are you using @inject, @multiInject or @unmanaged decorators at those indexes?
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,i.constructorArguments),i;let n=[];for(let t=0;t<i.constructorArguments.length;++t){let r=i.constructorArguments[t];(void 0===r||r.kind===eY.unknown)&&n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${t.toString()}.
Every constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[t,r]of i.properties)r.kind===eY.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${t.toString()}".
This property must be decorated either with @inject or @multiInject decorator.`);throw 0===n.length?new I(b.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.
This might be caused by one of the following reasons:
1. A third party library is targeting inversify reflection metadata.
2. A bug is causing the issue. Consider submiting an issue to fix it.`):new I(b.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:
${n.join("\n\n")}`)}(n).scope??o.scope,{cache:{isRight:!1,value:void 0},id:function(){var e,t;let i,n=d(Object,v)??0;return n===0x20000000000000-1?Reflect.defineMetadata(v,-(0x20000000000000-1),Object,void 0):(e=Object,t=()=>n,i=(d(e,v,void 0)??t())+1,Reflect.defineMetadata(v,i,e,void 0)),n}(),implementationType:n,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:n,type:g});e.operations.setBinding(s),s.isSatisfiedBy(t)&&r.push(s)}return r}function O(e){return void 0!==e.redirections}function k(e,t,i,n){var r,o,s,a,c,d;let l=i.elem.serviceIdentifier,u=i.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,i,n,r,o){if(0===e.length)t||$(i,n,r,o);else{let t=`Ambiguous bindings found for service: "${C(o[o.length-1]??i)}".${D(o)}
Registered bindings:
${e.map(e=>(function(e){switch(e.type){case g:return`[ type: "${e.type}", serviceIdentifier: "${C(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case m:return`[ type: "${e.type}", serviceIdentifier: "${C(e.serviceIdentifier)}", redirection: "${C(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${C(e.serviceIdentifier)}", scope: "${e.scope}" ]`}})(e.binding)).join("\n")}
Trying to resolve bindings for "${P(i,n)}".${N(r)}`;throw new I(b.planning,t)}}(e,t,l,u,i.elem,n):(r=e,o=t,s=l,a=u,c=i.elem,d=n,void 0!==r||o||$(s,a,c,d))}function $(e,t,i,n){let r=`No bindings found for service: "${C(n[n.length-1]??e)}".
Trying to resolve bindings for "${P(e,t)}".${D(n)}${N(i)}`;throw new I(b.planning,r)}function P(e,t){return void 0===t?`${C(e)} (Root service)`:C(t)}function N(e){let t=0===e.tags.size?"":`
- tags:
- ${[...e.tags.keys()].map(e=>e.toString()).join("\n - ")}`;return`
Binding constraints:
- service identifier: ${C(e.serviceIdentifier)}
- name: ${e.name?.toString()??"-"}${t}`}function D(e){return 0===e.length?"":`
- service redirections:
- ${e.map(e=>C(e)).join("\n - ")}`}function E(e,t,i){if(Array.isArray(e.bindings)&&1===e.bindings.length){let[n]=e.bindings;O(n)&&function e(t,i,n,r){if(1===t.redirections.length){let[o]=t.redirections;O(o)&&e(o,i,n,[...r,o.binding.targetServiceIdentifier]);return}k(t.redirections,i,n,r)}(n,t,i,[n.binding.targetServiceIdentifier]);return}k(e.bindings,t,i,[])}function T(e){return x.is(e)?e.unwrap():e}function F(e){return(t,i,n)=>{let r=T(n.value),o=i.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:r,tags:n.tags}),s=new B(o.last),a=n.kind===e1.multipleInjection&&n.chained,c=R(t,s,{chained:a}),d=[],l={bindings:d,isContextFree:!0,serviceIdentifier:r};if(d.push(...e(t,o,c,l,a)),l.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===e1.singleInjection){E(l,n.optional,o.last);let[e]=d;l.bindings=e}return l}}function _(e){return(t,i,n)=>{let r=T(n.value),o=i.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:r,tags:n.tags}),s=new B(o.last),a=n.kind===e3.multipleInjection&&n.chained,c=R(t,s,{chained:a}),d=[],l={bindings:d,isContextFree:!0,serviceIdentifier:r};if(d.push(...e(t,o,c,l,a)),l.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===e3.singleInjection){E(l,n.optional,o.last);let[e]=d;l.bindings=e}return l}}function U(e){var t,i,n;let r=(t=e,(e,i,n)=>{let r={binding:i,classMetadata:e.operations.getClassMetadata(i.implementationType),constructorParams:[],propertyParams:new Map};return t({autobindOptions:e.autobindOptions,node:r,operations:e.operations,servicesBranch:e.servicesBranch},n)}),o=(i=e,(e,t,n)=>i({autobindOptions:e.autobindOptions,node:{binding:t,params:[]},operations:e.operations,servicesBranch:e.servicesBranch},n)),s=(e,t,i,n,s)=>{let c=O(n)?n.binding.targetServiceIdentifier:n.serviceIdentifier;e.servicesBranch.push(c);let d=[];for(let n of i)switch(n.type){case g:d.push(r(e,n,t));break;case p:d.push(o(e,n,t));break;case m:{let i=a(e,t,n,s);d.push(i);break}default:d.push({binding:n})}return e.servicesBranch.pop(),d},a=(n=s,(e,t,i,r)=>{let o={binding:i,redirections:[]},s=R(e,new B(t.last),{chained:r,customServiceIdentifier:i.targetServiceIdentifier});return o.redirections.push(...n(e,t,s,o,r)),o});return s}function K(e,t,i,n){void 0!==e&&(M.is(i)&&!i.isExpanded()||i.isContextFree)?t.setPlan(e,{tree:{root:i}}):t.setNonCachedServiceNode(i,n)}var V=class extends M{#e;#t;#i;#n;constructor(e,t,i,n,r){super(r,T(n.value)),this.#t=t,this.#e=e,this.#i=i,this.#n=n}_buildPlanServiceNode(){return this.#t(this.#e,this.#i,this.#n)}},z=class extends M{#e;#t;#i;#n;constructor(e,t,i,n,r){super(r,T(n.value)),this.#e=e,this.#t=t,this.#i=i,this.#n=n}_buildPlanServiceNode(){return this.#t(this.#e,this.#i,this.#n)}};function q(e,t,i,n){var r,o,s,a,c,d,l,u;let h,f,v=(r=e,o=i,h=(s=r,a=o,(e,t,i)=>{if(i.kind===e1.unmanaged)return;if(t.length>500)throw new I(b.planningMaxDepthExceeded,"Maximum plan depth exceeded. This is likely caused by a circular dependency.");let n=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;let[i,n]=e.tags.entries().next().value;t={key:i,value:n}}let i=x.is(e.value)?e.value.unwrap():e.value;return e.kind===e1.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}}(i);if(void 0!==n){let t=e.operations.getPlan(n);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}let r=new V(e,s,t,i,a(e,t,i));return K(n,e.operations,r,{bindingConstraintsList:t,chainedBindings:i.kind===e1.multipleInjection&&i.chained,optionalBindings:i.optional}),r}),(e,t,i)=>{let n=t.classMetadata;for(let[r,o]of n.constructorArguments.entries())t.constructorParams[r]=h(e,i,o);for(let[r,o]of n.properties){let n=h(e,i,o);void 0!==n&&t.propertyParams.set(r,n)}return e.node}),p=(c=t,d=n,f=(l=c,u=d,(e,t,i)=>{let n=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;let[i,n]=e.tags.entries().next().value;t={key:i,value:n}}let i=x.is(e.value)?e.value.unwrap():e.value;return e.kind===e3.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}}(i);if(void 0!==n){let t=e.operations.getPlan(n);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}let r=new z(e,l,t,i,u(e,t,i));return K(n,e.operations,r,{bindingConstraintsList:t,chainedBindings:i.kind===e3.multipleInjection&&i.chained,optionalBindings:i.optional}),r}),(e,t,i)=>{for(let[n,r]of t.binding.metadata.arguments.entries())t.params[n]=f(e,i,r);return e.node});return(e,t)=>e.node.binding.type===g?v(e,e.node,t):p(e,e.node,t)}var L=F(G),W=_(G),H=U(q(L,W,L,W));function G(e,t,i,n,r){return H(e,t,i,n,r)}(eV=e4||={}).bindingAdded="bindingAdded",eV.bindingRemoved="bindingRemoved";var Q=U(q(L,W,function(e,t,i){return J(e,t,i)},function(e,t,i){return X(e,t,i)})),J=(e=F(Q),(t,i,n)=>{try{return e(t,i,n)}catch(e){if(I.isErrorOfKind(e,b.planning))return;throw e}}),X=(t=_(Q),(e,i,n)=>{try{return t(e,i,n)}catch(e){if(I.isErrorOfKind(e,b.planning))return;throw e}});function Y(e,t){return S(t)?(e.cache={isRight:!0,value:t},t.then(t=>Z(e,t))):Z(e,t)}function Z(e,t){return e.cache={isRight:!0,value:t},t}async function ee(e,t,i){let n=await t,r=i.next();for(;!0!==r.done;)n=await r.value(e.context,n),r=i.next();return n}function et(e,t,i){var n,r;let o,s=i;if(void 0!==t.onActivation){let i=t.onActivation;s=S(s)?s.then(t=>i(e.context,t)):i(e.context,s)}return n=t.serviceIdentifier,r=s,void 0===(o=e.getActivations(n))?r:S(r)?ee(e,r,o[Symbol.iterator]()):function(e,t,i){let n=t,r=i.next();for(;!0!==r.done;){let t=r.value(e.context,n);if(S(t))return ee(e,t,i);n=t,r=i.next()}return n}(e,r,o[Symbol.iterator]())}function ei(e){return(t,i)=>i.cache.isRight?i.cache.value:Y(i,et(t,i,e(t,i)))}var en=ei(function(e,t){return t.value});function er(e,t){return(i,n)=>{let r=e(n);switch(r.scope){case"Singleton":return r.cache.isRight?r.cache.value:Y(r,et(i,r,t(i,n)));case"Request":{if(i.requestScopeCache.has(r.id))return i.requestScopeCache.get(r.id);let e=et(i,r,t(i,n));return i.requestScopeCache.set(r.id,e),e}case"Transient":return et(i,r,t(i,n))}}}var eo=er(function(e){return e},function(e,t){return t.value(e.context)}),es=ei(function(e,t){return t.factory(e.context)});function ea(e,t,i){let n=function(e,t,i){if(i in e)if("function"==typeof e[i]){let n;try{n=e[i]()}catch(e){throw new I(b.resolution,`Unexpected error found when calling "${i.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:e})}if(S(n))return ec(t,i,n)}else throw new I(b.resolution,`Expecting a "${i.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);else throw new I(b.resolution,`Expecting a "${i.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`)}(e,t,i);return S(n)?n.then(()=>e):e}async function ec(e,t,i){try{await i}catch(i){throw new I(b.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:i})}}function ed(e,t,i){if(0===i.size)return e;let n=e;for(let e of i)n=S(n)?n.then(i=>ea(i,t,e)):ea(n,t,e);return n}function el(e){return(t,i,n)=>{let r=new n.binding.implementationType(...t),o=e(i,r,n);return S(o)?o.then(()=>ed(r,n.binding,n.classMetadata.lifecycle.postConstructMethodNames)):ed(r,n.binding,n.classMetadata.lifecycle.postConstructMethodNames)}}var eu=(ez=ey,(e,t,i)=>{let n=[];for(let[r,o]of i.propertyParams){let s=i.classMetadata.properties.get(r);if(void 0===s)throw new I(b.resolution,`Expecting metadata at property "${r.toString()}", none found`);s.kind!==e1.unmanaged&&void 0!==o.bindings&&(t[r]=ez(e,o),S(t[r])&&n.push((async()=>{t[r]=await t[r]})()))}if(n.length>0)return Promise.all(n).then(()=>void 0)}),eh=(eq=em,function e(t,i){let n=[];for(let r of i.redirections)O(r)?n.push(...e(t,r)):n.push(eq(t,r));return n}),ef=(eL=ey,eH=(e,t)=>{let i=[];for(let n of t.constructorParams)void 0===n?i.push(void 0):i.push(eL(e,n));return i.some(S)?Promise.all(i):i},eW=el(eu),eG=async(e,t,i)=>eW(await e,t,i),eQ=el(eu),(e,t)=>{let i=eH(e,t);return S(i)?eG(i,e,t):eQ(i,e,t)}),ev=(eJ=ey,eX=(e,t)=>{let i=[];for(let n of t.params)i.push(eJ(e,n));return i.some(S)?Promise.all(i):i},(e,t)=>{let i=eX(e,t);return S(i)?i.then(e=>t.binding.factory(...e)):t.binding.factory(...i)}),eg=er(function(e){return e.binding},ef),ep=er(function(e){return e.binding},ev);function em(e,t){switch(t.binding.type){case"ConstantValue":return en(e,t.binding);case"DynamicValue":return eo(e,t.binding);case"Factory":return es(e,t.binding);case g:return eg(e,t);case p:return ep(e,t)}}function ey(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){let i=[];for(let n of t)O(n)?i.push(...eh(e,n)):i.push(em(e,n));return i.some(S)?Promise.all(i):i}(e,t.bindings):function(e,t){if(!O(t))return em(e,t);{let i=eh(e,t);if(1===i.length)return i[0];throw new I(b.resolution,"Unexpected multiple resolved values on single injection")}}(e,t.bindings)}var eb=Symbol.for("@inversifyjs/plugin/isPlugin"),ew=class{[eb]=!0;_container;_context;constructor(e,t){this._container=e,this._context=t}};function eI(e){return("object"==typeof e&&!!e||"function"==typeof e)&&"function"==typeof e.then}function eS(e){switch(typeof e){case"string":case"symbol":return e.toString();case"function":return e.name;default:throw Error(`Unexpected ${typeof e} service id type`)}}var eC=Symbol.for("@inversifyjs/common/islazyServiceIdentifier"),eA=class{[eC];#e;constructor(e){this.#e=e,this[eC]=!0}static is(e){return"object"==typeof e&&!!e&&!0===e[eC]}unwrap(){return this.#e()}};function ex(e,t,i){return Reflect.getOwnMetadata(t,e,i)}function ej(e,t,i,n){Reflect.defineMetadata(t,i,e,n)}function eM(e,t,i,n,r){let o=n(ex(e,t,r)??i());Reflect.defineMetadata(t,o,e,r)}(i=()=>{var e,t;t=e||={},function(e){var i="object"==typeof globalThis?globalThis:"object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:function(){throw ReferenceError("globalThis could not be found. Please polyfill globalThis before loading this module.")}(),n=r(t);function r(e,t){return function(i,n){Object.defineProperty(e,i,{configurable:!0,writable:!0,value:n}),t&&t(i,n)}}void 0!==i.Reflect&&(n=r(i.Reflect,n)),e(n,i),void 0===i.Reflect&&(i.Reflect=t)}(function(e,t){var i,n="function"==typeof Symbol,r=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:O("Symbol.toPrimitive not found."),o=n&&void 0!==Symbol.iterator?Symbol.iterator:O("Symbol.iterator not found."),s=Object.getPrototypeOf(Function),a="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:O("A valid Map constructor could not be found."),c="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:O("A valid Set constructor could not be found."),d="function"==typeof WeakMap?WeakMap:O("A valid WeakMap constructor could not be found."),l=n?Symbol.for("@reflect-metadata:registry"):void 0,u=(!y(l)&&w(t.Reflect)&&Object.isExtensible(t.Reflect)&&(i=t.Reflect[l]),y(i)&&(i=function(){y(l)||void 0===t.Reflect||l in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(i=(e=t.Reflect).defineMetadata,n=e.hasOwnMetadata,r=e.getOwnMetadata,o=e.getOwnMetadataKeys,s=e.deleteMetadata,u=new d,h={isProviderFor:function(e,t){var i=u.get(e);return!!(!y(i)&&i.has(t))||!!o(e,t).length&&(y(i)&&(i=new c,u.set(e,i)),i.add(t),!0)},OrdinaryDefineOwnMetadata:i,OrdinaryHasOwnMetadata:n,OrdinaryGetOwnMetadata:r,OrdinaryOwnMetadataKeys:o,OrdinaryDeleteMetadata:s});var e,i,n,r,o,s,u,h,f,v,g,p=new d,m={registerProvider:function(e){if(!Object.isExtensible(m))throw Error("Cannot add provider to a frozen registry.");switch(!0){case h===e:break;case y(f):f=e;break;case f===e:break;case y(v):v=e;break;case v===e:break;default:void 0===g&&(g=new c),g.add(e)}},getProvider:b,setProvider:function(e,t,i){if(!function(e){if(y(e))throw TypeError();return f===e||v===e||!y(g)&&g.has(e)}(i))throw Error("Metadata provider not registered.");var n=b(e,t);if(n!==i){if(!y(n))return!1;var r=p.get(e);y(r)&&(r=new a,p.set(e,r)),r.set(t,i)}return!0}};return m;function b(e,t){var i,n=p.get(e);return y(n)||(i=n.get(t)),y(i)&&(i=function(e,t){if(!y(f)){if(f.isProviderFor(e,t))return f;if(!y(v)){if(v.isProviderFor(e,t))return f;if(!y(g))for(var i=j(g);;){var n=M(i);if(!n)return;var r=n.value;if(r.isProviderFor(e,t))return B(i),r}}}if(!y(h)&&h.isProviderFor(e,t))return h}(e,t),y(i)||(y(n)&&(n=new a,p.set(e,n)),n.set(t,i))),i}}()),!y(l)&&w(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,l,{enumerable:!1,configurable:!1,writable:!1,value:i}),i),h=function(e){var t=new d,i={isProviderFor:function(e,i){var n=t.get(e);return!y(n)&&n.has(i)},OrdinaryDefineOwnMetadata:function(e,t,i,r){n(i,r,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,i){var r=n(t,i,!1);return!y(r)&&!!r.has(e)},OrdinaryGetOwnMetadata:function(e,t,i){var r=n(t,i,!1);if(!y(r))return r.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var i=[],r=n(e,t,!1);if(y(r))return i;for(var o=j(r.keys()),s=0;;){var a=M(o);if(!a)return i.length=s,i;var c=a.value;try{i[s]=c}catch(e){try{B(o)}finally{throw e}}s++}},OrdinaryDeleteMetadata:function(e,i,r){var o=n(i,r,!1);if(y(o)||!o.delete(e))return!1;if(0===o.size){var s=t.get(i);y(s)||(s.delete(r),0===s.size&&t.delete(s))}return!0}};return u.registerProvider(i),i;function n(n,r,o){var s=t.get(n),c=!1;if(y(s)){if(!o)return;s=new a,t.set(n,s),c=!0}var d=s.get(r);if(y(d)){if(!o)return;if(d=new a,s.set(r,d),!e.setProvider(n,r,i))throw s.delete(r),c&&t.delete(n),Error("Wrong provider for target.")}return d}}(u);function f(e,t,i){var n=k(t,i,!1);return!y(n)&&!!n.OrdinaryHasOwnMetadata(e,t,i)}function v(e,t,i){var n=k(t,i,!1);if(!y(n))return n.OrdinaryGetOwnMetadata(e,t,i)}function g(e,t,i,n){k(i,n,!0).OrdinaryDefineOwnMetadata(e,t,i,n)}function p(e,t){var i=k(e,t,!1);return i?i.OrdinaryOwnMetadataKeys(e,t):[]}function m(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function y(e){return void 0===e}function b(e){return null===e}function w(e){return"object"==typeof e?null!==e:"function"==typeof e}function I(e){var t=function(e){switch(m(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var t="string",i=x(e,r);if(void 0!==i){var n=i.call(e,t);if(w(n))throw TypeError();return n}return function(e,t){if("string"===t){var i=e.toString;if(C(i)){var n=i.call(e);if(!w(n))return n}var r=e.valueOf;if(C(r)){var n=r.call(e);if(!w(n))return n}}else{var r=e.valueOf;if(C(r)){var n=r.call(e);if(!w(n))return n}var o=e.toString;if(C(o)){var n=o.call(e);if(!w(n))return n}}throw TypeError()}(e,t)}(e);return"symbol"==typeof t?t:""+t}function S(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function C(e){return"function"==typeof e}function A(e){return"function"==typeof e}function x(e,t){var i=e[t];if(null!=i){if(!C(i))throw TypeError();return i}}function j(e){var t=x(e,o);if(!C(t))throw TypeError();var i=t.call(e);if(!w(i))throw TypeError();return i}function M(e){var t=e.next();return!t.done&&t}function B(e){var t=e.return;t&&t.call(e)}function R(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===s||t!==s)return t;var i=e.prototype,n=i&&Object.getPrototypeOf(i);if(null==n||n===Object.prototype)return t;var r=n.constructor;return"function"!=typeof r||r===e?t:r}function O(e){throw e}function k(e,t,i){var n=u.getProvider(e,t);if(!y(n))return n;if(i){if(u.setProvider(e,t,h))return h;throw Error("Illegal state.")}}e("decorate",function(e,t,i,n){if(y(i)){if(!S(e)||!A(t))throw TypeError();for(var r=t,o=e.length-1;o>=0;--o){var s=(0,e[o])(r);if(!y(s)&&!b(s)){if(!A(s))throw TypeError();r=s}}return r}if(!S(e)||!w(t)||!w(n)&&!y(n)&&!b(n))throw TypeError();return b(n)&&(n=void 0),function(e,t,i,n){for(var r=e.length-1;r>=0;--r){var o=(0,e[r])(t,i,n);if(!y(o)&&!b(o)){if(!w(o))throw TypeError();n=o}}return n}(e,t,i=I(i),n)}),e("metadata",function(e,t){return function(i,n){if(!w(i)||!y(n)&&!function(e){switch(m(e)){case 3:case 4:return!0;default:return!1}}(n))throw TypeError();g(e,t,i,n)}}),e("defineMetadata",function(e,t,i,n){if(!w(i))throw TypeError();return y(n)||(n=I(n)),g(e,t,i,n)}),e("hasMetadata",function(e,t,i){if(!w(t))throw TypeError();return y(i)||(i=I(i)),function e(t,i,n){if(f(t,i,n))return!0;var r=R(i);return!b(r)&&e(t,r,n)}(e,t,i)}),e("hasOwnMetadata",function(e,t,i){if(!w(t))throw TypeError();return y(i)||(i=I(i)),f(e,t,i)}),e("getMetadata",function(e,t,i){if(!w(t))throw TypeError();return y(i)||(i=I(i)),function e(t,i,n){if(f(t,i,n))return v(t,i,n);var r=R(i);if(!b(r))return e(t,r,n)}(e,t,i)}),e("getOwnMetadata",function(e,t,i){if(!w(t))throw TypeError();return y(i)||(i=I(i)),v(e,t,i)}),e("getMetadataKeys",function(e,t){if(!w(e))throw TypeError();return y(t)||(t=I(t)),function e(t,i){var n=p(t,i),r=R(t);if(null===r)return n;var o=e(r,i);if(o.length<=0)return n;if(n.length<=0)return o;for(var s=new c,a=[],d=0;d<n.length;d++){var l=n[d],u=s.has(l);u||(s.add(l),a.push(l))}for(var h=0;h<o.length;h++){var l=o[h],u=s.has(l);u||(s.add(l),a.push(l))}return a}(e,t)}),e("getOwnMetadataKeys",function(e,t){if(!w(e))throw TypeError();return y(t)||(t=I(t)),p(e,t)}),e("deleteMetadata",function(e,t,i){if(!w(t))throw TypeError();y(i)||(i=I(i));var n=k(t,i,!1);return!y(n)&&n.OrdinaryDeleteMetadata(e,t,i)})})},()=>(n||i((n={exports:{}}).exports,n),n.exports))();var eB="@inversifyjs/container/bindingId",eR=class{#e;#t;constructor(e){let t;this.#e=((t=ex(Object,eB)??0)===0x20000000000000-1?ej(Object,eB,-(0x20000000000000-1)):eM(Object,eB,()=>t,e=>e+1),t),this.#t=e}get id(){return this.#e}load(e){return this.#t(e)}},eO="@inversifyjs/container/bindingId";function ek(){let e=ex(Object,eO)??0;return e===0x20000000000000-1?ej(Object,eO,-(0x20000000000000-1)):eM(Object,eO,()=>e,e=>e+1),e}var e$={Request:"Request",Singleton:"Singleton",Transient:"Transient"},eP={ConstantValue:"ConstantValue",DynamicValue:"DynamicValue",Factory:"Factory",Instance:"Instance",ResolvedValue:"ResolvedValue",ServiceRedirection:"ServiceRedirection"};function*eN(...e){for(let t of e)yield*t}var eD,eE,eT,eF,e_,eU,eK,eV,ez,eq,eL,eW,eH,eG,eQ,eJ,eX,eY,eZ,e0,e1,e2,e3,e4,e5,e6=class e{#e;#t;#i;constructor(e){for(let t of(this.#e=new Map,this.#t={},Reflect.ownKeys(e)))this.#t[t]=new Map;this.#i=e}add(e,t){for(let i of(this.#r(e).push(t),Reflect.ownKeys(t)))this.#o(i,t[i]).push(e)}clone(){let e=this.#n(),t=this.#s(),i=Reflect.ownKeys(this.#i),n=this._buildNewInstance(this.#i);for(let r of(this.#a(this.#e,n.#e,e,t),i))this.#c(this.#t[r],n.#t[r],e);return n}get(e,t){return this.#t[e].get(t)}getAllKeys(e){return this.#t[e].keys()}removeByRelation(e,t){let i=this.get(e,t);if(void 0!==i)for(let n of new Set(i)){let i=this.#e.get(n);if(void 0===i)throw Error("Expecting model relation, none found");for(let r of i)r[e]===t&&this.#d(n,r);this.#e.delete(n)}}_buildNewInstance(t){return new e(t)}_cloneModel(e){return e}_cloneRelation(e){return e}#n(){let e=new Map;for(let t of this.#e.keys()){let i=this._cloneModel(t);e.set(t,i)}return e}#s(){let e=new Map;for(let t of this.#e.values())for(let i of t){let t=this._cloneRelation(i);e.set(i,t)}return e}#r(e){let t=this.#e.get(e);return void 0===t&&(t=[],this.#e.set(e,t)),t}#o(e,t){let i=this.#t[e].get(t);return void 0===i&&(i=[],this.#t[e].set(t,i)),i}#l(e,t){let i=t.get(e);if(void 0===i)throw Error("Expecting model to be cloned, none found");return i}#u(e,t){let i=t.get(e);if(void 0===i)throw Error("Expecting relation to be cloned, none found");return i}#c(e,t,i){for(let[n,r]of e){let e=[];for(let t of r)e.push(this.#l(t,i));t.set(n,e)}}#a(e,t,i,n){for(let[r,o]of e){let e=[];for(let t of o)e.push(this.#u(t,n));t.set(this.#l(r,i),e)}}#d(e,t){for(let i of Reflect.ownKeys(t))this.#h(e,i,t[i])}#h(e,t,i){let n=this.#t[t].get(i);if(void 0!==n){let r=n.indexOf(e);-1!==r&&n.splice(r,1),0===n.length&&this.#t[t].delete(i)}}};(te=e5||={}).moduleId="moduleId",te.serviceId="serviceId";var e8=class e{#e;#t;constructor(e,t){this.#e=t??new e6({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],i=this.#e.get(e5.serviceId,e);void 0!==i&&t.push(i);let n=this.#t()?.get(e);if(void 0!==n&&t.push(n),0!==t.length)return eN(...t)}removeAllByModuleId(e){this.#e.removeByRelation(e5.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(e5.serviceId,e)}},e7="@inversifyjs/core/classMetadataReflectKey";function e9(){return{constructorArguments:[],lifecycle:{postConstructMethodNames:new Set,preDestroyMethodNames:new Set},properties:new Map,scope:void 0}}var te,tt,ti="@inversifyjs/core/pendingClassMetadataCountReflectKey",tn=Symbol.for("@inversifyjs/core/InversifyCoreError"),tr=class e extends Error{[tn];kind;constructor(e,t,i){super(t,i),this[tn]=!0,this.kind=e}static is(e){return"object"==typeof e&&!!e&&!0===e[tn]}static isErrorOfKind(t,i){return e.is(t)&&t.kind===i}};function to(e){let t,i=ex(e,"@inversifyjs/core/classMetadataReflectKey")??e9();if(void 0===(t=ex(e,ti))||0===t)return function(e,t){let i=[];if(t.length<e.length)throw new tr(tt.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}". "${e.name}" constructor requires at least ${e.length.toString()} arguments, found ${t.length.toString()} instead.
Are you using @inject, @multiInject or @unmanaged decorators in every non optional constructor argument?
If 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]&&i.push(e);if(i.length>0)throw new tr(tt.missingInjectionDecorator,`Found unexpected missing metadata on type "${e.name}" at constructor indexes "${i.join('", "')}".
Are you using @inject, @multiInject or @unmanaged decorators at those indexes?
If you're using typescript and want to rely on auto injection, set "emitDecoratorMetadata" compiler option to true`)}(e,i.constructorArguments),i;let n=[];for(let t=0;t<i.constructorArguments.length;++t){let r=i.constructorArguments[t];(void 0===r||r.kind===tu.unknown)&&n.push(` - Missing or incomplete metadata for type "${e.name}" at constructor argument with index ${t.toString()}.
Every constructor parameter must be decorated either with @inject, @multiInject or @unmanaged decorator.`)}for(let[t,r]of i.properties)r.kind===tu.unknown&&n.push(` - Missing or incomplete metadata for type "${e.name}" at property "${t.toString()}".
This property must be decorated either with @inject or @multiInject decorator.`);throw 0===n.length?new tr(tt.unknown,`Unexpected class metadata for type "${e.name}" with uncompletion traces.
This might be caused by one of the following reasons:
1. A third party library is targeting inversify reflection metadata.
2. A bug is causing the issue. Consider submiting an issue to fix it.`):new tr(tt.missingInjectionDecorator,`Invalid class metadata at type ${e.name}:
${n.join("\n\n")}`)}function ts(e,t){let i=to(t).scope??e.scope;return{cache:{isRight:!1,value:void 0},id:ek(),implementationType:t,isSatisfiedBy:()=>!0,moduleId:void 0,onActivation:void 0,onDeactivation:void 0,scope:i,serviceIdentifier:t,type:eP.Instance}}function ta(e){return e.isRight?{isRight:!0,value:e.value}:e}(tc=tt||={})[tc.injectionDecoratorConflict=0]="injectionDecoratorConflict",tc[tc.missingInjectionDecorator=1]="missingInjectionDecorator",tc[tc.planning=2]="planning",tc[tc.planningMaxDepthExceeded=3]="planningMaxDepthExceeded",tc[tc.resolution=4]="resolution",tc[tc.unknown=5]="unknown",(td=tu||={})[td.unknown=32]="unknown",(tl=th||={}).id="id",tl.moduleId="moduleId",tl.serviceId="serviceId";var tc,td,tl,tu,th,tf,tv=class e extends e6{_buildNewInstance(t){return new e(t)}_cloneModel(e){return function(e){switch(e.type){case eP.ConstantValue:case eP.DynamicValue:return{cache:ta(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};case eP.Factory:return{cache:ta(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};case eP.Instance:return{cache:ta(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};case eP.ResolvedValue:return{cache:ta(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};case eP.ServiceRedirection:return{id:e.id,isSatisfiedBy:e.isSatisfiedBy,moduleId:e.moduleId,serviceIdentifier:e.serviceIdentifier,targetServiceIdentifier:e.targetServiceIdentifier,type:e.type}}}(e)}},tg=class e{#e;#t;#i;constructor(e,t,i){this.#t=i??new tv({id:{isOptional:!1},moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#i=e,this.#e=t}static build(t,i){return new e(t,i)}clone(){return new e(this.#i,this.#e,this.#t.clone())}get(e){let t=this.getNonParentBindings(e)??this.#i()?.get(e);if(void 0!==t)return t;let i=this.#n(e);return void 0===i?i:[i]}*getChained(e){let t=this.getNonParentBindings(e);void 0!==t&&(yield*t);let i=this.#i();if(void 0===i){if(void 0===t){let t=this.#n(e);void 0!==t&&(yield t)}}else yield*i.getChained(e)}getBoundServices(){let e=new Set(this.#t.getAllKeys(th.serviceId)),t=this.#i();if(void 0!==t)for(let i of t.getBoundServices())e.add(i);return e}getById(e){return this.#t.get(th.id,e)??this.#i()?.getById(e)}getByModuleId(e){return this.#t.get(th.moduleId,e)??this.#i()?.getByModuleId(e)}getNonParentBindings(e){return this.#t.get(th.serviceId,e)}getNonParentBoundServices(){return this.#t.getAllKeys(th.serviceId)}removeById(e){this.#t.removeByRelation(th.id,e)}removeAllByModuleId(e){this.#t.removeByRelation(th.moduleId,e)}removeAllByServiceId(e){this.#t.removeByRelation(th.serviceId,e)}set(e){let t={[th.id]:e.id,[th.serviceId]:e.serviceIdentifier};void 0!==e.moduleId&&(t[th.moduleId]=e.moduleId),this.#t.add(e,t)}#n(e){if(void 0===this.#e||"function"!=typeof e)return;let t=ts(this.#e,e);return this.set(t),t}};(iY=tf||={}).moduleId="moduleId",iY.serviceId="serviceId";var tp=class e{#e;#t;constructor(e,t){this.#e=t??new e6({moduleId:{isOptional:!0},serviceId:{isOptional:!1}}),this.#t=e}static build(t){return new e(t)}add(e,t){this.#e.add(e,t)}clone(){return new e(this.#t,this.#e.clone())}get(e){let t=[],i=this.#e.get(tf.serviceId,e);void 0!==i&&t.push(i);let n=this.#t()?.get(e);if(void 0!==n&&t.push(n),0!==t.length)return eN(...t)}removeAllByModuleId(e){this.#e.removeByRelation(tf.moduleId,e)}removeAllByServiceId(e){this.#e.removeByRelation(tf.serviceId,e)}};function tm(e,t,i,n){let r=Array.isArray(e)?e:[e];if(void 0===i)return void Reflect.decorate(r,t);if("number"==typeof i){for(let e of r)e(t,void 0,i);return}if(void 0===n)return void Reflect.decorate(r,t.prototype,i);for(let e of r)e(t,i,n)}function ty(){return 0}function tb(e){return t=>{void 0!==t&&t.kind===tu.unknown&&eM(e,ti,ty,e=>e-1)}}function tw(e,t){return(...i)=>n=>{if(void 0===n)return e(...i);if(n.kind===ni.unmanaged)throw new tr(tt.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(n,...i)}}function tI(e){if(e.kind!==tu.unknown&&!0!==e.isFromTypescriptParamType)throw new tr(tt.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(iZ=ni||={})[iZ.multipleInjection=0]="multipleInjection",iZ[iZ.singleInjection=1]="singleInjection",iZ[iZ.unmanaged=2]="unmanaged";var tS=tw(function(e,t,i){return e===ni.multipleInjection?{chained:i?.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,i,n){return tI(e),t===ni.multipleInjection?{...e,chained:n?.chained??!1,kind:t,value:i}:{...e,kind:t,value:i}});function tC(e,t){return i=>{let n=i.properties.get(t);return i.properties.set(t,e(n)),i}}function tA(e,t,i,n){if(tr.isErrorOfKind(n,tt.injectionDecoratorConflict)){let r=function(e,t,i){if(void 0===i){if(void 0===t)throw new tr(tt.unknown,"Unexpected undefined property and index values");return{kind:nn.property,property:t,targetClass:e.constructor}}return"number"==typeof i?{index:i,kind:nn.parameter,targetClass:e}:{kind:nn.method,method:t,targetClass:e}}(e,t,i);throw new tr(tt.injectionDecoratorConflict,`Unexpected injection error.
Cause:
${n.message}
Details
${function(e){switch(e.kind){case nn.method:return`[class: "${e.targetClass.name}", method: "${e.method.toString()}"]`;case nn.parameter:return`[class: "${e.targetClass.name}", index: "${e.index.toString()}"]`;case nn.property:return`[class: "${e.targetClass.name}", property: "${e.property.toString()}"]`}}(r)}`,{cause:n})}throw n}function tx(e,t){return(i,n,r)=>{try{var o,s,a,c,d,l;let u,h,f;void 0===r?(o=e,s=t,u=tj(o,s),(e,t)=>{eM(e.constructor,e7,e9,tC(u(e),t))})(i,n):"number"==typeof r?(a=e,c=t,h=tj(a,c),(e,t,i)=>{var n,r,o;if(n=e,r=t,"function"==typeof n&&void 0===r){eM(e,e7,e9,(o=h(e),e=>{let t=e.constructorArguments[i];return e.constructorArguments[i]=o(t),e}))}else throw new tr(tt.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
Found @inject decorator at method "${t?.toString()??""}" at class "${e.constructor.name}"`)})(i,n,r):(d=e,l=t,f=tj(d,l),(e,t,i)=>{var n;if(n=i,void 0!==n.set)eM(e.constructor,e7,e9,tC(f(e),t));else throw new tr(tt.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
Found @inject decorator at method "${t.toString()}" at class "${e.constructor.name}"`)})(i,n,r)}catch(e){tA(i,n,r,e)}}}function tj(e,t){return i=>{let n=t(i);return t=>(n(t),e(t))}}function tM(e){return tx(tS(ni.singleInjection,e),tb)}(i0=nn||={})[i0.method=0]="method",i0[i0.parameter=1]="parameter",i0[i0.property=2]="property";var tB=[Array,BigInt,Boolean,Function,Number,Object,String];function tR(e){return t=>{var i;let n;(function(e){if(void 0!==ex(e,"@inversifyjs/core/classIsInjectableFlagReflectKey"))throw new tr(tt.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${e.name}"`);ej(e,"@inversifyjs/core/classIsInjectableFlagReflectKey",!0)})(t),void 0!==(n=ex(t,"design:paramtypes"))&&eM(t,e7,e9,(i=n,e=>(i.forEach((t,i)=>{void 0!==e.constructorArguments[i]||tB.includes(t)||(e.constructorArguments[i]={isFromTypescriptParamType:!0,kind:ni.singleInjection,name:void 0,optional:!1,tags:new Map,value:t})}),e))),void 0!==e&&eM(t,e7,e9,t=>({...t,scope:e}))}}function tO(e){return Object.getPrototypeOf(e.prototype)?.constructor}function tk(e,t,i){return e?new Set([...t,...i]):i}function t$(e){return t=>{var i,n;eM(t,e7,e9,(i=e,n=to(e.type),e=>{let t,r,o;return{constructorArguments:(i.extendConstructorArguments??!0?(t=[...n.constructorArguments],e.constructorArguments.map((e,i)=>{t[i]=e})):t=e.constructorArguments,t),lifecycle:(r=i.lifecycle?.extendPostConstructMethods??!0,o=tk(i.lifecycle?.extendPreDestroyMethods??!0,n.lifecycle.preDestroyMethodNames,e.lifecycle.preDestroyMethodNames),{postConstructMethodNames:tk(r,n.lifecycle.postConstructMethodNames,e.lifecycle.postConstructMethodNames),preDestroyMethodNames:o}),properties:i.extendProperties??!0?new Map(eN(n.properties,e.properties)):e.properties,scope:e.scope}}))}}function tP(e){return t=>{let i=tO(t);if(void 0===i)throw new tr(tt.injectionDecoratorConflict,`Expected base type for type "${t.name}", none found.`);t$({...e,type:i})(t)}}function tN(e){return t=>{let i=[],n=tO(t);for(;void 0!==n&&n!==Object;){let e=n;i.push(e),n=tO(e)}for(let n of(i.reverse(),i))t$({...e,type:n})(t)}}function tD(e,t){return tx(tS(ni.multipleInjection,e,t),tb)}function tE(e){return t=>{void 0===t&&eM(e,ti,ty,e=>e+1)}}function tT(e){return t=>{let i=t??{kind:tu.unknown,name:void 0,optional:!1,tags:new Map};if(i.kind!==ni.unmanaged)return e(i);throw new tr(tt.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections")}}function tF(e){return tx(tT(t=>{if(void 0!==t.name)throw new tr(tt.injectionDecoratorConflict,"Unexpected duplicated named decorator");return t.name=e,t}),tE)}function t_(e){if(e.optional)throw new tr(tt.injectionDecoratorConflict,"Unexpected duplicated optional decorator");return e.optional=!0,e}function tU(){return tx(tT(t_),tE)}function tK(){return(e,t,i)=>{try{eM(e.constructor,e7,e9,e=>{if(e.lifecycle.postConstructMethodNames.has(t))throw new tr(tt.injectionDecoratorConflict,`Unexpected duplicated postConstruct method ${t.toString()}`);return e.lifecycle.postConstructMethodNames.add(t),e})}catch(i){tA(e,t,void 0,i)}}}function tV(){return(e,t,i)=>{try{eM(e.constructor,e7,e9,e=>{if(e.lifecycle.preDestroyMethodNames.has(t))throw new tr(tt.injectionDecoratorConflict,`Unexpected duplicated preDestroy method ${t.toString()}`);return e.lifecycle.preDestroyMethodNames.add(t),e})}catch(i){tA(e,t,void 0,i)}}}function tz(e,t){return tx(tT(i=>{if(i.tags.has(e))throw new tr(tt.injectionDecoratorConflict,"Unexpected duplicated tag decorator with existing tag");return i.tags.set(e,t),i}),tE)}function tq(){return{kind:ni.unmanaged}}var tL=tw(tq,function(e){var t;if(tI(e),void 0!==(t=e).name||t.optional||t.tags.size>0)throw new tr(tt.injectionDecoratorConflict,"Unexpected injection found. Found @unmanaged injection with additional @named, @optional, @tagged or @targetName injections");return tq()});function tW(){return tx(tL(),tb)}(i1=nr||={})[i1.multipleInjection=0]="multipleInjection",i1[i1.singleInjection=1]="singleInjection";var tH=/stack space|call stack|too much recursion/i,tG=/too much recursion/;function tQ(e){try{return e instanceof Error&&(e instanceof RangeError&&tH.test(e.message)||"InternalError"===e.name&&tG.test(e.message))}catch(e){return e instanceof SyntaxError&&e.message.includes("Stack overflow")}}var tJ=Symbol.for("@inversifyjs/core/LazyPlanServiceNode"),tX=class{[tJ];_serviceIdentifier;_serviceNode;constructor(e,t){this[tJ]=!0,this._serviceNode=e,this._serviceIdentifier=t}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&&!!e&&!0===e[tJ]}invalidate(){this._serviceNode=void 0}isExpanded(){return void 0!==this._serviceNode}_getNode(){return void 0===this._serviceNode&&(this._serviceNode=this._buildPlanServiceNode()),this._serviceNode}},tY=class e{#e;constructor(e){this.#e=e}get name(){return this.#e.elem.name}get serviceIdentifier(){return this.#e.elem.serviceIdentifier}get tags(){return this.#e.elem.tags}getAncestor(){if(this.#e.elem.getAncestorsCalled=!0,void 0!==this.#e.previous)return new e(this.#e.previous)}};function tZ(e,t,i){let n=i?.customServiceIdentifier??t.serviceIdentifier,r=(i?.chained===!0?[...e.operations.getBindingsChained(n)]:[...e.operations.getBindings(n)??[]]).filter(e=>e.isSatisfiedBy(t));if(0===r.length&&void 0!==e.autobindOptions&&"function"==typeof n){let i=ts(e.autobindOptions,n);e.operations.setBinding(i),i.isSatisfiedBy(t)&&r.push(i)}return r}var t0=class e{last;length;constructor(e,t){this.last=e,this.length=t}concat(t){return new e({elem:t,previous:this.last},this.length+1)}[Symbol.iterator](){let e=this.last;return{next:()=>{if(void 0===e)return{done:!0,value:void 0};let t=e.elem;return e=e.previous,{done:!1,value:t}}}}};function t1(e){let t=new Map;return void 0!==e.rootConstraints.tag&&t.set(e.rootConstraints.tag.key,e.rootConstraints.tag.value),new t0({elem:{getAncestorsCalled:!1,name:e.rootConstraints.name,serviceIdentifier:e.rootConstraints.serviceIdentifier,tags:t},previous:void 0},1)}function t2(e){return void 0!==e.redirections}function t3(e,t,i,n){var r,o,s,a,c,d;let l=i.elem.serviceIdentifier,u=i.previous?.elem.serviceIdentifier;Array.isArray(e)?function(e,t,i,n,r,o){if(0===e.length)t||t4(i,n,r,o);else{let t=`Ambiguous bindings found for service: "${eS(o[o.length-1]??i)}".${t8(o)}
Registered bindings:
${e.map(e=>(function(e){switch(e.type){case eP.Instance:return`[ type: "${e.type}", serviceIdentifier: "${eS(e.serviceIdentifier)}", scope: "${e.scope}", implementationType: "${e.implementationType.name}" ]`;case eP.ServiceRedirection:return`[ type: "${e.type}", serviceIdentifier: "${eS(e.serviceIdentifier)}", redirection: "${eS(e.targetServiceIdentifier)}" ]`;default:return`[ type: "${e.type}", serviceIdentifier: "${eS(e.serviceIdentifier)}", scope: "${e.scope}" ]`}})(e.binding)).join("\n")}
Trying to resolve bindings for "${t5(i,n)}".${t6(r)}`;throw new tr(tt.planning,t)}}(e,t,l,u,i.elem,n):(r=e,o=t,s=l,a=u,c=i.elem,d=n,void 0!==r||o||t4(s,a,c,d))}function t4(e,t,i,n){let r=`No bindings found for service: "${eS(n[n.length-1]??e)}".
Trying to resolve bindings for "${t5(e,t)}".${t8(n)}${t6(i)}`;throw new tr(tt.planning,r)}function t5(e,t){return void 0===t?`${eS(e)} (Root service)`:eS(t)}function t6(e){let t=0===e.tags.size?"":`
- tags:
- ${[...e.tags.keys()].map(e=>e.toString()).join("\n - ")}`;return`
Binding constraints:
- service identifier: ${eS(e.serviceIdentifier)}
- name: ${e.name?.toString()??"-"}${t}`}function t8(e){return 0===e.length?"":`
- service redirections:
- ${e.map(e=>eS(e)).join("\n - ")}`}function t7(e,t,i){if(Array.isArray(e.bindings)&&1===e.bindings.length){let[n]=e.bindings;t2(n)&&function e(t,i,n,r){if(1===t.redirections.length){let[o]=t.redirections;t2(o)&&e(o,i,n,[...r,o.binding.targetServiceIdentifier]);return}t3(t.redirections,i,n,r)}(n,t,i,[n.binding.targetServiceIdentifier]);return}t3(e.bindings,t,i,[])}function t9(e){return eA.is(e)?e.unwrap():e}function ie(e){return(t,i,n)=>{let r=t9(n.value),o=i.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:r,tags:n.tags}),s=new tY(o.last),a=n.kind===ni.multipleInjection&&n.chained,c=tZ(t,s,{chained:a}),d=[],l={bindings:d,isContextFree:!0,serviceIdentifier:r};if(d.push(...e(t,o,c,l,a)),l.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===ni.singleInjection){t7(l,n.optional,o.last);let[e]=d;l.bindings=e}return l}}function it(e){return(t,i,n)=>{let r=t9(n.value),o=i.concat({getAncestorsCalled:!1,name:n.name,serviceIdentifier:r,tags:n.tags}),s=new tY(o.last),a=n.kind===nr.multipleInjection&&n.chained,c=tZ(t,s,{chained:a}),d=[],l={bindings:d,isContextFree:!0,serviceIdentifier:r};if(d.push(...e(t,o,c,l,a)),l.isContextFree=!o.last.elem.getAncestorsCalled,n.kind===nr.singleInjection){t7(l,n.optional,o.last);let[e]=d;l.bindings=e}return l}}function ii(e){var t,i,n;let r=(t=e,(e,i,n)=>{let r={binding:i,classMetadata:e.operations.getClassMetadata(i.implementationType),constructorParams:[],propertyParams:new Map};return t({autobindOptions:e.autobindOptions,node:r,operations:e.operations,servicesBranch:e.servicesBranch},n)}),o=(i=e,(e,t,n)=>i({autobindOptions:e.autobindOptions,node:{binding:t,params:[]},operations:e.operations,servicesBranch:e.servicesBranch},n)),s=(e,t,i,n,s)=>{let c=t2(n)?n.binding.targetServiceIdentifier:n.serviceIdentifier;e.servicesBranch.push(c);let d=[];for(let n of i)switch(n.type){case eP.Instance:d.push(r(e,n,t));break;case eP.ResolvedValue:d.push(o(e,n,t));break;case eP.ServiceRedirection:{let i=a(e,t,n,s);d.push(i);break}default:d.push({binding:n})}return e.servicesBranch.pop(),d},a=(n=s,(e,t,i,r)=>{let o={binding:i,redirections:[]},s=tZ(e,new tY(t.last),{chained:r,customServiceIdentifier:i.targetServiceIdentifier});return o.redirections.push(...n(e,t,s,o,r)),o});return s}function ir(e,t,i,n){void 0!==e&&(tX.is(i)&&!i.isExpanded()||i.isContextFree)?t.setPlan(e,{tree:{root:i}}):t.setNonCachedServiceNode(i,n)}var io=class extends tX{#e;#t;#i;#n;constructor(e,t,i,n,r){super(r,t9(n.value)),this.#t=t,this.#e=e,this.#i=i,this.#n=n}_buildPlanServiceNode(){return this.#t(this.#e,this.#i,this.#n)}},is=class extends tX{#e;#t;#i;#n;constructor(e,t,i,n,r){super(r,t9(n.value)),this.#e=e,this.#t=t,this.#i=i,this.#n=n}_buildPlanServiceNode(){return this.#t(this.#e,this.#i,this.#n)}};function ia(e,t,i,n){var r,o,s,a,c,d,l,u;let h,f,v=(r=e,o=i,h=(s=r,a=o,(e,t,i)=>{if(i.kind===ni.unmanaged)return;if(t.length>500)throw new tr(tt.planningMaxDepthExceeded,"Maximum plan depth exceeded. This is likely caused by a circular dependency.");let n=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;let[i,n]=e.tags.entries().next().value;t={key:i,value:n}}let i=eA.is(e.value)?e.value.unwrap():e.value;return e.kind===ni.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}}(i);if(void 0!==n){let t=e.operations.getPlan(n);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}let r=new io(e,s,t,i,a(e,t,i));return ir(n,e.operations,r,{bindingConstraintsList:t,chainedBindings:i.kind===ni.multipleInjection&&i.chained,optionalBindings:i.optional}),r}),(e,t,i)=>{let n=t.classMetadata;for(let[r,o]of n.constructorArguments.entries())t.constructorParams[r]=h(e,i,o);for(let[r,o]of n.properties){let n=h(e,i,o);void 0!==n&&t.propertyParams.set(r,n)}return e.node}),g=(c=t,d=n,f=(l=c,u=d,(e,t,i)=>{let n=function(e){let t;if(0===e.tags.size)t=void 0;else{if(1!==e.tags.size)return;let[i,n]=e.tags.entries().next().value;t={key:i,value:n}}let i=eA.is(e.value)?e.value.unwrap():e.value;return e.kind===nr.multipleInjection?{chained:e.chained,isMultiple:!0,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}:{isMultiple:!1,name:e.name,optional:e.optional,serviceIdentifier:i,tag:t}}(i);if(void 0!==n){let t=e.operations.getPlan(n);if(void 0!==t&&t.tree.root.isContextFree)return t.tree.root}let r=new is(e,l,t,i,u(e,t,i));return ir(n,e.operations,r,{bindingConstraintsList:t,chainedBindings:i.kind===nr.multipleInjection&&i.chained,optionalBindings:i.optional}),r}),(e,t,i)=>{for(let[n,r]of t.binding.metadata.arguments.entries())t.params[n]=f(e,i,r);return e.node});return(e,t)=>e.node.binding.type===eP.Instance?v(e,e.node,t):g(e,e.node,t)}var ic=class extends tX{#e;constructor(e,t){super(t,t.serviceIdentifier),this.#e=e}_buildPlanServiceNode(){return iv(this.#e)}},id=ie(ih),il=it(ih),iu=ii(ia(id,il,id,il));function ih(e,t,i,n,r){return iu(e,t,i,n,r)}var iv=e=>{let t=t1(e),i=new tY(t.last),n=e.rootConstraints.isMultiple&&e.rootConstraints.chained,r=tZ(e,i,{chained:n}),o=[],s={bindings:o,isContextFree:!0,serviceIdentifier:e.rootConstraints.serviceIdentifier};if(o.push(...iu(e,t,r,s,n)),s.isContextFree=!t.last.elem.getAncestorsCalled,!e.rootConstraints.isMultiple){t7(s,e.rootConstraints.isOptional??!1,t.last);let[i]=o;s.bindings=i}return s};(i2=no||={}).bindingAdded="bindingAdded",i2.bindingRemoved="bindingRemoved";var ig=class{#e;#t;#i;constructor(){this.#e=[],this.#t=8,this.#i=1024}*[Symbol.iterator](){let e=0;for(let t of this.#e){let i=t.deref();void 0===i?++e:yield i}this.#e.length>=this.#t&&this.#s(e)&&this.#n(e)}push(e){let t=new WeakRef(e);if(this.#e.push(t),this.#e.length>=this.#t&&this.#e.length%this.#i==0){let e=0;for(let t of this.#e)void 0===t.deref()&&++e;this.#s(e)&&this.#n(e)}}#n(e){let t=Array(this.#e.length-e),i=0;for(let e of this.#e)e.deref()&&(t[i++]=e);this.#e=t}#s(e){return e>=.5*this.#e.length}},ip=ii(ia(id,il,function(e,t,i){return im(e,t,i)},function(e,t,i){return iy(e,t,i)})),im=(r=ie(ip),(e,t,i)=>{try{return r(e,t,i)}catch(e){if(tr.isErrorOfKind(e,tt.planning))return;throw e}}),iy=(o=it(ip),(e,t,i)=>{try{return o(e,t,i)}catch(e){if(tr.isErrorOfKind(e,tt.planning))return;throw e}});function ib(e,t,i,n,r){if(tX.is(t)&&!t.isExpanded())return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1};let o=new tY(n.last);return!i.isSatisfiedBy(o)||n.last.elem.getAncestorsCalled?{isContextFreeBinding:!n.last.elem.getAncestorsCalled,shouldInvalidateServiceNode:!1}:function(e,t,i,n,r){let o;try{[o]=ip(e,n,[i],t,r)}catch(e){if(tQ(e)||tr.isErrorOfKind(e,tt.planningMaxDepthExceeded))return{isContextFreeBinding:!1,shouldInvalidateServiceNode:!0};throw e}var s=t,a=o;if(Array.isArray(s.bindings))s.bindings.push(a);else if(void 0===s.bindings)s.bindings=a;else{if(!tX.is(s))throw new tr(tt.planning,"Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!0}}return{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1}}(e,t,i,n,r)}function iw(e,t,i,n){let r;if(tX.is(e)&&!e.isExpanded())return{bindingNodeRemoved:void 0,isContextFreeBinding:!0};let o=new tY(i.last);if(!t.isSatisfiedBy(o)||i.last.elem.getAncestorsCalled)return{bindingNodeRemoved:void 0,isContextFreeBinding:!i.last.elem.getAncestorsCalled};if(Array.isArray(e.bindings))e.bindings=e.bindings.filter(e=>e.binding!==t||(r=e,!1));else if(e.bindings?.binding===t)if(r=e.bindings,n)e.bindings=void 0;else{if(!tX.is(e))throw new tr(tt.planning,"Unexpected non-lazy plan service node. This is likely a bug in the planning logic. Please, report this issue");e.invalidate()}return{bindingNodeRemoved:r,isContextFreeBinding:!0}}var iI=class{#e;#t;#i;#n;#s;#r;constructor(){this.#e=new Map,this.#t=this.#o(),this.#i=this.#o(),this.#n=this.#o(),this.#s=this.#o(),this.#r=new ig}clearCache(){for(let e of this.#a())e.clear();for(let e of this.#r)e.clearCache()}get(e){return void 0===e.name?void 0===e.tag?this.#c(this.#t,e).get(e.serviceIdentifier):this.#c(this.#s,e).get(e.serviceIdentifier)?.get(e.tag.key)?.get(e.tag.value):void 0===e.tag?this.#c(this.#i,e).get(e.serviceIdentifier)?.get(e.name):this.#c(this.#n,e).get(e.serviceIdentifier)?.get(e.name)?.get(e.tag.key)?.get(e.tag.value)}invalidateServiceBinding(e){for(let t of(this.#f(e),this.#h(e),this.#v(e),this.#g(e),this.#p(e),this.#r))t.invalidateServiceBinding(e)}set(e,t){void 0===e.name?void 0===e.tag?this.#c(this.#t,e).set(e.serviceIdentifier,t):this.#u(this.#u(this.#c(this.#s,e),e.serviceIdentifier),e.tag.key).set(e.tag.value,t):void 0===e.tag?this.#u(this.#c(this.#i,e),e.serviceIdentifier).set(e.name,t):this.#u(this.#u(this.#u(this.#c(this.#n,e),e.serviceIdentifier),e.name),e.tag.key).set(e.tag.value,t)}setNonCachedServiceNode(e,t){let i=this.#e.get(e.serviceIdentifier);void 0===i&&(i=new Map,this.#e.set(e.serviceIdentifier,i)),i.set(e,t)}subscribe(e){this.#r.push(e)}#o(){let e=Array(8);for(let t=0;t<e.length;++t)e[t]=new Map;return e}#l(e,t,i,n){let r=(2&t)!=0,o;return o=r?{chained:(0&t)!=0,isMultiple:r,serviceIdentifier:e.binding.serviceIdentifier}:{isMultiple:r,serviceIdentifier:e.binding.serviceIdentifier},(1&t)!=0&&(o.isOptional=!0),void 0!==i&&(o.name=i),void 0!==n&&(o.tag=n),{autobindOptions:void 0,operations:e.operations,rootConstraints:o,servicesBranch:[]}}#u(e,t){let i=e.get(t);return void 0===i&&(i=new Map,e.set(t,i)),i}#c(e,t){return e[this.#d(t)]}#a(){return[this.#e,...this.#t,...this.#i,...this.#n,...this.#s]}#d(e){return e.isMultiple?4*!!e.chained|!!e.optional|2:+!!e.optional}#h(e){for(let[t,i]of this.#i.entries()){let n=i.get(e.binding.serviceIdentifier);if(void 0!==n)for(let[i,r]of n.entries())this.#m(e,r,t,i,void 0)}}#v(e){for(let[t,i]of this.#n.entries()){let n=i.get(e.binding.serviceIdentifier);if(void 0!==n)for(let[i,r]of n.entries())for(let[n,o]of r.entries())for(let[r,s]of o.entries())this.#m(e,s,t,i,{key:n,value:r})}}#y(e){switch(e.binding.type){case eP.ServiceRedirection:for(let t of e.redirections)this.#y(t);break;case eP.Instance:for(let t of e.constructorParams)void 0!==t&&this.#b(t);for(let t of e.propertyParams.values())this.#b(t);break;case eP.ResolvedValue:for(let t of e.params)this.#b(t)}}#b(e){let t=this.#e.get(e.serviceIdentifier);void 0!==t&&t.has(e)&&(t.delete(e),this.#w(e))}#w(e){if(!(tX.is(e)&&!e.isExpanded())&&void 0!==e.bindings)if(Array.isArray(e.bindings))for(let t of e.bindings)this.#y(t);else this.#y(e.bindings)}#p(e){let t=this.#e.get(e.binding.serviceIdentifier);if(void 0!==t)switch(e.kind){case no.bindingAdded:for(let[i,n]of t){let t=ib({autobindOptions:void 0,operations:e.operations,servicesBranch:[]},i,e.binding,n.bindingConstraintsList,n.chainedBindings);t.isContextFreeBinding?t.shouldInvalidateServiceNode&&tX.is(i)&&(this.#w(i),i.invalidate()):this.clearCache()}break;case no.bindingRemoved:for(let[i,n]of t){let t=iw(i,e.binding,n.bindingConstraintsList,n.optionalBindings);t.isContextFreeBinding?void 0!==t.bindingNodeRemoved&&this.#y(t.bindingNodeRemoved):this.clearCache()}}}#f(e){for(let[t,i]of this.#t.entries()){let n=i.get(e.binding.serviceIdentifier);this.#m(e,n,t,void 0,void 0)}}#g(e){for(let[t,i]of this.#s.entries()){let n=i.get(e.binding.serviceIdentifier);if(void 0!==n)for(let[i,r]of n.entries())for(let[n,o]of r.entries())this.#m(e,o,t,void 0,{key:i,value:n})}}#m(e,t,i,n,r){if(void 0!==t&&tX.is(t.tree.root)){var o,s,a,c;let d=this.#l(e,i,n,r);switch(e.kind){case no.bindingAdded:{let i=(o=t.tree.root,s=e.binding,tX.is(o)&&!o.isExpanded()?{isContextFreeBinding:!0,shouldInvalidateServiceNode:!1}:ib(d,o,s,t1(d),d.rootConstraints.isMultiple&&d.rootConstraints.chained));i.isContextFreeBinding?i.shouldInvalidateServiceNode&&(this.#w(t.tree.root),t.tree.root.invalidate()):this.clearCache()}break;case no.bindingRemoved:{let i=(a=t.tree.root,c=e.binding,tX.is(a)&&!a.isExpanded()?{bindingNodeRemoved:void 0,isContextFreeBinding:!0}:iw(a,c,t1(d),d.rootConstraints.isOptional??!1));i.isContextFreeBinding?void 0!==i.bindingNodeRemoved&&this.#y(i.bindingNodeRemoved):this.clearCache()}}}}};function iS(e,t){return eI(t)?(e.cache={isRight:!0,value:t},t.then(t=>iC(e,t))):iC(e,t)}function iC(e,t){return e.cache={isRight:!0,value:t},t}async function iA(e,t,i){let n=await t,r=i.next();for(;!0!==r.done;)n=await r.value(e.context,n),r=i.next();return n}function ix(e,t,i){var n,r;let o,s=i;if(void 0!==t.onActivation){let i=t.onActivation;s=eI(s)?s.then(t=>i(e.context,t)):i(e.context,s)}return n=t.serviceIdentifier,r=s,void 0===(o=e.getActivations(n))?r:eI(r)?iA(e,r,o[Symbol.iterator]()):function(e,t,i){let n=t,r=i.next();for(;!0!==r.done;){let t=r.value(e.context,n);if(eI(t))return iA(e,t,i);n=t,r=i.next()}return n}(e,r,o[Symbol.iterator]())}function ij(e){return(t,i)=>i.cache.isRight?i.cache.value:iS(i,ix(t,i,e(t,i)))}var iM=ij(function(e,t){return t.value});function iB(e,t){return(i,n)=>{let r=e(n);switch(r.scope){case e$.Singleton:return r.cache.isRight?r.cache.value:iS(r,ix(i,r,t(i,n)));case e$.Request:{if(i.requestScopeCache.has(r.id))return i.requestScopeCache.get(r.id);let e=ix(i,r,t(i,n));return i.requestScopeCache.set(r.id,e),e}case e$.Transient:return ix(i,r,t(i,n))}}}var iR=iB(function(e){return e},function(e,t){return t.value(e.context)}),iO=ij(function(e,t){return t.factory(e.context)});function ik(e,t,i){let n=function(e,t,i){if(i in e)if("function"==typeof e[i]){let n;try{n=e[i]()}catch(e){throw new tr(tt.resolution,`Unexpected error found when calling "${i.toString()}" @postConstruct decorated method on class "${t.implementationType.name}"`,{cause:e})}if(eI(n))return i$(t,i,n)}else throw new tr(tt.resolution,`Expecting a "${i.toString()}" method when resolving "${t.implementationType.name}" class @postConstruct decorated method, a non function property was found instead.`);else throw new tr(tt.resolution,`Expecting a "${i.toString()}" property when resolving "${t.implementationType.name}" class @postConstruct decorated method, none found.`)}(e,t,i);return eI(n)?n.then(()=>e):e}async function i$(e,t,i){try{await i}catch(i){throw new tr(tt.resolution,`Unexpected error found when calling "${t.toString()}" @postConstruct decorated method on class "${e.implementationType.name}"`,{cause:i})}}function iP(e,t,i){if(0===i.size)return e;let n=e;for(let e of i)n=eI(n)?n.then(i=>ik(i,t,e)):ik(n,t,e);return n}function iN(e){return(t,i,n)=>{let r=new n.binding.implementationType(...t),o=e(i,r,n);return eI(o)?o.then(()=>iP(r,n.binding,n.classMetadata.lifecycle.postConstructMethodNames)):iP(r,n.binding,n.classMetadata.lifecycle.postConstructMethodNames)}}var iD=(i3=iV,(e,t,i)=>{let n=[];for(let[r,o]of i.propertyParams){let s=i.classMetadata.properties.get(r);if(void 0===s)throw new tr(tt.resolution,`Expecting metadata at property "${r.toString()}", none found`);s.kind!==ni.unmanaged&&void 0!==o.bindings&&(t[r]=i3(e,o),eI(t[r])&&n.push((async()=>{t[r]=await t[r]})()))}if(n.length>0)return Promise.all(n).then(()=>void 0)}),iE=(i4=iK,function e(t,i){let n=[];for(let r of i.redirections)t2(r)?n.push(...e(t,r)):n.push(i4(t,r));return n}),iT=(i5=iV,i8=(e,t)=>{let i=[];for(let n of t.constructorParams)void 0===n?i.push(void 0):i.push(i5(e,n));return i.some(eI)?Promise.all(i):i},i6=iN(iD),i7=async(e,t,i)=>i6(await e,t,i),i9=iN(iD),(e,t)=>{let i=i8(e,t);return eI(i)?i7(i,e,t):i9(i,e,t)}),iF=(ne=iV,nt=(e,t)=>{let i=[];for(let n of t.params)i.push(ne(e,n));return i.some(eI)?Promise.all(i):i},(e,t)=>{let i=nt(e,t);return eI(i)?i.then(e=>t.binding.factory(...e)):t.binding.factory(...i)}),i_=iB(function(e){return e.binding},iT),iU=iB(function(e){return e.binding},iF);function iK(e,t){switch(t.binding.type){case eP.ConstantValue:return iM(e,t.binding);case eP.DynamicValue:return iR(e,t.binding);case eP.Factory:return iO(e,t.binding);case eP.Instance:return i_(e,t);case eP.ResolvedValue:return iU(e,t)}}function iV(e,t){if(void 0!==t.bindings)return Array.isArray(t.bindings)?function(e,t){let i=[];for(let n of t)t2(n)?i.push(...iE(e,n)):i.push(iK(e,n));return i.some(eI)?Promise.all(i):i}(e,t.bindings):function(e,t){if(!t2(t))return iK(e,t);{let i=iE(e,t);if(1===i.length)return i[0];throw new tr(tt.resolution,"Unexpected multiple resolved values on single injection")}}(e,t.bindings)}function iz(e,t){if("function"==typeof e[t])return e[t]()}function iq(e,t){let i,n=e.lifecycle.preDestroyMethodNames;if(0!==n.size){for(let e of n)i=void 0===i?iz(t,e):i.then(()=>iz(t,e));return i}}function iL(e,t,i){let n=e.getDeactivations(t);if(void 0!==n)return eI(i)?iW(i,n[Symbol.iterator]()):function(e,t){let i=t.next();for(;!0!==i.done;){if(eI(i.value(e)))return iW(e,t);i=t.next()}}(i,n[Symbol.iterator]())}async function iW(e,t){let i=await e,n=t.next();for(;!0!==n.done;)await n.value(i),n=t.next()}function iH(e,t){let i=t.cache;return eI(i.value)?i.value.then(i=>iG(e,t,i)):iG(e,t,i.value)}function iG(e,t,i){let n;return void 0!==t.onDeactivation&&(n=(0,t.onDeactivation)(i)),void 0===n?iL(e,t.serviceIdentifier,i):n.then(()=>iL(e,t.serviceIdentifier,i))}function iQ(e,t){if(void 0===t)return;let i=function(e){let t=[];for(let i of e)void 0!==i.scope&&i.scope===e$.Singleton&&i.cache.isRight&&t.push(i);return t}(t),n=[];for(let t of i){let i=function(e,t){let i=function(e,t){if(t.type===eP.Instance){let i=e.getClassMetadata(t.implementationType),n=t.cache.value;return eI(n)?n.then(e=>iq(i,e)):iq(i,n)}}(e,t);return void 0===i?iH(e,t):i.then(()=>iH(e,t))}(e,t);void 0!==i&&n.push(i)}if(n.length>0)return Promise.all(n).then(()=>void 0)}var iJ=Symbol.for("@inversifyjs/container/bindingIdentifier");function iX(e){return"object"==typeof e&&!!e&&!0===e[iJ]}var iY,iZ,i0,i1,i2,i3,i4,i5,i6,i8,i7,i9,ne,nt,ni,nn,nr,no,ns,na=class{static always=e=>!0},nc=Symbol.for("@inversifyjs/container/InversifyContainerError"),nd=class e extends Error{[nc];kind;constructor(e,t,i){super(t,i),this[nc]=!0,this.kind=e}static is(e){return"object"==typeof e&&!!e&&!0===e[nc]}static isErrorOfKind(t,i){return e.is(t)&&t.kind===i}};function nl(e){return{[iJ]:!0,id:e.id}}function nu(e){return t=>{for(let i=t.getAncestor();void 0!==i;i=i.getAncestor())if(e(i))return!0;return!1}}function nh(e){return t=>t.name===e}function nf(e){return t=>t.serviceIdentifier===e}function nv(e,t){return i=>i.tags.has(e)&&i.tags.get(e)===t}function ng(e){return void 0===e.name&&0===e.tags.size}function np(e){let t=nu(e);return e=>!t(e)}function nm(e){return t=>{let i=t.getAncestor();return void 0===i||!e(i)}}function ny(e){return t=>{let i=t.getAncestor();return void 0!==i&&e(i)}}(u=ns||={})[u.invalidOperation=0]="invalidOperation";var nb=class{#e;constructor(e){this.#e=e}getIdentifier(){return nl(this.#e)}inRequestScope(){return this.#e.scope=e$.Request,new nC(this.#e)}inSingletonScope(){return this.#e.scope=e$.Singleton,new nC(this.#e)}inTransientScope(){return this.#e.scope=e$.Transient,new nC(this.#e)}},nw=class{#e;#t;#i;#n;constructor(e,t,i,n){this.#e=e,this.#t=t,this.#i=i,this.#n=n}to(e){let t=to(e),i={cache:{isRight:!1,value:void 0},id:ek(),implementationType:e,isSatisfiedBy:na.always,moduleId:this.#t,onActivation:void 0,onDeactivation:void 0,scope:t.scope??this.#i,serviceIdentifier:this.#n,type:eP.Instance};return this.#e(i),new nA(i)}toSelf(){if("function"!=typeof this.#n)throw Error('"toSelf" function can only be applied when a newable function is used as service identifier');return this.to(this.#n)}toConstantValue(e){let t={cache:{isRight:!1,value:void 0},id:ek(),isSatisfiedBy:na.always,moduleId:this.#t,onActivation:void 0,onDeactivation:void 0,scope:e$.Singleton,serviceIdentifier:this.#n,type:eP.ConstantValue,value:e};return this.#e(t),new nC(t)}toDynamicValue(e){let t={cache:{isRight:!1,value:void 0},id:ek(),isSatisfiedBy:na.always,moduleId:this.#t,onActivation:void 0,onDeactivation:void 0,scope:this.#i,serviceIdentifier:this.#n,type:eP.DynamicValue,value:e};return this.#e(t),new nA(t)}toResolvedValue(e,t){let i={cache:{isRight:!1,value:void 0},factory:e,id:ek(),isSatisfiedBy:na.always,metadata:this.#s(t),moduleId:this.#t,onActivation:void 0,onDeactivation:void 0,scope:this.#i,serviceIdentifier:this.#n,type:eP.ResolvedValue};return this.#e(i),new nA(i)}toFactory(e){let t={cache:{isRight:!1,value:void 0},factory:e,id:ek(),isSatisfiedBy:na.always,moduleId:this.#t,onActivation:void 0,onDeactivation:void 0,scope:e$.Singleton,serviceIdentifier:this.#n,type:eP.Factory};return this.#e(t),new nC(t)}toService(e){let t={id:ek(),isSatisfiedBy:na.always,moduleId:this.#t,serviceIdentifier:this.#n,targetServiceIdentifier:e,type:eP.ServiceRedirection};this.#e(t)}#s(e){return{arguments:(e??[]).map(e=>"object"!=typeof e||eA.is(e)?{kind:nr.singleInjection,name:void 0,optional:!1,tags:new Map,value:e}:!0===e.isMultiple?{chained:e.chained??!1,kind:nr.multipleInjection,name:e.name,optional:e.optional??!1,tags:new Map((e.tags??[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier}:{kind:nr.singleInjection,name:e.name,optional:e.optional??!1,tags:new Map((e.tags??[]).map(e=>[e.key,e.value])),value:e.serviceIdentifier})}}},nI=class{#e;constructor(e){this.#e=e}getIdentifier(){return nl(this.#e)}onActivation(e){return this.#e.onActivation=e,new nS(this.#e)}onDeactivation(e){if(this.#e.onDeactivation=e,this.#e.scope!==e$.Singleton)throw new nd(ns.invalidOperation,`Binding for service "${eS(this.#e.serviceIdentifier)}" has a deactivation function, but its scope is not singleton. Deactivation functions can only be used with singleton bindings.`);return new nS(this.#e)}},nS=class{#e;constructor(e){this.#e=e}getIdentifier(){return nl(this.#e)}when(e){return this.#e.isSatisfiedBy=e,new nI(this.#e)}whenAnyAncestor(e){return this.when(nu(e))}whenAnyAncestorIs(e){return this.when(nu(nf(e)))}whenAnyAncestorNamed(e){return this.when(nu(nh(e)))}whenAnyAncestorTagged(e,t){return this.when(nu(nv(e,t)))}whenDefault(){return this.when(ng)}whenNamed(e){return this.when(nh(e))}whenNoParent(e){return this.when(nm(e))}whenNoParentIs(e){return this.when(nm(nf(e)))}whenNoParentNamed(e){return this.when(nm(nh(e)))}whenNoParentTagged(e,t){return this.when(nm(nv(e,t)))}whenParent(e){return this.when(ny(e))}whenParentIs(e){return this.when(ny(nf(e)))}whenParentNamed(e){return this.when(ny(nh(e)))}whenParentTagged(e,t){return this.when(ny(nv(e,t)))}whenTagged(e,t){return this.when(nv(e,t))}whenNoAncestor(e){return this.when(np(e))}whenNoAncestorIs(e){return this.when(np(nf(e)))}whenNoAncestorNamed(e){return this.when(np(nh(e)))}whenNoAncestorTagged(e,t){return this.when(np(nv(e,t)))}},nC=class extends nS{#e;constructor(e){super(e),this.#e=new nI(e)}onActivation(e){return this.#e.onActivation(e)}onDeactivation(e){return this.#e.onDeactivation(e)}},nA=class extends nC{#e;constructor(e){super(e),this.#e=new nb(e)}inRequestScope(){return this.#e.inRequestScope()}inSingletonScope(){return this.#e.inSingletonScope()}inTransientScope(){return this.#e.inTransientScope()}},nx=class{#e;#t;#i;#n;constructor(e,t,i,n){this.#e=e,this.#t=t,this.#i=i,this.#n=n}bind(e){return new nw(e=>{this.#s(e)},void 0,this.#t,e)}isBound(e,t){let i=this.#n.bindingService.get(e);return this.#v(e,i,t)}isCurrentBound(e,t){let i=this.#n.bindingService.getNonParentBindings(e);return this.#v(e,i,t)}async rebindAsync(e){return await this.unbindAsync(e),this.bind(e)}rebind(e){return this.unbind(e),this.bind(e)}async unbindAsync(e){await this.#o(e)}async unbindAllAsync(){await this.#c()}unbindAll(){if(void 0!==this.#c())throw new nd(ns.invalidOperation,"Unexpected asynchronous deactivation when unbinding all services. Consider using Container.unbindAllAsync() instead.")}unbind(e){void 0!==this.#o(e)&&this.#r(e)}#s(e){this.#n.bindingService.set(e),this.#i.invalidateService({binding:e,kind:no.bindingAdded})}#r(e){let t;if(iX(e)){let i=function(e){var t=e?.[Symbol.iterator]();if(void 0===t)return;let i=t.next();return!0!==i.done?i.value:void 0}(this.#n.bindingService.getById(e.id))?.serviceIdentifier;t=void 0===i?"Unexpected asynchronous deactivation when unbinding binding identifier. Consider using Container.unbindAsync() instead.":`Unexpected asynchronous deactivation when unbinding "${eS(i)}" binding. Consider using Container.unbindAsync() instead.`}else t=`Unexpected asynchronous deactivation when unbinding "${eS(e)}" service. Consider using Container.unbindAsync() instead.`;throw new nd(ns.invalidOperation,t)}#o(e){return iX(e)?this.#l(e):this.#d(e)}#l(e){let t=this.#n.bindingService.getById(e.id),i=void 0===t?void 0:[...t],n=iQ(this.#e,t);if(void 0!==n)return n.then(()=>{this.#u(i,e)});this.#u(i,e)}#u(e,t){if(this.#n.bindingService.removeById(t.id),void 0!==e)for(let t of e)this.#i.invalidateService({binding:t,kind:no.bindingRemoved})}#c(){let e=[...this.#n.bindingService.getNonParentBoundServices()],t=e.map(e=>{var t;return t=this.#e,iQ(t,t.getBindings(e))});if(t.some(e=>eI(e)))return Promise.all(t).then(()=>{this.#a(e)});this.#a(e)}#a(e){for(let t of e)this.#n.activationService.removeAllByServiceId(t),this.#n.bindingService.removeAllByServiceId(t),this.#n.deactivationService.removeAllByServiceId(t);this.#n.planResultCacheService.clearCache()}#d(e){let t=this.#n.bindingService.get(e),i=void 0===t?void 0:[...t],n=iQ(this.#e,t);if(void 0!==n)return n.then(()=>{this.#h(e,i)});this.#h(e,i)}#h(e,t){if(this.#n.activationService.removeAllByServiceId(e),this.#n.bindingService.removeAllByServiceId(e),this.#n.deactivationService.removeAllByServiceId(e),void 0!==t)for(let e of t)this.#i.invalidateService({binding:e,kind:no.bindingRemoved})}#v(e,t,i){if(void 0===t)return!1;let n={getAncestor:()=>void 0,name:i?.name,serviceIdentifier:e,tags:new Map};for(let e of(i?.tag!==void 0&&n.tags.set(i.tag.key,i.tag.value),t))if(e.isSatisfiedBy(n))return!0;return!1}},nj=class{#e;#t;#i;#n;#s;constructor(e,t,i,n,r){this.#e=e,this.#t=t,this.#i=i,this.#n=n,this.#s=r}async loadAsync(...e){await Promise.all(this.#l(...e))}load(...e){for(let t of this.#l(...e))if(void 0!==t)throw new nd(ns.invalidOperation,"Unexpected asynchronous module load. Consider using container.loadAsync() instead.")}async unloadAsync(...e){await Promise.all(this.#c(...e)),this.#o(e)}unload(...e){for(let t of this.#c(...e))if(void 0!==t)throw new nd(ns.invalidOperation,"Unexpected asynchronous module unload. Consider using container.unloadAsync() instead.");this.#o(e)}#r(e){return{bind:t=>new nw(e=>{this.#u(e)},e,this.#i,t),isBound:this.#e.isBound.bind(this.#e),onActivation:(t,i)=>{this.#s.activationService.add(i,{moduleId:e,serviceId:t})},onDeactivation:(t,i)=>{this.#s.deactivationService.add(i,{moduleId:e,serviceId:t})},rebind:this.#e.rebind.bind(this.#e),rebindAsync:this.#e.rebindAsync.bind(this.#e),unbind:this.#e.unbind.bind(this.#e),unbindAsync:this.#e.unbindAsync.bind(this.#e)}}#o(e){for(let t of e)this.#s.activationService.removeAllByModuleId(t.id),this.#s.bindingService.removeAllByModuleId(t.id),this.#s.deactivationService.removeAllByModuleId(t.id);this.#s.planResultCacheService.clearCache()}#l(...e){return e.map(e=>e.load(this.#r(e.id)))}#u(e){this.#s.bindingService.set(e),this.#n.invalidateService({binding:e,kind:no.bindingAdded})}#c(...e){return e.map(e=>{var t,i;return t=this.#t,i=e.id,iQ(t,t.getBindingsFromModule(i))})}},nM=class{deactivationParams;constructor(e){this.deactivationParams={getBindings:e.bindingService.get.bind(e.bindingService),getBindingsFromModule:e.bindingService.getByModuleId.bind(e.bindingService),getClassMetadata:to,getDeactivations:e.deactivationService.get.bind(e.deactivationService)},e.onReset(()=>{var t;(t=this.deactivationParams).getBindings=e.bindingService.get.bind(e.bindingService),t.getBindingsFromModule=e.bindingService.getByModuleId.bind(e.bindingService),t.getDeactivations=e.deactivationService.get.bind(e.deactivationService)})}},nB=class{planParamsOperations;#e;constructor(e){this.#e=e,this.planParamsOperations={getBindings:this.#e.bindingService.get.bind(this.#e.bindingService),getBindingsChained:this.#e.bindingService.getChained.bind(this.#e.bindingService),getClassMetadata:to,getPlan:this.#e.planResultCacheService.get.bind(this.#e.planResultCacheService),setBinding:this.#i.bind(this),setNonCachedServiceNode:this.#e.planResultCacheService.setNonCachedServiceNode.bind(this.#e.planResultCacheService),setPlan:this.#e.planResultCacheService.set.bind(this.#e.planResultCacheService)},this.#e.onReset(()=>{this.#t()})}#t(){this.planParamsOperations.getBindings=this.#e.bindingService.get.bind(this.#e.bindingService),this.planParamsOperations.getBindingsChained=this.#e.bindingService.getChained.bind(this.#e.bindingService),this.planParamsOperations.setBinding=this.#i.bind(this)}#i(e){this.#e.bindingService.set(e),this.#e.planResultCacheService.invalidateServiceBinding({binding:e,kind:no.bindingAdded,operations:this.planParamsOperations})}},nR=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}invalidateService(e){this.#t.planResultCacheService.invalidateServiceBinding({...e,operations:this.#e.planParamsOperations})}},nO=class{#e;#t;#i;#n;constructor(e,t,i){this.#n=t,this.#i=i,this.#e=this.#r(e),this.#t=this.#o()}register(e,t){let i=new t(e,this.#t);this.#s(i),i.load(this.#e)}#s(e){if(!0!==e[eb])throw new nd(ns.invalidOperation,"Invalid plugin. The plugin must extend the Plugin class")}#r(e){return{define:(t,i)=>{if(Object.prototype.hasOwnProperty.call(e,t))throw new nd(ns.invalidOperation,`Container already has a method named "${String(t)}"`);e[t]=i},onPlan:this.#i.onPlan.bind(this.#i)}}#o(){let e=this.#n;return{get activationService(){return e.activationService},get bindingService(){return e.bindingService},get deactivationService(){return e.deactivationService},get planResultCacheService(){return e.planResultCacheService}}}},nk=class{activationService;bindingService;deactivationService;planResultCacheService;#e;constructor(e,t,i,n){this.activationService=e,this.bindingService=t,this.deactivationService=i,this.planResultCacheService=n,this.#e=[]}reset(e,t,i){for(let n of(this.activationService=e,this.bindingService=t,this.deactivationService=i,this.planResultCacheService.clearCache(),this.#e))n()}onReset(e){this.#e.push(e)}},n$=class{#e;#t;#i;#n;#s;#r;#o;constructor(e,t,i,n){this.#r=e,this.#o=t,this.#n=this.#h(),this.#e=i,this.#t=n,this.#i=e=>this.#o.activationService.get(e),this.#s=[],this.#o.onReset(()=>{this.#l()})}get(e,t){let i=this.#d(!1,e,t),n=this.#v(i);if(eI(n))throw new nd(ns.invalidOperation,`Unexpected asynchronous service when resolving service "${eS(e)}"`);return n}getAll(e,t){let i=this.#d(!0,e,t),n=this.#v(i);if(eI(n))throw new nd(ns.invalidOperation,`Unexpected asynchronous service when resolving service "${eS(e)}"`);return n}async getAllAsync(e,t){let i=this.#d(!0,e,t);return this.#v(i)}async getAsync(e,t){let i=this.#d(!1,e,t);return this.#v(i)}onPlan(e){this.#s.push(e)}#l(){this.#n=this.#h()}#u(e,t,i){let n=i?.name,r=i?.optional??!1,o=i?.tag;return e?{chained:i?.chained??!1,isMultiple:e,name:n,optional:r,serviceIdentifier:t,tag:o}:{isMultiple:e,name:n,optional:r,serviceIdentifier:t,tag:o}}#c(e,t,i){let n={autobindOptions:i?.autobind??this.#e?{scope:this.#t}:void 0,operations:this.#r.planParamsOperations,rootConstraints:this.#a(e,t,i),servicesBranch:[]};return this.#y(n,i),n}#a(e,t,i){return t?{chained:i?.chained??!1,isMultiple:t,serviceIdentifier:e}:{isMultiple:t,serviceIdentifier:e}}#d(e,t,i){let n=this.#u(e,t,i),r=this.#o.planResultCacheService.get(n);if(void 0!==r)return r;let o=function(e){try{let t=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},i=e.operations.getPlan(t);if(void 0!==i)return i;let n={tree:{root:new ic(e,iv(e))}};return e.operations.setPlan(t,n),n}catch(t){if(tQ(t)||tr.isErrorOfKind(t,tt.planningMaxDepthExceeded)){let i,n=0===(i=[...function(e){let t=new Set;for(let i of e.servicesBranch){if(t.has(i))return[...t,i];t.add(i)}return[...t]}(e)]).length?"(No dependency trace)":i.map(eS).join(" -> ");throw new tr(tt.planning,`Circular dependency found: ${n}`,{cause:t})}throw t}}(this.#c(t,e,i));for(let e of this.#s)e(n,o);return o}#h(){return{get:this.get.bind(this),getAll:this.getAll.bind(this),getAllAsync:this.getAllAsync.bind(this),getAsync:this.getAsync.bind(this)}}#v(e){return function(e){try{let t=e.planResult.tree.root;return iV(e,t)}catch(t){if(tQ(t)||tr.isErrorOfKind(t,tt.planningMaxDepthExceeded)){let i,n,r,o=0===(r=[...(i=e.planResult.tree.root,n=[],function e(t){let i=n.indexOf(t);if(-1!==i)return[...n.slice(i),t].map(e=>e.serviceIdentifier);n.push(t);try{for(let i of function(e){let t=[],i=e.bindings;if(void 0===i)return t;let n=e=>{if(t2(e)){for(let t of e.redirections)n(t);return}switch(e.binding.type){case eP.Instance:for(let i of e.constructorParams)void 0!==i&&t.push(i);for(let i of e.propertyParams.values())t.push(i);break;case eP.ResolvedValue:for(let i of e.params)t.push(i)}};if(Array.isArray(i))for(let e of i)n(e);else n(i);return t}(t)){let t=e(i);if(void 0!==t)return t}}finally{n.pop()}}(i)??[])]).length?"(No dependency trace)":r.map(eS).join(" -> ");throw new tr(tt.planning,`Circular dependency found: ${o}`,{cause:t})}throw t}}({context:this.#n,getActivations:this.#i,planResult:e,requestScopeCache:new Map})}#y(e,t){void 0!==t&&(void 0!==t.name&&(e.rootConstraints.name=t.name),!0===t.optional&&(e.rootConstraints.isOptional=!0),void 0!==t.tag&&(e.rootConstraints.tag={key:t.tag.key,value:t.tag.value}),e.rootConstraints.isMultiple&&(e.rootConstraints.chained=t?.chained??!1))}},nP=class{#e;#t;constructor(e){this.#e=e,this.#t=[]}restore(){let e=this.#t.pop();if(void 0===e)throw new nd(ns.invalidOperation,"No snapshot available to restore");this.#e.reset(e.activationService,e.bindingService,e.deactivationService)}snapshot(){this.#t.push({activationService:this.#e.activationService.clone(),bindingService:this.#e.bindingService.clone(),deactivationService:this.#e.deactivationService.clone()})}},nN=e$.Transient,nD=class{#e;#t;#i;#n;#s;#r;constructor(e){let t=e?.autobind??!1,i=e?.defaultScope??nN;this.#n=this.#l(e,t,i);let n=new nB(this.#n),r=new nR(n,this.#n),o=new nM(this.#n);this.#e=new nx(o.deactivationParams,i,r,this.#n),this.#t=new nj(this.#e,o.deactivationParams,i,r,this.#n),this.#s=new n$(n,this.#n,t,i),this.#i=new nO(this,this.#n,this.#s),this.#r=new nP(this.#n)}bind(e){return this.#e.bind(e)}get(e,t){return this.#s.get(e,t)}getAll(e,t){return this.#s.getAll(e,t)}async getAllAsync(e,t){return this.#s.getAllAsync(e,t)}async getAsync(e,t){return this.#s.getAsync(e,t)}isBound(e,t){return this.#e.isBound(e,t)}isCurrentBound(e,t){return this.#e.isCurrentBound(e,t)}async loadAsync(...e){return this.#t.loadAsync(...e)}load(...e){this.#t.load(...e)}onActivation(e,t){this.#n.activationService.add(t,{serviceId:e})}onDeactivation(e,t){this.#n.deactivationService.add(t,{serviceId:e})}register(e){this.#i.register(this,e)}restore(){this.#r.restore()}async rebindAsync(e){return this.#e.rebindAsync(e)}rebind(e){return this.#e.rebind(e)}snapshot(){this.#r.snapshot()}async unbindAsync(e){await this.#e.unbindAsync(e)}async unbindAllAsync(){await this.#e.unbindAllAsync()}unbindAll(){this.#e.unbindAll()}unbind(e){this.#e.unbind(e)}async unloadAsync(...e){return this.#t.unloadAsync(...e)}unload(...e){this.#t.unload(...e)}#o(e,t){if(e)return{scope:t}}#l(e,t,i){let n=this.#o(t,i);if(e?.parent===void 0)return new nk(e8.build(()=>void 0),tg.build(()=>void 0,n),tp.build(()=>void 0),new iI);let r=new iI,o=e.parent;return o.#n.planResultCacheService.subscribe(r),new nk(e8.build(()=>o.#n.activationService),tg.build(()=>o.#n.bindingService,n),tp.build(()=>o.#n.deactivationService),r)}};var nE=(h=[[e=>M.is(e),(e,t)=>t({bindings:e.bindings,isContextFree:e.isContextFree,serviceIdentifier:e.serviceIdentifier})]],s=new WeakMap,l=a=function(e){for(let[t,i]of h)if(t(e))return i(e,a);if("function"==typeof e){var t;return{name:(t=e).name,stringifiedContent:t.toString()}}if("object"==typeof e&&e){let t=s.get(e);if(void 0!==t)return t;let i=c(e);return s.set(e,i),i}return e},c=e=>{if("function"==typeof e[Symbol.iterator])return[...e].map(e=>l(e));let t={};for(let i of Reflect.ownKeys(e))t[i]=l(e[i]);return t},a),nT=class extends ew{load(e){e.onPlan((e,t)=>{self.postMessage({kind:"plan",options:nE(e),result:nE(t)})})}},nF=class extends nD{constructor(){super(),this.register(nT)}};export{nF as Container,eR as ContainerModule,eA as LazyServiceIdentifier,e$ as bindingScopeValues,eP as bindingTypeValues,tm as decorate,tM as inject,tP as injectFromBase,tN as injectFromHierarchy,tR as injectable,tD as multiInject,tF as named,tU as optional,tK as postConstruct,tV as preDestroy,tz as tagged,tW as unmanaged};