@webiny/api-composition-standalone 0.0.0-stage → 0.0.0-unstable.e1999482d0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/bulkActions/bulkActionsServer.d.ts +6 -0
  4. package/bulkActions/bulkActionsServer.js +26 -0
  5. package/bulkActions/bulkActionsServer.js.map +1 -0
  6. package/config/abstractions.d.ts +36 -0
  7. package/config/abstractions.js +5 -0
  8. package/config/abstractions.js.map +1 -0
  9. package/config/bakedSecrets.d.ts +8 -0
  10. package/config/bakedSecrets.js +17 -0
  11. package/config/bakedSecrets.js.map +1 -0
  12. package/config/readStandaloneConfig.d.ts +12 -0
  13. package/config/readStandaloneConfig.js +56 -0
  14. package/config/readStandaloneConfig.js.map +1 -0
  15. package/createWebinyApiHandler.d.ts +20 -0
  16. package/createWebinyApiHandler.js +136 -0
  17. package/createWebinyApiHandler.js.map +1 -0
  18. package/crypto/StandaloneEncryptionConfig.d.ts +17 -0
  19. package/crypto/StandaloneEncryptionConfig.js +20 -0
  20. package/crypto/StandaloneEncryptionConfig.js.map +1 -0
  21. package/crypto/StandaloneHashingConfig.d.ts +16 -0
  22. package/crypto/StandaloneHashingConfig.js +20 -0
  23. package/crypto/StandaloneHashingConfig.js.map +1 -0
  24. package/crypto/feature.d.ts +5 -0
  25. package/crypto/feature.js +13 -0
  26. package/crypto/feature.js.map +1 -0
  27. package/index.d.ts +2 -0
  28. package/index.js +1 -0
  29. package/package.json +50 -5
  30. package/publicUrls/ConfigPublicUrls.d.ts +13 -0
  31. package/publicUrls/ConfigPublicUrls.js +22 -0
  32. package/publicUrls/ConfigPublicUrls.js.map +1 -0
  33. package/publicUrls/feature.d.ts +4 -0
  34. package/publicUrls/feature.js +11 -0
  35. package/publicUrls/feature.js.map +1 -0
  36. package/scheduler/RecoverScheduledActionsHandler.d.ts +31 -0
  37. package/scheduler/RecoverScheduledActionsHandler.js +81 -0
  38. package/scheduler/RecoverScheduledActionsHandler.js.map +1 -0
  39. package/scheduler/RunScheduledActionOnceDecorator.d.ts +37 -0
  40. package/scheduler/RunScheduledActionOnceDecorator.js +91 -0
  41. package/scheduler/RunScheduledActionOnceDecorator.js.map +1 -0
  42. package/scheduler/ScheduledActionRecoverInputHandler.d.ts +14 -0
  43. package/scheduler/ScheduledActionRecoverInputHandler.js +5 -0
  44. package/scheduler/ScheduledActionRecoverInputHandler.js.map +1 -0
  45. package/scheduler/ScheduledActionRecoverInputType.d.ts +17 -0
  46. package/scheduler/ScheduledActionRecoverInputType.js +18 -0
  47. package/scheduler/ScheduledActionRecoverInputType.js.map +1 -0
  48. package/scheduler/abstractions/SchedulerSingleton.d.ts +10 -0
  49. package/scheduler/abstractions/SchedulerSingleton.js +5 -0
  50. package/scheduler/abstractions/SchedulerSingleton.js.map +1 -0
  51. package/scheduler/schedulerServer.d.ts +25 -0
  52. package/scheduler/schedulerServer.js +81 -0
  53. package/scheduler/schedulerServer.js.map +1 -0
  54. package/websockets/createWebsocketsAuthenticator.d.ts +4 -0
  55. package/websockets/createWebsocketsAuthenticator.js +47 -0
  56. package/websockets/createWebsocketsAuthenticator.js.map +1 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheduler/schedulerServer.js","sources":["../../src/scheduler/schedulerServer.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport { InputDispatcher } from \"@webiny/api-kernel-core\";\nimport { ScheduledActionInputType } from \"@webiny/api-kernel-core\";\nimport { SCHEDULED_ACTION_EVENT_IDENTIFIER } from \"@webiny/api-kernel-core\";\nimport type { IScheduledActionEvent } from \"@webiny/api-kernel-core\";\nimport { SchedulerService } from \"@webiny/api-scheduler/shared/abstractions.js\";\nimport { ScheduledActionLambdaHandler } from \"@webiny/api-scheduler\";\nimport { TimerSchedulerService } from \"@webiny/api-scheduler-standalone\";\nimport { SchedulerSingleton } from \"./abstractions/SchedulerSingleton.js\";\nimport { ScheduledActionRecoverInputType } from \"./ScheduledActionRecoverInputType.js\";\nimport { SCHEDULED_ACTION_RECOVER_EVENT_IDENTIFIER } from \"./ScheduledActionRecoverInputType.js\";\nimport type { IScheduledActionRecoverEvent } from \"./ScheduledActionRecoverInputType.js\";\nimport { RecoverScheduledActionsHandler } from \"./RecoverScheduledActionsHandler.js\";\nimport { ScheduledActionRecoverInputHandler } from \"./ScheduledActionRecoverInputHandler.js\";\nimport { RunScheduledActionOnceDecorator } from \"./RunScheduledActionOnceDecorator.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\n\n/**\n * ROOT wiring for the standalone (in-process timers) scheduler. Unlike AWS (per-request EventBridge\n * binding), the server holds ONE long-lived scheduler for all tenants, started once at boot —\n * the counterpart of the WebSockets connection manager. Registered as `SchedulerService` so\n * per-request create/update/delete (during GraphQL mutations) manipulate that single live timer set.\n *\n * When a timer fires (outside any request), the singleton dispatches a `ScheduledActionEvent`. The\n * handler is the one AWS runs for an EventBridge Scheduler invocation, in a fresh request container.\n */\nexport function registerSchedulerServer(rootContainer: Container): void {\n const dispatcher = rootContainer.resolve(InputDispatcher);\n const logger = rootContainer.resolve(Logger);\n\n const service = new TimerSchedulerService({\n logger,\n runAction: async (id, namespace, tenant) => {\n /*\n * `scheduleFor` is the time it fired. The event type needs one to recognise the event,\n * and nothing downstream reads it.\n */\n const event: IScheduledActionEvent = {\n [SCHEDULED_ACTION_EVENT_IDENTIFIER]: {\n id,\n namespace,\n tenant,\n scheduleFor: new Date().toISOString()\n }\n };\n // A failure is logged by the scheduler, which runs the action.\n await dispatcher.dispatch(event);\n }\n });\n\n // Register the ONE scheduler instance under TWO tokens — two views of the same object:\n //\n // - SchedulerService: the hosting-agnostic contract (create/update/delete/exists) that AWS\n // implements too. This is what per-request GraphQL mutations resolve to schedule/reschedule.\n // - SchedulerSingleton: typed as the CONCRETE TimerSchedulerService, so it also exposes the\n // methods that aren't on that contract — start() and recover(). Those are standalone-only: AWS's\n // EventBridge is managed infra (nothing to start) and persists its own schedules (nothing to\n // recover), so they don't belong on the shared interface. The boot step + recover handler\n // resolve this token precisely because they need start()/recover().\n //\n // registerInstance (not register) because it's a single live object holding all tenants' timers —\n // every caller must get the SAME instance, not a per-scope construction. Registered at root, so\n // per-request child containers inherit it via the parent chain; nothing registers a per-request\n // SchedulerService default that would shadow it (unlike e.g. the WS transport's Null default).\n rootContainer.registerInstance(SchedulerSingleton, service);\n rootContainer.registerInstance(SchedulerService, service);\n\n rootContainer.register(ScheduledActionInputType);\n rootContainer.register(ScheduledActionLambdaHandler);\n // Every process holds timers for the same actions; this lets only one of them run each action.\n rootContainer.registerDecorator(RunScheduledActionOnceDecorator);\n\n rootContainer.register(ScheduledActionRecoverInputType);\n rootContainer.register(RecoverScheduledActionsHandler);\n}\n\n// How often each process re-arms pending actions and fires overdue ones.\nconst RECOVER_EVERY_MS = 60_000;\n\nasync function recoverPendingSchedules(\n dispatcher: InputDispatcher.Interface,\n logger: Logger.Interface,\n atBoot: boolean\n): Promise<void> {\n const event: IScheduledActionRecoverEvent = {\n [SCHEDULED_ACTION_RECOVER_EVENT_IDENTIFIER]: true\n };\n\n try {\n const result = await dispatcher.dispatch<ScheduledActionRecoverInputHandler.Result>(event);\n if (atBoot) {\n logger.info(\n { recovered: result.recovered },\n \"[scheduler] boot recovery re-armed pending actions\"\n );\n }\n if (result.failedTenants.length > 0) {\n logger.error(\n { tenants: result.failedTenants },\n \"[scheduler] recovery failed for some tenants\"\n );\n }\n } catch (err) {\n logger.error({ error: err }, \"[scheduler] recovery failed\");\n }\n}\n\n/**\n * Boot step (onServer): start the timers, then re-arm the persisted schedules, at boot and then every\n * minute. Recovery runs in the background: it executes overdue actions one by one, and the server\n * should not wait for that before it starts listening. A failure is logged and never crashes startup.\n *\n * Running it every minute is what makes several processes work. Each holds its own timers, so an\n * action scheduled or moved through one process reaches the others' timers within a minute, and an\n * action whose process died is still fired, as an overdue one. `RunScheduledActionOnceDecorator`\n * keeps the processes from all running it. Runs never overlap.\n *\n * Returns a function for the shutdown: it stops the timers and recovery, then waits up to\n * `timeoutMs` for actions already running.\n */\nexport async function startSchedulerServer(\n rootContainer: Container\n): Promise<(timeoutMs: number) => Promise<void>> {\n const scheduler = rootContainer.resolve(SchedulerSingleton);\n await scheduler.start();\n\n const dispatcher = rootContainer.resolve(InputDispatcher);\n const logger = rootContainer.resolve(Logger);\n let recovering = false;\n const recover = async (atBoot: boolean) => {\n if (recovering) {\n return;\n }\n recovering = true;\n try {\n await recoverPendingSchedules(dispatcher, logger, atBoot);\n } finally {\n recovering = false;\n }\n };\n\n void recover(true);\n const everyMinute = setInterval(() => {\n void recover(false);\n }, RECOVER_EVERY_MS);\n\n return async (timeoutMs: number) => {\n clearInterval(everyMinute);\n await scheduler.stop();\n await scheduler.waitForRunning(timeoutMs);\n };\n}\n"],"names":["registerSchedulerServer","rootContainer","dispatcher","InputDispatcher","logger","Logger","service","TimerSchedulerService","id","namespace","tenant","event","SCHEDULED_ACTION_EVENT_IDENTIFIER","Date","SchedulerSingleton","SchedulerService","ScheduledActionInputType","ScheduledActionLambdaHandler","RunScheduledActionOnceDecorator","ScheduledActionRecoverInputType","RecoverScheduledActionsHandler","RECOVER_EVERY_MS","recoverPendingSchedules","atBoot","SCHEDULED_ACTION_RECOVER_EVENT_IDENTIFIER","result","err","startSchedulerServer","scheduler","recovering","recover","everyMinute","setInterval","timeoutMs","clearInterval"],"mappings":";;;;;;;;;AA0BO,SAASA,wBAAwBC,aAAwB;IAC5D,MAAMC,aAAaD,cAAc,OAAO,CAACE;IACzC,MAAMC,SAASH,cAAc,OAAO,CAACI;IAErC,MAAMC,UAAU,IAAIC,sBAAsB;QACtCH;QACA,WAAW,OAAOI,IAAIC,WAAWC;YAK7B,MAAMC,QAA+B;gBACjC,CAACC,kCAAkC,EAAE;oBACjCJ;oBACAC;oBACAC;oBACA,aAAa,IAAIG,OAAO,WAAW;gBACvC;YACJ;YAEA,MAAMX,WAAW,QAAQ,CAACS;QAC9B;IACJ;IAgBAV,cAAc,gBAAgB,CAACa,oBAAoBR;IACnDL,cAAc,gBAAgB,CAACc,kBAAkBT;IAEjDL,cAAc,QAAQ,CAACe;IACvBf,cAAc,QAAQ,CAACgB;IAEvBhB,cAAc,iBAAiB,CAACiB;IAEhCjB,cAAc,QAAQ,CAACkB;IACvBlB,cAAc,QAAQ,CAACmB;AAC3B;AAGA,MAAMC,mBAAmB;AAEzB,eAAeC,wBACXpB,UAAqC,EACrCE,MAAwB,EACxBmB,MAAe;IAEf,MAAMZ,QAAsC;QACxC,CAACa,0CAA0C,EAAE;IACjD;IAEA,IAAI;QACA,MAAMC,SAAS,MAAMvB,WAAW,QAAQ,CAA4CS;QACpF,IAAIY,QACAnB,OAAO,IAAI,CACP;YAAE,WAAWqB,OAAO,SAAS;QAAC,GAC9B;QAGR,IAAIA,OAAO,aAAa,CAAC,MAAM,GAAG,GAC9BrB,OAAO,KAAK,CACR;YAAE,SAASqB,OAAO,aAAa;QAAC,GAChC;IAGZ,EAAE,OAAOC,KAAK;QACVtB,OAAO,KAAK,CAAC;YAAE,OAAOsB;QAAI,GAAG;IACjC;AACJ;AAeO,eAAeC,qBAClB1B,aAAwB;IAExB,MAAM2B,YAAY3B,cAAc,OAAO,CAACa;IACxC,MAAMc,UAAU,KAAK;IAErB,MAAM1B,aAAaD,cAAc,OAAO,CAACE;IACzC,MAAMC,SAASH,cAAc,OAAO,CAACI;IACrC,IAAIwB,aAAa;IACjB,MAAMC,UAAU,OAAOP;QACnB,IAAIM,YACA;QAEJA,aAAa;QACb,IAAI;YACA,MAAMP,wBAAwBpB,YAAYE,QAAQmB;QACtD,SAAU;YACNM,aAAa;QACjB;IACJ;IAEKC,QAAQ;IACb,MAAMC,cAAcC,YAAY;QACvBF,QAAQ;IACjB,GAAGT;IAEH,OAAO,OAAOY;QACVC,cAAcH;QACd,MAAMH,UAAU,IAAI;QACpB,MAAMA,UAAU,cAAc,CAACK;IACnC;AACJ"}
