"use strict";(self.webpackChunkpasswords_webextension=self.webpackChunkpasswords_webextension||[]).push([[3746],{8962:(e,t,s)=>{s.d(t,{Z:()=>a});class a{async execute(e,t){console.trace("controller.execute() not implemented")}}},8146:(e,t,s)=>{s.r(t),s.d(t,{default:()=>i});var a=s(8962),r=s(9775),o=s(9083),c=s(7380),d=s(6567);class i extends a.Z{async execute(e,t){let{id:s}=e.getPayload(),a=r.Z.getItem(s);if(null===a||a.isTrashed())t.setPayload({success:!1});else{r.Z.removeItem(a);let e=(await o.Z.findById(a.getServer().getId())).getInstance("repository.password");await e.delete(a),t.setPayload({success:!0}),a.getHidden()?this._restoreOrDelete(e,a):this._crateTrashedNotification(e,a).catch(d.Z.catch)}}async _crateTrashedNotification(e,t){let s={type:t.getHidden()?"warning":"info",message:[`ToastPassword${t.getHidden()?"Hidden":""}Trashed`,t.getLabel()],closeable:!0,options:{restore:"ToastPasswordTrashedRestore",close:"ButtonClose"},ttl:t.getHidden()?10:5};return"restore"===await c.Z.create(s)&&(await e.restore(t),r.Z.addItem(t),c.Z.success(["ToastPasswordRestored",t.getLabel()]).catch(d.Z.catch),!0)}async _restoreOrDelete(e,t){await this._crateTrashedNotification(e,t)||await e.delete(t)}}}}]);