@acorex-platform/module-task-management-client 2.0.0-next.50 → 2.0.0-next.55

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 (35) hide show
  1. package/fesm2022/{acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-CiXlt3HQ.mjs → acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-DwzlDPlj.mjs} +18 -18
  2. package/fesm2022/{acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-CiXlt3HQ.mjs.map → acorex-platform-module-task-management-client-acorex-platform-module-task-management-client-DwzlDPlj.mjs.map} +1 -1
  3. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-DoR58GWa.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-C-OBLYRH.mjs} +10 -10
  4. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-DoR58GWa.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-acorex-platform-module-task-management-client-contracts-entity-catalog-C-OBLYRH.mjs.map} +1 -1
  5. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity--TP_F87Y.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity-BzX0IZiz.mjs} +2 -2
  6. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity--TP_F87Y.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-assignment.entity-BzX0IZiz.mjs.map} +1 -1
  7. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-sGrb0ZaR.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-CBVZn191.mjs} +2 -2
  8. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-sGrb0ZaR.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-checklist-item.entity-CBVZn191.mjs.map} +1 -1
  9. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-CLQw9kqg.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-B5sx1086.mjs} +2 -2
  10. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-CLQw9kqg.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-context.entity-B5sx1086.mjs.map} +1 -1
  11. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-Ce9NZlK_.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-B6MEupwd.mjs} +2 -2
  12. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-Ce9NZlK_.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-dependency.entity-B6MEupwd.mjs.map} +1 -1
  13. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-DKx2UHiz.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-DZxbpYQj.mjs} +2 -2
  14. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-DKx2UHiz.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-status.entity-DZxbpYQj.mjs.map} +1 -1
  15. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-CKY04iyS.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-BUId-4Pz.mjs} +2 -2
  16. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-CKY04iyS.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-template.entity-BUId-4Pz.mjs.map} +1 -1
  17. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-BGKWiqU8.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-CtU6gPxQ.mjs} +2 -2
  18. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-BGKWiqU8.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task-type.entity-CtU6gPxQ.mjs.map} +1 -1
  19. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-CiKg52ey.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-CiIPbFOl.mjs} +2 -2
  20. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-CiKg52ey.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-task.entity-CiIPbFOl.mjs.map} +1 -1
  21. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-Gne51DLu.mjs → acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-BQ3f4IFb.mjs} +2 -2
  22. package/fesm2022/{acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-Gne51DLu.mjs.map → acorex-platform-module-task-management-client-contracts-entity-catalog-time-log.entity-BQ3f4IFb.mjs.map} +1 -1
  23. package/fesm2022/acorex-platform-module-task-management-client-contracts-entity-catalog.mjs +1 -1
  24. package/fesm2022/{acorex-platform-module-task-management-client-list-task-board-assignees.query-D2UqZX3C.mjs → acorex-platform-module-task-management-client-list-task-board-assignees.query-gHXlPuml.mjs} +2 -2
  25. package/fesm2022/{acorex-platform-module-task-management-client-list-task-board-assignees.query-D2UqZX3C.mjs.map → acorex-platform-module-task-management-client-list-task-board-assignees.query-gHXlPuml.mjs.map} +1 -1
  26. package/fesm2022/{acorex-platform-module-task-management-client-list-task-board-reporters.query-C3NAYa9b.mjs → acorex-platform-module-task-management-client-list-task-board-reporters.query-CbZStDQZ.mjs} +1 -1
  27. package/fesm2022/{acorex-platform-module-task-management-client-list-task-board-reporters.query-C3NAYa9b.mjs.map → acorex-platform-module-task-management-client-list-task-board-reporters.query-CbZStDQZ.mjs.map} +1 -1
  28. package/fesm2022/{acorex-platform-module-task-management-client-list-task-types.query-DN8fFBFz.mjs → acorex-platform-module-task-management-client-list-task-types.query-RxRBZwod.mjs} +2 -2
  29. package/fesm2022/{acorex-platform-module-task-management-client-list-task-types.query-DN8fFBFz.mjs.map → acorex-platform-module-task-management-client-list-task-types.query-RxRBZwod.mjs.map} +1 -1
  30. package/fesm2022/{acorex-platform-module-task-management-client-start-task-flow.command-CR1JXr5r.mjs → acorex-platform-module-task-management-client-start-task-flow.command-CwzXpDON.mjs} +1 -1
  31. package/fesm2022/{acorex-platform-module-task-management-client-start-task-flow.command-CR1JXr5r.mjs.map → acorex-platform-module-task-management-client-start-task-flow.command-CwzXpDON.mjs.map} +1 -1
  32. package/fesm2022/{acorex-platform-module-task-management-client-task-board.page-BqwKNMOC.mjs → acorex-platform-module-task-management-client-task-board.page-UOGQqH9m.mjs} +14 -14
  33. package/fesm2022/{acorex-platform-module-task-management-client-task-board.page-BqwKNMOC.mjs.map → acorex-platform-module-task-management-client-task-board.page-UOGQqH9m.mjs.map} +1 -1
  34. package/fesm2022/acorex-platform-module-task-management-client.mjs +1 -1
  35. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"acorex-platform-module-task-management-client-start-task-flow.command-CR1JXr5r.mjs","sources":["../../../../libs/modules/task-management/client/src/lib/features/task/commands/start-task-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { runtimeResultObjectData, type AXPEntityReference } from '@acorex-platform/framework-shared/core';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXLoadingDialogService, type AXLoadingDialogRef } from '@acorex/components/loading-dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXPWorkflowManager,\n type AXPStartWorkflowRequest,\n type AXPStartWorkflowResponse,\n} from '@acorex-platform/framework-client/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPTaskManagementCommandKeys } from '@acorex-platform/module-task-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartTaskFlowInput {\n workflowId?: string;\n taskTypeId?: string;\n subjectRef?: AXPEntityReference;\n projectTypeId?: string;\n input?: Record<string, unknown>;\n options?: StartTaskFlowOptions;\n}\n\nexport interface StartTaskFlowOptions {\n workflowId: string;\n input: {\n taskTypeId: string;\n subjectRef: AXPEntityReference;\n projectTypeId?: string;\n taskTypeTitle?: string;\n } & Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst START_FLOW_FAILED = '@task-management:commands.start-flow.messages.failed';\nconst START_FLOW_FAILED_TITLE = '@task-management:commands.start-flow.messages.failed-title';\nconst START_FLOW_MISSING = '@task-management:commands.start-flow.messages.missing-input';\n\n//#endregion\n\n/**\n * Starts a task-type workflow.\n * The server loads the task type, checks the project type, and starts the workflow in one call.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartTaskFlowCommand implements AXPCommand<StartTaskFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly toastService = inject(AXToastService);\n private readonly commandService = inject(AXPCommandService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartTaskFlowInput): AXPCommandExecuteResultPromise<void> {\n const options = (input?.options ?? input) as StartTaskFlowOptions;\n const flowInput = options?.input ?? ({} as StartTaskFlowOptions['input']);\n const workflowId = (options?.workflowId ?? input?.workflowId)?.trim();\n const taskTypeId = flowInput?.taskTypeId?.trim();\n const subjectRef = flowInput?.subjectRef ?? input?.subjectRef;\n\n if (!workflowId || !taskTypeId || !subjectRef?.id || !subjectRef?.type) {\n await this.showFailure(START_FLOW_MISSING);\n return { success: false, message: { text: START_FLOW_MISSING }, metadata: { refresh: false } };\n }\n\n try {\n const remote = await this.withStartLoading(() =>\n this.commandService.executeRemote<AXPStartWorkflowRequest, AXPStartWorkflowResponse>(\n AXPTaskManagementCommandKeys.Task.BeginWorkflow,\n {\n workflowId,\n input: flowInput,\n },\n ),\n );\n\n const started = runtimeResultObjectData(remote);\n if (started == null || started.instanceId.length === 0) {\n const rawMessage = remote?.message?.text;\n const messageKey = typeof rawMessage === 'string' ? rawMessage : START_FLOW_FAILED;\n await this.showFailure(messageKey);\n return { success: false, message: { text: messageKey }, metadata: { refresh: false } };\n }\n\n const startResult = await this.workflowManager.continueStartedWorkflow(started, flowInput);\n if (!startResult.success) {\n await this.showFailure(START_FLOW_FAILED);\n return { success: false, message: { text: START_FLOW_FAILED }, metadata: { refresh: false } };\n }\n\n if (startResult.dismissed) {\n return { success: true, kind: 'object', data: undefined, metadata: { refresh: false } };\n }\n\n return { success: true, kind: 'object', data: undefined, metadata: { refresh: false } };\n } catch (error: unknown) {\n console.error('[StartTaskFlowCommand]', error);\n await this.showFailure(START_FLOW_FAILED);\n return { success: false, message: { text: START_FLOW_FAILED }, metadata: { refresh: false } };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async showFailure(messageKey: string): Promise<void> {\n const [title, content] = await Promise.all([\n this.translationService.translateAsync(START_FLOW_FAILED_TITLE),\n this.translationService.translateAsync(messageKey),\n ]);\n this.toastService.show({\n color: 'danger',\n title,\n content,\n closeButton: true,\n timeOut: 5000,\n });\n }\n\n /** Covers only the server start call, so the next user dialog is not hidden behind it. */\n private async withStartLoading<T>(work: () => Promise<T>): Promise<T> {\n const [title, text] = await Promise.all([\n this.translationService.translateAsync('@general:state-message.loading.title'),\n this.translationService.translateAsync('@general:state-message.loading.description'),\n ]);\n const dialog: AXLoadingDialogRef = this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n text,\n });\n try {\n return await work();\n } finally {\n dialog.close();\n await new Promise<void>((resolve) => setTimeout(resolve, 80));\n }\n }\n\n //#end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AAC,cAAc,CAAC,4CAA4C,CAAC;AACrF,SAAA,CAAC;AACF,QAAA,MAAM,MAAM,GAAuB,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;YACzD,KAAK;AACL,YAAA,IAAI,EAAE,eAAe;YACrB,IAAI;AACL,SAAA,CAAC;AACF,QAAA,IAAI;YACF,OAAO,MAAM,IAAI,EAAE;QACrB;gBAAU;YACR,MAAM,CAAC,KAAK,EAAE;AACd,YAAA,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,KAAK,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC/D;IACF;8GAjGW,oBAAoB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAApB,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,oBAAoB,cADP,MAAM,EAAA,CAAA,CAAA;;2FACnB,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBADhC,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;MAuGrB,2BAA2B,GAAG,4BAA4B,CAAC,IAAI,CAAC;;"}