@@ -0,0 +1,4 @@
1
+ import type { Container } from "@webiny/di";
2
+ import { type RegisterApiRequestStackConfig } from "@webiny/api-composition-core";
3
+ import type { WebsocketsConnectionAuthenticator } from "@webiny/api-websockets-standalone";
4
+ export declare function createWebsocketsAuthenticator(rootContainer: Container, extensions: RegisterApiRequestStackConfig["extensions"]): WebsocketsConnectionAuthenticator;
@@ -0,0 +1,47 @@
1
+ import { RequestContainer } from "@webiny/api-kernel-core";
2
+ import { registerApiRequestStack } from "@webiny/api-composition-core";
3
+ import { AuthenticationError } from "@webiny/api-core/features/security/authentication/AuthenticationContext/index.js";
4
+ import { RawAuthToken, RawTenantId, RequestIdentityLoader, RequestTenantLoader, TenantNotFoundError } from "@webiny/api-core/features/requestContext/index.js";
5
+ import { TenantContext } from "@webiny/api-core/features/tenancy/TenantContext/index.js";
6
+ import { IdentityContext } from "@webiny/api-core/features/security/IdentityContext/index.js";
7
+ import { CanAccessCurrentTenantUseCase } from "@webiny/api-core/features/security/CanAccessCurrentTenant/index.js";
8
+ import { Logger } from "@webiny/api-core/features/logger/index.js";
9
+ const refuseOnAuthenticationError = (logger)=>(error)=>{
10
+ if (!(error instanceof AuthenticationError)) throw error;
11
+ logger.warn({
12
+ code: error.code,
13
+ error: error.message
14
+ }, "[websockets] handshake refused");
15
+ return false;
16
+ };
17
+ const refuseUnknownTenant = (error)=>{
18
+ if (error instanceof TenantNotFoundError) return false;
19
+ throw error;
20
+ };
21
+ function createWebsocketsAuthenticator(rootContainer, extensions) {
22
+ return async (token, tenantId)=>{
23
+ const child = rootContainer.createChildContainer();
24
+ child.registerInstance(RequestContainer, child);
25
+ await registerApiRequestStack(child, {
26
+ extensions
27
+ });
28
+ child.resolve(RawTenantId).set(tenantId);
29
+ child.resolve(RawAuthToken).set(token);
30
+ const tenantLoaded = await child.resolve(RequestTenantLoader).establish().then(()=>true).catch(refuseUnknownTenant);
31
+ if (!tenantLoaded || !child.resolve(TenantContext).getTenant()) return null;
32
+ const refuse = refuseOnAuthenticationError(child.resolve(Logger));
33
+ const authenticated = await child.resolve(RequestIdentityLoader).establish().then(()=>true).catch(refuse);
34
+ if (!authenticated) return null;
35
+ const canAccessTenant = await child.resolve(CanAccessCurrentTenantUseCase).execute();
36
+ if (!canAccessTenant) return null;
37
+ const identity = child.resolve(IdentityContext).getIdentity();
38
+ return {
39
+ id: identity.id,
40
+ displayName: identity.displayName,
41
+ type: identity.type
42
+ };
43
+ };
44
+ }
45
+ export { createWebsocketsAuthenticator };
46
+
47
+ //# sourceMappingURL=createWebsocketsAuthenticator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"websockets/createWebsocketsAuthenticator.js","sources":["../../src/websockets/createWebsocketsAuthenticator.ts"],"sourcesContent":["import type { Container } from \"@webiny/di\";\nimport { RequestContainer } from \"@webiny/api-kernel-core\";\nimport {\n registerApiRequestStack,\n type RegisterApiRequestStackConfig\n} from \"@webiny/api-composition-core\";\nimport { AuthenticationError } from \"@webiny/api-core/features/security/authentication/AuthenticationContext/index.js\";\nimport { RawTenantId } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { RawAuthToken } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { RequestTenantLoader } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { TenantNotFoundError } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { RequestIdentityLoader } from \"@webiny/api-core/features/requestContext/index.js\";\nimport { TenantContext } from \"@webiny/api-core/features/tenancy/TenantContext/index.js\";\nimport { IdentityContext } from \"@webiny/api-core/features/security/IdentityContext/index.js\";\nimport { CanAccessCurrentTenantUseCase } from \"@webiny/api-core/features/security/CanAccessCurrentTenant/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport type { WebsocketsConnectionAuthenticator } from \"@webiny/api-websockets-standalone\";\n\n/*\n * An `AuthenticationError` refuses the handshake rather than failing it. That includes more than bad\n * tokens: `AuthenticationError.from` wraps every error an authenticator throws, a failed key lookup\n * as well, so the reason is logged here, where it would otherwise be lost.\n */\nconst refuseOnAuthenticationError = (logger: Logger.Interface) => {\n return (error: unknown): false => {\n if (!(error instanceof AuthenticationError)) {\n throw error;\n }\n logger.warn({ code: error.code, error: error.message }, \"[websockets] handshake refused\");\n return false;\n };\n};\n\n/**\n * Builds the `authenticate` callback the server WebSocket upgrade acceptor uses to turn a\n * connection's `?token` JWT into an identity in the connection's `?tenant`.\n *\n * Each new WebSocket connection (the HTTP upgrade handshake) is authenticated from its `?token` JWT\n * so the connection is registered under the real identity — targeted server→client sends need this,\n * since SendToIdentity matches connections by identity id. The catch is that AuthenticationContext\n * lives in the per-request stack (registered by ApiCoreFeature, not registerRootStorage), so we can't\n * resolve it from the root container. Instead we spin up a short-lived request-scoped child container,\n * the same way createHandler does for each HTTP request, and resolve it there. We only need the core\n * stack, not the transports. Like an HTTP transport, it only extracts the raw tenant id and token and\n * leaves the rest to the shared request loaders, tenant first, because an API key is looked up in the\n * current tenant. The identity must then be able to access that tenant: the client names the tenant,\n * so a valid token alone would let a user of one tenant receive another tenant's messages.\n * Connections are rare (one per admin session), so a fresh child per connection is cheap enough.\n *\n * This is also why the WebSocket server takes `authenticate` as a plain callback instead of resolving\n * auth itself: AuthenticationContext isn't reachable from the root container (it's per-request), so\n * only the handler — which can build a request-scoped child — can supply it. So authenticate has to be\n * a callback the handler builds, regardless of DI.\n */\nconst refuseUnknownTenant = (error: unknown): false => {\n if (error instanceof TenantNotFoundError) {\n return false;\n }\n throw error;\n};\n\nexport function createWebsocketsAuthenticator(\n rootContainer: Container,\n extensions: RegisterApiRequestStackConfig[\"extensions\"]\n): WebsocketsConnectionAuthenticator {\n return async (token, tenantId) => {\n const child = rootContainer.createChildContainer();\n child.registerInstance(RequestContainer, child);\n await registerApiRequestStack(child, { extensions });\n\n child.resolve(RawTenantId).set(tenantId);\n child.resolve(RawAuthToken).set(token);\n\n const tenantLoaded = await child\n .resolve(RequestTenantLoader)\n .establish()\n .then(() => true)\n .catch(refuseUnknownTenant);\n // An unknown tenant refuses the handshake rather than failing it.\n if (!tenantLoaded || !child.resolve(TenantContext).getTenant()) {\n return null;\n }\n\n const refuse = refuseOnAuthenticationError(child.resolve(Logger));\n const authenticated = await child\n .resolve(RequestIdentityLoader)\n .establish()\n .then(() => true)\n .catch(refuse);\n if (!authenticated) {\n return null;\n }\n\n // False for the anonymous identity, which is what a token no authenticator recognises gives.\n const canAccessTenant = await child.resolve(CanAccessCurrentTenantUseCase).execute();\n if (!canAccessTenant) {\n return null;\n }\n\n const identity = child.resolve(IdentityContext).getIdentity();\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n };\n };\n}\n"],"names":["refuseOnAuthenticationError","logger","error","AuthenticationError","refuseUnknownTenant","TenantNotFoundError","createWebsocketsAuthenticator","rootContainer","extensions","token","tenantId","child","RequestContainer","registerApiRequestStack","RawTenantId","RawAuthToken","tenantLoaded","RequestTenantLoader","TenantContext","refuse","Logger","authenticated","RequestIdentityLoader","canAccessTenant","CanAccessCurrentTenantUseCase","identity","IdentityContext"],"mappings":";;;;;;;;AAuBA,MAAMA,8BAA8B,CAACC,SAC1B,CAACC;QACJ,IAAI,CAAEA,CAAAA,iBAAiBC,mBAAkB,GACrC,MAAMD;QAEVD,OAAO,IAAI,CAAC;YAAE,MAAMC,MAAM,IAAI;YAAE,OAAOA,MAAM,OAAO;QAAC,GAAG;QACxD,OAAO;IACX;AAwBJ,MAAME,sBAAsB,CAACF;IACzB,IAAIA,iBAAiBG,qBACjB,OAAO;IAEX,MAAMH;AACV;AAEO,SAASI,8BACZC,aAAwB,EACxBC,UAAuD;IAEvD,OAAO,OAAOC,OAAOC;QACjB,MAAMC,QAAQJ,cAAc,oBAAoB;QAChDI,MAAM,gBAAgB,CAACC,kBAAkBD;QACzC,MAAME,wBAAwBF,OAAO;YAAEH;QAAW;QAElDG,MAAM,OAAO,CAACG,aAAa,GAAG,CAACJ;QAC/BC,MAAM,OAAO,CAACI,cAAc,GAAG,CAACN;QAEhC,MAAMO,eAAe,MAAML,MACtB,OAAO,CAACM,qBACR,SAAS,GACT,IAAI,CAAC,IAAM,MACX,KAAK,CAACb;QAEX,IAAI,CAACY,gBAAgB,CAACL,MAAM,OAAO,CAACO,eAAe,SAAS,IACxD,OAAO;QAGX,MAAMC,SAASnB,4BAA4BW,MAAM,OAAO,CAACS;QACzD,MAAMC,gBAAgB,MAAMV,MACvB,OAAO,CAACW,uBACR,SAAS,GACT,IAAI,CAAC,IAAM,MACX,KAAK,CAACH;QACX,IAAI,CAACE,eACD,OAAO;QAIX,MAAME,kBAAkB,MAAMZ,MAAM,OAAO,CAACa,+BAA+B,OAAO;QAClF,IAAI,CAACD,iBACD,OAAO;QAGX,MAAME,WAAWd,MAAM,OAAO,CAACe,iBAAiB,WAAW;QAC3D,OAAO;YACH,IAAID,SAAS,EAAE;YACf,aAAaA,SAAS,WAAW;YACjC,MAAMA,SAAS,IAAI;QACvB;IACJ;AACJ"}