import{aI as I,bc as w,c4 as A,az as d,ao as s,aF as T,L as k,aq as q,bU as o,m as p,v as R,f as b,e as v}from"./app-k0jcl5PQ.js";import{L as n}from"./uC6ielRn.chunk.js";const g="settings.deleteLtiPlatform",a=k.encloseNamespace(g);function E(e){const[P,h]=I.useState(!1),c=w(),r=A(),i=d(e.platformId&&n.getPlatform(e.platformId)),l=d(e.consumerKey&&n.getConsumer(e.consumerKey));function S(){if(h(!0),e.platformId){x();return}L()}function u(){c.success(a("success")),e.closePopup(),R.trigger({application:v.SETTINGS,action:b.Settings.LTI_PLATFORMS})}function m(){c.error(a("error")),e.closePopup()}function x(){const t=n.deletePlatform(e.platformId,u,m);p(r,t)}function L(){const t=n.deleteConsumer(e.consumerKey,u,m);p(r,t)}function C(){var t,f;return((t=i.data)==null?void 0:t.name)??((f=l.data)==null?void 0:f.name)??""}const j=!l.data&&!i.data;return s.jsxs(T,{title:a("title"),closePopup:e.closePopup,showLoadingSpinner:j,children:[s.jsx("p",{children:s.jsx(q,{namespace:g,phrase:"warning",options:{name:C()}})}),s.jsxs(o,{children:[s.jsx(o.Cancel,{onClick:e.closePopup}),s.jsx(o.Submit,{variant:"danger",text:a("delete"),onClick:S,showSpinner:P})]})]})}export{E as DeleteLtiPlatformView};
//# sourceMappingURL=Dwv5B8uP.chunk.js.map
