import{r as c,j as o}from"./@radix-Cdvw4jJ8.js";import{S as f,T as l,q as d,s as m,w as h,t as p}from"./index-BgEfQ3_G.js";import{a as u}from"./type-guards-CNgPYg8l.js";function x(t){const s=new Date(`${t}Z`),e=new Date;if(s<e)return"Expired";const a=s.getTime()-e.getTime(),r=Math.floor(a/(1e3*60*60*24)),i=Math.floor(a%(1e3*60*60*24)/(1e3*60*60)),n=Math.floor(a%(1e3*60*60)/(1e3*60));return r>0?`in ${r} ${r===1?"day":"days"}`:i>0?`in ${i} ${i===1?"hour":"hours"}`:n>0?`in ${n} ${n===1?"minute":"minutes"}`:"in less than a minute"}function j({expires:t}){const[s,e]=c.useState("");return c.useEffect(()=>{e(x(t))},[t]),s==="Expired"?o.jsxs("div",{className:"flex items-center space-x-0.5 text-theme-text-warning",children:[o.jsx(f,{className:"size-3 shrink-0 fill-theme-text-warning"}),o.jsx("span",{children:"Expired"})]}):o.jsx("div",{children:s})}function M({connector:t}){var e;const s=((e=t.body)==null?void 0:e.resource_id)||"Multiple";return o.jsx(l,{children:o.jsxs(d,{children:[o.jsx(m,{className:"max-w-full truncate",children:o.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:s})}),o.jsx(p,{children:s})]})})}function w(t){var r,i;const s=((r=t.body)==null?void 0:r.resource_types)??[],e=(i=t.body)==null?void 0:i.connector_type;return u(e)?[]:((e==null?void 0:e.resource_types)??[]).filter(n=>s.includes(n.resource_type))}function _(t){var r,i;const s=((r=t.body)==null?void 0:r.auth_method)||"",e=(i=t.body)==null?void 0:i.connector_type;return u(e)?void 0:((e==null?void 0:e.auth_methods)??[]).find(n=>n.auth_method===s)}export{j as E,M as R,_ as a,w as e};
