import{j as r}from"./@radix-D8tIKeo-.js";import{x as f,aj as l,Y as d,Z as m,_ as p,T as h,a0 as x,aE as u}from"./index-B44sgOyQ.js";import{a as c}from"./@monaco-editor-CuNQBT0l.js";function y(e){const t=l(e),s=new Date;if(t<s)return"Expired";const n=t.getTime()-s.getTime(),o=Math.floor(n/(1e3*60*60*24)),i=Math.floor(n%(1e3*60*60*24)/(1e3*60*60)),a=Math.floor(n%(1e3*60*60)/(1e3*60));return o>0?`in ${o} ${o===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 M({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(f,{className:"size-3 shrink-0 fill-theme-text-warning"}),r.jsx("span",{children:"Expired"})]}):r.jsx("div",{children:t})}function _({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(e){const t=e.body?.resource_types??[],s=e.body?.connector_type;return u(s)?[]:(s?.resource_types??[]).filter(o=>t.includes(o.resource_type))}function w(e){const t=e.body?.auth_method||"",s=e.body?.connector_type;return u(s)?void 0:(s?.auth_methods??[]).find(o=>o.auth_method===t)}export{M as E,_ as R,w as a,E as e};