1
+ {"version":3,"file":"acorex-platform-module-task-management-client-start-task-flow.command-CwzXpDON.mjs","sources":["../../../../libs/modules/task-management/client/src/lib/features/task/commands/start-task-flow.command.ts"],"sourcesContent":["//#region ---- Imports ----\n\nimport { AXPCommand, type AXPCommandExecuteResultPromise } from '@acorex-platform/framework-shared/runtime';\nimport { runtimeResultObjectData, type AXPEntityReference } from '@acorex-platform/framework-shared/core';\nimport { AXToastService } from '@acorex/components/toast';\nimport { AXLoadingDialogService, type AXLoadingDialogRef } from '@acorex/components/loading-dialog';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport { AXPCommandService } from '@acorex-platform/framework-client/runtime';\nimport {\n AXPWorkflowManager,\n type AXPStartWorkflowRequest,\n type AXPStartWorkflowResponse,\n} from '@acorex-platform/framework-client/workflow';\nimport { inject, Injectable } from '@angular/core';\nimport { AXPTaskManagementCommandKeys } from '@acorex-platform/module-task-management-client/contracts';\n\n//#endregion\n\n//#region ---- Types ----\n\nexport interface StartTaskFlowInput {\n workflowId?: string;\n taskTypeId?: string;\n subjectRef?: AXPEntityReference;\n projectTypeId?: string;\n input?: Record<string, unknown>;\n options?: StartTaskFlowOptions;\n}\n\nexport interface StartTaskFlowOptions {\n workflowId: string;\n input: {\n taskTypeId: string;\n subjectRef: AXPEntityReference;\n projectTypeId?: string;\n taskTypeTitle?: string;\n } & Record<string, unknown>;\n}\n\n//#endregion\n\n//#region ---- Constants ----\n\nconst START_FLOW_FAILED = '@task-management:commands.start-flow.messages.failed';\nconst START_FLOW_FAILED_TITLE = '@task-management:commands.start-flow.messages.failed-title';\nconst START_FLOW_MISSING = '@task-management:commands.start-flow.messages.missing-input';\n\n//#endregion\n\n/**\n * Starts a task-type workflow.\n * The server loads the task type, checks the project type, and starts the workflow in one call.\n */\n@Injectable({ providedIn: 'root' })\nexport class StartTaskFlowCommand implements AXPCommand<StartTaskFlowInput, void> {\n //#region ---- Services & Dependencies ----\n\n private readonly toastService = inject(AXToastService);\n private readonly commandService = inject(AXPCommandService);\n private readonly workflowManager = inject(AXPWorkflowManager);\n private readonly loadingDialog = inject(AXLoadingDialogService);\n private readonly translationService = inject(AXTranslationService);\n\n //#endregion\n\n //#region ---- Command Implementation ----\n\n async execute(input: StartTaskFlowInput): AXPCommandExecuteResultPromise<void> {\n const options = (input?.options ?? input) as StartTaskFlowOptions;\n const flowInput = options?.input ?? ({} as StartTaskFlowOptions['input']);\n const workflowId = (options?.workflowId ?? input?.workflowId)?.trim();\n const taskTypeId = flowInput?.taskTypeId?.trim();\n const subjectRef = flowInput?.subjectRef ?? input?.subjectRef;\n\n if (!workflowId || !taskTypeId || !subjectRef?.id || !subjectRef?.type) {\n await this.showFailure(START_FLOW_MISSING);\n return { success: false, message: { text: START_FLOW_MISSING }, metadata: { refresh: false } };\n }\n\n try {\n const remote = await this.withStartLoading(() =>\n this.commandService.executeRemote<AXPStartWorkflowRequest, AXPStartWorkflowResponse>(\n AXPTaskManagementCommandKeys.Task.BeginWorkflow,\n {\n workflowId,\n input: flowInput,\n },\n ),\n );\n\n const started = runtimeResultObjectData(remote);\n if (started == null || started.instanceId.length === 0) {\n const rawMessage = remote?.message?.text;\n const messageKey = typeof rawMessage === 'string' ? rawMessage : START_FLOW_FAILED;\n await this.showFailure(messageKey);\n return { success: false, message: { text: messageKey }, metadata: { refresh: false } };\n }\n\n const startResult = await this.workflowManager.continueStartedWorkflow(started, flowInput);\n if (!startResult.success) {\n await this.showFailure(START_FLOW_FAILED);\n return { success: false, message: { text: START_FLOW_FAILED }, metadata: { refresh: false } };\n }\n\n if (startResult.dismissed) {\n return { success: true, kind: 'object', data: undefined, metadata: { refresh: false } };\n }\n\n return { success: true, kind: 'object', data: undefined, metadata: { refresh: false } };\n } catch (error: unknown) {\n console.error('[StartTaskFlowCommand]', error);\n await this.showFailure(START_FLOW_FAILED);\n return { success: false, message: { text: START_FLOW_FAILED }, metadata: { refresh: false } };\n }\n }\n\n //#endregion\n\n //#region ---- Helpers ----\n\n private async showFailure(messageKey: string): Promise<void> {\n const [title, content] = await Promise.all([\n this.translationService.translateAsync(START_FLOW_FAILED_TITLE),\n this.translationService.translateAsync(messageKey),\n ]);\n this.toastService.show({\n color: 'danger',\n title,\n content,\n closeButton: true,\n timeOut: 5000,\n });\n }\n\n /** Covers only the server start call, so the next user dialog is not hidden behind it. */\n private async withStartLoading<T>(work: () => Promise<T>): Promise<T> {\n const [title, text] = await Promise.all([\n this.translationService.translateAsync('@general:state-message.loading.title'),\n this.translationService.translateAsync('@general:state-message.loading.description'),\n ]);\n const dialog: AXLoadingDialogRef = this.loadingDialog.show({\n title,\n mode: 'indeterminate',\n text,\n });\n try {\n return await work();\n } finally {\n dialog.close();\n await new Promise<void>((resolve) => setTimeout(resolve, 80));\n }\n }\n\n //#endregion\n}\n\nexport const START_TASK_FLOW_COMMAND_KEY = AXPTaskManagementCommandKeys.Task.StartFlow;\n"],"names":[],"mappings":";;;;;;;;;;AAuCA;AAEA;AAEA,MAAM,iBAAiB,GAAG,sDAAsD;AAChF,MAAM,uBAAuB,GAAG,4DAA4D;AAC5F,MAAM,kBAAkB,GAAG,6DAA6D;AAExF;AAEA;;;AAGG;MAEU,oBAAoB,CAAA;AADjC,IAAA,WAAA,GAAA;;AAImB,QAAA,IAAA,CAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC;AACrC,QAAA,IAAA,CAAA,cAAc,GAAG,MAAM,CAAC,iBAAiB,CAAC;AAC1C,QAAA,IAAA,CAAA,eAAe,GAAG,MAAM,CAAC,kBAAkB,CAAC;AAC5C,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,sBAAsB,CAAC;AAC9C,QAAA,IAAA,CAAA,kBAAkB,GAAG,MAAM,CAAC,oBAAoB,CAAC;AA6FnE,IAAA;;;IAvFC,MAAM,OAAO,CAAC,KAAyB,EAAA;QACrC,MAAM,OAAO,IAAI,KAAK,EAAE,OAAO,IAAI,KAAK,CAAyB;AACjE,QAAA,MAAM,SAAS,GAAG,OAAO,EAAE,KAAK,IAAK,EAAoC;AACzE,QAAA,MAAM,UAAU,GAAG,CAAC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,UAAU,GAAG,IAAI,EAAE;QACrE,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE;QAChD,MAAM,UAAU,GAAG,SAAS,EAAE,UAAU,IAAI,KAAK,EAAE,UAAU;AAE7D,QAAA,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE;AACtE,YAAA,MAAM,IAAI,CAAC,WAAW,CAAC,kBAAkB,CA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