import{ao as e,ba as N,aq as c,at as k,a_ as v,L as g,ce as A,v as m,f as n,e as i,aO as P,aU as r,aP as _,aG as y,aH as C,c0 as b,bN as M,az as x,aI as D,b5 as O}from"./app-k0jcl5PQ.js";import{B as R}from"./CCtuxSlD.chunk.js";import{u as f}from"./CAxN5LKv.chunk.js";import{L}from"./uC6ielRn.chunk.js";import{u as G}from"./DRKUY7jf.chunk.js";import"./CPXlV0fg.chunk.js";import"./DIAJ896Y.chunk.js";const j="settings.ltiPlatformListItem";function h(t){function a(s){s.preventDefault(),m.trigger(t.editAppLink)}function l(s){s.stopPropagation(),s.preventDefault(),m.trigger(t.deleteAppLink)}return e.jsxs(N,{appLink:t.editAppLink,onClick:a,className:"border border-secondary rounded px-3 py-2 d-flex justify-content-between align-items-center mb-2",children:[e.jsxs("span",{className:"fw-semibold",children:[t.name," (",t.version,")",t.incomplete&&e.jsxs("span",{className:"text-danger",children:[" ",e.jsx(c,{namespace:j,phrase:"incomplete"})]})]}),e.jsx(k,{onClick:l,children:e.jsx(v,{svg:A,title:g.getPhrase(j,"deleteTooltip")})})]})}var S=(t=>(t[t.Incomplete=0]="Incomplete",t[t.Complete=1]="Complete",t))(S||{});const $="_list_5t86q_1",H={list:$};function F(t){return e.jsxs("ul",{className:`list-unstyled ${H.list}`,children:[t.platforms.map(a=>e.jsx("li",{children:e.jsx(h,{name:a.name,version:1.3,editAppLink:{application:i.SETTINGS,action:n.Settings.EDIT_LTI_PLATFORM,args:[a.id]},deleteAppLink:{application:i.SETTINGS,action:n.Settings.DELETE_LTI_PLATFORM,params:{platformId:a.id}},incomplete:a.status===S.Incomplete})},a.id)),t.consumers.map(a=>e.jsx("li",{children:e.jsx(h,{name:a.name,version:1.1,editAppLink:{application:i.SETTINGS,action:n.Settings.EDIT_LTI_CONSUMER,args:[a.key]},deleteAppLink:{application:i.SETTINGS,action:n.Settings.DELETE_LTI_PLATFORM,params:{consumerKey:a.key}}})},a.key))]})}const E="settings.ltiPlatformsEmptyState",T=g.encloseNamespace(E);function w({createAppLink:t}){return e.jsx(P.Provider,{value:E,children:e.jsxs(r,{children:[e.jsx(r.Image,{src:_.EmptyStates.LTI,size:"small"}),e.jsx(r.Heading,{children:e.jsx(c,{phrase:"heading"})}),e.jsx(r.Info,{children:e.jsx(c,{phrase:"info"})}),e.jsx(r.Cta,{text:T("learnMore"),href:y.getLiteArticle(C.LtiSetup),openInNewTab:!0,className:"btn btn-link text-info mb-3 p-0"}),e.jsx(r.Cta,{text:T("ctaText"),appLink:t,icon:b,className:"btn btn-outline-dark"})]})})}const B="_platformList_egcc1_1",q="_platformItem_egcc1_4",o={platformList:B,platformItem:q};function U(){return e.jsxs("div",{className:o.platformList,children:[e.jsx("div",{className:`${o.platformItem} partial-loading-background mb-2 rounded`}),e.jsx("div",{className:`${o.platformItem} partial-loading-background mb-2 rounded`}),e.jsx("div",{className:`${o.platformItem} partial-loading-background mb-2 rounded`})]})}const d="settings.ltiPlatforms",p=g.encloseNamespace(d),I={application:i.SETTINGS,action:n.Settings.CREATE_LTI_PLATFORM};function Y(){M({title:p("pageTitle")});const t=x(L.getConsumers()),a=x(L.getPlatforms());f(t),f(a);const{canAccess:l}=G();return D.useEffect(()=>{l===!1&&m.trigger({application:i.SETTINGS,action:n.Settings.HOME})},[l]),l!==!0?e.jsx(e.Fragment,{}):e.jsxs("div",{className:"px-3",children:[e.jsxs("div",{className:"d-flex align-items-center justify-content-between",children:[e.jsx("h1",{className:"h2",children:e.jsx(c,{namespace:d,phrase:"heading"})}),e.jsx(O,{svg:b,appLink:I,className:"btn btn-outline-dark",children:e.jsx(c,{namespace:d,phrase:"addPlatform"})})]}),e.jsx("div",{className:"pb-3",children:e.jsx(R,{breadcrumbs:[{name:p("settings"),appLink:{application:i.SETTINGS,action:n.Settings.HOME}},{name:p("breadcrumb"),active:!0}]})}),(()=>{var s,u;return!a.data||!t.data?e.jsx(U,{}):!((s=a.data)!=null&&s.length)&&!((u=t.data)!=null&&u.length)?e.jsx(w,{createAppLink:I}):e.jsx(F,{platforms:a.data,consumers:t.data})})()]})}export{Y as LtiPlatformsView};
//# sourceMappingURL=B_hH2MHL.chunk.js.map
