{"version":3,"file":"restore-from-recycle-bin.action-_oETEEu6.js","sources":["../../../src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/modal/restore-from-recycle-bin-modal.token.ts","../../../src/packages/core/recycle-bin/entity-action/restore-from-recycle-bin/restore-from-recycle-bin.action.ts"],"sourcesContent":["import type { UmbEntityModel } from '@umbraco-cms/backoffice/entity';\nimport type { UmbPickerModalData, UmbPickerModalValue } from '@umbraco-cms/backoffice/modal';\nimport { UmbModalToken } from '@umbraco-cms/backoffice/modal';\n\nexport interface UmbRestoreFromRecycleBinModalData {\n\tunique: string;\n\tentityType: string;\n\trecycleBinRepositoryAlias: string;\n\titemRepositoryAlias: string;\n\tpickerModal: UmbModalToken, UmbPickerModalValue> | string;\n}\n\nexport interface UmbRestoreFromRecycleBinModalValue {\n\tdestination: UmbEntityModel | undefined;\n}\n\nexport const UMB_RESTORE_FROM_RECYCLE_BIN_MODAL = new UmbModalToken<\n\tUmbRestoreFromRecycleBinModalData,\n\tUmbRestoreFromRecycleBinModalValue\n>('Umb.Modal.RecycleBin.Restore', {\n\tmodal: {\n\t\ttype: 'sidebar',\n\t\tsize: 'small',\n\t},\n});\n","import { UmbEntityActionBase } from '../../../entity-action/entity-action-base.js';\nimport { UMB_RESTORE_FROM_RECYCLE_BIN_MODAL } from './modal/restore-from-recycle-bin-modal.token.js';\nimport { UMB_MODAL_MANAGER_CONTEXT } from '@umbraco-cms/backoffice/modal';\nimport { UmbRequestReloadStructureForEntityEvent } from '@umbraco-cms/backoffice/entity-action';\nimport { UMB_ACTION_EVENT_CONTEXT } from '@umbraco-cms/backoffice/action';\nimport type { MetaEntityActionRestoreFromRecycleBinKind } from '@umbraco-cms/backoffice/extension-registry';\n\n/**\n * Entity action for restoring an item from the recycle bin.\n * @class UmbRestoreFromRecycleBinEntityAction\n * @augments {UmbEntityActionBase}\n */\nexport class UmbRestoreFromRecycleBinEntityAction extends UmbEntityActionBase {\n\t/**\n\t * Executes the action.\n\t * @memberof UmbRestoreFromRecycleBinEntityAction\n\t */\n\toverride async execute() {\n\t\tif (!this.args.unique) throw new Error('Cannot restore an item without a unique identifier.');\n\n\t\tconst modalManager = await this.getContext(UMB_MODAL_MANAGER_CONTEXT);\n\t\tconst modal = modalManager.open(this, UMB_RESTORE_FROM_RECYCLE_BIN_MODAL, {\n\t\t\tdata: {\n\t\t\t\tunique: this.args.unique,\n\t\t\t\tentityType: this.args.entityType,\n\t\t\t\trecycleBinRepositoryAlias: this.args.meta.recycleBinRepositoryAlias,\n\t\t\t\titemRepositoryAlias: this.args.meta.itemRepositoryAlias,\n\t\t\t\tpickerModal: this.args.meta.pickerModal,\n\t\t\t},\n\t\t});\n\n\t\tconst { destination } = await modal.onSubmit();\n\t\tif (!destination) throw new Error('Cannot reload the structure without a destination.');\n\n\t\tconst actionEventContext = await this.getContext(UMB_ACTION_EVENT_CONTEXT);\n\t\tconst event = new UmbRequestReloadStructureForEntityEvent({\n\t\t\tunique: this.args.unique,\n\t\t\tentityType: this.args.entityType,\n\t\t});\n\n\t\tactionEventContext.dispatchEvent(event);\n\n\t\t// TODO: reload destination\n\t\tconsole.log(destination.unique, destination.entityType);\n\t}\n}\n\nexport { UmbRestoreFromRecycleBinEntityAction as api };\n"],"names":["UMB_RESTORE_FROM_RECYCLE_BIN_MODAL","UmbModalToken","UmbRestoreFromRecycleBinEntityAction","UmbEntityActionBase","modal","UMB_MODAL_MANAGER_CONTEXT","destination","actionEventContext","UMB_ACTION_EVENT_CONTEXT","event","UmbRequestReloadStructureForEntityEvent"],"mappings":";;;;AAgBa,MAAAA,IAAqC,IAAIC,EAGpD,gCAAgC;AAAA,EACjC,OAAO;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,EACP;AACD,CAAC;ACZM,MAAMC,UAA6CC,EAA+D;AAAA;AAAA;AAAA;AAAA;AAAA,EAKxH,MAAe,UAAU;AACxB,QAAI,CAAC,KAAK,KAAK,OAAc,OAAA,IAAI,MAAM,qDAAqD;AAG5F,UAAMC,KADe,MAAM,KAAK,WAAWC,CAAyB,GACzC,KAAK,MAAML,GAAoC;AAAA,MACzE,MAAM;AAAA,QACL,QAAQ,KAAK,KAAK;AAAA,QAClB,YAAY,KAAK,KAAK;AAAA,QACtB,2BAA2B,KAAK,KAAK,KAAK;AAAA,QAC1C,qBAAqB,KAAK,KAAK,KAAK;AAAA,QACpC,aAAa,KAAK,KAAK,KAAK;AAAA,MAC7B;AAAA,IAAA,CACA,GAEK,EAAE,aAAAM,EAAgB,IAAA,MAAMF,EAAM,SAAS;AAC7C,QAAI,CAACE,EAAmB,OAAA,IAAI,MAAM,oDAAoD;AAEtF,UAAMC,IAAqB,MAAM,KAAK,WAAWC,CAAwB,GACnEC,IAAQ,IAAIC,EAAwC;AAAA,MACzD,QAAQ,KAAK,KAAK;AAAA,MAClB,YAAY,KAAK,KAAK;AAAA,IAAA,CACtB;AAED,IAAAH,EAAmB,cAAcE,CAAK,GAGtC,QAAQ,IAAIH,EAAY,QAAQA,EAAY,UAAU;AAAA,EACvD;AACD;"}