@meridianjs/admin-dashboard 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ProjectTimelinePage-CfUyV6A9.js → ProjectTimelinePage-CBA3foKj.js} +1 -1
- package/dist/assets/index-DPCjp89Y.css +1 -0
- package/dist/assets/index-xgSB9sMI.js +477 -0
- package/dist/index.html +2 -2
- package/package.json +3 -1
- package/dist/assets/index-BOzBp6yE.css +0 -1
- package/dist/assets/index-DmMtaLEI.js +0 -476
|
@@ -1,476 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-CfUyV6A9.js","assets/vendor-query-B9zjiv_I.js","assets/vendor-react-GAVzOgi0.js","assets/vendor-dnd-DY2LDzZ0.js","assets/vendor-radix-CvpS4Cp5.js","assets/vendor-editor-Bc-lI3f8.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,u as Ne,a as ce,b as le,R as gc,Q as bc,c as yc}from"./vendor-query-B9zjiv_I.js";import{a as vc,c as N,r as x,b as jc,u as Ge,d as dr,N as As,e as He,L as wn,O as li,f as di,h as wc,i as Re,j as Rs,B as Nc}from"./vendor-react-GAVzOgi0.js";import{C as ci,R as kc,T as Sc,P as Cc,S as ya,a as ui,O as js,b as _n,c as ws,d as cr,e as Ks,D as Vs,f as En,g as mi,h as fi,i as Mc,j as hi,I as xi,k as pi,l as gi,m as bi,L as yi,n as vi,o as Dc,p as _c,q as ji,r as wi,F as Ni,u as Is,t as Qt,s as Ec,v as ki,w as Si,x as Oc,y as Ci,z as Mi,A as Tc,B as Di,V as Pc,E as _i,G as Ei,H as Ac,J as $c,K as Oi,M as Rc,N as Ic,Q as zc,U as Ti,W as Fc,X as Wc,Y as Pi,Z as qc,_ as Bc,$ as Ai,a0 as Lc,a1 as $i,a2 as Yc,a3 as Hc,a4 as Ri,a5 as Uc}from"./vendor-radix-CvpS4Cp5.js";import{u as Ii,a as zi,P as Fi,D as Wi,S as va,h as qi,b as rr,c as ja,C as wa,d as Kc,v as Vc,r as Gc,e as Qc,f as Xc}from"./vendor-dnd-DY2LDzZ0.js";import{E as Jc,u as Bi,i as Li,a as Yi,b as Hi,c as Ui,d as Zc,e as eu}from"./vendor-editor-Bc-lI3f8.js";(function(){const s=document.createElement("link").relList;if(s&&s.supports&&s.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const o of a)if(o.type==="childList")for(const i of o.addedNodes)i.tagName==="LINK"&&i.rel==="modulepreload"&&r(i)}).observe(document,{childList:!0,subtree:!0});function n(a){const o={};return a.integrity&&(o.integrity=a.integrity),a.referrerPolicy&&(o.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?o.credentials="include":a.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(a){if(a.ep)return;a.ep=!0;const o=n(a);fetch(a.href,o)}})();var Ki,po=vc;Ki=po.createRoot,po.hydrateRoot;const tu="modulepreload",su=function(t){return"/"+t},go={},nu=function(s,n,r){let a=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),l=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));a=Promise.allSettled(n.map(d=>{if(d=su(d),d in go)return;go[d]=!0;const c=d.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${u}`))return;const m=document.createElement("link");if(m.rel=c?"stylesheet":tu,c||(m.as="script"),m.crossOrigin="",m.href=d,l&&m.setAttribute("nonce",l),document.head.appendChild(m),c)return new Promise((f,h)=>{m.addEventListener("load",f),m.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${d}`)))})}))}function o(i){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=i,window.dispatchEvent(l),!l.defaultPrevented)throw i}return a.then(i=>{for(const l of i||[])l.status==="rejected"&&o(l.reason);return s().catch(o)})};var ru=function(){return null},au=t=>{switch(t){case"success":return lu;case"info":return cu;case"warning":return du;case"error":return uu;default:return null}},ou=Array(12).fill(0),iu=({visible:t,className:s})=>N.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":t},N.createElement("div",{className:"sonner-spinner"},ou.map((n,r)=>N.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),lu=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),du=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),cu=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),uu=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},N.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),mu=N.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},N.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),N.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),fu=()=>{let[t,s]=N.useState(document.hidden);return N.useEffect(()=>{let n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},da=1,hu=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let s=this.subscribers.indexOf(t);this.subscribers.splice(s,1)}),this.publish=t=>{this.subscribers.forEach(s=>s(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var s;let{message:n,...r}=t,a=typeof(t==null?void 0:t.id)=="number"||((s=t.id)==null?void 0:s.length)>0?t.id:da++,o=this.toasts.find(l=>l.id===a),i=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...t,id:a,title:n}),{...l,...t,id:a,dismissible:i,title:n}):l):this.addToast({title:n,...r,dismissible:i,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:t,dismiss:!0})),t),this.message=(t,s)=>this.create({...s,message:t}),this.error=(t,s)=>this.create({...s,message:t,type:"error"}),this.success=(t,s)=>this.create({...s,type:"success",message:t}),this.info=(t,s)=>this.create({...s,type:"info",message:t}),this.warning=(t,s)=>this.create({...s,type:"warning",message:t}),this.loading=(t,s)=>this.create({...s,type:"loading",message:t}),this.promise=(t,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:t,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=t instanceof Promise?t:t(),a=n!==void 0,o,i=r.then(async d=>{if(o=["resolve",d],N.isValidElement(d))a=!1,this.create({id:n,type:"default",message:d});else if(pu(d)&&!d.ok){a=!1;let c=typeof s.error=="function"?await s.error(`HTTP error! status: ${d.status}`):s.error,u=typeof s.description=="function"?await s.description(`HTTP error! status: ${d.status}`):s.description;this.create({id:n,type:"error",message:c,description:u})}else if(s.success!==void 0){a=!1;let c=typeof s.success=="function"?await s.success(d):s.success,u=typeof s.description=="function"?await s.description(d):s.description;this.create({id:n,type:"success",message:c,description:u})}}).catch(async d=>{if(o=["reject",d],s.error!==void 0){a=!1;let c=typeof s.error=="function"?await s.error(d):s.error,u=typeof s.description=="function"?await s.description(d):s.description;this.create({id:n,type:"error",message:c,description:u})}}).finally(()=>{var d;a&&(this.dismiss(n),n=void 0),(d=s.finally)==null||d.call(s)}),l=()=>new Promise((d,c)=>i.then(()=>o[0]==="reject"?c(o[1]):d(o[1])).catch(c));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,s)=>{let n=(s==null?void 0:s.id)||da++;return this.create({jsx:t(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Je=new hu,xu=(t,s)=>{let n=(s==null?void 0:s.id)||da++;return Je.addToast({title:t,...s,id:n}),n},pu=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",gu=xu,bu=()=>Je.toasts,yu=()=>Je.getActiveToasts(),R=Object.assign(gu,{success:Je.success,info:Je.info,warning:Je.warning,error:Je.error,custom:Je.custom,message:Je.message,promise:Je.promise,dismiss:Je.dismiss,loading:Je.loading},{getHistory:bu,getToasts:yu});function vu(t,{insertAt:s}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",s==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}vu(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
|
|
3
|
-
`);function Qn(t){return t.label!==void 0}var ju=3,wu="32px",Nu="16px",bo=4e3,ku=356,Su=14,Cu=20,Mu=200;function ct(...t){return t.filter(Boolean).join(" ")}function Du(t){let[s,n]=t.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}var _u=t=>{var s,n,r,a,o,i,l,d,c,u,m;let{invert:f,toast:h,unstyled:g,interacting:y,setHeights:S,visibleToasts:b,heights:w,index:j,toasts:v,expanded:C,removeToast:p,defaultRichColors:D,closeButton:P,style:z,cancelButtonStyle:_,actionButtonStyle:A,className:O="",descriptionClassName:$="",duration:E,position:Q,gap:Y,loadingIcon:V,expandByDefault:L,classNames:F,icons:Z,closeButtonAriaLabel:ee="Close toast",pauseWhenPageIsHidden:k}=t,[I,K]=N.useState(null),[q,M]=N.useState(null),[W,de]=N.useState(!1),[ye,$e]=N.useState(!1),[Qe,Rt]=N.useState(!1),[es,ie]=N.useState(!1),[ts,ss]=N.useState(!1),[ns,rs]=N.useState(0),[on,dt]=N.useState(0),pt=N.useRef(h.duration||E||bo),_s=N.useRef(null),qe=N.useRef(null),as=j===0,It=j+1<=b,Be=h.type,gt=h.dismissible!==!1,zt=h.className||"",ln=h.descriptionClassName||"",St=N.useMemo(()=>w.findIndex(B=>B.toastId===h.id)||0,[w,h.id]),dn=N.useMemo(()=>{var B;return(B=h.closeButton)!=null?B:P},[h.closeButton,P]),bt=N.useMemo(()=>h.duration||E||bo,[h.duration,E]),Ft=N.useRef(0),yt=N.useRef(0),Es=N.useRef(0),vt=N.useRef(null),[Os,cn]=Q.split("-"),ae=N.useMemo(()=>w.reduce((B,fe,he)=>he>=St?B:B+fe.height,0),[w,St]),X=fu(),ne=h.invert||f,U=Be==="loading";yt.current=N.useMemo(()=>St*Y+ae,[St,ae]),N.useEffect(()=>{pt.current=bt},[bt]),N.useEffect(()=>{de(!0)},[]),N.useEffect(()=>{let B=qe.current;if(B){let fe=B.getBoundingClientRect().height;return dt(fe),S(he=>[{toastId:h.id,height:fe,position:h.position},...he]),()=>S(he=>he.filter(Pe=>Pe.toastId!==h.id))}},[S,h.id]),N.useLayoutEffect(()=>{if(!W)return;let B=qe.current,fe=B.style.height;B.style.height="auto";let he=B.getBoundingClientRect().height;B.style.height=fe,dt(he),S(Pe=>Pe.find(Ce=>Ce.toastId===h.id)?Pe.map(Ce=>Ce.toastId===h.id?{...Ce,height:he}:Ce):[{toastId:h.id,height:he,position:h.position},...Pe])},[W,h.title,h.description,S,h.id]);let te=N.useCallback(()=>{$e(!0),rs(yt.current),S(B=>B.filter(fe=>fe.toastId!==h.id)),setTimeout(()=>{p(h)},Mu)},[h,p,S,yt]);N.useEffect(()=>{if(h.promise&&Be==="loading"||h.duration===1/0||h.type==="loading")return;let B;return C||y||k&&X?(()=>{if(Es.current<Ft.current){let fe=new Date().getTime()-Ft.current;pt.current=pt.current-fe}Es.current=new Date().getTime()})():pt.current!==1/0&&(Ft.current=new Date().getTime(),B=setTimeout(()=>{var fe;(fe=h.onAutoClose)==null||fe.call(h,h),te()},pt.current)),()=>clearTimeout(B)},[C,y,h,Be,k,X,te]),N.useEffect(()=>{h.delete&&te()},[te,h.delete]);function ge(){var B,fe,he;return Z!=null&&Z.loading?N.createElement("div",{className:ct(F==null?void 0:F.loader,(B=h==null?void 0:h.classNames)==null?void 0:B.loader,"sonner-loader"),"data-visible":Be==="loading"},Z.loading):V?N.createElement("div",{className:ct(F==null?void 0:F.loader,(fe=h==null?void 0:h.classNames)==null?void 0:fe.loader,"sonner-loader"),"data-visible":Be==="loading"},V):N.createElement(iu,{className:ct(F==null?void 0:F.loader,(he=h==null?void 0:h.classNames)==null?void 0:he.loader),visible:Be==="loading"})}return N.createElement("li",{tabIndex:0,ref:qe,className:ct(O,zt,F==null?void 0:F.toast,(s=h==null?void 0:h.classNames)==null?void 0:s.toast,F==null?void 0:F.default,F==null?void 0:F[Be],(n=h==null?void 0:h.classNames)==null?void 0:n[Be]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:D,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":W,"data-promise":!!h.promise,"data-swiped":ts,"data-removed":ye,"data-visible":It,"data-y-position":Os,"data-x-position":cn,"data-index":j,"data-front":as,"data-swiping":Qe,"data-dismissible":gt,"data-type":Be,"data-invert":ne,"data-swipe-out":es,"data-swipe-direction":q,"data-expanded":!!(C||L&&W),style:{"--index":j,"--toasts-before":j,"--z-index":v.length-j,"--offset":`${ye?ns:yt.current}px`,"--initial-height":L?"auto":`${on}px`,...z,...h.style},onDragEnd:()=>{Rt(!1),K(null),vt.current=null},onPointerDown:B=>{U||!gt||(_s.current=new Date,rs(yt.current),B.target.setPointerCapture(B.pointerId),B.target.tagName!=="BUTTON"&&(Rt(!0),vt.current={x:B.clientX,y:B.clientY}))},onPointerUp:()=>{var B,fe,he,Pe;if(es||!gt)return;vt.current=null;let Ce=Number(((B=qe.current)==null?void 0:B.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Me=Number(((fe=qe.current)==null?void 0:fe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),at=new Date().getTime()-((he=_s.current)==null?void 0:he.getTime()),Xe=I==="x"?Ce:Me,Wt=Math.abs(Xe)/at;if(Math.abs(Xe)>=Cu||Wt>.11){rs(yt.current),(Pe=h.onDismiss)==null||Pe.call(h,h),M(I==="x"?Ce>0?"right":"left":Me>0?"down":"up"),te(),ie(!0),ss(!1);return}Rt(!1),K(null)},onPointerMove:B=>{var fe,he,Pe,Ce;if(!vt.current||!gt||((fe=window.getSelection())==null?void 0:fe.toString().length)>0)return;let Me=B.clientY-vt.current.y,at=B.clientX-vt.current.x,Xe=(he=t.swipeDirections)!=null?he:Du(Q);!I&&(Math.abs(at)>1||Math.abs(Me)>1)&&K(Math.abs(at)>Math.abs(Me)?"x":"y");let Wt={x:0,y:0};I==="y"?(Xe.includes("top")||Xe.includes("bottom"))&&(Xe.includes("top")&&Me<0||Xe.includes("bottom")&&Me>0)&&(Wt.y=Me):I==="x"&&(Xe.includes("left")||Xe.includes("right"))&&(Xe.includes("left")&&at<0||Xe.includes("right")&&at>0)&&(Wt.x=at),(Math.abs(Wt.x)>0||Math.abs(Wt.y)>0)&&ss(!0),(Pe=qe.current)==null||Pe.style.setProperty("--swipe-amount-x",`${Wt.x}px`),(Ce=qe.current)==null||Ce.style.setProperty("--swipe-amount-y",`${Wt.y}px`)}},dn&&!h.jsx?N.createElement("button",{"aria-label":ee,"data-disabled":U,"data-close-button":!0,onClick:U||!gt?()=>{}:()=>{var B;te(),(B=h.onDismiss)==null||B.call(h,h)},className:ct(F==null?void 0:F.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(o=Z==null?void 0:Z.close)!=null?o:mu):null,h.jsx||x.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:N.createElement(N.Fragment,null,Be||h.icon||h.promise?N.createElement("div",{"data-icon":"",className:ct(F==null?void 0:F.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||ge():null,h.type!=="loading"?h.icon||(Z==null?void 0:Z[Be])||au(Be):null):null,N.createElement("div",{"data-content":"",className:ct(F==null?void 0:F.content,(l=h==null?void 0:h.classNames)==null?void 0:l.content)},N.createElement("div",{"data-title":"",className:ct(F==null?void 0:F.title,(d=h==null?void 0:h.classNames)==null?void 0:d.title)},typeof h.title=="function"?h.title():h.title),h.description?N.createElement("div",{"data-description":"",className:ct($,ln,F==null?void 0:F.description,(c=h==null?void 0:h.classNames)==null?void 0:c.description)},typeof h.description=="function"?h.description():h.description):null),x.isValidElement(h.cancel)?h.cancel:h.cancel&&Qn(h.cancel)?N.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||_,onClick:B=>{var fe,he;Qn(h.cancel)&>&&((he=(fe=h.cancel).onClick)==null||he.call(fe,B),te())},className:ct(F==null?void 0:F.cancelButton,(u=h==null?void 0:h.classNames)==null?void 0:u.cancelButton)},h.cancel.label):null,x.isValidElement(h.action)?h.action:h.action&&Qn(h.action)?N.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||A,onClick:B=>{var fe,he;Qn(h.action)&&((he=(fe=h.action).onClick)==null||he.call(fe,B),!B.defaultPrevented&&te())},className:ct(F==null?void 0:F.actionButton,(m=h==null?void 0:h.classNames)==null?void 0:m.actionButton)},h.action.label):null))};function yo(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Eu(t,s){let n={};return[t,s].forEach((r,a)=>{let o=a===1,i=o?"--mobile-offset":"--offset",l=o?Nu:wu;function d(c){["top","right","bottom","left"].forEach(u=>{n[`${i}-${u}`]=typeof c=="number"?`${c}px`:c})}typeof r=="number"||typeof r=="string"?d(r):typeof r=="object"?["top","right","bottom","left"].forEach(c=>{r[c]===void 0?n[`${i}-${c}`]=l:n[`${i}-${c}`]=typeof r[c]=="number"?`${r[c]}px`:r[c]}):d(l)}),n}var Ou=x.forwardRef(function(t,s){let{invert:n,position:r="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:i,className:l,offset:d,mobileOffset:c,theme:u="light",richColors:m,duration:f,style:h,visibleToasts:g=ju,toastOptions:y,dir:S=yo(),gap:b=Su,loadingIcon:w,icons:j,containerAriaLabel:v="Notifications",pauseWhenPageIsHidden:C}=t,[p,D]=N.useState([]),P=N.useMemo(()=>Array.from(new Set([r].concat(p.filter(k=>k.position).map(k=>k.position)))),[p,r]),[z,_]=N.useState([]),[A,O]=N.useState(!1),[$,E]=N.useState(!1),[Q,Y]=N.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=N.useRef(null),L=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),F=N.useRef(null),Z=N.useRef(!1),ee=N.useCallback(k=>{D(I=>{var K;return(K=I.find(q=>q.id===k.id))!=null&&K.delete||Je.dismiss(k.id),I.filter(({id:q})=>q!==k.id)})},[]);return N.useEffect(()=>Je.subscribe(k=>{if(k.dismiss){D(I=>I.map(K=>K.id===k.id?{...K,delete:!0}:K));return}setTimeout(()=>{jc.flushSync(()=>{D(I=>{let K=I.findIndex(q=>q.id===k.id);return K!==-1?[...I.slice(0,K),{...I[K],...k},...I.slice(K+1)]:[k,...I]})})})}),[]),N.useEffect(()=>{if(u!=="system"){Y(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Y("dark"):Y("light")),typeof window>"u")return;let k=window.matchMedia("(prefers-color-scheme: dark)");try{k.addEventListener("change",({matches:I})=>{Y(I?"dark":"light")})}catch{k.addListener(({matches:K})=>{try{Y(K?"dark":"light")}catch(q){console.error(q)}})}},[u]),N.useEffect(()=>{p.length<=1&&O(!1)},[p]),N.useEffect(()=>{let k=I=>{var K,q;a.every(M=>I[M]||I.code===M)&&(O(!0),(K=V.current)==null||K.focus()),I.code==="Escape"&&(document.activeElement===V.current||(q=V.current)!=null&&q.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a]),N.useEffect(()=>{if(V.current)return()=>{F.current&&(F.current.focus({preventScroll:!0}),F.current=null,Z.current=!1)}},[V.current]),N.createElement("section",{ref:s,"aria-label":`${v} ${L}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},P.map((k,I)=>{var K;let[q,M]=k.split("-");return p.length?N.createElement("ol",{key:k,dir:S==="auto"?yo():S,tabIndex:-1,ref:V,className:l,"data-sonner-toaster":!0,"data-theme":Q,"data-y-position":q,"data-lifted":A&&p.length>1&&!o,"data-x-position":M,style:{"--front-toast-height":`${((K=z[0])==null?void 0:K.height)||0}px`,"--width":`${ku}px`,"--gap":`${b}px`,...h,...Eu(d,c)},onBlur:W=>{Z.current&&!W.currentTarget.contains(W.relatedTarget)&&(Z.current=!1,F.current&&(F.current.focus({preventScroll:!0}),F.current=null))},onFocus:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||Z.current||(Z.current=!0,F.current=W.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{$||O(!1)},onDragEnd:()=>O(!1),onPointerDown:W=>{W.target instanceof HTMLElement&&W.target.dataset.dismissible==="false"||E(!0)},onPointerUp:()=>E(!1)},p.filter(W=>!W.position&&I===0||W.position===k).map((W,de)=>{var ye,$e;return N.createElement(_u,{key:W.id,icons:j,index:de,toast:W,defaultRichColors:m,duration:(ye=y==null?void 0:y.duration)!=null?ye:f,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:g,closeButton:($e=y==null?void 0:y.closeButton)!=null?$e:i,interacting:$,position:k,style:y==null?void 0:y.style,unstyled:y==null?void 0:y.unstyled,classNames:y==null?void 0:y.classNames,cancelButtonStyle:y==null?void 0:y.cancelButtonStyle,actionButtonStyle:y==null?void 0:y.actionButtonStyle,removeToast:ee,toasts:p.filter(Qe=>Qe.position==W.position),heights:z.filter(Qe=>Qe.position==W.position),setHeights:_,expandByDefault:o,gap:b,loadingIcon:w,expanded:A,pauseWhenPageIsHidden:C,swipeDirections:t.swipeDirections})})):null}))}),Tu=(t,s,n,r,a,o,i,l)=>{let d=document.documentElement,c=["light","dark"];function u(h){(Array.isArray(t)?t:[t]).forEach(g=>{let y=g==="class",S=y&&o?a.map(b=>o[b]||b):a;y?(d.classList.remove(...S),d.classList.add(o&&o[h]?o[h]:h)):d.setAttribute(g,h)}),m(h)}function m(h){l&&c.includes(h)&&(d.style.colorScheme=h)}function f(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(r)u(r);else try{let h=localStorage.getItem(s)||n,g=i&&h==="system"?f():h;u(g)}catch{}},vo=["light","dark"],Vi="(prefers-color-scheme: dark)",Pu=typeof window>"u",Na=x.createContext(void 0),Au={setTheme:t=>{},themes:[]},$u=()=>{var t;return(t=x.useContext(Na))!=null?t:Au},Ru=t=>x.useContext(Na)?x.createElement(x.Fragment,null,t.children):x.createElement(zu,{...t}),Iu=["light","dark"],zu=({forcedTheme:t,disableTransitionOnChange:s=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:a="theme",themes:o=Iu,defaultTheme:i=n?"system":"light",attribute:l="data-theme",value:d,children:c,nonce:u,scriptProps:m})=>{let[f,h]=x.useState(()=>Wu(a,i)),[g,y]=x.useState(()=>f==="system"?zr():f),S=d?Object.values(d):o,b=x.useCallback(C=>{let p=C;if(!p)return;C==="system"&&n&&(p=zr());let D=d?d[p]:p,P=s?qu(u):null,z=document.documentElement,_=A=>{A==="class"?(z.classList.remove(...S),D&&z.classList.add(D)):A.startsWith("data-")&&(D?z.setAttribute(A,D):z.removeAttribute(A))};if(Array.isArray(l)?l.forEach(_):_(l),r){let A=vo.includes(i)?i:null,O=vo.includes(p)?p:A;z.style.colorScheme=O}P==null||P()},[u]),w=x.useCallback(C=>{let p=typeof C=="function"?C(f):C;h(p);try{localStorage.setItem(a,p)}catch{}},[f]),j=x.useCallback(C=>{let p=zr(C);y(p),f==="system"&&n&&!t&&b("system")},[f,t]);x.useEffect(()=>{let C=window.matchMedia(Vi);return C.addListener(j),j(C),()=>C.removeListener(j)},[j]),x.useEffect(()=>{let C=p=>{p.key===a&&(p.newValue?h(p.newValue):w(i))};return window.addEventListener("storage",C),()=>window.removeEventListener("storage",C)},[w]),x.useEffect(()=>{b(t??f)},[t,f]);let v=x.useMemo(()=>({theme:f,setTheme:w,forcedTheme:t,resolvedTheme:f==="system"?g:f,themes:n?[...o,"system"]:o,systemTheme:n?g:void 0}),[f,w,t,g,n,o]);return x.createElement(Na.Provider,{value:v},x.createElement(Fu,{forcedTheme:t,storageKey:a,attribute:l,enableSystem:n,enableColorScheme:r,defaultTheme:i,value:d,themes:o,nonce:u,scriptProps:m}),c)},Fu=x.memo(({forcedTheme:t,storageKey:s,attribute:n,enableSystem:r,enableColorScheme:a,defaultTheme:o,value:i,themes:l,nonce:d,scriptProps:c})=>{let u=JSON.stringify([n,s,o,t,l,i,r,a]).slice(1,-1);return x.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?d:"",dangerouslySetInnerHTML:{__html:`(${Tu.toString()})(${u})`}})}),Wu=(t,s)=>{if(Pu)return;let n;try{n=localStorage.getItem(t)||void 0}catch{}return n||s},qu=t=>{let s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.appendChild(document.createTextNode("*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}")),document.head.appendChild(s),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(s)},1)}},zr=t=>(t||(t=window.matchMedia(Vi)),t.matches?"dark":"light");function Bu({children:t}){return e.jsx(Ru,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:t})}const Gi=x.createContext(null),un="meridian_token",Fr="meridian_user",Xn="meridian_workspace";function jo(t){try{const s=t.split(".")[1],n=s.replace(/-/g,"+").replace(/_/g,"/").padEnd(s.length+(4-s.length%4)%4,"="),r=JSON.parse(atob(n));return Array.isArray(r.roles)?r.roles:[]}catch{return[]}}function Lu({children:t}){const[s,n]=x.useState(()=>{try{const u=localStorage.getItem(Fr),m=localStorage.getItem(un);if(!u)return null;const f=JSON.parse(u);return Array.isArray(f.roles)||(f.roles=m?jo(m):[]),f}catch{return null}}),[r,a]=x.useState(()=>localStorage.getItem(un)),[o,i]=x.useState(()=>{try{const u=localStorage.getItem(Xn);return u?JSON.parse(u):null}catch{return null}}),l=(u,m)=>{const f=jo(m),h={...u,roles:f};n(h),a(m),localStorage.setItem(un,m),localStorage.setItem(Fr,JSON.stringify(h))},d=()=>{const u=localStorage.getItem(un);u&&fetch("/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${u}`,"Content-Type":"application/json"}}).catch(()=>{}),n(null),a(null),i(null),localStorage.removeItem(un),localStorage.removeItem(Fr),localStorage.removeItem(Xn)},c=u=>{i(u),u?localStorage.setItem(Xn,JSON.stringify(u)):localStorage.removeItem(Xn)};return x.useEffect(()=>{r&&!s&&d()},[]),e.jsx(Gi.Provider,{value:{user:s,token:r,workspace:o,isAuthenticated:!!r&&!!s,login:l,logout:d,setWorkspace:c},children:t})}function ke(){const t=x.useContext(Gi);if(!t)throw new Error("useAuth must be used within AuthProvider");return t}const Qi=x.createContext(null);function Yu({children:t}){const[s,n]=x.useState(!1);return x.useEffect(()=>{const r=a=>{(a.metaKey||a.ctrlKey)&&a.key==="k"&&(a.preventDefault(),n(o=>!o))};return document.addEventListener("keydown",r),()=>document.removeEventListener("keydown",r)},[]),e.jsx(Qi.Provider,{value:{open:s,setOpen:n,toggle:()=>n(r=>!r)},children:t})}function Xi(){const t=x.useContext(Qi);if(!t)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return t}function Ji(t){var s,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(s=0;s<a;s++)t[s]&&(n=Ji(t[s]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Zi(){for(var t,s,n=0,r="",a=arguments.length;n<a;n++)(t=arguments[n])&&(s=Ji(t))&&(r&&(r+=" "),r+=s);return r}const ka="-",Hu=t=>{const s=Ku(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:i=>{const l=i.split(ka);return l[0]===""&&l.length!==1&&l.shift(),el(l,s)||Uu(i)},getConflictingClassGroupIds:(i,l)=>{const d=n[i]||[];return l&&r[i]?[...d,...r[i]]:d}}},el=(t,s)=>{var i;if(t.length===0)return s.classGroupId;const n=t[0],r=s.nextPart.get(n),a=r?el(t.slice(1),r):void 0;if(a)return a;if(s.validators.length===0)return;const o=t.join(ka);return(i=s.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},wo=/^\[(.+)\]$/,Uu=t=>{if(wo.test(t)){const s=wo.exec(t)[1],n=s==null?void 0:s.substring(0,s.indexOf(":"));if(n)return"arbitrary.."+n}},Ku=t=>{const{theme:s,prefix:n}=t,r={nextPart:new Map,validators:[]};return Gu(Object.entries(t.classGroups),n).forEach(([o,i])=>{ca(i,r,o,s)}),r},ca=(t,s,n,r)=>{t.forEach(a=>{if(typeof a=="string"){const o=a===""?s:No(s,a);o.classGroupId=n;return}if(typeof a=="function"){if(Vu(a)){ca(a(r),s,n,r);return}s.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,i])=>{ca(i,No(s,o),n,r)})})},No=(t,s)=>{let n=t;return s.split(ka).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Vu=t=>t.isThemeGetter,Gu=(t,s)=>s?t.map(([n,r])=>{const a=r.map(o=>typeof o=="string"?s+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([i,l])=>[s+i,l])):o);return[n,a]}):t,Qu=t=>{if(t<1)return{get:()=>{},set:()=>{}};let s=0,n=new Map,r=new Map;const a=(o,i)=>{n.set(o,i),s++,s>t&&(s=0,r=n,n=new Map)};return{get(o){let i=n.get(o);if(i!==void 0)return i;if((i=r.get(o))!==void 0)return a(o,i),i},set(o,i){n.has(o)?n.set(o,i):a(o,i)}}},tl="!",Xu=t=>{const{separator:s,experimentalParseClassName:n}=t,r=s.length===1,a=s[0],o=s.length,i=l=>{const d=[];let c=0,u=0,m;for(let S=0;S<l.length;S++){let b=l[S];if(c===0){if(b===a&&(r||l.slice(S,S+o)===s)){d.push(l.slice(u,S)),u=S+o;continue}if(b==="/"){m=S;continue}}b==="["?c++:b==="]"&&c--}const f=d.length===0?l:l.substring(u),h=f.startsWith(tl),g=h?f.substring(1):f,y=m&&m>u?m-u:void 0;return{modifiers:d,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}};return n?l=>n({className:l,parseClassName:i}):i},Ju=t=>{if(t.length<=1)return t;const s=[];let n=[];return t.forEach(r=>{r[0]==="["?(s.push(...n.sort(),r),n=[]):n.push(r)}),s.push(...n.sort()),s},Zu=t=>({cache:Qu(t.cacheSize),parseClassName:Xu(t),...Hu(t)}),em=/\s+/,tm=(t,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=s,o=[],i=t.trim().split(em);let l="";for(let d=i.length-1;d>=0;d-=1){const c=i[d],{modifiers:u,hasImportantModifier:m,baseClassName:f,maybePostfixModifierPosition:h}=n(c);let g=!!h,y=r(g?f.substring(0,h):f);if(!y){if(!g){l=c+(l.length>0?" "+l:l);continue}if(y=r(f),!y){l=c+(l.length>0?" "+l:l);continue}g=!1}const S=Ju(u).join(":"),b=m?S+tl:S,w=b+y;if(o.includes(w))continue;o.push(w);const j=a(y,g);for(let v=0;v<j.length;++v){const C=j[v];o.push(b+C)}l=c+(l.length>0?" "+l:l)}return l};function sm(){let t=0,s,n,r="";for(;t<arguments.length;)(s=arguments[t++])&&(n=sl(s))&&(r&&(r+=" "),r+=n);return r}const sl=t=>{if(typeof t=="string")return t;let s,n="";for(let r=0;r<t.length;r++)t[r]&&(s=sl(t[r]))&&(n&&(n+=" "),n+=s);return n};function nm(t,...s){let n,r,a,o=i;function i(d){const c=s.reduce((u,m)=>m(u),t());return n=Zu(c),r=n.cache.get,a=n.cache.set,o=l,l(d)}function l(d){const c=r(d);if(c)return c;const u=tm(d,n);return a(d,u),u}return function(){return o(sm.apply(null,arguments))}}const Se=t=>{const s=n=>n[t]||[];return s.isThemeGetter=!0,s},nl=/^\[(?:([a-z-]+):)?(.+)\]$/i,rm=/^\d+\/\d+$/,am=new Set(["px","full","screen"]),om=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,im=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,lm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,dm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ct=t=>zs(t)||am.has(t)||rm.test(t),qt=t=>Gs(t,"length",bm),zs=t=>!!t&&!Number.isNaN(Number(t)),Wr=t=>Gs(t,"number",zs),mn=t=>!!t&&Number.isInteger(Number(t)),um=t=>t.endsWith("%")&&zs(t.slice(0,-1)),ue=t=>nl.test(t),Bt=t=>om.test(t),mm=new Set(["length","size","percentage"]),fm=t=>Gs(t,mm,rl),hm=t=>Gs(t,"position",rl),xm=new Set(["image","url"]),pm=t=>Gs(t,xm,vm),gm=t=>Gs(t,"",ym),fn=()=>!0,Gs=(t,s,n)=>{const r=nl.exec(t);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):n(r[2]):!1},bm=t=>im.test(t)&&!lm.test(t),rl=()=>!1,ym=t=>dm.test(t),vm=t=>cm.test(t),jm=()=>{const t=Se("colors"),s=Se("spacing"),n=Se("blur"),r=Se("brightness"),a=Se("borderColor"),o=Se("borderRadius"),i=Se("borderSpacing"),l=Se("borderWidth"),d=Se("contrast"),c=Se("grayscale"),u=Se("hueRotate"),m=Se("invert"),f=Se("gap"),h=Se("gradientColorStops"),g=Se("gradientColorStopPositions"),y=Se("inset"),S=Se("margin"),b=Se("opacity"),w=Se("padding"),j=Se("saturate"),v=Se("scale"),C=Se("sepia"),p=Se("skew"),D=Se("space"),P=Se("translate"),z=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],A=()=>["auto",ue,s],O=()=>[ue,s],$=()=>["",Ct,qt],E=()=>["auto",zs,ue],Q=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],V=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],L=()=>["start","end","center","between","around","evenly","stretch"],F=()=>["","0",ue],Z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[zs,ue];return{cacheSize:500,separator:":",theme:{colors:[fn],spacing:[Ct,qt],blur:["none","",Bt,ue],brightness:ee(),borderColor:[t],borderRadius:["none","","full",Bt,ue],borderSpacing:O(),borderWidth:$(),contrast:ee(),grayscale:F(),hueRotate:ee(),invert:F(),gap:O(),gradientColorStops:[t],gradientColorStopPositions:[um,qt],inset:A(),margin:A(),opacity:ee(),padding:O(),saturate:ee(),scale:ee(),sepia:F(),skew:ee(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",ue]}],container:["container"],columns:[{columns:[Bt]}],"break-after":[{"break-after":Z()}],"break-before":[{"break-before":Z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Q(),ue]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:z()}],"overscroll-x":[{"overscroll-x":z()}],"overscroll-y":[{"overscroll-y":z()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",mn,ue]}],basis:[{basis:A()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ue]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:["first","last","none",mn,ue]}],"grid-cols":[{"grid-cols":[fn]}],"col-start-end":[{col:["auto",{span:["full",mn,ue]},ue]}],"col-start":[{"col-start":E()}],"col-end":[{"col-end":E()}],"grid-rows":[{"grid-rows":[fn]}],"row-start-end":[{row:["auto",{span:[mn,ue]},ue]}],"row-start":[{"row-start":E()}],"row-end":[{"row-end":E()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ue]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...L()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...L(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...L(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[S]}],mx:[{mx:[S]}],my:[{my:[S]}],ms:[{ms:[S]}],me:[{me:[S]}],mt:[{mt:[S]}],mr:[{mr:[S]}],mb:[{mb:[S]}],ml:[{ml:[S]}],"space-x":[{"space-x":[D]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[D]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ue,s]}],"min-w":[{"min-w":[ue,s,"min","max","fit"]}],"max-w":[{"max-w":[ue,s,"none","full","min","max","fit","prose",{screen:[Bt]},Bt]}],h:[{h:[ue,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ue,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ue,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ue,s,"auto","min","max","fit"]}],"font-size":[{text:["base",Bt,qt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Wr]}],"font-family":[{font:[fn]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ue]}],"line-clamp":[{"line-clamp":["none",zs,Wr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ct,ue]}],"list-image":[{"list-image":["none",ue]}],"list-style-type":[{list:["none","disc","decimal",ue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ct,qt]}],"underline-offset":[{"underline-offset":["auto",Ct,ue]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Q(),hm]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",fm]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},pm]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[g]}],"gradient-via-pos":[{via:[g]}],"gradient-to-pos":[{to:[g]}],"gradient-from":[{from:[h]}],"gradient-via":[{via:[h]}],"gradient-to":[{to:[h]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:Y()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[Ct,ue]}],"outline-w":[{outline:[Ct,qt]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Ct,qt]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",Bt,gm]}],"shadow-color":[{shadow:[fn]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...V(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":V()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[d]}],"drop-shadow":[{"drop-shadow":["","none",Bt,ue]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[m]}],saturate:[{saturate:[j]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[d]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[m]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[j]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ue]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",ue]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",ue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[v]}],"scale-x":[{"scale-x":[v]}],"scale-y":[{"scale-y":[v]}],rotate:[{rotate:[mn,ue]}],"translate-x":[{"translate-x":[P]}],"translate-y":[{"translate-y":[P]}],"skew-x":[{"skew-x":[p]}],"skew-y":[{"skew-y":[p]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ue]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ue]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ue]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Ct,qt,Wr]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},wm=nm(jm);function T(...t){return wm(Zi(t))}const Sa=Cc,ms=kc,fs=Sc,Ut=x.forwardRef(({className:t,sideOffset:s=4,...n},r)=>e.jsx(ci,{ref:r,sideOffset:s,className:T("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));Ut.displayName=ci.displayName;const al=x.createContext([]);function Nm({widgets:t,children:s}){return N.createElement(al.Provider,{value:t},s)}function km(t){return x.useContext(al).filter(n=>n.zone===t).map(n=>n.component)}var oi;const ol=((oi=window.__MERIDIAN_CONFIG__)==null?void 0:oi.apiUrl)??void 0??"";class Ca extends Error{constructor(s,n,r){super(n),this.status=s,this.data=r,this.name="ApiError"}}function il(){return localStorage.getItem("meridian_token")}async function hn(t,s={}){var o;const n=il(),r={"Content-Type":"application/json",...s.headers};n&&(r.Authorization=`Bearer ${n}`);const a=await fetch(`${ol}${t}`,{...s,headers:r});if(!a.ok){let i;try{i=await a.json()}catch{i=null}const l=((o=i==null?void 0:i.error)==null?void 0:o.message)??`HTTP ${a.status}`;throw new Ca(a.status,l,i)}if(a.status!==204)return a.json()}const J={get:t=>hn(t,{method:"GET"}),post:(t,s)=>hn(t,{method:"POST",body:JSON.stringify(s)}),put:(t,s)=>hn(t,{method:"PUT",body:JSON.stringify(s)}),patch:(t,s)=>hn(t,{method:"PATCH",body:JSON.stringify(s)}),delete:t=>hn(t,{method:"DELETE"}),upload:async(t,s)=>{var o;const n=il(),r={};n&&(r.Authorization=`Bearer ${n}`);const a=await fetch(`${ol}${t}`,{method:"POST",headers:r,body:s});if(!a.ok){let i;try{i=await a.json()}catch{i=null}const l=((o=i==null?void 0:i.error)==null?void 0:o.message)??`HTTP ${a.status}`;throw new Ca(a.status,l,i)}if(a.status!==204)return a.json()}},Te={all:["issues"],byProject:t=>[...Te.all,"project",t],detail:t=>[...Te.all,t],comments:t=>[...Te.all,t,"comments"],activities:t=>[...Te.all,t,"activities"]};function On(t){return Ne({queryKey:t?Te.byProject(t):Te.all,queryFn:()=>{const s=t?`/admin/issues?project_id=${t}`:"/admin/issues";return J.get(s)},select:s=>s.issues})}function ll(t){return Ne({queryKey:Te.detail(t),queryFn:()=>J.get(`/admin/issues/${t}`),select:s=>s.issue,enabled:!!t})}function Sm(t){return Ne({queryKey:Te.comments(t),queryFn:()=>J.get(`/admin/issues/${t}/comments`),select:s=>s.comments,enabled:!!t})}function dl(){const t=ce();return le({mutationFn:s=>J.post("/admin/issues",s),onSuccess:(s,n)=>{t.invalidateQueries({queryKey:Te.byProject(n.project_id)})}})}function ur(t,s){const n=ce();return le({mutationFn:r=>J.put(`/admin/issues/${t}`,r),onMutate:async r=>{await n.cancelQueries({queryKey:Te.byProject(s)});const a=n.getQueryData(Te.byProject(s));return n.setQueryData(Te.byProject(s),o=>o&&{...o,issues:o.issues.map(i=>i.id===t?{...i,...r}:i)}),{previous:a}},onError:(r,a,o)=>{o!=null&&o.previous&&n.setQueryData(Te.byProject(s),o.previous)},onSettled:()=>{n.invalidateQueries({queryKey:Te.byProject(s)}),n.invalidateQueries({queryKey:Te.detail(t)})}})}function Cm(t){return Ne({queryKey:Te.activities(t),queryFn:()=>J.get(`/admin/issues/${t}/activities`),select:s=>s.activities,enabled:!!t})}function Mm(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/issues/${t}/comments`,{body:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Te.comments(t)})}})}const ko=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,So=Zi,Tn=(t,s)=>n=>{var r;if((s==null?void 0:s.variants)==null)return So(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=s,i=Object.keys(a).map(c=>{const u=n==null?void 0:n[c],m=o==null?void 0:o[c];if(u===null)return null;const f=ko(u)||ko(m);return a[c][f]}),l=n&&Object.entries(n).reduce((c,u)=>{let[m,f]=u;return f===void 0||(c[m]=f),c},{}),d=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:m,className:f,...h}=u;return Object.entries(h).every(g=>{let[y,S]=g;return Array.isArray(S)?S.includes({...o,...l}[y]):{...o,...l}[y]===S})?[...c,m,f]:c},[]);return So(t,i,d,n==null?void 0:n.class,n==null?void 0:n.className)},Fs=Tn("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline",indigo:"bg-indigo text-indigo-foreground hover:opacity-90"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9","icon-sm":"h-7 w-7"}},defaultVariants:{variant:"default",size:"default"}}),G=x.forwardRef(({className:t,variant:s,size:n,asChild:r=!1,...a},o)=>{const i=r?ya:"button";return e.jsx(i,{className:T(Fs({variant:s,size:n,className:t})),ref:o,...a})});G.displayName="Button";const xe=x.forwardRef(({className:t,type:s,...n},r)=>e.jsx("input",{type:s,className:T("flex h-9 w-full rounded-lg border border-input bg-transparent px-3 py-1 text-sm shadow-none transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-[#9ca3af] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),ref:r,...n}));xe.displayName="Input";/**
|
|
4
|
-
* @license lucide-react v0.468.0 - ISC
|
|
5
|
-
*
|
|
6
|
-
* This source code is licensed under the ISC license.
|
|
7
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
8
|
-
*/const Dm=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cl=(...t)=>t.filter((s,n,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===n).join(" ").trim();/**
|
|
9
|
-
* @license lucide-react v0.468.0 - ISC
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the ISC license.
|
|
12
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/var _m={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
|
14
|
-
* @license lucide-react v0.468.0 - ISC
|
|
15
|
-
*
|
|
16
|
-
* This source code is licensed under the ISC license.
|
|
17
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/const Em=x.forwardRef(({color:t="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:i,...l},d)=>x.createElement("svg",{ref:d,..._m,width:s,height:s,stroke:t,strokeWidth:r?Number(n)*24/Number(s):n,className:cl("lucide",a),...l},[...i.map(([c,u])=>x.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
|
|
19
|
-
* @license lucide-react v0.468.0 - ISC
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the ISC license.
|
|
22
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/const H=(t,s)=>{const n=x.forwardRef(({className:r,...a},o)=>x.createElement(Em,{ref:o,iconNode:s,className:cl(`lucide-${Dm(t)}`,r),...a}));return n.displayName=`${t}`,n};/**
|
|
24
|
-
* @license lucide-react v0.468.0 - ISC
|
|
25
|
-
*
|
|
26
|
-
* This source code is licensed under the ISC license.
|
|
27
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/const mr=H("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
|
|
29
|
-
* @license lucide-react v0.468.0 - ISC
|
|
30
|
-
*
|
|
31
|
-
* This source code is licensed under the ISC license.
|
|
32
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/const Ma=H("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
|
|
34
|
-
* @license lucide-react v0.468.0 - ISC
|
|
35
|
-
*
|
|
36
|
-
* This source code is licensed under the ISC license.
|
|
37
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
38
|
-
*/const fr=H("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
|
|
39
|
-
* @license lucide-react v0.468.0 - ISC
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the ISC license.
|
|
42
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/const Ls=H("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
|
|
44
|
-
* @license lucide-react v0.468.0 - ISC
|
|
45
|
-
*
|
|
46
|
-
* This source code is licensed under the ISC license.
|
|
47
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
48
|
-
*/const ul=H("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
|
|
49
|
-
* @license lucide-react v0.468.0 - ISC
|
|
50
|
-
*
|
|
51
|
-
* This source code is licensed under the ISC license.
|
|
52
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
53
|
-
*/const ml=H("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
|
|
54
|
-
* @license lucide-react v0.468.0 - ISC
|
|
55
|
-
*
|
|
56
|
-
* This source code is licensed under the ISC license.
|
|
57
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
58
|
-
*/const Om=H("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
|
|
59
|
-
* @license lucide-react v0.468.0 - ISC
|
|
60
|
-
*
|
|
61
|
-
* This source code is licensed under the ISC license.
|
|
62
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
63
|
-
*/const Da=H("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/**
|
|
64
|
-
* @license lucide-react v0.468.0 - ISC
|
|
65
|
-
*
|
|
66
|
-
* This source code is licensed under the ISC license.
|
|
67
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
68
|
-
*/const ht=H("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
|
|
69
|
-
* @license lucide-react v0.468.0 - ISC
|
|
70
|
-
*
|
|
71
|
-
* This source code is licensed under the ISC license.
|
|
72
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
73
|
-
*/const Tm=H("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
|
|
74
|
-
* @license lucide-react v0.468.0 - ISC
|
|
75
|
-
*
|
|
76
|
-
* This source code is licensed under the ISC license.
|
|
77
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
78
|
-
*/const it=H("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
|
|
79
|
-
* @license lucide-react v0.468.0 - ISC
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the ISC license.
|
|
82
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/const Qs=H("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
|
|
84
|
-
* @license lucide-react v0.468.0 - ISC
|
|
85
|
-
*
|
|
86
|
-
* This source code is licensed under the ISC license.
|
|
87
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
88
|
-
*/const _a=H("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
|
|
89
|
-
* @license lucide-react v0.468.0 - ISC
|
|
90
|
-
*
|
|
91
|
-
* This source code is licensed under the ISC license.
|
|
92
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
93
|
-
*/const Xs=H("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
|
|
94
|
-
* @license lucide-react v0.468.0 - ISC
|
|
95
|
-
*
|
|
96
|
-
* This source code is licensed under the ISC license.
|
|
97
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
98
|
-
*/const Ea=H("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
|
|
99
|
-
* @license lucide-react v0.468.0 - ISC
|
|
100
|
-
*
|
|
101
|
-
* This source code is licensed under the ISC license.
|
|
102
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
103
|
-
*/const fl=H("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
|
|
104
|
-
* @license lucide-react v0.468.0 - ISC
|
|
105
|
-
*
|
|
106
|
-
* This source code is licensed under the ISC license.
|
|
107
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
108
|
-
*/const Pm=H("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
|
|
109
|
-
* @license lucide-react v0.468.0 - ISC
|
|
110
|
-
*
|
|
111
|
-
* This source code is licensed under the ISC license.
|
|
112
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
113
|
-
*/const Ns=H("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
114
|
-
* @license lucide-react v0.468.0 - ISC
|
|
115
|
-
*
|
|
116
|
-
* This source code is licensed under the ISC license.
|
|
117
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
118
|
-
*/const hl=H("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
|
|
119
|
-
* @license lucide-react v0.468.0 - ISC
|
|
120
|
-
*
|
|
121
|
-
* This source code is licensed under the ISC license.
|
|
122
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
123
|
-
*/const xl=H("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
|
|
124
|
-
* @license lucide-react v0.468.0 - ISC
|
|
125
|
-
*
|
|
126
|
-
* This source code is licensed under the ISC license.
|
|
127
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
128
|
-
*/const Nt=H("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
|
|
129
|
-
* @license lucide-react v0.468.0 - ISC
|
|
130
|
-
*
|
|
131
|
-
* This source code is licensed under the ISC license.
|
|
132
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
133
|
-
*/const Am=H("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
|
|
134
|
-
* @license lucide-react v0.468.0 - ISC
|
|
135
|
-
*
|
|
136
|
-
* This source code is licensed under the ISC license.
|
|
137
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
-
*/const Xt=H("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
|
|
139
|
-
* @license lucide-react v0.468.0 - ISC
|
|
140
|
-
*
|
|
141
|
-
* This source code is licensed under the ISC license.
|
|
142
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
143
|
-
*/const pl=H("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
|
|
144
|
-
* @license lucide-react v0.468.0 - ISC
|
|
145
|
-
*
|
|
146
|
-
* This source code is licensed under the ISC license.
|
|
147
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
148
|
-
*/const gl=H("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
|
|
149
|
-
* @license lucide-react v0.468.0 - ISC
|
|
150
|
-
*
|
|
151
|
-
* This source code is licensed under the ISC license.
|
|
152
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
153
|
-
*/const $m=H("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
|
|
154
|
-
* @license lucide-react v0.468.0 - ISC
|
|
155
|
-
*
|
|
156
|
-
* This source code is licensed under the ISC license.
|
|
157
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
158
|
-
*/const Rm=H("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
|
|
159
|
-
* @license lucide-react v0.468.0 - ISC
|
|
160
|
-
*
|
|
161
|
-
* This source code is licensed under the ISC license.
|
|
162
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
163
|
-
*/const Oa=H("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
|
|
164
|
-
* @license lucide-react v0.468.0 - ISC
|
|
165
|
-
*
|
|
166
|
-
* This source code is licensed under the ISC license.
|
|
167
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
168
|
-
*/const Pn=H("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
|
|
169
|
-
* @license lucide-react v0.468.0 - ISC
|
|
170
|
-
*
|
|
171
|
-
* This source code is licensed under the ISC license.
|
|
172
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
173
|
-
*/const bl=H("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
|
|
174
|
-
* @license lucide-react v0.468.0 - ISC
|
|
175
|
-
*
|
|
176
|
-
* This source code is licensed under the ISC license.
|
|
177
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
178
|
-
*/const Ta=H("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
|
|
179
|
-
* @license lucide-react v0.468.0 - ISC
|
|
180
|
-
*
|
|
181
|
-
* This source code is licensed under the ISC license.
|
|
182
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
183
|
-
*/const An=H("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
184
|
-
* @license lucide-react v0.468.0 - ISC
|
|
185
|
-
*
|
|
186
|
-
* This source code is licensed under the ISC license.
|
|
187
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
188
|
-
*/const Im=H("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/**
|
|
189
|
-
* @license lucide-react v0.468.0 - ISC
|
|
190
|
-
*
|
|
191
|
-
* This source code is licensed under the ISC license.
|
|
192
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
193
|
-
*/const zm=H("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
|
|
194
|
-
* @license lucide-react v0.468.0 - ISC
|
|
195
|
-
*
|
|
196
|
-
* This source code is licensed under the ISC license.
|
|
197
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
198
|
-
*/const Fm=H("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/**
|
|
199
|
-
* @license lucide-react v0.468.0 - ISC
|
|
200
|
-
*
|
|
201
|
-
* This source code is licensed under the ISC license.
|
|
202
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
203
|
-
*/const Wm=H("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
|
|
204
|
-
* @license lucide-react v0.468.0 - ISC
|
|
205
|
-
*
|
|
206
|
-
* This source code is licensed under the ISC license.
|
|
207
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
208
|
-
*/const qm=H("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
|
|
209
|
-
* @license lucide-react v0.468.0 - ISC
|
|
210
|
-
*
|
|
211
|
-
* This source code is licensed under the ISC license.
|
|
212
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
213
|
-
*/const Pa=H("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
|
|
214
|
-
* @license lucide-react v0.468.0 - ISC
|
|
215
|
-
*
|
|
216
|
-
* This source code is licensed under the ISC license.
|
|
217
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
218
|
-
*/const Js=H("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
|
|
219
|
-
* @license lucide-react v0.468.0 - ISC
|
|
220
|
-
*
|
|
221
|
-
* This source code is licensed under the ISC license.
|
|
222
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
223
|
-
*/const yl=H("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
|
|
224
|
-
* @license lucide-react v0.468.0 - ISC
|
|
225
|
-
*
|
|
226
|
-
* This source code is licensed under the ISC license.
|
|
227
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
228
|
-
*/const Bm=H("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
|
|
229
|
-
* @license lucide-react v0.468.0 - ISC
|
|
230
|
-
*
|
|
231
|
-
* This source code is licensed under the ISC license.
|
|
232
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
233
|
-
*/const Lm=H("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
|
|
234
|
-
* @license lucide-react v0.468.0 - ISC
|
|
235
|
-
*
|
|
236
|
-
* This source code is licensed under the ISC license.
|
|
237
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
238
|
-
*/const Ym=H("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
|
|
239
|
-
* @license lucide-react v0.468.0 - ISC
|
|
240
|
-
*
|
|
241
|
-
* This source code is licensed under the ISC license.
|
|
242
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
243
|
-
*/const vl=H("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
|
|
244
|
-
* @license lucide-react v0.468.0 - ISC
|
|
245
|
-
*
|
|
246
|
-
* This source code is licensed under the ISC license.
|
|
247
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
248
|
-
*/const xt=H("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
|
|
249
|
-
* @license lucide-react v0.468.0 - ISC
|
|
250
|
-
*
|
|
251
|
-
* This source code is licensed under the ISC license.
|
|
252
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
253
|
-
*/const or=H("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
|
|
254
|
-
* @license lucide-react v0.468.0 - ISC
|
|
255
|
-
*
|
|
256
|
-
* This source code is licensed under the ISC license.
|
|
257
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
258
|
-
*/const Aa=H("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
|
|
259
|
-
* @license lucide-react v0.468.0 - ISC
|
|
260
|
-
*
|
|
261
|
-
* This source code is licensed under the ISC license.
|
|
262
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
263
|
-
*/const Hm=H("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
|
|
264
|
-
* @license lucide-react v0.468.0 - ISC
|
|
265
|
-
*
|
|
266
|
-
* This source code is licensed under the ISC license.
|
|
267
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
268
|
-
*/const jl=H("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
|
|
269
|
-
* @license lucide-react v0.468.0 - ISC
|
|
270
|
-
*
|
|
271
|
-
* This source code is licensed under the ISC license.
|
|
272
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
273
|
-
*/const hs=H("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
|
|
274
|
-
* @license lucide-react v0.468.0 - ISC
|
|
275
|
-
*
|
|
276
|
-
* This source code is licensed under the ISC license.
|
|
277
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
278
|
-
*/const wl=H("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
|
|
279
|
-
* @license lucide-react v0.468.0 - ISC
|
|
280
|
-
*
|
|
281
|
-
* This source code is licensed under the ISC license.
|
|
282
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
283
|
-
*/const hr=H("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
|
|
284
|
-
* @license lucide-react v0.468.0 - ISC
|
|
285
|
-
*
|
|
286
|
-
* This source code is licensed under the ISC license.
|
|
287
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
288
|
-
*/const Um=H("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
|
|
289
|
-
* @license lucide-react v0.468.0 - ISC
|
|
290
|
-
*
|
|
291
|
-
* This source code is licensed under the ISC license.
|
|
292
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
293
|
-
*/const Km=H("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
|
|
294
|
-
* @license lucide-react v0.468.0 - ISC
|
|
295
|
-
*
|
|
296
|
-
* This source code is licensed under the ISC license.
|
|
297
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
298
|
-
*/const Nl=H("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
|
|
299
|
-
* @license lucide-react v0.468.0 - ISC
|
|
300
|
-
*
|
|
301
|
-
* This source code is licensed under the ISC license.
|
|
302
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
303
|
-
*/const $n=H("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
|
|
304
|
-
* @license lucide-react v0.468.0 - ISC
|
|
305
|
-
*
|
|
306
|
-
* This source code is licensed under the ISC license.
|
|
307
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
308
|
-
*/const Vm=H("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
|
|
309
|
-
* @license lucide-react v0.468.0 - ISC
|
|
310
|
-
*
|
|
311
|
-
* This source code is licensed under the ISC license.
|
|
312
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
313
|
-
*/const Gm=H("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
|
|
314
|
-
* @license lucide-react v0.468.0 - ISC
|
|
315
|
-
*
|
|
316
|
-
* This source code is licensed under the ISC license.
|
|
317
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
318
|
-
*/const Qm=H("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
|
|
319
|
-
* @license lucide-react v0.468.0 - ISC
|
|
320
|
-
*
|
|
321
|
-
* This source code is licensed under the ISC license.
|
|
322
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
323
|
-
*/const $a=H("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
|
|
324
|
-
* @license lucide-react v0.468.0 - ISC
|
|
325
|
-
*
|
|
326
|
-
* This source code is licensed under the ISC license.
|
|
327
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
328
|
-
*/const Nn=H("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
|
|
329
|
-
* @license lucide-react v0.468.0 - ISC
|
|
330
|
-
*
|
|
331
|
-
* This source code is licensed under the ISC license.
|
|
332
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
333
|
-
*/const xr=H("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
|
334
|
-
* @license lucide-react v0.468.0 - ISC
|
|
335
|
-
*
|
|
336
|
-
* This source code is licensed under the ISC license.
|
|
337
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
338
|
-
*/const Ae=H("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
|
|
339
|
-
* @license lucide-react v0.468.0 - ISC
|
|
340
|
-
*
|
|
341
|
-
* This source code is licensed under the ISC license.
|
|
342
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
343
|
-
*/const Xm=H("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
|
|
344
|
-
* @license lucide-react v0.468.0 - ISC
|
|
345
|
-
*
|
|
346
|
-
* This source code is licensed under the ISC license.
|
|
347
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
348
|
-
*/const Jm=H("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/**
|
|
349
|
-
* @license lucide-react v0.468.0 - ISC
|
|
350
|
-
*
|
|
351
|
-
* This source code is licensed under the ISC license.
|
|
352
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
353
|
-
*/const pr=H("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
|
|
354
|
-
* @license lucide-react v0.468.0 - ISC
|
|
355
|
-
*
|
|
356
|
-
* This source code is licensed under the ISC license.
|
|
357
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
358
|
-
*/const Zm=H("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
|
|
359
|
-
* @license lucide-react v0.468.0 - ISC
|
|
360
|
-
*
|
|
361
|
-
* This source code is licensed under the ISC license.
|
|
362
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
363
|
-
*/const Ra=H("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
|
|
364
|
-
* @license lucide-react v0.468.0 - ISC
|
|
365
|
-
*
|
|
366
|
-
* This source code is licensed under the ISC license.
|
|
367
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
368
|
-
*/const ef=H("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
|
|
369
|
-
* @license lucide-react v0.468.0 - ISC
|
|
370
|
-
*
|
|
371
|
-
* This source code is licensed under the ISC license.
|
|
372
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
373
|
-
*/const ua=H("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
|
|
374
|
-
* @license lucide-react v0.468.0 - ISC
|
|
375
|
-
*
|
|
376
|
-
* This source code is licensed under the ISC license.
|
|
377
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
378
|
-
*/const kl=H("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
|
|
379
|
-
* @license lucide-react v0.468.0 - ISC
|
|
380
|
-
*
|
|
381
|
-
* This source code is licensed under the ISC license.
|
|
382
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
383
|
-
*/const Sl=H("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
|
|
384
|
-
* @license lucide-react v0.468.0 - ISC
|
|
385
|
-
*
|
|
386
|
-
* This source code is licensed under the ISC license.
|
|
387
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
388
|
-
*/const tf=H("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
|
|
389
|
-
* @license lucide-react v0.468.0 - ISC
|
|
390
|
-
*
|
|
391
|
-
* This source code is licensed under the ISC license.
|
|
392
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
393
|
-
*/const Cl=H("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
|
|
394
|
-
* @license lucide-react v0.468.0 - ISC
|
|
395
|
-
*
|
|
396
|
-
* This source code is licensed under the ISC license.
|
|
397
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
398
|
-
*/const sf=H("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
|
|
399
|
-
* @license lucide-react v0.468.0 - ISC
|
|
400
|
-
*
|
|
401
|
-
* This source code is licensed under the ISC license.
|
|
402
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
403
|
-
*/const nf=H("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
|
|
404
|
-
* @license lucide-react v0.468.0 - ISC
|
|
405
|
-
*
|
|
406
|
-
* This source code is licensed under the ISC license.
|
|
407
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
408
|
-
*/const rf=H("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
|
|
409
|
-
* @license lucide-react v0.468.0 - ISC
|
|
410
|
-
*
|
|
411
|
-
* This source code is licensed under the ISC license.
|
|
412
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
413
|
-
*/const af=H("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
|
|
414
|
-
* @license lucide-react v0.468.0 - ISC
|
|
415
|
-
*
|
|
416
|
-
* This source code is licensed under the ISC license.
|
|
417
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
418
|
-
*/const Pt=H("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
|
|
419
|
-
* @license lucide-react v0.468.0 - ISC
|
|
420
|
-
*
|
|
421
|
-
* This source code is licensed under the ISC license.
|
|
422
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
423
|
-
*/const of=H("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
|
|
424
|
-
* @license lucide-react v0.468.0 - ISC
|
|
425
|
-
*
|
|
426
|
-
* This source code is licensed under the ISC license.
|
|
427
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
428
|
-
*/const lf=H("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
|
|
429
|
-
* @license lucide-react v0.468.0 - ISC
|
|
430
|
-
*
|
|
431
|
-
* This source code is licensed under the ISC license.
|
|
432
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
433
|
-
*/const df=H("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
|
|
434
|
-
* @license lucide-react v0.468.0 - ISC
|
|
435
|
-
*
|
|
436
|
-
* This source code is licensed under the ISC license.
|
|
437
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
438
|
-
*/const cf=H("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
|
|
439
|
-
* @license lucide-react v0.468.0 - ISC
|
|
440
|
-
*
|
|
441
|
-
* This source code is licensed under the ISC license.
|
|
442
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
443
|
-
*/const Rn=H("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
|
|
444
|
-
* @license lucide-react v0.468.0 - ISC
|
|
445
|
-
*
|
|
446
|
-
* This source code is licensed under the ISC license.
|
|
447
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
448
|
-
*/const uf=H("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
|
|
449
|
-
* @license lucide-react v0.468.0 - ISC
|
|
450
|
-
*
|
|
451
|
-
* This source code is licensed under the ISC license.
|
|
452
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
453
|
-
*/const gs=H("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
|
|
454
|
-
* @license lucide-react v0.468.0 - ISC
|
|
455
|
-
*
|
|
456
|
-
* This source code is licensed under the ISC license.
|
|
457
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
458
|
-
*/const mf=H("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
|
|
459
|
-
* @license lucide-react v0.468.0 - ISC
|
|
460
|
-
*
|
|
461
|
-
* This source code is licensed under the ISC license.
|
|
462
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
463
|
-
*/const ze=H("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
|
|
464
|
-
* @license lucide-react v0.468.0 - ISC
|
|
465
|
-
*
|
|
466
|
-
* This source code is licensed under the ISC license.
|
|
467
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
468
|
-
*/const Zs=H("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function ff({issue:t}){const s=ur(t.id,t.project_id),[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(!1),d=t.metadata??{},c=Object.entries(d),u=()=>{if(!n.trim())return;const f={...d,[n.trim()]:a};s.mutate({metadata:f},{onSuccess:()=>{R.success("Metadata saved"),r(""),o(""),l(!1)},onError:()=>R.error("Failed to save metadata")})},m=f=>{const h={...d};delete h[f],s.mutate({metadata:Object.keys(h).length?h:null},{onSuccess:()=>R.success("Entry removed"),onError:()=>R.error("Failed to update metadata")})};return e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Rm,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!i&&e.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),"Add field"]})]}),e.jsxs("div",{className:"px-5 py-3 space-y-2",children:[c.length===0&&!i&&e.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),c.map(([f,h])=>e.jsxs("div",{className:"flex items-center gap-2 group",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:f}),e.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(h)}),e.jsx("button",{onClick:()=>m(f),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:e.jsx(Pt,{className:"h-3 w-3"})})]},f)),i&&e.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[e.jsx(xe,{autoFocus:!0,placeholder:"key",value:n,onChange:f=>r(f.target.value),onKeyDown:f=>{f.key==="Enter"&&u(),f.key==="Escape"&&l(!1)},className:"h-7 text-xs font-mono w-28 shrink-0"}),e.jsx(xe,{placeholder:"value",value:a,onChange:f=>o(f.target.value),onKeyDown:f=>{f.key==="Enter"&&u(),f.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),e.jsx(G,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!n.trim()||s.isPending,children:"Save"}),e.jsx(G,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),r(""),o("")},children:"Cancel"})]})]})]})}const hf=[{zone:"issue.details.after",component:ff}];function gr(t=!0){return Ne({queryKey:["workspaces"],queryFn:()=>J.get("/admin/workspaces"),select:s=>s.workspaces,enabled:t})}function xf(){const t=ce();return le({mutationFn:s=>J.post("/admin/workspaces",s),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function pf(t){const s=ce();return le({mutationFn:n=>J.put(`/admin/workspaces/${t}`,n),onSuccess:()=>{s.invalidateQueries({queryKey:["workspaces"]})}})}const Ia={list:t=>["workspaces",t,"invitations"]};function gf(t){return Ne({queryKey:Ia.list(t),queryFn:()=>J.get(`/admin/workspaces/${t}/invitations`),select:s=>s.invitations,enabled:!!t})}function bf(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/workspaces/${t}/invitations`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ia.list(t)})}})}function yf(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/workspaces/${t}/invitations/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ia.list(t)})}})}const br={list:t=>["workspaces",t,"members"]};function In(t){return Ne({queryKey:br.list(t),queryFn:()=>J.get(`/admin/workspaces/${t}/members`),select:s=>s.members,enabled:!!t})}function vf(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/workspaces/${t}/members`,n),onSuccess:()=>{s.invalidateQueries({queryKey:br.list(t)})}})}function jf(t){const s=ce();return le({mutationFn:({userId:n,role:r})=>J.patch(`/admin/workspaces/${t}/members/${n}`,{role:r}),onSuccess:()=>{s.invalidateQueries({queryKey:br.list(t)})}})}function wf(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/workspaces/${t}/members/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:br.list(t)})}})}const Kt={list:t=>["workspaces",t,"teams"],members:(t,s)=>["workspaces",t,"teams",s,"members"]};function za(t){return Ne({queryKey:Kt.list(t),queryFn:()=>J.get(`/admin/workspaces/${t}/teams`),select:s=>s.teams,enabled:!!t})}function Nf(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/workspaces/${t}/teams`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Kt.list(t)})}})}function kf(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/workspaces/${t}/teams/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Kt.list(t)})}})}function Sf(t,s){return Ne({queryKey:Kt.members(t,s),queryFn:()=>J.get(`/admin/workspaces/${t}/teams/${s}/members`),select:n=>n.members,enabled:!!(t&&s)})}function Cf(t,s){const n=ce();return le({mutationFn:r=>J.post(`/admin/workspaces/${t}/teams/${s}/members`,{user_id:r}),onSuccess:()=>{n.invalidateQueries({queryKey:Kt.members(t,s)}),n.invalidateQueries({queryKey:Kt.list(t)})}})}function Mf(t,s){const n=ce();return le({mutationFn:r=>J.delete(`/admin/workspaces/${t}/teams/${s}/members/${r}`),onSuccess:()=>{n.invalidateQueries({queryKey:Kt.members(t,s)}),n.invalidateQueries({queryKey:Kt.list(t)})}})}function Ml(){return Ne({queryKey:["setup-status"],queryFn:()=>J.get("/auth/setup"),staleTime:6e4,retry:!1})}function Df(){const{login:t}=ke();return le({mutationFn:s=>J.post("/auth/login",s),onSuccess:s=>{t(s.user,s.token)}})}function _f(){const{login:t}=ke();return le({mutationFn:s=>J.post("/auth/register",s),onSuccess:s=>{t(s.user,s.token)}})}function Ef(t){const{login:s}=ke();return le({mutationFn:n=>J.post(`/auth/invite/${t}`,n),onSuccess:n=>{s(n.user,n.token)}})}var ii;const Of=((ii=window.__MERIDIAN_CONFIG__)==null?void 0:ii.apiUrl)??void 0??"";function Tf(t,s){const n=`${Of}/admin/events?token=${encodeURIComponent(t)}&workspaceId=${encodeURIComponent(s)}`;return new EventSource(n)}function Pf(){const{token:t,workspace:s}=ke(),n=ce(),r=x.useRef(null);x.useEffect(()=>{if(!t||!s)return;const a=Tf(t,s.id);r.current=a;const o=i=>{i.forEach(l=>n.invalidateQueries({queryKey:l}))};return a.addEventListener("issue.created",()=>{o([["issues"],["notifications"]])}),a.addEventListener("issue.status_changed",()=>{o([["issues"]])}),a.addEventListener("issue.assigned",()=>{o([["issues"],["notifications"]])}),a.addEventListener("comment.created",()=>{o([["issues"],["notifications"]])}),a.onerror=()=>{},()=>{a.close(),r.current=null}},[t,s==null?void 0:s.id,n])}const qr=768;function Af(){const[t,s]=x.useState(void 0);return x.useEffect(()=>{const n=window.matchMedia(`(max-width: ${qr-1}px)`),r=()=>{s(window.innerWidth<qr)};return n.addEventListener("change",r),s(window.innerWidth<qr),()=>n.removeEventListener("change",r)},[]),!!t}const Fa=x.forwardRef(({className:t,orientation:s="horizontal",decorative:n=!0,...r},a)=>e.jsx(ui,{ref:a,decorative:n,orientation:s,className:T("shrink-0 bg-border",s==="horizontal"?"h-px w-full":"h-full w-px",t),...r}));Fa.displayName=ui.displayName;const $f=En,Rf=_n,Dl=x.forwardRef(({className:t,...s},n)=>e.jsx(js,{className:T("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:n}));Dl.displayName=js.displayName;const If=Tn("fixed z-50 gap-4 bg-background border-border transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-xl"}},defaultVariants:{side:"right"}}),_l=x.forwardRef(({side:t="right",className:s,children:n,...r},a)=>e.jsxs(Rf,{children:[e.jsx(Dl,{}),e.jsxs(ws,{ref:a,className:T(If({side:t}),s),...r,children:[n,e.jsxs(cr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",children:[e.jsx(ze,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));_l.displayName=ws.displayName;const El=({className:t,...s})=>e.jsx("div",{className:T("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",t),...s});El.displayName="SheetHeader";const Ol=x.forwardRef(({className:t,...s},n)=>e.jsx(Ks,{ref:n,className:T("text-base font-semibold text-foreground",t),...s}));Ol.displayName=Ks.displayName;const Tl=x.forwardRef(({className:t,...s},n)=>e.jsx(Vs,{ref:n,className:T("text-sm text-muted-foreground",t),...s}));Tl.displayName=Vs.displayName;function se({className:t,...s}){return e.jsx("div",{className:T("animate-pulse rounded-md bg-muted",t),...s})}const zf="sidebar_state",Ff=60*60*24*7,Wf="16rem",qf="18rem",Bf="3rem",Lf="b",Pl=x.createContext(null);function Wa(){const t=x.useContext(Pl);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function Yf({defaultOpen:t=!0,open:s,onOpenChange:n,className:r,style:a,children:o,...i}){const l=Af(),[d,c]=x.useState(!1),[u,m]=x.useState(t),f=s??u,h=x.useCallback(b=>{const w=typeof b=="function"?b(f):b;n?n(w):m(w),document.cookie=`${zf}=${w}; path=/; max-age=${Ff}`},[n,f]),g=x.useCallback(()=>l?c(b=>!b):h(b=>!b),[l,h,c]);x.useEffect(()=>{const b=w=>{w.key===Lf&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),g())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[g]);const y=f?"expanded":"collapsed",S=x.useMemo(()=>({state:y,open:f,setOpen:h,isMobile:l,openMobile:d,setOpenMobile:c,toggleSidebar:g}),[y,f,h,l,d,c,g]);return e.jsx(Pl.Provider,{value:S,children:e.jsx(Sa,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Wf,"--sidebar-width-icon":Bf,...a},className:T("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",r),...i,children:o})})})}function Hf({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",className:r,children:a,...o}){const{isMobile:i,state:l,openMobile:d,setOpenMobile:c}=Wa();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:T("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",r),...o,children:a}):i?e.jsx($f,{open:d,onOpenChange:c,...o,children:e.jsxs(_l,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden",style:{"--sidebar-width":qf},side:t,children:[e.jsxs(El,{className:"sr-only",children:[e.jsx(Ol,{children:"Sidebar"}),e.jsx(Tl,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:T("relative w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),e.jsx("div",{"data-slot":"sidebar-container",className:T("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem+2px)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)] group-data-[side=left]:border-r group-data-[side=right]:border-l",r),...o,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:a})})]})}function Uf({className:t,onClick:s,...n}){const{toggleSidebar:r}=Wa();return e.jsxs(G,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:T("size-7",t),onClick:a=>{s==null||s(a),r()},...n,children:[e.jsx(Gm,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Kf({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:T("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function Vf({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:T("flex flex-col gap-2 p-2",t),...s})}function Gf({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:T("flex flex-col gap-2 p-2",t),...s})}function Qf({className:t,...s}){return e.jsx(Fa,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:T("bg-sidebar-border mx-2 w-auto",t),...s})}function Xf({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:T("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function Br({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:T("relative flex w-full min-w-0 flex-col p-2",t),...s})}function Jf({className:t,asChild:s=!1,...n}){const r=s?ya:"div";return e.jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:T("text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-none transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0","group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",t),...n})}function Lr({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:T("w-full text-sm",t),...s})}function jn({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:T("flex w-full min-w-0 flex-col gap-1",t),...s})}function Ht({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:T("group/menu-item relative",t),...s})}const Zf=Tn("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-none ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-[[data-sidebar=menu-action]]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}}),_t=x.forwardRef(function({asChild:s=!1,isActive:n=!1,variant:r="default",size:a="default",tooltip:o,className:i,...l},d){const c=s?ya:"button",{isMobile:u,state:m}=Wa(),f=e.jsx(c,{ref:d,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":a,"data-active":n,className:T(Zf({variant:r,size:a}),i),...l});return o?(typeof o=="string"&&(o={children:o}),e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:f}),e.jsx(Ut,{side:"right",align:"center",hidden:m!=="collapsed"||u,...o})]})):f});_t.displayName="SidebarMenuButton";const eh=250,th=300,xs={all:["projects"],list:()=>[...xs.all,"list"],detail:t=>[...xs.all,t],byKey:t=>[...xs.all,"key",t]};function zn(){const{workspace:t}=ke();return Ne({queryKey:[...xs.list(),t==null?void 0:t.id],queryFn:()=>{const s=t!=null&&t.id?`?workspace_id=${t.id}`:"";return J.get(`/admin/projects${s}`)},select:s=>s.projects,enabled:!!(t!=null&&t.id)})}function ks(t){return Ne({queryKey:xs.byKey(t),queryFn:()=>J.get(`/admin/projects/by-identifier/${encodeURIComponent(t)}`),select:s=>s.project,enabled:!!t})}function sh(t,s={}){const[n,r]=x.useState(t),a=s.enabled!==!1;return x.useEffect(()=>{if(!a)return;const l=setTimeout(()=>r(t),eh);return()=>clearTimeout(l)},[t,a]),{...Ne({queryKey:["projects","suggest-identifier",n],queryFn:()=>J.get(`/admin/projects/suggest-identifier?name=${encodeURIComponent(n)}`),select:l=>l.identifier,enabled:a&&n.trim().length>0}),flush:()=>r(t)}}function nh(t,s={}){const n=t.toUpperCase().replace(/[^A-Z0-9]/g,""),[r,a]=x.useState(n),o=s.enabled!==!1&&n.length>=3;x.useEffect(()=>{if(!n){a("");return}const l=setTimeout(()=>a(n),th);return()=>clearTimeout(l)},[n]);const i=Ne({queryKey:["projects","check-identifier",r],queryFn:()=>J.get(`/admin/projects/check-identifier/${encodeURIComponent(r)}`),select:l=>l.available,enabled:o&&r.length>=3});return{available:i.data,isLoading:i.isLoading,isFetching:i.isFetching}}function rh(){const t=ce();return le({mutationFn:s=>J.post("/admin/projects",s),onSuccess:()=>{t.invalidateQueries({queryKey:xs.list()})}})}function ah(){const t=ce();return le({mutationFn:s=>J.delete(`/admin/projects/${s}`),onSuccess:()=>{t.invalidateQueries({queryKey:xs.list()})}})}const Ss=Dc,Cs=_c,oh=x.forwardRef(({className:t,inset:s,children:n,...r},a)=>e.jsxs(mi,{ref:a,className:T("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",s&&"pl-8",t),...r,children:[n,e.jsx(Xs,{className:"ml-auto"})]}));oh.displayName=mi.displayName;const ih=x.forwardRef(({className:t,...s},n)=>e.jsx(fi,{ref:n,className:T("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...s}));ih.displayName=fi.displayName;const Jt=x.forwardRef(({className:t,sideOffset:s=4,...n},r)=>e.jsx(Mc,{children:e.jsx(hi,{ref:r,sideOffset:s,className:T("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Jt.displayName=hi.displayName;const Ue=x.forwardRef(({className:t,inset:s,...n},r)=>e.jsx(xi,{ref:r,className:T("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",s&&"pl-8",t),...n}));Ue.displayName=xi.displayName;const lh=x.forwardRef(({className:t,children:s,checked:n,...r},a)=>e.jsxs(pi,{ref:a,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),checked:n,...r,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gi,{children:e.jsx(it,{className:"h-4 w-4"})})}),s]}));lh.displayName=pi.displayName;const dh=x.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(bi,{ref:r,className:T("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(gi,{children:e.jsx(Nt,{className:"h-2 w-2 fill-current"})})}),s]}));dh.displayName=bi.displayName;const qa=x.forwardRef(({className:t,inset:s,...n},r)=>e.jsx(yi,{ref:r,className:T("px-2 py-1.5 text-xs font-medium text-muted-foreground",s&&"pl-8",t),...n}));qa.displayName=yi.displayName;const Fn=x.forwardRef(({className:t,...s},n)=>e.jsx(vi,{ref:n,className:T("-mx-1 my-1 h-px bg-border",t),...s}));Fn.displayName=vi.displayName;const st=x.forwardRef(({className:t,...s},n)=>e.jsx(ji,{ref:n,className:T("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",t),...s}));st.displayName=ji.displayName;const ch=x.forwardRef(({className:t,...s},n)=>e.jsx(wi,{ref:n,className:T("aspect-square h-full w-full",t),...s}));ch.displayName=wi.displayName;const nt=x.forwardRef(({className:t,...s},n)=>e.jsx(Ni,{ref:n,className:T("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",t),...s}));nt.displayName=Ni.displayName;function uh(){var a;const{workspace:t,setWorkspace:s}=ke(),{data:n}=gr(),r=He();return e.jsx(jn,{children:e.jsx(Ht,{children:e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:e.jsxs(_t,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:e.jsx("span",{className:"text-[13px] font-bold",children:(((a=t==null?void 0:t.name)==null?void 0:a[0])??"M").toUpperCase()})}),e.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e.jsx("span",{className:"truncate font-semibold",children:(t==null?void 0:t.name)??"Meridian"}),e.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(t==null?void 0:t.slug)??""})]}),e.jsx(fl,{className:"ml-auto size-4 shrink-0"})]})}),e.jsxs(Jt,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[e.jsx(qa,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),n==null?void 0:n.map(o=>e.jsxs(Ue,{className:"cursor-pointer gap-2 p-2",onClick:()=>{s({id:o.id,name:o.name,slug:o.slug}),r(`/${o.slug}/projects`)},children:[e.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:e.jsx("span",{className:"text-[10px] font-bold",children:o.name[0].toUpperCase()})}),e.jsx("span",{className:"flex-1 truncate",children:o.name}),o.id===(t==null?void 0:t.id)&&e.jsx(it,{className:"size-3.5 text-muted-foreground shrink-0"})]},o.id)),e.jsx(Fn,{}),e.jsxs(Ue,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>r("/setup"),children:[e.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:e.jsx("span",{className:"text-xs font-semibold",children:"+"})}),e.jsx("span",{children:"Create workspace"})]})]})]})})})}function mh(){var a,o;const{user:t,logout:s}=ke(),n=t?`${((a=t.first_name)==null?void 0:a[0])??""}${((o=t.last_name)==null?void 0:o[0])??""}`.toUpperCase()||t.email[0].toUpperCase():"?",r=t?[t.first_name,t.last_name].filter(Boolean).join(" ")||t.email:"User";return e.jsx(jn,{children:e.jsx(Ht,{children:e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:e.jsxs(_t,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e.jsx(st,{className:"h-8 w-8 rounded-lg shrink-0",children:e.jsx(nt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})}),e.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e.jsx("span",{className:"truncate font-semibold",children:r}),e.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(t==null?void 0:t.email)??""})]}),e.jsx(fl,{className:"ml-auto size-4 shrink-0"})]})}),e.jsxs(Jt,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[e.jsx(qa,{className:"p-0 font-normal",children:e.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[e.jsx(st,{className:"h-8 w-8 rounded-lg",children:e.jsx(nt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})}),e.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[e.jsx("span",{className:"truncate font-semibold",children:r}),e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(t==null?void 0:t.email)??""})]})]})}),e.jsx(Fn,{}),e.jsxs(Ue,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:s,children:[e.jsx(Um,{className:"size-4"}),"Sign out"]})]})]})})})}function fh({...t}){var h;const{workspace:s,projectKey:n}=Ge(),{data:r}=zn(),{toggle:a}=Xi(),{user:o}=ke(),i=dr(),l=s??"",d=i.pathname===`/${l}/projects`,c=i.pathname.includes("/notifications"),u=i.pathname.includes("/settings"),m=i.pathname.includes("/roles"),f=((h=o==null?void 0:o.roles)==null?void 0:h.includes("super-admin"))??!1;return e.jsxs(Hf,{collapsible:"offcanvas",...t,children:[e.jsx(Vf,{children:e.jsx(uh,{})}),e.jsxs(Xf,{children:[e.jsx(Br,{children:e.jsx(Lr,{children:e.jsxs(jn,{children:[e.jsx(Ht,{children:e.jsxs(_t,{onClick:a,tooltip:"Search",children:[e.jsx(pr,{}),e.jsx("span",{children:"Search"}),e.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),e.jsx(Ht,{children:e.jsx(_t,{asChild:!0,isActive:d,tooltip:"Projects",children:e.jsxs(As,{to:`/${l}/projects`,end:!0,children:[e.jsx(xt,{}),e.jsx("span",{children:"Projects"})]})})}),e.jsx(Ht,{children:e.jsx(_t,{asChild:!0,isActive:c,tooltip:"Notifications",children:e.jsxs(As,{to:`/${l}/notifications`,children:[e.jsx(Ls,{}),e.jsx("span",{children:"Notifications"})]})})})]})})}),r&&r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Qf,{}),e.jsxs(Br,{children:[e.jsx(Jf,{children:"Recent"}),e.jsx(Lr,{children:e.jsx(jn,{children:r.slice(0,5).map(g=>e.jsx(Ht,{children:e.jsx(_t,{asChild:!0,isActive:g.identifier===n,tooltip:g.name,className:"data-[active=true]:bg-indigo-50 dark:data-[active=true]:bg-indigo-950/50 data-[active=true]:text-indigo-700 dark:data-[active=true]:text-indigo-300",children:e.jsxs(As,{to:`/${l}/projects/${g.identifier}/board`,children:[e.jsx("span",{className:"font-mono text-[10px] text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:g.identifier}),e.jsx("span",{className:"truncate",children:g.name})]})})},g.id))})})]})]}),e.jsx(Br,{className:"mt-auto",children:e.jsx(Lr,{children:e.jsxs(jn,{children:[f&&e.jsx(Ht,{children:e.jsx(_t,{asChild:!0,isActive:m,tooltip:"Roles & Permissions",children:e.jsxs(As,{to:`/${l}/roles`,children:[e.jsx(ua,{}),e.jsx("span",{children:"Roles"})]})})}),e.jsx(Ht,{children:e.jsx(_t,{asChild:!0,isActive:u,tooltip:"Settings",children:e.jsxs(As,{to:`/${l}/settings`,children:[e.jsx(Ra,{}),e.jsx("span",{children:"Settings"})]})})})]})})})]}),e.jsx(Gf,{children:e.jsx(mh,{})})]})}function hh(){const{theme:t,setTheme:s}=$u();return e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:e.jsxs(G,{variant:"ghost",size:"icon-sm",onClick:()=>s(t==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[e.jsx(sf,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),e.jsx(Vm,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),e.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),e.jsx(Ut,{children:"Toggle theme"})]})}const Wn={all:["notifications"],list:()=>[...Wn.all,"list"]};function xh(){return Ne({queryKey:Wn.list(),queryFn:()=>J.get("/admin/notifications"),select:t=>t.notifications})}function ph(){return Ne({queryKey:[...Wn.list(),"unread"],queryFn:()=>J.get("/admin/notifications?unread=true"),select:t=>t.count})}function gh(){const t=ce();return le({mutationFn:s=>J.post(`/admin/notifications/${s}/read`),onSuccess:()=>{t.invalidateQueries({queryKey:Wn.all})}})}function bh(){const t=ce();return le({mutationFn:()=>J.post("/admin/notifications/read-all"),onSuccess:()=>{t.invalidateQueries({queryKey:Wn.all})}})}function yh(){const t=dr(),{projectKey:s}=Ge(),{data:n}=zn(),r=n==null?void 0:n.find(o=>o.identifier===s),a=t.pathname;return a.includes("/board")?{icon:xt,label:r?`${r.name} / Board`:"Board"}:a.includes("/issues")?{icon:Js,label:r?`${r.name} / Issues`:"Issues"}:a.endsWith("/projects")?{icon:or,label:"Projects"}:a.includes("/notifications")?{icon:Ls,label:"Notifications"}:a.includes("/settings")?{icon:Ra,label:"Settings"}:{icon:or,label:"Meridian"}}function vh(){const{data:t=0}=ph(),{icon:s,label:n}=yh(),{workspace:r}=ke(),a=(r==null?void 0:r.slug)??"";return e.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:e.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[e.jsx(Uf,{className:"-ml-1"}),e.jsx(Fa,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(s,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),e.jsx("span",{className:"font-medium",children:n})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[e.jsx(hh,{}),e.jsx(G,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:e.jsxs(wn,{to:`/${a}/notifications`,children:[e.jsx(Ls,{className:"h-4 w-4",strokeWidth:1.5}),t>0&&e.jsx("span",{className:"absolute -top-0.5 -right-0.5 h-3.5 w-3.5 rounded-full bg-indigo text-[9px] font-bold text-white flex items-center justify-center leading-none",children:t>9?"9+":t})]})})]})]})})}function jh(){return e.jsxs(Yf,{children:[e.jsx(fh,{variant:"inset"}),e.jsxs(Kf,{className:"flex flex-col min-w-0",children:[e.jsx(vh,{}),e.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:e.jsx(li,{})})]})]})}const Co=["board","issues","sprints","timeline","access"];function wh(){const{projectKey:t,workspace:s}=Ge(),{data:n,error:r}=ks(t??""),a=He(),o=dr(),[i]=di();x.useEffect(()=>{r&&r instanceof Ca&&(r.status===403||r.status===404)&&a(`/${s}/projects`,{replace:!0})},[r,s,a]),x.useEffect(()=>{const c=i.get("tab");if(!c||!Co.includes(c))return;Co.every(m=>!o.pathname.endsWith(`/${m}`))&&a(`/${s}/projects/${t}/${c}`,{replace:!0})},[]);const l=`/${s}/projects/${t}`,d=[{to:`${l}/board`,label:"Board",icon:or,end:!0},{to:`${l}/issues`,label:"Issues",icon:Js,end:!1},{to:`${l}/sprints`,label:"Sprints",icon:Zs,end:!0},{to:`${l}/timeline`,label:"Timeline",icon:Da,end:!0},{to:`${l}/access`,label:"Access",icon:hr,end:!0}];return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"px-6 pt-5 border-b border-border bg-white dark:bg-card shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[n&&e.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:n.identifier}),e.jsx("h1",{className:"text-sm font-semibold",children:(n==null?void 0:n.name)??""})]}),e.jsx("div",{className:"flex -mb-px",children:d.map(({to:c,label:u,icon:m,end:f})=>e.jsxs(As,{to:c,end:f,className:({isActive:h})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${h?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[e.jsx(m,{className:"h-3.5 w-3.5",strokeWidth:1.5}),u]},c))})]}),e.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:e.jsx(li,{})})]})}var Mo=1,Nh=.9,kh=.8,Sh=.17,Yr=.1,Hr=.999,Ch=.9999,Mh=.99,Dh=/[\\\/_+.#"@\[\(\{&]/,_h=/[\\\/_+.#"@\[\(\{&]/g,Eh=/[\s-]/,Al=/[\s-]/g;function ma(t,s,n,r,a,o,i){if(o===s.length)return a===t.length?Mo:Mh;var l=`${a},${o}`;if(i[l]!==void 0)return i[l];for(var d=r.charAt(o),c=n.indexOf(d,a),u=0,m,f,h,g;c>=0;)m=ma(t,s,n,r,c+1,o+1,i),m>u&&(c===a?m*=Mo:Dh.test(t.charAt(c-1))?(m*=kh,h=t.slice(a,c-1).match(_h),h&&a>0&&(m*=Math.pow(Hr,h.length))):Eh.test(t.charAt(c-1))?(m*=Nh,g=t.slice(a,c-1).match(Al),g&&a>0&&(m*=Math.pow(Hr,g.length))):(m*=Sh,a>0&&(m*=Math.pow(Hr,c-a))),t.charAt(c)!==s.charAt(o)&&(m*=Ch)),(m<Yr&&n.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(c-1)!==r.charAt(o))&&(f=ma(t,s,n,r,c+1,o+2,i),f*Yr>m&&(m=f*Yr)),m>u&&(u=m),c=n.indexOf(d,c+1);return i[l]=u,u}function Do(t){return t.toLowerCase().replace(Al," ")}function Oh(t,s,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,ma(t,s,Do(t),Do(s),0,0,{})}var xn='[cmdk-group=""]',Ur='[cmdk-group-items=""]',Th='[cmdk-group-heading=""]',Ba='[cmdk-item=""]',_o=`${Ba}:not([aria-disabled="true"])`,fa="cmdk-item-select",ds="data-value",Ph=(t,s,n)=>Oh(t,s,n),$l=x.createContext(void 0),qn=()=>x.useContext($l),Rl=x.createContext(void 0),La=()=>x.useContext(Rl),Il=x.createContext(void 0),zl=x.forwardRef((t,s)=>{let n=$s(()=>{var k,I;return{search:"",value:(I=(k=t.value)!=null?k:t.defaultValue)!=null?I:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=$s(()=>new Set),a=$s(()=>new Map),o=$s(()=>new Map),i=$s(()=>new Set),l=Fl(t),{label:d,children:c,value:u,onValueChange:m,filter:f,shouldFilter:h,loop:g,disablePointerSelection:y=!1,vimBindings:S=!0,...b}=t,w=Is(),j=Is(),v=Is(),C=x.useRef(null),p=Yh();bs(()=>{if(u!==void 0){let k=u.trim();n.current.value=k,D.emit()}},[u]),bs(()=>{p(6,$)},[]);let D=x.useMemo(()=>({subscribe:k=>(i.current.add(k),()=>i.current.delete(k)),snapshot:()=>n.current,setState:(k,I,K)=>{var q,M,W;if(!Object.is(n.current[k],I)){if(n.current[k]=I,k==="search")O(),_(),p(1,A);else if(k==="value"&&(K||p(5,$),((q=l.current)==null?void 0:q.value)!==void 0)){let de=I??"";(W=(M=l.current).onValueChange)==null||W.call(M,de);return}D.emit()}},emit:()=>{i.current.forEach(k=>k())}}),[]),P=x.useMemo(()=>({value:(k,I,K)=>{var q;I!==((q=o.current.get(k))==null?void 0:q.value)&&(o.current.set(k,{value:I,keywords:K}),n.current.filtered.items.set(k,z(I,K)),p(2,()=>{_(),D.emit()}))},item:(k,I)=>(r.current.add(k),I&&(a.current.has(I)?a.current.get(I).add(k):a.current.set(I,new Set([k]))),p(3,()=>{O(),_(),n.current.value||A(),D.emit()}),()=>{o.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let K=E();p(4,()=>{O(),(K==null?void 0:K.getAttribute("id"))===k&&A(),D.emit()})}),group:k=>(a.current.has(k)||a.current.set(k,new Set),()=>{o.current.delete(k),a.current.delete(k)}),filter:()=>l.current.shouldFilter,label:d||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:w,inputId:v,labelId:j,listInnerRef:C}),[]);function z(k,I){var K,q;let M=(q=(K=l.current)==null?void 0:K.filter)!=null?q:Ph;return k?M(k,n.current.search,I):0}function _(){if(!n.current.search||l.current.shouldFilter===!1)return;let k=n.current.filtered.items,I=[];n.current.filtered.groups.forEach(q=>{let M=a.current.get(q),W=0;M.forEach(de=>{let ye=k.get(de);W=Math.max(ye,W)}),I.push([q,W])});let K=C.current;Q().sort((q,M)=>{var W,de;let ye=q.getAttribute("id"),$e=M.getAttribute("id");return((W=k.get($e))!=null?W:0)-((de=k.get(ye))!=null?de:0)}).forEach(q=>{let M=q.closest(Ur);M?M.appendChild(q.parentElement===M?q:q.closest(`${Ur} > *`)):K.appendChild(q.parentElement===K?q:q.closest(`${Ur} > *`))}),I.sort((q,M)=>M[1]-q[1]).forEach(q=>{var M;let W=(M=C.current)==null?void 0:M.querySelector(`${xn}[${ds}="${encodeURIComponent(q[0])}"]`);W==null||W.parentElement.appendChild(W)})}function A(){let k=Q().find(K=>K.getAttribute("aria-disabled")!=="true"),I=k==null?void 0:k.getAttribute(ds);D.setState("value",I||void 0)}function O(){var k,I,K,q;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let M=0;for(let W of r.current){let de=(I=(k=o.current.get(W))==null?void 0:k.value)!=null?I:"",ye=(q=(K=o.current.get(W))==null?void 0:K.keywords)!=null?q:[],$e=z(de,ye);n.current.filtered.items.set(W,$e),$e>0&&M++}for(let[W,de]of a.current)for(let ye of de)if(n.current.filtered.items.get(ye)>0){n.current.filtered.groups.add(W);break}n.current.filtered.count=M}function $(){var k,I,K;let q=E();q&&(((k=q.parentElement)==null?void 0:k.firstChild)===q&&((K=(I=q.closest(xn))==null?void 0:I.querySelector(Th))==null||K.scrollIntoView({block:"nearest"})),q.scrollIntoView({block:"nearest"}))}function E(){var k;return(k=C.current)==null?void 0:k.querySelector(`${Ba}[aria-selected="true"]`)}function Q(){var k;return Array.from(((k=C.current)==null?void 0:k.querySelectorAll(_o))||[])}function Y(k){let I=Q()[k];I&&D.setState("value",I.getAttribute(ds))}function V(k){var I;let K=E(),q=Q(),M=q.findIndex(de=>de===K),W=q[M+k];(I=l.current)!=null&&I.loop&&(W=M+k<0?q[q.length-1]:M+k===q.length?q[0]:q[M+k]),W&&D.setState("value",W.getAttribute(ds))}function L(k){let I=E(),K=I==null?void 0:I.closest(xn),q;for(;K&&!q;)K=k>0?Bh(K,xn):Lh(K,xn),q=K==null?void 0:K.querySelector(_o);q?D.setState("value",q.getAttribute(ds)):V(k)}let F=()=>Y(Q().length-1),Z=k=>{k.preventDefault(),k.metaKey?F():k.altKey?L(1):V(1)},ee=k=>{k.preventDefault(),k.metaKey?Y(0):k.altKey?L(-1):V(-1)};return x.createElement(Qt.div,{ref:s,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:k=>{var I;if((I=b.onKeyDown)==null||I.call(b,k),!k.defaultPrevented)switch(k.key){case"n":case"j":{S&&k.ctrlKey&&Z(k);break}case"ArrowDown":{Z(k);break}case"p":case"k":{S&&k.ctrlKey&&ee(k);break}case"ArrowUp":{ee(k);break}case"Home":{k.preventDefault(),Y(0);break}case"End":{k.preventDefault(),F();break}case"Enter":if(!k.nativeEvent.isComposing&&k.keyCode!==229){k.preventDefault();let K=E();if(K){let q=new Event(fa);K.dispatchEvent(q)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:P.inputId,id:P.labelId,style:Uh},d),yr(t,k=>x.createElement(Rl.Provider,{value:D},x.createElement($l.Provider,{value:P},k))))}),Ah=x.forwardRef((t,s)=>{var n,r;let a=Is(),o=x.useRef(null),i=x.useContext(Il),l=qn(),d=Fl(t),c=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;bs(()=>{if(!c)return l.item(a,i==null?void 0:i.id)},[c]);let u=Wl(a,o,[t.value,t.children,o],t.keywords),m=La(),f=ys(p=>p.value&&p.value===u.current),h=ys(p=>c||l.filter()===!1?!0:p.search?p.filtered.items.get(a)>0:!0);x.useEffect(()=>{let p=o.current;if(!(!p||t.disabled))return p.addEventListener(fa,g),()=>p.removeEventListener(fa,g)},[h,t.onSelect,t.disabled]);function g(){var p,D;y(),(D=(p=d.current).onSelect)==null||D.call(p,u.current)}function y(){m.setState("value",u.current,!0)}if(!h)return null;let{disabled:S,value:b,onSelect:w,forceMount:j,keywords:v,...C}=t;return x.createElement(Qt.div,{ref:kn([o,s]),...C,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!f,"data-disabled":!!S,"data-selected":!!f,onPointerMove:S||l.getDisablePointerSelection()?void 0:y,onClick:S?void 0:g},t.children)}),$h=x.forwardRef((t,s)=>{let{heading:n,children:r,forceMount:a,...o}=t,i=Is(),l=x.useRef(null),d=x.useRef(null),c=Is(),u=qn(),m=ys(h=>a||u.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);bs(()=>u.group(i),[]),Wl(i,l,[t.value,t.heading,d]);let f=x.useMemo(()=>({id:i,forceMount:a}),[a]);return x.createElement(Qt.div,{ref:kn([l,s]),...o,"cmdk-group":"",role:"presentation",hidden:m?void 0:!0},n&&x.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),yr(t,h=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},x.createElement(Il.Provider,{value:f},h))))}),Rh=x.forwardRef((t,s)=>{let{alwaysRender:n,...r}=t,a=x.useRef(null),o=ys(i=>!i.search);return!n&&!o?null:x.createElement(Qt.div,{ref:kn([a,s]),...r,"cmdk-separator":"",role:"separator"})}),Ih=x.forwardRef((t,s)=>{let{onValueChange:n,...r}=t,a=t.value!=null,o=La(),i=ys(u=>u.search),l=ys(u=>u.value),d=qn(),c=x.useMemo(()=>{var u;let m=(u=d.listInnerRef.current)==null?void 0:u.querySelector(`${Ba}[${ds}="${encodeURIComponent(l)}"]`);return m==null?void 0:m.getAttribute("id")},[]);return x.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),x.createElement(Qt.input,{ref:s,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:a?t.value:i,onChange:u=>{a||o.setState("search",u.target.value),n==null||n(u.target.value)}})}),zh=x.forwardRef((t,s)=>{let{children:n,label:r="Suggestions",...a}=t,o=x.useRef(null),i=x.useRef(null),l=qn();return x.useEffect(()=>{if(i.current&&o.current){let d=i.current,c=o.current,u,m=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let f=d.offsetHeight;c.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return m.observe(d),()=>{cancelAnimationFrame(u),m.unobserve(d)}}},[]),x.createElement(Qt.div,{ref:kn([o,s]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},yr(t,d=>x.createElement("div",{ref:kn([i,l.listInnerRef]),"cmdk-list-sizer":""},d)))}),Fh=x.forwardRef((t,s)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:i,...l}=t;return x.createElement(En,{open:n,onOpenChange:r},x.createElement(_n,{container:i},x.createElement(js,{"cmdk-overlay":"",className:a}),x.createElement(ws,{"aria-label":t.label,"cmdk-dialog":"",className:o},x.createElement(zl,{ref:s,...l}))))}),Wh=x.forwardRef((t,s)=>ys(n=>n.filtered.count===0)?x.createElement(Qt.div,{ref:s,...t,"cmdk-empty":"",role:"presentation"}):null),qh=x.forwardRef((t,s)=>{let{progress:n,children:r,label:a="Loading...",...o}=t;return x.createElement(Qt.div,{ref:s,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},yr(t,i=>x.createElement("div",{"aria-hidden":!0},i)))}),Ze=Object.assign(zl,{List:zh,Item:Ah,Input:Ih,Group:$h,Separator:Rh,Dialog:Fh,Empty:Wh,Loading:qh});function Bh(t,s){let n=t.nextElementSibling;for(;n;){if(n.matches(s))return n;n=n.nextElementSibling}}function Lh(t,s){let n=t.previousElementSibling;for(;n;){if(n.matches(s))return n;n=n.previousElementSibling}}function Fl(t){let s=x.useRef(t);return bs(()=>{s.current=t}),s}var bs=typeof window>"u"?x.useEffect:x.useLayoutEffect;function $s(t){let s=x.useRef();return s.current===void 0&&(s.current=t()),s}function kn(t){return s=>{t.forEach(n=>{typeof n=="function"?n(s):n!=null&&(n.current=s)})}}function ys(t){let s=La(),n=()=>t(s.snapshot());return Ec.useSyncExternalStore(s.subscribe,n,n)}function Wl(t,s,n,r=[]){let a=x.useRef(),o=qn();return bs(()=>{var i;let l=(()=>{var c;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(c=u.current.textContent)==null?void 0:c.trim():a.current}})(),d=r.map(c=>c.trim());o.value(t,l,d),(i=s.current)==null||i.setAttribute(ds,l),a.current=l}),a}var Yh=()=>{let[t,s]=x.useState(),n=$s(()=>new Map);return bs(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,a)=>{n.current.set(r,a),s({})}};function Hh(t){let s=t.type;return typeof s=="function"?s(t.props):"render"in s?s.render(t.props):t}function yr({asChild:t,children:s},n){return t&&x.isValidElement(s)?x.cloneElement(Hh(s),{ref:s.ref},n(s.props.children)):n(s)}var Uh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const vr=En,Kh=_n,ql=x.forwardRef(({className:t,...s},n)=>e.jsx(js,{ref:n,className:T("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));ql.displayName=js.displayName;const Bn=x.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(Kh,{children:[e.jsx(ql,{}),e.jsxs(ws,{ref:r,className:T("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background border border-border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] rounded-lg",t),...n,children:[s,e.jsxs(cr,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[e.jsx(ze,{className:"h-4 w-4"}),e.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Bn.displayName=ws.displayName;const jr=({className:t,...s})=>e.jsx("div",{className:T("flex flex-col space-y-1.5",t),...s});jr.displayName="DialogHeader";const wr=x.forwardRef(({className:t,...s},n)=>e.jsx(Ks,{ref:n,className:T("text-base font-semibold leading-none tracking-tight",t),...s}));wr.displayName=Ks.displayName;const Bl=x.forwardRef(({className:t,...s},n)=>e.jsx(Vs,{ref:n,className:T("text-sm text-muted-foreground",t),...s}));Bl.displayName=Vs.displayName;const Ws=x.forwardRef(({className:t,...s},n)=>e.jsx(Ze,{ref:n,className:T("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...s}));Ws.displayName=Ze.displayName;const Vh=({children:t,open:s,onOpenChange:n})=>e.jsx(vr,{open:s,onOpenChange:n,children:e.jsx(Bn,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:e.jsx(Ws,{className:"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5",children:t})})}),Ya=x.forwardRef(({className:t,...s},n)=>e.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[e.jsx(pr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),e.jsx(Ze.Input,{ref:n,className:T("flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...s})]}));Ya.displayName=Ze.Input.displayName;const qs=x.forwardRef(({className:t,...s},n)=>e.jsx(Ze.List,{ref:n,className:T("max-h-[320px] overflow-y-auto overflow-x-hidden",t),...s}));qs.displayName=Ze.List.displayName;const Ha=x.forwardRef((t,s)=>e.jsx(Ze.Empty,{ref:s,className:"py-6 text-center text-sm text-muted-foreground",...t}));Ha.displayName=Ze.Empty.displayName;const ps=x.forwardRef(({className:t,...s},n)=>e.jsx(Ze.Group,{ref:n,className:T("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...s}));ps.displayName=Ze.Group.displayName;const Ll=x.forwardRef(({className:t,...s},n)=>e.jsx(Ze.Separator,{ref:n,className:T("-mx-1 h-px bg-border",t),...s}));Ll.displayName=Ze.Separator.displayName;const mt=x.forwardRef(({className:t,...s},n)=>e.jsx(Ze.Item,{ref:n,className:T("relative flex cursor-pointer select-none items-center gap-2 rounded-md px-2 py-1.5 text-sm outline-none","data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground","data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50","[&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",t),...s}));mt.displayName=Ze.Item.displayName;function Gh(){const{open:t,setOpen:s}=Xi(),n=He(),{data:r}=zn(),{workspace:a}=ke(),o=(a==null?void 0:a.slug)??"",i=l=>{s(!1),l()};return e.jsxs(Vh,{open:t,onOpenChange:s,children:[e.jsx(Ya,{placeholder:"Search or jump to..."}),e.jsxs(qs,{children:[e.jsx(Ha,{children:"No results found."}),e.jsxs(ps,{heading:"Navigation",children:[e.jsxs(mt,{onSelect:()=>i(()=>n(`/${o}/projects`)),children:[e.jsx(or,{className:"text-muted-foreground"}),e.jsx("span",{children:"Projects"})]}),e.jsxs(mt,{onSelect:()=>i(()=>n(`/${o}/notifications`)),children:[e.jsx(Ls,{className:"text-muted-foreground"}),e.jsx("span",{children:"Notifications"})]}),e.jsxs(mt,{onSelect:()=>i(()=>n(`/${o}/settings`)),children:[e.jsx(Ra,{className:"text-muted-foreground"}),e.jsx("span",{children:"Settings"})]})]}),r&&r.length>0&&e.jsxs(e.Fragment,{children:[e.jsx(Ll,{}),e.jsxs(ps,{heading:"Projects",children:[r.map(l=>e.jsxs(mt,{value:`${l.name} board`,onSelect:()=>i(()=>n(`/${o}/projects/${l.identifier}/board`)),children:[e.jsx(xt,{className:"text-muted-foreground"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),e.jsx("span",{className:"truncate",children:l.name}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),r.map(l=>e.jsxs(mt,{value:`${l.name} issues`,onSelect:()=>i(()=>n(`/${o}/projects/${l.identifier}/issues`)),children:[e.jsx(Js,{className:"text-muted-foreground"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),e.jsx("span",{className:"truncate",children:l.name}),e.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Qh(){const[t,s]=x.useState(""),[n,r]=x.useState(""),[a,o]=x.useState(!1),i=He(),l=Df(),d=c=>{c.preventDefault(),l.mutate({email:t,password:n},{onSuccess:()=>i("/"),onError:u=>R.error(u.message??"Invalid email or password")})};return e.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[360px]",children:[e.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[e.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:e.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:e.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:e.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Welcome to Meridian"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),e.jsxs("form",{onSubmit:d,className:"space-y-2",children:[e.jsx(xe,{type:"email",placeholder:"Email",value:t,onChange:c=>s(c.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),e.jsxs("div",{className:"relative",children:[e.jsx(xe,{type:a?"text":"password",placeholder:"Password",value:n,onChange:c=>r(c.target.value),autoComplete:"current-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),e.jsx("button",{type:"button",onClick:()=>o(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:a?e.jsx(Ta,{className:"h-4 w-4"}):e.jsx(An,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"pt-1",children:e.jsx(G,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),e.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",e.jsx(wn,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]})]})})}function Xh(){const[t,s]=x.useState(""),[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState(!1),u=He(),m=_f(),{data:f}=Ml(),h=(f==null?void 0:f.needsSetup)===!0,g=y=>{y.preventDefault(),m.mutate({email:a,password:i,first_name:t,last_name:n},{onSuccess:()=>u("/"),onError:S=>R.error(S.message??"Registration failed")})};return e.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[360px]",children:[e.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[e.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:e.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:e.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:e.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:h?"Set up your account":"Create your account"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:h?"You're the first user — you'll be the super admin.":"Get started with Meridian"})]})]}),e.jsxs("form",{onSubmit:g,className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(xe,{placeholder:"First name",value:t,onChange:y=>s(y.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),e.jsx(xe,{placeholder:"Last name",value:n,onChange:y=>r(y.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),e.jsx(xe,{type:"email",placeholder:"Email",value:a,onChange:y=>o(y.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),e.jsxs("div",{className:"relative",children:[e.jsx(xe,{type:d?"text":"password",placeholder:"Password",value:i,onChange:y=>l(y.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),e.jsx("button",{type:"button",onClick:()=>c(!d),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:d?e.jsx(Ta,{className:"h-4 w-4"}):e.jsx(An,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"pt-1",children:e.jsx(G,{type:"submit",className:"w-full h-10 font-medium",disabled:m.isPending,children:m.isPending?"Creating account...":"Create Account"})})]}),e.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",e.jsx(wn,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function Jh(){const[t,s]=x.useState(""),n=He(),{setWorkspace:r}=ke(),a=xf(),o=i=>{i.preventDefault(),t.trim()&&a.mutate({name:t.trim()},{onSuccess:l=>{const d={id:l.workspace.id,name:l.workspace.name,slug:l.workspace.slug};r(d),n(`/${d.slug}/projects`,{replace:!0})},onError:l=>R.error(l.message??"Failed to create workspace")})};return e.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[380px]",children:[e.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[e.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:e.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:e.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:e.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),e.jsxs("div",{className:"text-center",children:[e.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Create your workspace"}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),e.jsxs("form",{onSubmit:o,className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(xe,{placeholder:"Workspace name (e.g. Acme Corp)",value:t,onChange:i=>s(i.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),e.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),e.jsx(G,{type:"submit",className:"w-full h-10 font-medium",disabled:!t.trim()||a.isPending,children:a.isPending?"Creating workspace...":"Create workspace"})]})]})})}function Zh(t){if(typeof document>"u")return;let s=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",s.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}const Yl=N.createContext({drawerRef:{current:null},overlayRef:{current:null},onPress:()=>{},onRelease:()=>{},onDrag:()=>{},onNestedDrag:()=>{},onNestedOpenChange:()=>{},onNestedRelease:()=>{},openProp:void 0,dismissible:!1,isOpen:!1,isDragging:!1,keyboardIsOpen:{current:!1},snapPointsOffset:null,snapPoints:null,handleOnly:!1,modal:!1,shouldFade:!1,activeSnapPoint:null,onOpenChange:()=>{},setActiveSnapPoint:()=>{},closeDrawer:()=>{},direction:"bottom",shouldAnimate:{current:!0},shouldScaleBackground:!1,setBackgroundColorOnScale:!0,noBodyStyles:!1,container:null,autoFocus:!1}),Ln=()=>{const t=N.useContext(Yl);if(!t)throw new Error("useDrawerContext must be used within a Drawer.Root");return t};Zh(`[data-vaul-drawer]{touch-action:none;will-change:transform;transition:transform .5s cubic-bezier(.32, .72, 0, 1);animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=open]{animation-name:slideFromBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=bottom][data-state=closed]{animation-name:slideToBottom}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=open]{animation-name:slideFromTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=top][data-state=closed]{animation-name:slideToTop}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=open]{animation-name:slideFromLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=left][data-state=closed]{animation-name:slideToLeft}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=open]{animation-name:slideFromRight}[data-vaul-drawer][data-vaul-snap-points=false][data-vaul-drawer-direction=right][data-state=closed]{animation-name:slideToRight}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--initial-transform,100%),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}[data-vaul-drawer][data-vaul-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--initial-transform,100%),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=top]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=bottom]{transform:translate3d(0,var(--snap-point-height,0),0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=left]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-drawer][data-vaul-delayed-snap-points=true][data-vaul-drawer-direction=right]{transform:translate3d(var(--snap-point-height,0),0,0)}[data-vaul-overlay][data-vaul-snap-points=false]{animation-duration:.5s;animation-timing-function:cubic-bezier(0.32,0.72,0,1)}[data-vaul-overlay][data-vaul-snap-points=false][data-state=open]{animation-name:fadeIn}[data-vaul-overlay][data-state=closed]{animation-name:fadeOut}[data-vaul-animate=false]{animation:none!important}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:0;transition:opacity .5s cubic-bezier(.32, .72, 0, 1)}[data-vaul-overlay][data-vaul-snap-points=true]{opacity:1}[data-vaul-drawer]:not([data-vaul-custom-container=true])::after{content:'';position:absolute;background:inherit;background-color:inherit}[data-vaul-drawer][data-vaul-drawer-direction=top]::after{top:initial;bottom:100%;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=bottom]::after{top:100%;bottom:initial;left:0;right:0;height:200%}[data-vaul-drawer][data-vaul-drawer-direction=left]::after{left:initial;right:100%;top:0;bottom:0;width:200%}[data-vaul-drawer][data-vaul-drawer-direction=right]::after{left:100%;right:initial;top:0;bottom:0;width:200%}[data-vaul-overlay][data-vaul-snap-points=true]:not([data-vaul-snap-points-overlay=true]):not(
|
|
469
|
-
[data-state=closed]
|
|
470
|
-
){opacity:0}[data-vaul-overlay][data-vaul-snap-points-overlay=true]{opacity:1}[data-vaul-handle]{display:block;position:relative;opacity:.7;background:#e2e2e4;margin-left:auto;margin-right:auto;height:5px;width:32px;border-radius:1rem;touch-action:pan-y}[data-vaul-handle]:active,[data-vaul-handle]:hover{opacity:1}[data-vaul-handle-hitarea]{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:max(100%,2.75rem);height:max(100%,2.75rem);touch-action:inherit}@media (hover:hover) and (pointer:fine){[data-vaul-drawer]{user-select:none}}@media (pointer:fine){[data-vaul-handle-hitarea]:{width:100%;height:100%}}@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeOut{to{opacity:0}}@keyframes slideFromBottom{from{transform:translate3d(0,var(--initial-transform,100%),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToBottom{to{transform:translate3d(0,var(--initial-transform,100%),0)}}@keyframes slideFromTop{from{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}to{transform:translate3d(0,0,0)}}@keyframes slideToTop{to{transform:translate3d(0,calc(var(--initial-transform,100%) * -1),0)}}@keyframes slideFromLeft{from{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToLeft{to{transform:translate3d(calc(var(--initial-transform,100%) * -1),0,0)}}@keyframes slideFromRight{from{transform:translate3d(var(--initial-transform,100%),0,0)}to{transform:translate3d(0,0,0)}}@keyframes slideToRight{to{transform:translate3d(var(--initial-transform,100%),0,0)}}`);function ex(){const t=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(t)&&/Mobile/.test(t)||/FxiOS/.test(t))}function tx(){return Ua(/^Mac/)}function sx(){return Ua(/^iPhone/)}function Eo(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function nx(){return Ua(/^iPad/)||tx()&&navigator.maxTouchPoints>1}function Hl(){return sx()||nx()}function Ua(t){return typeof window<"u"&&window.navigator!=null?t.test(window.navigator.platform):void 0}const rx=24,ax=typeof window<"u"?x.useLayoutEffect:x.useEffect;function Oo(...t){return(...s)=>{for(let n of t)typeof n=="function"&&n(...s)}}const Kr=typeof document<"u"&&window.visualViewport;function To(t){let s=window.getComputedStyle(t);return/(auto|scroll)/.test(s.overflow+s.overflowX+s.overflowY)}function Ul(t){for(To(t)&&(t=t.parentElement);t&&!To(t);)t=t.parentElement;return t||document.scrollingElement||document.documentElement}const ox=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Jn=0,Vr;function ix(t={}){let{isDisabled:s}=t;ax(()=>{if(!s)return Jn++,Jn===1&&Hl()&&(Vr=lx()),()=>{Jn--,Jn===0&&(Vr==null||Vr())}},[s])}function lx(){let t,s=0,n=m=>{t=Ul(m.target),!(t===document.documentElement&&t===document.body)&&(s=m.changedTouches[0].pageY)},r=m=>{if(!t||t===document.documentElement||t===document.body){m.preventDefault();return}let f=m.changedTouches[0].pageY,h=t.scrollTop,g=t.scrollHeight-t.clientHeight;g!==0&&((h<=0&&f>s||h>=g&&f<s)&&m.preventDefault(),s=f)},a=m=>{let f=m.target;ha(f)&&f!==document.activeElement&&(m.preventDefault(),f.style.transform="translateY(-2000px)",f.focus(),requestAnimationFrame(()=>{f.style.transform=""}))},o=m=>{let f=m.target;ha(f)&&(f.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{f.style.transform="",Kr&&(Kr.height<window.innerHeight?requestAnimationFrame(()=>{Po(f)}):Kr.addEventListener("resize",()=>Po(f),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},l=window.pageXOffset,d=window.pageYOffset,c=Oo(dx(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Oo(pn(document,"touchstart",n,{passive:!1,capture:!0}),pn(document,"touchmove",r,{passive:!1,capture:!0}),pn(document,"touchend",a,{passive:!1,capture:!0}),pn(document,"focus",o,!0),pn(window,"scroll",i));return()=>{c(),u(),window.scrollTo(l,d)}}function dx(t,s,n){let r=t.style[s];return t.style[s]=n,()=>{t.style[s]=r}}function pn(t,s,n,r){return t.addEventListener(s,n,r),()=>{t.removeEventListener(s,n,r)}}function Po(t){let s=document.scrollingElement||document.documentElement;for(;t&&t!==s;){let n=Ul(t);if(n!==document.documentElement&&n!==document.body&&n!==t){let r=n.getBoundingClientRect().top,a=t.getBoundingClientRect().top,o=t.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+rx;o>i&&(n.scrollTop+=a-r)}t=n.parentElement}}function ha(t){return t instanceof HTMLInputElement&&!ox.has(t.type)||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable}function cx(t,s){typeof t=="function"?t(s):t!=null&&(t.current=s)}function ux(...t){return s=>t.forEach(n=>cx(n,s))}function Kl(...t){return x.useCallback(ux(...t),t)}const Vl=new WeakMap;function Fe(t,s,n=!1){if(!t||!(t instanceof HTMLElement))return;let r={};Object.entries(s).forEach(([a,o])=>{if(a.startsWith("--")){t.style.setProperty(a,o);return}r[a]=t.style[a],t.style[a]=o}),!n&&Vl.set(t,r)}function mx(t,s){if(!t||!(t instanceof HTMLElement))return;let n=Vl.get(t);n&&(t.style[s]=n[s])}const Ie=t=>{switch(t){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return t}};function Zn(t,s){if(!t)return null;const n=window.getComputedStyle(t),r=n.transform||n.webkitTransform||n.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Ie(s)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Ie(s)?5:4]):null)}function fx(t){return 8*(Math.log(t+1)-2)}function Gr(t,s){if(!t)return()=>{};const n=t.style.cssText;return Object.assign(t.style,s),()=>{t.style.cssText=n}}function hx(...t){return(...s)=>{for(const n of t)typeof n=="function"&&n(...s)}}const De={DURATION:.5,EASE:[.32,.72,0,1]},Gl=.4,xx=.25,px=100,Ql=8,os=16,xa=26,Qr="vaul-dragging";function Xl(t){const s=N.useRef(t);return N.useEffect(()=>{s.current=t}),N.useMemo(()=>(...n)=>s.current==null?void 0:s.current.call(s,...n),[])}function gx({defaultProp:t,onChange:s}){const n=N.useState(t),[r]=n,a=N.useRef(r),o=Xl(s);return N.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),n}function Jl({prop:t,defaultProp:s,onChange:n=()=>{}}){const[r,a]=gx({defaultProp:s,onChange:n}),o=t!==void 0,i=o?t:r,l=Xl(n),d=N.useCallback(c=>{if(o){const m=typeof c=="function"?c(t):c;m!==t&&l(m)}else a(c)},[o,t,a,l]);return[i,d]}function bx({activeSnapPointProp:t,setActiveSnapPointProp:s,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:o,onSnapPointChange:i,direction:l="bottom",container:d,snapToSequentialPoint:c}){const[u,m]=Jl({prop:t,defaultProp:n==null?void 0:n[0],onChange:s}),[f,h]=N.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);N.useEffect(()=>{function D(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",D),()=>window.removeEventListener("resize",D)},[]);const g=N.useMemo(()=>u===(n==null?void 0:n[n.length-1])||null,[n,u]),y=N.useMemo(()=>{var D;return(D=n==null?void 0:n.findIndex(P=>P===u))!=null?D:null},[n,u]),S=n&&n.length>0&&(o||o===0)&&!Number.isNaN(o)&&n[o]===u||!n,b=N.useMemo(()=>{const D=d?{width:d.getBoundingClientRect().width,height:d.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var P;return(P=n==null?void 0:n.map(z=>{const _=typeof z=="string";let A=0;if(_&&(A=parseInt(z,10)),Ie(l)){const $=_?A:f?z*D.height:0;return f?l==="bottom"?D.height-$:-D.height+$:$}const O=_?A:f?z*D.width:0;return f?l==="right"?D.width-O:-D.width+O:O}))!=null?P:[]},[n,f,d]),w=N.useMemo(()=>y!==null?b==null?void 0:b[y]:null,[b,y]),j=N.useCallback(D=>{var P;const z=(P=b==null?void 0:b.findIndex(_=>_===D))!=null?P:null;i(z),Fe(r.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Ie(l)?`translate3d(0, ${D}px, 0)`:`translate3d(${D}px, 0, 0)`}),b&&z!==b.length-1&&o!==void 0&&z!==o&&z<o?Fe(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"0"}):Fe(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"1"}),m(n==null?void 0:n[Math.max(z,0)])},[r.current,n,b,o,a,m]);N.useEffect(()=>{if(u||t){var D;const P=(D=n==null?void 0:n.findIndex(z=>z===t||z===u))!=null?D:-1;b&&P!==-1&&typeof b[P]=="number"&&j(b[P])}},[u,t,n,b,j]);function v({draggedDistance:D,closeDrawer:P,velocity:z,dismissible:_}){if(o===void 0)return;const A=l==="bottom"||l==="right"?(w??0)-D:(w??0)+D,O=y===o-1,$=y===0,E=D>0;if(O&&Fe(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`}),!c&&z>2&&!E){_?P():j(b[0]);return}if(!c&&z>2&&E&&b&&n){j(b[n.length-1]);return}const Q=b==null?void 0:b.reduce((V,L)=>typeof V!="number"||typeof L!="number"?V:Math.abs(L-A)<Math.abs(V-A)?L:V),Y=Ie(l)?window.innerHeight:window.innerWidth;if(z>Gl&&Math.abs(D)<Y*.4){const V=E?1:-1;if(V>0&&g&&n){j(b[n.length-1]);return}if($&&V<0&&_&&P(),y===null)return;j(b[y+V]);return}j(Q)}function C({draggedDistance:D}){if(w===null)return;const P=l==="bottom"||l==="right"?w-D:w+D;(l==="bottom"||l==="right")&&P<b[b.length-1]||(l==="top"||l==="left")&&P>b[b.length-1]||Fe(r.current,{transform:Ie(l)?`translate3d(0, ${P}px, 0)`:`translate3d(${P}px, 0, 0)`})}function p(D,P){if(!n||typeof y!="number"||!b||o===void 0)return null;const z=y===o-1;if(y>=o&&P)return 0;if(z&&!P)return 1;if(!S&&!z)return null;const A=z?y+1:y-1,O=z?b[A]-b[A-1]:b[A+1]-b[A],$=D/Math.abs(O);return z?1-$:$}return{isLastSnapPoint:g,activeSnapPoint:u,shouldFade:S,getPercentageDragged:p,setActiveSnapPoint:m,activeSnapPointIndex:y,onRelease:v,onDrag:C,snapPointsOffset:b}}const yx=()=>()=>{};function vx(){const{direction:t,isOpen:s,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=Ln(),o=N.useRef(null),i=x.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-xa)/window.innerWidth}N.useEffect(()=>{if(s&&n){o.current&&clearTimeout(o.current);const d=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!d)return;hx(r&&!a?Gr(document.body,{background:"black"}):yx,Gr(d,{transformOrigin:Ie(t)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${De.DURATION}s`,transitionTimingFunction:`cubic-bezier(${De.EASE.join(",")})`}));const c=Gr(d,{borderRadius:`${Ql}px`,overflow:"hidden",...Ie(t)?{transform:`scale(${l()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`}:{transform:`scale(${l()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`}});return()=>{c(),o.current=window.setTimeout(()=>{i?document.body.style.background=i:document.body.style.removeProperty("background")},De.DURATION*1e3)}}},[s,n,i])}let gn=null;function jx({isOpen:t,modal:s,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:o}){const[i,l]=N.useState(()=>typeof window<"u"?window.location.href:""),d=N.useRef(0),c=N.useCallback(()=>{if(Eo()&&gn===null&&t&&!o){gn={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:m,innerHeight:f}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-d.current}px`,left:`${-m}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const h=f-window.innerHeight;h&&d.current>=f&&(document.body.style.top=`${-(d.current+h)}px`)}),300)}},[t]),u=N.useCallback(()=>{if(Eo()&&gn!==null&&!o){const m=-parseInt(document.body.style.top,10),f=-parseInt(document.body.style.left,10);Object.assign(document.body.style,gn),window.requestAnimationFrame(()=>{if(a&&i!==window.location.href){l(window.location.href);return}window.scrollTo(f,m)}),gn=null}},[i]);return N.useEffect(()=>{function m(){d.current=window.scrollY}return m(),window.addEventListener("scroll",m),()=>{window.removeEventListener("scroll",m)}},[]),N.useEffect(()=>{if(s)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[s,u]),N.useEffect(()=>{n||!r||(t?(!window.matchMedia("(display-mode: standalone)").matches&&c(),s||window.setTimeout(()=>{u()},500)):u())},[t,r,i,s,n,c,u]),{restorePositionSetting:u}}function wx({open:t,onOpenChange:s,children:n,onDrag:r,onRelease:a,snapPoints:o,shouldScaleBackground:i=!1,setBackgroundColorOnScale:l=!0,closeThreshold:d=xx,scrollLockTimeout:c=px,dismissible:u=!0,handleOnly:m=!1,fadeFromIndex:f=o&&o.length-1,activeSnapPoint:h,setActiveSnapPoint:g,fixed:y,modal:S=!0,onClose:b,nested:w,noBodyStyles:j=!1,direction:v="bottom",defaultOpen:C=!1,disablePreventScroll:p=!0,snapToSequentialPoint:D=!1,preventScrollRestoration:P=!1,repositionInputs:z=!0,onAnimationEnd:_,container:A,autoFocus:O=!1}){var $,E;const[Q=!1,Y]=Jl({defaultProp:C,prop:t,onChange:ae=>{s==null||s(ae),!ae&&!w&>(),setTimeout(()=>{_==null||_(ae)},De.DURATION*1e3),ae&&!S&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),ae||(document.body.style.pointerEvents="auto")}}),[V,L]=N.useState(!1),[F,Z]=N.useState(!1),[ee,k]=N.useState(!1),I=N.useRef(null),K=N.useRef(null),q=N.useRef(null),M=N.useRef(null),W=N.useRef(null),de=N.useRef(!1),ye=N.useRef(null),$e=N.useRef(0),Qe=N.useRef(!1),Rt=N.useRef(!C),es=N.useRef(0),ie=N.useRef(null),ts=N.useRef((($=ie.current)==null?void 0:$.getBoundingClientRect().height)||0),ss=N.useRef(((E=ie.current)==null?void 0:E.getBoundingClientRect().width)||0),ns=N.useRef(0),rs=N.useCallback(ae=>{o&&ae===qe.length-1&&(K.current=new Date)},[]),{activeSnapPoint:on,activeSnapPointIndex:dt,setActiveSnapPoint:pt,onRelease:_s,snapPointsOffset:qe,onDrag:as,shouldFade:It,getPercentageDragged:Be}=bx({snapPoints:o,activeSnapPointProp:h,setActiveSnapPointProp:g,drawerRef:ie,fadeFromIndex:f,overlayRef:I,onSnapPointChange:rs,direction:v,container:A,snapToSequentialPoint:D});ix({isDisabled:!Q||F||!S||ee||!V||!z||!p});const{restorePositionSetting:gt}=jx({isOpen:Q,modal:S,nested:w??!1,hasBeenOpened:V,preventScrollRestoration:P,noBodyStyles:j});function zt(){return(window.innerWidth-xa)/window.innerWidth}function ln(ae){var X,ne;!u&&!o||ie.current&&!ie.current.contains(ae.target)||(ts.current=((X=ie.current)==null?void 0:X.getBoundingClientRect().height)||0,ss.current=((ne=ie.current)==null?void 0:ne.getBoundingClientRect().width)||0,Z(!0),q.current=new Date,Hl()&&window.addEventListener("touchend",()=>de.current=!1,{once:!0}),ae.target.setPointerCapture(ae.pointerId),$e.current=Ie(v)?ae.pageY:ae.pageX)}function St(ae,X){var ne;let U=ae;const te=(ne=window.getSelection())==null?void 0:ne.toString(),ge=ie.current?Zn(ie.current,v):null,B=new Date;if(U.tagName==="SELECT"||U.hasAttribute("data-vaul-no-drag")||U.closest("[data-vaul-no-drag]"))return!1;if(v==="right"||v==="left")return!0;if(K.current&&B.getTime()-K.current.getTime()<500)return!1;if(ge!==null&&(v==="bottom"?ge>0:ge<0))return!0;if(te&&te.length>0)return!1;if(W.current&&B.getTime()-W.current.getTime()<c&&ge===0||X)return W.current=B,!1;for(;U;){if(U.scrollHeight>U.clientHeight){if(U.scrollTop!==0)return W.current=new Date,!1;if(U.getAttribute("role")==="dialog")return!0}U=U.parentNode}return!0}function dn(ae){if(ie.current&&F){const X=v==="bottom"||v==="right"?1:-1,ne=($e.current-(Ie(v)?ae.pageY:ae.pageX))*X,U=ne>0,te=o&&!u&&!U;if(te&&dt===0)return;const ge=Math.abs(ne),B=document.querySelector("[data-vaul-drawer-wrapper]"),fe=v==="bottom"||v==="top"?ts.current:ss.current;let he=ge/fe;const Pe=Be(ge,U);if(Pe!==null&&(he=Pe),te&&he>=1||!de.current&&!St(ae.target,U))return;if(ie.current.classList.add(Qr),de.current=!0,Fe(ie.current,{transition:"none"}),Fe(I.current,{transition:"none"}),o&&as({draggedDistance:ne}),U&&!o){const Me=fx(ne),at=Math.min(Me*-1,0)*X;Fe(ie.current,{transform:Ie(v)?`translate3d(0, ${at}px, 0)`:`translate3d(${at}px, 0, 0)`});return}const Ce=1-he;if((It||f&&dt===f-1)&&(r==null||r(ae,he),Fe(I.current,{opacity:`${Ce}`,transition:"none"},!0)),B&&I.current&&i){const Me=Math.min(zt()+he*(1-zt()),1),at=8-he*8,Xe=Math.max(0,14-he*14);Fe(B,{borderRadius:`${at}px`,transform:Ie(v)?`scale(${Me}) translate3d(0, ${Xe}px, 0)`:`scale(${Me}) translate3d(${Xe}px, 0, 0)`,transition:"none"},!0)}if(!o){const Me=ge*X;Fe(ie.current,{transform:Ie(v)?`translate3d(0, ${Me}px, 0)`:`translate3d(${Me}px, 0, 0)`})}}}N.useEffect(()=>{window.requestAnimationFrame(()=>{Rt.current=!0})},[]),N.useEffect(()=>{var ae;function X(){if(!ie.current||!z)return;const ne=document.activeElement;if(ha(ne)||Qe.current){var U;const te=((U=window.visualViewport)==null?void 0:U.height)||0,ge=window.innerHeight;let B=ge-te;const fe=ie.current.getBoundingClientRect().height||0,he=fe>ge*.8;ns.current||(ns.current=fe);const Pe=ie.current.getBoundingClientRect().top;if(Math.abs(es.current-B)>60&&(Qe.current=!Qe.current),o&&o.length>0&&qe&&dt){const Ce=qe[dt]||0;B+=Ce}if(es.current=B,fe>te||Qe.current){const Ce=ie.current.getBoundingClientRect().height;let Me=Ce;Ce>te&&(Me=te-(he?Pe:xa)),y?ie.current.style.height=`${Ce-Math.max(B,0)}px`:ie.current.style.height=`${Math.max(Me,te-Pe)}px`}else ex()||(ie.current.style.height=`${ns.current}px`);o&&o.length>0&&!Qe.current?ie.current.style.bottom="0px":ie.current.style.bottom=`${Math.max(B,0)}px`}}return(ae=window.visualViewport)==null||ae.addEventListener("resize",X),()=>{var ne;return(ne=window.visualViewport)==null?void 0:ne.removeEventListener("resize",X)}},[dt,o,qe]);function bt(ae){yt(),b==null||b(),ae||Y(!1),setTimeout(()=>{o&&pt(o[0])},De.DURATION*1e3)}function Ft(){if(!ie.current)return;const ae=document.querySelector("[data-vaul-drawer-wrapper]"),X=Zn(ie.current,v);Fe(ie.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`}),Fe(I.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"1"}),i&&X&&X>0&&Q&&Fe(ae,{borderRadius:`${Ql}px`,overflow:"hidden",...Ie(v)?{transform:`scale(${zt()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${zt()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${De.DURATION}s`,transitionTimingFunction:`cubic-bezier(${De.EASE.join(",")})`},!0)}function yt(){!F||!ie.current||(ie.current.classList.remove(Qr),de.current=!1,Z(!1),M.current=new Date)}function Es(ae){if(!F||!ie.current)return;ie.current.classList.remove(Qr),de.current=!1,Z(!1),M.current=new Date;const X=Zn(ie.current,v);if(!ae||!St(ae.target,!1)||!X||Number.isNaN(X)||q.current===null)return;const ne=M.current.getTime()-q.current.getTime(),U=$e.current-(Ie(v)?ae.pageY:ae.pageX),te=Math.abs(U)/ne;if(te>.05&&(k(!0),setTimeout(()=>{k(!1)},200)),o){_s({draggedDistance:U*(v==="bottom"||v==="right"?1:-1),closeDrawer:bt,velocity:te,dismissible:u}),a==null||a(ae,!0);return}if(v==="bottom"||v==="right"?U>0:U<0){Ft(),a==null||a(ae,!0);return}if(te>Gl){bt(),a==null||a(ae,!1);return}var ge;const B=Math.min((ge=ie.current.getBoundingClientRect().height)!=null?ge:0,window.innerHeight);var fe;const he=Math.min((fe=ie.current.getBoundingClientRect().width)!=null?fe:0,window.innerWidth),Pe=v==="left"||v==="right";if(Math.abs(X)>=(Pe?he:B)*d){bt(),a==null||a(ae,!1);return}a==null||a(ae,!0),Ft()}N.useEffect(()=>(Q&&(Fe(document.documentElement,{scrollBehavior:"auto"}),K.current=new Date),()=>{mx(document.documentElement,"scrollBehavior")}),[Q]);function vt(ae){const X=ae?(window.innerWidth-os)/window.innerWidth:1,ne=ae?-os:0;ye.current&&window.clearTimeout(ye.current),Fe(ie.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Ie(v)?`scale(${X}) translate3d(0, ${ne}px, 0)`:`scale(${X}) translate3d(${ne}px, 0, 0)`}),!ae&&ie.current&&(ye.current=setTimeout(()=>{const U=Zn(ie.current,v);Fe(ie.current,{transition:"none",transform:Ie(v)?`translate3d(0, ${U}px, 0)`:`translate3d(${U}px, 0, 0)`})},500))}function Os(ae,X){if(X<0)return;const ne=(window.innerWidth-os)/window.innerWidth,U=ne+X*(1-ne),te=-os+X*os;Fe(ie.current,{transform:Ie(v)?`scale(${U}) translate3d(0, ${te}px, 0)`:`scale(${U}) translate3d(${te}px, 0, 0)`,transition:"none"})}function cn(ae,X){const ne=Ie(v)?window.innerHeight:window.innerWidth,U=X?(ne-os)/ne:1,te=X?-os:0;X&&Fe(ie.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Ie(v)?`scale(${U}) translate3d(0, ${te}px, 0)`:`scale(${U}) translate3d(${te}px, 0, 0)`})}return N.useEffect(()=>{S||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[S]),N.createElement(En,{defaultOpen:C,onOpenChange:ae=>{!u&&!ae||(ae?L(!0):bt(!0),Y(ae))},open:Q},N.createElement(Yl.Provider,{value:{activeSnapPoint:on,snapPoints:o,setActiveSnapPoint:pt,drawerRef:ie,overlayRef:I,onOpenChange:s,onPress:ln,onRelease:Es,onDrag:dn,dismissible:u,shouldAnimate:Rt,handleOnly:m,isOpen:Q,isDragging:F,shouldFade:It,closeDrawer:bt,onNestedDrag:Os,onNestedOpenChange:vt,onNestedRelease:cn,keyboardIsOpen:Qe,modal:S,snapPointsOffset:qe,activeSnapPointIndex:dt,direction:v,shouldScaleBackground:i,setBackgroundColorOnScale:l,noBodyStyles:j,container:A,autoFocus:O}},n))}const Zl=N.forwardRef(function({...t},s){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:o,isOpen:i,modal:l,shouldAnimate:d}=Ln(),c=Kl(s,n),u=r&&r.length>0;if(!l)return null;const m=N.useCallback(f=>a(f),[a]);return N.createElement(js,{onMouseUp:m,ref:c,"data-vaul-overlay":"","data-vaul-snap-points":i&&u?"true":"false","data-vaul-snap-points-overlay":i&&o?"true":"false","data-vaul-animate":d!=null&&d.current?"true":"false",...t})});Zl.displayName="Drawer.Overlay";const ed=N.forwardRef(function({onPointerDownOutside:t,style:s,onOpenAutoFocus:n,...r},a){const{drawerRef:o,onPress:i,onRelease:l,onDrag:d,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:m,modal:f,isOpen:h,direction:g,snapPoints:y,container:S,handleOnly:b,shouldAnimate:w,autoFocus:j}=Ln(),[v,C]=N.useState(!1),p=Kl(a,o),D=N.useRef(null),P=N.useRef(null),z=N.useRef(!1),_=y&&y.length>0;vx();const A=($,E,Q=0)=>{if(z.current)return!0;const Y=Math.abs($.y),V=Math.abs($.x),L=V>Y,F=["bottom","right"].includes(E)?1:-1;if(E==="left"||E==="right"){if(!($.x*F<0)&&V>=0&&V<=Q)return L}else if(!($.y*F<0)&&Y>=0&&Y<=Q)return!L;return z.current=!0,!0};N.useEffect(()=>{_&&window.requestAnimationFrame(()=>{C(!0)})},[]);function O($){D.current=null,z.current=!1,l($)}return N.createElement(ws,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":v?"true":"false","data-vaul-snap-points":h&&_?"true":"false","data-vaul-custom-container":S?"true":"false","data-vaul-animate":w!=null&&w.current?"true":"false",...r,ref:p,style:u&&u.length>0?{"--snap-point-height":`${u[m??0]}px`,...s}:s,onPointerDown:$=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,$),D.current={x:$.pageX,y:$.pageY},i($))},onOpenAutoFocus:$=>{n==null||n($),j||$.preventDefault()},onPointerDownOutside:$=>{if(t==null||t($),!f||$.defaultPrevented){$.preventDefault();return}c.current&&(c.current=!1)},onFocusOutside:$=>{if(!f){$.preventDefault();return}},onPointerMove:$=>{if(P.current=$,b||(r.onPointerMove==null||r.onPointerMove.call(r,$),!D.current))return;const E=$.pageY-D.current.y,Q=$.pageX-D.current.x,Y=$.pointerType==="touch"?10:2;A({x:Q,y:E},g,Y)?d($):(Math.abs(Q)>Y||Math.abs(E)>Y)&&(D.current=null)},onPointerUp:$=>{r.onPointerUp==null||r.onPointerUp.call(r,$),D.current=null,z.current=!1,l($)},onPointerOut:$=>{r.onPointerOut==null||r.onPointerOut.call(r,$),O(P.current)},onContextMenu:$=>{r.onContextMenu==null||r.onContextMenu.call(r,$),P.current&&O(P.current)}})});ed.displayName="Drawer.Content";const Nx=250,kx=120,Sx=N.forwardRef(function({preventCycle:t=!1,children:s,...n},r){const{closeDrawer:a,isDragging:o,snapPoints:i,activeSnapPoint:l,setActiveSnapPoint:d,dismissible:c,handleOnly:u,isOpen:m,onPress:f,onDrag:h}=Ln(),g=N.useRef(null),y=N.useRef(!1);function S(){if(y.current){j();return}window.setTimeout(()=>{b()},kx)}function b(){if(o||t||y.current){j();return}if(j(),!i||i.length===0){c||a();return}if(l===i[i.length-1]&&c){a();return}const C=i.findIndex(D=>D===l);if(C===-1)return;const p=i[C+1];d(p)}function w(){g.current=window.setTimeout(()=>{y.current=!0},Nx)}function j(){g.current&&window.clearTimeout(g.current),y.current=!1}return N.createElement("div",{onClick:S,onPointerCancel:j,onPointerDown:v=>{u&&f(v),w()},onPointerMove:v=>{u&&h(v)},ref:r,"data-vaul-drawer-visible":m?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},N.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},s))});Sx.displayName="Drawer.Handle";function Cx(t){const s=Ln(),{container:n=s.container,...r}=t;return N.createElement(_n,{container:n,...r})}const At={Root:wx,Content:ed,Overlay:Zl,Portal:Cx,Title:Ks,Description:Vs},Ms=({shouldScaleBackground:t=!1,direction:s="right",...n})=>e.jsx(At.Root,{shouldScaleBackground:t,direction:s,...n});Ms.displayName="Drawer";const Mx=At.Portal,td=x.forwardRef(({className:t,...s},n)=>e.jsx(At.Overlay,{ref:n,className:T("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s}));td.displayName=At.Overlay.displayName;const Ds=x.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(Mx,{children:[e.jsx(td,{}),e.jsx(At.Content,{ref:r,className:T("fixed inset-y-0 right-0 z-50 flex h-full flex-col border-l border-border bg-background shadow-xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right","w-full max-w-lg",t),...n,children:s})]}));Ds.displayName="DrawerContent";const en=({className:t,...s})=>e.jsx("div",{className:T("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",t),...s});en.displayName="DrawerHeader";const tn=({className:t,...s})=>e.jsx("div",{className:T("flex-1 overflow-y-auto px-6 py-4",t),...s});tn.displayName="DrawerBody";const Yn=({className:t,...s})=>e.jsx("div",{className:T("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t border-border shrink-0",t),...s});Yn.displayName="DrawerFooter";const sn=x.forwardRef(({className:t,...s},n)=>e.jsx(At.Title,{ref:n,className:T("text-base font-semibold text-foreground",t),...s}));sn.displayName=At.Title.displayName;const Dx=x.forwardRef(({className:t,...s},n)=>e.jsx(At.Description,{ref:n,className:T("text-sm text-muted-foreground",t),...s}));Dx.displayName=At.Description.displayName;const _x=Tn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=x.forwardRef(({className:t,...s},n)=>e.jsx(ki,{ref:n,className:T(_x(),t),...s}));We.displayName=ki.displayName;const Nr=x.forwardRef(({className:t,...s},n)=>e.jsx("textarea",{className:T("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-none placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 resize-none",t),ref:n,...s}));Nr.displayName="Textarea";const Ao=[{name:"Backlog",key:"backlog",color:"#94a3b8",category:"backlog",position:0},{name:"Todo",key:"todo",color:"#64748b",category:"unstarted",position:1},{name:"In Progress",key:"in_progress",color:"#6366f1",category:"started",position:2},{name:"In Review",key:"in_review",color:"#f59e0b",category:"started",position:3},{name:"Done",key:"done",color:"#10b981",category:"completed",position:4},{name:"Cancelled",key:"cancelled",color:"#9ca3af",category:"cancelled",position:5}],Xr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function Ex(t){return t.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function Ox({chip:t,onRemove:s}){const{attributes:n,listeners:r,setNodeRef:a,transform:o,transition:i,isDragging:l}=ja({id:t.key});return e.jsxs("div",{ref:a,style:{transform:wa.Transform.toString(o),transition:i},className:T("flex items-center gap-1 pl-1 pr-1.5 py-0.5 rounded-full border text-xs font-medium transition-opacity",l?"opacity-50":"opacity-100"),children:[e.jsx("span",{...n,...r,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:e.jsx(yl,{className:"h-3 w-3"})}),e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:t.color}}),e.jsx("span",{className:"text-[11px]",children:t.name}),e.jsx("button",{type:"button",onClick:s,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:e.jsx(ze,{className:"h-3 w-3"})})]})}const Tx=3;function Px({open:t,onClose:s}){var Q;const[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState(!1),[u,m]=x.useState(!1),[f,h]=x.useState(Ao),[g,y]=x.useState(""),[S,b]=x.useState(Xr[2]),{workspace:w}=ke(),j=rh(),v=sh(n,{enabled:t}),C=nh(a,{enabled:t});x.useEffect(()=>{t&&v.data&&!d&&o(v.data)},[t,v.data,d]);const p=C.available===!1||j.isError&&((Q=j.error)==null?void 0:Q.status)===409,D=a.trim().length>=Tx&&/^[A-Z0-9]+$/i.test(a.trim()),P=Ii(zi(Fi,{activationConstraint:{distance:5}})),z=Y=>{r(Y)},_=()=>{n.trim()&&!d&&v.flush()},A=()=>{r(""),o(""),l(""),c(!1),m(!1),h(Ao),y(""),b(Xr[2]),j.reset(),s()},O=()=>{if(!g.trim())return;const Y=Ex(g.trim());if(f.some(V=>V.key===Y)){R.error("A status with this name already exists");return}h(V=>[...V,{name:g.trim(),key:Y,color:S,category:"started",position:V.length}]),y("")},$=Y=>{const{active:V,over:L}=Y;!L||V.id===L.id||h(F=>{const Z=F.findIndex(k=>k.key===V.id),ee=F.findIndex(k=>k.key===L.id);return rr(F,Z,ee).map((k,I)=>({...k,position:I}))})},E=Y=>{Y.preventDefault(),!(!n.trim()||!a.trim()||!D||p)&&j.mutate({name:n.trim(),identifier:a.trim().toUpperCase(),description:i.trim()||void 0,workspace_id:w.id,initial_statuses:f},{onSuccess:()=>{R.success("Project created"),A()},onError:V=>{(V==null?void 0:V.status)===409?R.error("This project key is already in use."):R.error(V.message??"Failed to create project")}})};return e.jsx(Ms,{open:t,onOpenChange:Y=>!Y&&A(),children:e.jsxs(Ds,{className:"max-w-md",children:[e.jsx(en,{children:e.jsx(sn,{children:"New project"})}),e.jsxs("form",{onSubmit:E,className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs(tn,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{htmlFor:"project-name",children:"Name"}),e.jsx(xe,{id:"project-name",placeholder:"My Project",value:n,onChange:Y=>z(Y.target.value),onBlur:_,autoFocus:!0}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{htmlFor:"project-id",children:["Identifier",e.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),e.jsx(xe,{id:"project-id",placeholder:"PROJ",value:a,onChange:Y=>{o(Y.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),c(!0)},maxLength:5,className:T("font-mono",p&&"border-destructive"),"aria-invalid":p}),p&&e.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{htmlFor:"project-desc",children:["Description",e.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsx(Nr,{id:"project-desc",placeholder:"What is this project about?",value:i,onChange:Y=>l(Y.target.value),className:"min-h-[80px]"})]}),e.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[e.jsx("button",{type:"button",onClick:()=>m(!u),className:"w-full flex items-center justify-between px-3 py-2.5 text-xs font-medium hover:bg-muted/40 transition-colors",children:e.jsxs("span",{className:"flex items-center gap-1.5",children:[u?e.jsx(Qs,{className:"h-3.5 w-3.5"}):e.jsx(Xs,{className:"h-3.5 w-3.5"}),"Statuses",e.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",f.length,")"]})]})}),u&&e.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[e.jsx(Wi,{sensors:P,onDragEnd:$,children:e.jsx(va,{items:f.map(Y=>Y.key),strategy:qi,children:e.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(Y=>e.jsx(Ox,{chip:Y,onRemove:()=>h(V=>V.filter(L=>L.key!==Y.key).map((L,F)=>({...L,position:F})))},Y.key))})})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:Xr.map(Y=>e.jsx("button",{type:"button",onClick:()=>b(Y),className:T("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",S===Y?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:Y}},Y))}),e.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[e.jsx(xe,{placeholder:"Status name…",value:g,onChange:Y=>y(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),O())},className:"h-7 text-xs flex-1"}),e.jsx(G,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:O,disabled:!g.trim(),children:e.jsx(Ae,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),e.jsxs(Yn,{children:[e.jsx(G,{type:"button",variant:"ghost",onClick:A,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:!n.trim()||!a.trim()||!D||p||j.isPending,children:j.isPending?"Creating...":"Create project"})]})]})]})})}const we=Rc,Ee=Ic,ve=x.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(Si,{ref:r,className:T("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-none ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[s,e.jsx(Oc,{asChild:!0,children:e.jsx(Qs,{className:"h-4 w-4 opacity-50"})})]}));ve.displayName=Si.displayName;const sd=x.forwardRef(({className:t,...s},n)=>e.jsx(Ci,{ref:n,className:T("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Ea,{className:"h-4 w-4"})}));sd.displayName=Ci.displayName;const nd=x.forwardRef(({className:t,...s},n)=>e.jsx(Mi,{ref:n,className:T("flex cursor-default items-center justify-center py-1",t),...s,children:e.jsx(Qs,{className:"h-4 w-4"})}));nd.displayName=Mi.displayName;const je=x.forwardRef(({className:t,children:s,position:n="popper",...r},a)=>e.jsx(Tc,{children:e.jsxs(Di,{ref:a,className:T("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[e.jsx(sd,{}),e.jsx(Pc,{className:T("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),e.jsx(nd,{})]})}));je.displayName=Di.displayName;const Ax=x.forwardRef(({className:t,...s},n)=>e.jsx(_i,{ref:n,className:T("px-2 py-1.5 text-xs font-medium text-muted-foreground",t),...s}));Ax.displayName=_i.displayName;const me=x.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(Ei,{ref:r,className:T("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[e.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:e.jsx(Ac,{children:e.jsx(it,{className:"h-4 w-4"})})}),e.jsx($c,{children:s})]}));me.displayName=Ei.displayName;const $x=x.forwardRef(({className:t,...s},n)=>e.jsx(Oi,{ref:n,className:T("-mx-1 my-1 h-px bg-border",t),...s}));$x.displayName=Oi.displayName;const Hn={project:t=>["projects",t,"access"]};function rd(t){return Ne({queryKey:Hn.project(t),queryFn:()=>J.get(`/admin/projects/${t}/access`),enabled:!!t})}function ad(t){const s=ce();return le({mutationFn:({userId:n,role:r})=>J.post(`/admin/projects/${t}/members`,{user_id:n,role:r}),onSuccess:()=>{s.invalidateQueries({queryKey:Hn.project(t)})}})}function od(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/projects/${t}/members/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Hn.project(t)})}})}function id(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/projects/${t}/teams`,{team_id:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Hn.project(t)})}})}function ld(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/projects/${t}/teams/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Hn.project(t)})}})}function Rx({open:t,onClose:s,projectId:n,projectName:r}){const{workspace:a}=ke(),o=(a==null?void 0:a.id)??"",{data:i,isLoading:l}=rd(n),{data:d}=In(o),{data:c}=za(o),u=ad(n),m=od(n),f=id(n),h=ld(n),[g,y]=x.useState(""),[S,b]=x.useState(""),w=new Set((i==null?void 0:i.members.map(p=>p.user_id))??[]),j=new Set((i==null?void 0:i.teams.map(p=>p.team_id))??[]),v=(d??[]).filter(p=>!w.has(p.user_id)),C=(c??[]).filter(p=>!j.has(p.id));return e.jsx(vr,{open:t,onOpenChange:p=>!p&&s(),children:e.jsxs(Bn,{className:"sm:max-w-[480px]",children:[e.jsx(jr,{children:e.jsxs(wr,{children:["Access — ",r]})}),e.jsxs("div",{className:"space-y-5 pt-1",children:[e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?e.jsx("div",{className:"space-y-2",children:[1,2].map(p=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-7 w-7 rounded-full"}),e.jsx(se,{className:"h-3.5 w-32"})]},p))}):(i==null?void 0:i.members.length)===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):e.jsx("div",{className:"space-y-1",children:i==null?void 0:i.members.map(p=>{var O;const D=p.user,P=(D==null?void 0:D.first_name)??"",z=(D==null?void 0:D.last_name)??"",_=`${P} ${z}`.trim()||(D==null?void 0:D.email)||"Unknown",A=(P[0]??z[0]??((O=D==null?void 0:D.email)==null?void 0:O[0])??"U").toUpperCase();return e.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[e.jsx(st,{className:"h-7 w-7 shrink-0",children:e.jsx(nt,{className:"text-[11px] font-medium",children:A})}),e.jsx("span",{className:"flex-1 text-sm truncate",children:_}),e.jsx("span",{className:T("text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",p.role==="manager"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:p.role}),e.jsx("button",{onClick:()=>m.mutate(p.user_id,{onSuccess:()=>R.success("Access removed"),onError:()=>R.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]},p.id)})}),v.length>0&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(Rn,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsxs(we,{value:g,onValueChange:y,children:[e.jsx(ve,{className:"h-8 text-xs flex-1",children:e.jsx(Ee,{placeholder:"Add person…"})}),e.jsx(je,{children:v.map(p=>{const D=p.user,P=(D==null?void 0:D.first_name)??"",z=(D==null?void 0:D.last_name)??"",_=`${P} ${z}`.trim()||(D==null?void 0:D.email)||"Unknown";return e.jsx(me,{value:p.user_id,children:_},p.user_id)})})]}),g&&e.jsx(G,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:u.isPending,onClick:()=>u.mutate({userId:g},{onSuccess:()=>{R.success("Access granted"),y("")},onError:()=>R.error("Failed to grant access")}),children:"Add"})]})]}),e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center justify-between mb-2",children:e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?e.jsx("div",{className:"space-y-2",children:[1].map(p=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{className:"h-7 w-7 rounded-lg"}),e.jsx(se,{className:"h-3.5 w-28"})]},p))}):(i==null?void 0:i.teams.length)===0?e.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):e.jsx("div",{className:"space-y-1",children:i==null?void 0:i.teams.map(p=>{const D=p.team;return e.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[e.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:e.jsx(gs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsx("span",{className:"flex-1 text-sm truncate",children:(D==null?void 0:D.name)??"Unknown team"}),D&&e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[D.member_count," ",D.member_count===1?"member":"members"]}),e.jsx("button",{onClick:()=>h.mutate(p.team_id,{onSuccess:()=>R.success("Team access removed"),onError:()=>R.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]},p.id)})}),C.length>0&&e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx(gs,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsxs(we,{value:S,onValueChange:b,children:[e.jsx(ve,{className:"h-8 text-xs flex-1",children:e.jsx(Ee,{placeholder:"Add team…"})}),e.jsx(je,{children:C.map(p=>e.jsx(me,{value:p.id,children:p.name},p.id))})]}),S&&e.jsx(G,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:f.isPending,onClick:()=>f.mutate(S,{onSuccess:()=>{R.success("Team access granted"),b("")},onError:()=>R.error("Failed to add team")}),children:"Add"})]})]}),e.jsx("div",{className:"flex justify-end pt-1",children:e.jsx(G,{variant:"outline",size:"sm",onClick:s,children:"Close"})})]})]})})}const dd=6048e5,Ix=864e5,zy=36e5,er=43200,$o=1440,Ro=Symbol.for("constructDateFrom");function Oe(t,s){return typeof t=="function"?t(s):t&&typeof t=="object"&&Ro in t?t[Ro](s):t instanceof Date?new t.constructor(s):new Date(s)}function pe(t,s){return Oe(s||t,t)}function Ka(t,s,n){const r=pe(t,n==null?void 0:n.in);return isNaN(s)?Oe((n==null?void 0:n.in)||t,NaN):(s&&r.setDate(r.getDate()+s),r)}function cd(t,s,n){const r=pe(t,n==null?void 0:n.in);if(isNaN(s))return Oe((n==null?void 0:n.in)||t,NaN);if(!s)return r;const a=r.getDate(),o=Oe((n==null?void 0:n.in)||t,r.getTime());o.setMonth(r.getMonth()+s+1,0);const i=o.getDate();return a>=i?o:(r.setFullYear(o.getFullYear(),o.getMonth(),a),r)}let zx={};function nn(){return zx}function Ys(t,s){var l,d,c,u;const n=nn(),r=(s==null?void 0:s.weekStartsOn)??((d=(l=s==null?void 0:s.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,a=pe(t,s==null?void 0:s.in),o=a.getDay(),i=(o<r?7:0)+o-r;return a.setDate(a.getDate()-i),a.setHours(0,0,0,0),a}function Sn(t,s){return Ys(t,{...s,weekStartsOn:1})}function ud(t,s){const n=pe(t,s==null?void 0:s.in),r=n.getFullYear(),a=Oe(n,0);a.setFullYear(r+1,0,4),a.setHours(0,0,0,0);const o=Sn(a),i=Oe(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=Sn(i);return n.getTime()>=o.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function ir(t){const s=pe(t),n=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return n.setUTCFullYear(s.getFullYear()),+t-+n}function Zt(t,...s){const n=Oe.bind(null,t||s.find(r=>typeof r=="object"));return s.map(n)}function Cn(t,s){const n=pe(t,s==null?void 0:s.in);return n.setHours(0,0,0,0),n}function Va(t,s,n){const[r,a]=Zt(n==null?void 0:n.in,t,s),o=Cn(r),i=Cn(a),l=+o-ir(o),d=+i-ir(i);return Math.round((l-d)/Ix)}function Fx(t,s){const n=ud(t,s),r=Oe(t,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),Sn(r)}function Wx(t,s,n){return Ka(t,s*7,n)}function qx(t,s,n){return cd(t,s*12,n)}function Bx(t,s){let n,r=s==null?void 0:s.in;return t.forEach(a=>{!r&&typeof a=="object"&&(r=Oe.bind(null,a));const o=pe(a,r);(!n||n<o||isNaN(+o))&&(n=o)}),Oe(r,n||NaN)}function Lx(t,s){let n,r=s==null?void 0:s.in;return t.forEach(a=>{!r&&typeof a=="object"&&(r=Oe.bind(null,a));const o=pe(a,r);(!n||n>o||isNaN(+o))&&(n=o)}),Oe(r,n||NaN)}function ar(t,s){const n=+pe(t)-+pe(s);return n<0?-1:n>0?1:n}function Ga(t){return Oe(t,Date.now())}function Qa(t,s,n){const[r,a]=Zt(n==null?void 0:n.in,t,s);return+Cn(r)==+Cn(a)}function md(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function Yx(t){return!(!md(t)&&typeof t!="number"||isNaN(+pe(t)))}function Xa(t,s,n){const[r,a]=Zt(n==null?void 0:n.in,t,s),o=r.getFullYear()-a.getFullYear(),i=r.getMonth()-a.getMonth();return o*12+i}function Hx(t){return s=>{const r=(t?Math[t]:Math.trunc)(s);return r===0?0:r}}function Ux(t,s){return+pe(t)-+pe(s)}function Kx(t,s){const n=pe(t,s==null?void 0:s.in);return n.setHours(23,59,59,999),n}function fd(t,s){const n=pe(t,s==null?void 0:s.in),r=n.getMonth();return n.setFullYear(n.getFullYear(),r+1,0),n.setHours(23,59,59,999),n}function Vx(t,s){const n=pe(t,s==null?void 0:s.in);return+Kx(n,s)==+fd(n,s)}function Gx(t,s,n){const[r,a,o]=Zt(n==null?void 0:n.in,t,t,s),i=ar(a,o),l=Math.abs(Xa(a,o));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-i*l);let d=ar(a,o)===-i;Vx(r)&&l===1&&ar(r,o)===1&&(d=!1);const c=i*(l-+d);return c===0?0:c}function Qx(t,s,n){const r=Ux(t,s)/1e3;return Hx(n==null?void 0:n.roundingMethod)(r)}function hd(t,s){const[n,r]=Zt(t,s.start,s.end);return{start:n,end:r}}function Xx(t,s){const{start:n,end:r}=hd(s==null?void 0:s.in,t);let a=+n>+r;const o=a?+n:+r,i=a?r:n;i.setHours(0,0,0,0),i.setDate(1);let l=1;const d=[];for(;+i<=o;)d.push(Oe(n,i)),i.setMonth(i.getMonth()+l);return a?d.reverse():d}function Jx(t,s){const n=pe(t,s==null?void 0:s.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Zx(t,s){const n=pe(t,s==null?void 0:s.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function xd(t,s){const n=pe(t,s==null?void 0:s.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function ep(t,s){const{start:n,end:r}=hd(s==null?void 0:s.in,t);let a=+n>+r;const o=a?+n:+r,i=a?r:n;i.setHours(0,0,0,0),i.setMonth(0,1);let l=1;const d=[];for(;+i<=o;)d.push(Oe(n,i)),i.setFullYear(i.getFullYear()+l);return a?d.reverse():d}function pd(t,s){var l,d,c,u;const n=nn(),r=(s==null?void 0:s.weekStartsOn)??((d=(l=s==null?void 0:s.locale)==null?void 0:l.options)==null?void 0:d.weekStartsOn)??n.weekStartsOn??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.weekStartsOn)??0,a=pe(t,s==null?void 0:s.in),o=a.getDay(),i=(o<r?-7:0)+6-(o-r);return a.setDate(a.getDate()+i),a.setHours(23,59,59,999),a}function tp(t,s){return pd(t,{...s,weekStartsOn:1})}const sp={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},np=(t,s,n)=>{let r;const a=sp[t];return typeof a=="string"?r=a:s===1?r=a.one:r=a.other.replace("{{count}}",s.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function Jr(t){return(s={})=>{const n=s.width?String(s.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const rp={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ap={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},op={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ip={date:Jr({formats:rp,defaultWidth:"full"}),time:Jr({formats:ap,defaultWidth:"full"}),dateTime:Jr({formats:op,defaultWidth:"full"})},lp={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},dp=(t,s,n,r)=>lp[t];function bn(t){return(s,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&t.formattingValues){const i=t.defaultFormattingWidth||t.defaultWidth,l=n!=null&&n.width?String(n.width):i;a=t.formattingValues[l]||t.formattingValues[i]}else{const i=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;a=t.values[l]||t.values[i]}const o=t.argumentCallback?t.argumentCallback(s):s;return a[o]}}const cp={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},up={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},mp={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},fp={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},hp={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},xp={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},pp=(t,s)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},gp={ordinalNumber:pp,era:bn({values:cp,defaultWidth:"wide"}),quarter:bn({values:up,defaultWidth:"wide",argumentCallback:t=>t-1}),month:bn({values:mp,defaultWidth:"wide"}),day:bn({values:fp,defaultWidth:"wide"}),dayPeriod:bn({values:hp,defaultWidth:"wide",formattingValues:xp,defaultFormattingWidth:"wide"})};function yn(t){return(s,n={})=>{const r=n.width,a=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],o=s.match(a);if(!o)return null;const i=o[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],d=Array.isArray(l)?yp(l,m=>m.test(i)):bp(l,m=>m.test(i));let c;c=t.valueCallback?t.valueCallback(d):d,c=n.valueCallback?n.valueCallback(c):c;const u=s.slice(i.length);return{value:c,rest:u}}}function bp(t,s){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&s(t[n]))return n}function yp(t,s){for(let n=0;n<t.length;n++)if(s(t[n]))return n}function vp(t){return(s,n={})=>{const r=s.match(t.matchPattern);if(!r)return null;const a=r[0],o=s.match(t.parsePattern);if(!o)return null;let i=t.valueCallback?t.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const l=s.slice(a.length);return{value:i,rest:l}}}const jp=/^(\d+)(th|st|nd|rd)?/i,wp=/\d+/i,Np={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},kp={any:[/^b/i,/^(a|c)/i]},Sp={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Cp={any:[/1/i,/2/i,/3/i,/4/i]},Mp={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},Dp={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},_p={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Ep={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Op={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},Tp={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Pp={ordinalNumber:vp({matchPattern:jp,parsePattern:wp,valueCallback:t=>parseInt(t,10)}),era:yn({matchPatterns:Np,defaultMatchWidth:"wide",parsePatterns:kp,defaultParseWidth:"any"}),quarter:yn({matchPatterns:Sp,defaultMatchWidth:"wide",parsePatterns:Cp,defaultParseWidth:"any",valueCallback:t=>t+1}),month:yn({matchPatterns:Mp,defaultMatchWidth:"wide",parsePatterns:Dp,defaultParseWidth:"any"}),day:yn({matchPatterns:_p,defaultMatchWidth:"wide",parsePatterns:Ep,defaultParseWidth:"any"}),dayPeriod:yn({matchPatterns:Op,defaultMatchWidth:"any",parsePatterns:Tp,defaultParseWidth:"any"})},cs={code:"en-US",formatDistance:np,formatLong:ip,formatRelative:dp,localize:gp,match:Pp,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Ap(t,s){const n=pe(t,s==null?void 0:s.in);return Va(n,xd(n))+1}function Ja(t,s){const n=pe(t,s==null?void 0:s.in),r=+Sn(n)-+Fx(n);return Math.round(r/dd)+1}function gd(t,s){var u,m,f,h;const n=pe(t,s==null?void 0:s.in),r=n.getFullYear(),a=nn(),o=(s==null?void 0:s.firstWeekContainsDate)??((m=(u=s==null?void 0:s.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??a.firstWeekContainsDate??((h=(f=a.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,i=Oe((s==null?void 0:s.in)||t,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const l=Ys(i,s),d=Oe((s==null?void 0:s.in)||t,0);d.setFullYear(r,0,o),d.setHours(0,0,0,0);const c=Ys(d,s);return+n>=+l?r+1:+n>=+c?r:r-1}function $p(t,s){var l,d,c,u;const n=nn(),r=(s==null?void 0:s.firstWeekContainsDate)??((d=(l=s==null?void 0:s.locale)==null?void 0:l.options)==null?void 0:d.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(c=n.locale)==null?void 0:c.options)==null?void 0:u.firstWeekContainsDate)??1,a=gd(t,s),o=Oe((s==null?void 0:s.in)||t,0);return o.setFullYear(a,0,r),o.setHours(0,0,0,0),Ys(o,s)}function Za(t,s){const n=pe(t,s==null?void 0:s.in),r=+Ys(n,s)-+$p(n,s);return Math.round(r/dd)+1}function be(t,s){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(s,"0");return n+r}const Lt={y(t,s){const n=t.getFullYear(),r=n>0?n:1-n;return be(s==="yy"?r%100:r,s.length)},M(t,s){const n=t.getMonth();return s==="M"?String(n+1):be(n+1,2)},d(t,s){return be(t.getDate(),s.length)},a(t,s){const n=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,s){return be(t.getHours()%12||12,s.length)},H(t,s){return be(t.getHours(),s.length)},m(t,s){return be(t.getMinutes(),s.length)},s(t,s){return be(t.getSeconds(),s.length)},S(t,s){const n=s.length,r=t.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return be(a,s.length)}},Ts={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Io={G:function(t,s,n){const r=t.getFullYear()>0?1:0;switch(s){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,s,n){if(s==="yo"){const r=t.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Lt.y(t,s)},Y:function(t,s,n,r){const a=gd(t,r),o=a>0?a:1-a;if(s==="YY"){const i=o%100;return be(i,2)}return s==="Yo"?n.ordinalNumber(o,{unit:"year"}):be(o,s.length)},R:function(t,s){const n=ud(t);return be(n,s.length)},u:function(t,s){const n=t.getFullYear();return be(n,s.length)},Q:function(t,s,n){const r=Math.ceil((t.getMonth()+1)/3);switch(s){case"Q":return String(r);case"QQ":return be(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,s,n){const r=Math.ceil((t.getMonth()+1)/3);switch(s){case"q":return String(r);case"qq":return be(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,s,n){const r=t.getMonth();switch(s){case"M":case"MM":return Lt.M(t,s);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,s,n){const r=t.getMonth();switch(s){case"L":return String(r+1);case"LL":return be(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,s,n,r){const a=Za(t,r);return s==="wo"?n.ordinalNumber(a,{unit:"week"}):be(a,s.length)},I:function(t,s,n){const r=Ja(t);return s==="Io"?n.ordinalNumber(r,{unit:"week"}):be(r,s.length)},d:function(t,s,n){return s==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):Lt.d(t,s)},D:function(t,s,n){const r=Ap(t);return s==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):be(r,s.length)},E:function(t,s,n){const r=t.getDay();switch(s){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,s,n,r){const a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(s){case"e":return String(o);case"ee":return be(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,s,n,r){const a=t.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(s){case"c":return String(o);case"cc":return be(o,s.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,s,n){const r=t.getDay(),a=r===0?7:r;switch(s){case"i":return String(a);case"ii":return be(a,s.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,s,n){const a=t.getHours()/12>=1?"pm":"am";switch(s){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,s,n){const r=t.getHours();let a;switch(r===12?a=Ts.noon:r===0?a=Ts.midnight:a=r/12>=1?"pm":"am",s){case"b":case"bb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(t,s,n){const r=t.getHours();let a;switch(r>=17?a=Ts.evening:r>=12?a=Ts.afternoon:r>=4?a=Ts.morning:a=Ts.night,s){case"B":case"BB":case"BBB":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(t,s,n){if(s==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Lt.h(t,s)},H:function(t,s,n){return s==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):Lt.H(t,s)},K:function(t,s,n){const r=t.getHours()%12;return s==="Ko"?n.ordinalNumber(r,{unit:"hour"}):be(r,s.length)},k:function(t,s,n){let r=t.getHours();return r===0&&(r=24),s==="ko"?n.ordinalNumber(r,{unit:"hour"}):be(r,s.length)},m:function(t,s,n){return s==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):Lt.m(t,s)},s:function(t,s,n){return s==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):Lt.s(t,s)},S:function(t,s){return Lt.S(t,s)},X:function(t,s,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(s){case"X":return Fo(r);case"XXXX":case"XX":return ls(r);case"XXXXX":case"XXX":default:return ls(r,":")}},x:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"x":return Fo(r);case"xxxx":case"xx":return ls(r);case"xxxxx":case"xxx":default:return ls(r,":")}},O:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+zo(r,":");case"OOOO":default:return"GMT"+ls(r,":")}},z:function(t,s,n){const r=t.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+zo(r,":");case"zzzz":default:return"GMT"+ls(r,":")}},t:function(t,s,n){const r=Math.trunc(+t/1e3);return be(r,s.length)},T:function(t,s,n){return be(+t,s.length)}};function zo(t,s=""){const n=t>0?"-":"+",r=Math.abs(t),a=Math.trunc(r/60),o=r%60;return o===0?n+String(a):n+String(a)+s+be(o,2)}function Fo(t,s){return t%60===0?(t>0?"-":"+")+be(Math.abs(t)/60,2):ls(t,s)}function ls(t,s=""){const n=t>0?"-":"+",r=Math.abs(t),a=be(Math.trunc(r/60),2),o=be(r%60,2);return n+a+s+o}const Wo=(t,s)=>{switch(t){case"P":return s.date({width:"short"});case"PP":return s.date({width:"medium"});case"PPP":return s.date({width:"long"});case"PPPP":default:return s.date({width:"full"})}},bd=(t,s)=>{switch(t){case"p":return s.time({width:"short"});case"pp":return s.time({width:"medium"});case"ppp":return s.time({width:"long"});case"pppp":default:return s.time({width:"full"})}},Rp=(t,s)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return Wo(t,s);let o;switch(r){case"P":o=s.dateTime({width:"short"});break;case"PP":o=s.dateTime({width:"medium"});break;case"PPP":o=s.dateTime({width:"long"});break;case"PPPP":default:o=s.dateTime({width:"full"});break}return o.replace("{{date}}",Wo(r,s)).replace("{{time}}",bd(a,s))},Ip={p:bd,P:Rp},zp=/^D+$/,Fp=/^Y+$/,Wp=["D","DD","YY","YYYY"];function qp(t){return zp.test(t)}function Bp(t){return Fp.test(t)}function Lp(t,s,n){const r=Yp(t,s,n);if(console.warn(r),Wp.includes(t))throw new RangeError(r)}function Yp(t,s,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${s}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Hp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Up=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Kp=/^'([^]*?)'?$/,Vp=/''/g,Gp=/[a-zA-Z]/;function oe(t,s,n){var u,m,f,h,g,y,S,b;const r=nn(),a=(n==null?void 0:n.locale)??r.locale??cs,o=(n==null?void 0:n.firstWeekContainsDate)??((m=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:m.firstWeekContainsDate)??r.firstWeekContainsDate??((h=(f=r.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,i=(n==null?void 0:n.weekStartsOn)??((y=(g=n==null?void 0:n.locale)==null?void 0:g.options)==null?void 0:y.weekStartsOn)??r.weekStartsOn??((b=(S=r.locale)==null?void 0:S.options)==null?void 0:b.weekStartsOn)??0,l=pe(t,n==null?void 0:n.in);if(!Yx(l))throw new RangeError("Invalid time value");let d=s.match(Up).map(w=>{const j=w[0];if(j==="p"||j==="P"){const v=Ip[j];return v(w,a.formatLong)}return w}).join("").match(Hp).map(w=>{if(w==="''")return{isToken:!1,value:"'"};const j=w[0];if(j==="'")return{isToken:!1,value:Qp(w)};if(Io[j])return{isToken:!0,value:w};if(j.match(Gp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+j+"`");return{isToken:!1,value:w}});a.localize.preprocessor&&(d=a.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return d.map(w=>{if(!w.isToken)return w.value;const j=w.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Bp(j)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&qp(j))&&Lp(j,s,String(t));const v=Io[j[0]];return v(l,j,a.localize,c)}).join("")}function Qp(t){const s=t.match(Kp);return s?s[1].replace(Vp,"'"):t}function Xp(t,s,n){const r=nn(),a=(n==null?void 0:n.locale)??r.locale??cs,o=2520,i=ar(t,s);if(isNaN(i))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:i}),[d,c]=Zt(n==null?void 0:n.in,...i>0?[s,t]:[t,s]),u=Qx(c,d),m=(ir(c)-ir(d))/1e3,f=Math.round((u-m)/60);let h;if(f<2)return n!=null&&n.includeSeconds?u<5?a.formatDistance("lessThanXSeconds",5,l):u<10?a.formatDistance("lessThanXSeconds",10,l):u<20?a.formatDistance("lessThanXSeconds",20,l):u<40?a.formatDistance("halfAMinute",0,l):u<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):f===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",f,l);if(f<45)return a.formatDistance("xMinutes",f,l);if(f<90)return a.formatDistance("aboutXHours",1,l);if(f<$o){const g=Math.round(f/60);return a.formatDistance("aboutXHours",g,l)}else{if(f<o)return a.formatDistance("xDays",1,l);if(f<er){const g=Math.round(f/$o);return a.formatDistance("xDays",g,l)}else if(f<er*2)return h=Math.round(f/er),a.formatDistance("aboutXMonths",h,l)}if(h=Gx(c,d),h<12){const g=Math.round(f/er);return a.formatDistance("xMonths",g,l)}else{const g=h%12,y=Math.trunc(h/12);return g<3?a.formatDistance("aboutXYears",y,l):g<9?a.formatDistance("overXYears",y,l):a.formatDistance("almostXYears",y+1,l)}}function Jp(t,s){return Xp(t,Ga(t),s)}function Zp(t,s){const n=pe(t,s==null?void 0:s.in),r=n.getFullYear(),a=n.getMonth(),o=Oe(n,0);return o.setFullYear(r,a+1,0),o.setHours(0,0,0,0),o.getDate()}function eg(t,s){return pe(t,s==null?void 0:s.in).getMonth()}function tg(t,s){return pe(t,s==null?void 0:s.in).getFullYear()}function sg(t,s){return+pe(t)>+pe(s)}function ng(t,s){return+pe(t)<+pe(s)}function rg(t,s,n){const[r,a]=Zt(n==null?void 0:n.in,t,s);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function ag(t,s,n){const[r,a]=Zt(n==null?void 0:n.in,t,s);return r.getFullYear()===a.getFullYear()}function og(t,s){return Qa(Oe(t,t),Ga(t))}function ig(t,s,n){return Ka(t,-1,n)}function lg(t,s){return Qa(Oe(t,t),ig(Ga(t)))}function dg(t,s,n){const r=pe(t,n==null?void 0:n.in),a=r.getFullYear(),o=r.getDate(),i=Oe(t,0);i.setFullYear(a,s,15),i.setHours(0,0,0,0);const l=Zp(i);return r.setMonth(s,Math.min(o,l)),r}function cg(t,s,n){const r=pe(t,n==null?void 0:n.in);return isNaN(+r)?Oe(t,NaN):(r.setFullYear(s),r)}function ug(){const[t,s]=x.useState(!1),[n,r]=x.useState(null),[a,o]=x.useState(""),{workspace:i}=Ge(),{data:l,isLoading:d}=zn(),c=ah(),u=He(),m=(l??[]).filter(f=>!a||f.name.toLowerCase().includes(a.toLowerCase())||f.identifier.toLowerCase().includes(a.toLowerCase()));return e.jsxs("div",{className:"p-2",children:[e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[e.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),e.jsxs(G,{size:"sm",onClick:()=>s(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"Create"]})]}),e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(G,{variant:"outline",size:"sm",className:"text-xs h-8",children:"Add filter"})}),e.jsxs("div",{className:"relative",children:[e.jsx(pr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(xe,{placeholder:"Search...",value:a,onChange:f=>o(f.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),e.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),e.jsx("span",{})]}),d?e.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(f=>e.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[e.jsx(se,{className:"h-4 w-48"}),e.jsx(se,{className:"h-4 w-12"}),e.jsx(se,{className:"h-5 w-16 rounded-full"}),e.jsx(se,{className:"h-4 w-24"}),e.jsx("div",{})]},f))}):m.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:e.jsx(xt,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium mb-1",children:a?"No projects match":"No projects yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:a?"Try a different search term.":"Create your first project to get started."}),!a&&e.jsxs(G,{size:"sm",onClick:()=>s(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"Create project"]})]}):e.jsx("div",{className:"divide-y divide-border",children:m.map(f=>e.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors group",onClick:()=>u(`/${i}/projects/${f.identifier}/board`),children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:f.name}),f.description&&e.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:f.description})]}),e.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:f.identifier}),e.jsx("div",{children:e.jsxs("span",{className:T("inline-flex items-center gap-1.5 text-xs",f.status==="active"&&"text-emerald-600",f.status==="paused"&&"text-amber-600",f.status==="archived"&&"text-muted-foreground"),children:[e.jsx("span",{className:T("h-1.5 w-1.5 rounded-full shrink-0",f.status==="active"&&"bg-emerald-500",f.status==="paused"&&"bg-amber-500",f.status==="archived"&&"bg-zinc-400")}),f.status.charAt(0).toUpperCase()+f.status.slice(1)]})}),e.jsx("span",{className:"text-sm text-muted-foreground",children:oe(new Date(f.created_at),"MMM d, yyyy")}),e.jsx("div",{className:"flex justify-end",onClick:h=>h.stopPropagation(),children:e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:e.jsx(G,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:e.jsx(Pn,{className:"h-4 w-4"})})}),e.jsxs(Jt,{align:"end",children:[e.jsxs(Ue,{onClick:()=>u(`/${i}/projects/${f.identifier}/board`),children:[e.jsx(xt,{className:"h-4 w-4"}),"Open board"]}),e.jsxs(Ue,{onClick:()=>u(`/${i}/projects/${f.identifier}/issues`),children:[e.jsx(Js,{className:"h-4 w-4"}),"View issues"]}),e.jsxs(Ue,{onClick:()=>r({id:f.id,name:f.name}),children:[e.jsx(hr,{className:"h-4 w-4"}),"Manage access"]}),e.jsx(Fn,{}),e.jsxs(Ue,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${f.name}"? This cannot be undone.`)&&c.mutate(f.id,{onSuccess:()=>R.success("Project deleted"),onError:()=>R.error("Failed to delete project")})},children:[e.jsx(Pt,{className:"h-4 w-4"}),"Delete"]})]})]})})]},f.id))}),!d&&m.length>0&&e.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[e.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",m.length," of ",m.length," result",m.length!==1?"s":""]}),e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx("span",{children:"1 of 1 pages"}),e.jsx(G,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),e.jsx(G,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),e.jsx(Px,{open:t,onClose:()=>s(!1)}),n&&e.jsx(Rx,{open:!!n,onClose:()=>r(null),projectId:n.id,projectName:n.name})]})}const eo={byProject:t=>["projects",t,"statuses"]};function rn(t){return Ne({queryKey:eo.byProject(t??""),queryFn:()=>J.get(`/admin/projects/${t}/statuses`),select:s=>s.statuses,enabled:!!t})}function mg(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/projects/${t}/statuses`,n),onSuccess:()=>{s.invalidateQueries({queryKey:eo.byProject(t)})}})}function fg(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/projects/${t}/statuses/reorder`,{orderedIds:n}),onSuccess:()=>{s.invalidateQueries({queryKey:eo.byProject(t)})}})}const to={all:["users"],list:()=>[...to.all,"list"]};function yd(){return Ne({queryKey:to.list(),queryFn:()=>J.get("/admin/users"),select:t=>t.users,staleTime:1e3*60*5})}function vd(){return Ne({queryKey:[...to.list(),"map"],queryFn:()=>J.get("/admin/users"),select:t=>new Map(t.users.map(s=>{var i;const n=s.first_name??"",r=s.last_name??"",a=`${n} ${r}`.trim()||s.email,o=(n[0]??r[0]??((i=s.email)==null?void 0:i[0])??"U").toUpperCase();return[s.id,{name:a,initials:o}]})),staleTime:1e3*60*5})}const vs={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},Tt={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},jd={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Vt={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},hg=({priority:t})=>{const s=T("h-3 w-3 shrink-0",jd[t]);switch(t){case"urgent":return e.jsx(Zs,{className:s});case"high":return e.jsx(fr,{className:s});case"medium":return e.jsx($n,{className:s});case"low":return e.jsx(mr,{className:s});default:return e.jsx(Nt,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function wd({issue:t,childCount:s=0,onClick:n}){var m,f;const{data:r}=vd(),{attributes:a,listeners:o,setNodeRef:i,transform:l,transition:d,isDragging:c}=ja({id:t.id}),u={transform:wa.Transform.toString(l),transition:d};return e.jsxs("div",{ref:i,style:u,...a,...o,onClick:n,className:T("bg-white dark:bg-card border border-border rounded-lg px-3 py-2.5 cursor-pointer select-none","hover:border-zinc-300 dark:hover:border-zinc-600 transition-colors",c&&"opacity-40 shadow-lg ring-2 ring-indigo/30"),children:[e.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:t.title}),e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx("span",{className:"text-[11px] font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:t.identifier}),t.parent_id&&e.jsx("span",{className:"flex items-center text-zinc-400 dark:text-zinc-500 shrink-0",title:"Child issue",children:e.jsx(hs,{className:"h-3 w-3"})}),s>0&&e.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:[e.jsx(hs,{className:"h-2.5 w-2.5"}),s]})]}),e.jsxs("div",{className:"flex items-center gap-1.5",children:[(t.assignee_ids??[]).length>0&&e.jsxs("div",{className:"flex -space-x-1",children:[(t.assignee_ids??[]).slice(0,2).map(h=>{const g=r==null?void 0:r.get(h);return e.jsx(st,{className:"h-4 w-4 border border-background",children:e.jsx(nt,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(g==null?void 0:g.initials)??"?"})},h)}),(((m=t.assignee_ids)==null?void 0:m.length)??0)>2&&e.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((f=t.assignee_ids)==null?void 0:f.length)??0)-2]})]}),e.jsx(hg,{priority:t.priority})]})]})]})}function tr(t,s){const n=t.replace("#",""),r=parseInt(n.substring(0,2),16),a=parseInt(n.substring(2,4),16),o=parseInt(n.substring(4,6),16);return isNaN(r)||isNaN(a)||isNaN(o)?`rgba(148,163,184,${s})`:`rgba(${r},${a},${o},${s})`}const xg=({category:t,color:s})=>{const n="h-3.5 w-3.5 shrink-0",r={color:s};switch(t){case"completed":return e.jsx(Ns,{className:n,style:r});case"started":return e.jsx(Xt,{className:n,style:r});default:return e.jsx(Nt,{className:n,style:r})}};function pg({id:t,label:s,color:n,category:r,issues:a,childCounts:o,sortable:i,onIssueClick:l}){const{setNodeRef:d,isOver:c}=Kc({id:t}),{attributes:u,listeners:m,setNodeRef:f,transform:h,transition:g,isDragging:y}=ja({id:t,disabled:!i}),S=i?{transform:wa.Transform.toString(h),transition:g}:void 0,b=tr(n,.08),w=tr(n,.16),j=tr(n,.35);return e.jsxs("div",{ref:f,style:S,className:T("flex flex-col min-w-[260px] max-w-[280px] w-full",y&&"opacity-50"),children:[e.jsxs("div",{className:T("flex items-center gap-2 mb-2 px-1",i&&"cursor-grab"),children:[i&&e.jsx("span",{...u,...m,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:e.jsx(yl,{className:"h-3.5 w-3.5"})}),e.jsx(xg,{category:r,color:n}),e.jsx("span",{className:"text-xs font-medium text-foreground",children:s}),e.jsx("span",{className:"ml-1 text-[11px] font-medium rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",style:{backgroundColor:tr(n,.12),color:n},children:a.length})]}),e.jsxs("div",{ref:d,className:T("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:c?w:b,boxShadow:c?`inset 0 0 0 1px ${j}`:void 0},children:[e.jsx(va,{items:a.map(v=>v.id),strategy:Vc,children:a.map(v=>e.jsx(wd,{issue:v,childCount:(o==null?void 0:o.get(v.id))??0,onClick:()=>l==null?void 0:l(v)},v.id))}),a.length===0&&e.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:e.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const Zr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],gg=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function bg({open:t,onClose:s,projectId:n}){const[r,a]=x.useState(""),[o,i]=x.useState(Zr[0]),[l,d]=x.useState(""),[c,u]=x.useState("started"),m=mg(n),f=l||o,h=()=>{r.trim()&&m.mutate({name:r.trim(),color:f,category:c},{onSuccess:()=>{R.success("Status created"),a(""),i(Zr[0]),d(""),u("started"),s()},onError:()=>R.error("Failed to create status")})};return e.jsx(Ms,{open:t,onOpenChange:g=>!g&&s(),children:e.jsxs(Ds,{className:"sm:max-w-sm",children:[e.jsx(en,{children:e.jsx(sn,{className:"text-sm font-medium",children:"New Status"})}),e.jsx(tn,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),e.jsx(xe,{placeholder:"e.g. In Review",value:r,onChange:g=>a(g.target.value),onKeyDown:g=>g.key==="Enter"&&h(),autoFocus:!0,className:"h-8 text-sm"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[Zr.map(g=>e.jsx("button",{onClick:()=>{i(g),d("")},className:T("h-6 w-6 rounded-full border-2 transition-transform hover:scale-110",o===g&&!l?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:g}},g)),e.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[e.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),e.jsx(xe,{placeholder:"#hex",value:l,onChange:g=>d(g.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),e.jsxs("div",{children:[e.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),e.jsxs(we,{value:c,onValueChange:g=>u(g),children:[e.jsx(ve,{className:"h-8 text-xs",children:e.jsx(Ee,{})}),e.jsx(je,{children:gg.map(g=>e.jsx(me,{value:g.value,className:"text-xs",children:g.label},g.value))})]})]})]})}),e.jsxs(Yn,{className:"mt-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:s,className:"text-xs",children:"Cancel"}),e.jsx(G,{size:"sm",onClick:h,disabled:!r.trim()||m.isPending,className:"text-xs",children:"Create"})]})]})})}function yg({projectId:t}){const[s,n]=x.useState(!1);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:e.jsxs("button",{onClick:()=>n(!0),className:"flex items-center gap-2 px-3 py-2 rounded-xl border border-dashed border-border text-muted-foreground hover:text-foreground hover:border-foreground/30 hover:bg-muted/30 transition-colors text-xs font-medium h-9",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),"Add status"]})}),e.jsx(bg,{open:s,onClose:()=>n(!1),projectId:t})]})}function ea(t,s){var r;const n={};for(const a of s)n[a.key]=[];for(const a of t)if(n[a.status]!==void 0)n[a.status].push(a);else{const o=((r=s[0])==null?void 0:r.key)??"backlog";n[o]=[...n[o]??[],a]}return n}function vg(t,s,n){var o;const r=new Map(s.map(i=>[i.id,i])),a={};for(const i of n)a[i.key]=[];for(const i of n)for(const l of t[i.key]??[]){const d=r.get(l.id);d&&d.status===i.key&&(a[i.key].push(d),r.delete(l.id))}for(const i of r.values()){const l=a[i.status];if(l)l.push(i);else{const d=(o=n[0])==null?void 0:o.key;d&&a[d].push(i)}}return a}function jg({issues:t,projectId:s,statuses:n,onIssueClick:r,onColumnsReorder:a}){const[o,i]=x.useState(()=>n.map(_=>_.id)),[l,d]=x.useState(()=>ea(t,n)),[c,u]=x.useState(null),[m,f]=x.useState(null),h=x.useRef(null),g=x.useRef(!1),y=ce(),S=x.useMemo(()=>{const _=new Map;for(const A of t)A.parent_id&&_.set(A.parent_id,(_.get(A.parent_id)??0)+1);return _},[t]);x.useEffect(()=>{g.current||d(_=>vg(_,t,n))},[t,n]);const b=[...n].sort((_,A)=>{const O=o.indexOf(_.id),$=o.indexOf(A.id);return O===-1&&$===-1?_.position-A.position:O===-1?1:$===-1?-1:O-$}),w=Ii(zi(Fi,{activationConstraint:{distance:5}})),j=x.useCallback(_=>{if(m){const A=_.droppableContainers.filter(O=>o.includes(O.id));return Gc({..._,droppableContainers:A})}return Qc(_)},[m,o]),v=x.useCallback(_=>{for(const[A,O]of Object.entries(l))if(O.some($=>$.id===_))return A;return null},[l]),C=x.useCallback(_=>n.some(A=>A.id===_),[n]),p=_=>{const A=_.active.id;if(g.current=!0,C(A)){f(A);return}for(const[O,$]of Object.entries(l)){const E=$.find(Q=>Q.id===A);if(E){u(E),h.current=O;return}}},D=_=>{const{active:A,over:O}=_;if(!O||m)return;const $=A.id,E=O.id;if(C($))return;const Q=v($),Y=n.find(L=>L.key===E||L.id===E),V=(Y==null?void 0:Y.key)??v(E);!Q||!V||Q===V||d(L=>{const F=[...L[Q]??[]],Z=[...L[V]??[]],ee=F.findIndex(K=>K.id===$);if(ee===-1)return L;const[k]=F.splice(ee,1),I={...k,status:V};if(Y)Z.push(I);else{const K=Z.findIndex(q=>q.id===E);if(K===-1)Z.push(I);else{const q=A.rect.current.translated!=null&&A.rect.current.translated.top>O.rect.top+O.rect.height/2;Z.splice(q?K+1:K,0,I)}}return{...L,[Q]:F,[V]:Z}})},P=_=>{var L;const{active:A,over:O}=_;if(u(null),g.current=!1,m){if(f(null),!O||A.id===O.id)return;const F=o.indexOf(A.id),Z=o.indexOf(O.id);if(F===-1||Z===-1||F===Z)return;const ee=rr(o,F,Z);i(ee),a==null||a(ee);return}if(!O){const F=h.current;h.current=null,F&&d(ea(t,n));return}const $=A.id,E=O.id,Q=h.current;h.current=null;const Y=n.find(F=>F.key===E||F.id===E),V=(Y==null?void 0:Y.key)??v(E);if(!(!Q||!V))if(Q===V)d(F=>{const Z=F[Q]??[],ee=Z.findIndex(I=>I.id===$),k=Z.findIndex(I=>I.id===E);return ee===-1||k===-1||ee===k?F:{...F,[Q]:rr(Z,ee,k)}});else{if(!n.find(ee=>ee.key===E||ee.id===E))d(ee=>{const k=[...ee[V]??[]],I=k.findIndex(de=>de.id===$);if(I===-1)return ee;const K=_.active.rect.current.translated!=null&&_.active.rect.current.translated.top>_.over.rect.top+_.over.rect.height/2,[q]=k.splice(I,1),M=k.findIndex(de=>de.id===E);if(M===-1)return k.splice(I,0,q),ee;const W=K?M+1:M;return k.splice(W,0,q),{...ee,[V]:k}});else{const ee=((L=_.active.rect.current.translated)==null?void 0:L.top)??1/0,k=_.over.rect.top+_.over.rect.height/2;ee<k&&d(I=>{const K=I[V]??[],q=K.findIndex(M=>M.id===$);return q<=0?I:{...I,[V]:rr(K,q,0)}})}const Z=y.getQueryData(Te.byProject(s));y.setQueryData(Te.byProject(s),ee=>ee&&{...ee,issues:ee.issues.map(k=>k.id===$?{...k,status:V}:k)}),J.put(`/admin/issues/${$}`,{status:V}).then(()=>{y.invalidateQueries({queryKey:Te.byProject(s)})}).catch(()=>{Z&&y.setQueryData(Te.byProject(s),Z),d(ea((Z==null?void 0:Z.issues)??t,n)),R.error("Failed to update issue status")})}},z=m?n.find(_=>_.id===m):null;return e.jsxs(Wi,{sensors:w,collisionDetection:j,onDragStart:p,onDragOver:D,onDragEnd:P,children:[e.jsxs("div",{className:"flex gap-4 h-full overflow-x-auto px-6 py-4 pb-6",children:[e.jsx(va,{items:o,strategy:qi,children:b.map(_=>e.jsx(pg,{id:_.id,label:_.name,color:_.color,category:_.category,issues:l[_.key]??[],childCounts:S,sortable:!0,onIssueClick:r},_.id))}),e.jsx(yg,{projectId:s})]}),e.jsxs(Xc,{children:[c&&e.jsx(wd,{issue:c}),z&&e.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:e.jsxs("div",{className:"h-9 flex items-center gap-2 px-3 rounded-xl border border-border bg-background text-xs font-medium text-foreground",children:[e.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:z.color}}),z.name]})})]})]})}const Hs={all:["sprints"],byProject:t=>["sprints","project",t],detail:t=>["sprints",t]};function an(t){return Ne({queryKey:t?Hs.byProject(t):Hs.all,queryFn:()=>{const s=t?`/admin/sprints?project_id=${t}`:"/admin/sprints";return J.get(s)},select:s=>s.sprints,enabled:!!t})}function wg(t){const s=ce();return le({mutationFn:n=>J.post("/admin/sprints",{...n,project_id:t}),onSuccess:()=>{s.invalidateQueries({queryKey:Hs.byProject(t)})}})}function Ng(t,s){const n=ce();return le({mutationFn:r=>J.put(`/admin/sprints/${t}`,r),onSuccess:()=>{n.invalidateQueries({queryKey:Hs.byProject(s)}),n.invalidateQueries({queryKey:Hs.detail(t)})}})}function kg(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/sprints/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Hs.byProject(t)})}})}const kr={byProject:t=>["task-lists","project",t]};function Un(t){return Ne({queryKey:t?kr.byProject(t):["task-lists"],queryFn:()=>J.get(`/admin/projects/${t}/task-lists`),select:s=>s.task_lists,enabled:!!t})}function Sg(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/projects/${t}/task-lists`,n),onSuccess:()=>{s.invalidateQueries({queryKey:kr.byProject(t)})}})}function Cg(t){const s=ce();return le({mutationFn:({id:n,...r})=>J.put(`/admin/task-lists/${n}`,r),onSuccess:()=>{s.invalidateQueries({queryKey:kr.byProject(t)})}})}function Mg(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/task-lists/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:kr.byProject(t)}),s.invalidateQueries({queryKey:Te.byProject(t)})}})}const Ke=Fc,Ve=Wc,Ye=x.forwardRef(({className:t,align:s="center",sideOffset:n=4,...r},a)=>e.jsx(zc,{children:e.jsx(Ti,{ref:a,align:s,sideOffset:n,className:T("z-50 w-72 rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2","data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));Ye.displayName=Ti.displayName;function qo(t,s,n){const r=(t==null?void 0:t[0])??"",a=(s==null?void 0:s[0])??"";return(r+a).toUpperCase()||((n==null?void 0:n[0])??"U").toUpperCase()}function Bo(t,s,n){return`${t??""} ${s??""}`.trim()||n}function Kn({value:t,onChange:s,disabled:n}){const[r,a]=x.useState(!1),[o,i]=x.useState(t),{data:l}=yd(),d=t.slice().sort().join(",");x.useEffect(()=>{i(t)},[d]);const c=m=>{const f=o.includes(m)?o.filter(h=>h!==m):[...o,m];i(f),s(f)},u=(l??[]).filter(m=>o.includes(m.id));return e.jsxs(Ke,{open:r,onOpenChange:a,children:[e.jsx(Ve,{asChild:!0,disabled:n,children:e.jsx("button",{type:"button",className:T("flex items-center gap-1 min-h-[28px] rounded-md px-1.5 py-1","hover:bg-accent transition-colors text-left","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",n&&"pointer-events-none opacity-50"),children:u.length===0?e.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx(Rn,{className:"h-3.5 w-3.5"}),"Assign"]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"flex -space-x-1.5",children:u.slice(0,3).map(m=>e.jsx(st,{className:"h-5 w-5 border border-background ring-0",children:e.jsx(nt,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:qo(m.first_name,m.last_name,m.email)})},m.id))}),u.length>3&&e.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",u.length-3]}),e.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:u.length===1?Bo(u[0].first_name,u[0].last_name,u[0].email):`${u.length} assignees`})]})})}),e.jsx(Ye,{className:"w-60 p-0",align:"start",children:e.jsxs(Ws,{children:[e.jsx(Ya,{placeholder:"Search users...",className:"h-8 text-xs"}),e.jsxs(qs,{children:[e.jsx(Ha,{className:"text-xs py-4",children:"No users found."}),e.jsx(ps,{children:(l??[]).map(m=>{const f=o.includes(m.id),h=Bo(m.first_name,m.last_name,m.email),g=qo(m.first_name,m.last_name,m.email);return e.jsxs(mt,{value:h,onSelect:()=>c(m.id),className:"gap-2 py-1.5",children:[e.jsx(st,{className:"h-5 w-5 shrink-0",children:e.jsx(nt,{className:"text-[9px] bg-muted text-muted-foreground",children:g})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs font-medium truncate",children:h}),e.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:m.email})]}),e.jsx(it,{className:T("h-3.5 w-3.5 shrink-0",f?"opacity-100 text-indigo-500":"opacity-0")})]},m.id)})})]})]})})]})}function Dg(t,s,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:t,timeZoneName:n}).format(s).split(/\s/g).slice(2).join(" ")}const ta={},vn={};function us(t,s){try{const r=(ta[t]||(ta[t]=new Intl.DateTimeFormat("en-US",{timeZone:t,timeZoneName:"longOffset"}).format))(s).split("GMT")[1];return r in vn?vn[r]:Lo(r,r.split(":"))}catch{if(t in vn)return vn[t];const n=t==null?void 0:t.match(_g);return n?Lo(t,n.slice(1)):NaN}}const _g=/([+-]\d\d):?(\d\d)?/;function Lo(t,s){const n=+(s[0]||0),r=+(s[1]||0),a=+(s[2]||0)/60;return vn[t]=n*60+r>0?n*60+r+a:n*60-r-a}class wt extends Date{constructor(...s){super(),s.length>1&&typeof s[s.length-1]=="string"&&(this.timeZone=s.pop()),this.internal=new Date,isNaN(us(this.timeZone,this))?this.setTime(NaN):s.length?typeof s[0]=="number"&&(s.length===1||s.length===2&&typeof s[1]!="number")?this.setTime(s[0]):typeof s[0]=="string"?this.setTime(+new Date(s[0])):s[0]instanceof Date?this.setTime(+s[0]):(this.setTime(+new Date(...s)),Nd(this),pa(this)):this.setTime(Date.now())}static tz(s,...n){return n.length?new wt(...n,s):new wt(Date.now(),s)}withTimeZone(s){return new wt(+this,s)}getTimezoneOffset(){const s=-us(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),pa(this),+this}[Symbol.for("constructDateFrom")](s){return new wt(+new Date(s),this.timeZone)}}const Yo=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(t=>{if(!Yo.test(t))return;const s=t.replace(Yo,"$1UTC");wt.prototype[s]&&(t.startsWith("get")?wt.prototype[t]=function(){return this.internal[s]()}:(wt.prototype[t]=function(){return Date.prototype[s].apply(this.internal,arguments),Eg(this),+this},wt.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),pa(this),+this}))});function pa(t){t.internal.setTime(+t),t.internal.setUTCSeconds(t.internal.getUTCSeconds()-Math.round(-us(t.timeZone,t)*60))}function Eg(t){Date.prototype.setFullYear.call(t,t.internal.getUTCFullYear(),t.internal.getUTCMonth(),t.internal.getUTCDate()),Date.prototype.setHours.call(t,t.internal.getUTCHours(),t.internal.getUTCMinutes(),t.internal.getUTCSeconds(),t.internal.getUTCMilliseconds()),Nd(t)}function Nd(t){const s=us(t.timeZone,t),n=s>0?Math.floor(s):Math.ceil(s),r=new Date(+t);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+t).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=a-o,l=Date.prototype.getHours.apply(t)!==t.internal.getUTCHours();i&&l&&t.internal.setUTCMinutes(t.internal.getUTCMinutes()+i);const d=a-n;d&&Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+d);const c=new Date(+t);c.setUTCSeconds(0);const u=a>0?c.getSeconds():(c.getSeconds()-60)%60,m=Math.round(-(us(t.timeZone,t)*60))%60;(m||u)&&(t.internal.setUTCSeconds(t.internal.getUTCSeconds()+m),Date.prototype.setUTCSeconds.call(t,Date.prototype.getUTCSeconds.call(t)+m+u));const f=us(t.timeZone,t),h=f>0?Math.floor(f):Math.ceil(f),y=-new Date(+t).getTimezoneOffset()-h,S=h!==n,b=y-d;if(S&&b){Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+b);const w=us(t.timeZone,t),j=w>0?Math.floor(w):Math.ceil(w),v=h-j;v&&(t.internal.setUTCMinutes(t.internal.getUTCMinutes()+v),Date.prototype.setUTCMinutes.call(t,Date.prototype.getUTCMinutes.call(t)+v))}}class Le extends wt{static tz(s,...n){return n.length?new Le(...n,s):new Le(Date.now(),s)}toISOString(){const[s,n,r]=this.tzComponents(),a=`${s}${n}:${r}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[s,n,r,a]=this.internal.toUTCString().split(" ");return`${s==null?void 0:s.slice(0,-1)} ${r} ${n} ${a}`}toTimeString(){const s=this.internal.toUTCString().split(" ")[4],[n,r,a]=this.tzComponents();return`${s} GMT${n}${r}${a} (${Dg(this.timeZone,this)})`}toLocaleString(s,n){return Date.prototype.toLocaleString.call(this,s,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleDateString(s,n){return Date.prototype.toLocaleDateString.call(this,s,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}toLocaleTimeString(s,n){return Date.prototype.toLocaleTimeString.call(this,s,{...n,timeZone:(n==null?void 0:n.timeZone)||this.timeZone})}tzComponents(){const s=this.getTimezoneOffset(),n=s>0?"-":"+",r=String(Math.floor(Math.abs(s)/60)).padStart(2,"0"),a=String(Math.abs(s)%60).padStart(2,"0");return[n,r,a]}withTimeZone(s){return new Le(+this,s)}[Symbol.for("constructDateFrom")](s){return new Le(+new Date(s),this.timeZone)}}const Ho=5,Og=4;function Tg(t,s){const n=s.startOfMonth(t),r=n.getDay()>0?n.getDay():7,a=s.addDays(t,-r+1),o=s.addDays(a,Ho*7-1);return s.getMonth(t)===s.getMonth(o)?Ho:Og}function kd(t,s){const n=s.startOfMonth(t),r=n.getDay();return r===1?n:r===0?s.addDays(n,-1*6):s.addDays(n,-1*(r-1))}function Pg(t,s){const n=kd(t,s),r=Tg(t,s);return s.addDays(n,r*7-1)}const Sd={...cs,labels:{labelDayButton:(t,s,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>oe(i,l,{locale:cs,...n});let o=a(t,"PPPP");return s.today&&(o=`Today, ${o}`),s.selected&&(o=`${o}, selected`),o},labelMonthDropdown:"Choose the Month",labelNext:"Go to the Next Month",labelPrevious:"Go to the Previous Month",labelWeekNumber:t=>`Week ${t}`,labelYearDropdown:"Choose the Year",labelGrid:(t,s,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,o)=>oe(a,o,{locale:cs,...s}),r(t,"LLLL yyyy")},labelGridcell:(t,s,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>oe(i,l,{locale:cs,...n});let o=a(t,"PPPP");return s!=null&&s.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(t,s,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,o)=>oe(a,o,{locale:cs,...s}),r(t,"cccc")}}};class rt{constructor(s,n){this.Date=Date,this.today=()=>{var r;return(r=this.overrides)!=null&&r.today?this.overrides.today():this.options.timeZone?Le.tz(this.options.timeZone):new this.Date},this.newDate=(r,a,o)=>{var i;return(i=this.overrides)!=null&&i.newDate?this.overrides.newDate(r,a,o):this.options.timeZone?new Le(r,a,o,this.options.timeZone):new Date(r,a,o)},this.addDays=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addDays?this.overrides.addDays(r,a):Ka(r,a)},this.addMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addMonths?this.overrides.addMonths(r,a):cd(r,a)},this.addWeeks=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addWeeks?this.overrides.addWeeks(r,a):Wx(r,a)},this.addYears=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addYears?this.overrides.addYears(r,a):qx(r,a)},this.differenceInCalendarDays=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):Va(r,a)},this.differenceInCalendarMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):Xa(r,a)},this.eachMonthOfInterval=r=>{var a;return(a=this.overrides)!=null&&a.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Xx(r)},this.eachYearOfInterval=r=>{var l;const a=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(r):ep(r),o=new Set(a.map(d=>this.getYear(d)));if(o.size===a.length)return a;const i=[];return o.forEach(d=>{i.push(new Date(d,0,1))}),i},this.endOfBroadcastWeek=r=>{var a;return(a=this.overrides)!=null&&a.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(r):Pg(r,this)},this.endOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.endOfISOWeek?this.overrides.endOfISOWeek(r):tp(r)},this.endOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.endOfMonth?this.overrides.endOfMonth(r):fd(r)},this.endOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.endOfWeek?this.overrides.endOfWeek(r,a):pd(r,this.options)},this.endOfYear=r=>{var a;return(a=this.overrides)!=null&&a.endOfYear?this.overrides.endOfYear(r):Zx(r)},this.format=(r,a,o)=>{var l;const i=(l=this.overrides)!=null&&l.format?this.overrides.format(r,a,this.options):oe(r,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(i):i},this.getISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.getISOWeek?this.overrides.getISOWeek(r):Ja(r)},this.getMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getMonth?this.overrides.getMonth(r,this.options):eg(r,this.options)},this.getYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getYear?this.overrides.getYear(r,this.options):tg(r,this.options)},this.getWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getWeek?this.overrides.getWeek(r,this.options):Za(r,this.options)},this.isAfter=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isAfter?this.overrides.isAfter(r,a):sg(r,a)},this.isBefore=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isBefore?this.overrides.isBefore(r,a):ng(r,a)},this.isDate=r=>{var a;return(a=this.overrides)!=null&&a.isDate?this.overrides.isDate(r):md(r)},this.isSameDay=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameDay?this.overrides.isSameDay(r,a):Qa(r,a)},this.isSameMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameMonth?this.overrides.isSameMonth(r,a):rg(r,a)},this.isSameYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameYear?this.overrides.isSameYear(r,a):ag(r,a)},this.max=r=>{var a;return(a=this.overrides)!=null&&a.max?this.overrides.max(r):Bx(r)},this.min=r=>{var a;return(a=this.overrides)!=null&&a.min?this.overrides.min(r):Lx(r)},this.setMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setMonth?this.overrides.setMonth(r,a):dg(r,a)},this.setYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setYear?this.overrides.setYear(r,a):cg(r,a)},this.startOfBroadcastWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):kd(r,this)},this.startOfDay=r=>{var a;return(a=this.overrides)!=null&&a.startOfDay?this.overrides.startOfDay(r):Cn(r)},this.startOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.startOfISOWeek?this.overrides.startOfISOWeek(r):Sn(r)},this.startOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.startOfMonth?this.overrides.startOfMonth(r):Jx(r)},this.startOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfWeek?this.overrides.startOfWeek(r,this.options):Ys(r,this.options)},this.startOfYear=r=>{var a;return(a=this.overrides)!=null&&a.startOfYear?this.overrides.startOfYear(r):xd(r)},this.options={locale:Sd,...s},this.overrides=n}getDigitMap(){const{numerals:s="latn"}=this.options,n=new Intl.NumberFormat("en-US",{numberingSystem:s}),r={};for(let a=0;a<10;a++)r[a.toString()]=n.format(a);return r}replaceDigits(s){const n=this.getDigitMap();return s.replace(/\d/g,r=>n[r]||r)}formatNumber(s){return this.replaceDigits(s.toString())}getMonthYearOrder(){var n;const s=(n=this.options.locale)==null?void 0:n.code;return s&&rt.yearFirstLocales.has(s)?"year-first":"month-first"}formatMonthYear(s){const{locale:n,timeZone:r,numerals:a}=this.options,o=n==null?void 0:n.code;if(o&&rt.yearFirstLocales.has(o))try{return new Intl.DateTimeFormat(o,{month:"long",year:"numeric",timeZone:r,numberingSystem:a}).format(s)}catch{}const i=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(s,i)}}rt.yearFirstLocales=new Set(["eu","hu","ja","ja-Hira","ja-JP","ko","ko-KR","lt","lt-LT","lv","lv-LV","mn","mn-MN","zh","zh-CN","zh-HK","zh-TW"]);const kt=new rt;class Cd{constructor(s,n,r=kt){this.date=s,this.displayMonth=n,this.outside=!!(n&&!r.isSameMonth(s,n)),this.dateLib=r,this.isoDate=r.format(s,"yyyy-MM-dd"),this.displayMonthId=r.format(n,"yyyy-MM"),this.dateMonthId=r.format(s,"yyyy-MM")}isEqualTo(s){return this.dateLib.isSameDay(s.date,this.date)&&this.dateLib.isSameMonth(s.displayMonth,this.displayMonth)}}class Ag{constructor(s,n){this.date=s,this.weeks=n}}class $g{constructor(s,n){this.days=n,this.weekNumber=s}}function Rg(t){return N.createElement("button",{...t})}function Ig(t){return N.createElement("span",{...t})}function zg(t){const{size:s=24,orientation:n="left",className:r}=t;return N.createElement("svg",{className:r,width:s,height:s,viewBox:"0 0 24 24"},n==="up"&&N.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&N.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&N.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&N.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Fg(t){const{day:s,modifiers:n,...r}=t;return N.createElement("td",{...r})}function Wg(t){const{day:s,modifiers:n,...r}=t,a=N.useRef(null);return N.useEffect(()=>{var o;n.focused&&((o=a.current)==null||o.focus())},[n.focused]),N.createElement("button",{ref:a,...r})}var re;(function(t){t.Root="root",t.Chevron="chevron",t.Day="day",t.DayButton="day_button",t.CaptionLabel="caption_label",t.Dropdowns="dropdowns",t.Dropdown="dropdown",t.DropdownRoot="dropdown_root",t.Footer="footer",t.MonthGrid="month_grid",t.MonthCaption="month_caption",t.MonthsDropdown="months_dropdown",t.Month="month",t.Months="months",t.Nav="nav",t.NextMonthButton="button_next",t.PreviousMonthButton="button_previous",t.Week="week",t.Weeks="weeks",t.Weekday="weekday",t.Weekdays="weekdays",t.WeekNumber="week_number",t.WeekNumberHeader="week_number_header",t.YearsDropdown="years_dropdown"})(re||(re={}));var _e;(function(t){t.disabled="disabled",t.hidden="hidden",t.outside="outside",t.focused="focused",t.today="today"})(_e||(_e={}));var ft;(function(t){t.range_end="range_end",t.range_middle="range_middle",t.range_start="range_start",t.selected="selected"})(ft||(ft={}));var et;(function(t){t.weeks_before_enter="weeks_before_enter",t.weeks_before_exit="weeks_before_exit",t.weeks_after_enter="weeks_after_enter",t.weeks_after_exit="weeks_after_exit",t.caption_after_enter="caption_after_enter",t.caption_after_exit="caption_after_exit",t.caption_before_enter="caption_before_enter",t.caption_before_exit="caption_before_exit"})(et||(et={}));function qg(t){const{options:s,className:n,components:r,classNames:a,...o}=t,i=[a[re.Dropdown],n].join(" "),l=s==null?void 0:s.find(({value:d})=>d===o.value);return N.createElement("span",{"data-disabled":o.disabled,className:a[re.DropdownRoot]},N.createElement(r.Select,{className:i,...o},s==null?void 0:s.map(({value:d,label:c,disabled:u})=>N.createElement(r.Option,{key:d,value:d,disabled:u},c))),N.createElement("span",{className:a[re.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,N.createElement(r.Chevron,{orientation:"down",size:18,className:a[re.Chevron]})))}function Bg(t){return N.createElement("div",{...t})}function Lg(t){return N.createElement("div",{...t})}function Yg(t){const{calendarMonth:s,displayIndex:n,...r}=t;return N.createElement("div",{...r},t.children)}function Hg(t){const{calendarMonth:s,displayIndex:n,...r}=t;return N.createElement("div",{...r})}function Ug(t){return N.createElement("table",{...t})}function Kg(t){return N.createElement("div",{...t})}const Md=x.createContext(void 0);function Vn(){const t=x.useContext(Md);if(t===void 0)throw new Error("useDayPicker() must be used within a custom component.");return t}function Vg(t){const{components:s}=Vn();return N.createElement(s.Dropdown,{...t})}function Gg(t){const{onPreviousClick:s,onNextClick:n,previousMonth:r,nextMonth:a,...o}=t,{components:i,classNames:l,labels:{labelPrevious:d,labelNext:c}}=Vn(),u=x.useCallback(f=>{a&&(n==null||n(f))},[a,n]),m=x.useCallback(f=>{r&&(s==null||s(f))},[r,s]);return N.createElement("nav",{...o},N.createElement(i.PreviousMonthButton,{type:"button",className:l[re.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:m},N.createElement(i.Chevron,{disabled:r?void 0:!0,className:l[re.Chevron],orientation:"left"})),N.createElement(i.NextMonthButton,{type:"button",className:l[re.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":c(a),onClick:u},N.createElement(i.Chevron,{disabled:a?void 0:!0,orientation:"right",className:l[re.Chevron]})))}function Qg(t){const{components:s}=Vn();return N.createElement(s.Button,{...t})}function Xg(t){return N.createElement("option",{...t})}function Jg(t){const{components:s}=Vn();return N.createElement(s.Button,{...t})}function Zg(t){const{rootRef:s,...n}=t;return N.createElement("div",{...n,ref:s})}function e0(t){return N.createElement("select",{...t})}function t0(t){const{week:s,...n}=t;return N.createElement("tr",{...n})}function s0(t){return N.createElement("th",{...t})}function n0(t){return N.createElement("thead",{"aria-hidden":!0},N.createElement("tr",{...t}))}function r0(t){const{week:s,...n}=t;return N.createElement("th",{...n})}function a0(t){return N.createElement("th",{...t})}function o0(t){return N.createElement("tbody",{...t})}function i0(t){const{components:s}=Vn();return N.createElement(s.Dropdown,{...t})}const l0=Object.freeze(Object.defineProperty({__proto__:null,Button:Rg,CaptionLabel:Ig,Chevron:zg,Day:Fg,DayButton:Wg,Dropdown:qg,DropdownNav:Bg,Footer:Lg,Month:Yg,MonthCaption:Hg,MonthGrid:Ug,Months:Kg,MonthsDropdown:Vg,Nav:Gg,NextMonthButton:Qg,Option:Xg,PreviousMonthButton:Jg,Root:Zg,Select:e0,Week:t0,WeekNumber:r0,WeekNumberHeader:a0,Weekday:s0,Weekdays:n0,Weeks:o0,YearsDropdown:i0},Symbol.toStringTag,{value:"Module"}));function Et(t,s,n=!1,r=kt){let{from:a,to:o}=t;const{differenceInCalendarDays:i,isSameDay:l}=r;return a&&o?(i(o,a)<0&&([a,o]=[o,a]),i(s,a)>=(n?1:0)&&i(o,s)>=(n?1:0)):!n&&o?l(o,s):!n&&a?l(a,s):!1}function so(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function Sr(t){return!!(t&&typeof t=="object"&&"from"in t)}function no(t){return!!(t&&typeof t=="object"&&"after"in t)}function ro(t){return!!(t&&typeof t=="object"&&"before"in t)}function Dd(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function _d(t,s){return Array.isArray(t)&&t.every(s.isDate)}function Ot(t,s,n=kt){const r=Array.isArray(s)?s:[s],{isSameDay:a,differenceInCalendarDays:o,isAfter:i}=n;return r.some(l=>{if(typeof l=="boolean")return l;if(n.isDate(l))return a(t,l);if(_d(l,n))return l.some(d=>a(t,d));if(Sr(l))return Et(l,t,!1,n);if(Dd(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(t.getDay()):l.dayOfWeek===t.getDay();if(so(l)){const d=o(l.before,t),c=o(l.after,t),u=d>0,m=c<0;return i(l.before,l.after)?m&&u:u||m}return no(l)?o(t,l.after)>0:ro(l)?o(l.before,t)>0:typeof l=="function"?l(t):!1})}function d0(t,s,n,r,a){const{disabled:o,hidden:i,modifiers:l,showOutsideDays:d,broadcastCalendar:c,today:u=a.today()}=s,{isSameDay:m,isSameMonth:f,startOfMonth:h,isBefore:g,endOfMonth:y,isAfter:S}=a,b=n&&h(n),w=r&&y(r),j={[_e.focused]:[],[_e.outside]:[],[_e.disabled]:[],[_e.hidden]:[],[_e.today]:[]},v={};for(const C of t){const{date:p,displayMonth:D}=C,P=!!(D&&!f(p,D)),z=!!(b&&g(p,b)),_=!!(w&&S(p,w)),A=!!(o&&Ot(p,o,a)),O=!!(i&&Ot(p,i,a))||z||_||!c&&!d&&P||c&&d===!1&&P,$=m(p,u);P&&j.outside.push(C),A&&j.disabled.push(C),O&&j.hidden.push(C),$&&j.today.push(C),l&&Object.keys(l).forEach(E=>{const Q=l==null?void 0:l[E];Q&&Ot(p,Q,a)&&(v[E]?v[E].push(C):v[E]=[C])})}return C=>{const p={[_e.focused]:!1,[_e.disabled]:!1,[_e.hidden]:!1,[_e.outside]:!1,[_e.today]:!1},D={};for(const P in j){const z=j[P];p[P]=z.some(_=>_===C)}for(const P in v)D[P]=v[P].some(z=>z===C);return{...p,...D}}}function c0(t,s,n={}){return Object.entries(t).filter(([,a])=>a===!0).reduce((a,[o])=>(n[o]?a.push(n[o]):s[_e[o]]?a.push(s[_e[o]]):s[ft[o]]&&a.push(s[ft[o]]),a),[s[re.Day]])}function u0(t){return{...l0,...t}}function m0(t){const s={"data-mode":t.mode??void 0,"data-required":"required"in t?t.required:void 0,"data-multiple-months":t.numberOfMonths&&t.numberOfMonths>1||void 0,"data-week-numbers":t.showWeekNumber||void 0,"data-broadcast-calendar":t.broadcastCalendar||void 0,"data-nav-layout":t.navLayout||void 0};return Object.entries(t).forEach(([n,r])=>{n.startsWith("data-")&&(s[n]=r)}),s}function f0(){const t={};for(const s in re)t[re[s]]=`rdp-${re[s]}`;for(const s in _e)t[_e[s]]=`rdp-${_e[s]}`;for(const s in ft)t[ft[s]]=`rdp-${ft[s]}`;for(const s in et)t[et[s]]=`rdp-${et[s]}`;return t}function Ed(t,s,n){return(n??new rt(s)).formatMonthYear(t)}const h0=Ed;function x0(t,s,n){return(n??new rt(s)).format(t,"d")}function p0(t,s=kt){return s.format(t,"LLLL")}function g0(t,s,n){return(n??new rt(s)).format(t,"cccccc")}function b0(t,s=kt){return t<10?s.formatNumber(`0${t.toLocaleString()}`):s.formatNumber(`${t.toLocaleString()}`)}function y0(){return""}function Od(t,s=kt){return s.format(t,"yyyy")}const v0=Od,j0=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:Ed,formatDay:x0,formatMonthCaption:h0,formatMonthDropdown:p0,formatWeekNumber:b0,formatWeekNumberHeader:y0,formatWeekdayName:g0,formatYearCaption:v0,formatYearDropdown:Od},Symbol.toStringTag,{value:"Module"}));function w0(t){return t!=null&&t.formatMonthCaption&&!t.formatCaption&&(t.formatCaption=t.formatMonthCaption),t!=null&&t.formatYearCaption&&!t.formatYearDropdown&&(t.formatYearDropdown=t.formatYearCaption),{...j0,...t}}function ao(t,s,n,r){let a=(r??new rt(n)).format(t,"PPPP");return s.today&&(a=`Today, ${a}`),s.selected&&(a=`${a}, selected`),a}const N0=ao;function oo(t,s,n){return(n??new rt(s)).formatMonthYear(t)}const k0=oo;function Td(t,s,n,r){let a=(r??new rt(n)).format(t,"PPPP");return s!=null&&s.today&&(a=`Today, ${a}`),a}function Pd(t){return"Choose the Month"}function Ad(){return""}const S0="Go to the Next Month";function $d(t,s){return S0}function Rd(t){return"Go to the Previous Month"}function Id(t,s,n){return(n??new rt(s)).format(t,"cccc")}function zd(t,s){return`Week ${t}`}function Fd(t){return"Week Number"}function Wd(t){return"Choose the Year"}const C0=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:k0,labelDay:N0,labelDayButton:ao,labelGrid:oo,labelGridcell:Td,labelMonthDropdown:Pd,labelNav:Ad,labelNext:$d,labelPrevious:Rd,labelWeekNumber:zd,labelWeekNumberHeader:Fd,labelWeekday:Id,labelYearDropdown:Wd},Symbol.toStringTag,{value:"Module"})),ut=(t,s,n)=>s||(n?typeof n=="function"?n:(...r)=>n:t);function M0(t,s){var r;const n=((r=s.locale)==null?void 0:r.labels)??{};return{...C0,...t??{},labelDayButton:ut(ao,t==null?void 0:t.labelDayButton,n.labelDayButton),labelMonthDropdown:ut(Pd,t==null?void 0:t.labelMonthDropdown,n.labelMonthDropdown),labelNext:ut($d,t==null?void 0:t.labelNext,n.labelNext),labelPrevious:ut(Rd,t==null?void 0:t.labelPrevious,n.labelPrevious),labelWeekNumber:ut(zd,t==null?void 0:t.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:ut(Wd,t==null?void 0:t.labelYearDropdown,n.labelYearDropdown),labelGrid:ut(oo,t==null?void 0:t.labelGrid,n.labelGrid),labelGridcell:ut(Td,t==null?void 0:t.labelGridcell,n.labelGridcell),labelNav:ut(Ad,t==null?void 0:t.labelNav,n.labelNav),labelWeekNumberHeader:ut(Fd,t==null?void 0:t.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:ut(Id,t==null?void 0:t.labelWeekday,n.labelWeekday)}}function D0(t,s,n,r,a){const{startOfMonth:o,startOfYear:i,endOfYear:l,eachMonthOfInterval:d,getMonth:c}=a;return d({start:i(t),end:l(t)}).map(f=>{const h=r.formatMonthDropdown(f,a),g=c(f),y=s&&f<o(s)||n&&f>o(n)||!1;return{value:g,label:h,disabled:y}})}function _0(t,s={},n={}){let r={...s==null?void 0:s[re.Day]};return Object.entries(t).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n==null?void 0:n[a]}}),r}function E0(t,s,n,r){const a=r??t.today(),o=n?t.startOfBroadcastWeek(a,t):s?t.startOfISOWeek(a):t.startOfWeek(a),i=[];for(let l=0;l<7;l++){const d=t.addDays(o,l);i.push(d)}return i}function O0(t,s,n,r,a=!1){if(!t||!s)return;const{startOfYear:o,endOfYear:i,eachYearOfInterval:l,getYear:d}=r,c=o(t),u=i(s),m=l({start:c,end:u});return a&&m.reverse(),m.map(f=>{const h=n.formatYearDropdown(f,r);return{value:d(f),label:h,disabled:!1}})}function T0(t,s={}){var l;const{weekStartsOn:n,locale:r}=s,a=n??((l=r==null?void 0:r.options)==null?void 0:l.weekStartsOn)??0,o=d=>{const c=typeof d=="number"||typeof d=="string"?new Date(d):d;return new Le(c.getFullYear(),c.getMonth(),c.getDate(),12,0,0,t)},i=d=>{const c=o(d);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>o(Le.tz(t)),newDate:(d,c,u)=>new Le(d,c,u,12,0,0,t),startOfDay:d=>o(d),startOfWeek:(d,c)=>{const u=o(d),m=(c==null?void 0:c.weekStartsOn)??a,f=(u.getDay()-m+7)%7;return u.setDate(u.getDate()-f),u},startOfISOWeek:d=>{const c=o(d),u=(c.getDay()-1+7)%7;return c.setDate(c.getDate()-u),c},startOfMonth:d=>{const c=o(d);return c.setDate(1),c},startOfYear:d=>{const c=o(d);return c.setMonth(0,1),c},endOfWeek:(d,c)=>{const u=o(d),h=((((c==null?void 0:c.weekStartsOn)??a)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+h),u},endOfISOWeek:d=>{const c=o(d),u=(7-c.getDay())%7;return c.setDate(c.getDate()+u),c},endOfMonth:d=>{const c=o(d);return c.setMonth(c.getMonth()+1,0),c},endOfYear:d=>{const c=o(d);return c.setMonth(11,31),c},eachMonthOfInterval:d=>{const c=o(d.start),u=o(d.end),m=[],f=new Le(c.getFullYear(),c.getMonth(),1,12,0,0,t),h=u.getFullYear()*12+u.getMonth();for(;f.getFullYear()*12+f.getMonth()<=h;)m.push(new Le(f,t)),f.setMonth(f.getMonth()+1,1);return m},addDays:(d,c)=>{const u=o(d);return u.setDate(u.getDate()+c),u},addWeeks:(d,c)=>{const u=o(d);return u.setDate(u.getDate()+c*7),u},addMonths:(d,c)=>{const u=o(d);return u.setMonth(u.getMonth()+c),u},addYears:(d,c)=>{const u=o(d);return u.setFullYear(u.getFullYear()+c),u},eachYearOfInterval:d=>{const c=o(d.start),u=o(d.end),m=[],f=new Le(c.getFullYear(),0,1,12,0,0,t);for(;f.getFullYear()<=u.getFullYear();)m.push(new Le(f,t)),f.setFullYear(f.getFullYear()+1,0,1);return m},getWeek:(d,c)=>{var m;const u=i(d);return Za(u,{weekStartsOn:(c==null?void 0:c.weekStartsOn)??a,firstWeekContainsDate:(c==null?void 0:c.firstWeekContainsDate)??((m=r==null?void 0:r.options)==null?void 0:m.firstWeekContainsDate)??1})},getISOWeek:d=>{const c=i(d);return Ja(c)},differenceInCalendarDays:(d,c)=>{const u=i(d),m=i(c);return Va(u,m)},differenceInCalendarMonths:(d,c)=>{const u=i(d),m=i(c);return Xa(u,m)}}}const Gn=t=>t instanceof HTMLElement?t:null,sa=t=>[...t.querySelectorAll("[data-animated-month]")??[]],P0=t=>Gn(t.querySelector("[data-animated-month]")),na=t=>Gn(t.querySelector("[data-animated-caption]")),ra=t=>Gn(t.querySelector("[data-animated-weeks]")),A0=t=>Gn(t.querySelector("[data-animated-nav]")),$0=t=>Gn(t.querySelector("[data-animated-weekdays]"));function R0(t,s,{classNames:n,months:r,focused:a,dateLib:o}){const i=x.useRef(null),l=x.useRef(r),d=x.useRef(!1);x.useLayoutEffect(()=>{const c=l.current;if(l.current=r,!s||!t.current||!(t.current instanceof HTMLElement)||r.length===0||c.length===0||r.length!==c.length)return;const u=o.isSameMonth(r[0].date,c[0].date),m=o.isAfter(r[0].date,c[0].date),f=m?n[et.caption_after_enter]:n[et.caption_before_enter],h=m?n[et.weeks_after_enter]:n[et.weeks_before_enter],g=i.current,y=t.current.cloneNode(!0);if(y instanceof HTMLElement?(sa(y).forEach(j=>{if(!(j instanceof HTMLElement))return;const v=P0(j);v&&j.contains(v)&&j.removeChild(v);const C=na(j);C&&C.classList.remove(f);const p=ra(j);p&&p.classList.remove(h)}),i.current=y):i.current=null,d.current||u||a)return;const S=g instanceof HTMLElement?sa(g):[],b=sa(t.current);if(b!=null&&b.every(w=>w instanceof HTMLElement)&&S&&S.every(w=>w instanceof HTMLElement)){d.current=!0,t.current.style.isolation="isolate";const w=A0(t.current);w&&(w.style.zIndex="1"),b.forEach((j,v)=>{const C=S[v];if(!C)return;j.style.position="relative",j.style.overflow="hidden";const p=na(j);p&&p.classList.add(f);const D=ra(j);D&&D.classList.add(h);const P=()=>{d.current=!1,t.current&&(t.current.style.isolation=""),w&&(w.style.zIndex=""),p&&p.classList.remove(f),D&&D.classList.remove(h),j.style.position="",j.style.overflow="",j.contains(C)&&j.removeChild(C)};C.style.pointerEvents="none",C.style.position="absolute",C.style.overflow="hidden",C.setAttribute("aria-hidden","true");const z=$0(C);z&&(z.style.opacity="0");const _=na(C);_&&(_.classList.add(m?n[et.caption_before_exit]:n[et.caption_after_exit]),_.addEventListener("animationend",P));const A=ra(C);A&&A.classList.add(m?n[et.weeks_before_exit]:n[et.weeks_after_exit]),j.insertBefore(C,j.firstChild)})}})}function I0(t,s,n,r){const a=t[0],o=t[t.length-1],{ISOWeek:i,fixedWeeks:l,broadcastCalendar:d}=n??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:m,endOfBroadcastWeek:f,endOfISOWeek:h,endOfMonth:g,endOfWeek:y,isAfter:S,startOfBroadcastWeek:b,startOfISOWeek:w,startOfWeek:j}=r,v=d?b(a,r):i?w(a):j(a),C=d?f(o):i?h(g(o)):y(g(o)),p=s&&(d?f(s):i?h(s):y(s)),D=p&&S(C,p)?p:C,P=u(D,v),z=m(o,a)+1,_=[];for(let $=0;$<=P;$++){const E=c(v,$);_.push(E)}const O=(d?35:42)*z;if(l&&_.length<O){const $=O-_.length;for(let E=0;E<$;E++){const Q=c(_[_.length-1],1);_.push(Q)}}return _}function z0(t){const s=[];return t.reduce((n,r)=>{const a=r.weeks.reduce((o,i)=>o.concat(i.days.slice()),s.slice());return n.concat(a.slice())},s.slice())}function F0(t,s,n,r){const{numberOfMonths:a=1}=n,o=[];for(let i=0;i<a;i++){const l=r.addMonths(t,i);if(s&&l>s)break;o.push(l)}return o}function Uo(t,s,n,r){const{month:a,defaultMonth:o,today:i=r.today(),numberOfMonths:l=1}=t;let d=a||o||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:m}=r;if(n&&c(n,d)<l-1){const f=-1*(l-1);d=u(n,f)}return s&&c(d,s)<0&&(d=s),m(d)}function W0(t,s,n,r){const{addDays:a,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:l,endOfWeek:d,getISOWeek:c,getWeek:u,startOfBroadcastWeek:m,startOfISOWeek:f,startOfWeek:h}=r,g=t.reduce((y,S)=>{const b=n.broadcastCalendar?m(S,r):n.ISOWeek?f(S):h(S),w=n.broadcastCalendar?o(S):n.ISOWeek?i(l(S)):d(l(S)),j=s.filter(D=>D>=b&&D<=w),v=n.broadcastCalendar?35:42;if(n.fixedWeeks&&j.length<v){const D=s.filter(P=>{const z=v-j.length;return P>w&&P<=a(w,z)});j.push(...D)}const C=j.reduce((D,P)=>{const z=n.ISOWeek?c(P):u(P),_=D.find(O=>O.weekNumber===z),A=new Cd(P,S,r);return _?_.days.push(A):D.push(new $g(z,[A])),D},[]),p=new Ag(S,C);return y.push(p),y},[]);return n.reverseMonths?g.reverse():g}function q0(t,s){let{startMonth:n,endMonth:r}=t;const{startOfYear:a,startOfDay:o,startOfMonth:i,endOfMonth:l,addYears:d,endOfYear:c,newDate:u,today:m}=s,{fromYear:f,toYear:h,fromMonth:g,toMonth:y}=t;!n&&g&&(n=g),!n&&f&&(n=s.newDate(f,0,1)),!r&&y&&(r=y),!r&&h&&(r=u(h,11,31));const S=t.captionLayout==="dropdown"||t.captionLayout==="dropdown-years";return n?n=i(n):f?n=u(f,0,1):!n&&S&&(n=a(d(t.today??m(),-100))),r?r=l(r):h?r=u(h,11,31):!r&&S&&(r=c(t.today??m())),[n&&o(n),r&&o(r)]}function B0(t,s,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:o=1}=n,{startOfMonth:i,addMonths:l,differenceInCalendarMonths:d}=r,c=a?o:1,u=i(t);if(!s)return l(u,c);if(!(d(s,t)<o))return l(u,c)}function L0(t,s,n,r){if(n.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:o}=n,{startOfMonth:i,addMonths:l,differenceInCalendarMonths:d}=r,c=a?o??1:1,u=i(t);if(!s)return l(u,-c);if(!(d(u,s)<=0))return l(u,-c)}function Y0(t){const s=[];return t.reduce((n,r)=>n.concat(r.weeks.slice()),s.slice())}function Cr(t,s){const[n,r]=x.useState(t);return[s===void 0?n:s,r]}function H0(t,s){var v;const[n,r]=q0(t,s),{startOfMonth:a,endOfMonth:o}=s,i=Uo(t,n,r,s),[l,d]=Cr(i,t.month?i:void 0);x.useEffect(()=>{const C=Uo(t,n,r,s);d(C)},[t.timeZone]);const{months:c,weeks:u,days:m,previousMonth:f,nextMonth:h}=x.useMemo(()=>{const C=F0(l,r,{numberOfMonths:t.numberOfMonths},s),p=I0(C,t.endMonth?o(t.endMonth):void 0,{ISOWeek:t.ISOWeek,fixedWeeks:t.fixedWeeks,broadcastCalendar:t.broadcastCalendar},s),D=W0(C,p,{broadcastCalendar:t.broadcastCalendar,fixedWeeks:t.fixedWeeks,ISOWeek:t.ISOWeek,reverseMonths:t.reverseMonths},s),P=Y0(D),z=z0(D),_=L0(l,n,t,s),A=B0(l,r,t,s);return{months:D,weeks:P,days:z,previousMonth:_,nextMonth:A}},[s,l.getTime(),r==null?void 0:r.getTime(),n==null?void 0:n.getTime(),t.disableNavigation,t.broadcastCalendar,(v=t.endMonth)==null?void 0:v.getTime(),t.fixedWeeks,t.ISOWeek,t.numberOfMonths,t.pagedNavigation,t.reverseMonths]),{disableNavigation:g,onMonthChange:y}=t,S=C=>u.some(p=>p.days.some(D=>D.isEqualTo(C))),b=C=>{if(g)return;let p=a(C);n&&p<a(n)&&(p=a(n)),r&&p>a(r)&&(p=a(r)),d(p),y==null||y(p)};return{months:c,weeks:u,days:m,navStart:n,navEnd:r,previousMonth:f,nextMonth:h,goToMonth:b,goToDay:C=>{S(C)||b(C.date)}}}var jt;(function(t){t[t.Today=0]="Today",t[t.Selected=1]="Selected",t[t.LastFocused=2]="LastFocused",t[t.FocusedModifier=3]="FocusedModifier"})(jt||(jt={}));function Ko(t){return!t[_e.disabled]&&!t[_e.hidden]&&!t[_e.outside]}function U0(t,s,n,r){let a,o=-1;for(const i of t){const l=s(i);Ko(l)&&(l[_e.focused]&&o<jt.FocusedModifier?(a=i,o=jt.FocusedModifier):r!=null&&r.isEqualTo(i)&&o<jt.LastFocused?(a=i,o=jt.LastFocused):n(i.date)&&o<jt.Selected?(a=i,o=jt.Selected):l[_e.today]&&o<jt.Today&&(a=i,o=jt.Today))}return a||(a=t.find(i=>Ko(s(i)))),a}function K0(t,s,n,r,a,o,i){const{ISOWeek:l,broadcastCalendar:d}=o,{addDays:c,addMonths:u,addWeeks:m,addYears:f,endOfBroadcastWeek:h,endOfISOWeek:g,endOfWeek:y,max:S,min:b,startOfBroadcastWeek:w,startOfISOWeek:j,startOfWeek:v}=i;let p={day:c,week:m,month:u,year:f,startOfWeek:D=>d?w(D,i):l?j(D):v(D),endOfWeek:D=>d?h(D):l?g(D):y(D)}[t](n,s==="after"?1:-1);return s==="before"&&r?p=S([r,p]):s==="after"&&a&&(p=b([a,p])),p}function qd(t,s,n,r,a,o,i,l=0){if(l>365)return;const d=K0(t,s,n.date,r,a,o,i),c=!!(o.disabled&&Ot(d,o.disabled,i)),u=!!(o.hidden&&Ot(d,o.hidden,i)),m=d,f=new Cd(d,m,i);return!c&&!u?f:qd(t,s,f,r,a,o,i,l+1)}function V0(t,s,n,r,a){const{autoFocus:o}=t,[i,l]=x.useState(),d=U0(s.days,n,r||(()=>!1),i),[c,u]=x.useState(o?d:void 0);return{isFocusTarget:y=>!!(d!=null&&d.isEqualTo(y)),setFocused:u,focused:c,blur:()=>{l(c),u(void 0)},moveFocus:(y,S)=>{if(!c)return;const b=qd(y,S,c,s.navStart,s.navEnd,t,a);b&&(t.disableNavigation&&!s.days.some(j=>j.isEqualTo(b))||(s.goToDay(b),u(b)))}}}function G0(t,s){const{selected:n,required:r,onSelect:a}=t,[o,i]=Cr(n,a?n:void 0),l=a?n:o,{isSameDay:d}=s,c=h=>(l==null?void 0:l.some(g=>d(g,h)))??!1,{min:u,max:m}=t;return{selected:l,select:(h,g,y)=>{let S=[...l??[]];if(c(h)){if((l==null?void 0:l.length)===u||r&&(l==null?void 0:l.length)===1)return;S=l==null?void 0:l.filter(b=>!d(b,h))}else(l==null?void 0:l.length)===m?S=[h]:S=[...S,h];return a||i(S),a==null||a(S,h,g,y),S},isSelected:c}}function Q0(t,s,n=0,r=0,a=!1,o=kt){const{from:i,to:l}=s||{},{isSameDay:d,isAfter:c,isBefore:u}=o;let m;if(!i&&!l)m={from:t,to:n>0?void 0:t};else if(i&&!l)d(i,t)?n===0?m={from:i,to:t}:a?m={from:i,to:void 0}:m=void 0:u(t,i)?m={from:t,to:i}:m={from:i,to:t};else if(i&&l)if(d(i,t)&&d(l,t))a?m={from:i,to:l}:m=void 0;else if(d(i,t))m={from:i,to:n>0?void 0:t};else if(d(l,t))m={from:t,to:n>0?void 0:t};else if(u(t,i))m={from:t,to:l};else if(c(t,i))m={from:i,to:t};else if(c(t,l))m={from:i,to:t};else throw new Error("Invalid range");if(m!=null&&m.from&&(m!=null&&m.to)){const f=o.differenceInCalendarDays(m.to,m.from);r>0&&f>r?m={from:t,to:void 0}:n>1&&f<n&&(m={from:t,to:void 0})}return m}function X0(t,s,n=kt){const r=Array.isArray(s)?s:[s];let a=t.from;const o=n.differenceInCalendarDays(t.to,t.from),i=Math.min(o,6);for(let l=0;l<=i;l++){if(r.includes(a.getDay()))return!0;a=n.addDays(a,1)}return!1}function Vo(t,s,n=kt){return Et(t,s.from,!1,n)||Et(t,s.to,!1,n)||Et(s,t.from,!1,n)||Et(s,t.to,!1,n)}function J0(t,s,n=kt){const r=Array.isArray(s)?s:[s];if(r.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:n.isDate(l)?Et(t,l,!1,n):_d(l,n)?l.some(d=>Et(t,d,!1,n)):Sr(l)?l.from&&l.to?Vo(t,{from:l.from,to:l.to},n):!1:Dd(l)?X0(t,l.dayOfWeek,n):so(l)?n.isAfter(l.before,l.after)?Vo(t,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):Ot(t.from,l,n)||Ot(t.to,l,n):no(l)||ro(l)?Ot(t.from,l,n)||Ot(t.to,l,n):!1))return!0;const i=r.filter(l=>typeof l=="function");if(i.length){let l=t.from;const d=n.differenceInCalendarDays(t.to,t.from);for(let c=0;c<=d;c++){if(i.some(u=>u(l)))return!0;l=n.addDays(l,1)}}return!1}function Z0(t,s){const{disabled:n,excludeDisabled:r,selected:a,required:o,onSelect:i}=t,[l,d]=Cr(a,i?a:void 0),c=i?a:l;return{selected:c,select:(f,h,g)=>{const{min:y,max:S}=t,b=f?Q0(f,c,y,S,o,s):void 0;return r&&n&&(b!=null&&b.from)&&b.to&&J0({from:b.from,to:b.to},n,s)&&(b.from=f,b.to=void 0),i||d(b),i==null||i(b,f,h,g),b},isSelected:f=>c&&Et(c,f,!1,s)}}function eb(t,s){const{selected:n,required:r,onSelect:a}=t,[o,i]=Cr(n,a?n:void 0),l=a?n:o,{isSameDay:d}=s;return{selected:l,select:(m,f,h)=>{let g=m;return!r&&l&&l&&d(m,l)&&(g=void 0),a||i(g),a==null||a(g,m,f,h),g},isSelected:m=>l?d(l,m):!1}}function tb(t,s){const n=eb(t,s),r=G0(t,s),a=Z0(t,s);switch(t.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function ot(t,s){return t instanceof Le&&t.timeZone===s?t:new Le(t,s)}function Ps(t,s,n){return ot(t,s)}function Go(t,s,n){return typeof t=="boolean"||typeof t=="function"?t:t instanceof Date?Ps(t,s):Array.isArray(t)?t.map(r=>r instanceof Date?Ps(r,s):r):Sr(t)?{...t,from:t.from?ot(t.from,s):t.from,to:t.to?ot(t.to,s):t.to}:so(t)?{before:Ps(t.before,s),after:Ps(t.after,s)}:no(t)?{after:Ps(t.after,s)}:ro(t)?{before:Ps(t.before,s)}:t}function aa(t,s,n){return t&&(Array.isArray(t)?t.map(r=>Go(r,s)):Go(t,s))}function sb(t){var ae;let s=t;const n=s.timeZone;if(n&&(s={...t,timeZone:n},s.today&&(s.today=ot(s.today,n)),s.month&&(s.month=ot(s.month,n)),s.defaultMonth&&(s.defaultMonth=ot(s.defaultMonth,n)),s.startMonth&&(s.startMonth=ot(s.startMonth,n)),s.endMonth&&(s.endMonth=ot(s.endMonth,n)),s.mode==="single"&&s.selected?s.selected=ot(s.selected,n):s.mode==="multiple"&&s.selected?s.selected=(ae=s.selected)==null?void 0:ae.map(X=>ot(X,n)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?ot(s.selected.from,n):s.selected.from,to:s.selected.to?ot(s.selected.to,n):s.selected.to}),s.disabled!==void 0&&(s.disabled=aa(s.disabled,n)),s.hidden!==void 0&&(s.hidden=aa(s.hidden,n)),s.modifiers)){const X={};Object.keys(s.modifiers).forEach(ne=>{var U;X[ne]=aa((U=s.modifiers)==null?void 0:U[ne],n)}),s.modifiers=X}const{components:r,formatters:a,labels:o,dateLib:i,locale:l,classNames:d}=x.useMemo(()=>{const X={...Sd,...s.locale},ne=s.broadcastCalendar?1:s.weekStartsOn,U=s.noonSafe&&s.timeZone?T0(s.timeZone,{weekStartsOn:ne,locale:X}):void 0,te=s.dateLib&&U?{...U,...s.dateLib}:s.dateLib??U,ge=new rt({locale:X,weekStartsOn:ne,firstWeekContainsDate:s.firstWeekContainsDate,useAdditionalWeekYearTokens:s.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:s.useAdditionalDayOfYearTokens,timeZone:s.timeZone,numerals:s.numerals},te);return{dateLib:ge,components:u0(s.components),formatters:w0(s.formatters),labels:M0(s.labels,ge.options),locale:X,classNames:{...f0(),...s.classNames}}},[s.locale,s.broadcastCalendar,s.weekStartsOn,s.firstWeekContainsDate,s.useAdditionalWeekYearTokens,s.useAdditionalDayOfYearTokens,s.timeZone,s.numerals,s.dateLib,s.noonSafe,s.components,s.formatters,s.labels,s.classNames]);s.today||(s={...s,today:i.today()});const{captionLayout:c,mode:u,navLayout:m,numberOfMonths:f=1,onDayBlur:h,onDayClick:g,onDayFocus:y,onDayKeyDown:S,onDayMouseEnter:b,onDayMouseLeave:w,onNextClick:j,onPrevClick:v,showWeekNumber:C,styles:p}=s,{formatCaption:D,formatDay:P,formatMonthDropdown:z,formatWeekNumber:_,formatWeekNumberHeader:A,formatWeekdayName:O,formatYearDropdown:$}=a,E=H0(s,i),{days:Q,months:Y,navStart:V,navEnd:L,previousMonth:F,nextMonth:Z,goToMonth:ee}=E,k=d0(Q,s,V,L,i),{isSelected:I,select:K,selected:q}=tb(s,i)??{},{blur:M,focused:W,isFocusTarget:de,moveFocus:ye,setFocused:$e}=V0(s,E,k,I??(()=>!1),i),{labelDayButton:Qe,labelGridcell:Rt,labelGrid:es,labelMonthDropdown:ie,labelNav:ts,labelPrevious:ss,labelNext:ns,labelWeekday:rs,labelWeekNumber:on,labelWeekNumberHeader:dt,labelYearDropdown:pt}=o,_s=x.useMemo(()=>E0(i,s.ISOWeek,s.broadcastCalendar,s.today),[i,s.ISOWeek,s.broadcastCalendar,s.today]),qe=u!==void 0||g!==void 0,as=x.useCallback(()=>{F&&(ee(F),v==null||v(F))},[F,ee,v]),It=x.useCallback(()=>{Z&&(ee(Z),j==null||j(Z))},[ee,Z,j]),Be=x.useCallback((X,ne)=>U=>{U.preventDefault(),U.stopPropagation(),$e(X),!ne.disabled&&(K==null||K(X.date,ne,U),g==null||g(X.date,ne,U))},[K,g,$e]),gt=x.useCallback((X,ne)=>U=>{$e(X),y==null||y(X.date,ne,U)},[y,$e]),zt=x.useCallback((X,ne)=>U=>{M(),h==null||h(X.date,ne,U)},[M,h]),ln=x.useCallback((X,ne)=>U=>{const te={ArrowLeft:[U.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[U.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[U.shiftKey?"year":"week","after"],ArrowUp:[U.shiftKey?"year":"week","before"],PageUp:[U.shiftKey?"year":"month","before"],PageDown:[U.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(te[U.key]){U.preventDefault(),U.stopPropagation();const[ge,B]=te[U.key];ye(ge,B)}S==null||S(X.date,ne,U)},[ye,S,s.dir]),St=x.useCallback((X,ne)=>U=>{b==null||b(X.date,ne,U)},[b]),dn=x.useCallback((X,ne)=>U=>{w==null||w(X.date,ne,U)},[w]),bt=x.useCallback(X=>ne=>{const U=Number(ne.target.value),te=i.setMonth(i.startOfMonth(X),U);ee(te)},[i,ee]),Ft=x.useCallback(X=>ne=>{const U=Number(ne.target.value),te=i.setYear(i.startOfMonth(X),U);ee(te)},[i,ee]),{className:yt,style:Es}=x.useMemo(()=>({className:[d[re.Root],s.className].filter(Boolean).join(" "),style:{...p==null?void 0:p[re.Root],...s.style}}),[d,s.className,s.style,p]),vt=m0(s),Os=x.useRef(null);R0(Os,!!s.animate,{classNames:d,months:Y,focused:W,dateLib:i});const cn={dayPickerProps:s,selected:q,select:K,isSelected:I,months:Y,nextMonth:Z,previousMonth:F,goToMonth:ee,getModifiers:k,components:r,classNames:d,styles:p,labels:o,formatters:a};return N.createElement(Md.Provider,{value:cn},N.createElement(r.Root,{rootRef:s.animate?Os:void 0,className:yt,style:Es,dir:s.dir,id:s.id,lang:s.lang,nonce:s.nonce,title:s.title,role:s.role,"aria-label":s["aria-label"],"aria-labelledby":s["aria-labelledby"],...vt},N.createElement(r.Months,{className:d[re.Months],style:p==null?void 0:p[re.Months]},!s.hideNavigation&&!m&&N.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:d[re.Nav],style:p==null?void 0:p[re.Nav],"aria-label":ts(),onPreviousClick:as,onNextClick:It,previousMonth:F,nextMonth:Z}),Y.map((X,ne)=>N.createElement(r.Month,{"data-animated-month":s.animate?"true":void 0,className:d[re.Month],style:p==null?void 0:p[re.Month],key:ne,displayIndex:ne,calendarMonth:X},m==="around"&&!s.hideNavigation&&ne===0&&N.createElement(r.PreviousMonthButton,{type:"button",className:d[re.PreviousMonthButton],tabIndex:F?void 0:-1,"aria-disabled":F?void 0:!0,"aria-label":ss(F),onClick:as,"data-animated-button":s.animate?"true":void 0},N.createElement(r.Chevron,{disabled:F?void 0:!0,className:d[re.Chevron],orientation:s.dir==="rtl"?"right":"left"})),N.createElement(r.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:d[re.MonthCaption],style:p==null?void 0:p[re.MonthCaption],calendarMonth:X,displayIndex:ne},c!=null&&c.startsWith("dropdown")?N.createElement(r.DropdownNav,{className:d[re.Dropdowns],style:p==null?void 0:p[re.Dropdowns]},(()=>{const U=c==="dropdown"||c==="dropdown-months"?N.createElement(r.MonthsDropdown,{key:"month",className:d[re.MonthsDropdown],"aria-label":ie(),classNames:d,components:r,disabled:!!s.disableNavigation,onChange:bt(X.date),options:D0(X.date,V,L,a,i),style:p==null?void 0:p[re.Dropdown],value:i.getMonth(X.date)}):N.createElement("span",{key:"month"},z(X.date,i)),te=c==="dropdown"||c==="dropdown-years"?N.createElement(r.YearsDropdown,{key:"year",className:d[re.YearsDropdown],"aria-label":pt(i.options),classNames:d,components:r,disabled:!!s.disableNavigation,onChange:Ft(X.date),options:O0(V,L,a,i,!!s.reverseYears),style:p==null?void 0:p[re.Dropdown],value:i.getYear(X.date)}):N.createElement("span",{key:"year"},$(X.date,i));return i.getMonthYearOrder()==="year-first"?[te,U]:[U,te]})(),N.createElement("span",{role:"status","aria-live":"polite",style:{border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"}},D(X.date,i.options,i))):N.createElement(r.CaptionLabel,{className:d[re.CaptionLabel],role:"status","aria-live":"polite"},D(X.date,i.options,i))),m==="around"&&!s.hideNavigation&&ne===f-1&&N.createElement(r.NextMonthButton,{type:"button",className:d[re.NextMonthButton],tabIndex:Z?void 0:-1,"aria-disabled":Z?void 0:!0,"aria-label":ns(Z),onClick:It,"data-animated-button":s.animate?"true":void 0},N.createElement(r.Chevron,{disabled:Z?void 0:!0,className:d[re.Chevron],orientation:s.dir==="rtl"?"left":"right"})),ne===f-1&&m==="after"&&!s.hideNavigation&&N.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:d[re.Nav],style:p==null?void 0:p[re.Nav],"aria-label":ts(),onPreviousClick:as,onNextClick:It,previousMonth:F,nextMonth:Z}),N.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":es(X.date,i.options,i)||void 0,className:d[re.MonthGrid],style:p==null?void 0:p[re.MonthGrid]},!s.hideWeekdays&&N.createElement(r.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:d[re.Weekdays],style:p==null?void 0:p[re.Weekdays]},C&&N.createElement(r.WeekNumberHeader,{"aria-label":dt(i.options),className:d[re.WeekNumberHeader],style:p==null?void 0:p[re.WeekNumberHeader],scope:"col"},A()),_s.map(U=>N.createElement(r.Weekday,{"aria-label":rs(U,i.options,i),className:d[re.Weekday],key:String(U),style:p==null?void 0:p[re.Weekday],scope:"col"},O(U,i.options,i)))),N.createElement(r.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:d[re.Weeks],style:p==null?void 0:p[re.Weeks]},X.weeks.map(U=>N.createElement(r.Week,{className:d[re.Week],key:U.weekNumber,style:p==null?void 0:p[re.Week],week:U},C&&N.createElement(r.WeekNumber,{week:U,style:p==null?void 0:p[re.WeekNumber],"aria-label":on(U.weekNumber,{locale:l}),className:d[re.WeekNumber],scope:"row",role:"rowheader"},_(U.weekNumber,i)),U.days.map(te=>{const{date:ge}=te,B=k(te);if(B[_e.focused]=!B.hidden&&!!(W!=null&&W.isEqualTo(te)),B[ft.selected]=(I==null?void 0:I(ge))||B.selected,Sr(q)){const{from:Ce,to:Me}=q;B[ft.range_start]=!!(Ce&&Me&&i.isSameDay(ge,Ce)),B[ft.range_end]=!!(Ce&&Me&&i.isSameDay(ge,Me)),B[ft.range_middle]=Et(q,ge,!0,i)}const fe=_0(B,p,s.modifiersStyles),he=c0(B,d,s.modifiersClassNames),Pe=!qe&&!B.hidden?Rt(ge,B,i.options,i):void 0;return N.createElement(r.Day,{key:`${te.isoDate}_${te.displayMonthId}`,day:te,modifiers:B,className:he.join(" "),style:fe,role:"gridcell","aria-selected":B.selected||void 0,"aria-label":Pe,"data-day":te.isoDate,"data-month":te.outside?te.dateMonthId:void 0,"data-selected":B.selected||void 0,"data-disabled":B.disabled||void 0,"data-hidden":B.hidden||void 0,"data-outside":te.outside||void 0,"data-focused":B.focused||void 0,"data-today":B.today||void 0},!B.hidden&&qe?N.createElement(r.DayButton,{className:d[re.DayButton],style:p==null?void 0:p[re.DayButton],type:"button",day:te,modifiers:B,disabled:!B.focused&&B.disabled||void 0,"aria-disabled":B.focused&&B.disabled||void 0,tabIndex:de(te)?0:-1,"aria-label":Qe(ge,B,i.options,i),onClick:Be(te,B),onBlur:zt(te,B),onFocus:gt(te,B),onKeyDown:ln(te,B),onMouseEnter:St(te,B),onMouseLeave:dn(te,B)},P(ge,i.options,i)):!B.hidden&&P(te.date,i.options,i))})))))))),s.footer&&N.createElement(r.Footer,{className:d[re.Footer],style:p==null?void 0:p[re.Footer],role:"status","aria-live":"polite"},s.footer)))}function lt({className:t,classNames:s,showOutsideDays:n=!0,...r}){return e.jsx(sb,{showOutsideDays:n,className:T("p-3",t),classNames:{months:"flex flex-col sm:flex-row gap-2",month:"flex flex-col gap-4",month_caption:"flex justify-center pt-1 relative items-center w-full",caption_label:"text-sm font-medium",nav:"flex items-center gap-1",button_previous:T(Fs({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:T(Fs({variant:"outline"}),"absolute right-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),month_grid:"w-full border-collapse",weekdays:"flex",weekday:"text-muted-foreground rounded-md w-8 font-normal text-[0.8rem] text-center",week:"flex w-full mt-2",day:"relative p-0 text-center text-sm focus-within:relative focus-within:z-20 [&:has([aria-selected])]:bg-accent [&:has([aria-selected].day-outside)]:bg-accent/50 rounded-md",day_button:T(Fs({variant:"ghost"}),"size-8 p-0 font-normal aria-selected:opacity-100"),selected:"[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground [&>button]:focus:bg-primary [&>button]:focus:text-primary-foreground",today:"[&>button]:bg-accent [&>button]:text-accent-foreground",outside:"day-outside text-muted-foreground [&>button]:text-muted-foreground aria-selected:text-muted-foreground",disabled:"text-muted-foreground opacity-50",hidden:"invisible",...s},components:{Chevron:({orientation:a})=>a==="left"?e.jsx(_a,{className:"h-4 w-4"}):e.jsx(Xs,{className:"h-4 w-4"})},...r})}lt.displayName="Calendar";function nb(t){if(!t.start_date&&!t.end_date)return null;const s=t.start_date?oe(new Date(t.start_date),"MMM d"):"—",n=t.end_date?oe(new Date(t.end_date),"MMM d"):"—";return`${s} – ${n}`}function Mr({open:t,onClose:s,projectId:n,defaultStatus:r="backlog",defaultTaskListId:a,defaultParentId:o}){const i=He(),{workspace:l,projectKey:d}=Ge(),{workspace:c}=ke(),[u,m]=x.useState(""),[f,h]=x.useState(""),[g,y]=x.useState(r),[S,b]=x.useState("medium"),[w,j]=x.useState("task"),[v,C]=x.useState([]),[p,D]=x.useState(""),[P,z]=x.useState(a??""),[_,A]=x.useState(void 0),[O,$]=x.useState(void 0),E=dl(),{data:Q}=rn(n),{data:Y}=an(n||void 0),{data:V}=Un(n||void 0),L=(Y??[]).filter(k=>k.status!=="completed"),F=Q&&Q.length>0?Object.fromEntries(Q.map(k=>[k.key,k.name])):vs,Z=()=>{m(""),h(""),y(r),b("medium"),j("task"),C([]),D(""),z(a??""),A(void 0),$(void 0),s()},ee=k=>{k.preventDefault(),u.trim()&&E.mutate({title:u.trim(),description:f.trim()||void 0,status:g,priority:S,type:w,project_id:n,workspace_id:c.id,assignee_ids:v.length>0?v:void 0,sprint_id:p||null,task_list_id:P||null,parent_id:o||null,start_date:_?oe(_,"yyyy-MM-dd"):null,due_date:O?oe(O,"yyyy-MM-dd"):null},{onSuccess:()=>{R.success("Issue created"),Z()},onError:I=>R.error(I.message??"Failed to create issue")})};return e.jsx(Ms,{open:t,onOpenChange:k=>!k&&Z(),children:e.jsxs(Ds,{className:"max-w-md",children:[e.jsx(en,{children:e.jsx(sn,{children:"New issue"})}),e.jsxs("form",{onSubmit:ee,className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs(tn,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{htmlFor:"issue-title",children:"Title"}),e.jsx(xe,{id:"issue-title",placeholder:"Issue title",value:u,onChange:k=>m(k.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{htmlFor:"issue-desc",children:["Description ",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsx(Nr,{id:"issue-desc",placeholder:"Add more context...",value:f,onChange:k=>h(k.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{children:"Status"}),e.jsxs(we,{value:g,onValueChange:y,children:[e.jsx(ve,{className:"h-8 text-xs",children:e.jsx(Ee,{})}),e.jsx(je,{children:Object.entries(F).map(([k,I])=>e.jsx(me,{value:k,className:"text-xs",children:I},k))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{children:"Priority"}),e.jsxs(we,{value:S,onValueChange:b,children:[e.jsx(ve,{className:"h-8 text-xs",children:e.jsx(Ee,{})}),e.jsx(je,{children:Object.entries(Tt).map(([k,I])=>e.jsx(me,{value:k,className:"text-xs",children:I},k))})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{children:"Type"}),e.jsxs(we,{value:w,onValueChange:j,children:[e.jsx(ve,{className:"h-8 text-xs",children:e.jsx(Ee,{})}),e.jsx(je,{children:Object.entries(Vt).map(([k,I])=>e.jsx(me,{value:k,className:"text-xs",children:I},k))})]})]})]}),o&&e.jsx("div",{className:"rounded-md bg-muted/50 border border-border px-3 py-2 text-xs text-muted-foreground",children:"Will be created as a child issue"}),(V??[]).length>0&&!o&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{children:["List ",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsxs(we,{value:P||"none",onValueChange:k=>z(k==="none"?"":k),children:[e.jsx(ve,{className:"h-8 text-xs",children:e.jsx(Ee,{placeholder:"No list"})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs",children:e.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(V??[]).map(k=>e.jsx(me,{value:k.id,className:"text-xs",children:k.name},k.id))]})]})]}),L.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{children:["Sprint ",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsxs(we,{value:p||"none",onValueChange:k=>D(k==="none"?"":k),children:[e.jsx(ve,{className:"h-8 text-xs",children:e.jsx(Ee,{placeholder:"No sprint"})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs",children:e.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),L.map(k=>{const I=nb(k);return e.jsx(me,{value:k.id,className:"text-xs",children:e.jsxs("div",{children:[e.jsx("span",{children:k.name}),I&&e.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:I})]})},k.id)})]})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{children:["Assignees ",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsx(Kn,{value:v,onChange:C})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{children:["Start Date ",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 w-full rounded-md border border-input px-3 text-sm bg-transparent hover:bg-accent transition-colors text-left",children:[e.jsx(ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:_?"text-foreground":"text-muted-foreground",children:_?oe(_,"MMM d, yyyy"):"No start date"}),_&&e.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),A(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(lt,{mode:"single",selected:_,onSelect:A,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{children:["Due Date ",e.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-2 h-9 w-full rounded-md border border-input px-3 text-sm bg-transparent hover:bg-accent transition-colors text-left",children:[e.jsx(ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:O?"text-foreground":"text-muted-foreground",children:O?oe(O,"MMM d, yyyy"):"No due date"}),O&&e.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),$(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(lt,{mode:"single",selected:O,onSelect:$,initialFocus:!0})})]})]})]}),e.jsxs(Yn,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsxs(G,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Z(),i(`/${l}/projects/${d}/issues/new`)},children:[e.jsx(bl,{className:"h-3.5 w-3.5"}),"Open full form"]}),e.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[e.jsx(G,{type:"button",variant:"ghost",onClick:Z,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:!u.trim()||E.isPending,children:E.isPending?"Creating...":"Create issue"})]})]})]})]})})}const io={byIssue:t=>["attachments",t]};function Bd(t){return Ne({queryKey:io.byIssue(t),queryFn:()=>J.get(`/admin/issues/${t}/attachments`),select:s=>s.attachments,enabled:!!t})}function Ld(t){const s=ce();return le({mutationFn:({file:n,commentId:r})=>{const a=new FormData;return a.append("file",n),r&&a.append("comment_id",r),J.upload(`/admin/issues/${t}/attachments`,a)},onSuccess:()=>{s.invalidateQueries({queryKey:io.byIssue(t)})}})}function rb(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/issues/${t}/attachments/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:io.byIssue(t)})}})}function Mn(t){return t.startsWith("image/")}function Dr(t){return t.startsWith("video/")}function _r(t){return t<1024?`${t} B`:t<1024*1024?`${(t/1024).toFixed(1)} KB`:`${(t/(1024*1024)).toFixed(1)} MB`}function lo(t,s){const n=document.createElement("a");n.href=t,n.download=s,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}function co({mimeType:t,className:s}){return Mn(t)?e.jsx(Fm,{className:s}):Dr(t)?e.jsx(xr,{className:s}):t.startsWith("text/")||t.includes("json")?e.jsx(zm,{className:s}):t.includes("zip")||t.includes("tar")||t.includes("gz")?e.jsx(Im,{className:s}):t.includes("pdf")||t.includes("word")||t.includes("document")?e.jsx(Wm,{className:s}):e.jsx(qm,{className:s})}function Yd({attachment:t,onClose:s}){return t?e.jsx(Ms,{open:!0,onOpenChange:n=>!n&&s(),children:e.jsxs(Ds,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[e.jsxs(en,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[e.jsx(sn,{className:"text-sm font-medium truncate",children:t.original_name}),e.jsxs(G,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>lo(t.url,t.original_name),children:[e.jsx(Oa,{className:"h-3.5 w-3.5"}),"Download"]})]}),e.jsxs(tn,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[Mn(t.mime_type)&&e.jsx("img",{src:t.url,alt:t.original_name,className:"max-w-full max-h-[75vh] object-contain"}),Dr(t.mime_type)&&e.jsx("video",{src:t.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),e.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[e.jsx("span",{children:_r(t.size)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:t.mime_type}),e.jsx("span",{children:"·"}),e.jsxs("span",{children:["Uploaded ",oe(new Date(t.created_at),"MMM d, yyyy")]})]})]})}):null}function ab({attachment:t}){const[s,n]=x.useState(null),r=Mn(t.mime_type)||Dr(t.mime_type),a=()=>{r?n(t):lo(t.url,t.original_name)};return e.jsxs(e.Fragment,{children:[Mn(t.mime_type)?e.jsx("button",{type:"button",onClick:a,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:t.original_name,children:e.jsx("img",{src:t.url,alt:t.original_name,className:"max-h-48 max-w-xs object-cover"})}):e.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-border bg-muted/40 hover:bg-muted transition-colors text-left max-w-xs",title:r?"View":"Download",children:[e.jsx(co,{mimeType:t.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-foreground truncate",children:t.original_name}),e.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:_r(t.size)}),!r&&e.jsx(Oa,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),s&&e.jsx(Yd,{attachment:s,onClose:()=>n(null)})]})}function ob({attachment:t,onOpen:s,onDelete:n,isDeleting:r}){const a=Mn(t.mime_type)||Dr(t.mime_type),o=()=>{a?s(t):lo(t.url,t.original_name)};return e.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[e.jsx("button",{type:"button",onClick:o,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground hover:bg-primary/10 hover:text-primary transition-colors",title:a?"View":"Download",children:e.jsx(co,{mimeType:t.mime_type,className:"h-4 w-4"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("button",{type:"button",onClick:o,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:t.original_name}),e.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[e.jsx("span",{children:_r(t.size)}),e.jsx("span",{children:"·"}),e.jsx("span",{children:oe(new Date(t.created_at),"MMM d, yyyy")}),t.comment_id&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("span",{className:"italic",children:"from comment"})]}),!a&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:[e.jsx(Oa,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),e.jsx(G,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all",onClick:()=>n(t.id),disabled:r,children:e.jsx(Pt,{className:"h-3.5 w-3.5"})})]})}function ib({onFiles:t,isUploading:s}){const[n,r]=x.useState(!1),a=x.useRef(null),o=x.useCallback(i=>{i.preventDefault(),r(!1);const l=Array.from(i.dataTransfer.files);l.length>0&&t(l)},[t]);return e.jsxs("div",{onDragOver:i=>{i.preventDefault(),r(!0)},onDragLeave:()=>r(!1),onDrop:o,onClick:()=>{var i;return!s&&((i=a.current)==null?void 0:i.click())},className:T("flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed px-4 py-6","cursor-pointer transition-colors",n?"border-primary/60 bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30",s&&"opacity-60 cursor-wait"),children:[e.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:e.jsx(df,{className:"h-4 w-4 text-muted-foreground"})}),e.jsx("p",{className:"text-xs font-medium text-foreground",children:s?"Uploading…":"Drop files or click to browse"}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),e.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:i=>{const l=Array.from(i.target.files??[]);l.length>0&&t(l),i.target.value=""}})]})}function lb({issueId:t,className:s}){const[n,r]=x.useState(null),{data:a,isLoading:o}=Bd(t),i=Ld(t),l=rb(t),d=u=>{u.forEach(m=>{i.mutate({file:m},{onSuccess:()=>R.success(`${m.name} uploaded`),onError:()=>R.error(`Failed to upload ${m.name}`)})})},c=u=>{l.mutate(u,{onSuccess:()=>R.success("Attachment removed"),onError:()=>R.error("Failed to remove attachment")})};return e.jsxs("div",{className:T("px-6 py-4 space-y-4",s),children:[e.jsx(ib,{onFiles:d,isUploading:i.isPending}),o?e.jsx("div",{className:"space-y-2",children:[1,2].map(u=>e.jsxs("div",{className:"flex items-center gap-3 px-3",children:[e.jsx(se,{className:"h-8 w-8 rounded-md shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(se,{className:"h-3 w-2/3"}),e.jsx(se,{className:"h-2.5 w-1/3"})]})]},u))}):a&&a.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx($a,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[a.length," ",a.length===1?"file":"files"]})]}),e.jsx("div",{children:a.map(u=>e.jsx(ob,{attachment:u,onOpen:r,onDelete:c,isDeleting:l.isPending},u.id))})]}):e.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),e.jsx(Yd,{attachment:n,onClose:()=>r(null)})]})}const Gt={byIssue:t=>["time-logs",t],activeTimer:t=>["time-logs",t,"active-timer"]};function db(t){return Ne({queryKey:Gt.byIssue(t),queryFn:()=>J.get(`/admin/issues/${t}/time-logs`),enabled:!!t})}function cb(t){return Ne({queryKey:Gt.activeTimer(t),queryFn:()=>J.get(`/admin/issues/${t}/time-logs/timer`),select:s=>s.active_timer,enabled:!!t,refetchInterval:1e4})}function ub(t){const s=ce();return le({mutationFn:n=>J.post(`/admin/issues/${t}/time-logs`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Gt.byIssue(t)})}})}function mb(t){const s=ce();return le({mutationFn:()=>J.post(`/admin/issues/${t}/time-logs/timer`,{action:"start"}),onSuccess:()=>{s.invalidateQueries({queryKey:Gt.activeTimer(t)}),s.invalidateQueries({queryKey:Gt.byIssue(t)})}})}function fb(t){const s=ce();return le({mutationFn:()=>J.post(`/admin/issues/${t}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{s.invalidateQueries({queryKey:Gt.activeTimer(t)}),s.invalidateQueries({queryKey:Gt.byIssue(t)})}})}function hb(t){const s=ce();return le({mutationFn:n=>J.delete(`/admin/issues/${t}/time-logs/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Gt.byIssue(t)})}})}const xb=Tn("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function Er({className:t,variant:s,...n}){return e.jsx("div",{className:T(xb({variant:s}),t),...n})}function ga(t){const s=Math.floor(t/60),n=t%60;return s===0?`${n}m`:n===0?`${s}h`:`${s}h ${n}m`}function Qo(t){const s=Date.now()-new Date(t).getTime(),n=Math.floor(s/1e3),r=Math.floor(n/3600),a=Math.floor(n%3600/60),o=n%60,i=String(a).padStart(2,"0"),l=String(o).padStart(2,"0");return r>0?`${r}:${i}:${l}`:`${i}:${l}`}function pb({startedAt:t}){const[s,n]=x.useState(()=>Qo(t));return x.useEffect(()=>{const r=setInterval(()=>n(Qo(t)),1e3);return()=>clearInterval(r)},[t]),e.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:s})}function gb({onSubmit:t,isPending:s,onCancel:n}){const[r,a]=x.useState(""),[o,i]=x.useState(""),[l,d]=x.useState(""),[c,u]=x.useState(new Date().toISOString().split("T")[0]),m=f=>{f.preventDefault();const h=parseInt(r||"0",10),g=parseInt(o||"0",10),y=h*60+g;if(y<=0){R.error("Please enter a duration greater than 0.");return}t({duration_minutes:y,description:l.trim()||void 0,logged_date:c||void 0})};return e.jsxs("form",{onSubmit:m,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[e.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),e.jsx(xe,{type:"number",min:"0",max:"999",placeholder:"0",value:r,onChange:f=>a(f.target.value),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),e.jsx(xe,{type:"number",min:"0",max:"59",placeholder:"0",value:o,onChange:f=>i(f.target.value),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"flex-1",children:[e.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),e.jsx(xe,{type:"date",value:c,onChange:f=>u(f.target.value),className:"h-8 text-sm"})]})]}),e.jsxs("div",{children:[e.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",e.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),e.jsx(xe,{placeholder:"What did you work on?",value:l,onChange:f=>d(f.target.value),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(G,{type:"button",variant:"ghost",size:"sm",onClick:n,className:"h-7 text-xs",children:"Cancel"}),e.jsx(G,{type:"submit",size:"sm",disabled:s,className:"h-7 text-xs",children:s?"Saving…":"Log time"})]})]})}function bb({entry:t,onDelete:s,isDeleting:n}){const r=t.started_at!=null&&t.stopped_at==null;return e.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[e.jsx("div",{className:T("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",r?"bg-emerald-50 dark:bg-emerald-950/40":"bg-muted"),children:r?e.jsx(af,{className:"h-3.5 w-3.5 text-emerald-600"}):t.source==="timer"?e.jsx(Xt,{className:"h-3.5 w-3.5 text-muted-foreground"}):e.jsx(Am,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r?e.jsx(pb,{startedAt:t.started_at}):e.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:ga(t.duration_minutes??0)}),e.jsx(Er,{variant:"muted",className:T("text-[10px] px-1.5 py-0",r?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":""),children:r?"Running":t.source==="timer"?"Timer":"Manual"})]}),t.description&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:t.description}),t.logged_date&&!r&&e.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:oe(new Date(t.logged_date),"MMM d, yyyy")})]}),!r&&e.jsx(G,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-0 group-hover:opacity-100 text-muted-foreground hover:text-destructive transition-all mt-0.5",onClick:()=>s(t.id),disabled:n,children:e.jsx(Pt,{className:"h-3.5 w-3.5"})})]})}function yb({issueId:t,className:s}){const[n,r]=x.useState(!1),{data:a,isLoading:o}=db(t),{data:i}=cb(t),l=ub(t),d=mb(t),c=fb(t),u=hb(t),m=(a==null?void 0:a.time_logs)??[],f=(a==null?void 0:a.total_minutes)??0,h=i!=null,g=w=>{l.mutate(w,{onSuccess:()=>{r(!1),R.success("Time logged")},onError:()=>R.error("Failed to log time")})},y=()=>{d.mutate(void 0,{onSuccess:()=>R.success("Timer started"),onError:w=>R.error(w.message??"Failed to start timer")})},S=()=>{c.mutate(void 0,{onSuccess:w=>{const j=w.time_log.duration_minutes??0;R.success(`Timer stopped — ${ga(j)} logged`)},onError:()=>R.error("Failed to stop timer")})},b=w=>{u.mutate(w,{onSuccess:()=>R.success("Time entry removed"),onError:()=>R.error("Failed to remove entry")})};return e.jsxs("div",{className:T("px-6 py-4 space-y-4",s),children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),e.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:f>0?ga(f):"—"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[!n&&e.jsxs(G,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>r(!0),children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),"Log time"]}),h?e.jsxs(G,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:S,disabled:c.isPending,children:[e.jsx(tf,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):e.jsxs(G,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:y,disabled:d.isPending,children:[e.jsx(xr,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),n&&e.jsx(gb,{onSubmit:g,isPending:l.isPending,onCancel:()=>r(!1)}),o?e.jsx("div",{className:"space-y-2",children:[1,2].map(w=>e.jsxs("div",{className:"flex items-center gap-3 px-3",children:[e.jsx(se,{className:"h-7 w-7 rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(se,{className:"h-3 w-1/3"}),e.jsx(se,{className:"h-2.5 w-1/4"})]})]},w))}):m.length>0?e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[e.jsx(Xt,{className:"h-3 w-3 text-muted-foreground"}),e.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[m.length," ",m.length===1?"entry":"entries"]})]}),e.jsx("div",{children:m.map(w=>e.jsx(bb,{entry:w,onDelete:b,isDeleting:u.isPending},w.id))})]}):e.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function is({onClick:t,active:s,title:n,children:r}){return e.jsx("button",{type:"button",title:n,onMouseDown:a=>{a.preventDefault(),t()},className:T("flex h-6 w-6 items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted",s&&"bg-muted text-foreground"),children:r})}function Xo(){return e.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}function Hd({issueId:t,compact:s,className:n,onSuccess:r}){const[a,o]=x.useState(!0),[i,l]=x.useState([]),[d,c]=x.useState(!1),u=x.useRef(null),m=x.useRef(async()=>{}),{user:f}=ke(),h=Mm(t),g=Ld(t),y=(f==null?void 0:f.first_name)??"",S=(f==null?void 0:f.last_name)??"",b=`${y} ${S}`.trim()||(f==null?void 0:f.email)||"?",w=f&&`${y[0]??""}${S[0]??""}`.toUpperCase()||"?",j=Ud(b),v=x.useMemo(()=>Jc.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(m.current(),!0)}}}),[]),C=Bi({extensions:[Li,Yi,Hi.configure({placeholder:"Leave a comment…"}),v],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:A}){o(A.isEmpty)}}),p=!a||i.length>0,D=A=>{l(O=>{const $=new Set(O.map(E=>`${E.name}-${E.size}`));return[...O,...A.filter(E=>!$.has(`${E.name}-${E.size}`))]})},P=A=>{l(O=>O.filter(($,E)=>E!==A))},z=async()=>{if(!(!p||d)){c(!0);try{const A=C!=null&&C.isEmpty?"":(C==null?void 0:C.getHTML())??"",$=(await h.mutateAsync(A||" ")).comment.id;for(const E of i)await g.mutateAsync({file:E,commentId:$});C==null||C.commands.clearContent(),o(!0),l([]),R.success("Comment added"),r==null||r()}catch{R.error("Failed to add comment")}finally{c(!1)}}};m.current=z;const _="h-3 w-3";return e.jsxs("div",{className:T("flex gap-3 items-start",n),children:[e.jsx(st,{className:"h-7 w-7 shrink-0 mt-1",children:e.jsx(nt,{className:T("text-[11px] font-semibold",j.bg,j.text),children:w})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:T("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[C&&e.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[e.jsx(is,{title:"Bold (⌘B)",active:C.isActive("bold"),onClick:()=>C.chain().focus().toggleBold().run(),children:e.jsx(ul,{className:_})}),e.jsx(is,{title:"Italic (⌘I)",active:C.isActive("italic"),onClick:()=>C.chain().focus().toggleItalic().run(),children:e.jsx(vl,{className:_})}),e.jsx(is,{title:"Strikethrough",active:C.isActive("strike"),onClick:()=>C.chain().focus().toggleStrike().run(),children:e.jsx(Cl,{className:_})}),e.jsx(is,{title:"Inline code",active:C.isActive("code"),onClick:()=>C.chain().focus().toggleCode().run(),children:e.jsx(gl,{className:_})}),e.jsx(Xo,{}),e.jsx(is,{title:"Bullet list",active:C.isActive("bulletList"),onClick:()=>C.chain().focus().toggleBulletList().run(),children:e.jsx(wl,{className:_})}),e.jsx(is,{title:"Ordered list",active:C.isActive("orderedList"),onClick:()=>C.chain().focus().toggleOrderedList().run(),children:e.jsx(jl,{className:_})}),e.jsx(Xo,{}),e.jsx(is,{title:"Code block",active:C.isActive("codeBlock"),onClick:()=>C.chain().focus().toggleCodeBlock().run(),children:e.jsx(pl,{className:_})})]}),e.jsx(Ui,{editor:C,className:T("px-3 py-2.5 text-sm",s?"min-h-[68px]":"min-h-[80px]")})]}),i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:i.map((A,O)=>e.jsxs("span",{className:"inline-flex items-center gap-1 pl-1.5 pr-1 py-0.5 rounded-md bg-muted border border-border text-[11px] text-foreground max-w-[180px]",children:[e.jsx(co,{mimeType:A.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:A.name}),e.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",_r(A.size),")"]}),e.jsx("button",{type:"button",onClick:()=>P(O),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:e.jsx(ze,{className:"h-3 w-3"})})]},O))}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(G,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var A;return(A=u.current)==null?void 0:A.click()},disabled:d,title:"Attach files",children:e.jsx($a,{className:"h-3.5 w-3.5"})}),e.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[e.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),e.jsx(G,{size:"icon",className:"h-8 w-8",onClick:z,disabled:!p||d,children:e.jsx(Zm,{className:"h-3.5 w-3.5"})})]}),e.jsx("input",{ref:u,type:"file",multiple:!0,className:"hidden",onChange:A=>{const O=Array.from(A.target.files??[]);O.length>0&&D(O),A.target.value=""}})]})]})}function vb({onClick:t,active:s,disabled:n,title:r,children:a}){return e.jsx("button",{type:"button",title:r,disabled:n,onMouseDown:o=>{o.preventDefault(),t()},className:T("flex h-[26px] w-[26px] items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted","disabled:opacity-30 disabled:cursor-not-allowed",s&&"bg-muted text-foreground"),children:a})}function sr(){return e.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function uo({content:t="",onChange:s,placeholder:n="Add a description…",className:r,toolbarClassName:a,editorClassName:o}){const i=Bi({extensions:[Li.configure({heading:{levels:[1,2,3]}}),Yi,Zc,eu.configure({nested:!0}),Hi.configure({placeholder:n})],content:t||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:c}){s&&s(c.isEmpty?"":c.getHTML())}});if(!i)return null;const l=(c,u,m,f,h)=>e.jsx(vb,{title:c,onClick:m,active:f,disabled:h,children:u},c),d="h-3.5 w-3.5";return e.jsxs("div",{className:T("flex flex-col overflow-hidden",r),children:[e.jsxs("div",{className:T("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",a),children:[l("Undo",e.jsx(lf,{className:d}),()=>i.chain().focus().undo().run(),!1,!i.can().undo()),l("Redo",e.jsx(Jm,{className:d}),()=>i.chain().focus().redo().run(),!1,!i.can().redo()),e.jsx(sr,{}),l("Bold (⌘B)",e.jsx(ul,{className:d}),()=>i.chain().focus().toggleBold().run(),i.isActive("bold")),l("Italic (⌘I)",e.jsx(vl,{className:d}),()=>i.chain().focus().toggleItalic().run(),i.isActive("italic")),l("Underline (⌘U)",e.jsx(of,{className:d}),()=>i.chain().focus().toggleUnderline().run(),i.isActive("underline")),l("Strikethrough",e.jsx(Cl,{className:d}),()=>i.chain().focus().toggleStrike().run(),i.isActive("strike")),l("Inline code",e.jsx(gl,{className:d}),()=>i.chain().focus().toggleCode().run(),i.isActive("code")),e.jsx(sr,{}),l("Heading 1",e.jsx(Bm,{className:d}),()=>i.chain().focus().toggleHeading({level:1}).run(),i.isActive("heading",{level:1})),l("Heading 2",e.jsx(Lm,{className:d}),()=>i.chain().focus().toggleHeading({level:2}).run(),i.isActive("heading",{level:2})),l("Heading 3",e.jsx(Ym,{className:d}),()=>i.chain().focus().toggleHeading({level:3}).run(),i.isActive("heading",{level:3})),e.jsx(sr,{}),l("Bullet list",e.jsx(wl,{className:d}),()=>i.chain().focus().toggleBulletList().run(),i.isActive("bulletList")),l("Ordered list",e.jsx(jl,{className:d}),()=>i.chain().focus().toggleOrderedList().run(),i.isActive("orderedList")),l("Task list",e.jsx(Hm,{className:d}),()=>i.chain().focus().toggleTaskList().run(),i.isActive("taskList")),e.jsx(sr,{}),l("Blockquote",e.jsx(Xm,{className:d}),()=>i.chain().focus().toggleBlockquote().run(),i.isActive("blockquote")),l("Code block",e.jsx(pl,{className:d}),()=>i.chain().focus().toggleCodeBlock().run(),i.isActive("codeBlock")),l("Divider line",e.jsx($n,{className:d}),()=>i.chain().focus().setHorizontalRule().run())]}),e.jsx(Ui,{editor:i,className:T("flex-1 px-5 py-4",o)})]})}function mo({html:t,className:s}){return t?e.jsx("div",{className:T("meridian-editor",s),dangerouslySetInnerHTML:{__html:t}}):null}const Jo=[{bg:"bg-indigo-100 dark:bg-indigo-900/50",text:"text-indigo-700 dark:text-indigo-300"},{bg:"bg-violet-100 dark:bg-violet-900/50",text:"text-violet-700 dark:text-violet-300"},{bg:"bg-emerald-100 dark:bg-emerald-900/50",text:"text-emerald-700 dark:text-emerald-300"},{bg:"bg-amber-100 dark:bg-amber-900/50",text:"text-amber-700 dark:text-amber-300"},{bg:"bg-rose-100 dark:bg-rose-900/50",text:"text-rose-700 dark:text-rose-300"},{bg:"bg-sky-100 dark:bg-sky-900/50",text:"text-sky-700 dark:text-sky-300"},{bg:"bg-teal-100 dark:bg-teal-900/50",text:"text-teal-700 dark:text-teal-300"},{bg:"bg-orange-100 dark:bg-orange-900/50",text:"text-orange-700 dark:text-orange-300"}];function Ud(t){let s=0;for(let n=0;n<t.length;n++)s=s*31+t.charCodeAt(n)&65535;return Jo[s%Jo.length]}function jb({body:t}){const s=t.trim();return s?/^<[a-z][\s\S]*>/i.test(s)?e.jsx(mo,{html:s,className:"text-xs"}):e.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:s}):null}const Zo={created:{icon:Ae,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:Ma,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:Rn,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:cf,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:Nn,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function wb(t,s){var a,o,i,l;const{action:n,changes:r}=t;if(n==="created")return"created this issue";if(n==="status_changed"){const d=(a=r==null?void 0:r.status)==null?void 0:a.from,c=(o=r==null?void 0:r.status)==null?void 0:o.to;return e.jsxs(e.Fragment,{children:["changed status",d&&e.jsxs(e.Fragment,{children:[" from ",e.jsx("strong",{className:"font-medium text-foreground",children:vs[d]??d})]}),c&&e.jsxs(e.Fragment,{children:[" to ",e.jsx("strong",{className:"font-medium text-foreground",children:vs[c]??c})]})]})}if(n==="assigned"||n==="unassigned"){const d=((i=r==null?void 0:r.assignee_ids)==null?void 0:i.to)??[],c=((l=r==null?void 0:r.assignee_ids)==null?void 0:l.from)??[],u=d.filter(h=>!c.includes(h)),m=c.filter(h=>!d.includes(h)),f=h=>{var g;return((g=s==null?void 0:s.get(h))==null?void 0:g.name)??h.slice(0,8)+"…"};return u.length>0&&m.length>0?e.jsx(e.Fragment,{children:"updated assignees"}):u.length>0?e.jsxs(e.Fragment,{children:["assigned ",e.jsx("strong",{className:"font-medium text-foreground",children:u.map(f).join(", ")})]}):m.length>0?e.jsxs(e.Fragment,{children:["unassigned ",e.jsx("strong",{className:"font-medium text-foreground",children:m.map(f).join(", ")})]}):"updated assignees"}if(n==="updated"&&r){const d=[];for(const[c,u]of Object.entries(r)){const{from:m,to:f}=u;c==="title"||c==="description"?d.push(e.jsxs("span",{children:["updated ",e.jsx("strong",{className:"font-medium text-foreground",children:c})]},c)):c==="priority"?d.push(e.jsxs("span",{children:["changed ",e.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),m!=null&&e.jsxs(e.Fragment,{children:[" from ",e.jsx("strong",{className:"font-medium text-foreground",children:Tt[m]??String(m)})]}),f!=null&&e.jsxs(e.Fragment,{children:[" to ",e.jsx("strong",{className:"font-medium text-foreground",children:Tt[f]??String(f)})]})]},c)):c==="type"?d.push(e.jsxs("span",{children:["changed ",e.jsx("strong",{className:"font-medium text-foreground",children:"type"}),m!=null&&e.jsxs(e.Fragment,{children:[" from ",e.jsx("strong",{className:"font-medium text-foreground",children:Vt[m]??String(m)})]}),f!=null&&e.jsxs(e.Fragment,{children:[" to ",e.jsx("strong",{className:"font-medium text-foreground",children:Vt[f]??String(f)})]})]},c)):d.push(e.jsxs("span",{children:["updated ",e.jsx("strong",{className:"font-medium text-foreground",children:c.replace(/_/g," ")})]},c))}return d.length===0?"made changes":e.jsx(e.Fragment,{children:d.reduce((c,u,m)=>m===0?[u]:[...c,e.jsx("span",{children:" and "},`sep-${m}`),u],[])})}return n.replace(/_/g," ")}function Kd({issueId:t,className:s,compact:n,onViewMore:r,onTabChange:a,hideCommentInput:o}){const[i,l]=x.useState("comments"),d=b=>{l(b),a==null||a(b)},{user:c}=ke(),{data:u}=vd(),{data:m,isLoading:f}=Sm(t),{data:h,isLoading:g}=Cm(t),{data:y}=Bd(t),S=b=>{var w;if(c&&b===c.id){const j=c.first_name??"",v=c.last_name??"",C=`${j} ${v}`.trim()||c.email,p=(j[0]??v[0]??((w=c.email)==null?void 0:w[0])??"U").toUpperCase();return{name:C,initials:p}}return(u==null?void 0:u.get(b))??{name:"Unknown",initials:"?"}};return e.jsxs("div",{className:s,children:[e.jsx("div",{className:"flex items-center gap-0 px-6 pt-3 border-b border-zinc-100 dark:border-zinc-800",children:["comments","activity","attachments","time"].map(b=>{const w=b==="comments"?(m==null?void 0:m.length)??0:b==="activity"?(h==null?void 0:h.length)??0:void 0,j=b==="comments"?"Comments":b==="activity"?"Activity":b==="attachments"?"Attachments":"Time",v=i===b;return e.jsxs("button",{onClick:()=>d(b),className:T("pb-2.5 mr-5 text-xs font-medium transition-colors border-b-2 -mb-px",v?"text-indigo-700 dark:text-indigo-300 border-indigo-500 dark:border-indigo-400":"border-transparent text-zinc-500 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200"),children:[j,w!=null&&w>0&&e.jsx("span",{className:T("ml-1.5 text-[10px] tabular-nums font-normal",v?"text-indigo-700 dark:text-indigo-500":"text-zinc-400"),children:w})]},b)})}),i==="comments"&&e.jsxs("div",{className:"px-6 pb-5 pt-4",children:[e.jsx("div",{className:"space-y-5 mb-5",children:f?e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{className:"h-7 w-7 rounded-full shrink-0"}),e.jsx(se,{className:"h-16 flex-1"})]}):m&&m.length>0?(n?m.slice(-5):m).map(b=>{const w=S(b.author_id),j=Ud(w.name),v=(y??[]).filter(C=>C.comment_id===b.id);return e.jsxs("div",{className:"flex gap-3",children:[e.jsx(st,{className:"h-7 w-7 mt-0.5 shrink-0",children:e.jsx(nt,{className:T("text-[11px] font-semibold",j.bg,j.text),children:w.initials})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[e.jsx("span",{className:"text-xs font-semibold text-zinc-900 dark:text-zinc-100",children:w.name}),e.jsx("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:oe(new Date(b.created_at),"MMM d, h:mm a")})]}),e.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900 border border-zinc-100 dark:border-zinc-800 px-3 py-2.5",children:e.jsx(jb,{body:b.body})}),v.length>0&&e.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:v.map(C=>e.jsx(ab,{attachment:C},C.id))})]})]},b.id)}):e.jsxs("div",{className:"flex flex-col items-center py-6 gap-2",children:[e.jsx("div",{className:"h-9 w-9 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:e.jsx(Nl,{className:"h-4 w-4 text-zinc-400 dark:text-zinc-500"})}),e.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500",children:"No comments yet"})]})}),n&&m&&m.length>5&&r&&e.jsxs("button",{onClick:r,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mb-4 font-medium transition-colors",children:["View all ",m.length," comments →"]}),!o&&e.jsx(Hd,{issueId:t})]}),i==="activity"&&e.jsx("div",{className:"px-6 pb-6 pt-4",children:g?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(b=>e.jsxs("div",{className:"flex gap-3",children:[e.jsx(se,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),e.jsx(se,{className:"h-4 flex-1 mt-1"})]},b))}):h&&h.length>0?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-zinc-100 dark:bg-zinc-800"}),e.jsx("div",{className:"space-y-0",children:(n?h.slice(-5):h).map((b,w,j)=>{var P;const v=Zo[b.action]??Zo.updated,C=v.icon,p=((P=u==null?void 0:u.get(b.actor_id))==null?void 0:P.name)??"System",D=w===j.length-1;return e.jsxs("div",{className:T("relative flex gap-3",D?"pb-0":"pb-4"),children:[e.jsx("div",{className:T("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",v.bg),children:e.jsx(C,{className:T("h-3 w-3",v.color)})}),e.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[e.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[e.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:p})," ",e.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:wb(b,u)})]}),e.jsx("p",{className:"text-[11px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:oe(new Date(b.created_at),"MMM d, yyyy · h:mm a")})]})]},b.id)})})]}),n&&h.length>5&&r&&e.jsxs("button",{onClick:r,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mt-3 font-medium transition-colors",children:["View all ",h.length," events →"]})]}):e.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500 py-4",children:"No activity yet."})}),i==="attachments"&&e.jsx(lb,{issueId:t}),i==="time"&&e.jsx(yb,{issueId:t})]})}const Vd=x.forwardRef(({className:t,children:s,...n},r)=>e.jsxs(Pi,{ref:r,className:T("relative overflow-hidden",t),...n,children:[e.jsx(qc,{className:"h-full w-full rounded-[inherit]",children:s}),e.jsx(Gd,{}),e.jsx(Bc,{})]}));Vd.displayName=Pi.displayName;const Gd=x.forwardRef(({className:t,orientation:s="vertical",...n},r)=>e.jsx(Ai,{ref:r,orientation:s,className:T("flex touch-none select-none transition-colors",s==="vertical"&&"h-full w-1.5 border-l border-l-transparent p-[1px]",s==="horizontal"&&"h-1.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:e.jsx(Lc,{className:"relative flex-1 rounded-full bg-border"})}));Gd.displayName=Ai.displayName;function tt({zone:t,props:s}){const n=km(t);return n.length?e.jsx(e.Fragment,{children:n.map((r,a)=>e.jsx(r,{...s},a))}):null}function Nb(t){if(!t.start_date&&!t.end_date)return null;const s=t.start_date?oe(new Date(t.start_date),"MMM d"):"—",n=t.end_date?oe(new Date(t.end_date),"MMM d"):"—";return`${s} – ${n}`}const kb={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-sky-500",no_priority:"bg-zinc-400"};function Sb(t,s){return t==="completed"?"bg-emerald-500":t==="in_progress"?"bg-indigo-500":t==="cancelled"?"bg-red-400":s!=null&&s.includes("block")?"bg-red-500":"bg-zinc-400"}const Mt=({children:t})=>e.jsx("p",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100 mb-1.5",children:t}),nr=()=>e.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800"});function Qd({issue:t,projectId:s,open:n,onClose:r}){const a=He(),{workspace:o,projectKey:i}=Ge(),{data:l}=ll((t==null?void 0:t.id)??""),d=l??t,[c,u]=x.useState(!1),[m,f]=x.useState(""),[h,g]=x.useState(""),[y,S]=x.useState("comments"),[b,w]=x.useState(!1),j=ur((d==null?void 0:d.id)??"",s),{data:v}=rn(s),{data:C}=an(s||void 0),{data:p}=Un(s||void 0),{data:D}=On(s||void 0),P=(C??[]).filter(M=>M.status!=="completed"),z=d!=null&&d.parent_id?D==null?void 0:D.find(M=>M.id===d.parent_id):null,_=(D==null?void 0:D.filter(M=>M.parent_id===(d==null?void 0:d.id)))??[],A=d!=null&&d.task_list_id?p==null?void 0:p.find(M=>M.id===d.task_list_id):null,O=v&&v.length>0?Object.fromEntries(v.map(M=>[M.key,M.name])):vs;if(x.useEffect(()=>{d&&(f(d.title),g(d.description??"")),u(!1)},[d==null?void 0:d.id]),!d)return null;const $=()=>{m.trim()&&j.mutate({title:m.trim(),description:h.trim()||void 0},{onSuccess:()=>{u(!1),R.success("Issue updated")},onError:()=>R.error("Failed to update issue")})},E=()=>{f(d.title),g(d.description??""),u(!1)},Q=M=>{j.mutate({status:M},{onSuccess:()=>R.success("Status updated"),onError:()=>R.error("Failed to update status")})},Y=M=>{j.mutate({priority:M},{onSuccess:()=>R.success("Priority updated"),onError:()=>R.error("Failed to update priority")})},V=M=>{j.mutate({type:M},{onSuccess:()=>R.success("Type updated"),onError:()=>R.error("Failed to update type")})},L=M=>{j.mutate({assignee_ids:M},{onSuccess:()=>R.success("Assignees updated"),onError:()=>R.error("Failed to update assignees")})},F=M=>{j.mutate({sprint_id:M},{onSuccess:()=>R.success(M?"Sprint assigned":"Removed from sprint"),onError:()=>R.error("Failed to update sprint")})},Z=M=>{j.mutate({task_list_id:M},{onSuccess:()=>R.success(M?"Moved to list":"Removed from list"),onError:()=>R.error("Failed to update list")})},ee=M=>{j.mutate({start_date:M?oe(M,"yyyy-MM-dd"):null},{onSuccess:()=>R.success(M?"Start date set":"Start date cleared"),onError:()=>R.error("Failed to update start date")})},k=M=>{j.mutate({due_date:M?oe(M,"yyyy-MM-dd"):null},{onSuccess:()=>R.success(M?"Due date set":"Due date cleared"),onError:()=>R.error("Failed to update due date")})},I=v==null?void 0:v.find(M=>M.category==="completed"),K=!!I&&d.status===I.key,q=(M,W,de)=>{const ye=M;return e.jsx("button",{title:W,onClick:de,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:e.jsx(ye,{className:"h-4 w-4"})},W)};return e.jsxs(e.Fragment,{children:[e.jsx(Ms,{open:n,onOpenChange:M=>!M&&r(),children:e.jsxs(Ds,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden bg-white dark:bg-zinc-950",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[e.jsxs("button",{onClick:()=>{var M;I&&Q(K?((M=v==null?void 0:v.find(W=>W.category==="unstarted"||W.category==="backlog"))==null?void 0:M.key)??d.status:I.key)},className:T("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",K?"border-emerald-500/40 text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-950/30":"border-border text-muted-foreground hover:text-foreground hover:border-foreground/40"),children:[e.jsx(it,{className:"h-3.5 w-3.5"}),K?"Completed":"Mark complete"]}),e.jsxs("div",{className:"flex items-center",children:[q(rf,"Upvote"),q($a,"Attachments"),q(Js,"Add sub-issue",()=>w(!0)),q(Aa,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${o}/projects/${i}/issues/${d.id}`),R.success("Link copied")}),q(Km,"Open full page",()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)}),c?e.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[e.jsx(G,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:E,children:"Cancel"}),e.jsxs(G,{size:"sm",className:"h-7 text-xs",onClick:$,disabled:!m.trim()||j.isPending,children:[e.jsx(it,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:q(Pn,"More options")}),e.jsx(Jt,{align:"end",className:"w-40",children:e.jsxs(Ue,{onClick:()=>u(!0),children:[e.jsx(Nn,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),q(Qm,"Open in full page",()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)})]})]}),e.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:c?e.jsx(xe,{value:m,onChange:M=>f(M.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[e.jsx("span",{className:"text-[11px] font-mono font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/60 px-1.5 py-0.5 rounded",children:d.identifier}),e.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase text-violet-500 dark:text-violet-400",children:Vt[d.type]??d.type})]}),e.jsx("h2",{className:"text-[17px] font-semibold leading-snug text-zinc-900 dark:text-zinc-50",children:d.title})]})}),e.jsxs(Vd,{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"px-6 pb-4 space-y-5 min-w-0",children:[e.jsx(tt,{zone:"issue.details.before",props:{issue:d}}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx(Mt,{children:"Status"}),e.jsxs(we,{value:d.status,onValueChange:Q,children:[e.jsx(ve,{className:"h-8 text-xs min-w-0",children:e.jsx(Ee,{})}),e.jsx(je,{children:Object.entries(O).map(([M,W])=>{const de=v==null?void 0:v.find(ye=>ye.key===M);return e.jsx(me,{value:M,className:"text-xs",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:T("h-2 w-2 rounded-full shrink-0 flex-none",Sb(de==null?void 0:de.category,M))}),e.jsx("span",{children:W})]})},M)})})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(Mt,{children:"Priority"}),e.jsxs(we,{value:d.priority,onValueChange:Y,children:[e.jsx(ve,{className:"h-8 text-xs min-w-0",children:e.jsx(Ee,{})}),e.jsx(je,{children:Object.entries(Tt).map(([M,W])=>e.jsx(me,{value:M,className:"text-xs",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:T("h-2 w-2 rounded-full shrink-0 flex-none",kb[M]??"bg-zinc-400")}),e.jsx("span",{children:W})]})},M))})]})]}),e.jsxs("div",{className:"min-w-0",children:[e.jsx(Mt,{children:"Type"}),e.jsxs(we,{value:d.type,onValueChange:V,children:[e.jsx(ve,{className:"h-8 text-xs min-w-0",children:e.jsx(Ee,{})}),e.jsx(je,{children:Object.entries(Vt).map(([M,W])=>e.jsx(me,{value:M,className:"text-xs",children:W},M))})]})]})]}),e.jsx(nr,{}),e.jsxs("div",{children:[e.jsx(Mt,{children:"Assignees"}),e.jsx(Kn,{value:d.assignee_ids??[],onChange:L,disabled:j.isPending})]}),e.jsx(nr,{}),e.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Mt,{children:"Sprint"}),e.jsxs(we,{value:d.sprint_id??"none",onValueChange:M=>F(M==="none"?null:M),children:[e.jsx(ve,{className:"h-8 text-xs min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[e.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx(Ee,{placeholder:"No sprint"})]})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),P.map(M=>{const W=Nb(M);return e.jsx(me,{value:M.id,className:"text-xs",children:e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{children:M.name}),W&&e.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:W})]})},M.id)})]})]})]}),(p??[]).length>0&&e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Mt,{children:"List"}),e.jsxs(we,{value:d.task_list_id??"none",onValueChange:M=>Z(M==="none"?null:M),children:[e.jsx(ve,{className:"h-8 text-xs min-w-0",children:e.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[e.jsx(Pa,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx(Ee,{placeholder:"No list",children:A?A.name:"No list"})]})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(p??[]).map(M=>e.jsx(me,{value:M.id,className:"text-xs",children:M.name},M.id))]})]})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Mt,{children:"Start Date"}),e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[e.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:`truncate ${d.start_date?"text-foreground":"text-muted-foreground"}`,children:d.start_date?oe(new Date(d.start_date),"MMM d, yyyy"):"No date"})]})}),e.jsxs(Ye,{className:"w-auto p-0",align:"start",children:[e.jsx(lt,{mode:"single",selected:d.start_date?new Date(d.start_date):void 0,onSelect:ee,initialFocus:!0}),d.start_date&&e.jsx("div",{className:"border-t px-3 py-2",children:e.jsxs("button",{onClick:()=>ee(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[e.jsx(ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(Mt,{children:"Due Date"}),e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[e.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:`truncate ${d.due_date?"text-foreground":"text-muted-foreground"}`,children:d.due_date?oe(new Date(d.due_date),"MMM d, yyyy"):"No date"})]})}),e.jsxs(Ye,{className:"w-auto p-0",align:"start",children:[e.jsx(lt,{mode:"single",selected:d.due_date?new Date(d.due_date):void 0,onSelect:k,initialFocus:!0}),d.due_date&&e.jsx("div",{className:"border-t px-3 py-2",children:e.jsxs("button",{onClick:()=>k(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[e.jsx(ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),e.jsx(nr,{}),!d.parent_id&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100",children:"Child Issues"}),e.jsxs("button",{onClick:()=>w(!0),className:"flex items-center gap-1 px-2 py-0.5 rounded-md bg-indigo-50 dark:bg-indigo-950/50 text-indigo-700 dark:text-indigo-300 text-[11px] font-medium hover:bg-indigo-100 dark:hover:bg-indigo-900/60 transition-colors",children:[e.jsx(Ae,{className:"h-3 w-3"}),"Add"]})]}),z&&e.jsxs("button",{onClick:()=>a(`/${o}/projects/${i}/issues/${z.id}`),className:"flex items-center gap-2 w-full px-3 py-1.5 rounded-md bg-zinc-100 dark:bg-zinc-800/60 border border-zinc-200 dark:border-zinc-700 hover:border-indigo-300 dark:hover:border-indigo-700 transition-colors text-left",children:[e.jsx(Ea,{className:"h-3.5 w-3.5 text-zinc-400 shrink-0"}),e.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-400 shrink-0",children:"Parent:"}),e.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:z.identifier}),e.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-300 truncate",children:z.title})]}),_.length===0?e.jsxs("button",{onClick:()=>w(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),"Create child issue"]}):e.jsx("div",{className:"space-y-1",children:_.map(M=>e.jsxs("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${M.id}`)},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/40 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all text-left group",children:[e.jsx(hs,{className:"h-3.5 w-3.5 text-indigo-400 dark:text-indigo-500 shrink-0"}),e.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:M.identifier}),e.jsx("span",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:M.title})]},M.id))})]}),e.jsx(nr,{}),e.jsxs("div",{children:[e.jsx(Mt,{children:"Description"}),c?e.jsx(uo,{content:h,onChange:g,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${d.id}-edit`):d.description?e.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900/60 border border-zinc-100 dark:border-zinc-800 px-3.5 py-3",children:e.jsx(mo,{html:d.description,className:"text-sm"})}):e.jsxs("button",{onClick:()=>u(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[e.jsx(Nn,{className:"h-3.5 w-3.5"}),"Add description"]})]})]}),e.jsx("div",{className:"px-6 py-4",children:e.jsx(tt,{zone:"issue.details.after",props:{issue:d}})}),e.jsx(Kd,{issueId:d.id,className:"border-t border-border",compact:!0,hideCommentInput:!0,onTabChange:S,onViewMore:()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)}})]}),y==="comments"&&e.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:e.jsx(Hd,{issueId:d.id,compact:!0})})]})}),e.jsx(Mr,{open:b,onClose:()=>w(!1),projectId:s,defaultParentId:d.id,defaultTaskListId:d.task_list_id})]})}function Cb(){const{projectKey:t}=Ge(),[s,n]=x.useState(null),[r,a]=x.useState(!1),{data:o}=ks(t??""),i=(o==null?void 0:o.id)??"",{data:l,isLoading:d}=On(i||void 0),{data:c,isLoading:u}=rn(i||void 0),m=fg(i);if(!t)return null;const f=d||u||!o,h=g=>{m.mutate(g)};return e.jsxs("div",{className:"flex flex-col h-full gap-0",children:[e.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[e.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border shrink-0",children:e.jsxs(G,{size:"sm",onClick:()=>a(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"Create"]})}),e.jsx(tt,{zone:"project.board.before",props:{projectId:i}}),e.jsx("div",{className:"flex-1 min-h-0",children:f?e.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(g=>e.jsxs("div",{className:"min-w-[260px]",children:[e.jsx(se,{className:"h-5 w-24 mb-3 rounded"}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(se,{className:"h-[82px] w-full rounded-lg"}),e.jsx(se,{className:"h-[82px] w-full rounded-lg"})]})]},g))}):e.jsx(jg,{issues:l??[],projectId:i,statuses:c??[],onIssueClick:n,onColumnsReorder:h})})]}),e.jsx(tt,{zone:"project.board.after",props:{projectId:i}}),e.jsx(Qd,{issue:s,projectId:i,open:!!s,onClose:()=>n(null)}),e.jsx(Mr,{open:r,onClose:()=>a(!1),projectId:i})]})}const ei=({priority:t,className:s})=>{const n=T("h-3.5 w-3.5 shrink-0",jd[t],s);switch(t){case"urgent":return e.jsx(Zs,{className:n});case"high":return e.jsx(fr,{className:n});case"medium":return e.jsx($n,{className:n});case"low":return e.jsx(mr,{className:n});default:return e.jsx(Nt,{className:T("h-3.5 w-3.5 shrink-0 text-zinc-300",s)})}},ba="grid-cols-[70px_250px_150px_120px_130px_140px_130px_32px]";function Xd({issue:t,projectId:s,statuses:n,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:c=!1,children:u=[],onAddChild:m}){const f=He(),[h,g]=x.useState(null),[y,S]=x.useState(!1),b=ur(t.id,s);function w(p){b.mutate(p),g(null)}const j=(a==null?void 0:a[t.status])??"#94a3b8",v=o.find(p=>p.id===t.sprint_id),C=u.length>0;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{onClick:()=>d(t),className:T(`group grid ${ba} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",c&&"bg-muted/10",b.isPending&&"opacity-70"),children:[e.jsx("span",{className:T("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 pl-6 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",c&&"text-muted-foreground/60"),children:t.identifier}),e.jsxs("div",{className:T("flex items-center gap-1 min-w-0 pr-3","sticky left-[70px] z-10 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",c&&"bg-[#f8f9fa] dark:bg-muted/20"),children:[!c&&C&&e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:e.jsx("button",{onClick:p=>{p.stopPropagation(),S(!y)},className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:y?e.jsx(Qs,{className:"h-3.5 w-3.5"}):e.jsx(Xs,{className:"h-3.5 w-3.5"})})}),e.jsx(Ut,{side:"top",children:y?"Collapse":"Expand"})]}),!c&&!C&&e.jsx("span",{className:"w-4 shrink-0"}),c&&e.jsx(hs,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}),e.jsx("span",{className:T("text-sm text-foreground truncate",c&&"text-muted-foreground"),children:t.title}),!c&&C&&e.jsxs("span",{className:"shrink-0 flex items-center gap-0.5 ml-1 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[e.jsx(hs,{className:"h-2.5 w-2.5"}),u.length]})]}),e.jsx("div",{onClick:p=>p.stopPropagation(),children:e.jsxs(Ke,{open:h==="status",onOpenChange:p=>g(p?"status":null),children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 max-w-full px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:j}}),e.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[t.status]??t.status})]})}),e.jsx(Ye,{className:"w-52 p-1",align:"start",onClick:p=>p.stopPropagation(),children:e.jsx(Ws,{children:e.jsx(qs,{children:e.jsx(ps,{children:n.map(p=>e.jsxs(mt,{value:p.name,onSelect:()=>w({status:p.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[e.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:p.color}}),e.jsx("span",{className:"text-xs flex-1",children:p.name}),t.status===p.key&&e.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500"})]},p.key))})})})})]})}),e.jsx("div",{onClick:p=>p.stopPropagation(),children:e.jsxs(Ke,{open:h==="priority",onOpenChange:p=>g(p?"priority":null),children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx(ei,{priority:t.priority}),e.jsx("span",{className:"text-xs text-muted-foreground",children:Tt[t.priority]??t.priority})]})}),e.jsx(Ye,{className:"w-44 p-1",align:"start",onClick:p=>p.stopPropagation(),children:e.jsx(Ws,{children:e.jsx(qs,{children:e.jsx(ps,{children:Object.entries(Tt).map(([p,D])=>e.jsxs(mt,{value:D,onSelect:()=>w({priority:p}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[e.jsx(ei,{priority:p}),e.jsx("span",{className:"text-xs flex-1",children:D}),t.priority===p&&e.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500"})]},p))})})})})]})}),e.jsx("div",{onClick:p=>p.stopPropagation(),children:e.jsxs(Ke,{open:h==="sprint",onOpenChange:p=>g(p?"sprint":null),children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring max-w-full",children:[e.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:T("text-xs truncate",v?"text-foreground":"text-muted-foreground"),children:(v==null?void 0:v.name)??"No sprint"})]})}),e.jsx(Ye,{className:"w-56 p-1",align:"start",onClick:p=>p.stopPropagation(),children:e.jsx(Ws,{children:e.jsx(qs,{children:e.jsxs(ps,{children:[e.jsxs(mt,{value:"no-sprint",onSelect:()=>w({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[e.jsx(ze,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!t.sprint_id&&e.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500"})]}),o.filter(p=>p.status!=="completed").map(p=>e.jsxs(mt,{value:p.name,onSelect:()=>w({sprint_id:p.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[e.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs truncate",children:p.name}),(p.start_date||p.end_date)&&e.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[p.start_date?oe(new Date(p.start_date),"MMM d"):"—"," → ",p.end_date?oe(new Date(p.end_date),"MMM d"):"—"]})]}),t.sprint_id===p.id&&e.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},p.id))]})})})})]})}),e.jsx("div",{onClick:p=>p.stopPropagation(),children:e.jsxs(Ke,{open:h==="due",onOpenChange:p=>g(p?"due":null),children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 px-1.5 py-1 rounded hover:bg-accent transition-colors focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",children:[e.jsx(ht,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("span",{className:T("text-xs",t.due_date?"text-foreground":"text-muted-foreground"),children:t.due_date?oe(new Date(t.due_date),"MMM d, yyyy"):"No due date"})]})}),e.jsxs(Ye,{className:"w-auto p-0",align:"start",onClick:p=>p.stopPropagation(),children:[e.jsx(lt,{mode:"single",selected:t.due_date?new Date(t.due_date):void 0,onSelect:p=>w({due_date:p?oe(p,"yyyy-MM-dd"):null}),initialFocus:!0}),t.due_date&&e.jsx("div",{className:"border-t px-3 py-2",children:e.jsxs("button",{onClick:()=>w({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[e.jsx(ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),e.jsx("div",{onClick:p=>p.stopPropagation(),children:e.jsx(Kn,{value:t.assignee_ids??[],onChange:p=>b.mutate({assignee_ids:p})})}),e.jsxs("div",{className:"flex items-center gap-1 pr-6",onClick:p=>p.stopPropagation(),children:[!c&&m&&e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:e.jsx("button",{onClick:()=>m(t.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:e.jsx(hs,{className:"h-3.5 w-3.5"})})}),e.jsx(Ut,{side:"top",children:"Add child issue"})]}),e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:e.jsx("button",{onClick:()=>f(`/${i}/projects/${l}/issues/${t.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:e.jsx(bl,{className:"h-3.5 w-3.5"})})}),e.jsx(Ut,{side:"top",children:"Open full page"})]})]})]}),!c&&y&&u.map(p=>e.jsx(Xd,{issue:p,projectId:s,statuses:n,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:!0},p.id))]})}function ti({taskList:t,issues:s,childrenMap:n,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,onAddIssue:m,onAddChild:f,onRenameList:h,onDeleteList:g}){const[y,S]=x.useState(!1),[b,w]=x.useState(!1),[j,v]=x.useState((t==null?void 0:t.name)??""),C=s.reduce((P,z)=>{var _;return P+(((_=n[z.id])==null?void 0:_.length)??0)},0),p=s.length+C,D=()=>{t&&j.trim()&&h&&h(t.id,j.trim()),w(!1)};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:e.jsx("button",{onClick:()=>S(!y),className:"text-muted-foreground hover:text-foreground transition-colors",children:y?e.jsx(Xs,{className:"h-3.5 w-3.5"}):e.jsx(Qs,{className:"h-3.5 w-3.5"})})}),e.jsx(Ut,{side:"right",children:y?"Expand":"Collapse"})]}),t?b?e.jsx("input",{autoFocus:!0,value:j,onChange:P=>v(P.target.value),onBlur:D,onKeyDown:P=>{P.key==="Enter"&&D(),P.key==="Escape"&&(w(!1),v(t.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):e.jsx("span",{className:"text-xs font-semibold text-foreground",children:t.name}):e.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),e.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:p}),e.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[e.jsxs("button",{onClick:()=>m((t==null?void 0:t.id)??null),className:"flex items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground transition-colors px-1.5 py-0.5 rounded hover:bg-muted",children:[e.jsx(Ae,{className:"h-3 w-3"}),"Add issue"]}),t&&e.jsxs(Ss,{children:[e.jsxs(ms,{children:[e.jsx(fs,{asChild:!0,children:e.jsx(Cs,{asChild:!0,children:e.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(Pn,{className:"h-3.5 w-3.5"})})})}),e.jsx(Ut,{side:"top",children:"More options"})]}),e.jsxs(Jt,{align:"end",className:"w-36",children:[e.jsxs(Ue,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{w(!0),v(t.name)},children:[e.jsx(Nn,{className:"h-3.5 w-3.5"}),"Rename"]}),e.jsxs(Ue,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>g==null?void 0:g(t.id),children:[e.jsx(Pt,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!y&&e.jsx("div",{className:"divide-y divide-border/60",children:s.length===0?e.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):s.map(P=>e.jsx(Xd,{issue:P,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,children:n[P.id]??[],onAddChild:f},P.id))})]})}function Mb(){var q;const{workspace:t,projectKey:s}=Ge(),[n,r]=x.useState(null),[a,o]=x.useState({open:!1}),[i,l]=x.useState(""),[d,c]=x.useState(!1),[u,m]=x.useState(""),[f,h]=x.useState("all"),[g,y]=x.useState("all"),[S,b]=x.useState("all"),{data:w}=ks(s??""),j=(w==null?void 0:w.id)??"",{data:v,isLoading:C}=On(j||void 0),{data:p}=rn(j||void 0),{data:D}=an(j||void 0),{data:P}=Un(j||void 0),z=Sg(j),_=Cg(j),A=Mg(j),O=p&&p.length>0?p:Object.entries(vs).map(([M,W],de)=>({id:M,project_id:j,key:M,name:W,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[M]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[M]??"backlog",position:de})),$=Object.fromEntries(O.map(M=>[M.key,M.name])),E=Object.fromEntries(O.map(M=>[M.key,M.color])),Q=D??[];if(!s||!t)return null;const Y=(v??[]).filter(M=>{const W=!u||M.title.toLowerCase().includes(u.toLowerCase())||M.identifier.toLowerCase().includes(u.toLowerCase()),de=f==="all"||M.status===f,ye=g==="all"||M.priority===g,$e=S==="all"||(S==="none"?!M.sprint_id:M.sprint_id===S);return W&&de&&ye&&$e}).sort((M,W)=>{const de=parseInt(M.identifier.split("-")[1]??"0",10),ye=parseInt(W.identifier.split("-")[1]??"0",10);return de-ye}),V={};for(const M of v??[])M.parent_id&&(V[M.parent_id]||(V[M.parent_id]=[]),V[M.parent_id].push(M));const L=Y.filter(M=>!M.parent_id),F=Y.length,Z=new Set((P??[]).map(M=>M.id)),ee={__none__:[]};for(const M of P??[])ee[M.id]=[];for(const M of L){const W=M.task_list_id&&Z.has(M.task_list_id)?M.task_list_id:"__none__";ee[W].push(M)}function k(){i.trim()&&z.mutate({name:i.trim()},{onSuccess:()=>{l(""),c(!1),R.success("List created")},onError:()=>R.error("Failed to create list")})}function I(M,W){_.mutate({id:M,name:W},{onError:()=>R.error("Failed to rename list")})}function K(M){const W=P==null?void 0:P.find(de=>de.id===M);confirm(`Delete list "${W==null?void 0:W.name}"? Issues in this list will be moved to No List.`)&&A.mutate(M,{onSuccess:()=>R.success("List deleted"),onError:()=>R.error("Failed to delete list")})}return e.jsxs("div",{className:"p-2",children:[e.jsx(tt,{zone:"project.issues.before",props:{projectId:j}}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:e.jsxs("div",{className:"flex items-center gap-2",children:[d?e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx(xe,{autoFocus:!0,placeholder:"List name...",value:i,onChange:M=>l(M.target.value),onKeyDown:M=>{M.key==="Enter"&&k(),M.key==="Escape"&&(c(!1),l(""))},className:"h-8 text-xs w-36"}),e.jsx(G,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:k,disabled:!i.trim()||z.isPending,children:"Add"}),e.jsx(G,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{c(!1),l("")},children:"Cancel"})]}):e.jsxs(G,{size:"sm",variant:"outline",onClick:()=>c(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"New List"]}),e.jsxs(G,{size:"sm",onClick:()=>o({open:!0}),children:[e.jsx(Ae,{className:"h-4 w-4"}),"Create"]})]})}),e.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(we,{value:S,onValueChange:b,children:[e.jsx(ve,{className:"h-8 text-xs w-[140px] bg-transparent",children:e.jsx(Ee,{placeholder:"Sprint"})}),e.jsxs(je,{children:[e.jsx(me,{value:"all",className:"text-xs",children:"All sprints"}),e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),Q.map(M=>e.jsx(me,{value:M.id,className:"text-xs",children:M.name},M.id))]})]}),e.jsxs(we,{value:f,onValueChange:h,children:[e.jsx(ve,{className:"h-8 text-xs w-[130px] bg-transparent",children:e.jsx(Ee,{placeholder:"Status"})}),e.jsxs(je,{children:[e.jsx(me,{value:"all",className:"text-xs",children:"All statuses"}),O.map(({key:M,name:W})=>e.jsx(me,{value:M,className:"text-xs",children:W},M))]})]}),e.jsxs(we,{value:g,onValueChange:y,children:[e.jsx(ve,{className:"h-8 text-xs w-[130px] bg-transparent",children:e.jsx(Ee,{placeholder:"Priority"})}),e.jsxs(je,{children:[e.jsx(me,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(Tt).map(([M,W])=>e.jsx(me,{value:M,className:"text-xs",children:W},M))]})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(pr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),e.jsx(xe,{placeholder:"Search...",value:u,onChange:M=>m(M.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("div",{className:"min-w-[1025px]",children:[e.jsxs("div",{className:T("grid items-center py-2.5 border-b border-border",ba),children:[e.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),e.jsx("span",{className:"pr-6"})]}),C?e.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(M=>e.jsxs("div",{className:T("grid items-center px-6 py-3 gap-4",ba),children:[e.jsx(se,{className:"h-4 w-14"}),e.jsx(se,{className:"h-4 w-56"}),e.jsx(se,{className:"h-5 w-20"}),e.jsx(se,{className:"h-4 w-16"}),e.jsx(se,{className:"h-4 w-20"}),e.jsx(se,{className:"h-4 w-24"}),e.jsx(se,{className:"h-6 w-16"}),e.jsx("span",{})]},M))}):F===0&&(v??[]).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),e.jsxs(G,{size:"sm",onClick:()=>o({open:!0}),children:[e.jsx(Ae,{className:"h-4 w-4"}),"Create issue"]})]}):L.length===0&&(v??[]).length>0?e.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):e.jsx(Sa,{delayDuration:200,children:e.jsxs("div",{className:"divide-y divide-border",children:[(P??[]).map(M=>e.jsx(ti,{taskList:M,issues:ee[M.id]??[],childrenMap:V,projectId:j,statuses:O,statusLabels:$,statusColorMap:E,sprints:Q,workspace:t,projectKey:s,onOpen:r,onAddIssue:W=>o({open:!0,defaultTaskListId:W}),onAddChild:W=>o({open:!0,defaultParentId:W}),onRenameList:I,onDeleteList:K},M.id)),(((q=ee.__none__)==null?void 0:q.length)>0||(P??[]).length===0)&&e.jsx(ti,{taskList:null,issues:ee.__none__??[],childrenMap:V,projectId:j,statuses:O,statusLabels:$,statusColorMap:E,sprints:Q,workspace:t,projectKey:s,onOpen:r,onAddIssue:M=>o({open:!0,defaultTaskListId:M}),onAddChild:M=>o({open:!0,defaultParentId:M})})]})})]})}),!C&&F>0&&e.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:e.jsxs("span",{className:"text-xs text-muted-foreground",children:[F," issue",F!==1?"s":""]})})]}),e.jsx(tt,{zone:"project.issues.after",props:{projectId:j}}),e.jsx(Qd,{issue:n,projectId:j,open:!!n,onClose:()=>r(null)}),e.jsx(Mr,{open:a.open,onClose:()=>o({open:!1}),projectId:j,defaultTaskListId:a.defaultTaskListId,defaultParentId:a.defaultParentId})]})}function Db(t,s=[]){let n=[];function r(o,i){const l=x.createContext(i),d=n.length;n=[...n,i];const c=m=>{var b;const{scope:f,children:h,...g}=m,y=((b=f==null?void 0:f[t])==null?void 0:b[d])||l,S=x.useMemo(()=>g,Object.values(g));return e.jsx(y.Provider,{value:S,children:h})};c.displayName=o+"Provider";function u(m,f){var y;const h=((y=f==null?void 0:f[t])==null?void 0:y[d])||l,g=x.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${m}\` must be used within \`${o}\``)}return[c,u]}const a=()=>{const o=n.map(i=>x.createContext(i));return function(l){const d=(l==null?void 0:l[t])||o;return x.useMemo(()=>({[`__scope${t}`]:{...l,[t]:d}}),[l,d])}};return a.scopeName=t,[r,_b(a,...s)]}function _b(...t){const s=t[0];if(t.length===1)return s;const n=()=>{const r=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((l,{useScope:d,scopeName:c})=>{const m=d(o)[`__scope${c}`];return{...l,...m}},{});return x.useMemo(()=>({[`__scope${s.scopeName}`]:i}),[i])}};return n.scopeName=s.scopeName,n}var Eb=Symbol("radix.slottable");function Ob(t){const s=({children:n})=>e.jsx(e.Fragment,{children:n});return s.displayName=`${t}.Slottable`,s.__radixId=Eb,s}var Jd="AlertDialog",[Tb]=Db(Jd,[Ri]),$t=Ri(),Zd=t=>{const{__scopeAlertDialog:s,...n}=t,r=$t(s);return e.jsx(En,{...r,...n,modal:!0})};Zd.displayName=Jd;var Pb="AlertDialogTrigger",Ab=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,...r}=t,a=$t(n);return e.jsx(Uc,{...a,...r,ref:s})});Ab.displayName=Pb;var $b="AlertDialogPortal",ec=t=>{const{__scopeAlertDialog:s,...n}=t,r=$t(s);return e.jsx(_n,{...r,...n})};ec.displayName=$b;var Rb="AlertDialogOverlay",tc=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,...r}=t,a=$t(n);return e.jsx(js,{...a,...r,ref:s})});tc.displayName=Rb;var Bs="AlertDialogContent",[Ib,zb]=Tb(Bs),Fb=Ob("AlertDialogContent"),sc=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,children:r,...a}=t,o=$t(n),i=x.useRef(null),l=$i(s,i),d=x.useRef(null);return e.jsx(Yc,{contentName:Bs,titleName:nc,docsSlug:"alert-dialog",children:e.jsx(Ib,{scope:n,cancelRef:d,children:e.jsxs(ws,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:Hc(a.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=d.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[e.jsx(Fb,{children:r}),e.jsx(qb,{contentRef:i})]})})})});sc.displayName=Bs;var nc="AlertDialogTitle",rc=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,...r}=t,a=$t(n);return e.jsx(Ks,{...a,...r,ref:s})});rc.displayName=nc;var ac="AlertDialogDescription",oc=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,...r}=t,a=$t(n);return e.jsx(Vs,{...a,...r,ref:s})});oc.displayName=ac;var Wb="AlertDialogAction",ic=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,...r}=t,a=$t(n);return e.jsx(cr,{...a,...r,ref:s})});ic.displayName=Wb;var lc="AlertDialogCancel",dc=x.forwardRef((t,s)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:a}=zb(lc,n),o=$t(n),i=$i(s,a);return e.jsx(cr,{...o,...r,ref:i})});dc.displayName=lc;var qb=({contentRef:t})=>{const s=`\`${Bs}\` requires a description for the component to be accessible for screen reader users.
|
|
471
|
-
|
|
472
|
-
You can add a description to the \`${Bs}\` by passing a \`${ac}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
473
|
-
|
|
474
|
-
Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Bs}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
|
|
475
|
-
|
|
476
|
-
For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(s)},[s,t]),null},Bb=Zd,Lb=ec,cc=tc,uc=sc,mc=ic,fc=dc,hc=rc,xc=oc;const fo=Bb,Yb=Lb,pc=x.forwardRef(({className:t,...s},n)=>e.jsx(cc,{className:T("fixed inset-0 z-50 bg-black/40 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...s,ref:n}));pc.displayName=cc.displayName;const Or=x.forwardRef(({className:t,...s},n)=>e.jsxs(Yb,{children:[e.jsx(pc,{}),e.jsx(uc,{ref:n,className:T("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background border border-border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-lg",t),...s})]}));Or.displayName=uc.displayName;const Tr=({className:t,...s})=>e.jsx("div",{className:T("flex flex-col space-y-2 text-center sm:text-left",t),...s});Tr.displayName="AlertDialogHeader";const Pr=({className:t,...s})=>e.jsx("div",{className:T("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s});Pr.displayName="AlertDialogFooter";const Ar=x.forwardRef(({className:t,...s},n)=>e.jsx(hc,{ref:n,className:T("text-base font-semibold",t),...s}));Ar.displayName=hc.displayName;const $r=x.forwardRef(({className:t,...s},n)=>e.jsx(xc,{ref:n,className:T("text-sm text-muted-foreground",t),...s}));$r.displayName=xc.displayName;const Rr=x.forwardRef(({className:t,...s},n)=>e.jsx(mc,{ref:n,className:T(Fs(),t),...s}));Rr.displayName=mc.displayName;const Ir=x.forwardRef(({className:t,...s},n)=>e.jsx(fc,{ref:n,className:T(Fs({variant:"outline"}),"mt-2 sm:mt-0",t),...s}));Ir.displayName=fc.displayName;function Hb({member:t,onRequestRemove:s}){var l;const n=t.user,r=(n==null?void 0:n.first_name)??"",a=(n==null?void 0:n.last_name)??"",o=`${r} ${a}`.trim()||(n==null?void 0:n.email)||"Unknown",i=(r[0]??a[0]??((l=n==null?void 0:n.email)==null?void 0:l[0])??"U").toUpperCase();return e.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[e.jsx(st,{className:"h-8 w-8 shrink-0",children:e.jsx(nt,{className:"text-xs font-medium",children:i})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:o}),(n==null?void 0:n.email)&&e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:n.email})]}),e.jsx(Er,{className:T("shrink-0 text-[11px] border-0 w-20 justify-center",t.role==="manager"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400":"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"),children:t.role}),e.jsx(G,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>s(t.user_id,o),children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]})}function Ub({teamEntry:t,onRemove:s}){const n=t.team;return e.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[e.jsx("div",{className:"h-8 w-8 rounded-lg bg-muted flex items-center justify-center shrink-0",children:e.jsx(gs,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:(n==null?void 0:n.name)??"Unknown team"}),n&&e.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[n.member_count," ",n.member_count===1?"member":"members"]})]}),e.jsx(G,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>s(t.team_id),children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]})}function Kb(){const{projectKey:t}=Ge(),{workspace:s}=ke(),n=(s==null?void 0:s.id)??"",{data:r}=ks(t??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=rd(a),{data:l}=In(n),{data:d}=za(n),c=ad(a),u=od(a),m=id(a),f=ld(a),[h,g]=x.useState(""),[y,S]=x.useState(""),[b,w]=x.useState(null),j=new Set((o==null?void 0:o.members.map(_=>_.user_id))??[]),v=new Set((o==null?void 0:o.teams.map(_=>_.team_id))??[]),C=(l??[]).filter(_=>!j.has(_.user_id)),p=(d??[]).filter(_=>!v.has(_.id)),D=(o==null?void 0:o.members.length)??0,P=(o==null?void 0:o.teams.length)??0;function z(){b&&u.mutate(b.userId,{onSuccess:()=>{R.success("Access removed"),w(null)},onError:()=>R.error("Failed to remove")})}return e.jsxs("div",{className:"p-2",children:[e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold",children:"Access"}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Manage who has access to this project."})]}),!i&&e.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[D," member",D!==1?"s":""," • ",P," team",P!==1?"s":""]})]}),i?e.jsxs("div",{children:[e.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),e.jsx("div",{className:"divide-y divide-border",children:[1,2].map(_=>e.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[e.jsx(se,{className:"h-8 w-8 rounded-full"}),e.jsx(se,{className:"h-4 w-44"}),e.jsx("div",{className:"flex-1"}),e.jsx(se,{className:"h-5 w-20"})]},_))}),e.jsx("div",{className:"px-6 py-2 border-y border-border bg-muted/20",children:e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),e.jsx("div",{className:"divide-y divide-border",children:[1].map(_=>e.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[e.jsx(se,{className:"h-8 w-8 rounded-lg"}),e.jsx(se,{className:"h-4 w-32"}),e.jsx("div",{className:"flex-1"}),e.jsx(se,{className:"h-4 w-20"})]},_))})]}):e.jsxs("div",{children:[e.jsxs("div",{children:[e.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"}),C.length>0&&e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsxs(we,{value:h,onValueChange:g,children:[e.jsx(ve,{className:"h-8 text-xs w-full sm:w-56",children:e.jsx(Ee,{placeholder:"Add person…"})}),e.jsx(je,{children:C.map(_=>{const A=_.user,O=(A==null?void 0:A.first_name)??"",$=(A==null?void 0:A.last_name)??"",E=`${O} ${$}`.trim()||(A==null?void 0:A.email)||"Unknown";return e.jsx(me,{value:_.user_id,children:E},_.user_id)})})]}),e.jsxs(G,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:!h||c.isPending,onClick:()=>c.mutate({userId:h},{onSuccess:()=>{R.success("Access granted"),g("")},onError:()=>R.error("Failed to grant access")}),children:[e.jsx(Rn,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),D===0?e.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No individual members."}):e.jsx("div",{className:"divide-y divide-border",children:o==null?void 0:o.members.map(_=>e.jsx(Hb,{member:_,onRequestRemove:(A,O)=>w({userId:A,displayName:O})},_.id))})]}),e.jsxs("div",{className:"border-t border-border",children:[e.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"}),p.length>0&&e.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[e.jsxs(we,{value:y,onValueChange:S,children:[e.jsx(ve,{className:"h-8 text-xs w-full sm:w-56",children:e.jsx(Ee,{placeholder:"Add team…"})}),e.jsx(je,{children:p.map(_=>e.jsx(me,{value:_.id,children:_.name},_.id))})]}),e.jsxs(G,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:!y||m.isPending,onClick:()=>m.mutate(y,{onSuccess:()=>{R.success("Team access granted"),S("")},onError:()=>R.error("Failed to add team")}),children:[e.jsx(gs,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),P===0?e.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No teams have access."}):e.jsx("div",{className:"divide-y divide-border",children:o==null?void 0:o.teams.map(_=>e.jsx(Ub,{teamEntry:_,onRemove:A=>f.mutate(A,{onSuccess:()=>R.success("Team access removed"),onError:()=>R.error("Failed to remove team")})},_.id))})]}),D===0&&P===0&&C.length===0&&p.length===0&&e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center border-t border-border",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:e.jsx(gs,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium mb-1",children:"No access entries yet"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Add workspace people or teams first to grant project access."})]})]})]}),e.jsx(fo,{open:!!b,onOpenChange:_=>{_||w(null)},children:e.jsxs(Or,{className:"sm:max-w-md",children:[e.jsxs(Tr,{children:[e.jsx(Ar,{children:"Remove member access?"}),e.jsx($r,{children:b?`${b.displayName} will lose access to this project.`:"This member will lose access to this project."})]}),e.jsxs(Pr,{children:[e.jsx(Ir,{disabled:u.isPending,children:"Cancel"}),e.jsx(Rr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:_=>{_.preventDefault(),z()},disabled:u.isPending,children:u.isPending?"Removing...":"Remove"})]})]})})]})}function si(t){if(!t.start_date&&!t.end_date)return null;const s=t.start_date?oe(new Date(t.start_date),"MMM d"):"—",n=t.end_date?oe(new Date(t.end_date),"MMM d"):"—";return`${s} – ${n}`}function Dt({label:t,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:t}),e.jsx("div",{className:"flex-1 min-w-0",children:s})]})}const Vb={backlog:e.jsx(Nt,{className:"h-3 w-3 text-zinc-400"}),todo:e.jsx(Nt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:e.jsx(Xt,{className:"h-3 w-3 text-indigo-500"}),in_review:e.jsx(An,{className:"h-3 w-3 text-amber-500"}),done:e.jsx(Ns,{className:"h-3 w-3 text-emerald-500"}),cancelled:e.jsx(xl,{className:"h-3 w-3 text-zinc-400"})},Gb={urgent:e.jsx(Zs,{className:"h-3 w-3 text-red-500"}),high:e.jsx(fr,{className:"h-3 w-3 text-orange-500"}),medium:e.jsx($n,{className:"h-3 w-3 text-yellow-500"}),low:e.jsx(mr,{className:"h-3 w-3 text-blue-400"})},Qb={bug:e.jsx(ml,{className:"h-3 w-3 text-red-500"}),feature:e.jsx(kl,{className:"h-3 w-3 text-purple-500"}),task:e.jsx(Sl,{className:"h-3 w-3 text-blue-500"}),chore:e.jsx(Ma,{className:"h-3 w-3 text-zinc-500"})};function oa({value:t,onValueChange:s,options:n,icons:r,placeholder:a}){return e.jsxs(we,{value:t,onValueChange:s,children:[e.jsx(ve,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[r[t]??e.jsx(hl,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{children:n[t]??a??""})]})}),e.jsx(je,{children:Object.entries(n).map(([o,i])=>e.jsx(me,{value:o,className:"text-xs",children:e.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function Xb(){const{workspace:t,projectKey:s,issueId:n}=Ge(),r=He(),[a,o]=x.useState(!1),[i,l]=x.useState(""),[d,c]=x.useState(""),[u,m]=x.useState(!1),{data:f}=ks(s??""),h=(f==null?void 0:f.id)??"",{data:g,isLoading:y}=ll(n??""),S=ur(n??"",h),{data:b}=rn(h||void 0),{data:w}=an(h||void 0),{data:j}=Un(h||void 0),{data:v}=On(h||void 0),C=(w??[]).filter(E=>E.status!=="completed"),p=g!=null&&g.parent_id?v==null?void 0:v.find(E=>E.id===g.parent_id):null,D=(v==null?void 0:v.filter(E=>E.parent_id===n))??[],P=g!=null&&g.task_list_id?j==null?void 0:j.find(E=>E.id===g.task_list_id):null,z=b&&b.length>0?Object.fromEntries(b.map(E=>[E.key,E.name])):vs,_=b&&b.length>0?Object.fromEntries(b.map(E=>[E.key,E.category==="completed"?e.jsx(Ns,{className:"h-3 w-3",style:{color:E.color}}):E.category==="started"?e.jsx(Xt,{className:"h-3 w-3",style:{color:E.color}}):e.jsx(Nt,{className:"h-3 w-3",style:{color:E.color}})])):Vb;if(x.useEffect(()=>{g&&(l(g.title),c(g.description??"")),o(!1)},[g==null?void 0:g.id]),!s||!n)return null;const A=()=>{i.trim()&&S.mutate({title:i.trim(),description:d.trim()||void 0},{onSuccess:()=>{o(!1),R.success("Issue updated")},onError:()=>R.error("Failed to update issue")})},O=()=>{g&&(l(g.title),c(g.description??"")),o(!1)},$=(E,Q)=>{S.mutate(E,{onSuccess:()=>R.success(`${Q} updated`),onError:()=>R.error(`Failed to update ${Q.toLowerCase()}`)})};return y||!g?e.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[e.jsx("div",{className:"sticky top-0 z-10 h-[57px] bg-white dark:bg-card border-b border-border"}),e.jsx("div",{className:"px-2 py-2",children:e.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 space-y-4 shadow-sm",children:[e.jsx(se,{className:"h-7 w-3/4"}),e.jsx(se,{className:"h-32 w-full"})]}),e.jsx(se,{className:"h-24 w-full rounded-xl"}),e.jsx(se,{className:"h-48 w-full rounded-xl"})]}),e.jsx(se,{className:"h-[280px] w-full rounded-xl"})]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 h-[57px] bg-white dark:bg-card border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsxs(G,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>r(`/${t}/projects/${s}/issues`),children:[e.jsx(_a,{className:"h-3.5 w-3.5"}),(f==null?void 0:f.name)??"Issues"]}),e.jsx("span",{className:"text-border",children:"/"}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:g.identifier}),e.jsx(Er,{variant:"muted",className:"text-[10px] ml-1",children:Vt[g.type]??g.type})]}),e.jsx("div",{className:"flex items-center gap-2",children:a?e.jsxs(e.Fragment,{children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:O,children:"Discard"}),e.jsx(G,{size:"sm",onClick:A,disabled:!i.trim()||S.isPending,className:"px-4",children:S.isPending?"Saving…":"Save changes"})]}):e.jsxs(G,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>o(!0),children:[e.jsx(Nn,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),e.jsx("div",{className:"px-2 py-2",children:e.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[e.jsxs("div",{className:"space-y-4",children:[e.jsx(tt,{zone:"issue.details.before",props:{issue:g}}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[e.jsx("div",{className:"px-6 pt-6 pb-3",children:a?e.jsx("input",{autoFocus:!0,value:i,onChange:E=>l(E.target.value),onKeyDown:E=>{E.key==="Enter"&&E.preventDefault()},className:T("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")}):e.jsx("h1",{className:"text-xl font-semibold text-foreground leading-snug",children:g.title})}),e.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),a?e.jsx(uo,{content:d,onChange:c,placeholder:"Add a description…",className:"border-t border-border/50 min-h-[280px]"}):g.description?e.jsx("div",{className:"border-t border-border/50",children:e.jsx(mo,{html:g.description,className:"px-5 py-4"})}):e.jsx("div",{className:"border-t border-border/50 px-6 py-4",children:e.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})})]}),!g.parent_id&&e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[e.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Child Issues"}),e.jsxs("button",{onClick:()=>m(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Ae,{className:"h-3.5 w-3.5"}),"Add child issue"]})]}),D.length===0?e.jsx("div",{className:"px-5 py-4 text-xs text-muted-foreground/50 italic",children:"No child issues yet"}):e.jsx("div",{className:"px-5 py-2 divide-y divide-border/40",children:D.map(E=>e.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs",children:[e.jsx(hs,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsx("button",{onClick:()=>r(`/${t}/projects/${s}/issues/${E.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:E.identifier}),e.jsx("button",{onClick:()=>r(`/${t}/projects/${s}/issues/${E.id}`),className:"text-foreground hover:text-foreground/70 truncate text-left transition-colors",children:E.title})]},E.id))})]}),e.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:e.jsx(Kd,{issueId:n})}),e.jsx(tt,{zone:"issue.details.after",props:{issue:g}})]}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(tt,{zone:"issue.details.sidebar",props:{issue:g}}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),e.jsxs("div",{className:"px-4 py-1",children:[e.jsx(Dt,{label:"Status",children:e.jsx(oa,{value:g.status,onValueChange:E=>$({status:E},"Status"),options:z,icons:_})}),e.jsx(Dt,{label:"Priority",children:e.jsx(oa,{value:g.priority,onValueChange:E=>$({priority:E},"Priority"),options:Tt,icons:Gb})}),e.jsx(Dt,{label:"Type",children:e.jsx(oa,{value:g.type,onValueChange:E=>$({type:E},"Type"),options:Vt,icons:Qb})}),e.jsx(Dt,{label:"Assignees",children:e.jsx(Kn,{value:g.assignee_ids??[],onChange:E=>$({assignee_ids:E},"Assignees"),disabled:S.isPending})}),e.jsx(Dt,{label:"Sprint",children:e.jsxs(we,{value:g.sprint_id??"none",onValueChange:E=>$({sprint_id:E==="none"?null:E},"Sprint"),children:[e.jsx(ve,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),g.sprint_id?(()=>{const E=C.find(Y=>Y.id===g.sprint_id)??(w==null?void 0:w.find(Y=>Y.id===g.sprint_id));if(!E)return e.jsxs("span",{className:"truncate",children:[g.sprint_id.slice(0,8),"…"]});const Q=si(E);return e.jsxs("span",{className:"truncate",children:[E.name,Q&&e.jsxs("span",{className:"text-muted-foreground ml-1",children:["· ",Q]})]})})():e.jsx("span",{className:"text-muted-foreground",children:"No sprint"})]})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),C.map(E=>{const Q=si(E);return e.jsx(me,{value:E.id,className:"text-xs",children:e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{children:E.name}),Q&&e.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:Q})]})},E.id)})]})]})}),(j??[]).length>0&&e.jsx(Dt,{label:"List",children:e.jsxs(we,{value:g.task_list_id??"none",onValueChange:E=>$({task_list_id:E==="none"?null:E},"List"),children:[e.jsx(ve,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(Pa,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:P?"truncate":"text-muted-foreground",children:(P==null?void 0:P.name)??"No list"})]})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(j??[]).map(E=>e.jsx(me,{value:E.id,className:"text-xs",children:E.name},E.id))]})]})}),e.jsx(Dt,{label:"Start Date",children:e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[e.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:g.start_date?"text-foreground":"text-muted-foreground",children:g.start_date?oe(new Date(g.start_date),"MMM d, yyyy"):"No start date"})]})}),e.jsxs(Ye,{className:"w-auto p-0",align:"start",children:[e.jsx(lt,{mode:"single",selected:g.start_date?new Date(g.start_date):void 0,onSelect:E=>$({start_date:E?oe(E,"yyyy-MM-dd"):null},"Start date"),initialFocus:!0}),g.start_date&&e.jsx("div",{className:"border-t px-3 py-2",children:e.jsxs("button",{onClick:()=>$({start_date:null},"Start date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[e.jsx(ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),e.jsx(Dt,{label:"Due Date",children:e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[e.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:g.due_date?"text-foreground":"text-muted-foreground",children:g.due_date?oe(new Date(g.due_date),"MMM d, yyyy"):"No due date"})]})}),e.jsxs(Ye,{className:"w-auto p-0",align:"start",children:[e.jsx(lt,{mode:"single",selected:g.due_date?new Date(g.due_date):void 0,onSelect:E=>$({due_date:E?oe(E,"yyyy-MM-dd"):null},"Due date"),initialFocus:!0}),g.due_date&&e.jsx("div",{className:"border-t px-3 py-2",children:e.jsxs("button",{onClick:()=>$({due_date:null},"Due date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[e.jsx(ze,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),p&&e.jsx(Dt,{label:"Parent",children:e.jsxs("button",{onClick:()=>r(`/${t}/projects/${s}/issues/${p.id}`),className:"flex items-center gap-1.5 text-xs hover:text-foreground transition-colors text-left w-full min-w-0",children:[e.jsx(Ea,{className:"h-3 w-3 text-muted-foreground shrink-0"}),e.jsx("span",{className:"font-mono text-muted-foreground shrink-0",children:p.identifier}),e.jsx("span",{className:"text-foreground truncate",children:p.title})]})})]})]}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Details"})}),e.jsxs("div",{className:"px-4 pt-3 pb-4 space-y-2.5",children:[e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Created"}),e.jsx("span",{className:"text-foreground",children:oe(new Date(g.created_at),"MMM d, yyyy")})]}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted-foreground",children:"Updated"}),e.jsx("span",{className:"text-foreground",children:oe(new Date(g.updated_at),"MMM d, yyyy")})]})]})]})]})]})})]}),e.jsx(Mr,{open:u,onClose:()=>m(!1),projectId:h,defaultParentId:n,defaultTaskListId:g.task_list_id})]})}function Yt({label:t,children:s}){return e.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:t}),e.jsx("div",{className:"flex-1 min-w-0",children:s})]})}const Jb={backlog:e.jsx(Nt,{className:"h-3 w-3 text-zinc-400"}),todo:e.jsx(Nt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:e.jsx(Xt,{className:"h-3 w-3 text-indigo-500"}),in_review:e.jsx(An,{className:"h-3 w-3 text-amber-500"}),done:e.jsx(Ns,{className:"h-3 w-3 text-emerald-500"}),cancelled:e.jsx(xl,{className:"h-3 w-3 text-zinc-400"})},Zb={urgent:e.jsx(Zs,{className:"h-3 w-3 text-red-500"}),high:e.jsx(fr,{className:"h-3 w-3 text-orange-500"}),medium:e.jsx($n,{className:"h-3 w-3 text-yellow-500"}),low:e.jsx(mr,{className:"h-3 w-3 text-blue-400"})},ey={bug:e.jsx(ml,{className:"h-3 w-3 text-red-500"}),feature:e.jsx(kl,{className:"h-3 w-3 text-purple-500"}),task:e.jsx(Sl,{className:"h-3 w-3 text-blue-500"}),chore:e.jsx(Ma,{className:"h-3 w-3 text-zinc-500"})};function ia({value:t,onValueChange:s,options:n,icons:r,placeholder:a}){return e.jsxs(we,{value:t,onValueChange:s,children:[e.jsx(ve,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[r[t]??e.jsx(hl,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{children:n[t]??a??""})]})}),e.jsx(je,{children:Object.entries(n).map(([o,i])=>e.jsx(me,{value:o,className:"text-xs",children:e.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function ty(t){if(!t.start_date&&!t.end_date)return null;const s=t.start_date?oe(new Date(t.start_date),"MMM d"):"—",n=t.end_date?oe(new Date(t.end_date),"MMM d"):"—";return`${s} – ${n}`}function sy(){const{workspace:t,projectKey:s}=Ge(),n=He(),{workspace:r}=ke(),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState("backlog"),[u,m]=x.useState("medium"),[f,h]=x.useState("task"),[g,y]=x.useState([]),[S,b]=x.useState(""),[w,j]=x.useState(""),[v,C]=x.useState(void 0),[p,D]=x.useState(void 0),{data:P}=ks(s??""),z=(P==null?void 0:P.id)??"",_=dl(),{data:A}=rn(z||void 0),{data:O}=an(z||void 0),{data:$}=Un(z||void 0),E=(O??[]).filter(L=>L.status!=="completed"),Q=A&&A.length>0?Object.fromEntries(A.map(L=>[L.key,L.name])):vs,Y=A&&A.length>0?Object.fromEntries(A.map(L=>[L.key,L.category==="completed"?e.jsx(Ns,{className:"h-3 w-3",style:{color:L.color}}):L.category==="started"?e.jsx(Xt,{className:"h-3 w-3",style:{color:L.color}}):e.jsx(Nt,{className:"h-3 w-3",style:{color:L.color}})])):Jb;if(!s||!z)return null;const V=()=>{if(!a.trim()){R.error("Title is required");return}_.mutate({title:a.trim(),description:i||void 0,status:d,priority:u,type:f,project_id:z,workspace_id:r.id,assignee_ids:g.length>0?g:void 0,sprint_id:S||null,task_list_id:w||null,start_date:v?oe(v,"yyyy-MM-dd"):null,due_date:p?oe(p,"yyyy-MM-dd"):null},{onSuccess:L=>{R.success("Issue created"),n(`/${t}/projects/${s}/issues/${L.issue.id}`,{replace:!0})},onError:L=>R.error(L.message??"Failed to create issue")})};return e.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 h-[57px] bg-white dark:bg-card border-b border-border",children:[e.jsxs(G,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>n(`/${t}/projects/${s}/issues`),children:[e.jsx(_a,{className:"h-3.5 w-3.5"}),(P==null?void 0:P.name)??"Issues"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(G,{variant:"ghost",size:"sm",onClick:()=>n(`/${t}/projects/${s}/issues`),children:"Discard"}),e.jsx(G,{size:"sm",onClick:V,disabled:!a.trim()||_.isPending,className:"px-4",children:_.isPending?"Creating…":"Create issue"})]})]}),e.jsx("div",{className:"px-2 py-2",children:e.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[e.jsx("div",{className:"px-6 pt-6 pb-3",children:e.jsx("input",{autoFocus:!0,value:a,onChange:L=>o(L.target.value),onKeyDown:L=>{L.key==="Enter"&&L.preventDefault()},placeholder:"Issue title…",className:T("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")})}),e.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:e.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),e.jsx(uo,{content:"",onChange:l,placeholder:"Add steps to reproduce, acceptance criteria, or context…",className:"border-t border-border/50 min-h-[320px]"})]}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[e.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),e.jsxs("div",{className:"px-4 py-1",children:[e.jsx(Yt,{label:"Status",children:e.jsx(ia,{value:d,onValueChange:c,options:Q,icons:Y})}),e.jsx(Yt,{label:"Priority",children:e.jsx(ia,{value:u,onValueChange:m,options:Tt,icons:Zb})}),e.jsx(Yt,{label:"Type",children:e.jsx(ia,{value:f,onValueChange:h,options:Vt,icons:ey})}),e.jsx(Yt,{label:"Assignees",children:e.jsx(Kn,{value:g,onChange:y})}),E.length>0&&e.jsx(Yt,{label:"Sprint",children:e.jsxs(we,{value:S||"none",onValueChange:L=>b(L==="none"?"":L),children:[e.jsx(ve,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx(Ee,{placeholder:"No sprint"})]})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),E.map(L=>{const F=ty(L);return e.jsx(me,{value:L.id,className:"text-xs",children:e.jsxs("div",{className:"flex items-baseline gap-1.5",children:[e.jsx("span",{children:L.name}),F&&e.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:F})]})},L.id)})]})]})}),($??[]).length>0&&e.jsx(Yt,{label:"List",children:e.jsxs(we,{value:w||"none",onValueChange:L=>j(L==="none"?"":L),children:[e.jsx(ve,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[e.jsx(Pa,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx(Ee,{placeholder:"No list"})]})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),($??[]).map(L=>e.jsx(me,{value:L.id,className:"text-xs",children:L.name},L.id))]})]})}),e.jsx(Yt,{label:"Start Date",children:e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[e.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:v?"text-foreground":"text-muted-foreground",children:v?oe(v,"MMM d, yyyy"):"No start date"}),v&&e.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),C(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ze,{className:"h-3 w-3"})})]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(lt,{mode:"single",selected:v,onSelect:C,initialFocus:!0})})]})}),e.jsx(Yt,{label:"Due Date",children:e.jsxs(Ke,{children:[e.jsx(Ve,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[e.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:p?"text-foreground":"text-muted-foreground",children:p?oe(p,"MMM d, yyyy"):"No due date"}),p&&e.jsx("button",{type:"button",onClick:L=>{L.stopPropagation(),D(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ze,{className:"h-3 w-3"})})]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(lt,{mode:"single",selected:p,onSelect:D,initialFocus:!0})})]})})]}),e.jsx("div",{className:"px-4 pt-2 pb-3 mt-1 border-t border-border/60",children:e.jsxs("p",{className:"text-[11px] text-muted-foreground/50 leading-relaxed",children:["Press ",e.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})})]})]})})]})}const ny={issue:{icon:Js,label:"Issue"},project:{icon:xt,label:"Project"},comment:{icon:Nl,label:"Comment"},sprint:{icon:Zs,label:"Sprint"}};function ry(t){const s=new Date(t);return og(s)?Jp(s,{addSuffix:!0}):lg(s)?`Yesterday ${oe(s,"h:mm a")}`:oe(s,"MMM d, yyyy")}function ay(){const{workspace:t}=Ge(),s=He(),{data:n,isLoading:r}=xh(),{data:a=[]}=zn(),o=gh(),i=bh(),l=(n==null?void 0:n.filter(u=>!u.read).length)??0,d=Object.fromEntries(a.map(u=>[u.id,u]));function c(u){var m;if(u.entity_type==="issue"&&((m=u.metadata)!=null&&m.project_id)){const f=d[u.metadata.project_id];if(f)return`/${t}/projects/${f.identifier}/issues/${u.entity_id}`}if(u.entity_type==="project"){const f=d[u.entity_id];if(f)return`/${t}/projects/${f.identifier}/board`}return null}return e.jsx("div",{className:"p-2",children:e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[e.jsx("h1",{className:"text-base font-semibold",children:"Notifications"}),l>0&&e.jsxs(G,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>i.mutate(void 0,{onSuccess:()=>R.success("All marked as read"),onError:()=>R.error("Failed")}),disabled:i.isPending,children:[e.jsx(Tm,{className:"h-3.5 w-3.5"}),"Mark all read"]})]}),e.jsxs("div",{className:"grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-2.5 border-b border-border",children:[e.jsx("span",{}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Type"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Message"}),e.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Time"}),e.jsx("span",{})]}),r?e.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(u=>e.jsxs("div",{className:"grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-3",children:[e.jsx("div",{}),e.jsx(se,{className:"h-5 w-20 rounded-full"}),e.jsx(se,{className:"h-4 w-3/4"}),e.jsx(se,{className:"h-4 w-20"}),e.jsx("div",{})]},u))}):n!=null&&n.length?e.jsx("div",{className:"divide-y divide-border",children:n.map(u=>{const m=ny[u.entity_type]??{icon:Ls,label:u.entity_type},f=m.icon,h=c(u);return e.jsxs("div",{className:T("grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-3 transition-colors",!u.read&&"bg-[#eff6ff] dark:bg-indigo-950/20","hover:bg-[#f9fafb] dark:hover:bg-muted/30",h&&"cursor-pointer"),onClick:()=>{h&&(u.read||o.mutate(u.id),s(h))},children:[e.jsx("div",{className:"flex items-center justify-center",children:!u.read&&e.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-indigo-500 shrink-0"})}),e.jsx("div",{children:e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground bg-muted px-2 py-0.5 rounded-full",children:[e.jsx(f,{className:"h-3 w-3"}),m.label]})}),e.jsx("p",{className:T("text-sm truncate",u.read?"text-muted-foreground":"font-medium text-foreground"),children:u.message}),e.jsx("span",{className:"text-xs text-muted-foreground",children:ry(u.created_at)}),e.jsx("div",{className:"flex justify-end",onClick:g=>g.stopPropagation(),children:!u.read&&e.jsx(G,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground px-2",onClick:()=>o.mutate(u.id,{onError:()=>R.error("Failed")}),children:"Mark read"})})]},u.id)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:e.jsx(Ls,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium mb-1",children:"No notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"You're all caught up."})]}),!r&&!!(n!=null&&n.length)&&e.jsx("div",{className:"px-6 py-3 border-t border-border",children:e.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.length," notification",n.length!==1?"s":"",l>0?` · ${l} unread`:""]})})]})})}function oy({open:t,onClose:s,projectId:n}){const[r,a]=x.useState(""),[o,i]=x.useState(""),[l,d]=x.useState(),[c,u]=x.useState(),[m,f]=x.useState(!1),[h,g]=x.useState(!1),y=wg(n);function S(){a(""),i(""),d(void 0),u(void 0),s()}async function b(w){w.preventDefault(),r.trim()&&y.mutate({name:r.trim(),goal:o.trim()||void 0,start_date:l?oe(l,"yyyy-MM-dd"):null,end_date:c?oe(c,"yyyy-MM-dd"):null},{onSuccess:()=>{R.success("Sprint created"),S()},onError:()=>R.error("Failed to create sprint")})}return e.jsx(Ms,{open:t,onOpenChange:w=>!w&&S(),children:e.jsxs(Ds,{className:"sm:max-w-md",children:[e.jsx(en,{children:e.jsx(sn,{children:"New Sprint"})}),e.jsxs("form",{onSubmit:b,className:"flex flex-col flex-1 overflow-hidden",children:[e.jsxs(tn,{className:"space-y-4 py-1",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{htmlFor:"sprint-name",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(xe,{id:"sprint-name",placeholder:"e.g. Sprint 1",value:r,onChange:w=>a(w.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs(We,{htmlFor:"sprint-goal",children:["Goal ",e.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),e.jsx(Nr,{id:"sprint-goal",placeholder:"What do you want to achieve in this sprint?",value:o,onChange:w=>i(w.target.value),className:"resize-none text-sm",rows:2})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{children:"Start Date"}),e.jsxs(Ke,{open:m,onOpenChange:f,children:[e.jsx(Ve,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:T("w-full justify-start text-left font-normal text-sm h-9",!l&&"text-muted-foreground"),children:[e.jsx(ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),l?oe(l,"MMM d, yyyy"):"Pick date"]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(lt,{mode:"single",selected:l,onSelect:w=>{d(w),f(!1)},disabled:w=>c?w>c:!1,initialFocus:!0})})]})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(We,{children:"End Date"}),e.jsxs(Ke,{open:h,onOpenChange:g,children:[e.jsx(Ve,{asChild:!0,children:e.jsxs(G,{variant:"outline",className:T("w-full justify-start text-left font-normal text-sm h-9",!c&&"text-muted-foreground"),children:[e.jsx(ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),c?oe(c,"MMM d, yyyy"):"Pick date"]})}),e.jsx(Ye,{className:"w-auto p-0",align:"start",children:e.jsx(lt,{mode:"single",selected:c,onSelect:w=>{u(w),g(!1)},disabled:w=>l?w<l:!1,initialFocus:!0})})]})]})]})]}),e.jsxs(Yn,{children:[e.jsx(G,{type:"button",variant:"ghost",onClick:S,children:"Cancel"}),e.jsx(G,{type:"submit",disabled:!r.trim()||y.isPending,children:y.isPending?"Creating…":"Create Sprint"})]})]})]})})}const iy={active:{label:"Active",icon:xr,badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",section:"Active Sprint"},planned:{label:"Planned",icon:Xt,badge:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",section:"Planned"},completed:{label:"Completed",icon:Ns,badge:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",section:"Completed"}};function ly({sprint:t,projectId:s,issueCount:n}){const r=Ng(t.id,s),a=kg(s),o=iy[t.status],i=o.icon;function l(){r.mutate({status:"active"},{onSuccess:()=>R.success(`"${t.name}" started`),onError:()=>R.error("Failed to start sprint")})}function d(){r.mutate({status:"completed"},{onSuccess:()=>R.success(`"${t.name}" completed`),onError:f=>R.error((f==null?void 0:f.message)??"Failed to complete sprint")})}function c(){confirm(`Delete sprint "${t.name}"? This cannot be undone.`)&&a.mutate(t.id,{onSuccess:()=>R.success("Sprint deleted"),onError:()=>R.error("Failed to delete sprint")})}const u=!!t.start_date,m=!!t.end_date;return e.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("div",{className:T("flex h-7 w-7 items-center justify-center rounded-full shrink-0",t.status==="active"?"bg-emerald-100 dark:bg-emerald-900/30":t.status==="completed"?"bg-blue-100 dark:bg-blue-900/30":"bg-zinc-100 dark:bg-zinc-800"),children:e.jsx(i,{className:T("h-3.5 w-3.5",t.status==="active"?"text-emerald-600 dark:text-emerald-400":t.status==="completed"?"text-blue-600 dark:text-blue-400":"text-zinc-500")})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.name}),t.goal&&e.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5 flex items-center gap-1",children:[e.jsx(nf,{className:"h-3 w-3 shrink-0"}),t.goal]})]})]}),e.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 w-52",children:[e.jsx(Da,{className:"h-3.5 w-3.5 shrink-0"}),u||m?e.jsxs("span",{children:[u?oe(new Date(t.start_date),"MMM d"):"—"," → ",m?oe(new Date(t.end_date),"MMM d, yyyy"):"—"]}):e.jsx("span",{className:"italic",children:"No dates set"})]}),e.jsxs("div",{className:"text-xs text-muted-foreground shrink-0 w-20 text-right",children:[n," issue",n!==1?"s":""]}),e.jsx(Er,{className:T("shrink-0 text-[11px] border-0 w-20 justify-center",o.badge),children:o.label}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[t.status==="planned"&&e.jsxs(G,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:l,disabled:r.isPending,children:[e.jsx(xr,{className:"h-3 w-3"}),"Start"]}),t.status==="active"&&e.jsxs(G,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:d,disabled:r.isPending,children:[e.jsx(Ns,{className:"h-3 w-3"}),"Complete"]}),e.jsx(G,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:c,disabled:a.isPending,children:e.jsx(Pt,{className:"h-3.5 w-3.5"})})]})]})}function dy(){const{projectKey:t}=Ge(),[s,n]=x.useState(!1),{data:r}=ks(t??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=an(a||void 0),{data:l}=On(a||void 0),d=(l??[]).reduce((m,f)=>(f.sprint_id&&(m[f.sprint_id]=(m[f.sprint_id]??0)+1),m),{}),c={active:(o??[]).filter(m=>m.status==="active"),planned:(o??[]).filter(m=>m.status==="planned"),completed:(o??[]).filter(m=>m.status==="completed")},u=[{key:"active",label:"Active Sprint",items:c.active},{key:"planned",label:"Planned",items:c.planned},{key:"completed",label:"Completed",items:c.completed}];return e.jsxs("div",{className:"p-2",children:[e.jsx(tt,{zone:"project.sprints.before",props:{projectId:a}}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:e.jsxs(G,{size:"sm",onClick:()=>n(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"New Sprint"]})}),i?e.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(m=>e.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[e.jsx(se,{className:"h-7 w-7 rounded-full"}),e.jsx(se,{className:"h-4 w-40"}),e.jsx("div",{className:"flex-1"}),e.jsx(se,{className:"h-4 w-32"}),e.jsx(se,{className:"h-5 w-20"})]},m))}):(o??[]).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:e.jsx(Da,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium mb-1",children:"No sprints yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a sprint to start planning your work in time-boxed iterations."}),e.jsxs(G,{size:"sm",onClick:()=>n(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"New Sprint"]})]}):e.jsx("div",{children:u.map(({key:m,label:f,items:h})=>h.length===0?null:e.jsxs("div",{children:[e.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:f})}),e.jsx("div",{className:"divide-y divide-border",children:h.map(g=>e.jsx(ly,{sprint:g,projectId:a,issueCount:d[g.id]??0},g.id))})]},m))})]}),e.jsx(tt,{zone:"project.sprints.after",props:{projectId:a}}),e.jsx(oy,{open:s,onClose:()=>n(!1),projectId:a})]})}const Us={all:["roles"],list:()=>[...Us.all,"list"],detail:t=>[...Us.all,t]};function ho(){return Ne({queryKey:Us.list(),queryFn:()=>J.get("/admin/roles"),select:t=>t.roles,staleTime:1e3*60*2})}function cy(){const t=ce();return le({mutationFn:s=>J.post("/admin/roles",s),onSuccess:()=>{t.invalidateQueries({queryKey:Us.list()})}})}function uy(t){const s=ce();return le({mutationFn:n=>J.put(`/admin/roles/${t}`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Us.list()})}})}function my(){const t=ce();return le({mutationFn:s=>J.delete(`/admin/roles/${s}`),onSuccess:()=>{t.invalidateQueries({queryKey:Us.list()})}})}function fy(){const t=ce();return le({mutationFn:({userId:s,appRoleId:n})=>J.patch(`/admin/users/${s}/role`,{app_role_id:n}),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}const lr=[{group:"Members & Invitations",permissions:[{key:"member:invite",label:"Invite members"},{key:"member:remove",label:"Remove members"},{key:"member:update_role",label:"Change member roles"}]},{group:"Workspaces",permissions:[{key:"workspace:create",label:"Create workspaces"},{key:"workspace:update",label:"Update workspace settings"},{key:"workspace:delete",label:"Delete workspaces"}]},{group:"Projects",permissions:[{key:"project:create",label:"Create projects"},{key:"project:update",label:"Update project settings"},{key:"project:delete",label:"Delete projects"},{key:"project:archive",label:"Archive projects"},{key:"project:manage_access",label:"Manage project access"}]},{group:"Issues",permissions:[{key:"issue:create",label:"Create issues"},{key:"issue:update",label:"Update issues"},{key:"issue:delete",label:"Delete issues"},{key:"issue:assign",label:"Assign issues"},{key:"issue:update_status",label:"Update issue status"}]},{group:"Sprints",permissions:[{key:"sprint:create",label:"Create sprints"},{key:"sprint:start",label:"Start sprints"},{key:"sprint:complete",label:"Complete sprints"},{key:"sprint:delete",label:"Delete sprints"}]},{group:"Teams",permissions:[{key:"team:create",label:"Create teams"},{key:"team:update",label:"Update teams"},{key:"team:delete",label:"Delete teams"},{key:"team:manage_members",label:"Manage team members"}]},{group:"Roles",permissions:[{key:"role:create",label:"Create roles"},{key:"role:update",label:"Update roles"},{key:"role:delete",label:"Delete roles"},{key:"role:assign",label:"Assign roles to users"}]}];function Dn({open:t,onClose:s,onConfirm:n,title:r,description:a,confirmLabel:o="Confirm",variant:i="default",loading:l=!1}){return e.jsx(fo,{open:t,onOpenChange:d=>!d&&s(),children:e.jsxs(Or,{children:[e.jsxs(Tr,{children:[e.jsx(Ar,{children:r}),e.jsx($r,{children:a})]}),e.jsxs(Pr,{children:[e.jsx(Ir,{onClick:s,disabled:l,children:"Cancel"}),e.jsx(Rr,{onClick:n,disabled:l,className:T(i==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus:ring-destructive"),children:l?"Please wait…":o})]})]})})}const hy=["workspace:update","workspace:delete","workspace:create"];function ni(t,s){const n=s.find(r=>r.id===t);return n&&hy.some(r=>n.permissions.includes(r))?"admin":"member"}function xo({value:t,className:s}){const[n,r]=x.useState(!1),a=()=>{navigator.clipboard.writeText(t),r(!0),setTimeout(()=>r(!1),1500)};return e.jsx("button",{onClick:a,className:T("text-muted-foreground hover:text-foreground transition-colors",s),title:"Copy",children:n?e.jsx(it,{className:"h-3.5 w-3.5 text-emerald-500"}):e.jsx($m,{className:"h-3.5 w-3.5"})})}function ri({value:t,onChange:s,appRoles:n}){return!n||n.length===0?e.jsxs("div",{className:"flex items-start gap-2 px-3 py-2.5 border border-border rounded-lg bg-muted/40 text-xs text-muted-foreground",children:[e.jsx(Pm,{className:"h-3.5 w-3.5 shrink-0 mt-0.5"}),e.jsxs("span",{children:["No roles created yet."," ",e.jsx("a",{href:"?tab=roles",className:"underline hover:text-foreground transition-colors",children:"Create roles"})," ","before inviting members."]})]}):e.jsxs(we,{value:t,onValueChange:s,children:[e.jsx(ve,{className:"h-15",children:e.jsx(Ee,{placeholder:"Select a role…"})}),e.jsx(je,{children:n.map(r=>e.jsx(me,{value:r.id,children:e.jsxs("div",{className:"flex flex-col items-start",children:[e.jsx("span",{children:r.name}),r.description&&e.jsx("span",{className:"text-xs text-muted-foreground",children:r.description})]})},r.id))})]})}function xy({open:t,onClose:s,workspaceId:n}){const[r,a]=x.useState("existing"),[o,i]=x.useState(""),[l,d]=x.useState(""),[c,u]=x.useState(""),[m,f]=x.useState(""),[h,g]=x.useState(""),[y,S]=x.useState(null),{data:b=[]}=yd(),{data:w=[]}=In(n),j=vf(n),v=bf(n),{data:C}=ho(),p=x.useMemo(()=>new Set(w.map(O=>O.user_id)),[w]),D=x.useMemo(()=>b.filter(O=>!p.has(O.id)),[b,p]),P=x.useMemo(()=>{const O=o.toLowerCase().trim();return O?D.filter($=>$.email.toLowerCase().includes(O)||`${$.first_name} ${$.last_name}`.toLowerCase().includes(O)):D},[D,o]);x.useEffect(()=>{if(t){const O=C&&C.length>0?C[0].id:"";i(""),d(""),u(O),f(""),g(O),S(null),a("existing")}},[t,C]);const z=O=>{var $;return(($=C==null?void 0:C.find(E=>E.id===O))==null?void 0:$.name)??"Member"},_=()=>{if(!l||!c)return;const O=ni(c,C??[]);j.mutate({user_id:l,role:O,app_role_id:c},{onSuccess:()=>{R.success("Member added"),s()},onError:$=>R.error($.message||"Failed to add member")})},A=O=>{if(O.preventDefault(),!h)return;const $=ni(h,C??[]);v.mutate({email:m.trim()||void 0,role:$,app_role_id:h},{onSuccess:E=>{S(E.invitation),R.success("Invitation created")},onError:E=>R.error(E.message||"Failed to create invitation")})};return e.jsx(vr,{open:t,onOpenChange:O=>!O&&s(),children:e.jsxs(Bn,{className:"sm:max-w-[520px] bg-white dark:bg-indigo-950/50",children:[e.jsx(jr,{children:e.jsx(wr,{children:"Add member"})}),!y&&e.jsxs("div",{className:"flex rounded-lg border border-border p-0.5 bg-muted/40 gap-0.5",children:[e.jsx("button",{type:"button",onClick:()=>a("existing"),className:T("flex-1 text-sm py-1.5 rounded-md font-medium transition-colors",r==="existing"?"bg-white dark:bg-card shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:"Existing user"}),e.jsx("button",{type:"button",onClick:()=>a("invite"),className:T("flex-1 text-sm py-1.5 rounded-md font-medium transition-colors",r==="invite"?"bg-white dark:bg-card shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:"Send invite"})]}),r==="existing"&&!y&&e.jsxs("div",{className:"space-y-3 pt-1",children:[e.jsx(xe,{placeholder:"Search by name or email…",value:o,onChange:O=>i(O.target.value),className:"h-9",autoFocus:!0}),e.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:D.length===0?e.jsxs("div",{className:"py-8 text-center px-4",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"All users are already members."}),e.jsx("button",{className:"mt-2 text-xs text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",onClick:()=>a("invite"),children:"Send an invite instead"})]}):P.length===0?e.jsx("div",{className:"py-6 text-center",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:['No users match "',o,'"']})}):e.jsx("div",{className:"max-h-52 overflow-y-auto divide-y divide-border",children:P.map(O=>{const $=O.first_name??"",E=O.last_name??"",Q=`${$} ${E}`.trim()||O.email,Y=($[0]??E[0]??O.email[0]??"U").toUpperCase(),V=l===O.id;return e.jsxs("button",{type:"button",onClick:()=>d(V?"":O.id),className:T("w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",V?"bg-indigo/5 dark:bg-indigo/10":"hover:bg-muted/40"),children:[e.jsx(st,{className:"h-7 w-7 shrink-0",children:e.jsx(nt,{className:"text-[11px] font-medium",children:Y})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:Q}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:O.email})]}),V&&e.jsx(it,{className:"h-4 w-4 text-indigo shrink-0"})]},O.id)})})}),D.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1.5 text-left",children:[e.jsx("label",{className:"text-xs font-medium text-black dark:text-white ",children:"Role"}),e.jsx(ri,{value:c,onChange:u,appRoles:C})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),e.jsx(G,{type:"button",size:"sm",disabled:!l||!c||j.isPending,onClick:_,children:j.isPending?"Adding…":"Add to workspace"})]})]})]}),r==="invite"&&!y&&e.jsxs("form",{onSubmit:A,className:"space-y-4 pt-1",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-medium text-black dark:text-white ",children:["Email ",e.jsx("span",{className:"font-normal",children:"(optional)"})]}),e.jsx(xe,{type:"email",placeholder:"colleague@example.com",value:m,onChange:O=>f(O.target.value),className:"h-9",autoFocus:!0}),e.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Leave blank to generate a shareable link."})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-black dark:text-white ",children:"Role"}),e.jsx(ri,{value:h,onChange:g,appRoles:C})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),e.jsx(G,{type:"submit",size:"sm",disabled:!h||v.isPending,children:v.isPending?"Creating…":"Create invitation"})]})]}),y&&e.jsxs("div",{className:"space-y-4 pt-1",children:[e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Share this link with"," ",y.email?e.jsx("span",{className:"font-medium text-foreground",children:y.email}):"anyone you want to invite",". They will join as"," ",e.jsx("span",{className:"font-medium text-foreground",children:z(h)}),"."]}),e.jsxs("div",{className:"flex items-start gap-2 p-3 bg-muted/50 rounded-lg border border-border",children:[e.jsx(Aa,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5"}),e.jsx("span",{className:"text-xs font-mono text-foreground flex-1 min-w-0 break-all",children:`${window.location.origin}/invite/${y.token}`}),e.jsx(xo,{value:`${window.location.origin}/invite/${y.token}`,className:"shrink-0"})]}),e.jsxs("div",{className:"flex items-center justify-between pt-1",children:[e.jsx("button",{className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>S(null),children:"Create another"}),e.jsx(G,{size:"sm",onClick:s,children:"Done"})]})]})]})})}function py({invitation:t,workspaceId:s}){const n=yf(s),r=`${window.location.origin}/invite/${t.token}`;return e.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5 hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors group",children:[e.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:e.jsx(Aa,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.email??"Shareable link"}),e.jsx("span",{className:T("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",t.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:t.role==="admin"?"Admin":"Member"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[e.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[280px]",children:r}),e.jsx(xo,{value:r})]})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("span",{className:"text-xs text-muted-foreground hidden sm:block",children:oe(new Date(t.created_at),"MMM d")}),e.jsx("button",{onClick:()=>n.mutate(t.id,{onSuccess:()=>R.success("Invitation revoked"),onError:()=>R.error("Failed to revoke")}),disabled:n.isPending,className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive disabled:opacity-50",title:"Revoke invitation",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]})]})}function gy({workspaceId:t}){const{workspace:s,setWorkspace:n}=ke(),{data:r,isLoading:a}=gr(),o=r==null?void 0:r.find(m=>m.id===(s==null?void 0:s.id)),i=pf(t),[l,d]=x.useState("");x.useEffect(()=>{o&&d(o.name)},[o==null?void 0:o.name]);const c=o?l.trim()!==o.name:!1,u=()=>{!l.trim()||!o||i.mutate({name:l.trim()},{onSuccess:m=>{n({id:m.workspace.id,name:m.workspace.name,slug:m.workspace.slug}),R.success("Workspace updated")},onError:()=>R.error("Failed to update workspace")})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:e.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Workspace details"})}),e.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Name"}),a?e.jsx(se,{className:"h-8 w-64"}):e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(xe,{value:l,onChange:m=>d(m.target.value),className:"h-8 w-64 text-sm bg-transparent",placeholder:"Workspace name"}),c&&e.jsx(G,{size:"sm",className:"h-8",onClick:u,disabled:!l.trim()||i.isPending,children:i.isPending?"Saving…":"Save"})]})]}),e.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"URL slug"}),a?e.jsx(se,{className:"h-4 w-40"}):e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx("span",{className:"font-mono text-foreground",children:o==null?void 0:o.slug}),e.jsx(xo,{value:(o==null?void 0:o.slug)??""})]})]}),e.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Plan"}),a?e.jsx(se,{className:"h-4 w-16"}):e.jsx("span",{className:"text-sm capitalize",children:(o==null?void 0:o.plan)??"free"})]}),e.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Created"}),a?e.jsx(se,{className:"h-4 w-28"}):e.jsx("span",{className:"text-sm text-muted-foreground",children:o!=null&&o.created_at?oe(new Date(o.created_at),"MMMM d, yyyy"):"—"})]})]})}function by({workspaceId:t,onInvite:s}){var S,b;const{data:n,isLoading:r}=In(t),{data:a,isLoading:o}=gf(t),i=jf(t),l=wf(t),d=fy(),{data:c}=ho(),{user:u}=ke(),[m,f]=x.useState(null),[h,g]=x.useState(null),y=(a==null?void 0:a.filter(w=>w.status==="pending"))??[];return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:e.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Members",!r&&n&&e.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",n.length]})]})}),r?e.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(w=>e.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[e.jsx(se,{className:"h-7 w-7 rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(se,{className:"h-3.5 w-32"}),e.jsx(se,{className:"h-3 w-48"})]})]},w))}):n!=null&&n.length?e.jsx("div",{className:"divide-y divide-border",children:n.map(w=>{var z;const j=w.user,v=(j==null?void 0:j.first_name)??"",C=(j==null?void 0:j.last_name)??"",p=`${v} ${C}`.trim()||(j==null?void 0:j.email)||"Unknown",D=(v[0]??C[0]??((z=j==null?void 0:j.email)==null?void 0:z[0])??"U").toUpperCase(),P=(j==null?void 0:j.id)===(u==null?void 0:u.id);return e.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5 hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors group",children:[e.jsx(st,{className:"h-7 w-7 shrink-0",children:e.jsx(nt,{className:"text-[11px] font-medium",children:D})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:p}),P&&e.jsx("span",{className:"text-[11px] text-muted-foreground",children:"(you)"})]}),(j==null?void 0:j.email)&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:j.email})]}),e.jsx("span",{className:T("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",w.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:w.role==="admin"?"Admin":"Member"}),c&&c.length>0&&e.jsxs(we,{value:w.app_role_id??"none",onValueChange:_=>d.mutate({userId:w.user_id,appRoleId:_==="none"?null:_},{onSuccess:()=>R.success("Custom role updated"),onError:()=>R.error("Failed to update custom role")}),children:[e.jsx(ve,{className:"h-7 text-[11px] w-32 shrink-0",children:e.jsx(Ee,{placeholder:"Custom role"})}),e.jsxs(je,{children:[e.jsx(me,{value:"none",children:e.jsx("span",{className:"text-muted-foreground",children:"No custom role"})}),c.map(_=>e.jsx(me,{value:_.id,children:_.name},_.id))]})]}),!P&&e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:e.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:e.jsx(Pn,{className:"h-4 w-4"})})}),e.jsxs(Jt,{align:"end",className:"w-44",children:[e.jsx(Ue,{onClick:()=>g({member:w,newRole:w.role==="admin"?"member":"admin"}),children:w.role==="admin"?"Make member":"Make admin"}),e.jsx(Ue,{onClick:()=>{fetch(`/admin/users/${w.user_id}/sessions`,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("meridian_token")}`}}).then(()=>R.success("Sessions revoked — user will be signed out")).catch(()=>R.error("Failed to revoke sessions"))},children:"Revoke sessions"}),e.jsx(Fn,{}),e.jsxs(Ue,{className:"text-destructive focus:text-destructive",onClick:()=>f(w),children:[e.jsx(Pt,{className:"h-3.5 w-3.5 mr-2"}),"Remove"]})]})]})]},w.id)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:e.jsx(mf,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium mb-1",children:"No members yet"}),e.jsx("button",{onClick:s,className:"text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}),e.jsxs("div",{className:"px-6 py-2 border-t border-b border-border bg-muted/20 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Pending invitations",!o&&y.length>0&&e.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",y.length]})]}),e.jsxs("button",{onClick:s,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Ae,{className:"h-3 w-3"}),"Invite"]})]}),o?e.jsx("div",{className:"divide-y divide-border",children:[1,2].map(w=>e.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[e.jsx(se,{className:"h-7 w-7 rounded-full shrink-0"}),e.jsxs("div",{className:"flex-1 space-y-1.5",children:[e.jsx(se,{className:"h-3.5 w-48"}),e.jsx(se,{className:"h-3 w-64"})]})]},w))}):y.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"No pending invitations."}),e.jsx("button",{onClick:s,className:"mt-2 text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}):e.jsx("div",{className:"divide-y divide-border",children:y.map(w=>e.jsx(py,{invitation:w,workspaceId:t},w.id))}),e.jsx(Dn,{open:!!m,onClose:()=>f(null),onConfirm:()=>{m&&l.mutate(m.user_id,{onSuccess:()=>{R.success("Member removed"),f(null)},onError:()=>{R.error("Failed to remove member"),f(null)}})},title:"Remove member",description:`Remove ${((S=m==null?void 0:m.user)==null?void 0:S.email)??"this member"} from the workspace? They will lose access to all projects.`,confirmLabel:"Remove",variant:"destructive",loading:l.isPending}),e.jsx(Dn,{open:!!h,onClose:()=>g(null),onConfirm:()=>{h&&i.mutate({userId:h.member.user_id,role:h.newRole},{onSuccess:()=>{R.success("Role updated"),g(null)},onError:()=>{R.error("Failed to update role"),g(null)}})},title:"Change role",description:`Make ${((b=h==null?void 0:h.member.user)==null?void 0:b.email)??"this member"} a workspace ${(h==null?void 0:h.newRole)==="admin"?"admin":"member"}?`,confirmLabel:"Change role",loading:i.isPending})]})}function yy({workspaceId:t,teamId:s,allMembers:n}){var b,w;const{data:r,isLoading:a}=Sf(t,s),o=Cf(t,s),i=Mf(t,s),[l,d]=x.useState(""),[c,u]=x.useState(null),[m,f]=x.useState(null),h=new Set((r==null?void 0:r.map(j=>j.user_id))??[]),g=n.filter(j=>!h.has(j.user_id)),y=r==null?void 0:r.find(j=>j.user_id===c),S=n.find(j=>j.user_id===m);return e.jsxs("div",{className:"bg-muted/10 border-t border-border",children:[a?e.jsx("div",{className:"px-8 py-3",children:e.jsx(se,{className:"h-3 w-40"})}):(r==null?void 0:r.length)===0?e.jsx("p",{className:"px-8 py-3 text-xs text-muted-foreground",children:"No members in this team yet."}):e.jsx("div",{className:"divide-y divide-border/50",children:r==null?void 0:r.map(j=>{var z;const v=j.user,C=(v==null?void 0:v.first_name)??"",p=(v==null?void 0:v.last_name)??"",D=`${C} ${p}`.trim()||(v==null?void 0:v.email)||"Unknown",P=(C[0]??p[0]??((z=v==null?void 0:v.email)==null?void 0:z[0])??"U").toUpperCase();return e.jsxs("div",{className:"flex items-center gap-3 px-8 py-2.5 group hover:bg-muted/20 transition-colors",children:[e.jsx(st,{className:"h-6 w-6 shrink-0",children:e.jsx(nt,{className:"text-[10px] font-medium",children:P})}),e.jsx("span",{className:"flex-1 text-sm truncate",children:D}),e.jsx("button",{onClick:()=>u(j.user_id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Remove from team",children:e.jsx(ze,{className:"h-3.5 w-3.5"})})]},j.id)})}),g.length>0&&e.jsxs("div",{className:"px-8 py-2.5 flex items-center gap-2 border-t border-border/50",children:[e.jsx(Rn,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsxs(we,{value:l,onValueChange:d,children:[e.jsx(ve,{className:"h-7 text-xs flex-1 max-w-[200px]",children:e.jsx(Ee,{placeholder:"Add member…"})}),e.jsx(je,{children:g.map(j=>{const v=j.user,C=(v==null?void 0:v.first_name)??"",p=(v==null?void 0:v.last_name)??"",D=`${C} ${p}`.trim()||(v==null?void 0:v.email)||"Unknown";return e.jsx(me,{value:j.user_id,children:D},j.user_id)})})]}),l&&e.jsx(G,{size:"sm",className:"h-7 text-xs px-2",disabled:o.isPending,onClick:()=>f(l),children:"Add"})]}),e.jsx(Dn,{open:!!c,onClose:()=>u(null),onConfirm:()=>{c&&i.mutate(c,{onSuccess:()=>{R.success("Removed from team"),u(null)},onError:()=>{R.error("Failed to remove"),u(null)}})},title:"Remove from team",description:`Remove ${((b=y==null?void 0:y.user)==null?void 0:b.email)??"this member"} from the team?`,confirmLabel:"Remove",variant:"destructive",loading:i.isPending}),e.jsx(Dn,{open:!!m,onClose:()=>{f(null),d("")},onConfirm:()=>{m&&o.mutate(m,{onSuccess:()=>{R.success("Added to team"),f(null),d("")},onError:()=>{R.error("Failed to add"),f(null)}})},title:"Add to team",description:`Add ${((w=S==null?void 0:S.user)==null?void 0:w.email)??"this member"} to the team?`,confirmLabel:"Add",loading:o.isPending})]})}function vy({workspaceId:t}){const{data:s,isLoading:n}=za(t),{data:r}=In(t),a=Nf(t),o=kf(t),[i,l]=x.useState(new Set),[d,c]=x.useState(!1),[u,m]=x.useState(""),[f,h]=x.useState(null),g=s==null?void 0:s.find(b=>b.id===f),y=b=>{l(w=>{const j=new Set(w);return j.has(b)?j.delete(b):j.add(b),j})},S=b=>{b.preventDefault(),u.trim()&&a.mutate({name:u.trim()},{onSuccess:()=>{R.success("Team created"),m(""),c(!1)},onError:()=>R.error("Failed to create team")})};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:[e.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Teams",!n&&s&&e.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",s.length]})]}),e.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx(Ae,{className:"h-3 w-3"}),"New team"]})]}),d&&e.jsx("div",{className:"px-6 py-3 border-b border-border bg-muted/5",children:e.jsxs("form",{onSubmit:S,className:"flex items-center gap-2",children:[e.jsx(xe,{autoFocus:!0,placeholder:"Team name",value:u,onChange:b=>m(b.target.value),className:"h-8 text-sm flex-1 max-w-[240px]"}),e.jsx(G,{type:"submit",size:"sm",className:"h-8",disabled:!u.trim()||a.isPending,children:a.isPending?"Creating…":"Create"}),e.jsx(G,{type:"button",variant:"ghost",size:"sm",className:"h-8",onClick:()=>{c(!1),m("")},children:"Cancel"})]})}),n?e.jsx("div",{className:"divide-y divide-border",children:[1,2].map(b=>e.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[e.jsx(se,{className:"h-7 w-7 rounded-lg shrink-0"}),e.jsx(se,{className:"h-3.5 w-32"})]},b))}):s!=null&&s.length?e.jsx("div",{className:"divide-y divide-border",children:s.map(b=>{const w=i.has(b.id);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5 hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors group",children:[e.jsx("button",{onClick:()=>y(b.id),className:"text-muted-foreground hover:text-foreground shrink-0 transition-colors",children:w?e.jsx(Qs,{className:"h-4 w-4"}):e.jsx(Xs,{className:"h-4 w-4"})}),e.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:e.jsx(gs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:b.name}),b.description&&e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:b.description})]}),e.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[b.member_count," ",b.member_count===1?"member":"members"]}),e.jsxs(Ss,{children:[e.jsx(Cs,{asChild:!0,children:e.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:e.jsx(Pn,{className:"h-4 w-4"})})}),e.jsx(Jt,{align:"end",className:"w-36",children:e.jsxs(Ue,{className:"text-destructive focus:text-destructive",onClick:()=>h(b.id),children:[e.jsx(Pt,{className:"h-3.5 w-3.5 mr-2"}),"Delete team"]})})]})]}),w&&e.jsx(yy,{workspaceId:t,teamId:b.id,allMembers:r??[]})]},b.id)})}):e.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[e.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:e.jsx(gs,{className:"h-5 w-5 text-muted-foreground"})}),e.jsx("p",{className:"text-sm font-medium mb-1",children:"No teams yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Teams make it easy to grant project access to groups of people."}),e.jsx(G,{variant:"outline",size:"sm",onClick:()=>c(!0),children:"Create a team"})]}),e.jsx(Dn,{open:!!f,onClose:()=>h(null),onConfirm:()=>{f&&o.mutate(f,{onSuccess:()=>{R.success("Team deleted"),h(null)},onError:()=>{R.error("Failed to delete team"),h(null)}})},title:"Delete team",description:`Delete "${(g==null?void 0:g.name)??"this team"}"? All members will be removed from the team. Projects will not be affected.`,confirmLabel:"Delete team",variant:"destructive",loading:o.isPending})]})}const jy=["general","members","teams"];function wy(){const{workspace:t}=ke(),s=(t==null?void 0:t.id)??"",[n,r]=di(),a=n.get("tab"),[o,i]=x.useState(jy.includes(a)?a:"general"),l=u=>{i(u),r({tab:u},{replace:!0})},[d,c]=x.useState(!1);return e.jsxs("div",{className:"p-2",children:[e.jsx(tt,{zone:"workspace.settings.before",props:{workspaceId:s}}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2",children:[e.jsx("div",{className:"flex",children:["general","members","teams"].map(u=>e.jsx("button",{onClick:()=>l(u),className:T("h-12 px-4 text-sm font-medium border-b-2 transition-colors capitalize",o===u?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:u},u))}),o==="members"&&e.jsxs(G,{size:"sm",onClick:()=>c(!0),children:[e.jsx(Ae,{className:"h-4 w-4"}),"Add member"]})]}),o==="general"&&e.jsx(gy,{workspaceId:s}),o==="members"&&e.jsx(by,{workspaceId:s,onInvite:()=>c(!0)}),o==="teams"&&e.jsx(vy,{workspaceId:s})]}),e.jsx(tt,{zone:"workspace.settings.after",props:{workspaceId:s}}),e.jsx(xy,{open:d,onClose:()=>c(!1),workspaceId:s})]})}function Ny({open:t,onClose:s}){const[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(new Set),d=cy();x.useEffect(()=>{t&&(r(""),o(""),l(new Set))},[t]);const c=lr.flatMap(y=>y.permissions.map(S=>S.key)),u=c.every(y=>i.has(y)),m=!u&&c.some(y=>i.has(y)),f=()=>{l(u?new Set:new Set(c))},h=y=>{l(S=>{const b=new Set(S);return b.has(y)?b.delete(y):b.add(y),b})},g=y=>{y.preventDefault(),n.trim()&&d.mutate({name:n.trim(),description:a.trim()||void 0,permissions:Array.from(i)},{onSuccess:()=>{R.success("Role created"),s()},onError:S=>R.error(S.message||"Failed to create role")})};return e.jsx(vr,{open:t,onOpenChange:y=>!y&&s(),children:e.jsxs(Bn,{className:"sm:max-w-[580px] max-h-[85vh] overflow-y-auto",children:[e.jsxs(jr,{children:[e.jsx(wr,{children:"Create role"}),e.jsx(Bl,{children:"Define a new custom role with a specific permission set."})]}),e.jsxs("form",{onSubmit:g,className:"space-y-5 pt-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),e.jsx(xe,{value:n,onChange:y=>r(y.target.value),placeholder:"e.g. Developer, PM, Viewer",className:"h-9",autoFocus:!0,required:!0})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Description ",e.jsx("span",{className:"font-normal",children:"(optional)"})]}),e.jsx(xe,{value:a,onChange:y=>o(y.target.value),placeholder:"What is this role for?",className:"h-9"})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),e.jsx("button",{type:"button",onClick:f,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:u?"Deselect all":"Select all"})]}),lr.map(y=>e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:y.group}),e.jsx("div",{className:"space-y-1.5",children:y.permissions.map(S=>e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[e.jsx("input",{type:"checkbox",checked:i.has(S.key),onChange:()=>h(S.key),className:"h-3.5 w-3.5 rounded border-border accent-foreground cursor-pointer"}),e.jsx("span",{className:"text-sm group-hover:text-foreground text-muted-foreground transition-colors",children:S.label})]},S.key))})]},y.group))]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[e.jsx(G,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),e.jsx(G,{type:"submit",size:"sm",disabled:!n.trim()||d.isPending,children:d.isPending?"Creating…":"Create role"})]})]})]})})}function ky({role:t,onDeleted:s}){const[n,r]=x.useState(t.name),[a,o]=x.useState(t.description??""),[i,l]=x.useState(new Set(t.permissions)),[d,c]=x.useState(!1),u=uy(t.id),m=my();x.useEffect(()=>{r(t.name),o(t.description??""),l(new Set(t.permissions))},[t.id,t.name,t.description,t.permissions]);const f=n!==t.name||a!==(t.description??"")||i.size!==t.permissions.length||Array.from(i).some(v=>!t.permissions.includes(v)),h=lr.flatMap(v=>v.permissions.map(C=>C.key)),g=h.every(v=>i.has(v)),y=!g&&h.some(v=>i.has(v)),S=()=>{l(g?new Set:new Set(h))},b=v=>{l(C=>{const p=new Set(C);return p.has(v)?p.delete(v):p.add(v),p})},w=()=>{u.mutate({name:n.trim(),description:a.trim()||void 0,permissions:Array.from(i)},{onSuccess:()=>R.success("Role saved"),onError:v=>R.error(v.message||"Failed to save role")})},j=()=>{m.mutate(t.id,{onSuccess:()=>{R.success("Role deleted"),s(),c(!1)},onError:v=>R.error(v.message||"Failed to delete role")})};return e.jsxs("div",{className:"flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("h2",{className:"text-sm font-semibold",children:t.name}),t.is_system&&e.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:[e.jsx(hr,{className:"h-3 w-3"}),"System"]})]}),!t.is_system&&e.jsx("button",{onClick:()=>c(!0),className:"text-muted-foreground hover:text-destructive transition-colors",title:"Delete role",children:e.jsx(Pt,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-5",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),e.jsx(xe,{value:n,onChange:v=>r(v.target.value),className:"h-8 text-sm"})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),e.jsx(xe,{value:a,onChange:v=>o(v.target.value),placeholder:"What is this role for?",className:"h-8 text-sm"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),e.jsx("button",{type:"button",onClick:S,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:g?"Deselect all":"Select all"})]}),lr.map(v=>e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:v.group}),e.jsx("div",{className:"space-y-2",children:v.permissions.map(C=>e.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[e.jsx("input",{type:"checkbox",checked:i.has(C.key),onChange:()=>b(C.key),className:"h-3.5 w-3.5 rounded border-border accent-foreground cursor-pointer"}),e.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:C.label})]},C.key))})]},v.group))]}),e.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-border flex justify-end",children:e.jsx(G,{size:"sm",onClick:w,disabled:!f||!n.trim()||u.isPending,children:u.isPending?"Saving…":"Save changes"})}),e.jsx(fo,{open:d,onOpenChange:c,children:e.jsxs(Or,{children:[e.jsxs(Tr,{children:[e.jsxs(Ar,{children:['Delete "',t.name,'"?']}),e.jsx($r,{children:"This role will be removed from all users assigned to it. This action cannot be undone."})]}),e.jsxs(Pr,{children:[e.jsx(Ir,{children:"Cancel"}),e.jsx(Rr,{onClick:j,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Sy(){const{data:t,isLoading:s}=ho(),[n,r]=x.useState(null),[a,o]=x.useState(!1),i=(t==null?void 0:t.filter(c=>c.is_system))??[],l=(t==null?void 0:t.filter(c=>!c.is_system))??[];x.useEffect(()=>{t&&t.length>0&&!n&&r(t[0].id)},[t]);const d=(t==null?void 0:t.find(c=>c.id===n))??null;return e.jsx("div",{className:"p-2 h-full",children:e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ua,{className:"h-5 w-5 text-muted-foreground"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-base font-semibold",children:"Roles & Permissions"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Define what users with each custom role can do across the application."})]})]}),e.jsxs(G,{size:"sm",onClick:()=>o(!0),children:[e.jsx(Ae,{className:"h-4 w-4 mr-1.5"}),"Create role"]})]}),e.jsxs("div",{className:"flex flex-1 min-h-0",children:[e.jsx("div",{className:"w-56 shrink-0 border-r border-border flex flex-col overflow-y-auto",children:s?e.jsx("div",{className:"p-4 space-y-2",children:[1,2,3].map(c=>e.jsx(se,{className:"h-8 w-full"},c))}):e.jsxs(e.Fragment,{children:[i.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-3 pt-3 pb-1",children:e.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"System Roles"})}),i.map(c=>e.jsxs("button",{onClick:()=>r(c.id),className:T("w-full flex items-center gap-2 px-3 py-2 text-left text-sm transition-colors",n===c.id?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[e.jsx(hr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),e.jsx("span",{className:"truncate",children:c.name})]},c.id))]}),l.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-3 pt-3 pb-1",children:e.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom Roles"})}),l.map(c=>e.jsxs("button",{onClick:()=>r(c.id),className:T("w-full flex items-center gap-2 px-3 py-2 text-left text-sm transition-colors",n===c.id?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[e.jsx("div",{className:"h-3 w-3 shrink-0"}),e.jsx("span",{className:"truncate",children:c.name})]},c.id))]}),!s&&(!t||t.length===0)&&e.jsx("div",{className:"flex flex-col items-center justify-center py-10 px-3 text-center",children:e.jsx("p",{className:"text-xs text-muted-foreground",children:"No roles yet."})})]})}),e.jsx("div",{className:"flex-1 min-w-0",children:d?e.jsx(ky,{role:d,onDeleted:()=>{var u;const c=(t==null?void 0:t.filter(m=>m.id!==d.id))??[];r(((u=c[0])==null?void 0:u.id)??null)}},d.id):e.jsx("div",{className:"flex items-center justify-center h-full text-center p-8",children:e.jsxs("div",{children:[e.jsx(ua,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),e.jsx("p",{className:"text-sm font-medium mb-1",children:"Select a role to edit"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Or"," ",e.jsx("button",{onClick:()=>o(!0),className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"create a new role"})]})]})})})]}),e.jsx(Ny,{open:a,onClose:()=>o(!1)})]})})}function Cy(t){return Ne({queryKey:["invite",t],queryFn:()=>J.get(`/auth/invite/${t}`),retry:!1,enabled:!!t})}function My(){const{token:t}=Ge(),{isAuthenticated:s}=ke(),n=He(),{data:r,isLoading:a,error:o}=Cy(t??""),i=Ef(t??""),[l,d]=x.useState(""),[c,u]=x.useState(""),[m,f]=x.useState(""),[h,g]=x.useState(""),[y,S]=x.useState(!1);if(s&&r)return n(`/${r.workspace.slug}/projects`,{replace:!0}),null;const b=(r==null?void 0:r.invitation.email)??null,w=j=>{j.preventDefault();const v=b??m.trim();if(!v){R.error("Email is required");return}i.mutate({email:v,password:h,first_name:l,last_name:c},{onSuccess:()=>{n(`/${r.workspace.slug}/projects`,{replace:!0})},onError:C=>R.error(C.message??"Registration failed")})};return e.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:e.jsxs("div",{className:"w-full max-w-[380px]",children:[e.jsx("div",{className:"flex justify-center mb-8",children:e.jsx("div",{className:"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:e.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:e.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:e.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}),a?e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-48 mx-auto"}),e.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-32 mx-auto"})]}):o?e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-3",children:[e.jsx("p",{className:"text-sm font-medium",children:"Invalid or expired invitation"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"This invite link is no longer valid. Ask for a new one."}),e.jsx(wn,{to:"/login",children:e.jsx(G,{variant:"outline",size:"sm",className:"mt-2",children:"Go to login"})})]}):r?e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[e.jsxs("div",{className:"px-5 py-4 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(Om,{className:"h-3.5 w-3.5 text-muted-foreground"}),e.jsx("span",{className:"text-xs text-muted-foreground",children:"You've been invited to"})]}),e.jsx("p",{className:"text-base font-semibold",children:r.workspace.name})]}),e.jsxs("div",{className:"px-5 py-3 flex items-center gap-2.5",children:[r.invitation.role==="admin"?e.jsx(ef,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):e.jsx(uf,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Joining as"," ",e.jsx("span",{className:"font-medium text-foreground capitalize",children:r.invitation.role}),r.invitation.role==="admin"?" — full access":" — can view and edit"]})]})]}),e.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-5",children:[e.jsx("p",{className:"text-sm font-medium mb-4",children:"Create your account"}),e.jsxs("form",{onSubmit:w,className:"space-y-2",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsx(xe,{placeholder:"First name",value:l,onChange:j=>d(j.target.value),required:!0,className:"h-9 bg-transparent",autoFocus:!0}),e.jsx(xe,{placeholder:"Last name",value:c,onChange:j=>u(j.target.value),required:!0,className:"h-9 bg-transparent"})]}),b?e.jsxs("div",{className:"relative",children:[e.jsx(xe,{type:"email",value:b,readOnly:!0,className:"h-9 bg-muted/50 text-muted-foreground cursor-not-allowed"}),e.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:"locked"})]}):e.jsx(xe,{type:"email",placeholder:"Email",value:m,onChange:j=>f(j.target.value),required:!0,className:"h-9 bg-transparent",autoComplete:"email"}),e.jsxs("div",{className:"relative",children:[e.jsx(xe,{type:y?"text":"password",placeholder:"Password (min. 8 characters)",value:h,onChange:j=>g(j.target.value),required:!0,minLength:8,className:"h-9 bg-transparent pr-10",autoComplete:"new-password"}),e.jsx("button",{type:"button",onClick:()=>S(!y),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:y?e.jsx(Ta,{className:"h-4 w-4"}):e.jsx(An,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"pt-1",children:e.jsx(G,{type:"submit",className:"w-full h-9 font-medium",disabled:i.isPending,children:i.isPending?"Creating account…":"Accept invitation"})})]})]}),e.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Already have an account?"," ",e.jsx(wn,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]}):null]})})}const Dy=x.lazy(()=>nu(()=>import("./ProjectTimelinePage-CfUyV6A9.js"),__vite__mapDeps([0,1,2,3,4,5])).then(t=>({default:t.ProjectTimelinePage})));function la({children:t}){const{isAuthenticated:s}=ke();return s?e.jsx(e.Fragment,{children:t}):e.jsx(Rs,{to:"/login",replace:!0})}function ai({children:t}){const{isAuthenticated:s}=ke(),{data:n}=Ml(),r=dr();return s?e.jsx(Rs,{to:"/",replace:!0}):n!=null&&n.needsSetup&&r.pathname==="/login"?e.jsx(Rs,{to:"/register",replace:!0}):n&&!n.needsSetup&&r.pathname==="/register"?e.jsx(Rs,{to:"/login",replace:!0}):e.jsx(e.Fragment,{children:t})}function _y(){const{workspace:t,setWorkspace:s}=ke(),n=He(),{data:r,isLoading:a}=gr(!t);return x.useEffect(()=>{if(t){n(`/${t.slug}/projects`,{replace:!0});return}if(!a&&r!==void 0)if(r.length>0){const o=r[0];s({id:o.id,name:o.name,slug:o.slug}),n(`/${o.slug}/projects`,{replace:!0})}else n("/setup",{replace:!0})},[t,r,a,n,s]),e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function Ey(){const{workspace:t}=Ge(),{workspace:s,setWorkspace:n}=ke();Pf();const r=He(),{data:a,isLoading:o,isFetching:i}=gr();return x.useEffect(()=>{if(o||!a)return;const l=a.find(d=>d.slug===t);l?l.id!==(s==null?void 0:s.id)&&n({id:l.id,name:l.name,slug:l.slug}):a.length>0?r(`/${a[0].slug}/projects`,{replace:!0}):!s&&!i&&r("/setup",{replace:!0})},[a,t,o,i,s==null?void 0:s.id,r,n]),o||!s||s.slug!==t?e.jsx("div",{className:"min-h-screen flex items-center justify-center",children:e.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):e.jsxs(e.Fragment,{children:[e.jsx(jh,{}),e.jsx(Gh,{})]})}function Oy(){return e.jsxs(wc,{children:[e.jsx(Re,{path:"/login",element:e.jsx(ai,{children:e.jsx(Qh,{})})}),e.jsx(Re,{path:"/register",element:e.jsx(ai,{children:e.jsx(Xh,{})})}),e.jsx(Re,{path:"/invite/:token",element:e.jsx(My,{})}),e.jsx(Re,{path:"/setup",element:e.jsx(la,{children:e.jsx(Jh,{})})}),e.jsx(Re,{index:!0,element:e.jsx(la,{children:e.jsx(_y,{})})}),e.jsxs(Re,{path:"/:workspace",element:e.jsx(la,{children:e.jsx(Ey,{})}),children:[e.jsx(Re,{index:!0,element:e.jsx(Rs,{to:"projects",replace:!0})}),e.jsx(Re,{path:"projects",element:e.jsx(ug,{})}),e.jsxs(Re,{path:"projects/:projectKey",element:e.jsx(wh,{}),children:[e.jsx(Re,{path:"board",element:e.jsx(Cb,{})}),e.jsx(Re,{path:"issues",element:e.jsx(Mb,{})}),e.jsx(Re,{path:"issues/new",element:e.jsx(sy,{})}),e.jsx(Re,{path:"issues/:issueId",element:e.jsx(Xb,{})}),e.jsx(Re,{path:"sprints",element:e.jsx(dy,{})}),e.jsx(Re,{path:"timeline",element:e.jsx(x.Suspense,{fallback:e.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:e.jsx(Dy,{})})}),e.jsx(Re,{path:"access",element:e.jsx(Kb,{})})]}),e.jsx(Re,{path:"notifications",element:e.jsx(ay,{})}),e.jsx(Re,{path:"settings",element:e.jsx(wy,{})}),e.jsx(Re,{path:"roles",element:e.jsx(Sy,{})})]}),e.jsx(Re,{path:"*",element:e.jsx(Rs,{to:"/",replace:!0})})]})}window.__React=N;window.__ReactJsxRuntime=gc;const Ty=new bc({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let t=[];try{const n=await import("/admin-extensions.js");Array.isArray(n==null?void 0:n.default)&&(t=n.default)}catch{}Ki(document.getElementById("root")).render(e.jsx(x.StrictMode,{children:e.jsx(Nm,{widgets:[...hf,...t],children:e.jsx(Bu,{children:e.jsxs(yc,{client:Ty,children:[e.jsx(Lu,{children:e.jsx(Yu,{children:e.jsx(Nc,{children:e.jsxs(Sa,{delayDuration:300,children:[e.jsx(Oy,{}),e.jsx(Ou,{position:"bottom-right",toastOptions:{classNames:{toast:"bg-white dark:bg-card border border-border text-foreground text-sm rounded-lg shadow-sm",description:"text-muted-foreground"}}})]})})})}),e.jsx(ru,{initialIsOpen:!1})]})})})}))})();export{R as A,G as B,Xs as C,Te as D,J as E,Qd as I,Ae as P,tt as W,T as a,it as b,H as c,Va as d,Nt as e,Zp as f,Hx as g,Ka as h,Qa as i,Xp as j,oe as k,Cn as l,zy as m,Zt as n,Kx as o,Gx as p,Jx as q,fd as r,ig as s,pe as t,cd as u,ks as v,On as w,rn as x,an as y,Mr as z};
|