import{c as T,u as z,j as n}from"./index-BcdQIGUF.js";import{B as y}from"./button-BVfOTfpc.js";import{T as C,a as S,b as B,c as v}from"./tooltip-DDTkATYg.js";import{c as A}from"./Pin01-EjlLL7Hj.js";import{u as E,a as I}from"./use-organization-settings-K9WNKRlW.js";function $(h){const e=T.c(19),{title:u,url:t,icon:p}=h,{org:_}=z(),s=E(_.id),f=I(_.id);let a;e[0]!==s?.sidebar_items||e[1]!==t?(a=s?.sidebar_items?.some(m=>m.url===t),e[0]=s?.sidebar_items,e[1]=t,e[2]=a):a=e[2];const r=!!a;let l;e[3]!==f.update||e[4]!==p||e[5]!==r||e[6]!==s?.sidebar_items||e[7]!==u||e[8]!==t?(l=async()=>{const m=s?.sidebar_items||[];let j;r?j=m.filter(P=>P.url!==t):j=[...m,{title:u,url:t,icon:p}],await f.update.mutateAsync({sidebar_items:j})},e[3]=f.update,e[4]=p,e[5]=r,e[6]=s?.sidebar_items,e[7]=u,e[8]=t,e[9]=l):l=e[9];const b=l,x=r?"secondary":"outline";let c;e[10]===Symbol.for("react.memo_cache_sentinel")?(c=n.jsx(A,{size:16}),e[10]=c):c=e[10];let i;e[11]!==b||e[12]!==x?(i=n.jsx(C,{asChild:!0,children:n.jsx(y,{onClick:b,size:"icon",variant:x,className:"size-7 border border-input",children:c})}),e[11]=b,e[12]=x,e[13]=i):i=e[13];const g=r?"Pinned":"Pin to sidebar";let o;e[14]!==g?(o=n.jsx(S,{children:g}),e[14]=g,e[15]=o):o=e[15];let d;return e[16]!==i||e[17]!==o?(d=n.jsx(B,{children:n.jsxs(v,{children:[i,o]})}),e[16]=i,e[17]=o,e[18]=d):d=e[18],d}export{$ as P};
