import{r as c,aJ as r}from"./@ui-core-DKdciH1Z.js";import{y as l,aU as f,a1 as d,a2 as m,a3 as p,T as h,a5 as x,ad as u}from"./index-D7KLAbvI.js";function y(e){const t=f(e),s=new Date;if(t<s)return"Expired";const o=t.getTime()-s.getTime(),n=Math.floor(o/(1e3*60*60*24)),i=Math.floor(o%(1e3*60*60*24)/(1e3*60*60)),a=Math.floor(o%(1e3*60*60)/(1e3*60));return n>0?`in ${n} ${n===1?"day":"days"}`:i>0?`in ${i} ${i===1?"hour":"hours"}`:a>0?`in ${a} ${a===1?"minute":"minutes"}`:"in less than a minute"}function j({expires:e}){const[t,s]=c.useState("");return c.useEffect(()=>{s(y(e))},[e]),t==="Expired"?r.jsxs("div",{className:"flex items-center space-x-0.5 text-theme-text-warning",children:[r.jsx(l,{className:"size-3 shrink-0 fill-theme-text-warning"}),r.jsx("span",{children:"Expired"})]}):r.jsx("div",{children:t})}function M({connector:e}){const t=e.body?.resource_id||"Multiple";return r.jsx(d,{children:r.jsxs(m,{children:[r.jsx(p,{className:"max-w-full truncate",children:r.jsx(h,{size:"sm",rounded:!1,emphasis:"minimal",className:"block w-fit max-w-full gap-0.5 truncate text-theme-text-primary",color:"grey",children:t})}),r.jsx(x,{children:t})]})})}function _(e){const t=e.body?.resource_types??[],s=e.body?.connector_type;return u(s)?[]:(s?.resource_types??[]).filter(n=>t.includes(n.resource_type))}function E(e){const t=e.body?.auth_method||"",s=e.body?.connector_type;return u(s)?void 0:(s?.auth_methods??[]).find(n=>n.auth_method===t)}export{j as E,M as R,E as a,_ as e};
