@meridianjs/admin-dashboard 0.1.12 → 0.1.13

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.
@@ -1,476 +1,476 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-CXkvGaEM.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 t,u as Ne,a as me,b as ce,R as dc,Q as cc,c as uc}from"./vendor-query-B9zjiv_I.js";import{a as mc,c as v,r as x,b as fc,u as Ge,d as nr,N as Ts,e as Ue,L as yn,O as Zo,f as ei,h as hc,i as $e,j as As,B as xc}from"./vendor-react-GAVzOgi0.js";import{C as ti,R as pc,T as gc,P as bc,S as oa,a as si,O as ys,b as kn,c as vs,d as rr,e as Hs,D as Us,f as Sn,g as ni,h as ri,i as yc,j as ai,I as oi,k as ii,l as li,m as di,L as ci,n as ui,o as vc,p as jc,q as mi,r as fi,F as hi,u as $s,t as Gt,s as wc,v as xi,w as pi,x as Nc,y as gi,z as bi,A as kc,B as yi,V as Sc,E as vi,G as ji,H as Cc,J as Mc,K as wi,M as Dc,N as _c,Q as Ec,U as Ni,W as Oc,X as Tc,Y as ki,Z as Pc,_ as Ac,$ as Si,a0 as $c,a1 as Ci,a2 as Rc,a3 as Ic,a4 as Mi,a5 as Fc}from"./vendor-radix-CvpS4Cp5.js";import{u as Di,a as _i,P as Ei,D as Oi,S as ia,h as Ti,b as Jn,c as la,C as da,d as zc,v as Wc,r as qc,e as Bc,f as Yc}from"./vendor-dnd-DY2LDzZ0.js";import{E as Lc,u as Pi,i as Ai,a as $i,b as Ri,c as Ii,d as Hc,e as Uc}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 Fi,co=mc;Fi=co.createRoot,co.hydrateRoot;const Kc="modulepreload",Vc=function(e){return"/"+e},uo={},Gc=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=Vc(d),d in uo)return;uo[d]=!0;const c=d.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":Kc,c||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((m,h)=>{f.addEventListener("load",m),f.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 Qc=function(){return null},Xc=e=>{switch(e){case"success":return eu;case"info":return su;case"warning":return tu;case"error":return nu;default:return null}},Jc=Array(12).fill(0),Zc=({visible:e,className:s})=>v.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":e},v.createElement("div",{className:"sonner-spinner"},Jc.map((n,r)=>v.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),eu=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},v.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"})),tu=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},v.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"})),su=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},v.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"})),nu=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},v.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"})),ru=v.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"},v.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),v.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),au=()=>{let[e,s]=v.useState(document.hidden);return v.useEffect(()=>{let n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Xr=1,ou=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let s=this.subscribers.indexOf(e);this.subscribers.splice(s,1)}),this.publish=e=>{this.subscribers.forEach(s=>s(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var s;let{message:n,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((s=e.id)==null?void 0:s.length)>0?e.id:Xr++,o=this.toasts.find(l=>l.id===a),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:n}),{...l,...e,id:a,dismissible:i,title:n}):l):this.addToast({title:n,...r,dismissible:i,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:e,dismiss:!0})),e),this.message=(e,s)=>this.create({...s,message:e}),this.error=(e,s)=>this.create({...s,message:e,type:"error"}),this.success=(e,s)=>this.create({...s,type:"success",message:e}),this.info=(e,s)=>this.create({...s,type:"info",message:e}),this.warning=(e,s)=>this.create({...s,type:"warning",message:e}),this.loading=(e,s)=>this.create({...s,type:"loading",message:e}),this.promise=(e,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:e,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=e instanceof Promise?e:e(),a=n!==void 0,o,i=r.then(async d=>{if(o=["resolve",d],v.isValidElement(d))a=!1,this.create({id:n,type:"default",message:d});else if(lu(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=(e,s)=>{let n=(s==null?void 0:s.id)||Xr++;return this.create({jsx:e(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Xe=new ou,iu=(e,s)=>{let n=(s==null?void 0:s.id)||Xr++;return Xe.addToast({title:e,...s,id:n}),n},lu=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",du=iu,cu=()=>Xe.toasts,uu=()=>Xe.getActiveToasts(),R=Object.assign(du,{success:Xe.success,info:Xe.info,warning:Xe.warning,error:Xe.error,custom:Xe.custom,message:Xe.message,promise:Xe.promise,dismiss:Xe.dismiss,loading:Xe.loading},{getHistory:cu,getToasts:uu});function mu(e,{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=e:r.appendChild(document.createTextNode(e))}mu(`: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 Hn(e){return e.label!==void 0}var fu=3,hu="32px",xu="16px",mo=4e3,pu=356,gu=14,bu=20,yu=200;function dt(...e){return e.filter(Boolean).join(" ")}function vu(e){let[s,n]=e.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}var ju=e=>{var s,n,r,a,o,i,l,d,c,u,f;let{invert:m,toast:h,unstyled:g,interacting:y,setHeights:S,visibleToasts:b,heights:N,index:w,toasts:j,expanded:E,removeToast:p,defaultRichColors:C,closeButton:A,style:D,cancelButtonStyle:_,actionButtonStyle:I,className:$="",descriptionClassName:F="",duration:T,position:X,gap:q,loadingIcon:V,expandByDefault:W,classNames:z,icons:Q,closeButtonAriaLabel:ee="Close toast",pauseWhenPageIsHidden:k}=e,[M,Y]=v.useState(null),[L,ae]=v.useState(null),[P,ie]=v.useState(!1),[ge,Te]=v.useState(!1),[qe,$t]=v.useState(!1),[Zt,le]=v.useState(!1),[es,ts]=v.useState(!1),[ss,ns]=v.useState(0),[rn,lt]=v.useState(0),pt=v.useRef(h.duration||T||mo),Ms=v.useRef(null),Be=v.useRef(null),rs=w===0,Rt=w+1<=b,Ye=h.type,gt=h.dismissible!==!1,It=h.className||"",an=h.descriptionClassName||"",St=v.useMemo(()=>N.findIndex(B=>B.toastId===h.id)||0,[N,h.id]),on=v.useMemo(()=>{var B;return(B=h.closeButton)!=null?B:A},[h.closeButton,A]),bt=v.useMemo(()=>h.duration||T||mo,[h.duration,T]),Ft=v.useRef(0),yt=v.useRef(0),Ds=v.useRef(0),vt=v.useRef(null),[_s,ln]=X.split("-"),re=v.useMemo(()=>N.reduce((B,fe,he)=>he>=St?B:B+fe.height,0),[N,St]),G=au(),se=h.invert||m,U=Ye==="loading";yt.current=v.useMemo(()=>St*q+re,[St,re]),v.useEffect(()=>{pt.current=bt},[bt]),v.useEffect(()=>{ie(!0)},[]),v.useEffect(()=>{let B=Be.current;if(B){let fe=B.getBoundingClientRect().height;return lt(fe),S(he=>[{toastId:h.id,height:fe,position:h.position},...he]),()=>S(he=>he.filter(Ae=>Ae.toastId!==h.id))}},[S,h.id]),v.useLayoutEffect(()=>{if(!P)return;let B=Be.current,fe=B.style.height;B.style.height="auto";let he=B.getBoundingClientRect().height;B.style.height=fe,lt(he),S(Ae=>Ae.find(Ce=>Ce.toastId===h.id)?Ae.map(Ce=>Ce.toastId===h.id?{...Ce,height:he}:Ce):[{toastId:h.id,height:he,position:h.position},...Ae])},[P,h.title,h.description,S,h.id]);let Z=v.useCallback(()=>{Te(!0),ns(yt.current),S(B=>B.filter(fe=>fe.toastId!==h.id)),setTimeout(()=>{p(h)},yu)},[h,p,S,yt]);v.useEffect(()=>{if(h.promise&&Ye==="loading"||h.duration===1/0||h.type==="loading")return;let B;return E||y||k&&G?(()=>{if(Ds.current<Ft.current){let fe=new Date().getTime()-Ft.current;pt.current=pt.current-fe}Ds.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),Z()},pt.current)),()=>clearTimeout(B)},[E,y,h,Ye,k,G,Z]),v.useEffect(()=>{h.delete&&Z()},[Z,h.delete]);function be(){var B,fe,he;return Q!=null&&Q.loading?v.createElement("div",{className:dt(z==null?void 0:z.loader,(B=h==null?void 0:h.classNames)==null?void 0:B.loader,"sonner-loader"),"data-visible":Ye==="loading"},Q.loading):V?v.createElement("div",{className:dt(z==null?void 0:z.loader,(fe=h==null?void 0:h.classNames)==null?void 0:fe.loader,"sonner-loader"),"data-visible":Ye==="loading"},V):v.createElement(Zc,{className:dt(z==null?void 0:z.loader,(he=h==null?void 0:h.classNames)==null?void 0:he.loader),visible:Ye==="loading"})}return v.createElement("li",{tabIndex:0,ref:Be,className:dt($,It,z==null?void 0:z.toast,(s=h==null?void 0:h.classNames)==null?void 0:s.toast,z==null?void 0:z.default,z==null?void 0:z[Ye],(n=h==null?void 0:h.classNames)==null?void 0:n[Ye]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:C,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":P,"data-promise":!!h.promise,"data-swiped":es,"data-removed":ge,"data-visible":Rt,"data-y-position":_s,"data-x-position":ln,"data-index":w,"data-front":rs,"data-swiping":qe,"data-dismissible":gt,"data-type":Ye,"data-invert":se,"data-swipe-out":Zt,"data-swipe-direction":L,"data-expanded":!!(E||W&&P),style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${ge?ss:yt.current}px`,"--initial-height":W?"auto":`${rn}px`,...D,...h.style},onDragEnd:()=>{$t(!1),Y(null),vt.current=null},onPointerDown:B=>{U||!gt||(Ms.current=new Date,ns(yt.current),B.target.setPointerCapture(B.pointerId),B.target.tagName!=="BUTTON"&&($t(!0),vt.current={x:B.clientX,y:B.clientY}))},onPointerUp:()=>{var B,fe,he,Ae;if(Zt||!gt)return;vt.current=null;let Ce=Number(((B=Be.current)==null?void 0:B.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Me=Number(((fe=Be.current)==null?void 0:fe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),nt=new Date().getTime()-((he=Ms.current)==null?void 0:he.getTime()),Qe=M==="x"?Ce:Me,zt=Math.abs(Qe)/nt;if(Math.abs(Qe)>=bu||zt>.11){ns(yt.current),(Ae=h.onDismiss)==null||Ae.call(h,h),ae(M==="x"?Ce>0?"right":"left":Me>0?"down":"up"),Z(),le(!0),ts(!1);return}$t(!1),Y(null)},onPointerMove:B=>{var fe,he,Ae,Ce;if(!vt.current||!gt||((fe=window.getSelection())==null?void 0:fe.toString().length)>0)return;let Me=B.clientY-vt.current.y,nt=B.clientX-vt.current.x,Qe=(he=e.swipeDirections)!=null?he:vu(X);!M&&(Math.abs(nt)>1||Math.abs(Me)>1)&&Y(Math.abs(nt)>Math.abs(Me)?"x":"y");let zt={x:0,y:0};M==="y"?(Qe.includes("top")||Qe.includes("bottom"))&&(Qe.includes("top")&&Me<0||Qe.includes("bottom")&&Me>0)&&(zt.y=Me):M==="x"&&(Qe.includes("left")||Qe.includes("right"))&&(Qe.includes("left")&&nt<0||Qe.includes("right")&&nt>0)&&(zt.x=nt),(Math.abs(zt.x)>0||Math.abs(zt.y)>0)&&ts(!0),(Ae=Be.current)==null||Ae.style.setProperty("--swipe-amount-x",`${zt.x}px`),(Ce=Be.current)==null||Ce.style.setProperty("--swipe-amount-y",`${zt.y}px`)}},on&&!h.jsx?v.createElement("button",{"aria-label":ee,"data-disabled":U,"data-close-button":!0,onClick:U||!gt?()=>{}:()=>{var B;Z(),(B=h.onDismiss)==null||B.call(h,h)},className:dt(z==null?void 0:z.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(o=Q==null?void 0:Q.close)!=null?o:ru):null,h.jsx||x.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:v.createElement(v.Fragment,null,Ye||h.icon||h.promise?v.createElement("div",{"data-icon":"",className:dt(z==null?void 0:z.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||be():null,h.type!=="loading"?h.icon||(Q==null?void 0:Q[Ye])||Xc(Ye):null):null,v.createElement("div",{"data-content":"",className:dt(z==null?void 0:z.content,(l=h==null?void 0:h.classNames)==null?void 0:l.content)},v.createElement("div",{"data-title":"",className:dt(z==null?void 0:z.title,(d=h==null?void 0:h.classNames)==null?void 0:d.title)},typeof h.title=="function"?h.title():h.title),h.description?v.createElement("div",{"data-description":"",className:dt(F,an,z==null?void 0:z.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&&Hn(h.cancel)?v.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||_,onClick:B=>{var fe,he;Hn(h.cancel)&&gt&&((he=(fe=h.cancel).onClick)==null||he.call(fe,B),Z())},className:dt(z==null?void 0:z.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&&Hn(h.action)?v.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||I,onClick:B=>{var fe,he;Hn(h.action)&&((he=(fe=h.action).onClick)==null||he.call(fe,B),!B.defaultPrevented&&Z())},className:dt(z==null?void 0:z.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function fo(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function wu(e,s){let n={};return[e,s].forEach((r,a)=>{let o=a===1,i=o?"--mobile-offset":"--offset",l=o?xu:hu;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 Nu=x.forwardRef(function(e,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:f,duration:m,style:h,visibleToasts:g=fu,toastOptions:y,dir:S=fo(),gap:b=gu,loadingIcon:N,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:E}=e,[p,C]=v.useState([]),A=v.useMemo(()=>Array.from(new Set([r].concat(p.filter(k=>k.position).map(k=>k.position)))),[p,r]),[D,_]=v.useState([]),[I,$]=v.useState(!1),[F,T]=v.useState(!1),[X,q]=v.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=v.useRef(null),W=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),z=v.useRef(null),Q=v.useRef(!1),ee=v.useCallback(k=>{C(M=>{var Y;return(Y=M.find(L=>L.id===k.id))!=null&&Y.delete||Xe.dismiss(k.id),M.filter(({id:L})=>L!==k.id)})},[]);return v.useEffect(()=>Xe.subscribe(k=>{if(k.dismiss){C(M=>M.map(Y=>Y.id===k.id?{...Y,delete:!0}:Y));return}setTimeout(()=>{fc.flushSync(()=>{C(M=>{let Y=M.findIndex(L=>L.id===k.id);return Y!==-1?[...M.slice(0,Y),{...M[Y],...k},...M.slice(Y+1)]:[k,...M]})})})}),[]),v.useEffect(()=>{if(u!=="system"){q(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let k=window.matchMedia("(prefers-color-scheme: dark)");try{k.addEventListener("change",({matches:M})=>{q(M?"dark":"light")})}catch{k.addListener(({matches:Y})=>{try{q(Y?"dark":"light")}catch(L){console.error(L)}})}},[u]),v.useEffect(()=>{p.length<=1&&$(!1)},[p]),v.useEffect(()=>{let k=M=>{var Y,L;a.every(ae=>M[ae]||M.code===ae)&&($(!0),(Y=V.current)==null||Y.focus()),M.code==="Escape"&&(document.activeElement===V.current||(L=V.current)!=null&&L.contains(document.activeElement))&&$(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a]),v.useEffect(()=>{if(V.current)return()=>{z.current&&(z.current.focus({preventScroll:!0}),z.current=null,Q.current=!1)}},[V.current]),v.createElement("section",{ref:s,"aria-label":`${j} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},A.map((k,M)=>{var Y;let[L,ae]=k.split("-");return p.length?v.createElement("ol",{key:k,dir:S==="auto"?fo():S,tabIndex:-1,ref:V,className:l,"data-sonner-toaster":!0,"data-theme":X,"data-y-position":L,"data-lifted":I&&p.length>1&&!o,"data-x-position":ae,style:{"--front-toast-height":`${((Y=D[0])==null?void 0:Y.height)||0}px`,"--width":`${pu}px`,"--gap":`${b}px`,...h,...wu(d,c)},onBlur:P=>{Q.current&&!P.currentTarget.contains(P.relatedTarget)&&(Q.current=!1,z.current&&(z.current.focus({preventScroll:!0}),z.current=null))},onFocus:P=>{P.target instanceof HTMLElement&&P.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,z.current=P.relatedTarget)},onMouseEnter:()=>$(!0),onMouseMove:()=>$(!0),onMouseLeave:()=>{F||$(!1)},onDragEnd:()=>$(!1),onPointerDown:P=>{P.target instanceof HTMLElement&&P.target.dataset.dismissible==="false"||T(!0)},onPointerUp:()=>T(!1)},p.filter(P=>!P.position&&M===0||P.position===k).map((P,ie)=>{var ge,Te;return v.createElement(ju,{key:P.id,icons:w,index:ie,toast:P,defaultRichColors:f,duration:(ge=y==null?void 0:y.duration)!=null?ge:m,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:g,closeButton:(Te=y==null?void 0:y.closeButton)!=null?Te:i,interacting:F,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==P.position),heights:D.filter(qe=>qe.position==P.position),setHeights:_,expandByDefault:o,gap:b,loadingIcon:N,expanded:I,pauseWhenPageIsHidden:E,swipeDirections:e.swipeDirections})})):null}))}),ku=(e,s,n,r,a,o,i,l)=>{let d=document.documentElement,c=["light","dark"];function u(h){(Array.isArray(e)?e:[e]).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)}),f(h)}function f(h){l&&c.includes(h)&&(d.style.colorScheme=h)}function m(){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"?m():h;u(g)}catch{}},ho=["light","dark"],zi="(prefers-color-scheme: dark)",Su=typeof window>"u",ca=x.createContext(void 0),Cu={setTheme:e=>{},themes:[]},Mu=()=>{var e;return(e=x.useContext(ca))!=null?e:Cu},Du=e=>x.useContext(ca)?x.createElement(x.Fragment,null,e.children):x.createElement(Eu,{...e}),_u=["light","dark"],Eu=({forcedTheme:e,disableTransitionOnChange:s=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:a="theme",themes:o=_u,defaultTheme:i=n?"system":"light",attribute:l="data-theme",value:d,children:c,nonce:u,scriptProps:f})=>{let[m,h]=x.useState(()=>Tu(a,i)),[g,y]=x.useState(()=>m==="system"?Sr():m),S=d?Object.values(d):o,b=x.useCallback(E=>{let p=E;if(!p)return;E==="system"&&n&&(p=Sr());let C=d?d[p]:p,A=s?Pu(u):null,D=document.documentElement,_=I=>{I==="class"?(D.classList.remove(...S),C&&D.classList.add(C)):I.startsWith("data-")&&(C?D.setAttribute(I,C):D.removeAttribute(I))};if(Array.isArray(l)?l.forEach(_):_(l),r){let I=ho.includes(i)?i:null,$=ho.includes(p)?p:I;D.style.colorScheme=$}A==null||A()},[u]),N=x.useCallback(E=>{let p=typeof E=="function"?E(m):E;h(p);try{localStorage.setItem(a,p)}catch{}},[m]),w=x.useCallback(E=>{let p=Sr(E);y(p),m==="system"&&n&&!e&&b("system")},[m,e]);x.useEffect(()=>{let E=window.matchMedia(zi);return E.addListener(w),w(E),()=>E.removeListener(w)},[w]),x.useEffect(()=>{let E=p=>{p.key===a&&(p.newValue?h(p.newValue):N(i))};return window.addEventListener("storage",E),()=>window.removeEventListener("storage",E)},[N]),x.useEffect(()=>{b(e??m)},[e,m]);let j=x.useMemo(()=>({theme:m,setTheme:N,forcedTheme:e,resolvedTheme:m==="system"?g:m,themes:n?[...o,"system"]:o,systemTheme:n?g:void 0}),[m,N,e,g,n,o]);return x.createElement(ca.Provider,{value:j},x.createElement(Ou,{forcedTheme:e,storageKey:a,attribute:l,enableSystem:n,enableColorScheme:r,defaultTheme:i,value:d,themes:o,nonce:u,scriptProps:f}),c)},Ou=x.memo(({forcedTheme:e,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,e,l,i,r,a]).slice(1,-1);return x.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?d:"",dangerouslySetInnerHTML:{__html:`(${ku.toString()})(${u})`}})}),Tu=(e,s)=>{if(Su)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||s},Pu=e=>{let s=document.createElement("style");return e&&s.setAttribute("nonce",e),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)}},Sr=e=>(e||(e=window.matchMedia(zi)),e.matches?"dark":"light");function Au({children:e}){return t.jsx(Du,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const Wi=x.createContext(null),Un="meridian_token",Cr="meridian_user",Kn="meridian_workspace";function xo(e){try{const s=e.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 $u({children:e}){const[s,n]=x.useState(()=>{try{const u=localStorage.getItem(Cr),f=localStorage.getItem(Un);if(!u)return null;const m=JSON.parse(u);return Array.isArray(m.roles)||(m.roles=f?xo(f):[]),m}catch{return null}}),[r,a]=x.useState(()=>localStorage.getItem(Un)),[o,i]=x.useState(()=>{try{const u=localStorage.getItem(Kn);return u?JSON.parse(u):null}catch{return null}}),l=(u,f)=>{const m=xo(f),h={...u,roles:m};n(h),a(f),localStorage.setItem(Un,f),localStorage.setItem(Cr,JSON.stringify(h))},d=()=>{n(null),a(null),i(null),localStorage.removeItem(Un),localStorage.removeItem(Cr),localStorage.removeItem(Kn)},c=u=>{i(u),u?localStorage.setItem(Kn,JSON.stringify(u)):localStorage.removeItem(Kn)};return x.useEffect(()=>{r&&!s&&d()},[]),t.jsx(Wi.Provider,{value:{user:s,token:r,workspace:o,isAuthenticated:!!r&&!!s,login:l,logout:d,setWorkspace:c},children:e})}function ke(){const e=x.useContext(Wi);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const qi=x.createContext(null);function Ru({children:e}){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)},[]),t.jsx(qi.Provider,{value:{open:s,setOpen:n,toggle:()=>n(r=>!r)},children:e})}function Bi(){const e=x.useContext(qi);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function Yi(e){var s,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(s=0;s<a;s++)e[s]&&(n=Yi(e[s]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Li(){for(var e,s,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(s=Yi(e))&&(r&&(r+=" "),r+=s);return r}const ua="-",Iu=e=>{const s=zu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(ua);return l[0]===""&&l.length!==1&&l.shift(),Hi(l,s)||Fu(i)},getConflictingClassGroupIds:(i,l)=>{const d=n[i]||[];return l&&r[i]?[...d,...r[i]]:d}}},Hi=(e,s)=>{var i;if(e.length===0)return s.classGroupId;const n=e[0],r=s.nextPart.get(n),a=r?Hi(e.slice(1),r):void 0;if(a)return a;if(s.validators.length===0)return;const o=e.join(ua);return(i=s.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},po=/^\[(.+)\]$/,Fu=e=>{if(po.test(e)){const s=po.exec(e)[1],n=s==null?void 0:s.substring(0,s.indexOf(":"));if(n)return"arbitrary.."+n}},zu=e=>{const{theme:s,prefix:n}=e,r={nextPart:new Map,validators:[]};return qu(Object.entries(e.classGroups),n).forEach(([o,i])=>{Jr(i,r,o,s)}),r},Jr=(e,s,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?s:go(s,a);o.classGroupId=n;return}if(typeof a=="function"){if(Wu(a)){Jr(a(r),s,n,r);return}s.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,i])=>{Jr(i,go(s,o),n,r)})})},go=(e,s)=>{let n=e;return s.split(ua).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Wu=e=>e.isThemeGetter,qu=(e,s)=>s?e.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]}):e,Bu=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,n=new Map,r=new Map;const a=(o,i)=>{n.set(o,i),s++,s>e&&(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)}}},Ui="!",Yu=e=>{const{separator:s,experimentalParseClassName:n}=e,r=s.length===1,a=s[0],o=s.length,i=l=>{const d=[];let c=0,u=0,f;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==="/"){f=S;continue}}b==="["?c++:b==="]"&&c--}const m=d.length===0?l:l.substring(u),h=m.startsWith(Ui),g=h?m.substring(1):m,y=f&&f>u?f-u:void 0;return{modifiers:d,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}};return n?l=>n({className:l,parseClassName:i}):i},Lu=e=>{if(e.length<=1)return e;const s=[];let n=[];return e.forEach(r=>{r[0]==="["?(s.push(...n.sort(),r),n=[]):n.push(r)}),s.push(...n.sort()),s},Hu=e=>({cache:Bu(e.cacheSize),parseClassName:Yu(e),...Iu(e)}),Uu=/\s+/,Ku=(e,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=s,o=[],i=e.trim().split(Uu);let l="";for(let d=i.length-1;d>=0;d-=1){const c=i[d],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:h}=n(c);let g=!!h,y=r(g?m.substring(0,h):m);if(!y){if(!g){l=c+(l.length>0?" "+l:l);continue}if(y=r(m),!y){l=c+(l.length>0?" "+l:l);continue}g=!1}const S=Lu(u).join(":"),b=f?S+Ui:S,N=b+y;if(o.includes(N))continue;o.push(N);const w=a(y,g);for(let j=0;j<w.length;++j){const E=w[j];o.push(b+E)}l=c+(l.length>0?" "+l:l)}return l};function Vu(){let e=0,s,n,r="";for(;e<arguments.length;)(s=arguments[e++])&&(n=Ki(s))&&(r&&(r+=" "),r+=n);return r}const Ki=e=>{if(typeof e=="string")return e;let s,n="";for(let r=0;r<e.length;r++)e[r]&&(s=Ki(e[r]))&&(n&&(n+=" "),n+=s);return n};function Gu(e,...s){let n,r,a,o=i;function i(d){const c=s.reduce((u,f)=>f(u),e());return n=Hu(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=Ku(d,n);return a(d,u),u}return function(){return o(Vu.apply(null,arguments))}}const Se=e=>{const s=n=>n[e]||[];return s.isThemeGetter=!0,s},Vi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Qu=/^\d+\/\d+$/,Xu=new Set(["px","full","screen"]),Ju=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Zu=/\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$/,em=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,sm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ct=e=>Rs(e)||Xu.has(e)||Qu.test(e),Wt=e=>Ks(e,"length",cm),Rs=e=>!!e&&!Number.isNaN(Number(e)),Mr=e=>Ks(e,"number",Rs),dn=e=>!!e&&Number.isInteger(Number(e)),nm=e=>e.endsWith("%")&&Rs(e.slice(0,-1)),ue=e=>Vi.test(e),qt=e=>Ju.test(e),rm=new Set(["length","size","percentage"]),am=e=>Ks(e,rm,Gi),om=e=>Ks(e,"position",Gi),im=new Set(["image","url"]),lm=e=>Ks(e,im,mm),dm=e=>Ks(e,"",um),cn=()=>!0,Ks=(e,s,n)=>{const r=Vi.exec(e);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):n(r[2]):!1},cm=e=>Zu.test(e)&&!em.test(e),Gi=()=>!1,um=e=>tm.test(e),mm=e=>sm.test(e),fm=()=>{const e=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"),f=Se("invert"),m=Se("gap"),h=Se("gradientColorStops"),g=Se("gradientColorStopPositions"),y=Se("inset"),S=Se("margin"),b=Se("opacity"),N=Se("padding"),w=Se("saturate"),j=Se("scale"),E=Se("sepia"),p=Se("skew"),C=Se("space"),A=Se("translate"),D=()=>["auto","contain","none"],_=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",ue,s],$=()=>[ue,s],F=()=>["",Ct,Wt],T=()=>["auto",Rs,ue],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["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"],W=()=>["start","end","center","between","around","evenly","stretch"],z=()=>["","0",ue],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[Rs,ue];return{cacheSize:500,separator:":",theme:{colors:[cn],spacing:[Ct,Wt],blur:["none","",qt,ue],brightness:ee(),borderColor:[e],borderRadius:["none","","full",qt,ue],borderSpacing:$(),borderWidth:F(),contrast:ee(),grayscale:z(),hueRotate:ee(),invert:z(),gap:$(),gradientColorStops:[e],gradientColorStopPositions:[nm,Wt],inset:I(),margin:I(),opacity:ee(),padding:$(),saturate:ee(),scale:ee(),sepia:z(),skew:ee(),space:$(),translate:$()},classGroups:{aspect:[{aspect:["auto","square","video",ue]}],container:["container"],columns:[{columns:[qt]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...X(),ue]}],overflow:[{overflow:_()}],"overflow-x":[{"overflow-x":_()}],"overflow-y":[{"overflow-y":_()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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",dn,ue]}],basis:[{basis:I()}],"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:z()}],shrink:[{shrink:z()}],order:[{order:["first","last","none",dn,ue]}],"grid-cols":[{"grid-cols":[cn]}],"col-start-end":[{col:["auto",{span:["full",dn,ue]},ue]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[cn]}],"row-start-end":[{row:["auto",{span:[dn,ue]},ue]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"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:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],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":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"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:[qt]},qt]}],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",qt,Wt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Mr]}],"font-family":[{font:[cn]}],"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",Rs,Mr]}],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:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ct,Wt]}],"underline-offset":[{"underline-offset":["auto",Ct,ue]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:$()}],"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:[...X(),om]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",am]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},lm]}],"bg-color":[{bg:[e]}],"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:[...q(),"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:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[Ct,ue]}],"outline-w":[{outline:[Ct,Wt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Ct,Wt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",qt,dm]}],"shadow-color":[{shadow:[cn]}],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",qt,ue]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[E]}],"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":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"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:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[dn,ue]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"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",e]}],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:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":$()}],"scroll-mx":[{"scroll-mx":$()}],"scroll-my":[{"scroll-my":$()}],"scroll-ms":[{"scroll-ms":$()}],"scroll-me":[{"scroll-me":$()}],"scroll-mt":[{"scroll-mt":$()}],"scroll-mr":[{"scroll-mr":$()}],"scroll-mb":[{"scroll-mb":$()}],"scroll-ml":[{"scroll-ml":$()}],"scroll-p":[{"scroll-p":$()}],"scroll-px":[{"scroll-px":$()}],"scroll-py":[{"scroll-py":$()}],"scroll-ps":[{"scroll-ps":$()}],"scroll-pe":[{"scroll-pe":$()}],"scroll-pt":[{"scroll-pt":$()}],"scroll-pr":[{"scroll-pr":$()}],"scroll-pb":[{"scroll-pb":$()}],"scroll-pl":[{"scroll-pl":$()}],"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:[e,"none"]}],"stroke-w":[{stroke:[Ct,Wt,Mr]}],stroke:[{stroke:[e,"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"]}}},hm=Gu(fm);function O(...e){return hm(Li(e))}const ma=bc,us=pc,ms=gc,Ht=x.forwardRef(({className:e,sideOffset:s=4,...n},r)=>t.jsx(ti,{ref:r,sideOffset:s,className:O("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",e),...n}));Ht.displayName=ti.displayName;const Qi=x.createContext([]);function xm({widgets:e,children:s}){return v.createElement(Qi.Provider,{value:e},s)}function pm(e){return x.useContext(Qi).filter(n=>n.zone===e).map(n=>n.component)}var Xo;const Xi=((Xo=window.__MERIDIAN_CONFIG__)==null?void 0:Xo.apiUrl)??void 0??"";class Ji extends Error{constructor(s,n,r){super(n),this.status=s,this.data=r,this.name="ApiError"}}function Zi(){return localStorage.getItem("meridian_token")}async function un(e,s={}){var o;const n=Zi(),r={"Content-Type":"application/json",...s.headers};n&&(r.Authorization=`Bearer ${n}`);const a=await fetch(`${Xi}${e}`,{...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 Ji(a.status,l,i)}if(a.status!==204)return a.json()}const J={get:e=>un(e,{method:"GET"}),post:(e,s)=>un(e,{method:"POST",body:JSON.stringify(s)}),put:(e,s)=>un(e,{method:"PUT",body:JSON.stringify(s)}),patch:(e,s)=>un(e,{method:"PATCH",body:JSON.stringify(s)}),delete:e=>un(e,{method:"DELETE"}),upload:async(e,s)=>{var o;const n=Zi(),r={};n&&(r.Authorization=`Bearer ${n}`);const a=await fetch(`${Xi}${e}`,{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 Ji(a.status,l,i)}if(a.status!==204)return a.json()}},Pe={all:["issues"],byProject:e=>[...Pe.all,"project",e],detail:e=>[...Pe.all,e],comments:e=>[...Pe.all,e,"comments"],activities:e=>[...Pe.all,e,"activities"]};function Cn(e){return Ne({queryKey:e?Pe.byProject(e):Pe.all,queryFn:()=>{const s=e?`/admin/issues?project_id=${e}`:"/admin/issues";return J.get(s)},select:s=>s.issues})}function el(e){return Ne({queryKey:Pe.detail(e),queryFn:()=>J.get(`/admin/issues/${e}`),select:s=>s.issue,enabled:!!e})}function gm(e){return Ne({queryKey:Pe.comments(e),queryFn:()=>J.get(`/admin/issues/${e}/comments`),select:s=>s.comments,enabled:!!e})}function tl(){const e=me();return ce({mutationFn:s=>J.post("/admin/issues",s),onSuccess:(s,n)=>{e.invalidateQueries({queryKey:Pe.byProject(n.project_id)})}})}function ar(e,s){const n=me();return ce({mutationFn:r=>J.put(`/admin/issues/${e}`,r),onMutate:async r=>{await n.cancelQueries({queryKey:Pe.byProject(s)});const a=n.getQueryData(Pe.byProject(s));return n.setQueryData(Pe.byProject(s),o=>o&&{...o,issues:o.issues.map(i=>i.id===e?{...i,...r}:i)}),{previous:a}},onError:(r,a,o)=>{o!=null&&o.previous&&n.setQueryData(Pe.byProject(s),o.previous)},onSettled:()=>{n.invalidateQueries({queryKey:Pe.byProject(s)}),n.invalidateQueries({queryKey:Pe.detail(e)})}})}function bm(e){return Ne({queryKey:Pe.activities(e),queryFn:()=>J.get(`/admin/issues/${e}/activities`),select:s=>s.activities,enabled:!!e})}function ym(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/issues/${e}/comments`,{body:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Pe.comments(e)})}})}const bo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yo=Li,Mn=(e,s)=>n=>{var r;if((s==null?void 0:s.variants)==null)return yo(e,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],f=o==null?void 0:o[c];if(u===null)return null;const m=bo(u)||bo(f);return a[c][m]}),l=n&&Object.entries(n).reduce((c,u)=>{let[f,m]=u;return m===void 0||(c[f]=m),c},{}),d=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:m,...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,f,m]:c},[]);return yo(e,i,d,n==null?void 0:n.class,n==null?void 0:n.className)},Is=Mn("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"}}),K=x.forwardRef(({className:e,variant:s,size:n,asChild:r=!1,...a},o)=>{const i=r?oa:"button";return t.jsx(i,{className:O(Is({variant:s,size:n,className:e})),ref:o,...a})});K.displayName="Button";const xe=x.forwardRef(({className:e,type:s,...n},r)=>t.jsx("input",{type:s,className:O("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",e),ref:r,...n}));xe.displayName="Input";/**
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-Cm6JeB53.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 t,u as Ne,a as ue,b as de,R as uc,Q as mc,c as fc}from"./vendor-query-B9zjiv_I.js";import{a as hc,c as v,r as x,b as xc,u as Ge,d as rr,N as Ts,e as He,L as yn,O as ei,f as ti,h as pc,i as $e,j as As,B as gc}from"./vendor-react-GAVzOgi0.js";import{C as si,R as bc,T as yc,P as vc,S as ia,a as ni,O as ys,b as kn,c as vs,d as ar,e as Us,D as Hs,f as Sn,g as ri,h as ai,i as jc,j as oi,I as ii,k as li,l as di,m as ci,L as ui,n as mi,o as wc,p as Nc,q as fi,r as hi,F as xi,u as $s,t as Gt,s as kc,v as pi,w as gi,x as Sc,y as bi,z as yi,A as Cc,B as vi,V as Mc,E as ji,G as wi,H as Dc,J as _c,K as Ni,M as Ec,N as Oc,Q as Tc,U as ki,W as Pc,X as Ac,Y as Si,Z as $c,_ as Rc,$ as Ci,a0 as Ic,a1 as Mi,a2 as Fc,a3 as zc,a4 as Di,a5 as Wc}from"./vendor-radix-CvpS4Cp5.js";import{u as _i,a as Ei,P as Oi,D as Ti,S as la,h as Pi,b as Zn,c as da,C as ca,d as qc,v as Bc,r as Yc,e as Lc,f as Uc}from"./vendor-dnd-DY2LDzZ0.js";import{E as Hc,u as Ai,i as $i,a as Ri,b as Ii,c as Fi,d as Kc,e as Vc}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 zi,co=hc;zi=co.createRoot,co.hydrateRoot;const Gc="modulepreload",Qc=function(e){return"/"+e},uo={},Xc=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=Qc(d),d in uo)return;uo[d]=!0;const c=d.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${d}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":Gc,c||(f.as="script"),f.crossOrigin="",f.href=d,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((m,h)=>{f.addEventListener("load",m),f.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 Jc=function(){return null},Zc=e=>{switch(e){case"success":return su;case"info":return ru;case"warning":return nu;case"error":return au;default:return null}},eu=Array(12).fill(0),tu=({visible:e,className:s})=>v.createElement("div",{className:["sonner-loading-wrapper",s].filter(Boolean).join(" "),"data-visible":e},v.createElement("div",{className:"sonner-spinner"},eu.map((n,r)=>v.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),su=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},v.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"})),nu=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},v.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"})),ru=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},v.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"})),au=v.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},v.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"})),ou=v.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"},v.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),v.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),iu=()=>{let[e,s]=v.useState(document.hidden);return v.useEffect(()=>{let n=()=>{s(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},Jr=1,lu=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let s=this.subscribers.indexOf(e);this.subscribers.splice(s,1)}),this.publish=e=>{this.subscribers.forEach(s=>s(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var s;let{message:n,...r}=e,a=typeof(e==null?void 0:e.id)=="number"||((s=e.id)==null?void 0:s.length)>0?e.id:Jr++,o=this.toasts.find(l=>l.id===a),i=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:n}),{...l,...e,id:a,dismissible:i,title:n}):l):this.addToast({title:n,...r,dismissible:i,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(s=>{this.subscribers.forEach(n=>n({id:s.id,dismiss:!0}))}),this.subscribers.forEach(s=>s({id:e,dismiss:!0})),e),this.message=(e,s)=>this.create({...s,message:e}),this.error=(e,s)=>this.create({...s,message:e,type:"error"}),this.success=(e,s)=>this.create({...s,type:"success",message:e}),this.info=(e,s)=>this.create({...s,type:"info",message:e}),this.warning=(e,s)=>this.create({...s,type:"warning",message:e}),this.loading=(e,s)=>this.create({...s,type:"loading",message:e}),this.promise=(e,s)=>{if(!s)return;let n;s.loading!==void 0&&(n=this.create({...s,promise:e,type:"loading",message:s.loading,description:typeof s.description!="function"?s.description:void 0}));let r=e instanceof Promise?e:e(),a=n!==void 0,o,i=r.then(async d=>{if(o=["resolve",d],v.isValidElement(d))a=!1,this.create({id:n,type:"default",message:d});else if(cu(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=(e,s)=>{let n=(s==null?void 0:s.id)||Jr++;return this.create({jsx:e(n),id:n,...s}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},Xe=new lu,du=(e,s)=>{let n=(s==null?void 0:s.id)||Jr++;return Xe.addToast({title:e,...s,id:n}),n},cu=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",uu=du,mu=()=>Xe.toasts,fu=()=>Xe.getActiveToasts(),I=Object.assign(uu,{success:Xe.success,info:Xe.info,warning:Xe.warning,error:Xe.error,custom:Xe.custom,message:Xe.message,promise:Xe.promise,dismiss:Xe.dismiss,loading:Xe.loading},{getHistory:mu,getToasts:fu});function hu(e,{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=e:r.appendChild(document.createTextNode(e))}hu(`: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 Hn(e){return e.label!==void 0}var xu=3,pu="32px",gu="16px",mo=4e3,bu=356,yu=14,vu=20,ju=200;function ct(...e){return e.filter(Boolean).join(" ")}function wu(e){let[s,n]=e.split("-"),r=[];return s&&r.push(s),n&&r.push(n),r}var Nu=e=>{var s,n,r,a,o,i,l,d,c,u,f;let{invert:m,toast:h,unstyled:g,interacting:y,setHeights:S,visibleToasts:b,heights:N,index:w,toasts:j,expanded:E,removeToast:p,defaultRichColors:C,closeButton:$,style:D,cancelButtonStyle:O,actionButtonStyle:F,className:_="",descriptionClassName:R="",duration:T,position:X,gap:q,loadingIcon:V,expandByDefault:W,classNames:z,icons:Q,closeButtonAriaLabel:ee="Close toast",pauseWhenPageIsHidden:k}=e,[M,Y]=v.useState(null),[L,ae]=v.useState(null),[A,ie]=v.useState(!1),[ge,Te]=v.useState(!1),[qe,$t]=v.useState(!1),[Zt,le]=v.useState(!1),[es,ts]=v.useState(!1),[ss,ns]=v.useState(0),[rn,dt]=v.useState(0),pt=v.useRef(h.duration||T||mo),Ms=v.useRef(null),Be=v.useRef(null),rs=w===0,Rt=w+1<=b,Ye=h.type,gt=h.dismissible!==!1,It=h.className||"",an=h.descriptionClassName||"",St=v.useMemo(()=>N.findIndex(B=>B.toastId===h.id)||0,[N,h.id]),on=v.useMemo(()=>{var B;return(B=h.closeButton)!=null?B:$},[h.closeButton,$]),bt=v.useMemo(()=>h.duration||T||mo,[h.duration,T]),Ft=v.useRef(0),yt=v.useRef(0),Ds=v.useRef(0),vt=v.useRef(null),[_s,ln]=X.split("-"),re=v.useMemo(()=>N.reduce((B,fe,he)=>he>=St?B:B+fe.height,0),[N,St]),G=iu(),se=h.invert||m,H=Ye==="loading";yt.current=v.useMemo(()=>St*q+re,[St,re]),v.useEffect(()=>{pt.current=bt},[bt]),v.useEffect(()=>{ie(!0)},[]),v.useEffect(()=>{let B=Be.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(Ae=>Ae.toastId!==h.id))}},[S,h.id]),v.useLayoutEffect(()=>{if(!A)return;let B=Be.current,fe=B.style.height;B.style.height="auto";let he=B.getBoundingClientRect().height;B.style.height=fe,dt(he),S(Ae=>Ae.find(Ce=>Ce.toastId===h.id)?Ae.map(Ce=>Ce.toastId===h.id?{...Ce,height:he}:Ce):[{toastId:h.id,height:he,position:h.position},...Ae])},[A,h.title,h.description,S,h.id]);let Z=v.useCallback(()=>{Te(!0),ns(yt.current),S(B=>B.filter(fe=>fe.toastId!==h.id)),setTimeout(()=>{p(h)},ju)},[h,p,S,yt]);v.useEffect(()=>{if(h.promise&&Ye==="loading"||h.duration===1/0||h.type==="loading")return;let B;return E||y||k&&G?(()=>{if(Ds.current<Ft.current){let fe=new Date().getTime()-Ft.current;pt.current=pt.current-fe}Ds.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),Z()},pt.current)),()=>clearTimeout(B)},[E,y,h,Ye,k,G,Z]),v.useEffect(()=>{h.delete&&Z()},[Z,h.delete]);function be(){var B,fe,he;return Q!=null&&Q.loading?v.createElement("div",{className:ct(z==null?void 0:z.loader,(B=h==null?void 0:h.classNames)==null?void 0:B.loader,"sonner-loader"),"data-visible":Ye==="loading"},Q.loading):V?v.createElement("div",{className:ct(z==null?void 0:z.loader,(fe=h==null?void 0:h.classNames)==null?void 0:fe.loader,"sonner-loader"),"data-visible":Ye==="loading"},V):v.createElement(tu,{className:ct(z==null?void 0:z.loader,(he=h==null?void 0:h.classNames)==null?void 0:he.loader),visible:Ye==="loading"})}return v.createElement("li",{tabIndex:0,ref:Be,className:ct(_,It,z==null?void 0:z.toast,(s=h==null?void 0:h.classNames)==null?void 0:s.toast,z==null?void 0:z.default,z==null?void 0:z[Ye],(n=h==null?void 0:h.classNames)==null?void 0:n[Ye]),"data-sonner-toast":"","data-rich-colors":(r=h.richColors)!=null?r:C,"data-styled":!(h.jsx||h.unstyled||g),"data-mounted":A,"data-promise":!!h.promise,"data-swiped":es,"data-removed":ge,"data-visible":Rt,"data-y-position":_s,"data-x-position":ln,"data-index":w,"data-front":rs,"data-swiping":qe,"data-dismissible":gt,"data-type":Ye,"data-invert":se,"data-swipe-out":Zt,"data-swipe-direction":L,"data-expanded":!!(E||W&&A),style:{"--index":w,"--toasts-before":w,"--z-index":j.length-w,"--offset":`${ge?ss:yt.current}px`,"--initial-height":W?"auto":`${rn}px`,...D,...h.style},onDragEnd:()=>{$t(!1),Y(null),vt.current=null},onPointerDown:B=>{H||!gt||(Ms.current=new Date,ns(yt.current),B.target.setPointerCapture(B.pointerId),B.target.tagName!=="BUTTON"&&($t(!0),vt.current={x:B.clientX,y:B.clientY}))},onPointerUp:()=>{var B,fe,he,Ae;if(Zt||!gt)return;vt.current=null;let Ce=Number(((B=Be.current)==null?void 0:B.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Me=Number(((fe=Be.current)==null?void 0:fe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),at=new Date().getTime()-((he=Ms.current)==null?void 0:he.getTime()),Qe=M==="x"?Ce:Me,zt=Math.abs(Qe)/at;if(Math.abs(Qe)>=vu||zt>.11){ns(yt.current),(Ae=h.onDismiss)==null||Ae.call(h,h),ae(M==="x"?Ce>0?"right":"left":Me>0?"down":"up"),Z(),le(!0),ts(!1);return}$t(!1),Y(null)},onPointerMove:B=>{var fe,he,Ae,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,Qe=(he=e.swipeDirections)!=null?he:wu(X);!M&&(Math.abs(at)>1||Math.abs(Me)>1)&&Y(Math.abs(at)>Math.abs(Me)?"x":"y");let zt={x:0,y:0};M==="y"?(Qe.includes("top")||Qe.includes("bottom"))&&(Qe.includes("top")&&Me<0||Qe.includes("bottom")&&Me>0)&&(zt.y=Me):M==="x"&&(Qe.includes("left")||Qe.includes("right"))&&(Qe.includes("left")&&at<0||Qe.includes("right")&&at>0)&&(zt.x=at),(Math.abs(zt.x)>0||Math.abs(zt.y)>0)&&ts(!0),(Ae=Be.current)==null||Ae.style.setProperty("--swipe-amount-x",`${zt.x}px`),(Ce=Be.current)==null||Ce.style.setProperty("--swipe-amount-y",`${zt.y}px`)}},on&&!h.jsx?v.createElement("button",{"aria-label":ee,"data-disabled":H,"data-close-button":!0,onClick:H||!gt?()=>{}:()=>{var B;Z(),(B=h.onDismiss)==null||B.call(h,h)},className:ct(z==null?void 0:z.closeButton,(a=h==null?void 0:h.classNames)==null?void 0:a.closeButton)},(o=Q==null?void 0:Q.close)!=null?o:ou):null,h.jsx||x.isValidElement(h.title)?h.jsx?h.jsx:typeof h.title=="function"?h.title():h.title:v.createElement(v.Fragment,null,Ye||h.icon||h.promise?v.createElement("div",{"data-icon":"",className:ct(z==null?void 0:z.icon,(i=h==null?void 0:h.classNames)==null?void 0:i.icon)},h.promise||h.type==="loading"&&!h.icon?h.icon||be():null,h.type!=="loading"?h.icon||(Q==null?void 0:Q[Ye])||Zc(Ye):null):null,v.createElement("div",{"data-content":"",className:ct(z==null?void 0:z.content,(l=h==null?void 0:h.classNames)==null?void 0:l.content)},v.createElement("div",{"data-title":"",className:ct(z==null?void 0:z.title,(d=h==null?void 0:h.classNames)==null?void 0:d.title)},typeof h.title=="function"?h.title():h.title),h.description?v.createElement("div",{"data-description":"",className:ct(R,an,z==null?void 0:z.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&&Hn(h.cancel)?v.createElement("button",{"data-button":!0,"data-cancel":!0,style:h.cancelButtonStyle||O,onClick:B=>{var fe,he;Hn(h.cancel)&&gt&&((he=(fe=h.cancel).onClick)==null||he.call(fe,B),Z())},className:ct(z==null?void 0:z.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&&Hn(h.action)?v.createElement("button",{"data-button":!0,"data-action":!0,style:h.actionButtonStyle||F,onClick:B=>{var fe,he;Hn(h.action)&&((he=(fe=h.action).onClick)==null||he.call(fe,B),!B.defaultPrevented&&Z())},className:ct(z==null?void 0:z.actionButton,(f=h==null?void 0:h.classNames)==null?void 0:f.actionButton)},h.action.label):null))};function fo(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function ku(e,s){let n={};return[e,s].forEach((r,a)=>{let o=a===1,i=o?"--mobile-offset":"--offset",l=o?gu:pu;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 Su=x.forwardRef(function(e,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:f,duration:m,style:h,visibleToasts:g=xu,toastOptions:y,dir:S=fo(),gap:b=yu,loadingIcon:N,icons:w,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:E}=e,[p,C]=v.useState([]),$=v.useMemo(()=>Array.from(new Set([r].concat(p.filter(k=>k.position).map(k=>k.position)))),[p,r]),[D,O]=v.useState([]),[F,_]=v.useState(!1),[R,T]=v.useState(!1),[X,q]=v.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),V=v.useRef(null),W=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),z=v.useRef(null),Q=v.useRef(!1),ee=v.useCallback(k=>{C(M=>{var Y;return(Y=M.find(L=>L.id===k.id))!=null&&Y.delete||Xe.dismiss(k.id),M.filter(({id:L})=>L!==k.id)})},[]);return v.useEffect(()=>Xe.subscribe(k=>{if(k.dismiss){C(M=>M.map(Y=>Y.id===k.id?{...Y,delete:!0}:Y));return}setTimeout(()=>{xc.flushSync(()=>{C(M=>{let Y=M.findIndex(L=>L.id===k.id);return Y!==-1?[...M.slice(0,Y),{...M[Y],...k},...M.slice(Y+1)]:[k,...M]})})})}),[]),v.useEffect(()=>{if(u!=="system"){q(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?q("dark"):q("light")),typeof window>"u")return;let k=window.matchMedia("(prefers-color-scheme: dark)");try{k.addEventListener("change",({matches:M})=>{q(M?"dark":"light")})}catch{k.addListener(({matches:Y})=>{try{q(Y?"dark":"light")}catch(L){console.error(L)}})}},[u]),v.useEffect(()=>{p.length<=1&&_(!1)},[p]),v.useEffect(()=>{let k=M=>{var Y,L;a.every(ae=>M[ae]||M.code===ae)&&(_(!0),(Y=V.current)==null||Y.focus()),M.code==="Escape"&&(document.activeElement===V.current||(L=V.current)!=null&&L.contains(document.activeElement))&&_(!1)};return document.addEventListener("keydown",k),()=>document.removeEventListener("keydown",k)},[a]),v.useEffect(()=>{if(V.current)return()=>{z.current&&(z.current.focus({preventScroll:!0}),z.current=null,Q.current=!1)}},[V.current]),v.createElement("section",{ref:s,"aria-label":`${j} ${W}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},$.map((k,M)=>{var Y;let[L,ae]=k.split("-");return p.length?v.createElement("ol",{key:k,dir:S==="auto"?fo():S,tabIndex:-1,ref:V,className:l,"data-sonner-toaster":!0,"data-theme":X,"data-y-position":L,"data-lifted":F&&p.length>1&&!o,"data-x-position":ae,style:{"--front-toast-height":`${((Y=D[0])==null?void 0:Y.height)||0}px`,"--width":`${bu}px`,"--gap":`${b}px`,...h,...ku(d,c)},onBlur:A=>{Q.current&&!A.currentTarget.contains(A.relatedTarget)&&(Q.current=!1,z.current&&(z.current.focus({preventScroll:!0}),z.current=null))},onFocus:A=>{A.target instanceof HTMLElement&&A.target.dataset.dismissible==="false"||Q.current||(Q.current=!0,z.current=A.relatedTarget)},onMouseEnter:()=>_(!0),onMouseMove:()=>_(!0),onMouseLeave:()=>{R||_(!1)},onDragEnd:()=>_(!1),onPointerDown:A=>{A.target instanceof HTMLElement&&A.target.dataset.dismissible==="false"||T(!0)},onPointerUp:()=>T(!1)},p.filter(A=>!A.position&&M===0||A.position===k).map((A,ie)=>{var ge,Te;return v.createElement(Nu,{key:A.id,icons:w,index:ie,toast:A,defaultRichColors:f,duration:(ge=y==null?void 0:y.duration)!=null?ge:m,className:y==null?void 0:y.className,descriptionClassName:y==null?void 0:y.descriptionClassName,invert:n,visibleToasts:g,closeButton:(Te=y==null?void 0:y.closeButton)!=null?Te:i,interacting:R,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==A.position),heights:D.filter(qe=>qe.position==A.position),setHeights:O,expandByDefault:o,gap:b,loadingIcon:N,expanded:F,pauseWhenPageIsHidden:E,swipeDirections:e.swipeDirections})})):null}))}),Cu=(e,s,n,r,a,o,i,l)=>{let d=document.documentElement,c=["light","dark"];function u(h){(Array.isArray(e)?e:[e]).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)}),f(h)}function f(h){l&&c.includes(h)&&(d.style.colorScheme=h)}function m(){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"?m():h;u(g)}catch{}},ho=["light","dark"],Wi="(prefers-color-scheme: dark)",Mu=typeof window>"u",ua=x.createContext(void 0),Du={setTheme:e=>{},themes:[]},_u=()=>{var e;return(e=x.useContext(ua))!=null?e:Du},Eu=e=>x.useContext(ua)?x.createElement(x.Fragment,null,e.children):x.createElement(Tu,{...e}),Ou=["light","dark"],Tu=({forcedTheme:e,disableTransitionOnChange:s=!1,enableSystem:n=!0,enableColorScheme:r=!0,storageKey:a="theme",themes:o=Ou,defaultTheme:i=n?"system":"light",attribute:l="data-theme",value:d,children:c,nonce:u,scriptProps:f})=>{let[m,h]=x.useState(()=>Au(a,i)),[g,y]=x.useState(()=>m==="system"?Cr():m),S=d?Object.values(d):o,b=x.useCallback(E=>{let p=E;if(!p)return;E==="system"&&n&&(p=Cr());let C=d?d[p]:p,$=s?$u(u):null,D=document.documentElement,O=F=>{F==="class"?(D.classList.remove(...S),C&&D.classList.add(C)):F.startsWith("data-")&&(C?D.setAttribute(F,C):D.removeAttribute(F))};if(Array.isArray(l)?l.forEach(O):O(l),r){let F=ho.includes(i)?i:null,_=ho.includes(p)?p:F;D.style.colorScheme=_}$==null||$()},[u]),N=x.useCallback(E=>{let p=typeof E=="function"?E(m):E;h(p);try{localStorage.setItem(a,p)}catch{}},[m]),w=x.useCallback(E=>{let p=Cr(E);y(p),m==="system"&&n&&!e&&b("system")},[m,e]);x.useEffect(()=>{let E=window.matchMedia(Wi);return E.addListener(w),w(E),()=>E.removeListener(w)},[w]),x.useEffect(()=>{let E=p=>{p.key===a&&(p.newValue?h(p.newValue):N(i))};return window.addEventListener("storage",E),()=>window.removeEventListener("storage",E)},[N]),x.useEffect(()=>{b(e??m)},[e,m]);let j=x.useMemo(()=>({theme:m,setTheme:N,forcedTheme:e,resolvedTheme:m==="system"?g:m,themes:n?[...o,"system"]:o,systemTheme:n?g:void 0}),[m,N,e,g,n,o]);return x.createElement(ua.Provider,{value:j},x.createElement(Pu,{forcedTheme:e,storageKey:a,attribute:l,enableSystem:n,enableColorScheme:r,defaultTheme:i,value:d,themes:o,nonce:u,scriptProps:f}),c)},Pu=x.memo(({forcedTheme:e,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,e,l,i,r,a]).slice(1,-1);return x.createElement("script",{...c,suppressHydrationWarning:!0,nonce:typeof window>"u"?d:"",dangerouslySetInnerHTML:{__html:`(${Cu.toString()})(${u})`}})}),Au=(e,s)=>{if(Mu)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||s},$u=e=>{let s=document.createElement("style");return e&&s.setAttribute("nonce",e),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)}},Cr=e=>(e||(e=window.matchMedia(Wi)),e.matches?"dark":"light");function Ru({children:e}){return t.jsx(Eu,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const qi=x.createContext(null),Kn="meridian_token",Mr="meridian_user",Vn="meridian_workspace";function xo(e){try{const s=e.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 Iu({children:e}){const[s,n]=x.useState(()=>{try{const u=localStorage.getItem(Mr),f=localStorage.getItem(Kn);if(!u)return null;const m=JSON.parse(u);return Array.isArray(m.roles)||(m.roles=f?xo(f):[]),m}catch{return null}}),[r,a]=x.useState(()=>localStorage.getItem(Kn)),[o,i]=x.useState(()=>{try{const u=localStorage.getItem(Vn);return u?JSON.parse(u):null}catch{return null}}),l=(u,f)=>{const m=xo(f),h={...u,roles:m};n(h),a(f),localStorage.setItem(Kn,f),localStorage.setItem(Mr,JSON.stringify(h))},d=()=>{n(null),a(null),i(null),localStorage.removeItem(Kn),localStorage.removeItem(Mr),localStorage.removeItem(Vn)},c=u=>{i(u),u?localStorage.setItem(Vn,JSON.stringify(u)):localStorage.removeItem(Vn)};return x.useEffect(()=>{r&&!s&&d()},[]),t.jsx(qi.Provider,{value:{user:s,token:r,workspace:o,isAuthenticated:!!r&&!!s,login:l,logout:d,setWorkspace:c},children:e})}function ke(){const e=x.useContext(qi);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const Bi=x.createContext(null);function Fu({children:e}){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)},[]),t.jsx(Bi.Provider,{value:{open:s,setOpen:n,toggle:()=>n(r=>!r)},children:e})}function Yi(){const e=x.useContext(Bi);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function Li(e){var s,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(s=0;s<a;s++)e[s]&&(n=Li(e[s]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Ui(){for(var e,s,n=0,r="",a=arguments.length;n<a;n++)(e=arguments[n])&&(s=Li(e))&&(r&&(r+=" "),r+=s);return r}const ma="-",zu=e=>{const s=qu(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const l=i.split(ma);return l[0]===""&&l.length!==1&&l.shift(),Hi(l,s)||Wu(i)},getConflictingClassGroupIds:(i,l)=>{const d=n[i]||[];return l&&r[i]?[...d,...r[i]]:d}}},Hi=(e,s)=>{var i;if(e.length===0)return s.classGroupId;const n=e[0],r=s.nextPart.get(n),a=r?Hi(e.slice(1),r):void 0;if(a)return a;if(s.validators.length===0)return;const o=e.join(ma);return(i=s.validators.find(({validator:l})=>l(o)))==null?void 0:i.classGroupId},po=/^\[(.+)\]$/,Wu=e=>{if(po.test(e)){const s=po.exec(e)[1],n=s==null?void 0:s.substring(0,s.indexOf(":"));if(n)return"arbitrary.."+n}},qu=e=>{const{theme:s,prefix:n}=e,r={nextPart:new Map,validators:[]};return Yu(Object.entries(e.classGroups),n).forEach(([o,i])=>{Zr(i,r,o,s)}),r},Zr=(e,s,n,r)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?s:go(s,a);o.classGroupId=n;return}if(typeof a=="function"){if(Bu(a)){Zr(a(r),s,n,r);return}s.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,i])=>{Zr(i,go(s,o),n,r)})})},go=(e,s)=>{let n=e;return s.split(ma).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},Bu=e=>e.isThemeGetter,Yu=(e,s)=>s?e.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]}):e,Lu=e=>{if(e<1)return{get:()=>{},set:()=>{}};let s=0,n=new Map,r=new Map;const a=(o,i)=>{n.set(o,i),s++,s>e&&(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)}}},Ki="!",Uu=e=>{const{separator:s,experimentalParseClassName:n}=e,r=s.length===1,a=s[0],o=s.length,i=l=>{const d=[];let c=0,u=0,f;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==="/"){f=S;continue}}b==="["?c++:b==="]"&&c--}const m=d.length===0?l:l.substring(u),h=m.startsWith(Ki),g=h?m.substring(1):m,y=f&&f>u?f-u:void 0;return{modifiers:d,hasImportantModifier:h,baseClassName:g,maybePostfixModifierPosition:y}};return n?l=>n({className:l,parseClassName:i}):i},Hu=e=>{if(e.length<=1)return e;const s=[];let n=[];return e.forEach(r=>{r[0]==="["?(s.push(...n.sort(),r),n=[]):n.push(r)}),s.push(...n.sort()),s},Ku=e=>({cache:Lu(e.cacheSize),parseClassName:Uu(e),...zu(e)}),Vu=/\s+/,Gu=(e,s)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:a}=s,o=[],i=e.trim().split(Vu);let l="";for(let d=i.length-1;d>=0;d-=1){const c=i[d],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:h}=n(c);let g=!!h,y=r(g?m.substring(0,h):m);if(!y){if(!g){l=c+(l.length>0?" "+l:l);continue}if(y=r(m),!y){l=c+(l.length>0?" "+l:l);continue}g=!1}const S=Hu(u).join(":"),b=f?S+Ki:S,N=b+y;if(o.includes(N))continue;o.push(N);const w=a(y,g);for(let j=0;j<w.length;++j){const E=w[j];o.push(b+E)}l=c+(l.length>0?" "+l:l)}return l};function Qu(){let e=0,s,n,r="";for(;e<arguments.length;)(s=arguments[e++])&&(n=Vi(s))&&(r&&(r+=" "),r+=n);return r}const Vi=e=>{if(typeof e=="string")return e;let s,n="";for(let r=0;r<e.length;r++)e[r]&&(s=Vi(e[r]))&&(n&&(n+=" "),n+=s);return n};function Xu(e,...s){let n,r,a,o=i;function i(d){const c=s.reduce((u,f)=>f(u),e());return n=Ku(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=Gu(d,n);return a(d,u),u}return function(){return o(Qu.apply(null,arguments))}}const Se=e=>{const s=n=>n[e]||[];return s.isThemeGetter=!0,s},Gi=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ju=/^\d+\/\d+$/,Zu=new Set(["px","full","screen"]),em=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,tm=/\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$/,sm=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,nm=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,rm=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ct=e=>Rs(e)||Zu.has(e)||Ju.test(e),Wt=e=>Ks(e,"length",mm),Rs=e=>!!e&&!Number.isNaN(Number(e)),Dr=e=>Ks(e,"number",Rs),dn=e=>!!e&&Number.isInteger(Number(e)),am=e=>e.endsWith("%")&&Rs(e.slice(0,-1)),me=e=>Gi.test(e),qt=e=>em.test(e),om=new Set(["length","size","percentage"]),im=e=>Ks(e,om,Qi),lm=e=>Ks(e,"position",Qi),dm=new Set(["image","url"]),cm=e=>Ks(e,dm,hm),um=e=>Ks(e,"",fm),cn=()=>!0,Ks=(e,s,n)=>{const r=Gi.exec(e);return r?r[1]?typeof s=="string"?r[1]===s:s.has(r[1]):n(r[2]):!1},mm=e=>tm.test(e)&&!sm.test(e),Qi=()=>!1,fm=e=>nm.test(e),hm=e=>rm.test(e),xm=()=>{const e=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"),f=Se("invert"),m=Se("gap"),h=Se("gradientColorStops"),g=Se("gradientColorStopPositions"),y=Se("inset"),S=Se("margin"),b=Se("opacity"),N=Se("padding"),w=Se("saturate"),j=Se("scale"),E=Se("sepia"),p=Se("skew"),C=Se("space"),$=Se("translate"),D=()=>["auto","contain","none"],O=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto",me,s],_=()=>[me,s],R=()=>["",Ct,Wt],T=()=>["auto",Rs,me],X=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["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"],W=()=>["start","end","center","between","around","evenly","stretch"],z=()=>["","0",me],Q=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ee=()=>[Rs,me];return{cacheSize:500,separator:":",theme:{colors:[cn],spacing:[Ct,Wt],blur:["none","",qt,me],brightness:ee(),borderColor:[e],borderRadius:["none","","full",qt,me],borderSpacing:_(),borderWidth:R(),contrast:ee(),grayscale:z(),hueRotate:ee(),invert:z(),gap:_(),gradientColorStops:[e],gradientColorStopPositions:[am,Wt],inset:F(),margin:F(),opacity:ee(),padding:_(),saturate:ee(),scale:ee(),sepia:z(),skew:ee(),space:_(),translate:_()},classGroups:{aspect:[{aspect:["auto","square","video",me]}],container:["container"],columns:[{columns:[qt]}],"break-after":[{"break-after":Q()}],"break-before":[{"break-before":Q()}],"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:[...X(),me]}],overflow:[{overflow:O()}],"overflow-x":[{"overflow-x":O()}],"overflow-y":[{"overflow-y":O()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],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",dn,me]}],basis:[{basis:F()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",me]}],grow:[{grow:z()}],shrink:[{shrink:z()}],order:[{order:["first","last","none",dn,me]}],"grid-cols":[{"grid-cols":[cn]}],"col-start-end":[{col:["auto",{span:["full",dn,me]},me]}],"col-start":[{"col-start":T()}],"col-end":[{"col-end":T()}],"grid-rows":[{"grid-rows":[cn]}],"row-start-end":[{row:["auto",{span:[dn,me]},me]}],"row-start":[{"row-start":T()}],"row-end":[{"row-end":T()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",me]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",me]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...W()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...W(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...W(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[N]}],px:[{px:[N]}],py:[{py:[N]}],ps:[{ps:[N]}],pe:[{pe:[N]}],pt:[{pt:[N]}],pr:[{pr:[N]}],pb:[{pb:[N]}],pl:[{pl:[N]}],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":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",me,s]}],"min-w":[{"min-w":[me,s,"min","max","fit"]}],"max-w":[{"max-w":[me,s,"none","full","min","max","fit","prose",{screen:[qt]},qt]}],h:[{h:[me,s,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[me,s,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[me,s,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[me,s,"auto","min","max","fit"]}],"font-size":[{text:["base",qt,Wt]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Dr]}],"font-family":[{font:[cn]}],"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",me]}],"line-clamp":[{"line-clamp":["none",Rs,Dr]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ct,me]}],"list-image":[{"list-image":["none",me]}],"list-style-type":[{list:["none","disc","decimal",me]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ct,Wt]}],"underline-offset":[{"underline-offset":["auto",Ct,me]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:_()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",me]}],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",me]}],"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:[...X(),lm]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",im]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},cm]}],"bg-color":[{bg:[e]}],"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:[...q(),"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:q()}],"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:["",...q()]}],"outline-offset":[{"outline-offset":[Ct,me]}],"outline-w":[{outline:[Ct,Wt]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[Ct,Wt]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",qt,um]}],"shadow-color":[{shadow:[cn]}],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",qt,me]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[w]}],sepia:[{sepia:[E]}],"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":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[E]}],"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",me]}],duration:[{duration:ee()}],ease:[{ease:["linear","in","out","in-out",me]}],delay:[{delay:ee()}],animate:[{animate:["none","spin","ping","pulse","bounce",me]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[dn,me]}],"translate-x":[{"translate-x":[$]}],"translate-y":[{"translate-y":[$]}],"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",me]}],accent:[{accent:["auto",e]}],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",me]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":_()}],"scroll-mx":[{"scroll-mx":_()}],"scroll-my":[{"scroll-my":_()}],"scroll-ms":[{"scroll-ms":_()}],"scroll-me":[{"scroll-me":_()}],"scroll-mt":[{"scroll-mt":_()}],"scroll-mr":[{"scroll-mr":_()}],"scroll-mb":[{"scroll-mb":_()}],"scroll-ml":[{"scroll-ml":_()}],"scroll-p":[{"scroll-p":_()}],"scroll-px":[{"scroll-px":_()}],"scroll-py":[{"scroll-py":_()}],"scroll-ps":[{"scroll-ps":_()}],"scroll-pe":[{"scroll-pe":_()}],"scroll-pt":[{"scroll-pt":_()}],"scroll-pr":[{"scroll-pr":_()}],"scroll-pb":[{"scroll-pb":_()}],"scroll-pl":[{"scroll-pl":_()}],"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",me]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ct,Wt,Dr]}],stroke:[{stroke:[e,"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"]}}},pm=Xu(xm);function P(...e){return pm(Ui(e))}const fa=vc,us=bc,ms=yc,Ut=x.forwardRef(({className:e,sideOffset:s=4,...n},r)=>t.jsx(si,{ref:r,sideOffset:s,className:P("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",e),...n}));Ut.displayName=si.displayName;const Xi=x.createContext([]);function gm({widgets:e,children:s}){return v.createElement(Xi.Provider,{value:e},s)}function bm(e){return x.useContext(Xi).filter(n=>n.zone===e).map(n=>n.component)}var Jo;const Ji=((Jo=window.__MERIDIAN_CONFIG__)==null?void 0:Jo.apiUrl)??void 0??"";class Zi extends Error{constructor(s,n,r){super(n),this.status=s,this.data=r,this.name="ApiError"}}function el(){return localStorage.getItem("meridian_token")}async function un(e,s={}){var o;const n=el(),r={"Content-Type":"application/json",...s.headers};n&&(r.Authorization=`Bearer ${n}`);const a=await fetch(`${Ji}${e}`,{...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 Zi(a.status,l,i)}if(a.status!==204)return a.json()}const J={get:e=>un(e,{method:"GET"}),post:(e,s)=>un(e,{method:"POST",body:JSON.stringify(s)}),put:(e,s)=>un(e,{method:"PUT",body:JSON.stringify(s)}),patch:(e,s)=>un(e,{method:"PATCH",body:JSON.stringify(s)}),delete:e=>un(e,{method:"DELETE"}),upload:async(e,s)=>{var o;const n=el(),r={};n&&(r.Authorization=`Bearer ${n}`);const a=await fetch(`${Ji}${e}`,{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 Zi(a.status,l,i)}if(a.status!==204)return a.json()}},Pe={all:["issues"],byProject:e=>[...Pe.all,"project",e],detail:e=>[...Pe.all,e],comments:e=>[...Pe.all,e,"comments"],activities:e=>[...Pe.all,e,"activities"]};function Cn(e){return Ne({queryKey:e?Pe.byProject(e):Pe.all,queryFn:()=>{const s=e?`/admin/issues?project_id=${e}`:"/admin/issues";return J.get(s)},select:s=>s.issues})}function tl(e){return Ne({queryKey:Pe.detail(e),queryFn:()=>J.get(`/admin/issues/${e}`),select:s=>s.issue,enabled:!!e})}function ym(e){return Ne({queryKey:Pe.comments(e),queryFn:()=>J.get(`/admin/issues/${e}/comments`),select:s=>s.comments,enabled:!!e})}function sl(){const e=ue();return de({mutationFn:s=>J.post("/admin/issues",s),onSuccess:(s,n)=>{e.invalidateQueries({queryKey:Pe.byProject(n.project_id)})}})}function or(e,s){const n=ue();return de({mutationFn:r=>J.put(`/admin/issues/${e}`,r),onMutate:async r=>{await n.cancelQueries({queryKey:Pe.byProject(s)});const a=n.getQueryData(Pe.byProject(s));return n.setQueryData(Pe.byProject(s),o=>o&&{...o,issues:o.issues.map(i=>i.id===e?{...i,...r}:i)}),{previous:a}},onError:(r,a,o)=>{o!=null&&o.previous&&n.setQueryData(Pe.byProject(s),o.previous)},onSettled:()=>{n.invalidateQueries({queryKey:Pe.byProject(s)}),n.invalidateQueries({queryKey:Pe.detail(e)})}})}function vm(e){return Ne({queryKey:Pe.activities(e),queryFn:()=>J.get(`/admin/issues/${e}/activities`),select:s=>s.activities,enabled:!!e})}function jm(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/issues/${e}/comments`,{body:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Pe.comments(e)})}})}const bo=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,yo=Ui,Mn=(e,s)=>n=>{var r;if((s==null?void 0:s.variants)==null)return yo(e,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],f=o==null?void 0:o[c];if(u===null)return null;const m=bo(u)||bo(f);return a[c][m]}),l=n&&Object.entries(n).reduce((c,u)=>{let[f,m]=u;return m===void 0||(c[f]=m),c},{}),d=s==null||(r=s.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:f,className:m,...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,f,m]:c},[]);return yo(e,i,d,n==null?void 0:n.class,n==null?void 0:n.className)},Is=Mn("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"}}),K=x.forwardRef(({className:e,variant:s,size:n,asChild:r=!1,...a},o)=>{const i=r?ia:"button";return t.jsx(i,{className:P(Is({variant:s,size:n,className:e})),ref:o,...a})});K.displayName="Button";const xe=x.forwardRef(({className:e,type:s,...n},r)=>t.jsx("input",{type:s,className:P("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",e),ref:r,...n}));xe.displayName="Input";/**
4
4
  * @license lucide-react v0.468.0 - ISC
5
5
  *
6
6
  * This source code is licensed under the ISC license.
7
7
  * See the LICENSE file in the root directory of this source tree.
8
- */const vm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),sl=(...e)=>e.filter((s,n,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===n).join(" ").trim();/**
8
+ */const wm=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nl=(...e)=>e.filter((s,n,r)=>!!s&&s.trim()!==""&&r.indexOf(s)===n).join(" ").trim();/**
9
9
  * @license lucide-react v0.468.0 - ISC
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
13
- */var jm={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"};/**
13
+ */var Nm={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
14
  * @license lucide-react v0.468.0 - ISC
15
15
  *
16
16
  * This source code is licensed under the ISC license.
17
17
  * See the LICENSE file in the root directory of this source tree.
18
- */const wm=x.forwardRef(({color:e="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:i,...l},d)=>x.createElement("svg",{ref:d,...jm,width:s,height:s,stroke:e,strokeWidth:r?Number(n)*24/Number(s):n,className:sl("lucide",a),...l},[...i.map(([c,u])=>x.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
18
+ */const km=x.forwardRef(({color:e="currentColor",size:s=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:a="",children:o,iconNode:i,...l},d)=>x.createElement("svg",{ref:d,...Nm,width:s,height:s,stroke:e,strokeWidth:r?Number(n)*24/Number(s):n,className:nl("lucide",a),...l},[...i.map(([c,u])=>x.createElement(c,u)),...Array.isArray(o)?o:[o]]));/**
19
19
  * @license lucide-react v0.468.0 - ISC
20
20
  *
21
21
  * This source code is licensed under the ISC license.
22
22
  * See the LICENSE file in the root directory of this source tree.
23
- */const H=(e,s)=>{const n=x.forwardRef(({className:r,...a},o)=>x.createElement(wm,{ref:o,iconNode:s,className:sl(`lucide-${vm(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
23
+ */const U=(e,s)=>{const n=x.forwardRef(({className:r,...a},o)=>x.createElement(km,{ref:o,iconNode:s,className:nl(`lucide-${wm(e)}`,r),...a}));return n.displayName=`${e}`,n};/**
24
24
  * @license lucide-react v0.468.0 - ISC
25
25
  *
26
26
  * This source code is licensed under the ISC license.
27
27
  * See the LICENSE file in the root directory of this source tree.
28
- */const or=H("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
28
+ */const ir=U("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
29
29
  * @license lucide-react v0.468.0 - ISC
30
30
  *
31
31
  * This source code is licensed under the ISC license.
32
32
  * See the LICENSE file in the root directory of this source tree.
33
- */const fa=H("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
33
+ */const ha=U("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
34
34
  * @license lucide-react v0.468.0 - ISC
35
35
  *
36
36
  * This source code is licensed under the ISC license.
37
37
  * See the LICENSE file in the root directory of this source tree.
38
- */const ir=H("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
38
+ */const lr=U("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
39
39
  * @license lucide-react v0.468.0 - ISC
40
40
  *
41
41
  * This source code is licensed under the ISC license.
42
42
  * See the LICENSE file in the root directory of this source tree.
43
- */const qs=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"}]]);/**
43
+ */const qs=U("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
44
  * @license lucide-react v0.468.0 - ISC
45
45
  *
46
46
  * This source code is licensed under the ISC license.
47
47
  * See the LICENSE file in the root directory of this source tree.
48
- */const nl=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"}]]);/**
48
+ */const rl=U("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
49
  * @license lucide-react v0.468.0 - ISC
50
50
  *
51
51
  * This source code is licensed under the ISC license.
52
52
  * See the LICENSE file in the root directory of this source tree.
53
- */const rl=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"}]]);/**
53
+ */const al=U("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
54
  * @license lucide-react v0.468.0 - ISC
55
55
  *
56
56
  * This source code is licensed under the ISC license.
57
57
  * See the LICENSE file in the root directory of this source tree.
58
- */const Nm=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"}]]);/**
58
+ */const Sm=U("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
59
  * @license lucide-react v0.468.0 - ISC
60
60
  *
61
61
  * This source code is licensed under the ISC license.
62
62
  * See the LICENSE file in the root directory of this source tree.
63
- */const ha=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"}]]);/**
63
+ */const xa=U("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
64
  * @license lucide-react v0.468.0 - ISC
65
65
  *
66
66
  * This source code is licensed under the ISC license.
67
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"}]]);/**
68
+ */const ht=U("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
69
  * @license lucide-react v0.468.0 - ISC
70
70
  *
71
71
  * This source code is licensed under the ISC license.
72
72
  * See the LICENSE file in the root directory of this source tree.
73
- */const km=H("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
73
+ */const Cm=U("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
74
74
  * @license lucide-react v0.468.0 - ISC
75
75
  *
76
76
  * This source code is licensed under the ISC license.
77
77
  * See the LICENSE file in the root directory of this source tree.
78
- */const mt=H("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
78
+ */const it=U("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
79
79
  * @license lucide-react v0.468.0 - ISC
80
80
  *
81
81
  * This source code is licensed under the ISC license.
82
82
  * See the LICENSE file in the root directory of this source tree.
83
- */const Vs=H("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
83
+ */const Vs=U("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
84
84
  * @license lucide-react v0.468.0 - ISC
85
85
  *
86
86
  * This source code is licensed under the ISC license.
87
87
  * See the LICENSE file in the root directory of this source tree.
88
- */const xa=H("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
88
+ */const pa=U("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
89
89
  * @license lucide-react v0.468.0 - ISC
90
90
  *
91
91
  * This source code is licensed under the ISC license.
92
92
  * See the LICENSE file in the root directory of this source tree.
93
- */const Gs=H("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
93
+ */const Gs=U("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
94
94
  * @license lucide-react v0.468.0 - ISC
95
95
  *
96
96
  * This source code is licensed under the ISC license.
97
97
  * See the LICENSE file in the root directory of this source tree.
98
- */const pa=H("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
98
+ */const ga=U("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
99
99
  * @license lucide-react v0.468.0 - ISC
100
100
  *
101
101
  * This source code is licensed under the ISC license.
102
102
  * See the LICENSE file in the root directory of this source tree.
103
- */const al=H("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
103
+ */const ol=U("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
104
104
  * @license lucide-react v0.468.0 - ISC
105
105
  *
106
106
  * This source code is licensed under the ISC license.
107
107
  * See the LICENSE file in the root directory of this source tree.
108
- */const js=H("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
108
+ */const js=U("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
109
109
  * @license lucide-react v0.468.0 - ISC
110
110
  *
111
111
  * This source code is licensed under the ISC license.
112
112
  * See the LICENSE file in the root directory of this source tree.
113
- */const ol=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"}]]);/**
113
+ */const il=U("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"}]]);/**
114
114
  * @license lucide-react v0.468.0 - ISC
115
115
  *
116
116
  * This source code is licensed under the ISC license.
117
117
  * See the LICENSE file in the root directory of this source tree.
118
- */const il=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"}]]);/**
118
+ */const ll=U("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"}]]);/**
119
119
  * @license lucide-react v0.468.0 - ISC
120
120
  *
121
121
  * This source code is licensed under the ISC license.
122
122
  * See the LICENSE file in the root directory of this source tree.
123
- */const Nt=H("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
123
+ */const Nt=U("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
124
124
  * @license lucide-react v0.468.0 - ISC
125
125
  *
126
126
  * This source code is licensed under the ISC license.
127
127
  * See the LICENSE file in the root directory of this source tree.
128
- */const Sm=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"}]]);/**
128
+ */const Mm=U("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"}]]);/**
129
129
  * @license lucide-react v0.468.0 - ISC
130
130
  *
131
131
  * This source code is licensed under the ISC license.
132
132
  * See the LICENSE file in the root directory of this source tree.
133
- */const Qt=H("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
133
+ */const Qt=U("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
134
134
  * @license lucide-react v0.468.0 - ISC
135
135
  *
136
136
  * This source code is licensed under the ISC license.
137
137
  * See the LICENSE file in the root directory of this source tree.
138
- */const ll=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"}]]);/**
138
+ */const dl=U("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"}]]);/**
139
139
  * @license lucide-react v0.468.0 - ISC
140
140
  *
141
141
  * This source code is licensed under the ISC license.
142
142
  * See the LICENSE file in the root directory of this source tree.
143
- */const dl=H("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
143
+ */const cl=U("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
144
144
  * @license lucide-react v0.468.0 - ISC
145
145
  *
146
146
  * This source code is licensed under the ISC license.
147
147
  * See the LICENSE file in the root directory of this source tree.
148
- */const Cm=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"}]]);/**
148
+ */const Dm=U("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"}]]);/**
149
149
  * @license lucide-react v0.468.0 - ISC
150
150
  *
151
151
  * This source code is licensed under the ISC license.
152
152
  * See the LICENSE file in the root directory of this source tree.
153
- */const cl=H("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
153
+ */const ul=U("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
154
154
  * @license lucide-react v0.468.0 - ISC
155
155
  *
156
156
  * This source code is licensed under the ISC license.
157
157
  * See the LICENSE file in the root directory of this source tree.
158
- */const Mm=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"}]]);/**
158
+ */const _m=U("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
159
  * @license lucide-react v0.468.0 - ISC
160
160
  *
161
161
  * This source code is licensed under the ISC license.
162
162
  * See the LICENSE file in the root directory of this source tree.
163
- */const ga=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"}]]);/**
163
+ */const ba=U("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
164
  * @license lucide-react v0.468.0 - ISC
165
165
  *
166
166
  * This source code is licensed under the ISC license.
167
167
  * See the LICENSE file in the root directory of this source tree.
168
- */const Dn=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"}]]);/**
168
+ */const Dn=U("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
169
  * @license lucide-react v0.468.0 - ISC
170
170
  *
171
171
  * This source code is licensed under the ISC license.
172
172
  * See the LICENSE file in the root directory of this source tree.
173
- */const ul=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"}]]);/**
173
+ */const ml=U("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
174
  * @license lucide-react v0.468.0 - ISC
175
175
  *
176
176
  * This source code is licensed under the ISC license.
177
177
  * See the LICENSE file in the root directory of this source tree.
178
- */const ba=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"}]]);/**
178
+ */const ya=U("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
179
  * @license lucide-react v0.468.0 - ISC
180
180
  *
181
181
  * This source code is licensed under the ISC license.
182
182
  * See the LICENSE file in the root directory of this source tree.
183
- */const _n=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"}]]);/**
183
+ */const _n=U("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
184
  * @license lucide-react v0.468.0 - ISC
185
185
  *
186
186
  * This source code is licensed under the ISC license.
187
187
  * See the LICENSE file in the root directory of this source tree.
188
- */const Dm=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"}]]);/**
188
+ */const Em=U("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
189
  * @license lucide-react v0.468.0 - ISC
190
190
  *
191
191
  * This source code is licensed under the ISC license.
192
192
  * See the LICENSE file in the root directory of this source tree.
193
- */const _m=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"}]]);/**
193
+ */const Om=U("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
194
  * @license lucide-react v0.468.0 - ISC
195
195
  *
196
196
  * This source code is licensed under the ISC license.
197
197
  * See the LICENSE file in the root directory of this source tree.
198
- */const Em=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"}]]);/**
198
+ */const Tm=U("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
199
  * @license lucide-react v0.468.0 - ISC
200
200
  *
201
201
  * This source code is licensed under the ISC license.
202
202
  * See the LICENSE file in the root directory of this source tree.
203
- */const Om=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"}]]);/**
203
+ */const Pm=U("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
204
  * @license lucide-react v0.468.0 - ISC
205
205
  *
206
206
  * This source code is licensed under the ISC license.
207
207
  * See the LICENSE file in the root directory of this source tree.
208
- */const Tm=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"}]]);/**
208
+ */const Am=U("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
209
  * @license lucide-react v0.468.0 - ISC
210
210
  *
211
211
  * This source code is licensed under the ISC license.
212
212
  * See the LICENSE file in the root directory of this source tree.
213
- */const ya=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"}]]);/**
213
+ */const va=U("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
214
  * @license lucide-react v0.468.0 - ISC
215
215
  *
216
216
  * This source code is licensed under the ISC license.
217
217
  * See the LICENSE file in the root directory of this source tree.
218
- */const Qs=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"}]]);/**
218
+ */const Qs=U("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
219
  * @license lucide-react v0.468.0 - ISC
220
220
  *
221
221
  * This source code is licensed under the ISC license.
222
222
  * See the LICENSE file in the root directory of this source tree.
223
- */const ml=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"}]]);/**
223
+ */const fl=U("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
224
  * @license lucide-react v0.468.0 - ISC
225
225
  *
226
226
  * This source code is licensed under the ISC license.
227
227
  * See the LICENSE file in the root directory of this source tree.
228
- */const Pm=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"}]]);/**
228
+ */const $m=U("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
229
  * @license lucide-react v0.468.0 - ISC
230
230
  *
231
231
  * This source code is licensed under the ISC license.
232
232
  * See the LICENSE file in the root directory of this source tree.
233
- */const Am=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"}]]);/**
233
+ */const Rm=U("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
234
  * @license lucide-react v0.468.0 - ISC
235
235
  *
236
236
  * This source code is licensed under the ISC license.
237
237
  * See the LICENSE file in the root directory of this source tree.
238
- */const $m=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"}]]);/**
238
+ */const Im=U("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
239
  * @license lucide-react v0.468.0 - ISC
240
240
  *
241
241
  * This source code is licensed under the ISC license.
242
242
  * See the LICENSE file in the root directory of this source tree.
243
- */const fl=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"}]]);/**
243
+ */const hl=U("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
244
  * @license lucide-react v0.468.0 - ISC
245
245
  *
246
246
  * This source code is licensed under the ISC license.
247
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"}]]);/**
248
+ */const xt=U("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
249
  * @license lucide-react v0.468.0 - ISC
250
250
  *
251
251
  * This source code is licensed under the ISC license.
252
252
  * See the LICENSE file in the root directory of this source tree.
253
- */const er=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"}]]);/**
253
+ */const tr=U("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
254
  * @license lucide-react v0.468.0 - ISC
255
255
  *
256
256
  * This source code is licensed under the ISC license.
257
257
  * See the LICENSE file in the root directory of this source tree.
258
- */const va=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"}]]);/**
258
+ */const ja=U("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
259
  * @license lucide-react v0.468.0 - ISC
260
260
  *
261
261
  * This source code is licensed under the ISC license.
262
262
  * See the LICENSE file in the root directory of this source tree.
263
- */const Rm=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"}]]);/**
263
+ */const Fm=U("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
264
  * @license lucide-react v0.468.0 - ISC
265
265
  *
266
266
  * This source code is licensed under the ISC license.
267
267
  * See the LICENSE file in the root directory of this source tree.
268
- */const hl=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"}]]);/**
268
+ */const xl=U("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
269
  * @license lucide-react v0.468.0 - ISC
270
270
  *
271
271
  * This source code is licensed under the ISC license.
272
272
  * See the LICENSE file in the root directory of this source tree.
273
- */const Im=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"}]]);/**
273
+ */const zm=U("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
274
  * @license lucide-react v0.468.0 - ISC
275
275
  *
276
276
  * This source code is licensed under the ISC license.
277
277
  * See the LICENSE file in the root directory of this source tree.
278
- */const xl=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"}]]);/**
278
+ */const pl=U("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
279
  * @license lucide-react v0.468.0 - ISC
280
280
  *
281
281
  * This source code is licensed under the ISC license.
282
282
  * See the LICENSE file in the root directory of this source tree.
283
- */const lr=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"}]]);/**
283
+ */const dr=U("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
284
  * @license lucide-react v0.468.0 - ISC
285
285
  *
286
286
  * This source code is licensed under the ISC license.
287
287
  * See the LICENSE file in the root directory of this source tree.
288
- */const Fm=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"}]]);/**
288
+ */const Wm=U("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
289
  * @license lucide-react v0.468.0 - ISC
290
290
  *
291
291
  * This source code is licensed under the ISC license.
292
292
  * See the LICENSE file in the root directory of this source tree.
293
- */const zm=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"}]]);/**
293
+ */const qm=U("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
294
  * @license lucide-react v0.468.0 - ISC
295
295
  *
296
296
  * This source code is licensed under the ISC license.
297
297
  * See the LICENSE file in the root directory of this source tree.
298
- */const Wm=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"}]]);/**
298
+ */const Bm=U("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
299
  * @license lucide-react v0.468.0 - ISC
300
300
  *
301
301
  * This source code is licensed under the ISC license.
302
302
  * See the LICENSE file in the root directory of this source tree.
303
- */const En=H("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
303
+ */const En=U("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
304
304
  * @license lucide-react v0.468.0 - ISC
305
305
  *
306
306
  * This source code is licensed under the ISC license.
307
307
  * See the LICENSE file in the root directory of this source tree.
308
- */const qm=H("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
308
+ */const Ym=U("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
309
309
  * @license lucide-react v0.468.0 - ISC
310
310
  *
311
311
  * This source code is licensed under the ISC license.
312
312
  * See the LICENSE file in the root directory of this source tree.
313
- */const Bm=H("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
313
+ */const Lm=U("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
314
314
  * @license lucide-react v0.468.0 - ISC
315
315
  *
316
316
  * This source code is licensed under the ISC license.
317
317
  * See the LICENSE file in the root directory of this source tree.
318
- */const Ym=H("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
318
+ */const Um=U("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
319
319
  * @license lucide-react v0.468.0 - ISC
320
320
  *
321
321
  * This source code is licensed under the ISC license.
322
322
  * See the LICENSE file in the root directory of this source tree.
323
- */const ja=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"}]]);/**
323
+ */const wa=U("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
324
  * @license lucide-react v0.468.0 - ISC
325
325
  *
326
326
  * This source code is licensed under the ISC license.
327
327
  * See the LICENSE file in the root directory of this source tree.
328
- */const dr=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"}]]);/**
328
+ */const cr=U("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
329
  * @license lucide-react v0.468.0 - ISC
330
330
  *
331
331
  * This source code is licensed under the ISC license.
332
332
  * See the LICENSE file in the root directory of this source tree.
333
- */const cr=H("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
333
+ */const ur=U("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
334
334
  * @license lucide-react v0.468.0 - ISC
335
335
  *
336
336
  * This source code is licensed under the ISC license.
337
337
  * See the LICENSE file in the root directory of this source tree.
338
- */const Ie=H("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
338
+ */const Ie=U("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
339
339
  * @license lucide-react v0.468.0 - ISC
340
340
  *
341
341
  * This source code is licensed under the ISC license.
342
342
  * See the LICENSE file in the root directory of this source tree.
343
- */const Lm=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"}]]);/**
343
+ */const Hm=U("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
344
  * @license lucide-react v0.468.0 - ISC
345
345
  *
346
346
  * This source code is licensed under the ISC license.
347
347
  * See the LICENSE file in the root directory of this source tree.
348
- */const Hm=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"}]]);/**
348
+ */const Km=U("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
349
  * @license lucide-react v0.468.0 - ISC
350
350
  *
351
351
  * This source code is licensed under the ISC license.
352
352
  * See the LICENSE file in the root directory of this source tree.
353
- */const ur=H("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
353
+ */const mr=U("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
354
354
  * @license lucide-react v0.468.0 - ISC
355
355
  *
356
356
  * This source code is licensed under the ISC license.
357
357
  * See the LICENSE file in the root directory of this source tree.
358
- */const Um=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"}]]);/**
358
+ */const Vm=U("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
359
  * @license lucide-react v0.468.0 - ISC
360
360
  *
361
361
  * This source code is licensed under the ISC license.
362
362
  * See the LICENSE file in the root directory of this source tree.
363
- */const wa=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"}]]);/**
363
+ */const Na=U("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
364
  * @license lucide-react v0.468.0 - ISC
365
365
  *
366
366
  * This source code is licensed under the ISC license.
367
367
  * See the LICENSE file in the root directory of this source tree.
368
- */const Na=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"}]]);/**
368
+ */const ka=U("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
369
  * @license lucide-react v0.468.0 - ISC
370
370
  *
371
371
  * This source code is licensed under the ISC license.
372
372
  * See the LICENSE file in the root directory of this source tree.
373
- */const Zr=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"}]]);/**
373
+ */const ea=U("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
374
  * @license lucide-react v0.468.0 - ISC
375
375
  *
376
376
  * This source code is licensed under the ISC license.
377
377
  * See the LICENSE file in the root directory of this source tree.
378
- */const pl=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"}]]);/**
378
+ */const gl=U("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
379
  * @license lucide-react v0.468.0 - ISC
380
380
  *
381
381
  * This source code is licensed under the ISC license.
382
382
  * See the LICENSE file in the root directory of this source tree.
383
- */const gl=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"}]]);/**
383
+ */const bl=U("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
384
  * @license lucide-react v0.468.0 - ISC
385
385
  *
386
386
  * This source code is licensed under the ISC license.
387
387
  * See the LICENSE file in the root directory of this source tree.
388
- */const Km=H("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
388
+ */const Gm=U("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
389
389
  * @license lucide-react v0.468.0 - ISC
390
390
  *
391
391
  * This source code is licensed under the ISC license.
392
392
  * See the LICENSE file in the root directory of this source tree.
393
- */const bl=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"}]]);/**
393
+ */const yl=U("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
394
  * @license lucide-react v0.468.0 - ISC
395
395
  *
396
396
  * This source code is licensed under the ISC license.
397
397
  * See the LICENSE file in the root directory of this source tree.
398
- */const Vm=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"}]]);/**
398
+ */const Qm=U("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
399
  * @license lucide-react v0.468.0 - ISC
400
400
  *
401
401
  * This source code is licensed under the ISC license.
402
402
  * See the LICENSE file in the root directory of this source tree.
403
- */const Gm=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"}]]);/**
403
+ */const Xm=U("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
404
  * @license lucide-react v0.468.0 - ISC
405
405
  *
406
406
  * This source code is licensed under the ISC license.
407
407
  * See the LICENSE file in the root directory of this source tree.
408
- */const Qm=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"}]]);/**
408
+ */const Jm=U("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
409
  * @license lucide-react v0.468.0 - ISC
410
410
  *
411
411
  * This source code is licensed under the ISC license.
412
412
  * See the LICENSE file in the root directory of this source tree.
413
- */const Xm=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"}]]);/**
413
+ */const Zm=U("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
414
  * @license lucide-react v0.468.0 - ISC
415
415
  *
416
416
  * This source code is licensed under the ISC license.
417
417
  * See the LICENSE file in the root directory of this source tree.
418
- */const Tt=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"}]]);/**
418
+ */const Tt=U("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
419
  * @license lucide-react v0.468.0 - ISC
420
420
  *
421
421
  * This source code is licensed under the ISC license.
422
422
  * See the LICENSE file in the root directory of this source tree.
423
- */const Jm=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"}]]);/**
423
+ */const ef=U("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
424
  * @license lucide-react v0.468.0 - ISC
425
425
  *
426
426
  * This source code is licensed under the ISC license.
427
427
  * See the LICENSE file in the root directory of this source tree.
428
- */const Zm=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"}]]);/**
428
+ */const tf=U("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
429
  * @license lucide-react v0.468.0 - ISC
430
430
  *
431
431
  * This source code is licensed under the ISC license.
432
432
  * See the LICENSE file in the root directory of this source tree.
433
- */const ef=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"}]]);/**
433
+ */const sf=U("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
434
  * @license lucide-react v0.468.0 - ISC
435
435
  *
436
436
  * This source code is licensed under the ISC license.
437
437
  * See the LICENSE file in the root directory of this source tree.
438
- */const tf=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"}]]);/**
438
+ */const nf=U("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
439
  * @license lucide-react v0.468.0 - ISC
440
440
  *
441
441
  * This source code is licensed under the ISC license.
442
442
  * See the LICENSE file in the root directory of this source tree.
443
- */const On=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"}]]);/**
443
+ */const On=U("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
444
  * @license lucide-react v0.468.0 - ISC
445
445
  *
446
446
  * This source code is licensed under the ISC license.
447
447
  * See the LICENSE file in the root directory of this source tree.
448
- */const yl=H("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
448
+ */const vl=U("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
449
449
  * @license lucide-react v0.468.0 - ISC
450
450
  *
451
451
  * This source code is licensed under the ISC license.
452
452
  * See the LICENSE file in the root directory of this source tree.
453
- */const xs=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"}]]);/**
453
+ */const xs=U("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
454
  * @license lucide-react v0.468.0 - ISC
455
455
  *
456
456
  * This source code is licensed under the ISC license.
457
457
  * See the LICENSE file in the root directory of this source tree.
458
- */const sf=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"}]]);/**
458
+ */const rf=U("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
459
  * @license lucide-react v0.468.0 - ISC
460
460
  *
461
461
  * This source code is licensed under the ISC license.
462
462
  * See the LICENSE file in the root directory of this source tree.
463
- */const Fe=H("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
463
+ */const Fe=U("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
464
464
  * @license lucide-react v0.468.0 - ISC
465
465
  *
466
466
  * This source code is licensed under the ISC license.
467
467
  * See the LICENSE file in the root directory of this source tree.
468
- */const Xs=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 nf({issue:e}){const s=ar(e.id,e.project_id),[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(!1),d=e.metadata??{},c=Object.entries(d),u=()=>{if(!n.trim())return;const m={...d,[n.trim()]:a};s.mutate({metadata:m},{onSuccess:()=>{R.success("Metadata saved"),r(""),o(""),l(!1)},onError:()=>R.error("Failed to save metadata")})},f=m=>{const h={...d};delete h[m],s.mutate({metadata:Object.keys(h).length?h:null},{onSuccess:()=>R.success("Entry removed"),onError:()=>R.error("Failed to update metadata")})};return t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Mm,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!i&&t.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Add field"]})]}),t.jsxs("div",{className:"px-5 py-3 space-y-2",children:[c.length===0&&!i&&t.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),c.map(([m,h])=>t.jsxs("div",{className:"flex items-center gap-2 group",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:m}),t.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(h)}),t.jsx("button",{onClick:()=>f(m),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:t.jsx(Tt,{className:"h-3 w-3"})})]},m)),i&&t.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[t.jsx(xe,{autoFocus:!0,placeholder:"key",value:n,onChange:m=>r(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs font-mono w-28 shrink-0"}),t.jsx(xe,{placeholder:"value",value:a,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),t.jsx(K,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!n.trim()||s.isPending,children:"Save"}),t.jsx(K,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),r(""),o("")},children:"Cancel"})]})]})]})}const rf=[{zone:"issue.details.after",component:nf}];function mr(e=!0){return Ne({queryKey:["workspaces"],queryFn:()=>J.get("/admin/workspaces"),select:s=>s.workspaces,enabled:e})}function af(){const e=me();return ce({mutationFn:s=>J.post("/admin/workspaces",s),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function of(e){const s=me();return ce({mutationFn:n=>J.put(`/admin/workspaces/${e}`,n),onSuccess:()=>{s.invalidateQueries({queryKey:["workspaces"]})}})}const ka={list:e=>["workspaces",e,"invitations"]};function lf(e){return Ne({queryKey:ka.list(e),queryFn:()=>J.get(`/admin/workspaces/${e}/invitations`),select:s=>s.invitations,enabled:!!e})}function df(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/workspaces/${e}/invitations`,n),onSuccess:()=>{s.invalidateQueries({queryKey:ka.list(e)})}})}function cf(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/workspaces/${e}/invitations/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:ka.list(e)})}})}const Sa={list:e=>["workspaces",e,"members"]};function fr(e){return Ne({queryKey:Sa.list(e),queryFn:()=>J.get(`/admin/workspaces/${e}/members`),select:s=>s.members,enabled:!!e})}function uf(e){const s=me();return ce({mutationFn:({userId:n,role:r})=>J.patch(`/admin/workspaces/${e}/members/${n}`,{role:r}),onSuccess:()=>{s.invalidateQueries({queryKey:Sa.list(e)})}})}function mf(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/workspaces/${e}/members/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Sa.list(e)})}})}const Ut={list:e=>["workspaces",e,"teams"],members:(e,s)=>["workspaces",e,"teams",s,"members"]};function Ca(e){return Ne({queryKey:Ut.list(e),queryFn:()=>J.get(`/admin/workspaces/${e}/teams`),select:s=>s.teams,enabled:!!e})}function ff(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/workspaces/${e}/teams`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ut.list(e)})}})}function hf(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/workspaces/${e}/teams/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ut.list(e)})}})}function xf(e,s){return Ne({queryKey:Ut.members(e,s),queryFn:()=>J.get(`/admin/workspaces/${e}/teams/${s}/members`),select:n=>n.members,enabled:!!(e&&s)})}function pf(e,s){const n=me();return ce({mutationFn:r=>J.post(`/admin/workspaces/${e}/teams/${s}/members`,{user_id:r}),onSuccess:()=>{n.invalidateQueries({queryKey:Ut.members(e,s)}),n.invalidateQueries({queryKey:Ut.list(e)})}})}function gf(e,s){const n=me();return ce({mutationFn:r=>J.delete(`/admin/workspaces/${e}/teams/${s}/members/${r}`),onSuccess:()=>{n.invalidateQueries({queryKey:Ut.members(e,s)}),n.invalidateQueries({queryKey:Ut.list(e)})}})}function vl(){return Ne({queryKey:["setup-status"],queryFn:()=>J.get("/auth/setup"),staleTime:6e4,retry:!1})}function bf(){const{login:e}=ke();return ce({mutationFn:s=>J.post("/auth/login",s),onSuccess:s=>{e(s.user,s.token)}})}function yf(){const{login:e}=ke();return ce({mutationFn:s=>J.post("/auth/register",s),onSuccess:s=>{e(s.user,s.token)}})}function vf(e){const{login:s}=ke();return ce({mutationFn:n=>J.post(`/auth/invite/${e}`,n),onSuccess:n=>{s(n.user,n.token)}})}var Jo;const jf=((Jo=window.__MERIDIAN_CONFIG__)==null?void 0:Jo.apiUrl)??void 0??"";function wf(e,s){const n=`${jf}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(s)}`;return new EventSource(n)}function Nf(){const{token:e,workspace:s}=ke(),n=me(),r=x.useRef(null);x.useEffect(()=>{if(!e||!s)return;const a=wf(e,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}},[e,s==null?void 0:s.id,n])}const Dr=768;function kf(){const[e,s]=x.useState(void 0);return x.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Dr-1}px)`),r=()=>{s(window.innerWidth<Dr)};return n.addEventListener("change",r),s(window.innerWidth<Dr),()=>n.removeEventListener("change",r)},[]),!!e}const Ma=x.forwardRef(({className:e,orientation:s="horizontal",decorative:n=!0,...r},a)=>t.jsx(si,{ref:a,decorative:n,orientation:s,className:O("shrink-0 bg-border",s==="horizontal"?"h-px w-full":"h-full w-px",e),...r}));Ma.displayName=si.displayName;const Sf=Sn,Cf=kn,jl=x.forwardRef(({className:e,...s},n)=>t.jsx(ys,{className:O("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",e),...s,ref:n}));jl.displayName=ys.displayName;const Mf=Mn("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"}}),wl=x.forwardRef(({side:e="right",className:s,children:n,...r},a)=>t.jsxs(Cf,{children:[t.jsx(jl,{}),t.jsxs(vs,{ref:a,className:O(Mf({side:e}),s),...r,children:[n,t.jsxs(rr,{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:[t.jsx(Fe,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));wl.displayName=vs.displayName;const Nl=({className:e,...s})=>t.jsx("div",{className:O("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...s});Nl.displayName="SheetHeader";const kl=x.forwardRef(({className:e,...s},n)=>t.jsx(Hs,{ref:n,className:O("text-base font-semibold text-foreground",e),...s}));kl.displayName=Hs.displayName;const Sl=x.forwardRef(({className:e,...s},n)=>t.jsx(Us,{ref:n,className:O("text-sm text-muted-foreground",e),...s}));Sl.displayName=Us.displayName;function te({className:e,...s}){return t.jsx("div",{className:O("animate-pulse rounded-md bg-muted",e),...s})}const Df="sidebar_state",_f=60*60*24*7,Ef="16rem",Of="18rem",Tf="3rem",Pf="b",Cl=x.createContext(null);function Da(){const e=x.useContext(Cl);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Af({defaultOpen:e=!0,open:s,onOpenChange:n,className:r,style:a,children:o,...i}){const l=kf(),[d,c]=x.useState(!1),[u,f]=x.useState(e),m=s??u,h=x.useCallback(b=>{const N=typeof b=="function"?b(m):b;n?n(N):f(N),document.cookie=`${Df}=${N}; path=/; max-age=${_f}`},[n,m]),g=x.useCallback(()=>l?c(b=>!b):h(b=>!b),[l,h,c]);x.useEffect(()=>{const b=N=>{N.key===Pf&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),g())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[g]);const y=m?"expanded":"collapsed",S=x.useMemo(()=>({state:y,open:m,setOpen:h,isMobile:l,openMobile:d,setOpenMobile:c,toggleSidebar:g}),[y,m,h,l,d,c,g]);return t.jsx(Cl.Provider,{value:S,children:t.jsx(ma,{delayDuration:0,children:t.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Ef,"--sidebar-width-icon":Tf,...a},className:O("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",r),...i,children:o})})})}function $f({side:e="left",variant:s="sidebar",collapsible:n="offcanvas",className:r,children:a,...o}){const{isMobile:i,state:l,openMobile:d,setOpenMobile:c}=Da();return n==="none"?t.jsx("div",{"data-slot":"sidebar",className:O("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",r),...o,children:a}):i?t.jsx(Sf,{open:d,onOpenChange:c,...o,children:t.jsxs(wl,{"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":Of},side:e,children:[t.jsxs(Nl,{className:"sr-only",children:[t.jsx(kl,{children:"Sidebar"}),t.jsx(Sl,{children:"Displays the mobile sidebar."})]}),t.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):t.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":s,"data-side":e,"data-slot":"sidebar",children:[t.jsx("div",{"data-slot":"sidebar-gap",className:O("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)]")}),t.jsx("div",{"data-slot":"sidebar-container",className:O("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="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:t.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 Rf({className:e,onClick:s,...n}){const{toggleSidebar:r}=Da();return t.jsxs(K,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:O("size-7",e),onClick:a=>{s==null||s(a),r()},...n,children:[t.jsx(Bm,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function If({className:e,...s}){return t.jsx("main",{"data-slot":"sidebar-inset",className:O("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",e),...s})}function Ff({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:O("flex flex-col gap-2 p-2",e),...s})}function zf({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:O("flex flex-col gap-2 p-2",e),...s})}function Wf({className:e,...s}){return t.jsx(Ma,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:O("bg-sidebar-border mx-2 w-auto",e),...s})}function qf({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:O("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...s})}function _r({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:O("relative flex w-full min-w-0 flex-col p-2",e),...s})}function Bf({className:e,asChild:s=!1,...n}){const r=s?oa:"div";return t.jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:O("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",e),...n})}function Er({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:O("w-full text-sm",e),...s})}function bn({className:e,...s}){return t.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:O("flex w-full min-w-0 flex-col gap-1",e),...s})}function Lt({className:e,...s}){return t.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:O("group/menu-item relative",e),...s})}const Yf=Mn("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"}}),Dt=x.forwardRef(function({asChild:s=!1,isActive:n=!1,variant:r="default",size:a="default",tooltip:o,className:i,...l},d){const c=s?oa:"button",{isMobile:u,state:f}=Da(),m=t.jsx(c,{ref:d,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":a,"data-active":n,className:O(Yf({variant:r,size:a}),i),...l});return o?(typeof o=="string"&&(o={children:o}),t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:m}),t.jsx(Ht,{side:"right",align:"center",hidden:f!=="collapsed"||u,...o})]})):m});Dt.displayName="SidebarMenuButton";const Lf=250,Hf=300,fs={all:["projects"],list:()=>[...fs.all,"list"],detail:e=>[...fs.all,e],byKey:e=>[...fs.all,"key",e]};function Tn(){const{workspace:e}=ke();return Ne({queryKey:[...fs.list(),e==null?void 0:e.id],queryFn:()=>{const s=e!=null&&e.id?`?workspace_id=${e.id}`:"";return J.get(`/admin/projects${s}`)},select:s=>s.projects,enabled:!!(e!=null&&e.id)})}function ws(e){return Ne({queryKey:fs.byKey(e),queryFn:()=>J.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:s=>s.project,enabled:!!e})}function Uf(e,s={}){const[n,r]=x.useState(e),a=s.enabled!==!1;return x.useEffect(()=>{if(!a)return;const l=setTimeout(()=>r(e),Lf);return()=>clearTimeout(l)},[e,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(e)}}function Kf(e,s={}){const n=e.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),Hf);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 Vf(){const e=me();return ce({mutationFn:s=>J.post("/admin/projects",s),onSuccess:()=>{e.invalidateQueries({queryKey:fs.list()})}})}function Gf(){const e=me();return ce({mutationFn:s=>J.delete(`/admin/projects/${s}`),onSuccess:()=>{e.invalidateQueries({queryKey:fs.list()})}})}const Ns=vc,ks=jc,Qf=x.forwardRef(({className:e,inset:s,children:n,...r},a)=>t.jsxs(ni,{ref:a,className:O("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",e),...r,children:[n,t.jsx(Gs,{className:"ml-auto"})]}));Qf.displayName=ni.displayName;const Xf=x.forwardRef(({className:e,...s},n)=>t.jsx(ri,{ref:n,className:O("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",e),...s}));Xf.displayName=ri.displayName;const Xt=x.forwardRef(({className:e,sideOffset:s=4,...n},r)=>t.jsx(yc,{children:t.jsx(ai,{ref:r,sideOffset:s,className:O("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",e),...n})}));Xt.displayName=ai.displayName;const Je=x.forwardRef(({className:e,inset:s,...n},r)=>t.jsx(oi,{ref:r,className:O("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",e),...n}));Je.displayName=oi.displayName;const Jf=x.forwardRef(({className:e,children:s,checked:n,...r},a)=>t.jsxs(ii,{ref:a,className:O("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",e),checked:n,...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(li,{children:t.jsx(mt,{className:"h-4 w-4"})})}),s]}));Jf.displayName=ii.displayName;const Zf=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(di,{ref:r,className:O("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",e),...n,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(li,{children:t.jsx(Nt,{className:"h-2 w-2 fill-current"})})}),s]}));Zf.displayName=di.displayName;const _a=x.forwardRef(({className:e,inset:s,...n},r)=>t.jsx(ci,{ref:r,className:O("px-2 py-1.5 text-xs font-medium text-muted-foreground",s&&"pl-8",e),...n}));_a.displayName=ci.displayName;const Pn=x.forwardRef(({className:e,...s},n)=>t.jsx(ui,{ref:n,className:O("-mx-1 my-1 h-px bg-border",e),...s}));Pn.displayName=ui.displayName;const at=x.forwardRef(({className:e,...s},n)=>t.jsx(mi,{ref:n,className:O("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...s}));at.displayName=mi.displayName;const eh=x.forwardRef(({className:e,...s},n)=>t.jsx(fi,{ref:n,className:O("aspect-square h-full w-full",e),...s}));eh.displayName=fi.displayName;const ot=x.forwardRef(({className:e,...s},n)=>t.jsx(hi,{ref:n,className:O("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...s}));ot.displayName=hi.displayName;function th(){var a;const{workspace:e,setWorkspace:s}=ke(),{data:n}=mr(),r=Ue();return t.jsx(bn,{children:t.jsx(Lt,{children:t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsxs(Dt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:t.jsx("span",{className:"text-[13px] font-bold",children:(((a=e==null?void 0:e.name)==null?void 0:a[0])??"M").toUpperCase()})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),t.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),t.jsx(al,{className:"ml-auto size-4 shrink-0"})]})}),t.jsxs(Xt,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[t.jsx(_a,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),n==null?void 0:n.map(o=>t.jsxs(Je,{className:"cursor-pointer gap-2 p-2",onClick:()=>{s({id:o.id,name:o.name,slug:o.slug}),r(`/${o.slug}/projects`)},children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:t.jsx("span",{className:"text-[10px] font-bold",children:o.name[0].toUpperCase()})}),t.jsx("span",{className:"flex-1 truncate",children:o.name}),o.id===(e==null?void 0:e.id)&&t.jsx(mt,{className:"size-3.5 text-muted-foreground shrink-0"})]},o.id)),t.jsx(Pn,{}),t.jsxs(Je,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>r("/setup"),children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:t.jsx("span",{className:"text-xs font-semibold",children:"+"})}),t.jsx("span",{children:"Create workspace"})]})]})]})})})}function sh(){var a,o;const{user:e,logout:s}=ke(),n=e?`${((a=e.first_name)==null?void 0:a[0])??""}${((o=e.last_name)==null?void 0:o[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",r=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return t.jsx(bn,{children:t.jsx(Lt,{children:t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsxs(Dt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsx(at,{className:"h-8 w-8 rounded-lg shrink-0",children:t.jsx(ot,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:r}),t.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),t.jsx(al,{className:"ml-auto size-4 shrink-0"})]})}),t.jsxs(Xt,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[t.jsx(_a,{className:"p-0 font-normal",children:t.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[t.jsx(at,{className:"h-8 w-8 rounded-lg",children:t.jsx(ot,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:r}),t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),t.jsx(Pn,{}),t.jsxs(Je,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:s,children:[t.jsx(Fm,{className:"size-4"}),"Sign out"]})]})]})})})}function nh({...e}){var h;const{workspace:s,projectKey:n}=Ge(),{data:r}=Tn(),{toggle:a}=Bi(),{user:o}=ke(),i=nr(),l=s??"",d=i.pathname===`/${l}/projects`,c=i.pathname.includes("/notifications"),u=i.pathname.includes("/settings"),f=i.pathname.includes("/roles"),m=((h=o==null?void 0:o.roles)==null?void 0:h.includes("super-admin"))??!1;return t.jsxs($f,{collapsible:"offcanvas",...e,children:[t.jsx(Ff,{children:t.jsx(th,{})}),t.jsxs(qf,{children:[t.jsx(_r,{children:t.jsx(Er,{children:t.jsxs(bn,{children:[t.jsx(Lt,{children:t.jsxs(Dt,{onClick:a,tooltip:"Search",children:[t.jsx(ur,{}),t.jsx("span",{children:"Search"}),t.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:d,tooltip:"Projects",children:t.jsxs(Ts,{to:`/${l}/projects`,end:!0,children:[t.jsx(xt,{}),t.jsx("span",{children:"Projects"})]})})}),t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:c,tooltip:"Notifications",children:t.jsxs(Ts,{to:`/${l}/notifications`,children:[t.jsx(qs,{}),t.jsx("span",{children:"Notifications"})]})})})]})})}),r&&r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Wf,{}),t.jsxs(_r,{children:[t.jsx(Bf,{children:"Recent"}),t.jsx(Er,{children:t.jsx(bn,{children:r.slice(0,5).map(g=>t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:g.identifier===n,tooltip:g.name,children:t.jsxs(Ts,{to:`/${l}/projects/${g.identifier}/board`,children:[t.jsx("span",{className:"font-mono text-[11px] text-sidebar-foreground/50 shrink-0",children:g.identifier}),t.jsx("span",{className:"truncate",children:g.name})]})})},g.id))})})]})]}),t.jsx(_r,{className:"mt-auto",children:t.jsx(Er,{children:t.jsxs(bn,{children:[m&&t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:f,tooltip:"Roles & Permissions",children:t.jsxs(Ts,{to:`/${l}/roles`,children:[t.jsx(Zr,{}),t.jsx("span",{children:"Roles"})]})})}),t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:u,tooltip:"Settings",children:t.jsxs(Ts,{to:`/${l}/settings`,children:[t.jsx(wa,{}),t.jsx("span",{children:"Settings"})]})})})]})})})]}),t.jsx(zf,{children:t.jsx(sh,{})})]})}function rh(){const{theme:e,setTheme:s}=Mu();return t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsxs(K,{variant:"ghost",size:"icon-sm",onClick:()=>s(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[t.jsx(Vm,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),t.jsx(qm,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),t.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),t.jsx(Ht,{children:"Toggle theme"})]})}const An={all:["notifications"],list:()=>[...An.all,"list"]};function ah(){return Ne({queryKey:An.list(),queryFn:()=>J.get("/admin/notifications"),select:e=>e.notifications})}function oh(){return Ne({queryKey:[...An.list(),"unread"],queryFn:()=>J.get("/admin/notifications?unread=true"),select:e=>e.count})}function ih(){const e=me();return ce({mutationFn:s=>J.post(`/admin/notifications/${s}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:An.all})}})}function lh(){const e=me();return ce({mutationFn:()=>J.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:An.all})}})}function dh(){const e=nr(),{projectKey:s}=Ge(),{data:n}=Tn(),r=n==null?void 0:n.find(o=>o.identifier===s),a=e.pathname;return a.includes("/board")?{icon:xt,label:r?`${r.name} / Board`:"Board"}:a.includes("/issues")?{icon:Qs,label:r?`${r.name} / Issues`:"Issues"}:a.endsWith("/projects")?{icon:er,label:"Projects"}:a.includes("/notifications")?{icon:qs,label:"Notifications"}:a.includes("/settings")?{icon:wa,label:"Settings"}:{icon:er,label:"Meridian"}}function ch(){const{data:e=0}=oh(),{icon:s,label:n}=dh(),{workspace:r}=ke(),a=(r==null?void 0:r.slug)??"";return t.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:t.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[t.jsx(Rf,{className:"-ml-1"}),t.jsx(Ma,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx(s,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),t.jsx("span",{className:"font-medium",children:n})]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx(rh,{}),t.jsx(K,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:t.jsxs(yn,{to:`/${a}/notifications`,children:[t.jsx(qs,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&t.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:e>9?"9+":e})]})})]})]})})}function uh(){return t.jsxs(Af,{children:[t.jsx(nh,{variant:"inset"}),t.jsxs(If,{className:"flex flex-col min-w-0",children:[t.jsx(ch,{}),t.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:t.jsx(Zo,{})})]})]})}const vo=["board","issues","sprints","timeline","access"];function mh(){const{projectKey:e,workspace:s}=Ge(),{data:n}=ws(e??""),r=Ue(),a=nr(),[o]=ei();x.useEffect(()=>{const d=o.get("tab");if(!d||!vo.includes(d))return;vo.every(u=>!a.pathname.endsWith(`/${u}`))&&r(`/${s}/projects/${e}/${d}`,{replace:!0})},[]);const i=`/${s}/projects/${e}`,l=[{to:`${i}/board`,label:"Board",icon:er,end:!0},{to:`${i}/issues`,label:"Issues",icon:Qs,end:!1},{to:`${i}/sprints`,label:"Sprints",icon:Xs,end:!0},{to:`${i}/timeline`,label:"Timeline",icon:ha,end:!0},{to:`${i}/access`,label:"Access",icon:lr,end:!0}];return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"px-6 pt-5 border-b border-border bg-white dark:bg-card shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[n&&t.jsx("span",{className:"text-xs font-mono text-muted-foreground bg-muted border border-border px-2 py-0.5 rounded",children:n.identifier}),t.jsx("h1",{className:"text-sm font-semibold",children:(n==null?void 0:n.name)??""})]}),t.jsx("div",{className:"flex -mb-px",children:l.map(({to:d,label:c,icon:u,end:f})=>t.jsxs(Ts,{to:d,end:f,className:({isActive:m})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${m?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[t.jsx(u,{className:"h-3.5 w-3.5",strokeWidth:1.5}),c]},d))})]}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:t.jsx(Zo,{})})]})}var jo=1,fh=.9,hh=.8,xh=.17,Or=.1,Tr=.999,ph=.9999,gh=.99,bh=/[\\\/_+.#"@\[\(\{&]/,yh=/[\\\/_+.#"@\[\(\{&]/g,vh=/[\s-]/,Ml=/[\s-]/g;function ea(e,s,n,r,a,o,i){if(o===s.length)return a===e.length?jo:gh;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,f,m,h,g;c>=0;)f=ea(e,s,n,r,c+1,o+1,i),f>u&&(c===a?f*=jo:bh.test(e.charAt(c-1))?(f*=hh,h=e.slice(a,c-1).match(yh),h&&a>0&&(f*=Math.pow(Tr,h.length))):vh.test(e.charAt(c-1))?(f*=fh,g=e.slice(a,c-1).match(Ml),g&&a>0&&(f*=Math.pow(Tr,g.length))):(f*=xh,a>0&&(f*=Math.pow(Tr,c-a))),e.charAt(c)!==s.charAt(o)&&(f*=ph)),(f<Or&&n.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(c-1)!==r.charAt(o))&&(m=ea(e,s,n,r,c+1,o+2,i),m*Or>f&&(f=m*Or)),f>u&&(u=f),c=n.indexOf(d,c+1);return i[l]=u,u}function wo(e){return e.toLowerCase().replace(Ml," ")}function jh(e,s,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ea(e,s,wo(e),wo(s),0,0,{})}var mn='[cmdk-group=""]',Pr='[cmdk-group-items=""]',wh='[cmdk-group-heading=""]',Ea='[cmdk-item=""]',No=`${Ea}:not([aria-disabled="true"])`,ta="cmdk-item-select",ls="data-value",Nh=(e,s,n)=>jh(e,s,n),Dl=x.createContext(void 0),$n=()=>x.useContext(Dl),_l=x.createContext(void 0),Oa=()=>x.useContext(_l),El=x.createContext(void 0),Ol=x.forwardRef((e,s)=>{let n=Ps(()=>{var k,M;return{search:"",value:(M=(k=e.value)!=null?k:e.defaultValue)!=null?M:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=Ps(()=>new Set),a=Ps(()=>new Map),o=Ps(()=>new Map),i=Ps(()=>new Set),l=Tl(e),{label:d,children:c,value:u,onValueChange:f,filter:m,shouldFilter:h,loop:g,disablePointerSelection:y=!1,vimBindings:S=!0,...b}=e,N=$s(),w=$s(),j=$s(),E=x.useRef(null),p=Ah();ps(()=>{if(u!==void 0){let k=u.trim();n.current.value=k,C.emit()}},[u]),ps(()=>{p(6,F)},[]);let C=x.useMemo(()=>({subscribe:k=>(i.current.add(k),()=>i.current.delete(k)),snapshot:()=>n.current,setState:(k,M,Y)=>{var L,ae,P;if(!Object.is(n.current[k],M)){if(n.current[k]=M,k==="search")$(),_(),p(1,I);else if(k==="value"&&(Y||p(5,F),((L=l.current)==null?void 0:L.value)!==void 0)){let ie=M??"";(P=(ae=l.current).onValueChange)==null||P.call(ae,ie);return}C.emit()}},emit:()=>{i.current.forEach(k=>k())}}),[]),A=x.useMemo(()=>({value:(k,M,Y)=>{var L;M!==((L=o.current.get(k))==null?void 0:L.value)&&(o.current.set(k,{value:M,keywords:Y}),n.current.filtered.items.set(k,D(M,Y)),p(2,()=>{_(),C.emit()}))},item:(k,M)=>(r.current.add(k),M&&(a.current.has(M)?a.current.get(M).add(k):a.current.set(M,new Set([k]))),p(3,()=>{$(),_(),n.current.value||I(),C.emit()}),()=>{o.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let Y=T();p(4,()=>{$(),(Y==null?void 0:Y.getAttribute("id"))===k&&I(),C.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||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:j,labelId:w,listInnerRef:E}),[]);function D(k,M){var Y,L;let ae=(L=(Y=l.current)==null?void 0:Y.filter)!=null?L:Nh;return k?ae(k,n.current.search,M):0}function _(){if(!n.current.search||l.current.shouldFilter===!1)return;let k=n.current.filtered.items,M=[];n.current.filtered.groups.forEach(L=>{let ae=a.current.get(L),P=0;ae.forEach(ie=>{let ge=k.get(ie);P=Math.max(ge,P)}),M.push([L,P])});let Y=E.current;X().sort((L,ae)=>{var P,ie;let ge=L.getAttribute("id"),Te=ae.getAttribute("id");return((P=k.get(Te))!=null?P:0)-((ie=k.get(ge))!=null?ie:0)}).forEach(L=>{let ae=L.closest(Pr);ae?ae.appendChild(L.parentElement===ae?L:L.closest(`${Pr} > *`)):Y.appendChild(L.parentElement===Y?L:L.closest(`${Pr} > *`))}),M.sort((L,ae)=>ae[1]-L[1]).forEach(L=>{var ae;let P=(ae=E.current)==null?void 0:ae.querySelector(`${mn}[${ls}="${encodeURIComponent(L[0])}"]`);P==null||P.parentElement.appendChild(P)})}function I(){let k=X().find(Y=>Y.getAttribute("aria-disabled")!=="true"),M=k==null?void 0:k.getAttribute(ls);C.setState("value",M||void 0)}function $(){var k,M,Y,L;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ae=0;for(let P of r.current){let ie=(M=(k=o.current.get(P))==null?void 0:k.value)!=null?M:"",ge=(L=(Y=o.current.get(P))==null?void 0:Y.keywords)!=null?L:[],Te=D(ie,ge);n.current.filtered.items.set(P,Te),Te>0&&ae++}for(let[P,ie]of a.current)for(let ge of ie)if(n.current.filtered.items.get(ge)>0){n.current.filtered.groups.add(P);break}n.current.filtered.count=ae}function F(){var k,M,Y;let L=T();L&&(((k=L.parentElement)==null?void 0:k.firstChild)===L&&((Y=(M=L.closest(mn))==null?void 0:M.querySelector(wh))==null||Y.scrollIntoView({block:"nearest"})),L.scrollIntoView({block:"nearest"}))}function T(){var k;return(k=E.current)==null?void 0:k.querySelector(`${Ea}[aria-selected="true"]`)}function X(){var k;return Array.from(((k=E.current)==null?void 0:k.querySelectorAll(No))||[])}function q(k){let M=X()[k];M&&C.setState("value",M.getAttribute(ls))}function V(k){var M;let Y=T(),L=X(),ae=L.findIndex(ie=>ie===Y),P=L[ae+k];(M=l.current)!=null&&M.loop&&(P=ae+k<0?L[L.length-1]:ae+k===L.length?L[0]:L[ae+k]),P&&C.setState("value",P.getAttribute(ls))}function W(k){let M=T(),Y=M==null?void 0:M.closest(mn),L;for(;Y&&!L;)Y=k>0?Th(Y,mn):Ph(Y,mn),L=Y==null?void 0:Y.querySelector(No);L?C.setState("value",L.getAttribute(ls)):V(k)}let z=()=>q(X().length-1),Q=k=>{k.preventDefault(),k.metaKey?z():k.altKey?W(1):V(1)},ee=k=>{k.preventDefault(),k.metaKey?q(0):k.altKey?W(-1):V(-1)};return x.createElement(Gt.div,{ref:s,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:k=>{var M;if((M=b.onKeyDown)==null||M.call(b,k),!k.defaultPrevented)switch(k.key){case"n":case"j":{S&&k.ctrlKey&&Q(k);break}case"ArrowDown":{Q(k);break}case"p":case"k":{S&&k.ctrlKey&&ee(k);break}case"ArrowUp":{ee(k);break}case"Home":{k.preventDefault(),q(0);break}case"End":{k.preventDefault(),z();break}case"Enter":if(!k.nativeEvent.isComposing&&k.keyCode!==229){k.preventDefault();let Y=T();if(Y){let L=new Event(ta);Y.dispatchEvent(L)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:A.inputId,id:A.labelId,style:Rh},d),hr(e,k=>x.createElement(_l.Provider,{value:C},x.createElement(Dl.Provider,{value:A},k))))}),kh=x.forwardRef((e,s)=>{var n,r;let a=$s(),o=x.useRef(null),i=x.useContext(El),l=$n(),d=Tl(e),c=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;ps(()=>{if(!c)return l.item(a,i==null?void 0:i.id)},[c]);let u=Pl(a,o,[e.value,e.children,o],e.keywords),f=Oa(),m=gs(p=>p.value&&p.value===u.current),h=gs(p=>c||l.filter()===!1?!0:p.search?p.filtered.items.get(a)>0:!0);x.useEffect(()=>{let p=o.current;if(!(!p||e.disabled))return p.addEventListener(ta,g),()=>p.removeEventListener(ta,g)},[h,e.onSelect,e.disabled]);function g(){var p,C;y(),(C=(p=d.current).onSelect)==null||C.call(p,u.current)}function y(){f.setState("value",u.current,!0)}if(!h)return null;let{disabled:S,value:b,onSelect:N,forceMount:w,keywords:j,...E}=e;return x.createElement(Gt.div,{ref:vn([o,s]),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!m,"data-disabled":!!S,"data-selected":!!m,onPointerMove:S||l.getDisablePointerSelection()?void 0:y,onClick:S?void 0:g},e.children)}),Sh=x.forwardRef((e,s)=>{let{heading:n,children:r,forceMount:a,...o}=e,i=$s(),l=x.useRef(null),d=x.useRef(null),c=$s(),u=$n(),f=gs(h=>a||u.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);ps(()=>u.group(i),[]),Pl(i,l,[e.value,e.heading,d]);let m=x.useMemo(()=>({id:i,forceMount:a}),[a]);return x.createElement(Gt.div,{ref:vn([l,s]),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&x.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),hr(e,h=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},x.createElement(El.Provider,{value:m},h))))}),Ch=x.forwardRef((e,s)=>{let{alwaysRender:n,...r}=e,a=x.useRef(null),o=gs(i=>!i.search);return!n&&!o?null:x.createElement(Gt.div,{ref:vn([a,s]),...r,"cmdk-separator":"",role:"separator"})}),Mh=x.forwardRef((e,s)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=Oa(),i=gs(u=>u.search),l=gs(u=>u.value),d=$n(),c=x.useMemo(()=>{var u;let f=(u=d.listInnerRef.current)==null?void 0:u.querySelector(`${Ea}[${ls}="${encodeURIComponent(l)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(Gt.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?e.value:i,onChange:u=>{a||o.setState("search",u.target.value),n==null||n(u.target.value)}})}),Dh=x.forwardRef((e,s)=>{let{children:n,label:r="Suggestions",...a}=e,o=x.useRef(null),i=x.useRef(null),l=$n();return x.useEffect(()=>{if(i.current&&o.current){let d=i.current,c=o.current,u,f=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let m=d.offsetHeight;c.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(d),()=>{cancelAnimationFrame(u),f.unobserve(d)}}},[]),x.createElement(Gt.div,{ref:vn([o,s]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},hr(e,d=>x.createElement("div",{ref:vn([i,l.listInnerRef]),"cmdk-list-sizer":""},d)))}),_h=x.forwardRef((e,s)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:i,...l}=e;return x.createElement(Sn,{open:n,onOpenChange:r},x.createElement(kn,{container:i},x.createElement(ys,{"cmdk-overlay":"",className:a}),x.createElement(vs,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(Ol,{ref:s,...l}))))}),Eh=x.forwardRef((e,s)=>gs(n=>n.filtered.count===0)?x.createElement(Gt.div,{ref:s,...e,"cmdk-empty":"",role:"presentation"}):null),Oh=x.forwardRef((e,s)=>{let{progress:n,children:r,label:a="Loading...",...o}=e;return x.createElement(Gt.div,{ref:s,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},hr(e,i=>x.createElement("div",{"aria-hidden":!0},i)))}),Ze=Object.assign(Ol,{List:Dh,Item:kh,Input:Mh,Group:Sh,Separator:Ch,Dialog:_h,Empty:Eh,Loading:Oh});function Th(e,s){let n=e.nextElementSibling;for(;n;){if(n.matches(s))return n;n=n.nextElementSibling}}function Ph(e,s){let n=e.previousElementSibling;for(;n;){if(n.matches(s))return n;n=n.previousElementSibling}}function Tl(e){let s=x.useRef(e);return ps(()=>{s.current=e}),s}var ps=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Ps(e){let s=x.useRef();return s.current===void 0&&(s.current=e()),s}function vn(e){return s=>{e.forEach(n=>{typeof n=="function"?n(s):n!=null&&(n.current=s)})}}function gs(e){let s=Oa(),n=()=>e(s.snapshot());return wc.useSyncExternalStore(s.subscribe,n,n)}function Pl(e,s,n,r=[]){let a=x.useRef(),o=$n();return ps(()=>{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(e,l,d),(i=s.current)==null||i.setAttribute(ls,l),a.current=l}),a}var Ah=()=>{let[e,s]=x.useState(),n=Ps(()=>new Map);return ps(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),s({})}};function $h(e){let s=e.type;return typeof s=="function"?s(e.props):"render"in s?s.render(e.props):e}function hr({asChild:e,children:s},n){return e&&x.isValidElement(s)?x.cloneElement($h(s),{ref:s.ref},n(s.props.children)):n(s)}var Rh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const xr=Sn,Ih=kn,Al=x.forwardRef(({className:e,...s},n)=>t.jsx(ys,{ref:n,className:O("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",e),...s}));Al.displayName=ys.displayName;const Rn=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(Ih,{children:[t.jsx(Al,{}),t.jsxs(vs,{ref:r,className:O("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",e),...n,children:[s,t.jsxs(rr,{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:[t.jsx(Fe,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rn.displayName=vs.displayName;const pr=({className:e,...s})=>t.jsx("div",{className:O("flex flex-col space-y-1.5",e),...s});pr.displayName="DialogHeader";const gr=x.forwardRef(({className:e,...s},n)=>t.jsx(Hs,{ref:n,className:O("text-base font-semibold leading-none tracking-tight",e),...s}));gr.displayName=Hs.displayName;const $l=x.forwardRef(({className:e,...s},n)=>t.jsx(Us,{ref:n,className:O("text-sm text-muted-foreground",e),...s}));$l.displayName=Us.displayName;const Fs=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze,{ref:n,className:O("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...s}));Fs.displayName=Ze.displayName;const Fh=({children:e,open:s,onOpenChange:n})=>t.jsx(xr,{open:s,onOpenChange:n,children:t.jsx(Rn,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:t.jsx(Fs,{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:e})})}),Ta=x.forwardRef(({className:e,...s},n)=>t.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[t.jsx(ur,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t.jsx(Ze.Input,{ref:n,className:O("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",e),...s})]}));Ta.displayName=Ze.Input.displayName;const zs=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.List,{ref:n,className:O("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...s}));zs.displayName=Ze.List.displayName;const Pa=x.forwardRef((e,s)=>t.jsx(Ze.Empty,{ref:s,className:"py-6 text-center text-sm text-muted-foreground",...e}));Pa.displayName=Ze.Empty.displayName;const hs=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.Group,{ref:n,className:O("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",e),...s}));hs.displayName=Ze.Group.displayName;const Rl=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.Separator,{ref:n,className:O("-mx-1 h-px bg-border",e),...s}));Rl.displayName=Ze.Separator.displayName;const ut=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.Item,{ref:n,className:O("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",e),...s}));ut.displayName=Ze.Item.displayName;function zh(){const{open:e,setOpen:s}=Bi(),n=Ue(),{data:r}=Tn(),{workspace:a}=ke(),o=(a==null?void 0:a.slug)??"",i=l=>{s(!1),l()};return t.jsxs(Fh,{open:e,onOpenChange:s,children:[t.jsx(Ta,{placeholder:"Search or jump to..."}),t.jsxs(zs,{children:[t.jsx(Pa,{children:"No results found."}),t.jsxs(hs,{heading:"Navigation",children:[t.jsxs(ut,{onSelect:()=>i(()=>n(`/${o}/projects`)),children:[t.jsx(er,{className:"text-muted-foreground"}),t.jsx("span",{children:"Projects"})]}),t.jsxs(ut,{onSelect:()=>i(()=>n(`/${o}/notifications`)),children:[t.jsx(qs,{className:"text-muted-foreground"}),t.jsx("span",{children:"Notifications"})]}),t.jsxs(ut,{onSelect:()=>i(()=>n(`/${o}/settings`)),children:[t.jsx(wa,{className:"text-muted-foreground"}),t.jsx("span",{children:"Settings"})]})]}),r&&r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Rl,{}),t.jsxs(hs,{heading:"Projects",children:[r.map(l=>t.jsxs(ut,{value:`${l.name} board`,onSelect:()=>i(()=>n(`/${o}/projects/${l.identifier}/board`)),children:[t.jsx(xt,{className:"text-muted-foreground"}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),t.jsx("span",{className:"truncate",children:l.name}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),r.map(l=>t.jsxs(ut,{value:`${l.name} issues`,onSelect:()=>i(()=>n(`/${o}/projects/${l.identifier}/issues`)),children:[t.jsx(Qs,{className:"text-muted-foreground"}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),t.jsx("span",{className:"truncate",children:l.name}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Wh(){const[e,s]=x.useState(""),[n,r]=x.useState(""),[a,o]=x.useState(!1),i=Ue(),l=bf(),d=c=>{c.preventDefault(),l.mutate({email:e,password:n},{onSuccess:()=>i("/"),onError:u=>R.error(u.message??"Invalid email or password")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[360px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Welcome to Meridian"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),t.jsxs("form",{onSubmit:d,className:"space-y-2",children:[t.jsx(xe,{type:"email",placeholder:"Email",value:e,onChange:c=>s(c.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),t.jsxs("div",{className:"relative",children:[t.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"}),t.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?t.jsx(ba,{className:"h-4 w-4"}):t.jsx(_n,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(K,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",t.jsx(yn,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]})]})})}function qh(){const[e,s]=x.useState(""),[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState(!1),u=Ue(),f=yf(),{data:m}=vl(),h=(m==null?void 0:m.needsSetup)===!0,g=y=>{y.preventDefault(),f.mutate({email:a,password:i,first_name:e,last_name:n},{onSuccess:()=>u("/"),onError:S=>R.error(S.message??"Registration failed")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[360px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:h?"Set up your account":"Create your account"}),t.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"})]})]}),t.jsxs("form",{onSubmit:g,className:"space-y-2",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(xe,{placeholder:"First name",value:e,onChange:y=>s(y.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),t.jsx(xe,{placeholder:"Last name",value:n,onChange:y=>r(y.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),t.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"}),t.jsxs("div",{className:"relative",children:[t.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"}),t.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?t.jsx(ba,{className:"h-4 w-4"}):t.jsx(_n,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(K,{type:"submit",className:"w-full h-10 font-medium",disabled:f.isPending,children:f.isPending?"Creating account...":"Create Account"})})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",t.jsx(yn,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function Bh(){const[e,s]=x.useState(""),n=Ue(),{setWorkspace:r}=ke(),a=af(),o=i=>{i.preventDefault(),e.trim()&&a.mutate({name:e.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 t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[380px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Create your workspace"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),t.jsxs("form",{onSubmit:o,className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(xe,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:i=>s(i.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),t.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),t.jsx(K,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||a.isPending,children:a.isPending?"Creating workspace...":"Create workspace"})]})]})})}function Yh(e){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=e:n.appendChild(document.createTextNode(e))}const Il=v.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}),In=()=>{const e=v.useContext(Il);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Yh(`[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(
468
+ */const Xs=U("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 af({issue:e}){const s=or(e.id,e.project_id),[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(!1),d=e.metadata??{},c=Object.entries(d),u=()=>{if(!n.trim())return;const m={...d,[n.trim()]:a};s.mutate({metadata:m},{onSuccess:()=>{I.success("Metadata saved"),r(""),o(""),l(!1)},onError:()=>I.error("Failed to save metadata")})},f=m=>{const h={...d};delete h[m],s.mutate({metadata:Object.keys(h).length?h:null},{onSuccess:()=>I.success("Entry removed"),onError:()=>I.error("Failed to update metadata")})};return t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(_m,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!i&&t.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Add field"]})]}),t.jsxs("div",{className:"px-5 py-3 space-y-2",children:[c.length===0&&!i&&t.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),c.map(([m,h])=>t.jsxs("div",{className:"flex items-center gap-2 group",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:m}),t.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(h)}),t.jsx("button",{onClick:()=>f(m),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:t.jsx(Tt,{className:"h-3 w-3"})})]},m)),i&&t.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[t.jsx(xe,{autoFocus:!0,placeholder:"key",value:n,onChange:m=>r(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs font-mono w-28 shrink-0"}),t.jsx(xe,{placeholder:"value",value:a,onChange:m=>o(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),t.jsx(K,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!n.trim()||s.isPending,children:"Save"}),t.jsx(K,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),r(""),o("")},children:"Cancel"})]})]})]})}const of=[{zone:"issue.details.after",component:af}];function fr(e=!0){return Ne({queryKey:["workspaces"],queryFn:()=>J.get("/admin/workspaces"),select:s=>s.workspaces,enabled:e})}function lf(){const e=ue();return de({mutationFn:s=>J.post("/admin/workspaces",s),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function df(e){const s=ue();return de({mutationFn:n=>J.put(`/admin/workspaces/${e}`,n),onSuccess:()=>{s.invalidateQueries({queryKey:["workspaces"]})}})}const Sa={list:e=>["workspaces",e,"invitations"]};function cf(e){return Ne({queryKey:Sa.list(e),queryFn:()=>J.get(`/admin/workspaces/${e}/invitations`),select:s=>s.invitations,enabled:!!e})}function uf(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/workspaces/${e}/invitations`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Sa.list(e)})}})}function mf(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/workspaces/${e}/invitations/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Sa.list(e)})}})}const hr={list:e=>["workspaces",e,"members"]};function Tn(e){return Ne({queryKey:hr.list(e),queryFn:()=>J.get(`/admin/workspaces/${e}/members`),select:s=>s.members,enabled:!!e})}function ff(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/workspaces/${e}/members`,n),onSuccess:()=>{s.invalidateQueries({queryKey:hr.list(e)})}})}function hf(e){const s=ue();return de({mutationFn:({userId:n,role:r})=>J.patch(`/admin/workspaces/${e}/members/${n}`,{role:r}),onSuccess:()=>{s.invalidateQueries({queryKey:hr.list(e)})}})}function xf(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/workspaces/${e}/members/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:hr.list(e)})}})}const Ht={list:e=>["workspaces",e,"teams"],members:(e,s)=>["workspaces",e,"teams",s,"members"]};function Ca(e){return Ne({queryKey:Ht.list(e),queryFn:()=>J.get(`/admin/workspaces/${e}/teams`),select:s=>s.teams,enabled:!!e})}function pf(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/workspaces/${e}/teams`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ht.list(e)})}})}function gf(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/workspaces/${e}/teams/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ht.list(e)})}})}function bf(e,s){return Ne({queryKey:Ht.members(e,s),queryFn:()=>J.get(`/admin/workspaces/${e}/teams/${s}/members`),select:n=>n.members,enabled:!!(e&&s)})}function yf(e,s){const n=ue();return de({mutationFn:r=>J.post(`/admin/workspaces/${e}/teams/${s}/members`,{user_id:r}),onSuccess:()=>{n.invalidateQueries({queryKey:Ht.members(e,s)}),n.invalidateQueries({queryKey:Ht.list(e)})}})}function vf(e,s){const n=ue();return de({mutationFn:r=>J.delete(`/admin/workspaces/${e}/teams/${s}/members/${r}`),onSuccess:()=>{n.invalidateQueries({queryKey:Ht.members(e,s)}),n.invalidateQueries({queryKey:Ht.list(e)})}})}function jl(){return Ne({queryKey:["setup-status"],queryFn:()=>J.get("/auth/setup"),staleTime:6e4,retry:!1})}function jf(){const{login:e}=ke();return de({mutationFn:s=>J.post("/auth/login",s),onSuccess:s=>{e(s.user,s.token)}})}function wf(){const{login:e}=ke();return de({mutationFn:s=>J.post("/auth/register",s),onSuccess:s=>{e(s.user,s.token)}})}function Nf(e){const{login:s}=ke();return de({mutationFn:n=>J.post(`/auth/invite/${e}`,n),onSuccess:n=>{s(n.user,n.token)}})}var Zo;const kf=((Zo=window.__MERIDIAN_CONFIG__)==null?void 0:Zo.apiUrl)??void 0??"";function Sf(e,s){const n=`${kf}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(s)}`;return new EventSource(n)}function Cf(){const{token:e,workspace:s}=ke(),n=ue(),r=x.useRef(null);x.useEffect(()=>{if(!e||!s)return;const a=Sf(e,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}},[e,s==null?void 0:s.id,n])}const _r=768;function Mf(){const[e,s]=x.useState(void 0);return x.useEffect(()=>{const n=window.matchMedia(`(max-width: ${_r-1}px)`),r=()=>{s(window.innerWidth<_r)};return n.addEventListener("change",r),s(window.innerWidth<_r),()=>n.removeEventListener("change",r)},[]),!!e}const Ma=x.forwardRef(({className:e,orientation:s="horizontal",decorative:n=!0,...r},a)=>t.jsx(ni,{ref:a,decorative:n,orientation:s,className:P("shrink-0 bg-border",s==="horizontal"?"h-px w-full":"h-full w-px",e),...r}));Ma.displayName=ni.displayName;const Df=Sn,_f=kn,wl=x.forwardRef(({className:e,...s},n)=>t.jsx(ys,{className:P("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",e),...s,ref:n}));wl.displayName=ys.displayName;const Ef=Mn("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"}}),Nl=x.forwardRef(({side:e="right",className:s,children:n,...r},a)=>t.jsxs(_f,{children:[t.jsx(wl,{}),t.jsxs(vs,{ref:a,className:P(Ef({side:e}),s),...r,children:[n,t.jsxs(ar,{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:[t.jsx(Fe,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Nl.displayName=vs.displayName;const kl=({className:e,...s})=>t.jsx("div",{className:P("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...s});kl.displayName="SheetHeader";const Sl=x.forwardRef(({className:e,...s},n)=>t.jsx(Us,{ref:n,className:P("text-base font-semibold text-foreground",e),...s}));Sl.displayName=Us.displayName;const Cl=x.forwardRef(({className:e,...s},n)=>t.jsx(Hs,{ref:n,className:P("text-sm text-muted-foreground",e),...s}));Cl.displayName=Hs.displayName;function te({className:e,...s}){return t.jsx("div",{className:P("animate-pulse rounded-md bg-muted",e),...s})}const Of="sidebar_state",Tf=60*60*24*7,Pf="16rem",Af="18rem",$f="3rem",Rf="b",Ml=x.createContext(null);function Da(){const e=x.useContext(Ml);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function If({defaultOpen:e=!0,open:s,onOpenChange:n,className:r,style:a,children:o,...i}){const l=Mf(),[d,c]=x.useState(!1),[u,f]=x.useState(e),m=s??u,h=x.useCallback(b=>{const N=typeof b=="function"?b(m):b;n?n(N):f(N),document.cookie=`${Of}=${N}; path=/; max-age=${Tf}`},[n,m]),g=x.useCallback(()=>l?c(b=>!b):h(b=>!b),[l,h,c]);x.useEffect(()=>{const b=N=>{N.key===Rf&&(N.metaKey||N.ctrlKey)&&(N.preventDefault(),g())};return window.addEventListener("keydown",b),()=>window.removeEventListener("keydown",b)},[g]);const y=m?"expanded":"collapsed",S=x.useMemo(()=>({state:y,open:m,setOpen:h,isMobile:l,openMobile:d,setOpenMobile:c,toggleSidebar:g}),[y,m,h,l,d,c,g]);return t.jsx(Ml.Provider,{value:S,children:t.jsx(fa,{delayDuration:0,children:t.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":Pf,"--sidebar-width-icon":$f,...a},className:P("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",r),...i,children:o})})})}function Ff({side:e="left",variant:s="sidebar",collapsible:n="offcanvas",className:r,children:a,...o}){const{isMobile:i,state:l,openMobile:d,setOpenMobile:c}=Da();return n==="none"?t.jsx("div",{"data-slot":"sidebar",className:P("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",r),...o,children:a}):i?t.jsx(Df,{open:d,onOpenChange:c,...o,children:t.jsxs(Nl,{"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":Af},side:e,children:[t.jsxs(kl,{className:"sr-only",children:[t.jsx(Sl,{children:"Sidebar"}),t.jsx(Cl,{children:"Displays the mobile sidebar."})]}),t.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):t.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?n:"","data-variant":s,"data-side":e,"data-slot":"sidebar",children:[t.jsx("div",{"data-slot":"sidebar-gap",className:P("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)]")}),t.jsx("div",{"data-slot":"sidebar-container",className:P("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex",e==="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:t.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 zf({className:e,onClick:s,...n}){const{toggleSidebar:r}=Da();return t.jsxs(K,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:P("size-7",e),onClick:a=>{s==null||s(a),r()},...n,children:[t.jsx(Lm,{}),t.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Wf({className:e,...s}){return t.jsx("main",{"data-slot":"sidebar-inset",className:P("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",e),...s})}function qf({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:P("flex flex-col gap-2 p-2",e),...s})}function Bf({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:P("flex flex-col gap-2 p-2",e),...s})}function Yf({className:e,...s}){return t.jsx(Ma,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:P("bg-sidebar-border mx-2 w-auto",e),...s})}function Lf({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:P("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...s})}function Er({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:P("relative flex w-full min-w-0 flex-col p-2",e),...s})}function Uf({className:e,asChild:s=!1,...n}){const r=s?ia:"div";return t.jsx(r,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:P("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",e),...n})}function Or({className:e,...s}){return t.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:P("w-full text-sm",e),...s})}function bn({className:e,...s}){return t.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:P("flex w-full min-w-0 flex-col gap-1",e),...s})}function Lt({className:e,...s}){return t.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:P("group/menu-item relative",e),...s})}const Hf=Mn("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"}}),Dt=x.forwardRef(function({asChild:s=!1,isActive:n=!1,variant:r="default",size:a="default",tooltip:o,className:i,...l},d){const c=s?ia:"button",{isMobile:u,state:f}=Da(),m=t.jsx(c,{ref:d,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":a,"data-active":n,className:P(Hf({variant:r,size:a}),i),...l});return o?(typeof o=="string"&&(o={children:o}),t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:m}),t.jsx(Ut,{side:"right",align:"center",hidden:f!=="collapsed"||u,...o})]})):m});Dt.displayName="SidebarMenuButton";const Kf=250,Vf=300,fs={all:["projects"],list:()=>[...fs.all,"list"],detail:e=>[...fs.all,e],byKey:e=>[...fs.all,"key",e]};function Pn(){const{workspace:e}=ke();return Ne({queryKey:[...fs.list(),e==null?void 0:e.id],queryFn:()=>{const s=e!=null&&e.id?`?workspace_id=${e.id}`:"";return J.get(`/admin/projects${s}`)},select:s=>s.projects,enabled:!!(e!=null&&e.id)})}function ws(e){return Ne({queryKey:fs.byKey(e),queryFn:()=>J.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:s=>s.project,enabled:!!e})}function Gf(e,s={}){const[n,r]=x.useState(e),a=s.enabled!==!1;return x.useEffect(()=>{if(!a)return;const l=setTimeout(()=>r(e),Kf);return()=>clearTimeout(l)},[e,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(e)}}function Qf(e,s={}){const n=e.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),Vf);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 Xf(){const e=ue();return de({mutationFn:s=>J.post("/admin/projects",s),onSuccess:()=>{e.invalidateQueries({queryKey:fs.list()})}})}function Jf(){const e=ue();return de({mutationFn:s=>J.delete(`/admin/projects/${s}`),onSuccess:()=>{e.invalidateQueries({queryKey:fs.list()})}})}const Ns=wc,ks=Nc,Zf=x.forwardRef(({className:e,inset:s,children:n,...r},a)=>t.jsxs(ri,{ref:a,className:P("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",e),...r,children:[n,t.jsx(Gs,{className:"ml-auto"})]}));Zf.displayName=ri.displayName;const eh=x.forwardRef(({className:e,...s},n)=>t.jsx(ai,{ref:n,className:P("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",e),...s}));eh.displayName=ai.displayName;const Xt=x.forwardRef(({className:e,sideOffset:s=4,...n},r)=>t.jsx(jc,{children:t.jsx(oi,{ref:r,sideOffset:s,className:P("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",e),...n})}));Xt.displayName=oi.displayName;const Je=x.forwardRef(({className:e,inset:s,...n},r)=>t.jsx(ii,{ref:r,className:P("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",e),...n}));Je.displayName=ii.displayName;const th=x.forwardRef(({className:e,children:s,checked:n,...r},a)=>t.jsxs(li,{ref:a,className:P("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",e),checked:n,...r,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(di,{children:t.jsx(it,{className:"h-4 w-4"})})}),s]}));th.displayName=li.displayName;const sh=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(ci,{ref:r,className:P("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",e),...n,children:[t.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(di,{children:t.jsx(Nt,{className:"h-2 w-2 fill-current"})})}),s]}));sh.displayName=ci.displayName;const _a=x.forwardRef(({className:e,inset:s,...n},r)=>t.jsx(ui,{ref:r,className:P("px-2 py-1.5 text-xs font-medium text-muted-foreground",s&&"pl-8",e),...n}));_a.displayName=ui.displayName;const An=x.forwardRef(({className:e,...s},n)=>t.jsx(mi,{ref:n,className:P("-mx-1 my-1 h-px bg-border",e),...s}));An.displayName=mi.displayName;const st=x.forwardRef(({className:e,...s},n)=>t.jsx(fi,{ref:n,className:P("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...s}));st.displayName=fi.displayName;const nh=x.forwardRef(({className:e,...s},n)=>t.jsx(hi,{ref:n,className:P("aspect-square h-full w-full",e),...s}));nh.displayName=hi.displayName;const nt=x.forwardRef(({className:e,...s},n)=>t.jsx(xi,{ref:n,className:P("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...s}));nt.displayName=xi.displayName;function rh(){var a;const{workspace:e,setWorkspace:s}=ke(),{data:n}=fr(),r=He();return t.jsx(bn,{children:t.jsx(Lt,{children:t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsxs(Dt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:t.jsx("span",{className:"text-[13px] font-bold",children:(((a=e==null?void 0:e.name)==null?void 0:a[0])??"M").toUpperCase()})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),t.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),t.jsx(ol,{className:"ml-auto size-4 shrink-0"})]})}),t.jsxs(Xt,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[t.jsx(_a,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),n==null?void 0:n.map(o=>t.jsxs(Je,{className:"cursor-pointer gap-2 p-2",onClick:()=>{s({id:o.id,name:o.name,slug:o.slug}),r(`/${o.slug}/projects`)},children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:t.jsx("span",{className:"text-[10px] font-bold",children:o.name[0].toUpperCase()})}),t.jsx("span",{className:"flex-1 truncate",children:o.name}),o.id===(e==null?void 0:e.id)&&t.jsx(it,{className:"size-3.5 text-muted-foreground shrink-0"})]},o.id)),t.jsx(An,{}),t.jsxs(Je,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>r("/setup"),children:[t.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:t.jsx("span",{className:"text-xs font-semibold",children:"+"})}),t.jsx("span",{children:"Create workspace"})]})]})]})})})}function ah(){var a,o;const{user:e,logout:s}=ke(),n=e?`${((a=e.first_name)==null?void 0:a[0])??""}${((o=e.last_name)==null?void 0:o[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",r=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return t.jsx(bn,{children:t.jsx(Lt,{children:t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsxs(Dt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[t.jsx(st,{className:"h-8 w-8 rounded-lg shrink-0",children:t.jsx(nt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:r}),t.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),t.jsx(ol,{className:"ml-auto size-4 shrink-0"})]})}),t.jsxs(Xt,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[t.jsx(_a,{className:"p-0 font-normal",children:t.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[t.jsx(st,{className:"h-8 w-8 rounded-lg",children:t.jsx(nt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})}),t.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[t.jsx("span",{className:"truncate font-semibold",children:r}),t.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),t.jsx(An,{}),t.jsxs(Je,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:s,children:[t.jsx(Wm,{className:"size-4"}),"Sign out"]})]})]})})})}function oh({...e}){var h;const{workspace:s,projectKey:n}=Ge(),{data:r}=Pn(),{toggle:a}=Yi(),{user:o}=ke(),i=rr(),l=s??"",d=i.pathname===`/${l}/projects`,c=i.pathname.includes("/notifications"),u=i.pathname.includes("/settings"),f=i.pathname.includes("/roles"),m=((h=o==null?void 0:o.roles)==null?void 0:h.includes("super-admin"))??!1;return t.jsxs(Ff,{collapsible:"offcanvas",...e,children:[t.jsx(qf,{children:t.jsx(rh,{})}),t.jsxs(Lf,{children:[t.jsx(Er,{children:t.jsx(Or,{children:t.jsxs(bn,{children:[t.jsx(Lt,{children:t.jsxs(Dt,{onClick:a,tooltip:"Search",children:[t.jsx(mr,{}),t.jsx("span",{children:"Search"}),t.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:d,tooltip:"Projects",children:t.jsxs(Ts,{to:`/${l}/projects`,end:!0,children:[t.jsx(xt,{}),t.jsx("span",{children:"Projects"})]})})}),t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:c,tooltip:"Notifications",children:t.jsxs(Ts,{to:`/${l}/notifications`,children:[t.jsx(qs,{}),t.jsx("span",{children:"Notifications"})]})})})]})})}),r&&r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Yf,{}),t.jsxs(Er,{children:[t.jsx(Uf,{children:"Recent"}),t.jsx(Or,{children:t.jsx(bn,{children:r.slice(0,5).map(g=>t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:g.identifier===n,tooltip:g.name,children:t.jsxs(Ts,{to:`/${l}/projects/${g.identifier}/board`,children:[t.jsx("span",{className:"font-mono text-[11px] text-sidebar-foreground/50 shrink-0",children:g.identifier}),t.jsx("span",{className:"truncate",children:g.name})]})})},g.id))})})]})]}),t.jsx(Er,{className:"mt-auto",children:t.jsx(Or,{children:t.jsxs(bn,{children:[m&&t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:f,tooltip:"Roles & Permissions",children:t.jsxs(Ts,{to:`/${l}/roles`,children:[t.jsx(ea,{}),t.jsx("span",{children:"Roles"})]})})}),t.jsx(Lt,{children:t.jsx(Dt,{asChild:!0,isActive:u,tooltip:"Settings",children:t.jsxs(Ts,{to:`/${l}/settings`,children:[t.jsx(Na,{}),t.jsx("span",{children:"Settings"})]})})})]})})})]}),t.jsx(Bf,{children:t.jsx(ah,{})})]})}function ih(){const{theme:e,setTheme:s}=_u();return t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsxs(K,{variant:"ghost",size:"icon-sm",onClick:()=>s(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[t.jsx(Qm,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),t.jsx(Ym,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),t.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),t.jsx(Ut,{children:"Toggle theme"})]})}const $n={all:["notifications"],list:()=>[...$n.all,"list"]};function lh(){return Ne({queryKey:$n.list(),queryFn:()=>J.get("/admin/notifications"),select:e=>e.notifications})}function dh(){return Ne({queryKey:[...$n.list(),"unread"],queryFn:()=>J.get("/admin/notifications?unread=true"),select:e=>e.count})}function ch(){const e=ue();return de({mutationFn:s=>J.post(`/admin/notifications/${s}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:$n.all})}})}function uh(){const e=ue();return de({mutationFn:()=>J.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:$n.all})}})}function mh(){const e=rr(),{projectKey:s}=Ge(),{data:n}=Pn(),r=n==null?void 0:n.find(o=>o.identifier===s),a=e.pathname;return a.includes("/board")?{icon:xt,label:r?`${r.name} / Board`:"Board"}:a.includes("/issues")?{icon:Qs,label:r?`${r.name} / Issues`:"Issues"}:a.endsWith("/projects")?{icon:tr,label:"Projects"}:a.includes("/notifications")?{icon:qs,label:"Notifications"}:a.includes("/settings")?{icon:Na,label:"Settings"}:{icon:tr,label:"Meridian"}}function fh(){const{data:e=0}=dh(),{icon:s,label:n}=mh(),{workspace:r}=ke(),a=(r==null?void 0:r.slug)??"";return t.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:t.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[t.jsx(zf,{className:"-ml-1"}),t.jsx(Ma,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx(s,{className:"h-4 w-4 text-muted-foreground",strokeWidth:1.5}),t.jsx("span",{className:"font-medium",children:n})]}),t.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[t.jsx(ih,{}),t.jsx(K,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:t.jsxs(yn,{to:`/${a}/notifications`,children:[t.jsx(qs,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&t.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:e>9?"9+":e})]})})]})]})})}function hh(){return t.jsxs(If,{children:[t.jsx(oh,{variant:"inset"}),t.jsxs(Wf,{className:"flex flex-col min-w-0",children:[t.jsx(fh,{}),t.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:t.jsx(ei,{})})]})]})}const vo=["board","issues","sprints","timeline","access"];function xh(){const{projectKey:e,workspace:s}=Ge(),{data:n}=ws(e??""),r=He(),a=rr(),[o]=ti();x.useEffect(()=>{const d=o.get("tab");if(!d||!vo.includes(d))return;vo.every(u=>!a.pathname.endsWith(`/${u}`))&&r(`/${s}/projects/${e}/${d}`,{replace:!0})},[]);const i=`/${s}/projects/${e}`,l=[{to:`${i}/board`,label:"Board",icon:tr,end:!0},{to:`${i}/issues`,label:"Issues",icon:Qs,end:!1},{to:`${i}/sprints`,label:"Sprints",icon:Xs,end:!0},{to:`${i}/timeline`,label:"Timeline",icon:xa,end:!0},{to:`${i}/access`,label:"Access",icon:dr,end:!0}];return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"px-6 pt-5 border-b border-border bg-white dark:bg-card shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2.5 mb-4",children:[n&&t.jsx("span",{className:"text-xs font-mono text-muted-foreground bg-muted border border-border px-2 py-0.5 rounded",children:n.identifier}),t.jsx("h1",{className:"text-sm font-semibold",children:(n==null?void 0:n.name)??""})]}),t.jsx("div",{className:"flex -mb-px",children:l.map(({to:d,label:c,icon:u,end:f})=>t.jsxs(Ts,{to:d,end:f,className:({isActive:m})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${m?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[t.jsx(u,{className:"h-3.5 w-3.5",strokeWidth:1.5}),c]},d))})]}),t.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:t.jsx(ei,{})})]})}var jo=1,ph=.9,gh=.8,bh=.17,Tr=.1,Pr=.999,yh=.9999,vh=.99,jh=/[\\\/_+.#"@\[\(\{&]/,wh=/[\\\/_+.#"@\[\(\{&]/g,Nh=/[\s-]/,Dl=/[\s-]/g;function ta(e,s,n,r,a,o,i){if(o===s.length)return a===e.length?jo:vh;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,f,m,h,g;c>=0;)f=ta(e,s,n,r,c+1,o+1,i),f>u&&(c===a?f*=jo:jh.test(e.charAt(c-1))?(f*=gh,h=e.slice(a,c-1).match(wh),h&&a>0&&(f*=Math.pow(Pr,h.length))):Nh.test(e.charAt(c-1))?(f*=ph,g=e.slice(a,c-1).match(Dl),g&&a>0&&(f*=Math.pow(Pr,g.length))):(f*=bh,a>0&&(f*=Math.pow(Pr,c-a))),e.charAt(c)!==s.charAt(o)&&(f*=yh)),(f<Tr&&n.charAt(c-1)===r.charAt(o+1)||r.charAt(o+1)===r.charAt(o)&&n.charAt(c-1)!==r.charAt(o))&&(m=ta(e,s,n,r,c+1,o+2,i),m*Tr>f&&(f=m*Tr)),f>u&&(u=f),c=n.indexOf(d,c+1);return i[l]=u,u}function wo(e){return e.toLowerCase().replace(Dl," ")}function kh(e,s,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,ta(e,s,wo(e),wo(s),0,0,{})}var mn='[cmdk-group=""]',Ar='[cmdk-group-items=""]',Sh='[cmdk-group-heading=""]',Ea='[cmdk-item=""]',No=`${Ea}:not([aria-disabled="true"])`,sa="cmdk-item-select",ls="data-value",Ch=(e,s,n)=>kh(e,s,n),_l=x.createContext(void 0),Rn=()=>x.useContext(_l),El=x.createContext(void 0),Oa=()=>x.useContext(El),Ol=x.createContext(void 0),Tl=x.forwardRef((e,s)=>{let n=Ps(()=>{var k,M;return{search:"",value:(M=(k=e.value)!=null?k:e.defaultValue)!=null?M:"",filtered:{count:0,items:new Map,groups:new Set}}}),r=Ps(()=>new Set),a=Ps(()=>new Map),o=Ps(()=>new Map),i=Ps(()=>new Set),l=Pl(e),{label:d,children:c,value:u,onValueChange:f,filter:m,shouldFilter:h,loop:g,disablePointerSelection:y=!1,vimBindings:S=!0,...b}=e,N=$s(),w=$s(),j=$s(),E=x.useRef(null),p=Ih();ps(()=>{if(u!==void 0){let k=u.trim();n.current.value=k,C.emit()}},[u]),ps(()=>{p(6,R)},[]);let C=x.useMemo(()=>({subscribe:k=>(i.current.add(k),()=>i.current.delete(k)),snapshot:()=>n.current,setState:(k,M,Y)=>{var L,ae,A;if(!Object.is(n.current[k],M)){if(n.current[k]=M,k==="search")_(),O(),p(1,F);else if(k==="value"&&(Y||p(5,R),((L=l.current)==null?void 0:L.value)!==void 0)){let ie=M??"";(A=(ae=l.current).onValueChange)==null||A.call(ae,ie);return}C.emit()}},emit:()=>{i.current.forEach(k=>k())}}),[]),$=x.useMemo(()=>({value:(k,M,Y)=>{var L;M!==((L=o.current.get(k))==null?void 0:L.value)&&(o.current.set(k,{value:M,keywords:Y}),n.current.filtered.items.set(k,D(M,Y)),p(2,()=>{O(),C.emit()}))},item:(k,M)=>(r.current.add(k),M&&(a.current.has(M)?a.current.get(M).add(k):a.current.set(M,new Set([k]))),p(3,()=>{_(),O(),n.current.value||F(),C.emit()}),()=>{o.current.delete(k),r.current.delete(k),n.current.filtered.items.delete(k);let Y=T();p(4,()=>{_(),(Y==null?void 0:Y.getAttribute("id"))===k&&F(),C.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||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:N,inputId:j,labelId:w,listInnerRef:E}),[]);function D(k,M){var Y,L;let ae=(L=(Y=l.current)==null?void 0:Y.filter)!=null?L:Ch;return k?ae(k,n.current.search,M):0}function O(){if(!n.current.search||l.current.shouldFilter===!1)return;let k=n.current.filtered.items,M=[];n.current.filtered.groups.forEach(L=>{let ae=a.current.get(L),A=0;ae.forEach(ie=>{let ge=k.get(ie);A=Math.max(ge,A)}),M.push([L,A])});let Y=E.current;X().sort((L,ae)=>{var A,ie;let ge=L.getAttribute("id"),Te=ae.getAttribute("id");return((A=k.get(Te))!=null?A:0)-((ie=k.get(ge))!=null?ie:0)}).forEach(L=>{let ae=L.closest(Ar);ae?ae.appendChild(L.parentElement===ae?L:L.closest(`${Ar} > *`)):Y.appendChild(L.parentElement===Y?L:L.closest(`${Ar} > *`))}),M.sort((L,ae)=>ae[1]-L[1]).forEach(L=>{var ae;let A=(ae=E.current)==null?void 0:ae.querySelector(`${mn}[${ls}="${encodeURIComponent(L[0])}"]`);A==null||A.parentElement.appendChild(A)})}function F(){let k=X().find(Y=>Y.getAttribute("aria-disabled")!=="true"),M=k==null?void 0:k.getAttribute(ls);C.setState("value",M||void 0)}function _(){var k,M,Y,L;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let ae=0;for(let A of r.current){let ie=(M=(k=o.current.get(A))==null?void 0:k.value)!=null?M:"",ge=(L=(Y=o.current.get(A))==null?void 0:Y.keywords)!=null?L:[],Te=D(ie,ge);n.current.filtered.items.set(A,Te),Te>0&&ae++}for(let[A,ie]of a.current)for(let ge of ie)if(n.current.filtered.items.get(ge)>0){n.current.filtered.groups.add(A);break}n.current.filtered.count=ae}function R(){var k,M,Y;let L=T();L&&(((k=L.parentElement)==null?void 0:k.firstChild)===L&&((Y=(M=L.closest(mn))==null?void 0:M.querySelector(Sh))==null||Y.scrollIntoView({block:"nearest"})),L.scrollIntoView({block:"nearest"}))}function T(){var k;return(k=E.current)==null?void 0:k.querySelector(`${Ea}[aria-selected="true"]`)}function X(){var k;return Array.from(((k=E.current)==null?void 0:k.querySelectorAll(No))||[])}function q(k){let M=X()[k];M&&C.setState("value",M.getAttribute(ls))}function V(k){var M;let Y=T(),L=X(),ae=L.findIndex(ie=>ie===Y),A=L[ae+k];(M=l.current)!=null&&M.loop&&(A=ae+k<0?L[L.length-1]:ae+k===L.length?L[0]:L[ae+k]),A&&C.setState("value",A.getAttribute(ls))}function W(k){let M=T(),Y=M==null?void 0:M.closest(mn),L;for(;Y&&!L;)Y=k>0?$h(Y,mn):Rh(Y,mn),L=Y==null?void 0:Y.querySelector(No);L?C.setState("value",L.getAttribute(ls)):V(k)}let z=()=>q(X().length-1),Q=k=>{k.preventDefault(),k.metaKey?z():k.altKey?W(1):V(1)},ee=k=>{k.preventDefault(),k.metaKey?q(0):k.altKey?W(-1):V(-1)};return x.createElement(Gt.div,{ref:s,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:k=>{var M;if((M=b.onKeyDown)==null||M.call(b,k),!k.defaultPrevented)switch(k.key){case"n":case"j":{S&&k.ctrlKey&&Q(k);break}case"ArrowDown":{Q(k);break}case"p":case"k":{S&&k.ctrlKey&&ee(k);break}case"ArrowUp":{ee(k);break}case"Home":{k.preventDefault(),q(0);break}case"End":{k.preventDefault(),z();break}case"Enter":if(!k.nativeEvent.isComposing&&k.keyCode!==229){k.preventDefault();let Y=T();if(Y){let L=new Event(sa);Y.dispatchEvent(L)}}}}},x.createElement("label",{"cmdk-label":"",htmlFor:$.inputId,id:$.labelId,style:zh},d),xr(e,k=>x.createElement(El.Provider,{value:C},x.createElement(_l.Provider,{value:$},k))))}),Mh=x.forwardRef((e,s)=>{var n,r;let a=$s(),o=x.useRef(null),i=x.useContext(Ol),l=Rn(),d=Pl(e),c=(r=(n=d.current)==null?void 0:n.forceMount)!=null?r:i==null?void 0:i.forceMount;ps(()=>{if(!c)return l.item(a,i==null?void 0:i.id)},[c]);let u=Al(a,o,[e.value,e.children,o],e.keywords),f=Oa(),m=gs(p=>p.value&&p.value===u.current),h=gs(p=>c||l.filter()===!1?!0:p.search?p.filtered.items.get(a)>0:!0);x.useEffect(()=>{let p=o.current;if(!(!p||e.disabled))return p.addEventListener(sa,g),()=>p.removeEventListener(sa,g)},[h,e.onSelect,e.disabled]);function g(){var p,C;y(),(C=(p=d.current).onSelect)==null||C.call(p,u.current)}function y(){f.setState("value",u.current,!0)}if(!h)return null;let{disabled:S,value:b,onSelect:N,forceMount:w,keywords:j,...E}=e;return x.createElement(Gt.div,{ref:vn([o,s]),...E,id:a,"cmdk-item":"",role:"option","aria-disabled":!!S,"aria-selected":!!m,"data-disabled":!!S,"data-selected":!!m,onPointerMove:S||l.getDisablePointerSelection()?void 0:y,onClick:S?void 0:g},e.children)}),Dh=x.forwardRef((e,s)=>{let{heading:n,children:r,forceMount:a,...o}=e,i=$s(),l=x.useRef(null),d=x.useRef(null),c=$s(),u=Rn(),f=gs(h=>a||u.filter()===!1?!0:h.search?h.filtered.groups.has(i):!0);ps(()=>u.group(i),[]),Al(i,l,[e.value,e.heading,d]);let m=x.useMemo(()=>({id:i,forceMount:a}),[a]);return x.createElement(Gt.div,{ref:vn([l,s]),...o,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},n&&x.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),xr(e,h=>x.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},x.createElement(Ol.Provider,{value:m},h))))}),_h=x.forwardRef((e,s)=>{let{alwaysRender:n,...r}=e,a=x.useRef(null),o=gs(i=>!i.search);return!n&&!o?null:x.createElement(Gt.div,{ref:vn([a,s]),...r,"cmdk-separator":"",role:"separator"})}),Eh=x.forwardRef((e,s)=>{let{onValueChange:n,...r}=e,a=e.value!=null,o=Oa(),i=gs(u=>u.search),l=gs(u=>u.value),d=Rn(),c=x.useMemo(()=>{var u;let f=(u=d.listInnerRef.current)==null?void 0:u.querySelector(`${Ea}[${ls}="${encodeURIComponent(l)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return x.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),x.createElement(Gt.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?e.value:i,onChange:u=>{a||o.setState("search",u.target.value),n==null||n(u.target.value)}})}),Oh=x.forwardRef((e,s)=>{let{children:n,label:r="Suggestions",...a}=e,o=x.useRef(null),i=x.useRef(null),l=Rn();return x.useEffect(()=>{if(i.current&&o.current){let d=i.current,c=o.current,u,f=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let m=d.offsetHeight;c.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(d),()=>{cancelAnimationFrame(u),f.unobserve(d)}}},[]),x.createElement(Gt.div,{ref:vn([o,s]),...a,"cmdk-list":"",role:"listbox","aria-label":r,id:l.listId},xr(e,d=>x.createElement("div",{ref:vn([i,l.listInnerRef]),"cmdk-list-sizer":""},d)))}),Th=x.forwardRef((e,s)=>{let{open:n,onOpenChange:r,overlayClassName:a,contentClassName:o,container:i,...l}=e;return x.createElement(Sn,{open:n,onOpenChange:r},x.createElement(kn,{container:i},x.createElement(ys,{"cmdk-overlay":"",className:a}),x.createElement(vs,{"aria-label":e.label,"cmdk-dialog":"",className:o},x.createElement(Tl,{ref:s,...l}))))}),Ph=x.forwardRef((e,s)=>gs(n=>n.filtered.count===0)?x.createElement(Gt.div,{ref:s,...e,"cmdk-empty":"",role:"presentation"}):null),Ah=x.forwardRef((e,s)=>{let{progress:n,children:r,label:a="Loading...",...o}=e;return x.createElement(Gt.div,{ref:s,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},xr(e,i=>x.createElement("div",{"aria-hidden":!0},i)))}),Ze=Object.assign(Tl,{List:Oh,Item:Mh,Input:Eh,Group:Dh,Separator:_h,Dialog:Th,Empty:Ph,Loading:Ah});function $h(e,s){let n=e.nextElementSibling;for(;n;){if(n.matches(s))return n;n=n.nextElementSibling}}function Rh(e,s){let n=e.previousElementSibling;for(;n;){if(n.matches(s))return n;n=n.previousElementSibling}}function Pl(e){let s=x.useRef(e);return ps(()=>{s.current=e}),s}var ps=typeof window>"u"?x.useEffect:x.useLayoutEffect;function Ps(e){let s=x.useRef();return s.current===void 0&&(s.current=e()),s}function vn(e){return s=>{e.forEach(n=>{typeof n=="function"?n(s):n!=null&&(n.current=s)})}}function gs(e){let s=Oa(),n=()=>e(s.snapshot());return kc.useSyncExternalStore(s.subscribe,n,n)}function Al(e,s,n,r=[]){let a=x.useRef(),o=Rn();return ps(()=>{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(e,l,d),(i=s.current)==null||i.setAttribute(ls,l),a.current=l}),a}var Ih=()=>{let[e,s]=x.useState(),n=Ps(()=>new Map);return ps(()=>{n.current.forEach(r=>r()),n.current=new Map},[e]),(r,a)=>{n.current.set(r,a),s({})}};function Fh(e){let s=e.type;return typeof s=="function"?s(e.props):"render"in s?s.render(e.props):e}function xr({asChild:e,children:s},n){return e&&x.isValidElement(s)?x.cloneElement(Fh(s),{ref:s.ref},n(s.props.children)):n(s)}var zh={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const pr=Sn,Wh=kn,$l=x.forwardRef(({className:e,...s},n)=>t.jsx(ys,{ref:n,className:P("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",e),...s}));$l.displayName=ys.displayName;const In=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(Wh,{children:[t.jsx($l,{}),t.jsxs(vs,{ref:r,className:P("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",e),...n,children:[s,t.jsxs(ar,{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:[t.jsx(Fe,{className:"h-4 w-4"}),t.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));In.displayName=vs.displayName;const gr=({className:e,...s})=>t.jsx("div",{className:P("flex flex-col space-y-1.5",e),...s});gr.displayName="DialogHeader";const br=x.forwardRef(({className:e,...s},n)=>t.jsx(Us,{ref:n,className:P("text-base font-semibold leading-none tracking-tight",e),...s}));br.displayName=Us.displayName;const Rl=x.forwardRef(({className:e,...s},n)=>t.jsx(Hs,{ref:n,className:P("text-sm text-muted-foreground",e),...s}));Rl.displayName=Hs.displayName;const Fs=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze,{ref:n,className:P("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...s}));Fs.displayName=Ze.displayName;const qh=({children:e,open:s,onOpenChange:n})=>t.jsx(pr,{open:s,onOpenChange:n,children:t.jsx(In,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:t.jsx(Fs,{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:e})})}),Ta=x.forwardRef(({className:e,...s},n)=>t.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[t.jsx(mr,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),t.jsx(Ze.Input,{ref:n,className:P("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",e),...s})]}));Ta.displayName=Ze.Input.displayName;const zs=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.List,{ref:n,className:P("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...s}));zs.displayName=Ze.List.displayName;const Pa=x.forwardRef((e,s)=>t.jsx(Ze.Empty,{ref:s,className:"py-6 text-center text-sm text-muted-foreground",...e}));Pa.displayName=Ze.Empty.displayName;const hs=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.Group,{ref:n,className:P("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",e),...s}));hs.displayName=Ze.Group.displayName;const Il=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.Separator,{ref:n,className:P("-mx-1 h-px bg-border",e),...s}));Il.displayName=Ze.Separator.displayName;const mt=x.forwardRef(({className:e,...s},n)=>t.jsx(Ze.Item,{ref:n,className:P("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",e),...s}));mt.displayName=Ze.Item.displayName;function Bh(){const{open:e,setOpen:s}=Yi(),n=He(),{data:r}=Pn(),{workspace:a}=ke(),o=(a==null?void 0:a.slug)??"",i=l=>{s(!1),l()};return t.jsxs(qh,{open:e,onOpenChange:s,children:[t.jsx(Ta,{placeholder:"Search or jump to..."}),t.jsxs(zs,{children:[t.jsx(Pa,{children:"No results found."}),t.jsxs(hs,{heading:"Navigation",children:[t.jsxs(mt,{onSelect:()=>i(()=>n(`/${o}/projects`)),children:[t.jsx(tr,{className:"text-muted-foreground"}),t.jsx("span",{children:"Projects"})]}),t.jsxs(mt,{onSelect:()=>i(()=>n(`/${o}/notifications`)),children:[t.jsx(qs,{className:"text-muted-foreground"}),t.jsx("span",{children:"Notifications"})]}),t.jsxs(mt,{onSelect:()=>i(()=>n(`/${o}/settings`)),children:[t.jsx(Na,{className:"text-muted-foreground"}),t.jsx("span",{children:"Settings"})]})]}),r&&r.length>0&&t.jsxs(t.Fragment,{children:[t.jsx(Il,{}),t.jsxs(hs,{heading:"Projects",children:[r.map(l=>t.jsxs(mt,{value:`${l.name} board`,onSelect:()=>i(()=>n(`/${o}/projects/${l.identifier}/board`)),children:[t.jsx(xt,{className:"text-muted-foreground"}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),t.jsx("span",{className:"truncate",children:l.name}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),r.map(l=>t.jsxs(mt,{value:`${l.name} issues`,onSelect:()=>i(()=>n(`/${o}/projects/${l.identifier}/issues`)),children:[t.jsx(Qs,{className:"text-muted-foreground"}),t.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),t.jsx("span",{className:"truncate",children:l.name}),t.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Yh(){const[e,s]=x.useState(""),[n,r]=x.useState(""),[a,o]=x.useState(!1),i=He(),l=jf(),d=c=>{c.preventDefault(),l.mutate({email:e,password:n},{onSuccess:()=>i("/"),onError:u=>I.error(u.message??"Invalid email or password")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[360px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Welcome to Meridian"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),t.jsxs("form",{onSubmit:d,className:"space-y-2",children:[t.jsx(xe,{type:"email",placeholder:"Email",value:e,onChange:c=>s(c.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),t.jsxs("div",{className:"relative",children:[t.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"}),t.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?t.jsx(ya,{className:"h-4 w-4"}):t.jsx(_n,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(K,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",t.jsx(yn,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]})]})})}function Lh(){const[e,s]=x.useState(""),[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState(!1),u=He(),f=wf(),{data:m}=jl(),h=(m==null?void 0:m.needsSetup)===!0,g=y=>{y.preventDefault(),f.mutate({email:a,password:i,first_name:e,last_name:n},{onSuccess:()=>u("/"),onError:S=>I.error(S.message??"Registration failed")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[360px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:h?"Set up your account":"Create your account"}),t.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"})]})]}),t.jsxs("form",{onSubmit:g,className:"space-y-2",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(xe,{placeholder:"First name",value:e,onChange:y=>s(y.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),t.jsx(xe,{placeholder:"Last name",value:n,onChange:y=>r(y.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),t.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"}),t.jsxs("div",{className:"relative",children:[t.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"}),t.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?t.jsx(ya,{className:"h-4 w-4"}):t.jsx(_n,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(K,{type:"submit",className:"w-full h-10 font-medium",disabled:f.isPending,children:f.isPending?"Creating account...":"Create Account"})})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",t.jsx(yn,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function Uh(){const[e,s]=x.useState(""),n=He(),{setWorkspace:r}=ke(),a=lf(),o=i=>{i.preventDefault(),e.trim()&&a.mutate({name:e.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=>I.error(l.message??"Failed to create workspace")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[380px]",children:[t.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),t.jsxs("div",{className:"text-center",children:[t.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Create your workspace"}),t.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),t.jsxs("form",{onSubmit:o,className:"space-y-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(xe,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:i=>s(i.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),t.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),t.jsx(K,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||a.isPending,children:a.isPending?"Creating workspace...":"Create workspace"})]})]})})}function Hh(e){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=e:n.appendChild(document.createTextNode(e))}const Fl=v.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}),Fn=()=>{const e=v.useContext(Fl);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};Hh(`[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
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 Lh(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Hh(){return Aa(/^Mac/)}function Uh(){return Aa(/^iPhone/)}function ko(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Kh(){return Aa(/^iPad/)||Hh()&&navigator.maxTouchPoints>1}function Fl(){return Uh()||Kh()}function Aa(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Vh=24,Gh=typeof window<"u"?x.useLayoutEffect:x.useEffect;function So(...e){return(...s)=>{for(let n of e)typeof n=="function"&&n(...s)}}const Ar=typeof document<"u"&&window.visualViewport;function Co(e){let s=window.getComputedStyle(e);return/(auto|scroll)/.test(s.overflow+s.overflowX+s.overflowY)}function zl(e){for(Co(e)&&(e=e.parentElement);e&&!Co(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Qh=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Vn=0,$r;function Xh(e={}){let{isDisabled:s}=e;Gh(()=>{if(!s)return Vn++,Vn===1&&Fl()&&($r=Jh()),()=>{Vn--,Vn===0&&($r==null||$r())}},[s])}function Jh(){let e,s=0,n=f=>{e=zl(f.target),!(e===document.documentElement&&e===document.body)&&(s=f.changedTouches[0].pageY)},r=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,h=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((h<=0&&m>s||h>=g&&m<s)&&f.preventDefault(),s=m)},a=f=>{let m=f.target;sa(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},o=f=>{let m=f.target;sa(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",Ar&&(Ar.height<window.innerHeight?requestAnimationFrame(()=>{Mo(m)}):Ar.addEventListener("resize",()=>Mo(m),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},l=window.pageXOffset,d=window.pageYOffset,c=So(Zh(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=So(fn(document,"touchstart",n,{passive:!1,capture:!0}),fn(document,"touchmove",r,{passive:!1,capture:!0}),fn(document,"touchend",a,{passive:!1,capture:!0}),fn(document,"focus",o,!0),fn(window,"scroll",i));return()=>{c(),u(),window.scrollTo(l,d)}}function Zh(e,s,n){let r=e.style[s];return e.style[s]=n,()=>{e.style[s]=r}}function fn(e,s,n,r){return e.addEventListener(s,n,r),()=>{e.removeEventListener(s,n,r)}}function Mo(e){let s=document.scrollingElement||document.documentElement;for(;e&&e!==s;){let n=zl(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,a=e.getBoundingClientRect().top,o=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+Vh;o>i&&(n.scrollTop+=a-r)}e=n.parentElement}}function sa(e){return e instanceof HTMLInputElement&&!Qh.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function ex(e,s){typeof e=="function"?e(s):e!=null&&(e.current=s)}function tx(...e){return s=>e.forEach(n=>ex(n,s))}function Wl(...e){return x.useCallback(tx(...e),e)}const ql=new WeakMap;function ze(e,s,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(s).forEach(([a,o])=>{if(a.startsWith("--")){e.style.setProperty(a,o);return}r[a]=e.style[a],e.style[a]=o}),!n&&ql.set(e,r)}function sx(e,s){if(!e||!(e instanceof HTMLElement))return;let n=ql.get(e);n&&(e.style[s]=n[s])}const Re=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Gn(e,s){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Re(s)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Re(s)?5:4]):null)}function nx(e){return 8*(Math.log(e+1)-2)}function Rr(e,s){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,s),()=>{e.style.cssText=n}}function rx(...e){return(...s)=>{for(const n of e)typeof n=="function"&&n(...s)}}const De={DURATION:.5,EASE:[.32,.72,0,1]},Bl=.4,ax=.25,ox=100,Yl=8,as=16,na=26,Ir="vaul-dragging";function Ll(e){const s=v.useRef(e);return v.useEffect(()=>{s.current=e}),v.useMemo(()=>(...n)=>s.current==null?void 0:s.current.call(s,...n),[])}function ix({defaultProp:e,onChange:s}){const n=v.useState(e),[r]=n,a=v.useRef(r),o=Ll(s);return v.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),n}function Hl({prop:e,defaultProp:s,onChange:n=()=>{}}){const[r,a]=ix({defaultProp:s,onChange:n}),o=e!==void 0,i=o?e:r,l=Ll(n),d=v.useCallback(c=>{if(o){const f=typeof c=="function"?c(e):c;f!==e&&l(f)}else a(c)},[o,e,a,l]);return[i,d]}function lx({activeSnapPointProp:e,setActiveSnapPointProp:s,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:o,onSnapPointChange:i,direction:l="bottom",container:d,snapToSequentialPoint:c}){const[u,f]=Hl({prop:e,defaultProp:n==null?void 0:n[0],onChange:s}),[m,h]=v.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);v.useEffect(()=>{function C(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const g=v.useMemo(()=>u===(n==null?void 0:n[n.length-1])||null,[n,u]),y=v.useMemo(()=>{var C;return(C=n==null?void 0:n.findIndex(A=>A===u))!=null?C:null},[n,u]),S=n&&n.length>0&&(o||o===0)&&!Number.isNaN(o)&&n[o]===u||!n,b=v.useMemo(()=>{const C=d?{width:d.getBoundingClientRect().width,height:d.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var A;return(A=n==null?void 0:n.map(D=>{const _=typeof D=="string";let I=0;if(_&&(I=parseInt(D,10)),Re(l)){const F=_?I:m?D*C.height:0;return m?l==="bottom"?C.height-F:-C.height+F:F}const $=_?I:m?D*C.width:0;return m?l==="right"?C.width-$:-C.width+$:$}))!=null?A:[]},[n,m,d]),N=v.useMemo(()=>y!==null?b==null?void 0:b[y]:null,[b,y]),w=v.useCallback(C=>{var A;const D=(A=b==null?void 0:b.findIndex(_=>_===C))!=null?A:null;i(D),ze(r.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Re(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),b&&D!==b.length-1&&o!==void 0&&D!==o&&D<o?ze(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"0"}):ze(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"1"}),f(n==null?void 0:n[Math.max(D,0)])},[r.current,n,b,o,a,f]);v.useEffect(()=>{if(u||e){var C;const A=(C=n==null?void 0:n.findIndex(D=>D===e||D===u))!=null?C:-1;b&&A!==-1&&typeof b[A]=="number"&&w(b[A])}},[u,e,n,b,w]);function j({draggedDistance:C,closeDrawer:A,velocity:D,dismissible:_}){if(o===void 0)return;const I=l==="bottom"||l==="right"?(N??0)-C:(N??0)+C,$=y===o-1,F=y===0,T=C>0;if($&&ze(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`}),!c&&D>2&&!T){_?A():w(b[0]);return}if(!c&&D>2&&T&&b&&n){w(b[n.length-1]);return}const X=b==null?void 0:b.reduce((V,W)=>typeof V!="number"||typeof W!="number"?V:Math.abs(W-I)<Math.abs(V-I)?W:V),q=Re(l)?window.innerHeight:window.innerWidth;if(D>Bl&&Math.abs(C)<q*.4){const V=T?1:-1;if(V>0&&g&&n){w(b[n.length-1]);return}if(F&&V<0&&_&&A(),y===null)return;w(b[y+V]);return}w(X)}function E({draggedDistance:C}){if(N===null)return;const A=l==="bottom"||l==="right"?N-C:N+C;(l==="bottom"||l==="right")&&A<b[b.length-1]||(l==="top"||l==="left")&&A>b[b.length-1]||ze(r.current,{transform:Re(l)?`translate3d(0, ${A}px, 0)`:`translate3d(${A}px, 0, 0)`})}function p(C,A){if(!n||typeof y!="number"||!b||o===void 0)return null;const D=y===o-1;if(y>=o&&A)return 0;if(D&&!A)return 1;if(!S&&!D)return null;const I=D?y+1:y-1,$=D?b[I]-b[I-1]:b[I+1]-b[I],F=C/Math.abs($);return D?1-F:F}return{isLastSnapPoint:g,activeSnapPoint:u,shouldFade:S,getPercentageDragged:p,setActiveSnapPoint:f,activeSnapPointIndex:y,onRelease:j,onDrag:E,snapPointsOffset:b}}const dx=()=>()=>{};function cx(){const{direction:e,isOpen:s,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=In(),o=v.useRef(null),i=x.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-na)/window.innerWidth}v.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;rx(r&&!a?Rr(document.body,{background:"black"}):dx,Rr(d,{transformOrigin:Re(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${De.DURATION}s`,transitionTimingFunction:`cubic-bezier(${De.EASE.join(",")})`}));const c=Rr(d,{borderRadius:`${Yl}px`,overflow:"hidden",...Re(e)?{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 hn=null;function ux({isOpen:e,modal:s,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:o}){const[i,l]=v.useState(()=>typeof window<"u"?window.location.href:""),d=v.useRef(0),c=v.useCallback(()=>{if(ko()&&hn===null&&e&&!o){hn={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-d.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const h=m-window.innerHeight;h&&d.current>=m&&(document.body.style.top=`${-(d.current+h)}px`)}),300)}},[e]),u=v.useCallback(()=>{if(ko()&&hn!==null&&!o){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,hn),window.requestAnimationFrame(()=>{if(a&&i!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),hn=null}},[i]);return v.useEffect(()=>{function f(){d.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),v.useEffect(()=>{if(s)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[s,u]),v.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&c(),s||window.setTimeout(()=>{u()},500)):u())},[e,r,i,s,n,c,u]),{restorePositionSetting:u}}function mx({open:e,onOpenChange:s,children:n,onDrag:r,onRelease:a,snapPoints:o,shouldScaleBackground:i=!1,setBackgroundColorOnScale:l=!0,closeThreshold:d=ax,scrollLockTimeout:c=ox,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:m=o&&o.length-1,activeSnapPoint:h,setActiveSnapPoint:g,fixed:y,modal:S=!0,onClose:b,nested:N,noBodyStyles:w=!1,direction:j="bottom",defaultOpen:E=!1,disablePreventScroll:p=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:A=!1,repositionInputs:D=!0,onAnimationEnd:_,container:I,autoFocus:$=!1}){var F,T;const[X=!1,q]=Hl({defaultProp:E,prop:e,onChange:re=>{s==null||s(re),!re&&!N&&gt(),setTimeout(()=>{_==null||_(re)},De.DURATION*1e3),re&&!S&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),re||(document.body.style.pointerEvents="auto")}}),[V,W]=v.useState(!1),[z,Q]=v.useState(!1),[ee,k]=v.useState(!1),M=v.useRef(null),Y=v.useRef(null),L=v.useRef(null),ae=v.useRef(null),P=v.useRef(null),ie=v.useRef(!1),ge=v.useRef(null),Te=v.useRef(0),qe=v.useRef(!1),$t=v.useRef(!E),Zt=v.useRef(0),le=v.useRef(null),es=v.useRef(((F=le.current)==null?void 0:F.getBoundingClientRect().height)||0),ts=v.useRef(((T=le.current)==null?void 0:T.getBoundingClientRect().width)||0),ss=v.useRef(0),ns=v.useCallback(re=>{o&&re===Be.length-1&&(Y.current=new Date)},[]),{activeSnapPoint:rn,activeSnapPointIndex:lt,setActiveSnapPoint:pt,onRelease:Ms,snapPointsOffset:Be,onDrag:rs,shouldFade:Rt,getPercentageDragged:Ye}=lx({snapPoints:o,activeSnapPointProp:h,setActiveSnapPointProp:g,drawerRef:le,fadeFromIndex:m,overlayRef:M,onSnapPointChange:ns,direction:j,container:I,snapToSequentialPoint:C});Xh({isDisabled:!X||z||!S||ee||!V||!D||!p});const{restorePositionSetting:gt}=ux({isOpen:X,modal:S,nested:N??!1,hasBeenOpened:V,preventScrollRestoration:A,noBodyStyles:w});function It(){return(window.innerWidth-na)/window.innerWidth}function an(re){var G,se;!u&&!o||le.current&&!le.current.contains(re.target)||(es.current=((G=le.current)==null?void 0:G.getBoundingClientRect().height)||0,ts.current=((se=le.current)==null?void 0:se.getBoundingClientRect().width)||0,Q(!0),L.current=new Date,Fl()&&window.addEventListener("touchend",()=>ie.current=!1,{once:!0}),re.target.setPointerCapture(re.pointerId),Te.current=Re(j)?re.pageY:re.pageX)}function St(re,G){var se;let U=re;const Z=(se=window.getSelection())==null?void 0:se.toString(),be=le.current?Gn(le.current,j):null,B=new Date;if(U.tagName==="SELECT"||U.hasAttribute("data-vaul-no-drag")||U.closest("[data-vaul-no-drag]"))return!1;if(j==="right"||j==="left")return!0;if(Y.current&&B.getTime()-Y.current.getTime()<500)return!1;if(be!==null&&(j==="bottom"?be>0:be<0))return!0;if(Z&&Z.length>0)return!1;if(P.current&&B.getTime()-P.current.getTime()<c&&be===0||G)return P.current=B,!1;for(;U;){if(U.scrollHeight>U.clientHeight){if(U.scrollTop!==0)return P.current=new Date,!1;if(U.getAttribute("role")==="dialog")return!0}U=U.parentNode}return!0}function on(re){if(le.current&&z){const G=j==="bottom"||j==="right"?1:-1,se=(Te.current-(Re(j)?re.pageY:re.pageX))*G,U=se>0,Z=o&&!u&&!U;if(Z&&lt===0)return;const be=Math.abs(se),B=document.querySelector("[data-vaul-drawer-wrapper]"),fe=j==="bottom"||j==="top"?es.current:ts.current;let he=be/fe;const Ae=Ye(be,U);if(Ae!==null&&(he=Ae),Z&&he>=1||!ie.current&&!St(re.target,U))return;if(le.current.classList.add(Ir),ie.current=!0,ze(le.current,{transition:"none"}),ze(M.current,{transition:"none"}),o&&rs({draggedDistance:se}),U&&!o){const Me=nx(se),nt=Math.min(Me*-1,0)*G;ze(le.current,{transform:Re(j)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`});return}const Ce=1-he;if((Rt||m&&lt===m-1)&&(r==null||r(re,he),ze(M.current,{opacity:`${Ce}`,transition:"none"},!0)),B&&M.current&&i){const Me=Math.min(It()+he*(1-It()),1),nt=8-he*8,Qe=Math.max(0,14-he*14);ze(B,{borderRadius:`${nt}px`,transform:Re(j)?`scale(${Me}) translate3d(0, ${Qe}px, 0)`:`scale(${Me}) translate3d(${Qe}px, 0, 0)`,transition:"none"},!0)}if(!o){const Me=be*G;ze(le.current,{transform:Re(j)?`translate3d(0, ${Me}px, 0)`:`translate3d(${Me}px, 0, 0)`})}}}v.useEffect(()=>{window.requestAnimationFrame(()=>{$t.current=!0})},[]),v.useEffect(()=>{var re;function G(){if(!le.current||!D)return;const se=document.activeElement;if(sa(se)||qe.current){var U;const Z=((U=window.visualViewport)==null?void 0:U.height)||0,be=window.innerHeight;let B=be-Z;const fe=le.current.getBoundingClientRect().height||0,he=fe>be*.8;ss.current||(ss.current=fe);const Ae=le.current.getBoundingClientRect().top;if(Math.abs(Zt.current-B)>60&&(qe.current=!qe.current),o&&o.length>0&&Be&&lt){const Ce=Be[lt]||0;B+=Ce}if(Zt.current=B,fe>Z||qe.current){const Ce=le.current.getBoundingClientRect().height;let Me=Ce;Ce>Z&&(Me=Z-(he?Ae:na)),y?le.current.style.height=`${Ce-Math.max(B,0)}px`:le.current.style.height=`${Math.max(Me,Z-Ae)}px`}else Lh()||(le.current.style.height=`${ss.current}px`);o&&o.length>0&&!qe.current?le.current.style.bottom="0px":le.current.style.bottom=`${Math.max(B,0)}px`}}return(re=window.visualViewport)==null||re.addEventListener("resize",G),()=>{var se;return(se=window.visualViewport)==null?void 0:se.removeEventListener("resize",G)}},[lt,o,Be]);function bt(re){yt(),b==null||b(),re||q(!1),setTimeout(()=>{o&&pt(o[0])},De.DURATION*1e3)}function Ft(){if(!le.current)return;const re=document.querySelector("[data-vaul-drawer-wrapper]"),G=Gn(le.current,j);ze(le.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`}),ze(M.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"1"}),i&&G&&G>0&&X&&ze(re,{borderRadius:`${Yl}px`,overflow:"hidden",...Re(j)?{transform:`scale(${It()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${It()}) 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(){!z||!le.current||(le.current.classList.remove(Ir),ie.current=!1,Q(!1),ae.current=new Date)}function Ds(re){if(!z||!le.current)return;le.current.classList.remove(Ir),ie.current=!1,Q(!1),ae.current=new Date;const G=Gn(le.current,j);if(!re||!St(re.target,!1)||!G||Number.isNaN(G)||L.current===null)return;const se=ae.current.getTime()-L.current.getTime(),U=Te.current-(Re(j)?re.pageY:re.pageX),Z=Math.abs(U)/se;if(Z>.05&&(k(!0),setTimeout(()=>{k(!1)},200)),o){Ms({draggedDistance:U*(j==="bottom"||j==="right"?1:-1),closeDrawer:bt,velocity:Z,dismissible:u}),a==null||a(re,!0);return}if(j==="bottom"||j==="right"?U>0:U<0){Ft(),a==null||a(re,!0);return}if(Z>Bl){bt(),a==null||a(re,!1);return}var be;const B=Math.min((be=le.current.getBoundingClientRect().height)!=null?be:0,window.innerHeight);var fe;const he=Math.min((fe=le.current.getBoundingClientRect().width)!=null?fe:0,window.innerWidth),Ae=j==="left"||j==="right";if(Math.abs(G)>=(Ae?he:B)*d){bt(),a==null||a(re,!1);return}a==null||a(re,!0),Ft()}v.useEffect(()=>(X&&(ze(document.documentElement,{scrollBehavior:"auto"}),Y.current=new Date),()=>{sx(document.documentElement,"scrollBehavior")}),[X]);function vt(re){const G=re?(window.innerWidth-as)/window.innerWidth:1,se=re?-as:0;ge.current&&window.clearTimeout(ge.current),ze(le.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Re(j)?`scale(${G}) translate3d(0, ${se}px, 0)`:`scale(${G}) translate3d(${se}px, 0, 0)`}),!re&&le.current&&(ge.current=setTimeout(()=>{const U=Gn(le.current,j);ze(le.current,{transition:"none",transform:Re(j)?`translate3d(0, ${U}px, 0)`:`translate3d(${U}px, 0, 0)`})},500))}function _s(re,G){if(G<0)return;const se=(window.innerWidth-as)/window.innerWidth,U=se+G*(1-se),Z=-as+G*as;ze(le.current,{transform:Re(j)?`scale(${U}) translate3d(0, ${Z}px, 0)`:`scale(${U}) translate3d(${Z}px, 0, 0)`,transition:"none"})}function ln(re,G){const se=Re(j)?window.innerHeight:window.innerWidth,U=G?(se-as)/se:1,Z=G?-as:0;G&&ze(le.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Re(j)?`scale(${U}) translate3d(0, ${Z}px, 0)`:`scale(${U}) translate3d(${Z}px, 0, 0)`})}return v.useEffect(()=>{S||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[S]),v.createElement(Sn,{defaultOpen:E,onOpenChange:re=>{!u&&!re||(re?W(!0):bt(!0),q(re))},open:X},v.createElement(Il.Provider,{value:{activeSnapPoint:rn,snapPoints:o,setActiveSnapPoint:pt,drawerRef:le,overlayRef:M,onOpenChange:s,onPress:an,onRelease:Ds,onDrag:on,dismissible:u,shouldAnimate:$t,handleOnly:f,isOpen:X,isDragging:z,shouldFade:Rt,closeDrawer:bt,onNestedDrag:_s,onNestedOpenChange:vt,onNestedRelease:ln,keyboardIsOpen:qe,modal:S,snapPointsOffset:Be,activeSnapPointIndex:lt,direction:j,shouldScaleBackground:i,setBackgroundColorOnScale:l,noBodyStyles:w,container:I,autoFocus:$}},n))}const Ul=v.forwardRef(function({...e},s){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:o,isOpen:i,modal:l,shouldAnimate:d}=In(),c=Wl(s,n),u=r&&r.length>0;if(!l)return null;const f=v.useCallback(m=>a(m),[a]);return v.createElement(ys,{onMouseUp:f,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",...e})});Ul.displayName="Drawer.Overlay";const Kl=v.forwardRef(function({onPointerDownOutside:e,style:s,onOpenAutoFocus:n,...r},a){const{drawerRef:o,onPress:i,onRelease:l,onDrag:d,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:f,modal:m,isOpen:h,direction:g,snapPoints:y,container:S,handleOnly:b,shouldAnimate:N,autoFocus:w}=In(),[j,E]=v.useState(!1),p=Wl(a,o),C=v.useRef(null),A=v.useRef(null),D=v.useRef(!1),_=y&&y.length>0;cx();const I=(F,T,X=0)=>{if(D.current)return!0;const q=Math.abs(F.y),V=Math.abs(F.x),W=V>q,z=["bottom","right"].includes(T)?1:-1;if(T==="left"||T==="right"){if(!(F.x*z<0)&&V>=0&&V<=X)return W}else if(!(F.y*z<0)&&q>=0&&q<=X)return!W;return D.current=!0,!0};v.useEffect(()=>{_&&window.requestAnimationFrame(()=>{E(!0)})},[]);function $(F){C.current=null,D.current=!1,l(F)}return v.createElement(vs,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":j?"true":"false","data-vaul-snap-points":h&&_?"true":"false","data-vaul-custom-container":S?"true":"false","data-vaul-animate":N!=null&&N.current?"true":"false",...r,ref:p,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...s}:s,onPointerDown:F=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,F),C.current={x:F.pageX,y:F.pageY},i(F))},onOpenAutoFocus:F=>{n==null||n(F),w||F.preventDefault()},onPointerDownOutside:F=>{if(e==null||e(F),!m||F.defaultPrevented){F.preventDefault();return}c.current&&(c.current=!1)},onFocusOutside:F=>{if(!m){F.preventDefault();return}},onPointerMove:F=>{if(A.current=F,b||(r.onPointerMove==null||r.onPointerMove.call(r,F),!C.current))return;const T=F.pageY-C.current.y,X=F.pageX-C.current.x,q=F.pointerType==="touch"?10:2;I({x:X,y:T},g,q)?d(F):(Math.abs(X)>q||Math.abs(T)>q)&&(C.current=null)},onPointerUp:F=>{r.onPointerUp==null||r.onPointerUp.call(r,F),C.current=null,D.current=!1,l(F)},onPointerOut:F=>{r.onPointerOut==null||r.onPointerOut.call(r,F),$(A.current)},onContextMenu:F=>{r.onContextMenu==null||r.onContextMenu.call(r,F),A.current&&$(A.current)}})});Kl.displayName="Drawer.Content";const fx=250,hx=120,xx=v.forwardRef(function({preventCycle:e=!1,children:s,...n},r){const{closeDrawer:a,isDragging:o,snapPoints:i,activeSnapPoint:l,setActiveSnapPoint:d,dismissible:c,handleOnly:u,isOpen:f,onPress:m,onDrag:h}=In(),g=v.useRef(null),y=v.useRef(!1);function S(){if(y.current){w();return}window.setTimeout(()=>{b()},hx)}function b(){if(o||e||y.current){w();return}if(w(),!i||i.length===0){c||a();return}if(l===i[i.length-1]&&c){a();return}const E=i.findIndex(C=>C===l);if(E===-1)return;const p=i[E+1];d(p)}function N(){g.current=window.setTimeout(()=>{y.current=!0},fx)}function w(){g.current&&window.clearTimeout(g.current),y.current=!1}return v.createElement("div",{onClick:S,onPointerCancel:w,onPointerDown:j=>{u&&m(j),N()},onPointerMove:j=>{u&&h(j)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},v.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},s))});xx.displayName="Drawer.Handle";function px(e){const s=In(),{container:n=s.container,...r}=e;return v.createElement(kn,{container:n,...r})}const Pt={Root:mx,Content:Kl,Overlay:Ul,Portal:px,Title:Hs,Description:Us},Ss=({shouldScaleBackground:e=!1,direction:s="right",...n})=>t.jsx(Pt.Root,{shouldScaleBackground:e,direction:s,...n});Ss.displayName="Drawer";const gx=Pt.Portal,Vl=x.forwardRef(({className:e,...s},n)=>t.jsx(Pt.Overlay,{ref:n,className:O("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",e),...s}));Vl.displayName=Pt.Overlay.displayName;const Cs=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(gx,{children:[t.jsx(Vl,{}),t.jsx(Pt.Content,{ref:r,className:O("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",e),...n,children:s})]}));Cs.displayName="DrawerContent";const Js=({className:e,...s})=>t.jsx("div",{className:O("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...s});Js.displayName="DrawerHeader";const Zs=({className:e,...s})=>t.jsx("div",{className:O("flex-1 overflow-y-auto px-6 py-4",e),...s});Zs.displayName="DrawerBody";const Fn=({className:e,...s})=>t.jsx("div",{className:O("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t border-border shrink-0",e),...s});Fn.displayName="DrawerFooter";const en=x.forwardRef(({className:e,...s},n)=>t.jsx(Pt.Title,{ref:n,className:O("text-base font-semibold text-foreground",e),...s}));en.displayName=Pt.Title.displayName;const bx=x.forwardRef(({className:e,...s},n)=>t.jsx(Pt.Description,{ref:n,className:O("text-sm text-muted-foreground",e),...s}));bx.displayName=Pt.Description.displayName;const yx=Mn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=x.forwardRef(({className:e,...s},n)=>t.jsx(xi,{ref:n,className:O(yx(),e),...s}));We.displayName=xi.displayName;const br=x.forwardRef(({className:e,...s},n)=>t.jsx("textarea",{className:O("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",e),ref:n,...s}));br.displayName="Textarea";const Do=[{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}],Fr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function vx(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function jx({chip:e,onRemove:s}){const{attributes:n,listeners:r,setNodeRef:a,transform:o,transition:i,isDragging:l}=la({id:e.key});return t.jsxs("div",{ref:a,style:{transform:da.Transform.toString(o),transition:i},className:O("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:[t.jsx("span",{...n,...r,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:t.jsx(ml,{className:"h-3 w-3"})}),t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),t.jsx("span",{className:"text-[11px]",children:e.name}),t.jsx("button",{type:"button",onClick:s,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:t.jsx(Fe,{className:"h-3 w-3"})})]})}const wx=3;function Nx({open:e,onClose:s}){var X;const[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState(!1),[u,f]=x.useState(!1),[m,h]=x.useState(Do),[g,y]=x.useState(""),[S,b]=x.useState(Fr[2]),{workspace:N}=ke(),w=Vf(),j=Uf(n,{enabled:e}),E=Kf(a,{enabled:e});x.useEffect(()=>{e&&j.data&&!d&&o(j.data)},[e,j.data,d]);const p=E.available===!1||w.isError&&((X=w.error)==null?void 0:X.status)===409,C=a.trim().length>=wx&&/^[A-Z0-9]+$/i.test(a.trim()),A=Di(_i(Ei,{activationConstraint:{distance:5}})),D=q=>{r(q)},_=()=>{n.trim()&&!d&&j.flush()},I=()=>{r(""),o(""),l(""),c(!1),f(!1),h(Do),y(""),b(Fr[2]),w.reset(),s()},$=()=>{if(!g.trim())return;const q=vx(g.trim());if(m.some(V=>V.key===q)){R.error("A status with this name already exists");return}h(V=>[...V,{name:g.trim(),key:q,color:S,category:"started",position:V.length}]),y("")},F=q=>{const{active:V,over:W}=q;!W||V.id===W.id||h(z=>{const Q=z.findIndex(k=>k.key===V.id),ee=z.findIndex(k=>k.key===W.id);return Jn(z,Q,ee).map((k,M)=>({...k,position:M}))})},T=q=>{q.preventDefault(),!(!n.trim()||!a.trim()||!C||p)&&w.mutate({name:n.trim(),identifier:a.trim().toUpperCase(),description:i.trim()||void 0,workspace_id:N.id,initial_statuses:m},{onSuccess:()=>{R.success("Project created"),I()},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 t.jsx(Ss,{open:e,onOpenChange:q=>!q&&I(),children:t.jsxs(Cs,{className:"max-w-md",children:[t.jsx(Js,{children:t.jsx(en,{children:"New project"})}),t.jsxs("form",{onSubmit:T,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(Zs,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{htmlFor:"project-name",children:"Name"}),t.jsx(xe,{id:"project-name",placeholder:"My Project",value:n,onChange:q=>D(q.target.value),onBlur:_,autoFocus:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"project-id",children:["Identifier",t.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),t.jsx(xe,{id:"project-id",placeholder:"PROJ",value:a,onChange:q=>{o(q.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),c(!0)},maxLength:5,className:O("font-mono",p&&"border-destructive"),"aria-invalid":p}),p&&t.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"project-desc",children:["Description",t.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(br,{id:"project-desc",placeholder:"What is this project about?",value:i,onChange:q=>l(q.target.value),className:"min-h-[80px]"})]}),t.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[t.jsx("button",{type:"button",onClick:()=>f(!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:t.jsxs("span",{className:"flex items-center gap-1.5",children:[u?t.jsx(Vs,{className:"h-3.5 w-3.5"}):t.jsx(Gs,{className:"h-3.5 w-3.5"}),"Statuses",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",m.length,")"]})]})}),u&&t.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[t.jsx(Oi,{sensors:A,onDragEnd:F,children:t.jsx(ia,{items:m.map(q=>q.key),strategy:Ti,children:t.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(q=>t.jsx(jx,{chip:q,onRemove:()=>h(V=>V.filter(W=>W.key!==q.key).map((W,z)=>({...W,position:z})))},q.key))})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:Fr.map(q=>t.jsx("button",{type:"button",onClick:()=>b(q),className:O("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",S===q?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:q}},q))}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[t.jsx(xe,{placeholder:"Status name…",value:g,onChange:q=>y(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),$())},className:"h-7 text-xs flex-1"}),t.jsx(K,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:$,disabled:!g.trim(),children:t.jsx(Ie,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),t.jsxs(Fn,{children:[t.jsx(K,{type:"button",variant:"ghost",onClick:I,children:"Cancel"}),t.jsx(K,{type:"submit",disabled:!n.trim()||!a.trim()||!C||p||w.isPending,children:w.isPending?"Creating...":"Create project"})]})]})]})})}const we=Dc,Ee=_c,ve=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(pi,{ref:r,className:O("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",e),...n,children:[s,t.jsx(Nc,{asChild:!0,children:t.jsx(Vs,{className:"h-4 w-4 opacity-50"})})]}));ve.displayName=pi.displayName;const Gl=x.forwardRef(({className:e,...s},n)=>t.jsx(gi,{ref:n,className:O("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(pa,{className:"h-4 w-4"})}));Gl.displayName=gi.displayName;const Ql=x.forwardRef(({className:e,...s},n)=>t.jsx(bi,{ref:n,className:O("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(Vs,{className:"h-4 w-4"})}));Ql.displayName=bi.displayName;const je=x.forwardRef(({className:e,children:s,position:n="popper",...r},a)=>t.jsx(kc,{children:t.jsxs(yi,{ref:a,className:O("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",e),position:n,...r,children:[t.jsx(Gl,{}),t.jsx(Sc,{className:O("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),t.jsx(Ql,{})]})}));je.displayName=yi.displayName;const kx=x.forwardRef(({className:e,...s},n)=>t.jsx(vi,{ref:n,className:O("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...s}));kx.displayName=vi.displayName;const de=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(ji,{ref:r,className:O("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",e),...n,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Cc,{children:t.jsx(mt,{className:"h-4 w-4"})})}),t.jsx(Mc,{children:s})]}));de.displayName=ji.displayName;const Sx=x.forwardRef(({className:e,...s},n)=>t.jsx(wi,{ref:n,className:O("-mx-1 my-1 h-px bg-border",e),...s}));Sx.displayName=wi.displayName;const zn={project:e=>["projects",e,"access"]};function Xl(e){return Ne({queryKey:zn.project(e),queryFn:()=>J.get(`/admin/projects/${e}/access`),enabled:!!e})}function Jl(e){const s=me();return ce({mutationFn:({userId:n,role:r})=>J.post(`/admin/projects/${e}/members`,{user_id:n,role:r}),onSuccess:()=>{s.invalidateQueries({queryKey:zn.project(e)})}})}function Zl(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/projects/${e}/members/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:zn.project(e)})}})}function ed(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/projects/${e}/teams`,{team_id:n}),onSuccess:()=>{s.invalidateQueries({queryKey:zn.project(e)})}})}function td(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/projects/${e}/teams/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:zn.project(e)})}})}function Cx({open:e,onClose:s,projectId:n,projectName:r}){const{workspace:a}=ke(),o=(a==null?void 0:a.id)??"",{data:i,isLoading:l}=Xl(n),{data:d}=fr(o),{data:c}=Ca(o),u=Jl(n),f=Zl(n),m=ed(n),h=td(n),[g,y]=x.useState(""),[S,b]=x.useState(""),N=new Set((i==null?void 0:i.members.map(p=>p.user_id))??[]),w=new Set((i==null?void 0:i.teams.map(p=>p.team_id))??[]),j=(d??[]).filter(p=>!N.has(p.user_id)),E=(c??[]).filter(p=>!w.has(p.id));return t.jsx(xr,{open:e,onOpenChange:p=>!p&&s(),children:t.jsxs(Rn,{className:"sm:max-w-[480px]",children:[t.jsx(pr,{children:t.jsxs(gr,{children:["Access — ",r]})}),t.jsxs("div",{className:"space-y-5 pt-1",children:[t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?t.jsx("div",{className:"space-y-2",children:[1,2].map(p=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"h-7 w-7 rounded-full"}),t.jsx(te,{className:"h-3.5 w-32"})]},p))}):(i==null?void 0:i.members.length)===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):t.jsx("div",{className:"space-y-1",children:i==null?void 0:i.members.map(p=>{var $;const C=p.user,A=(C==null?void 0:C.first_name)??"",D=(C==null?void 0:C.last_name)??"",_=`${A} ${D}`.trim()||(C==null?void 0:C.email)||"Unknown",I=(A[0]??D[0]??(($=C==null?void 0:C.email)==null?void 0:$[0])??"U").toUpperCase();return t.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[t.jsx(at,{className:"h-7 w-7 shrink-0",children:t.jsx(ot,{className:"text-[11px] font-medium",children:I})}),t.jsx("span",{className:"flex-1 text-sm truncate",children:_}),t.jsx("span",{className:O("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}),t.jsx("button",{onClick:()=>f.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:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]},p.id)})}),j.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(On,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs(we,{value:g,onValueChange:y,children:[t.jsx(ve,{className:"h-8 text-xs flex-1",children:t.jsx(Ee,{placeholder:"Add person…"})}),t.jsx(je,{children:j.map(p=>{const C=p.user,A=(C==null?void 0:C.first_name)??"",D=(C==null?void 0:C.last_name)??"",_=`${A} ${D}`.trim()||(C==null?void 0:C.email)||"Unknown";return t.jsx(de,{value:p.user_id,children:_},p.user_id)})})]}),g&&t.jsx(K,{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"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?t.jsx("div",{className:"space-y-2",children:[1].map(p=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"h-7 w-7 rounded-lg"}),t.jsx(te,{className:"h-3.5 w-28"})]},p))}):(i==null?void 0:i.teams.length)===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):t.jsx("div",{className:"space-y-1",children:i==null?void 0:i.teams.map(p=>{const C=p.team;return t.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[t.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:t.jsx(xs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsx("span",{className:"flex-1 text-sm truncate",children:(C==null?void 0:C.name)??"Unknown team"}),C&&t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[C.member_count," ",C.member_count===1?"member":"members"]}),t.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:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]},p.id)})}),E.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(xs,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs(we,{value:S,onValueChange:b,children:[t.jsx(ve,{className:"h-8 text-xs flex-1",children:t.jsx(Ee,{placeholder:"Add team…"})}),t.jsx(je,{children:E.map(p=>t.jsx(de,{value:p.id,children:p.name},p.id))})]}),S&&t.jsx(K,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:m.isPending,onClick:()=>m.mutate(S,{onSuccess:()=>{R.success("Team access granted"),b("")},onError:()=>R.error("Failed to add team")}),children:"Add"})]})]}),t.jsx("div",{className:"flex justify-end pt-1",children:t.jsx(K,{variant:"outline",size:"sm",onClick:s,children:"Close"})})]})]})})}const sd=6048e5,Mx=864e5,Cy=36e5,Qn=43200,_o=1440,Eo=Symbol.for("constructDateFrom");function Oe(e,s){return typeof e=="function"?e(s):e&&typeof e=="object"&&Eo in e?e[Eo](s):e instanceof Date?new e.constructor(s):new Date(s)}function pe(e,s){return Oe(s||e,e)}function $a(e,s,n){const r=pe(e,n==null?void 0:n.in);return isNaN(s)?Oe((n==null?void 0:n.in)||e,NaN):(s&&r.setDate(r.getDate()+s),r)}function nd(e,s,n){const r=pe(e,n==null?void 0:n.in);if(isNaN(s))return Oe((n==null?void 0:n.in)||e,NaN);if(!s)return r;const a=r.getDate(),o=Oe((n==null?void 0:n.in)||e,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 Dx={};function tn(){return Dx}function Bs(e,s){var l,d,c,u;const n=tn(),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(e,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 jn(e,s){return Bs(e,{...s,weekStartsOn:1})}function rd(e,s){const n=pe(e,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=jn(a),i=Oe(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=jn(i);return n.getTime()>=o.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function tr(e){const s=pe(e),n=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return n.setUTCFullYear(s.getFullYear()),+e-+n}function Jt(e,...s){const n=Oe.bind(null,e||s.find(r=>typeof r=="object"));return s.map(n)}function wn(e,s){const n=pe(e,s==null?void 0:s.in);return n.setHours(0,0,0,0),n}function Ra(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s),o=wn(r),i=wn(a),l=+o-tr(o),d=+i-tr(i);return Math.round((l-d)/Mx)}function _x(e,s){const n=rd(e,s),r=Oe(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),jn(r)}function Ex(e,s,n){return $a(e,s*7,n)}function Ox(e,s,n){return nd(e,s*12,n)}function Tx(e,s){let n,r=s==null?void 0:s.in;return e.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 Px(e,s){let n,r=s==null?void 0:s.in;return e.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 Zn(e,s){const n=+pe(e)-+pe(s);return n<0?-1:n>0?1:n}function Ia(e){return Oe(e,Date.now())}function Fa(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s);return+wn(r)==+wn(a)}function ad(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Ax(e){return!(!ad(e)&&typeof e!="number"||isNaN(+pe(e)))}function za(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s),o=r.getFullYear()-a.getFullYear(),i=r.getMonth()-a.getMonth();return o*12+i}function $x(e){return s=>{const r=(e?Math[e]:Math.trunc)(s);return r===0?0:r}}function Rx(e,s){return+pe(e)-+pe(s)}function Ix(e,s){const n=pe(e,s==null?void 0:s.in);return n.setHours(23,59,59,999),n}function od(e,s){const n=pe(e,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 Fx(e,s){const n=pe(e,s==null?void 0:s.in);return+Ix(n,s)==+od(n,s)}function zx(e,s,n){const[r,a,o]=Jt(n==null?void 0:n.in,e,e,s),i=Zn(a,o),l=Math.abs(za(a,o));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-i*l);let d=Zn(a,o)===-i;Fx(r)&&l===1&&Zn(r,o)===1&&(d=!1);const c=i*(l-+d);return c===0?0:c}function Wx(e,s,n){const r=Rx(e,s)/1e3;return $x(n==null?void 0:n.roundingMethod)(r)}function id(e,s){const[n,r]=Jt(e,s.start,s.end);return{start:n,end:r}}function qx(e,s){const{start:n,end:r}=id(s==null?void 0:s.in,e);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 Bx(e,s){const n=pe(e,s==null?void 0:s.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Yx(e,s){const n=pe(e,s==null?void 0:s.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function ld(e,s){const n=pe(e,s==null?void 0:s.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Lx(e,s){const{start:n,end:r}=id(s==null?void 0:s.in,e);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 dd(e,s){var l,d,c,u;const n=tn(),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(e,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 Hx(e,s){return dd(e,{...s,weekStartsOn:1})}const Ux={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"}},Kx=(e,s,n)=>{let r;const a=Ux[e];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 zr(e){return(s={})=>{const n=s.width?String(s.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Vx={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Gx={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Qx={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Xx={date:zr({formats:Vx,defaultWidth:"full"}),time:zr({formats:Gx,defaultWidth:"full"}),dateTime:zr({formats:Qx,defaultWidth:"full"})},Jx={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Zx=(e,s,n,r)=>Jx[e];function xn(e){return(s,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):i;a=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(s):s;return a[o]}}const ep={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},tp={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},sp={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"]},np={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"]},rp={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"}},ap={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"}},op=(e,s)=>{const n=Number(e),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"},ip={ordinalNumber:op,era:xn({values:ep,defaultWidth:"wide"}),quarter:xn({values:tp,defaultWidth:"wide",argumentCallback:e=>e-1}),month:xn({values:sp,defaultWidth:"wide"}),day:xn({values:np,defaultWidth:"wide"}),dayPeriod:xn({values:rp,defaultWidth:"wide",formattingValues:ap,defaultFormattingWidth:"wide"})};function pn(e){return(s,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=s.match(a);if(!o)return null;const i=o[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?dp(l,f=>f.test(i)):lp(l,f=>f.test(i));let c;c=e.valueCallback?e.valueCallback(d):d,c=n.valueCallback?n.valueCallback(c):c;const u=s.slice(i.length);return{value:c,rest:u}}}function lp(e,s){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&s(e[n]))return n}function dp(e,s){for(let n=0;n<e.length;n++)if(s(e[n]))return n}function cp(e){return(s,n={})=>{const r=s.match(e.matchPattern);if(!r)return null;const a=r[0],o=s.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const l=s.slice(a.length);return{value:i,rest:l}}}const up=/^(\d+)(th|st|nd|rd)?/i,mp=/\d+/i,fp={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},hp={any:[/^b/i,/^(a|c)/i]},xp={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},pp={any:[/1/i,/2/i,/3/i,/4/i]},gp={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},bp={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]},yp={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},vp={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]},jp={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},wp={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}},Np={ordinalNumber:cp({matchPattern:up,parsePattern:mp,valueCallback:e=>parseInt(e,10)}),era:pn({matchPatterns:fp,defaultMatchWidth:"wide",parsePatterns:hp,defaultParseWidth:"any"}),quarter:pn({matchPatterns:xp,defaultMatchWidth:"wide",parsePatterns:pp,defaultParseWidth:"any",valueCallback:e=>e+1}),month:pn({matchPatterns:gp,defaultMatchWidth:"wide",parsePatterns:bp,defaultParseWidth:"any"}),day:pn({matchPatterns:yp,defaultMatchWidth:"wide",parsePatterns:vp,defaultParseWidth:"any"}),dayPeriod:pn({matchPatterns:jp,defaultMatchWidth:"any",parsePatterns:wp,defaultParseWidth:"any"})},ds={code:"en-US",formatDistance:Kx,formatLong:Xx,formatRelative:Zx,localize:ip,match:Np,options:{weekStartsOn:0,firstWeekContainsDate:1}};function kp(e,s){const n=pe(e,s==null?void 0:s.in);return Ra(n,ld(n))+1}function Wa(e,s){const n=pe(e,s==null?void 0:s.in),r=+jn(n)-+_x(n);return Math.round(r/sd)+1}function cd(e,s){var u,f,m,h;const n=pe(e,s==null?void 0:s.in),r=n.getFullYear(),a=tn(),o=(s==null?void 0:s.firstWeekContainsDate)??((f=(u=s==null?void 0:s.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??a.firstWeekContainsDate??((h=(m=a.locale)==null?void 0:m.options)==null?void 0:h.firstWeekContainsDate)??1,i=Oe((s==null?void 0:s.in)||e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const l=Bs(i,s),d=Oe((s==null?void 0:s.in)||e,0);d.setFullYear(r,0,o),d.setHours(0,0,0,0);const c=Bs(d,s);return+n>=+l?r+1:+n>=+c?r:r-1}function Sp(e,s){var l,d,c,u;const n=tn(),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=cd(e,s),o=Oe((s==null?void 0:s.in)||e,0);return o.setFullYear(a,0,r),o.setHours(0,0,0,0),Bs(o,s)}function qa(e,s){const n=pe(e,s==null?void 0:s.in),r=+Bs(n,s)-+Sp(n,s);return Math.round(r/sd)+1}function ye(e,s){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(s,"0");return n+r}const Bt={y(e,s){const n=e.getFullYear(),r=n>0?n:1-n;return ye(s==="yy"?r%100:r,s.length)},M(e,s){const n=e.getMonth();return s==="M"?String(n+1):ye(n+1,2)},d(e,s){return ye(e.getDate(),s.length)},a(e,s){const n=e.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(e,s){return ye(e.getHours()%12||12,s.length)},H(e,s){return ye(e.getHours(),s.length)},m(e,s){return ye(e.getMinutes(),s.length)},s(e,s){return ye(e.getSeconds(),s.length)},S(e,s){const n=s.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return ye(a,s.length)}},Es={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Oo={G:function(e,s,n){const r=e.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(e,s,n){if(s==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Bt.y(e,s)},Y:function(e,s,n,r){const a=cd(e,r),o=a>0?a:1-a;if(s==="YY"){const i=o%100;return ye(i,2)}return s==="Yo"?n.ordinalNumber(o,{unit:"year"}):ye(o,s.length)},R:function(e,s){const n=rd(e);return ye(n,s.length)},u:function(e,s){const n=e.getFullYear();return ye(n,s.length)},Q:function(e,s,n){const r=Math.ceil((e.getMonth()+1)/3);switch(s){case"Q":return String(r);case"QQ":return ye(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(e,s,n){const r=Math.ceil((e.getMonth()+1)/3);switch(s){case"q":return String(r);case"qq":return ye(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(e,s,n){const r=e.getMonth();switch(s){case"M":case"MM":return Bt.M(e,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(e,s,n){const r=e.getMonth();switch(s){case"L":return String(r+1);case"LL":return ye(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(e,s,n,r){const a=qa(e,r);return s==="wo"?n.ordinalNumber(a,{unit:"week"}):ye(a,s.length)},I:function(e,s,n){const r=Wa(e);return s==="Io"?n.ordinalNumber(r,{unit:"week"}):ye(r,s.length)},d:function(e,s,n){return s==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Bt.d(e,s)},D:function(e,s,n){const r=kp(e);return s==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ye(r,s.length)},E:function(e,s,n){const r=e.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(e,s,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(s){case"e":return String(o);case"ee":return ye(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(e,s,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(s){case"c":return String(o);case"cc":return ye(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(e,s,n){const r=e.getDay(),a=r===0?7:r;switch(s){case"i":return String(a);case"ii":return ye(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(e,s,n){const a=e.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(e,s,n){const r=e.getHours();let a;switch(r===12?a=Es.noon:r===0?a=Es.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(e,s,n){const r=e.getHours();let a;switch(r>=17?a=Es.evening:r>=12?a=Es.afternoon:r>=4?a=Es.morning:a=Es.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(e,s,n){if(s==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Bt.h(e,s)},H:function(e,s,n){return s==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Bt.H(e,s)},K:function(e,s,n){const r=e.getHours()%12;return s==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ye(r,s.length)},k:function(e,s,n){let r=e.getHours();return r===0&&(r=24),s==="ko"?n.ordinalNumber(r,{unit:"hour"}):ye(r,s.length)},m:function(e,s,n){return s==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Bt.m(e,s)},s:function(e,s,n){return s==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Bt.s(e,s)},S:function(e,s){return Bt.S(e,s)},X:function(e,s,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(s){case"X":return Po(r);case"XXXX":case"XX":return is(r);case"XXXXX":case"XXX":default:return is(r,":")}},x:function(e,s,n){const r=e.getTimezoneOffset();switch(s){case"x":return Po(r);case"xxxx":case"xx":return is(r);case"xxxxx":case"xxx":default:return is(r,":")}},O:function(e,s,n){const r=e.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+To(r,":");case"OOOO":default:return"GMT"+is(r,":")}},z:function(e,s,n){const r=e.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+To(r,":");case"zzzz":default:return"GMT"+is(r,":")}},t:function(e,s,n){const r=Math.trunc(+e/1e3);return ye(r,s.length)},T:function(e,s,n){return ye(+e,s.length)}};function To(e,s=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return o===0?n+String(a):n+String(a)+s+ye(o,2)}function Po(e,s){return e%60===0?(e>0?"-":"+")+ye(Math.abs(e)/60,2):is(e,s)}function is(e,s=""){const n=e>0?"-":"+",r=Math.abs(e),a=ye(Math.trunc(r/60),2),o=ye(r%60,2);return n+a+s+o}const Ao=(e,s)=>{switch(e){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"})}},ud=(e,s)=>{switch(e){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"})}},Cp=(e,s)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return Ao(e,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}}",Ao(r,s)).replace("{{time}}",ud(a,s))},Mp={p:ud,P:Cp},Dp=/^D+$/,_p=/^Y+$/,Ep=["D","DD","YY","YYYY"];function Op(e){return Dp.test(e)}function Tp(e){return _p.test(e)}function Pp(e,s,n){const r=Ap(e,s,n);if(console.warn(r),Ep.includes(e))throw new RangeError(r)}function Ap(e,s,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${s}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const $p=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Rp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Ip=/^'([^]*?)'?$/,Fp=/''/g,zp=/[a-zA-Z]/;function oe(e,s,n){var u,f,m,h,g,y,S,b;const r=tn(),a=(n==null?void 0:n.locale)??r.locale??ds,o=(n==null?void 0:n.firstWeekContainsDate)??((f=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((h=(m=r.locale)==null?void 0:m.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(e,n==null?void 0:n.in);if(!Ax(l))throw new RangeError("Invalid time value");let d=s.match(Rp).map(N=>{const w=N[0];if(w==="p"||w==="P"){const j=Mp[w];return j(N,a.formatLong)}return N}).join("").match($p).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const w=N[0];if(w==="'")return{isToken:!1,value:Wp(N)};if(Oo[w])return{isToken:!0,value:N};if(w.match(zp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:N}});a.localize.preprocessor&&(d=a.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return d.map(N=>{if(!N.isToken)return N.value;const w=N.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Tp(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Op(w))&&Pp(w,s,String(e));const j=Oo[w[0]];return j(l,w,a.localize,c)}).join("")}function Wp(e){const s=e.match(Ip);return s?s[1].replace(Fp,"'"):e}function qp(e,s,n){const r=tn(),a=(n==null?void 0:n.locale)??r.locale??ds,o=2520,i=Zn(e,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]=Jt(n==null?void 0:n.in,...i>0?[s,e]:[e,s]),u=Wx(c,d),f=(tr(c)-tr(d))/1e3,m=Math.round((u-f)/60);let h;if(m<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):m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<_o){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}else{if(m<o)return a.formatDistance("xDays",1,l);if(m<Qn){const g=Math.round(m/_o);return a.formatDistance("xDays",g,l)}else if(m<Qn*2)return h=Math.round(m/Qn),a.formatDistance("aboutXMonths",h,l)}if(h=zx(c,d),h<12){const g=Math.round(m/Qn);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 Bp(e,s){return qp(e,Ia(e),s)}function Yp(e,s){const n=pe(e,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 Lp(e,s){return pe(e,s==null?void 0:s.in).getMonth()}function Hp(e,s){return pe(e,s==null?void 0:s.in).getFullYear()}function Up(e,s){return+pe(e)>+pe(s)}function Kp(e,s){return+pe(e)<+pe(s)}function Vp(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function Gp(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s);return r.getFullYear()===a.getFullYear()}function Qp(e,s){return Fa(Oe(e,e),Ia(e))}function Xp(e,s,n){return $a(e,-1,n)}function Jp(e,s){return Fa(Oe(e,e),Xp(Ia(e)))}function Zp(e,s,n){const r=pe(e,n==null?void 0:n.in),a=r.getFullYear(),o=r.getDate(),i=Oe(e,0);i.setFullYear(a,s,15),i.setHours(0,0,0,0);const l=Yp(i);return r.setMonth(s,Math.min(o,l)),r}function eg(e,s,n){const r=pe(e,n==null?void 0:n.in);return isNaN(+r)?Oe(e,NaN):(r.setFullYear(s),r)}function tg(){const[e,s]=x.useState(!1),[n,r]=x.useState(null),[a,o]=x.useState(""),{workspace:i}=Ge(),{data:l,isLoading:d}=Tn(),c=Gf(),u=Ue(),f=(l??[]).filter(m=>!a||m.name.toLowerCase().includes(a.toLowerCase())||m.identifier.toLowerCase().includes(a.toLowerCase()));return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),t.jsxs(K,{size:"sm",onClick:()=>s(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create"]})]}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(K,{variant:"outline",size:"sm",className:"text-xs h-8",children:"Add filter"})}),t.jsxs("div",{className:"relative",children:[t.jsx(ur,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),t.jsx(xe,{placeholder:"Search...",value:a,onChange:m=>o(m.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),t.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),t.jsx("span",{})]}),d?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(m=>t.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[t.jsx(te,{className:"h-4 w-48"}),t.jsx(te,{className:"h-4 w-12"}),t.jsx(te,{className:"h-5 w-16 rounded-full"}),t.jsx(te,{className:"h-4 w-24"}),t.jsx("div",{})]},m))}):f.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xt,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:a?"No projects match":"No projects yet"}),t.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&&t.jsxs(K,{size:"sm",onClick:()=>s(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create project"]})]}):t.jsx("div",{className:"divide-y divide-border",children:f.map(m=>t.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/${m.identifier}/board`),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:m.name}),m.description&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:m.description})]}),t.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:m.identifier}),t.jsx("div",{children:t.jsxs("span",{className:O("inline-flex items-center gap-1.5 text-xs",m.status==="active"&&"text-emerald-600",m.status==="paused"&&"text-amber-600",m.status==="archived"&&"text-muted-foreground"),children:[t.jsx("span",{className:O("h-1.5 w-1.5 rounded-full shrink-0",m.status==="active"&&"bg-emerald-500",m.status==="paused"&&"bg-amber-500",m.status==="archived"&&"bg-zinc-400")}),m.status.charAt(0).toUpperCase()+m.status.slice(1)]})}),t.jsx("span",{className:"text-sm text-muted-foreground",children:oe(new Date(m.created_at),"MMM d, yyyy")}),t.jsx("div",{className:"flex justify-end",onClick:h=>h.stopPropagation(),children:t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Dn,{className:"h-4 w-4"})})}),t.jsxs(Xt,{align:"end",children:[t.jsxs(Je,{onClick:()=>u(`/${i}/projects/${m.identifier}/board`),children:[t.jsx(xt,{className:"h-4 w-4"}),"Open board"]}),t.jsxs(Je,{onClick:()=>u(`/${i}/projects/${m.identifier}/issues`),children:[t.jsx(Qs,{className:"h-4 w-4"}),"View issues"]}),t.jsxs(Je,{onClick:()=>r({id:m.id,name:m.name}),children:[t.jsx(lr,{className:"h-4 w-4"}),"Manage access"]}),t.jsx(Pn,{}),t.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${m.name}"? This cannot be undone.`)&&c.mutate(m.id,{onSuccess:()=>R.success("Project deleted"),onError:()=>R.error("Failed to delete project")})},children:[t.jsx(Tt,{className:"h-4 w-4"}),"Delete"]})]})]})})]},m.id))}),!d&&f.length>0&&t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[t.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",f.length," of ",f.length," result",f.length!==1?"s":""]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx("span",{children:"1 of 1 pages"}),t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),t.jsx(Nx,{open:e,onClose:()=>s(!1)}),n&&t.jsx(Cx,{open:!!n,onClose:()=>r(null),projectId:n.id,projectName:n.name})]})}const Ba={byProject:e=>["projects",e,"statuses"]};function sn(e){return Ne({queryKey:Ba.byProject(e??""),queryFn:()=>J.get(`/admin/projects/${e}/statuses`),select:s=>s.statuses,enabled:!!e})}function sg(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/projects/${e}/statuses`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ba.byProject(e)})}})}function ng(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Ba.byProject(e)})}})}const Ya={all:["users"],list:()=>[...Ya.all,"list"]};function rg(){return Ne({queryKey:Ya.list(),queryFn:()=>J.get("/admin/users"),select:e=>e.users,staleTime:1e3*60*5})}function md(){return Ne({queryKey:[...Ya.list(),"map"],queryFn:()=>J.get("/admin/users"),select:e=>new Map(e.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 bs={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},Ot={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},fd={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Kt={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},ag=({priority:e})=>{const s=O("h-3 w-3 shrink-0",fd[e]);switch(e){case"urgent":return t.jsx(Xs,{className:s});case"high":return t.jsx(ir,{className:s});case"medium":return t.jsx(En,{className:s});case"low":return t.jsx(or,{className:s});default:return t.jsx(Nt,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function hd({issue:e,onClick:s}){var u,f;const{data:n}=md(),{attributes:r,listeners:a,setNodeRef:o,transform:i,transition:l,isDragging:d}=la({id:e.id}),c={transform:da.Transform.toString(i),transition:l};return t.jsxs("div",{ref:o,style:c,...r,...a,onClick:s,className:O("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",d&&"opacity-40 shadow-lg ring-2 ring-indigo/30"),children:[t.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:e.identifier}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&t.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(m=>{const h=n==null?void 0:n.get(m);return t.jsx(at,{className:"h-4 w-4 border border-background",children:t.jsx(ot,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(h==null?void 0:h.initials)??"?"})},m)}),(((u=e.assignee_ids)==null?void 0:u.length)??0)>2&&t.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((f=e.assignee_ids)==null?void 0:f.length)??0)-2]})]}),t.jsx(ag,{priority:e.priority})]})]})]})}function Wr(e,s){const n=e.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 og=({category:e,color:s})=>{const n="h-3.5 w-3.5 shrink-0",r={color:s};switch(e){case"completed":return t.jsx(js,{className:n,style:r});case"started":return t.jsx(Qt,{className:n,style:r});default:return t.jsx(Nt,{className:n,style:r})}};function ig({id:e,label:s,color:n,category:r,issues:a,sortable:o,onIssueClick:i}){const{setNodeRef:l,isOver:d}=zc({id:e}),{attributes:c,listeners:u,setNodeRef:f,transform:m,transition:h,isDragging:g}=la({id:e,disabled:!o}),y=o?{transform:da.Transform.toString(m),transition:h}:void 0,S=Wr(n,.08),b=Wr(n,.16),N=Wr(n,.35);return t.jsxs("div",{ref:f,style:y,className:O("flex flex-col min-w-[260px] max-w-[280px] w-full",g&&"opacity-50"),children:[t.jsxs("div",{className:O("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&t.jsx("span",{...c,...u,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:t.jsx(ml,{className:"h-3.5 w-3.5"})}),t.jsx(og,{category:r,color:n}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:s}),t.jsx("span",{className:"ml-1 text-[11px] text-muted-foreground bg-muted rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",children:a.length})]}),t.jsxs("div",{ref:l,className:O("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:d?b:S,boxShadow:d?`inset 0 0 0 1px ${N}`:void 0},children:[t.jsx(ia,{items:a.map(w=>w.id),strategy:Wc,children:a.map(w=>t.jsx(hd,{issue:w,onClick:()=>i==null?void 0:i(w)},w.id))}),a.length===0&&t.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:t.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const qr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],lg=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function dg({open:e,onClose:s,projectId:n}){const[r,a]=x.useState(""),[o,i]=x.useState(qr[0]),[l,d]=x.useState(""),[c,u]=x.useState("started"),f=sg(n),m=l||o,h=()=>{r.trim()&&f.mutate({name:r.trim(),color:m,category:c},{onSuccess:()=>{R.success("Status created"),a(""),i(qr[0]),d(""),u("started"),s()},onError:()=>R.error("Failed to create status")})};return t.jsx(Ss,{open:e,onOpenChange:g=>!g&&s(),children:t.jsxs(Cs,{className:"sm:max-w-sm",children:[t.jsx(Js,{children:t.jsx(en,{className:"text-sm font-medium",children:"New Status"})}),t.jsx(Zs,{children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),t.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"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[qr.map(g=>t.jsx("button",{onClick:()=>{i(g),d("")},className:O("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)),t.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[t.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),t.jsx(xe,{placeholder:"#hex",value:l,onChange:g=>d(g.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),t.jsxs(we,{value:c,onValueChange:g=>u(g),children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:lg.map(g=>t.jsx(de,{value:g.value,className:"text-xs",children:g.label},g.value))})]})]})]})}),t.jsxs(Fn,{className:"mt-2",children:[t.jsx(K,{variant:"ghost",size:"sm",onClick:s,className:"text-xs",children:"Cancel"}),t.jsx(K,{size:"sm",onClick:h,disabled:!r.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function cg({projectId:e}){const[s,n]=x.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:t.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:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Add status"]})}),t.jsx(dg,{open:s,onClose:()=>n(!1),projectId:e})]})}function Br(e,s){var r;const n={};for(const a of s)n[a.key]=[];for(const a of e)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 ug(e,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 e[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 mg({issues:e,projectId:s,statuses:n,onIssueClick:r,onColumnsReorder:a}){const[o,i]=x.useState(()=>n.map(D=>D.id)),[l,d]=x.useState(()=>Br(e,n)),[c,u]=x.useState(null),[f,m]=x.useState(null),h=x.useRef(null),g=x.useRef(!1),y=me();x.useEffect(()=>{g.current||d(D=>ug(D,e,n))},[e,n]);const S=[...n].sort((D,_)=>{const I=o.indexOf(D.id),$=o.indexOf(_.id);return I===-1&&$===-1?D.position-_.position:I===-1?1:$===-1?-1:I-$}),b=Di(_i(Ei,{activationConstraint:{distance:5}})),N=x.useCallback(D=>{if(f){const _=D.droppableContainers.filter(I=>o.includes(I.id));return qc({...D,droppableContainers:_})}return Bc(D)},[f,o]),w=x.useCallback(D=>{for(const[_,I]of Object.entries(l))if(I.some($=>$.id===D))return _;return null},[l]),j=x.useCallback(D=>n.some(_=>_.id===D),[n]),E=D=>{const _=D.active.id;if(g.current=!0,j(_)){m(_);return}for(const[I,$]of Object.entries(l)){const F=$.find(T=>T.id===_);if(F){u(F),h.current=I;return}}},p=D=>{const{active:_,over:I}=D;if(!I||f)return;const $=_.id,F=I.id;if(j($))return;const T=w($),X=n.find(V=>V.key===F||V.id===F),q=(X==null?void 0:X.key)??w(F);!T||!q||T===q||d(V=>{const W=[...V[T]??[]],z=[...V[q]??[]],Q=W.findIndex(M=>M.id===$);if(Q===-1)return V;const[ee]=W.splice(Q,1),k={...ee,status:q};if(X)z.push(k);else{const M=z.findIndex(Y=>Y.id===F);if(M===-1)z.push(k);else{const Y=_.rect.current.translated!=null&&_.rect.current.translated.top>I.rect.top+I.rect.height/2;z.splice(Y?M+1:M,0,k)}}return{...V,[T]:W,[q]:z}})},C=D=>{var V;const{active:_,over:I}=D;if(u(null),g.current=!1,f){if(m(null),!I||_.id===I.id)return;const W=o.indexOf(_.id),z=o.indexOf(I.id);if(W===-1||z===-1||W===z)return;const Q=Jn(o,W,z);i(Q),a==null||a(Q);return}if(!I){const W=h.current;h.current=null,W&&d(Br(e,n));return}const $=_.id,F=I.id,T=h.current;h.current=null;const X=n.find(W=>W.key===F||W.id===F),q=(X==null?void 0:X.key)??w(F);if(!(!T||!q))if(T===q)d(W=>{const z=W[T]??[],Q=z.findIndex(k=>k.id===$),ee=z.findIndex(k=>k.id===F);return Q===-1||ee===-1||Q===ee?W:{...W,[T]:Jn(z,Q,ee)}});else{if(!n.find(Q=>Q.key===F||Q.id===F))d(Q=>{const ee=[...Q[q]??[]],k=ee.findIndex(P=>P.id===$);if(k===-1)return Q;const M=D.active.rect.current.translated!=null&&D.active.rect.current.translated.top>D.over.rect.top+D.over.rect.height/2,[Y]=ee.splice(k,1),L=ee.findIndex(P=>P.id===F);if(L===-1)return ee.splice(k,0,Y),Q;const ae=M?L+1:L;return ee.splice(ae,0,Y),{...Q,[q]:ee}});else{const Q=((V=D.active.rect.current.translated)==null?void 0:V.top)??1/0,ee=D.over.rect.top+D.over.rect.height/2;Q<ee&&d(k=>{const M=k[q]??[],Y=M.findIndex(L=>L.id===$);return Y<=0?k:{...k,[q]:Jn(M,Y,0)}})}const z=y.getQueryData(Pe.byProject(s));y.setQueryData(Pe.byProject(s),Q=>Q&&{...Q,issues:Q.issues.map(ee=>ee.id===$?{...ee,status:q}:ee)}),J.put(`/admin/issues/${$}`,{status:q}).then(()=>{y.invalidateQueries({queryKey:Pe.byProject(s)})}).catch(()=>{z&&y.setQueryData(Pe.byProject(s),z),d(Br((z==null?void 0:z.issues)??e,n)),R.error("Failed to update issue status")})}},A=f?n.find(D=>D.id===f):null;return t.jsxs(Oi,{sensors:b,collisionDetection:N,onDragStart:E,onDragOver:p,onDragEnd:C,children:[t.jsxs("div",{className:"flex gap-4 h-full overflow-x-auto px-6 py-4 pb-6",children:[t.jsx(ia,{items:o,strategy:Ti,children:S.map(D=>t.jsx(ig,{id:D.id,label:D.name,color:D.color,category:D.category,issues:l[D.key]??[],sortable:!0,onIssueClick:r},D.id))}),t.jsx(cg,{projectId:s})]}),t.jsxs(Yc,{children:[c&&t.jsx(hd,{issue:c}),A&&t.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:t.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:[t.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:A.color}}),A.name]})})]})]})}const Ys={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function nn(e){return Ne({queryKey:e?Ys.byProject(e):Ys.all,queryFn:()=>{const s=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return J.get(s)},select:s=>s.sprints,enabled:!!e})}function fg(e){const s=me();return ce({mutationFn:n=>J.post("/admin/sprints",{...n,project_id:e}),onSuccess:()=>{s.invalidateQueries({queryKey:Ys.byProject(e)})}})}function hg(e,s){const n=me();return ce({mutationFn:r=>J.put(`/admin/sprints/${e}`,r),onSuccess:()=>{n.invalidateQueries({queryKey:Ys.byProject(s)}),n.invalidateQueries({queryKey:Ys.detail(e)})}})}function xg(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/sprints/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ys.byProject(e)})}})}const yr={byProject:e=>["task-lists","project",e]};function Wn(e){return Ne({queryKey:e?yr.byProject(e):["task-lists"],queryFn:()=>J.get(`/admin/projects/${e}/task-lists`),select:s=>s.task_lists,enabled:!!e})}function pg(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/projects/${e}/task-lists`,n),onSuccess:()=>{s.invalidateQueries({queryKey:yr.byProject(e)})}})}function gg(e){const s=me();return ce({mutationFn:({id:n,...r})=>J.put(`/admin/task-lists/${n}`,r),onSuccess:()=>{s.invalidateQueries({queryKey:yr.byProject(e)})}})}function bg(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/task-lists/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:yr.byProject(e)}),s.invalidateQueries({queryKey:Pe.byProject(e)})}})}const Ke=Oc,Ve=Tc,He=x.forwardRef(({className:e,align:s="center",sideOffset:n=4,...r},a)=>t.jsx(Ec,{children:t.jsx(Ni,{ref:a,align:s,sideOffset:n,className:O("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",e),...r})}));He.displayName=Ni.displayName;function $o(e,s,n){const r=(e==null?void 0:e[0])??"",a=(s==null?void 0:s[0])??"";return(r+a).toUpperCase()||((n==null?void 0:n[0])??"U").toUpperCase()}function Ro(e,s,n){return`${e??""} ${s??""}`.trim()||n}function qn({value:e,onChange:s,disabled:n}){const[r,a]=x.useState(!1),[o,i]=x.useState(e),{data:l}=rg(),d=e.slice().sort().join(",");x.useEffect(()=>{i(e)},[d]);const c=f=>{const m=o.includes(f)?o.filter(h=>h!==f):[...o,f];i(m),s(m)},u=(l??[]).filter(f=>o.includes(f.id));return t.jsxs(Ke,{open:r,onOpenChange:a,children:[t.jsx(Ve,{asChild:!0,disabled:n,children:t.jsx("button",{type:"button",className:O("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?t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(On,{className:"h-3.5 w-3.5"}),"Assign"]}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"flex -space-x-1.5",children:u.slice(0,3).map(f=>t.jsx(at,{className:"h-5 w-5 border border-background ring-0",children:t.jsx(ot,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:$o(f.first_name,f.last_name,f.email)})},f.id))}),u.length>3&&t.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",u.length-3]}),t.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:u.length===1?Ro(u[0].first_name,u[0].last_name,u[0].email):`${u.length} assignees`})]})})}),t.jsx(He,{className:"w-60 p-0",align:"start",children:t.jsxs(Fs,{children:[t.jsx(Ta,{placeholder:"Search users...",className:"h-8 text-xs"}),t.jsxs(zs,{children:[t.jsx(Pa,{className:"text-xs py-4",children:"No users found."}),t.jsx(hs,{children:(l??[]).map(f=>{const m=o.includes(f.id),h=Ro(f.first_name,f.last_name,f.email),g=$o(f.first_name,f.last_name,f.email);return t.jsxs(ut,{value:h,onSelect:()=>c(f.id),className:"gap-2 py-1.5",children:[t.jsx(at,{className:"h-5 w-5 shrink-0",children:t.jsx(ot,{className:"text-[9px] bg-muted text-muted-foreground",children:g})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs font-medium truncate",children:h}),t.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:f.email})]}),t.jsx(mt,{className:O("h-3.5 w-3.5 shrink-0",m?"opacity-100 text-indigo-500":"opacity-0")})]},f.id)})})]})]})})]})}function yg(e,s,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(s).split(/\s/g).slice(2).join(" ")}const Yr={},gn={};function cs(e,s){try{const r=(Yr[e]||(Yr[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(s).split("GMT")[1];return r in gn?gn[r]:Io(r,r.split(":"))}catch{if(e in gn)return gn[e];const n=e==null?void 0:e.match(vg);return n?Io(e,n.slice(1)):NaN}}const vg=/([+-]\d\d):?(\d\d)?/;function Io(e,s){const n=+(s[0]||0),r=+(s[1]||0),a=+(s[2]||0)/60;return gn[e]=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(cs(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)),xd(this),ra(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=-cs(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),ra(this),+this}[Symbol.for("constructDateFrom")](s){return new wt(+new Date(s),this.timeZone)}}const Fo=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Fo.test(e))return;const s=e.replace(Fo,"$1UTC");wt.prototype[s]&&(e.startsWith("get")?wt.prototype[e]=function(){return this.internal[s]()}:(wt.prototype[e]=function(){return Date.prototype[s].apply(this.internal,arguments),jg(this),+this},wt.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),ra(this),+this}))});function ra(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-cs(e.timeZone,e)*60))}function jg(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),xd(e)}function xd(e){const s=cs(e.timeZone,e),n=s>0?Math.floor(s):Math.ceil(s),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=a-o,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const d=a-n;d&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+d);const c=new Date(+e);c.setUTCSeconds(0);const u=a>0?c.getSeconds():(c.getSeconds()-60)%60,f=Math.round(-(cs(e.timeZone,e)*60))%60;(f||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+f+u));const m=cs(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),y=-new Date(+e).getTimezoneOffset()-h,S=h!==n,b=y-d;if(S&&b){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+b);const N=cs(e.timeZone,e),w=N>0?Math.floor(N):Math.ceil(N),j=h-w;j&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+j),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+j))}}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} (${yg(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 zo=5,wg=4;function Ng(e,s){const n=s.startOfMonth(e),r=n.getDay()>0?n.getDay():7,a=s.addDays(e,-r+1),o=s.addDays(a,zo*7-1);return s.getMonth(e)===s.getMonth(o)?zo:wg}function pd(e,s){const n=s.startOfMonth(e),r=n.getDay();return r===1?n:r===0?s.addDays(n,-1*6):s.addDays(n,-1*(r-1))}function kg(e,s){const n=pd(e,s),r=Ng(e,s);return s.addDays(n,r*7-1)}const gd={...ds,labels:{labelDayButton:(e,s,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>oe(i,l,{locale:ds,...n});let o=a(e,"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:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,s,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,o)=>oe(a,o,{locale:ds,...s}),r(e,"LLLL yyyy")},labelGridcell:(e,s,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>oe(i,l,{locale:ds,...n});let o=a(e,"PPPP");return s!=null&&s.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,s,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,o)=>oe(a,o,{locale:ds,...s}),r(e,"cccc")}}};class st{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):$a(r,a)},this.addMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addMonths?this.overrides.addMonths(r,a):nd(r,a)},this.addWeeks=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addWeeks?this.overrides.addWeeks(r,a):Ex(r,a)},this.addYears=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addYears?this.overrides.addYears(r,a):Ox(r,a)},this.differenceInCalendarDays=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):Ra(r,a)},this.differenceInCalendarMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):za(r,a)},this.eachMonthOfInterval=r=>{var a;return(a=this.overrides)!=null&&a.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):qx(r)},this.eachYearOfInterval=r=>{var l;const a=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Lx(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):kg(r,this)},this.endOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.endOfISOWeek?this.overrides.endOfISOWeek(r):Hx(r)},this.endOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.endOfMonth?this.overrides.endOfMonth(r):od(r)},this.endOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.endOfWeek?this.overrides.endOfWeek(r,a):dd(r,this.options)},this.endOfYear=r=>{var a;return(a=this.overrides)!=null&&a.endOfYear?this.overrides.endOfYear(r):Yx(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):Wa(r)},this.getMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getMonth?this.overrides.getMonth(r,this.options):Lp(r,this.options)},this.getYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getYear?this.overrides.getYear(r,this.options):Hp(r,this.options)},this.getWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getWeek?this.overrides.getWeek(r,this.options):qa(r,this.options)},this.isAfter=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isAfter?this.overrides.isAfter(r,a):Up(r,a)},this.isBefore=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isBefore?this.overrides.isBefore(r,a):Kp(r,a)},this.isDate=r=>{var a;return(a=this.overrides)!=null&&a.isDate?this.overrides.isDate(r):ad(r)},this.isSameDay=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameDay?this.overrides.isSameDay(r,a):Fa(r,a)},this.isSameMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameMonth?this.overrides.isSameMonth(r,a):Vp(r,a)},this.isSameYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameYear?this.overrides.isSameYear(r,a):Gp(r,a)},this.max=r=>{var a;return(a=this.overrides)!=null&&a.max?this.overrides.max(r):Tx(r)},this.min=r=>{var a;return(a=this.overrides)!=null&&a.min?this.overrides.min(r):Px(r)},this.setMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setMonth?this.overrides.setMonth(r,a):Zp(r,a)},this.setYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setYear?this.overrides.setYear(r,a):eg(r,a)},this.startOfBroadcastWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):pd(r,this)},this.startOfDay=r=>{var a;return(a=this.overrides)!=null&&a.startOfDay?this.overrides.startOfDay(r):wn(r)},this.startOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.startOfISOWeek?this.overrides.startOfISOWeek(r):jn(r)},this.startOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.startOfMonth?this.overrides.startOfMonth(r):Bx(r)},this.startOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfWeek?this.overrides.startOfWeek(r,this.options):Bs(r,this.options)},this.startOfYear=r=>{var a;return(a=this.overrides)!=null&&a.startOfYear?this.overrides.startOfYear(r):ld(r)},this.options={locale:gd,...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&&st.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&&st.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)}}st.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 st;class bd{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 Sg{constructor(s,n){this.date=s,this.weeks=n}}class Cg{constructor(s,n){this.days=n,this.weekNumber=s}}function Mg(e){return v.createElement("button",{...e})}function Dg(e){return v.createElement("span",{...e})}function _g(e){const{size:s=24,orientation:n="left",className:r}=e;return v.createElement("svg",{className:r,width:s,height:s,viewBox:"0 0 24 24"},n==="up"&&v.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&v.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&v.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&v.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Eg(e){const{day:s,modifiers:n,...r}=e;return v.createElement("td",{...r})}function Og(e){const{day:s,modifiers:n,...r}=e,a=v.useRef(null);return v.useEffect(()=>{var o;n.focused&&((o=a.current)==null||o.focus())},[n.focused]),v.createElement("button",{ref:a,...r})}var ne;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(ne||(ne={}));var _e;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(_e||(_e={}));var ft;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(ft||(ft={}));var et;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(et||(et={}));function Tg(e){const{options:s,className:n,components:r,classNames:a,...o}=e,i=[a[ne.Dropdown],n].join(" "),l=s==null?void 0:s.find(({value:d})=>d===o.value);return v.createElement("span",{"data-disabled":o.disabled,className:a[ne.DropdownRoot]},v.createElement(r.Select,{className:i,...o},s==null?void 0:s.map(({value:d,label:c,disabled:u})=>v.createElement(r.Option,{key:d,value:d,disabled:u},c))),v.createElement("span",{className:a[ne.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,v.createElement(r.Chevron,{orientation:"down",size:18,className:a[ne.Chevron]})))}function Pg(e){return v.createElement("div",{...e})}function Ag(e){return v.createElement("div",{...e})}function $g(e){const{calendarMonth:s,displayIndex:n,...r}=e;return v.createElement("div",{...r},e.children)}function Rg(e){const{calendarMonth:s,displayIndex:n,...r}=e;return v.createElement("div",{...r})}function Ig(e){return v.createElement("table",{...e})}function Fg(e){return v.createElement("div",{...e})}const yd=x.createContext(void 0);function Bn(){const e=x.useContext(yd);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function zg(e){const{components:s}=Bn();return v.createElement(s.Dropdown,{...e})}function Wg(e){const{onPreviousClick:s,onNextClick:n,previousMonth:r,nextMonth:a,...o}=e,{components:i,classNames:l,labels:{labelPrevious:d,labelNext:c}}=Bn(),u=x.useCallback(m=>{a&&(n==null||n(m))},[a,n]),f=x.useCallback(m=>{r&&(s==null||s(m))},[r,s]);return v.createElement("nav",{...o},v.createElement(i.PreviousMonthButton,{type:"button",className:l[ne.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:f},v.createElement(i.Chevron,{disabled:r?void 0:!0,className:l[ne.Chevron],orientation:"left"})),v.createElement(i.NextMonthButton,{type:"button",className:l[ne.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":c(a),onClick:u},v.createElement(i.Chevron,{disabled:a?void 0:!0,orientation:"right",className:l[ne.Chevron]})))}function qg(e){const{components:s}=Bn();return v.createElement(s.Button,{...e})}function Bg(e){return v.createElement("option",{...e})}function Yg(e){const{components:s}=Bn();return v.createElement(s.Button,{...e})}function Lg(e){const{rootRef:s,...n}=e;return v.createElement("div",{...n,ref:s})}function Hg(e){return v.createElement("select",{...e})}function Ug(e){const{week:s,...n}=e;return v.createElement("tr",{...n})}function Kg(e){return v.createElement("th",{...e})}function Vg(e){return v.createElement("thead",{"aria-hidden":!0},v.createElement("tr",{...e}))}function Gg(e){const{week:s,...n}=e;return v.createElement("th",{...n})}function Qg(e){return v.createElement("th",{...e})}function Xg(e){return v.createElement("tbody",{...e})}function Jg(e){const{components:s}=Bn();return v.createElement(s.Dropdown,{...e})}const Zg=Object.freeze(Object.defineProperty({__proto__:null,Button:Mg,CaptionLabel:Dg,Chevron:_g,Day:Eg,DayButton:Og,Dropdown:Tg,DropdownNav:Pg,Footer:Ag,Month:$g,MonthCaption:Rg,MonthGrid:Ig,Months:Fg,MonthsDropdown:zg,Nav:Wg,NextMonthButton:qg,Option:Bg,PreviousMonthButton:Yg,Root:Lg,Select:Hg,Week:Ug,WeekNumber:Gg,WeekNumberHeader:Qg,Weekday:Kg,Weekdays:Vg,Weeks:Xg,YearsDropdown:Jg},Symbol.toStringTag,{value:"Module"}));function _t(e,s,n=!1,r=kt){let{from:a,to:o}=e;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 La(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function vr(e){return!!(e&&typeof e=="object"&&"from"in e)}function Ha(e){return!!(e&&typeof e=="object"&&"after"in e)}function Ua(e){return!!(e&&typeof e=="object"&&"before"in e)}function vd(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function jd(e,s){return Array.isArray(e)&&e.every(s.isDate)}function Et(e,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(e,l);if(jd(l,n))return l.some(d=>a(e,d));if(vr(l))return _t(l,e,!1,n);if(vd(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(La(l)){const d=o(l.before,e),c=o(l.after,e),u=d>0,f=c<0;return i(l.before,l.after)?f&&u:u||f}return Ha(l)?o(e,l.after)>0:Ua(l)?o(l.before,e)>0:typeof l=="function"?l(e):!1})}function eb(e,s,n,r,a){const{disabled:o,hidden:i,modifiers:l,showOutsideDays:d,broadcastCalendar:c,today:u=a.today()}=s,{isSameDay:f,isSameMonth:m,startOfMonth:h,isBefore:g,endOfMonth:y,isAfter:S}=a,b=n&&h(n),N=r&&y(r),w={[_e.focused]:[],[_e.outside]:[],[_e.disabled]:[],[_e.hidden]:[],[_e.today]:[]},j={};for(const E of e){const{date:p,displayMonth:C}=E,A=!!(C&&!m(p,C)),D=!!(b&&g(p,b)),_=!!(N&&S(p,N)),I=!!(o&&Et(p,o,a)),$=!!(i&&Et(p,i,a))||D||_||!c&&!d&&A||c&&d===!1&&A,F=f(p,u);A&&w.outside.push(E),I&&w.disabled.push(E),$&&w.hidden.push(E),F&&w.today.push(E),l&&Object.keys(l).forEach(T=>{const X=l==null?void 0:l[T];X&&Et(p,X,a)&&(j[T]?j[T].push(E):j[T]=[E])})}return E=>{const p={[_e.focused]:!1,[_e.disabled]:!1,[_e.hidden]:!1,[_e.outside]:!1,[_e.today]:!1},C={};for(const A in w){const D=w[A];p[A]=D.some(_=>_===E)}for(const A in j)C[A]=j[A].some(D=>D===E);return{...p,...C}}}function tb(e,s,n={}){return Object.entries(e).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[ne.Day]])}function sb(e){return{...Zg,...e}}function nb(e){const s={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(s[n]=r)}),s}function rb(){const e={};for(const s in ne)e[ne[s]]=`rdp-${ne[s]}`;for(const s in _e)e[_e[s]]=`rdp-${_e[s]}`;for(const s in ft)e[ft[s]]=`rdp-${ft[s]}`;for(const s in et)e[et[s]]=`rdp-${et[s]}`;return e}function wd(e,s,n){return(n??new st(s)).formatMonthYear(e)}const ab=wd;function ob(e,s,n){return(n??new st(s)).format(e,"d")}function ib(e,s=kt){return s.format(e,"LLLL")}function lb(e,s,n){return(n??new st(s)).format(e,"cccccc")}function db(e,s=kt){return e<10?s.formatNumber(`0${e.toLocaleString()}`):s.formatNumber(`${e.toLocaleString()}`)}function cb(){return""}function Nd(e,s=kt){return s.format(e,"yyyy")}const ub=Nd,mb=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:wd,formatDay:ob,formatMonthCaption:ab,formatMonthDropdown:ib,formatWeekNumber:db,formatWeekNumberHeader:cb,formatWeekdayName:lb,formatYearCaption:ub,formatYearDropdown:Nd},Symbol.toStringTag,{value:"Module"}));function fb(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...mb,...e}}function Ka(e,s,n,r){let a=(r??new st(n)).format(e,"PPPP");return s.today&&(a=`Today, ${a}`),s.selected&&(a=`${a}, selected`),a}const hb=Ka;function Va(e,s,n){return(n??new st(s)).formatMonthYear(e)}const xb=Va;function kd(e,s,n,r){let a=(r??new st(n)).format(e,"PPPP");return s!=null&&s.today&&(a=`Today, ${a}`),a}function Sd(e){return"Choose the Month"}function Cd(){return""}const pb="Go to the Next Month";function Md(e,s){return pb}function Dd(e){return"Go to the Previous Month"}function _d(e,s,n){return(n??new st(s)).format(e,"cccc")}function Ed(e,s){return`Week ${e}`}function Od(e){return"Week Number"}function Td(e){return"Choose the Year"}const gb=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:xb,labelDay:hb,labelDayButton:Ka,labelGrid:Va,labelGridcell:kd,labelMonthDropdown:Sd,labelNav:Cd,labelNext:Md,labelPrevious:Dd,labelWeekNumber:Ed,labelWeekNumberHeader:Od,labelWeekday:_d,labelYearDropdown:Td},Symbol.toStringTag,{value:"Module"})),ct=(e,s,n)=>s||(n?typeof n=="function"?n:(...r)=>n:e);function bb(e,s){var r;const n=((r=s.locale)==null?void 0:r.labels)??{};return{...gb,...e??{},labelDayButton:ct(Ka,e==null?void 0:e.labelDayButton,n.labelDayButton),labelMonthDropdown:ct(Sd,e==null?void 0:e.labelMonthDropdown,n.labelMonthDropdown),labelNext:ct(Md,e==null?void 0:e.labelNext,n.labelNext),labelPrevious:ct(Dd,e==null?void 0:e.labelPrevious,n.labelPrevious),labelWeekNumber:ct(Ed,e==null?void 0:e.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:ct(Td,e==null?void 0:e.labelYearDropdown,n.labelYearDropdown),labelGrid:ct(Va,e==null?void 0:e.labelGrid,n.labelGrid),labelGridcell:ct(kd,e==null?void 0:e.labelGridcell,n.labelGridcell),labelNav:ct(Cd,e==null?void 0:e.labelNav,n.labelNav),labelWeekNumberHeader:ct(Od,e==null?void 0:e.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:ct(_d,e==null?void 0:e.labelWeekday,n.labelWeekday)}}function yb(e,s,n,r,a){const{startOfMonth:o,startOfYear:i,endOfYear:l,eachMonthOfInterval:d,getMonth:c}=a;return d({start:i(e),end:l(e)}).map(m=>{const h=r.formatMonthDropdown(m,a),g=c(m),y=s&&m<o(s)||n&&m>o(n)||!1;return{value:g,label:h,disabled:y}})}function vb(e,s={},n={}){let r={...s==null?void 0:s[ne.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n==null?void 0:n[a]}}),r}function jb(e,s,n,r){const a=r??e.today(),o=n?e.startOfBroadcastWeek(a,e):s?e.startOfISOWeek(a):e.startOfWeek(a),i=[];for(let l=0;l<7;l++){const d=e.addDays(o,l);i.push(d)}return i}function wb(e,s,n,r,a=!1){if(!e||!s)return;const{startOfYear:o,endOfYear:i,eachYearOfInterval:l,getYear:d}=r,c=o(e),u=i(s),f=l({start:c,end:u});return a&&f.reverse(),f.map(m=>{const h=n.formatYearDropdown(m,r);return{value:d(m),label:h,disabled:!1}})}function Nb(e,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,e)},i=d=>{const c=o(d);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>o(Le.tz(e)),newDate:(d,c,u)=>new Le(d,c,u,12,0,0,e),startOfDay:d=>o(d),startOfWeek:(d,c)=>{const u=o(d),f=(c==null?void 0:c.weekStartsOn)??a,m=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-m),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),f=[],m=new Le(c.getFullYear(),c.getMonth(),1,12,0,0,e),h=u.getFullYear()*12+u.getMonth();for(;m.getFullYear()*12+m.getMonth()<=h;)f.push(new Le(m,e)),m.setMonth(m.getMonth()+1,1);return f},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),f=[],m=new Le(c.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new Le(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(d,c)=>{var f;const u=i(d);return qa(u,{weekStartsOn:(c==null?void 0:c.weekStartsOn)??a,firstWeekContainsDate:(c==null?void 0:c.firstWeekContainsDate)??((f=r==null?void 0:r.options)==null?void 0:f.firstWeekContainsDate)??1})},getISOWeek:d=>{const c=i(d);return Wa(c)},differenceInCalendarDays:(d,c)=>{const u=i(d),f=i(c);return Ra(u,f)},differenceInCalendarMonths:(d,c)=>{const u=i(d),f=i(c);return za(u,f)}}}const Yn=e=>e instanceof HTMLElement?e:null,Lr=e=>[...e.querySelectorAll("[data-animated-month]")??[]],kb=e=>Yn(e.querySelector("[data-animated-month]")),Hr=e=>Yn(e.querySelector("[data-animated-caption]")),Ur=e=>Yn(e.querySelector("[data-animated-weeks]")),Sb=e=>Yn(e.querySelector("[data-animated-nav]")),Cb=e=>Yn(e.querySelector("[data-animated-weekdays]"));function Mb(e,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||!e.current||!(e.current instanceof HTMLElement)||r.length===0||c.length===0||r.length!==c.length)return;const u=o.isSameMonth(r[0].date,c[0].date),f=o.isAfter(r[0].date,c[0].date),m=f?n[et.caption_after_enter]:n[et.caption_before_enter],h=f?n[et.weeks_after_enter]:n[et.weeks_before_enter],g=i.current,y=e.current.cloneNode(!0);if(y instanceof HTMLElement?(Lr(y).forEach(w=>{if(!(w instanceof HTMLElement))return;const j=kb(w);j&&w.contains(j)&&w.removeChild(j);const E=Hr(w);E&&E.classList.remove(m);const p=Ur(w);p&&p.classList.remove(h)}),i.current=y):i.current=null,d.current||u||a)return;const S=g instanceof HTMLElement?Lr(g):[],b=Lr(e.current);if(b!=null&&b.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){d.current=!0,e.current.style.isolation="isolate";const N=Sb(e.current);N&&(N.style.zIndex="1"),b.forEach((w,j)=>{const E=S[j];if(!E)return;w.style.position="relative",w.style.overflow="hidden";const p=Hr(w);p&&p.classList.add(m);const C=Ur(w);C&&C.classList.add(h);const A=()=>{d.current=!1,e.current&&(e.current.style.isolation=""),N&&(N.style.zIndex=""),p&&p.classList.remove(m),C&&C.classList.remove(h),w.style.position="",w.style.overflow="",w.contains(E)&&w.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const D=Cb(E);D&&(D.style.opacity="0");const _=Hr(E);_&&(_.classList.add(f?n[et.caption_before_exit]:n[et.caption_after_exit]),_.addEventListener("animationend",A));const I=Ur(E);I&&I.classList.add(f?n[et.weeks_before_exit]:n[et.weeks_after_exit]),w.insertBefore(E,w.firstChild)})}})}function Db(e,s,n,r){const a=e[0],o=e[e.length-1],{ISOWeek:i,fixedWeeks:l,broadcastCalendar:d}=n??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:m,endOfISOWeek:h,endOfMonth:g,endOfWeek:y,isAfter:S,startOfBroadcastWeek:b,startOfISOWeek:N,startOfWeek:w}=r,j=d?b(a,r):i?N(a):w(a),E=d?m(o):i?h(g(o)):y(g(o)),p=s&&(d?m(s):i?h(s):y(s)),C=p&&S(E,p)?p:E,A=u(C,j),D=f(o,a)+1,_=[];for(let F=0;F<=A;F++){const T=c(j,F);_.push(T)}const $=(d?35:42)*D;if(l&&_.length<$){const F=$-_.length;for(let T=0;T<F;T++){const X=c(_[_.length-1],1);_.push(X)}}return _}function _b(e){const s=[];return e.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 Eb(e,s,n,r){const{numberOfMonths:a=1}=n,o=[];for(let i=0;i<a;i++){const l=r.addMonths(e,i);if(s&&l>s)break;o.push(l)}return o}function Wo(e,s,n,r){const{month:a,defaultMonth:o,today:i=r.today(),numberOfMonths:l=1}=e;let d=a||o||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:f}=r;if(n&&c(n,d)<l-1){const m=-1*(l-1);d=u(n,m)}return s&&c(d,s)<0&&(d=s),f(d)}function Ob(e,s,n,r){const{addDays:a,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:l,endOfWeek:d,getISOWeek:c,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:m,startOfWeek:h}=r,g=e.reduce((y,S)=>{const b=n.broadcastCalendar?f(S,r):n.ISOWeek?m(S):h(S),N=n.broadcastCalendar?o(S):n.ISOWeek?i(l(S)):d(l(S)),w=s.filter(C=>C>=b&&C<=N),j=n.broadcastCalendar?35:42;if(n.fixedWeeks&&w.length<j){const C=s.filter(A=>{const D=j-w.length;return A>N&&A<=a(N,D)});w.push(...C)}const E=w.reduce((C,A)=>{const D=n.ISOWeek?c(A):u(A),_=C.find($=>$.weekNumber===D),I=new bd(A,S,r);return _?_.days.push(I):C.push(new Cg(D,[I])),C},[]),p=new Sg(S,E);return y.push(p),y},[]);return n.reverseMonths?g.reverse():g}function Tb(e,s){let{startMonth:n,endMonth:r}=e;const{startOfYear:a,startOfDay:o,startOfMonth:i,endOfMonth:l,addYears:d,endOfYear:c,newDate:u,today:f}=s,{fromYear:m,toYear:h,fromMonth:g,toMonth:y}=e;!n&&g&&(n=g),!n&&m&&(n=s.newDate(m,0,1)),!r&&y&&(r=y),!r&&h&&(r=u(h,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=i(n):m?n=u(m,0,1):!n&&S&&(n=a(d(e.today??f(),-100))),r?r=l(r):h?r=u(h,11,31):!r&&S&&(r=c(e.today??f())),[n&&o(n),r&&o(r)]}function Pb(e,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(e);if(!s)return l(u,c);if(!(d(s,e)<o))return l(u,c)}function Ab(e,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(e);if(!s)return l(u,-c);if(!(d(u,s)<=0))return l(u,-c)}function $b(e){const s=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),s.slice())}function jr(e,s){const[n,r]=x.useState(e);return[s===void 0?n:s,r]}function Rb(e,s){var j;const[n,r]=Tb(e,s),{startOfMonth:a,endOfMonth:o}=s,i=Wo(e,n,r,s),[l,d]=jr(i,e.month?i:void 0);x.useEffect(()=>{const E=Wo(e,n,r,s);d(E)},[e.timeZone]);const{months:c,weeks:u,days:f,previousMonth:m,nextMonth:h}=x.useMemo(()=>{const E=Eb(l,r,{numberOfMonths:e.numberOfMonths},s),p=Db(E,e.endMonth?o(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},s),C=Ob(E,p,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},s),A=$b(C),D=_b(C),_=Ab(l,n,e,s),I=Pb(l,r,e,s);return{months:C,weeks:A,days:D,previousMonth:_,nextMonth:I}},[s,l.getTime(),r==null?void 0:r.getTime(),n==null?void 0:n.getTime(),e.disableNavigation,e.broadcastCalendar,(j=e.endMonth)==null?void 0:j.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:g,onMonthChange:y}=e,S=E=>u.some(p=>p.days.some(C=>C.isEqualTo(E))),b=E=>{if(g)return;let p=a(E);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:f,navStart:n,navEnd:r,previousMonth:m,nextMonth:h,goToMonth:b,goToDay:E=>{S(E)||b(E.date)}}}var jt;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(jt||(jt={}));function qo(e){return!e[_e.disabled]&&!e[_e.hidden]&&!e[_e.outside]}function Ib(e,s,n,r){let a,o=-1;for(const i of e){const l=s(i);qo(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=e.find(i=>qo(s(i)))),a}function Fb(e,s,n,r,a,o,i){const{ISOWeek:l,broadcastCalendar:d}=o,{addDays:c,addMonths:u,addWeeks:f,addYears:m,endOfBroadcastWeek:h,endOfISOWeek:g,endOfWeek:y,max:S,min:b,startOfBroadcastWeek:N,startOfISOWeek:w,startOfWeek:j}=i;let p={day:c,week:f,month:u,year:m,startOfWeek:C=>d?N(C,i):l?w(C):j(C),endOfWeek:C=>d?h(C):l?g(C):y(C)}[e](n,s==="after"?1:-1);return s==="before"&&r?p=S([r,p]):s==="after"&&a&&(p=b([a,p])),p}function Pd(e,s,n,r,a,o,i,l=0){if(l>365)return;const d=Fb(e,s,n.date,r,a,o,i),c=!!(o.disabled&&Et(d,o.disabled,i)),u=!!(o.hidden&&Et(d,o.hidden,i)),f=d,m=new bd(d,f,i);return!c&&!u?m:Pd(e,s,m,r,a,o,i,l+1)}function zb(e,s,n,r,a){const{autoFocus:o}=e,[i,l]=x.useState(),d=Ib(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=Pd(y,S,c,s.navStart,s.navEnd,e,a);b&&(e.disableNavigation&&!s.days.some(w=>w.isEqualTo(b))||(s.goToDay(b),u(b)))}}}function Wb(e,s){const{selected:n,required:r,onSelect:a}=e,[o,i]=jr(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:f}=e;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)===f?S=[h]:S=[...S,h];return a||i(S),a==null||a(S,h,g,y),S},isSelected:c}}function qb(e,s,n=0,r=0,a=!1,o=kt){const{from:i,to:l}=s||{},{isSameDay:d,isAfter:c,isBefore:u}=o;let f;if(!i&&!l)f={from:e,to:n>0?void 0:e};else if(i&&!l)d(i,e)?n===0?f={from:i,to:e}:a?f={from:i,to:void 0}:f=void 0:u(e,i)?f={from:e,to:i}:f={from:i,to:e};else if(i&&l)if(d(i,e)&&d(l,e))a?f={from:i,to:l}:f=void 0;else if(d(i,e))f={from:i,to:n>0?void 0:e};else if(d(l,e))f={from:e,to:n>0?void 0:e};else if(u(e,i))f={from:e,to:l};else if(c(e,i))f={from:i,to:e};else if(c(e,l))f={from:i,to:e};else throw new Error("Invalid range");if(f!=null&&f.from&&(f!=null&&f.to)){const m=o.differenceInCalendarDays(f.to,f.from);r>0&&m>r?f={from:e,to:void 0}:n>1&&m<n&&(f={from:e,to:void 0})}return f}function Bb(e,s,n=kt){const r=Array.isArray(s)?s:[s];let a=e.from;const o=n.differenceInCalendarDays(e.to,e.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 Bo(e,s,n=kt){return _t(e,s.from,!1,n)||_t(e,s.to,!1,n)||_t(s,e.from,!1,n)||_t(s,e.to,!1,n)}function Yb(e,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)?_t(e,l,!1,n):jd(l,n)?l.some(d=>_t(e,d,!1,n)):vr(l)?l.from&&l.to?Bo(e,{from:l.from,to:l.to},n):!1:vd(l)?Bb(e,l.dayOfWeek,n):La(l)?n.isAfter(l.before,l.after)?Bo(e,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):Et(e.from,l,n)||Et(e.to,l,n):Ha(l)||Ua(l)?Et(e.from,l,n)||Et(e.to,l,n):!1))return!0;const i=r.filter(l=>typeof l=="function");if(i.length){let l=e.from;const d=n.differenceInCalendarDays(e.to,e.from);for(let c=0;c<=d;c++){if(i.some(u=>u(l)))return!0;l=n.addDays(l,1)}}return!1}function Lb(e,s){const{disabled:n,excludeDisabled:r,selected:a,required:o,onSelect:i}=e,[l,d]=jr(a,i?a:void 0),c=i?a:l;return{selected:c,select:(m,h,g)=>{const{min:y,max:S}=e,b=m?qb(m,c,y,S,o,s):void 0;return r&&n&&(b!=null&&b.from)&&b.to&&Yb({from:b.from,to:b.to},n,s)&&(b.from=m,b.to=void 0),i||d(b),i==null||i(b,m,h,g),b},isSelected:m=>c&&_t(c,m,!1,s)}}function Hb(e,s){const{selected:n,required:r,onSelect:a}=e,[o,i]=jr(n,a?n:void 0),l=a?n:o,{isSameDay:d}=s;return{selected:l,select:(f,m,h)=>{let g=f;return!r&&l&&l&&d(f,l)&&(g=void 0),a||i(g),a==null||a(g,f,m,h),g},isSelected:f=>l?d(l,f):!1}}function Ub(e,s){const n=Hb(e,s),r=Wb(e,s),a=Lb(e,s);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function rt(e,s){return e instanceof Le&&e.timeZone===s?e:new Le(e,s)}function Os(e,s,n){return rt(e,s)}function Yo(e,s,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Os(e,s):Array.isArray(e)?e.map(r=>r instanceof Date?Os(r,s):r):vr(e)?{...e,from:e.from?rt(e.from,s):e.from,to:e.to?rt(e.to,s):e.to}:La(e)?{before:Os(e.before,s),after:Os(e.after,s)}:Ha(e)?{after:Os(e.after,s)}:Ua(e)?{before:Os(e.before,s)}:e}function Kr(e,s,n){return e&&(Array.isArray(e)?e.map(r=>Yo(r,s)):Yo(e,s))}function Kb(e){var re;let s=e;const n=s.timeZone;if(n&&(s={...e,timeZone:n},s.today&&(s.today=rt(s.today,n)),s.month&&(s.month=rt(s.month,n)),s.defaultMonth&&(s.defaultMonth=rt(s.defaultMonth,n)),s.startMonth&&(s.startMonth=rt(s.startMonth,n)),s.endMonth&&(s.endMonth=rt(s.endMonth,n)),s.mode==="single"&&s.selected?s.selected=rt(s.selected,n):s.mode==="multiple"&&s.selected?s.selected=(re=s.selected)==null?void 0:re.map(G=>rt(G,n)):s.mode==="range"&&s.selected&&(s.selected={from:s.selected.from?rt(s.selected.from,n):s.selected.from,to:s.selected.to?rt(s.selected.to,n):s.selected.to}),s.disabled!==void 0&&(s.disabled=Kr(s.disabled,n)),s.hidden!==void 0&&(s.hidden=Kr(s.hidden,n)),s.modifiers)){const G={};Object.keys(s.modifiers).forEach(se=>{var U;G[se]=Kr((U=s.modifiers)==null?void 0:U[se],n)}),s.modifiers=G}const{components:r,formatters:a,labels:o,dateLib:i,locale:l,classNames:d}=x.useMemo(()=>{const G={...gd,...s.locale},se=s.broadcastCalendar?1:s.weekStartsOn,U=s.noonSafe&&s.timeZone?Nb(s.timeZone,{weekStartsOn:se,locale:G}):void 0,Z=s.dateLib&&U?{...U,...s.dateLib}:s.dateLib??U,be=new st({locale:G,weekStartsOn:se,firstWeekContainsDate:s.firstWeekContainsDate,useAdditionalWeekYearTokens:s.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:s.useAdditionalDayOfYearTokens,timeZone:s.timeZone,numerals:s.numerals},Z);return{dateLib:be,components:sb(s.components),formatters:fb(s.formatters),labels:bb(s.labels,be.options),locale:G,classNames:{...rb(),...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:f,numberOfMonths:m=1,onDayBlur:h,onDayClick:g,onDayFocus:y,onDayKeyDown:S,onDayMouseEnter:b,onDayMouseLeave:N,onNextClick:w,onPrevClick:j,showWeekNumber:E,styles:p}=s,{formatCaption:C,formatDay:A,formatMonthDropdown:D,formatWeekNumber:_,formatWeekNumberHeader:I,formatWeekdayName:$,formatYearDropdown:F}=a,T=Rb(s,i),{days:X,months:q,navStart:V,navEnd:W,previousMonth:z,nextMonth:Q,goToMonth:ee}=T,k=eb(X,s,V,W,i),{isSelected:M,select:Y,selected:L}=Ub(s,i)??{},{blur:ae,focused:P,isFocusTarget:ie,moveFocus:ge,setFocused:Te}=zb(s,T,k,M??(()=>!1),i),{labelDayButton:qe,labelGridcell:$t,labelGrid:Zt,labelMonthDropdown:le,labelNav:es,labelPrevious:ts,labelNext:ss,labelWeekday:ns,labelWeekNumber:rn,labelWeekNumberHeader:lt,labelYearDropdown:pt}=o,Ms=x.useMemo(()=>jb(i,s.ISOWeek,s.broadcastCalendar,s.today),[i,s.ISOWeek,s.broadcastCalendar,s.today]),Be=u!==void 0||g!==void 0,rs=x.useCallback(()=>{z&&(ee(z),j==null||j(z))},[z,ee,j]),Rt=x.useCallback(()=>{Q&&(ee(Q),w==null||w(Q))},[ee,Q,w]),Ye=x.useCallback((G,se)=>U=>{U.preventDefault(),U.stopPropagation(),Te(G),!se.disabled&&(Y==null||Y(G.date,se,U),g==null||g(G.date,se,U))},[Y,g,Te]),gt=x.useCallback((G,se)=>U=>{Te(G),y==null||y(G.date,se,U)},[y,Te]),It=x.useCallback((G,se)=>U=>{ae(),h==null||h(G.date,se,U)},[ae,h]),an=x.useCallback((G,se)=>U=>{const Z={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(Z[U.key]){U.preventDefault(),U.stopPropagation();const[be,B]=Z[U.key];ge(be,B)}S==null||S(G.date,se,U)},[ge,S,s.dir]),St=x.useCallback((G,se)=>U=>{b==null||b(G.date,se,U)},[b]),on=x.useCallback((G,se)=>U=>{N==null||N(G.date,se,U)},[N]),bt=x.useCallback(G=>se=>{const U=Number(se.target.value),Z=i.setMonth(i.startOfMonth(G),U);ee(Z)},[i,ee]),Ft=x.useCallback(G=>se=>{const U=Number(se.target.value),Z=i.setYear(i.startOfMonth(G),U);ee(Z)},[i,ee]),{className:yt,style:Ds}=x.useMemo(()=>({className:[d[ne.Root],s.className].filter(Boolean).join(" "),style:{...p==null?void 0:p[ne.Root],...s.style}}),[d,s.className,s.style,p]),vt=nb(s),_s=x.useRef(null);Mb(_s,!!s.animate,{classNames:d,months:q,focused:P,dateLib:i});const ln={dayPickerProps:s,selected:L,select:Y,isSelected:M,months:q,nextMonth:Q,previousMonth:z,goToMonth:ee,getModifiers:k,components:r,classNames:d,styles:p,labels:o,formatters:a};return v.createElement(yd.Provider,{value:ln},v.createElement(r.Root,{rootRef:s.animate?_s:void 0,className:yt,style:Ds,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},v.createElement(r.Months,{className:d[ne.Months],style:p==null?void 0:p[ne.Months]},!s.hideNavigation&&!f&&v.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:d[ne.Nav],style:p==null?void 0:p[ne.Nav],"aria-label":es(),onPreviousClick:rs,onNextClick:Rt,previousMonth:z,nextMonth:Q}),q.map((G,se)=>v.createElement(r.Month,{"data-animated-month":s.animate?"true":void 0,className:d[ne.Month],style:p==null?void 0:p[ne.Month],key:se,displayIndex:se,calendarMonth:G},f==="around"&&!s.hideNavigation&&se===0&&v.createElement(r.PreviousMonthButton,{type:"button",className:d[ne.PreviousMonthButton],tabIndex:z?void 0:-1,"aria-disabled":z?void 0:!0,"aria-label":ts(z),onClick:rs,"data-animated-button":s.animate?"true":void 0},v.createElement(r.Chevron,{disabled:z?void 0:!0,className:d[ne.Chevron],orientation:s.dir==="rtl"?"right":"left"})),v.createElement(r.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:d[ne.MonthCaption],style:p==null?void 0:p[ne.MonthCaption],calendarMonth:G,displayIndex:se},c!=null&&c.startsWith("dropdown")?v.createElement(r.DropdownNav,{className:d[ne.Dropdowns],style:p==null?void 0:p[ne.Dropdowns]},(()=>{const U=c==="dropdown"||c==="dropdown-months"?v.createElement(r.MonthsDropdown,{key:"month",className:d[ne.MonthsDropdown],"aria-label":le(),classNames:d,components:r,disabled:!!s.disableNavigation,onChange:bt(G.date),options:yb(G.date,V,W,a,i),style:p==null?void 0:p[ne.Dropdown],value:i.getMonth(G.date)}):v.createElement("span",{key:"month"},D(G.date,i)),Z=c==="dropdown"||c==="dropdown-years"?v.createElement(r.YearsDropdown,{key:"year",className:d[ne.YearsDropdown],"aria-label":pt(i.options),classNames:d,components:r,disabled:!!s.disableNavigation,onChange:Ft(G.date),options:wb(V,W,a,i,!!s.reverseYears),style:p==null?void 0:p[ne.Dropdown],value:i.getYear(G.date)}):v.createElement("span",{key:"year"},F(G.date,i));return i.getMonthYearOrder()==="year-first"?[Z,U]:[U,Z]})(),v.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"}},C(G.date,i.options,i))):v.createElement(r.CaptionLabel,{className:d[ne.CaptionLabel],role:"status","aria-live":"polite"},C(G.date,i.options,i))),f==="around"&&!s.hideNavigation&&se===m-1&&v.createElement(r.NextMonthButton,{type:"button",className:d[ne.NextMonthButton],tabIndex:Q?void 0:-1,"aria-disabled":Q?void 0:!0,"aria-label":ss(Q),onClick:Rt,"data-animated-button":s.animate?"true":void 0},v.createElement(r.Chevron,{disabled:Q?void 0:!0,className:d[ne.Chevron],orientation:s.dir==="rtl"?"left":"right"})),se===m-1&&f==="after"&&!s.hideNavigation&&v.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:d[ne.Nav],style:p==null?void 0:p[ne.Nav],"aria-label":es(),onPreviousClick:rs,onNextClick:Rt,previousMonth:z,nextMonth:Q}),v.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":Zt(G.date,i.options,i)||void 0,className:d[ne.MonthGrid],style:p==null?void 0:p[ne.MonthGrid]},!s.hideWeekdays&&v.createElement(r.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:d[ne.Weekdays],style:p==null?void 0:p[ne.Weekdays]},E&&v.createElement(r.WeekNumberHeader,{"aria-label":lt(i.options),className:d[ne.WeekNumberHeader],style:p==null?void 0:p[ne.WeekNumberHeader],scope:"col"},I()),Ms.map(U=>v.createElement(r.Weekday,{"aria-label":ns(U,i.options,i),className:d[ne.Weekday],key:String(U),style:p==null?void 0:p[ne.Weekday],scope:"col"},$(U,i.options,i)))),v.createElement(r.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:d[ne.Weeks],style:p==null?void 0:p[ne.Weeks]},G.weeks.map(U=>v.createElement(r.Week,{className:d[ne.Week],key:U.weekNumber,style:p==null?void 0:p[ne.Week],week:U},E&&v.createElement(r.WeekNumber,{week:U,style:p==null?void 0:p[ne.WeekNumber],"aria-label":rn(U.weekNumber,{locale:l}),className:d[ne.WeekNumber],scope:"row",role:"rowheader"},_(U.weekNumber,i)),U.days.map(Z=>{const{date:be}=Z,B=k(Z);if(B[_e.focused]=!B.hidden&&!!(P!=null&&P.isEqualTo(Z)),B[ft.selected]=(M==null?void 0:M(be))||B.selected,vr(L)){const{from:Ce,to:Me}=L;B[ft.range_start]=!!(Ce&&Me&&i.isSameDay(be,Ce)),B[ft.range_end]=!!(Ce&&Me&&i.isSameDay(be,Me)),B[ft.range_middle]=_t(L,be,!0,i)}const fe=vb(B,p,s.modifiersStyles),he=tb(B,d,s.modifiersClassNames),Ae=!Be&&!B.hidden?$t(be,B,i.options,i):void 0;return v.createElement(r.Day,{key:`${Z.isoDate}_${Z.displayMonthId}`,day:Z,modifiers:B,className:he.join(" "),style:fe,role:"gridcell","aria-selected":B.selected||void 0,"aria-label":Ae,"data-day":Z.isoDate,"data-month":Z.outside?Z.dateMonthId:void 0,"data-selected":B.selected||void 0,"data-disabled":B.disabled||void 0,"data-hidden":B.hidden||void 0,"data-outside":Z.outside||void 0,"data-focused":B.focused||void 0,"data-today":B.today||void 0},!B.hidden&&Be?v.createElement(r.DayButton,{className:d[ne.DayButton],style:p==null?void 0:p[ne.DayButton],type:"button",day:Z,modifiers:B,disabled:!B.focused&&B.disabled||void 0,"aria-disabled":B.focused&&B.disabled||void 0,tabIndex:ie(Z)?0:-1,"aria-label":qe(be,B,i.options,i),onClick:Ye(Z,B),onBlur:It(Z,B),onFocus:gt(Z,B),onKeyDown:an(Z,B),onMouseEnter:St(Z,B),onMouseLeave:on(Z,B)},A(be,i.options,i)):!B.hidden&&A(Z.date,i.options,i))})))))))),s.footer&&v.createElement(r.Footer,{className:d[ne.Footer],style:p==null?void 0:p[ne.Footer],role:"status","aria-live":"polite"},s.footer)))}function it({className:e,classNames:s,showOutsideDays:n=!0,...r}){return t.jsx(Kb,{showOutsideDays:n,className:O("p-3",e),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:O(Is({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:O(Is({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:O(Is({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"?t.jsx(xa,{className:"h-4 w-4"}):t.jsx(Gs,{className:"h-4 w-4"})},...r})}it.displayName="Calendar";function Vb(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function wr({open:e,onClose:s,projectId:n,defaultStatus:r="backlog",defaultTaskListId:a,defaultParentId:o}){const i=Ue(),{workspace:l,projectKey:d}=Ge(),{workspace:c}=ke(),[u,f]=x.useState(""),[m,h]=x.useState(""),[g,y]=x.useState(r),[S,b]=x.useState("medium"),[N,w]=x.useState("task"),[j,E]=x.useState([]),[p,C]=x.useState(""),[A,D]=x.useState(a??""),[_,I]=x.useState(void 0),[$,F]=x.useState(void 0),T=tl(),{data:X}=sn(n),{data:q}=nn(n||void 0),{data:V}=Wn(n||void 0),W=(q??[]).filter(k=>k.status!=="completed"),z=X&&X.length>0?Object.fromEntries(X.map(k=>[k.key,k.name])):bs,Q=()=>{f(""),h(""),y(r),b("medium"),w("task"),E([]),C(""),D(a??""),I(void 0),F(void 0),s()},ee=k=>{k.preventDefault(),u.trim()&&T.mutate({title:u.trim(),description:m.trim()||void 0,status:g,priority:S,type:N,project_id:n,workspace_id:c.id,assignee_ids:j.length>0?j:void 0,sprint_id:p||null,task_list_id:A||null,parent_id:o||null,start_date:_?oe(_,"yyyy-MM-dd"):null,due_date:$?oe($,"yyyy-MM-dd"):null},{onSuccess:()=>{R.success("Issue created"),Q()},onError:M=>R.error(M.message??"Failed to create issue")})};return t.jsx(Ss,{open:e,onOpenChange:k=>!k&&Q(),children:t.jsxs(Cs,{className:"max-w-md",children:[t.jsx(Js,{children:t.jsx(en,{children:"New issue"})}),t.jsxs("form",{onSubmit:ee,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(Zs,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{htmlFor:"issue-title",children:"Title"}),t.jsx(xe,{id:"issue-title",placeholder:"Issue title",value:u,onChange:k=>f(k.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"issue-desc",children:["Description ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(br,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:k=>h(k.target.value)})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Status"}),t.jsxs(we,{value:g,onValueChange:y,children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(z).map(([k,M])=>t.jsx(de,{value:k,className:"text-xs",children:M},k))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Priority"}),t.jsxs(we,{value:S,onValueChange:b,children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Ot).map(([k,M])=>t.jsx(de,{value:k,className:"text-xs",children:M},k))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Type"}),t.jsxs(we,{value:N,onValueChange:w,children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Kt).map(([k,M])=>t.jsx(de,{value:k,className:"text-xs",children:M},k))})]})]})]}),o&&t.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&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["List ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(we,{value:A||"none",onValueChange:k=>D(k==="none"?"":k),children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{placeholder:"No list"})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs",children:t.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(V??[]).map(k=>t.jsx(de,{value:k.id,className:"text-xs",children:k.name},k.id))]})]})]}),W.length>0&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Sprint ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(we,{value:p||"none",onValueChange:k=>C(k==="none"?"":k),children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{placeholder:"No sprint"})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs",children:t.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),W.map(k=>{const M=Vb(k);return t.jsx(de,{value:k.id,className:"text-xs",children:t.jsxs("div",{children:[t.jsx("span",{children:k.name}),M&&t.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:M})]})},k.id)})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Assignees ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(qn,{value:j,onChange:E})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Start Date ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:_?"text-foreground":"text-muted-foreground",children:_?oe(_,"MMM d, yyyy"):"No start date"}),_&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),I(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}),t.jsx(He,{className:"w-auto p-0",align:"start",children:t.jsx(it,{mode:"single",selected:_,onSelect:I,initialFocus:!0})})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Due Date ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:$?"text-foreground":"text-muted-foreground",children:$?oe($,"MMM d, yyyy"):"No due date"}),$&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),F(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}),t.jsx(He,{className:"w-auto p-0",align:"start",children:t.jsx(it,{mode:"single",selected:$,onSelect:F,initialFocus:!0})})]})]})]}),t.jsxs(Fn,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[t.jsxs(K,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Q(),i(`/${l}/projects/${d}/issues/new`)},children:[t.jsx(ul,{className:"h-3.5 w-3.5"}),"Open full form"]}),t.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[t.jsx(K,{type:"button",variant:"ghost",onClick:Q,children:"Cancel"}),t.jsx(K,{type:"submit",disabled:!u.trim()||T.isPending,children:T.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Ga={byIssue:e=>["attachments",e]};function Ad(e){return Ne({queryKey:Ga.byIssue(e),queryFn:()=>J.get(`/admin/issues/${e}/attachments`),select:s=>s.attachments,enabled:!!e})}function $d(e){const s=me();return ce({mutationFn:({file:n,commentId:r})=>{const a=new FormData;return a.append("file",n),r&&a.append("comment_id",r),J.upload(`/admin/issues/${e}/attachments`,a)},onSuccess:()=>{s.invalidateQueries({queryKey:Ga.byIssue(e)})}})}function Gb(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/issues/${e}/attachments/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ga.byIssue(e)})}})}function Nn(e){return e.startsWith("image/")}function Nr(e){return e.startsWith("video/")}function kr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qa(e,s){const n=document.createElement("a");n.href=e,n.download=s,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Xa({mimeType:e,className:s}){return Nn(e)?t.jsx(Em,{className:s}):Nr(e)?t.jsx(cr,{className:s}):e.startsWith("text/")||e.includes("json")?t.jsx(_m,{className:s}):e.includes("zip")||e.includes("tar")||e.includes("gz")?t.jsx(Dm,{className:s}):e.includes("pdf")||e.includes("word")||e.includes("document")?t.jsx(Om,{className:s}):t.jsx(Tm,{className:s})}function Rd({attachment:e,onClose:s}){return e?t.jsx(Ss,{open:!0,onOpenChange:n=>!n&&s(),children:t.jsxs(Cs,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[t.jsxs(Js,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[t.jsx(en,{className:"text-sm font-medium truncate",children:e.original_name}),t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Qa(e.url,e.original_name),children:[t.jsx(ga,{className:"h-3.5 w-3.5"}),"Download"]})]}),t.jsxs(Zs,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[Nn(e.mime_type)&&t.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),Nr(e.mime_type)&&t.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),t.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[t.jsx("span",{children:kr(e.size)}),t.jsx("span",{children:"·"}),t.jsx("span",{children:e.mime_type}),t.jsx("span",{children:"·"}),t.jsxs("span",{children:["Uploaded ",oe(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function Qb({attachment:e}){const[s,n]=x.useState(null),r=Nn(e.mime_type)||Nr(e.mime_type),a=()=>{r?n(e):Qa(e.url,e.original_name)};return t.jsxs(t.Fragment,{children:[Nn(e.mime_type)?t.jsx("button",{type:"button",onClick:a,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:t.jsx("img",{src:e.url,alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):t.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:[t.jsx(Xa,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:kr(e.size)}),!r&&t.jsx(ga,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),s&&t.jsx(Rd,{attachment:s,onClose:()=>n(null)})]})}function Xb({attachment:e,onOpen:s,onDelete:n,isDeleting:r}){const a=Nn(e.mime_type)||Nr(e.mime_type),o=()=>{a?s(e):Qa(e.url,e.original_name)};return t.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[t.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:t.jsx(Xa,{mimeType:e.mime_type,className:"h-4 w-4"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("button",{type:"button",onClick:o,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),t.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[t.jsx("span",{children:kr(e.size)}),t.jsx("span",{children:"·"}),t.jsx("span",{children:oe(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsx("span",{className:"italic",children:"from comment"})]}),!a&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsxs("span",{className:"flex items-center gap-0.5",children:[t.jsx(ga,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),t.jsx(K,{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(e.id),disabled:r,children:t.jsx(Tt,{className:"h-3.5 w-3.5"})})]})}function Jb({onFiles:e,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&&e(l)},[e]);return t.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:O("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:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:t.jsx(ef,{className:"h-4 w-4 text-muted-foreground"})}),t.jsx("p",{className:"text-xs font-medium text-foreground",children:s?"Uploading…":"Drop files or click to browse"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),t.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:i=>{const l=Array.from(i.target.files??[]);l.length>0&&e(l),i.target.value=""}})]})}function Zb({issueId:e,className:s}){const[n,r]=x.useState(null),{data:a,isLoading:o}=Ad(e),i=$d(e),l=Gb(e),d=u=>{u.forEach(f=>{i.mutate({file:f},{onSuccess:()=>R.success(`${f.name} uploaded`),onError:()=>R.error(`Failed to upload ${f.name}`)})})},c=u=>{l.mutate(u,{onSuccess:()=>R.success("Attachment removed"),onError:()=>R.error("Failed to remove attachment")})};return t.jsxs("div",{className:O("px-6 py-4 space-y-4",s),children:[t.jsx(Jb,{onFiles:d,isUploading:i.isPending}),o?t.jsx("div",{className:"space-y-2",children:[1,2].map(u=>t.jsxs("div",{className:"flex items-center gap-3 px-3",children:[t.jsx(te,{className:"h-8 w-8 rounded-md shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3 w-2/3"}),t.jsx(te,{className:"h-2.5 w-1/3"})]})]},u))}):a&&a.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[t.jsx(ja,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[a.length," ",a.length===1?"file":"files"]})]}),t.jsx("div",{children:a.map(u=>t.jsx(Xb,{attachment:u,onOpen:r,onDelete:c,isDeleting:l.isPending},u.id))})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),t.jsx(Rd,{attachment:n,onClose:()=>r(null)})]})}const Vt={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function e0(e){return Ne({queryKey:Vt.byIssue(e),queryFn:()=>J.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function t0(e){return Ne({queryKey:Vt.activeTimer(e),queryFn:()=>J.get(`/admin/issues/${e}/time-logs/timer`),select:s=>s.active_timer,enabled:!!e,refetchInterval:1e4})}function s0(e){const s=me();return ce({mutationFn:n=>J.post(`/admin/issues/${e}/time-logs`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}function n0(e){const s=me();return ce({mutationFn:()=>J.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.activeTimer(e)}),s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}function r0(e){const s=me();return ce({mutationFn:()=>J.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.activeTimer(e)}),s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}function a0(e){const s=me();return ce({mutationFn:n=>J.delete(`/admin/issues/${e}/time-logs/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}const o0=Mn("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 Ln({className:e,variant:s,...n}){return t.jsx("div",{className:O(o0({variant:s}),e),...n})}function aa(e){const s=Math.floor(e/60),n=e%60;return s===0?`${n}m`:n===0?`${s}h`:`${s}h ${n}m`}function Lo(e){const s=Date.now()-new Date(e).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 i0({startedAt:e}){const[s,n]=x.useState(()=>Lo(e));return x.useEffect(()=>{const r=setInterval(()=>n(Lo(e)),1e3);return()=>clearInterval(r)},[e]),t.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:s})}function l0({onSubmit:e,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]),f=m=>{m.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}e({duration_minutes:y,description:l.trim()||void 0,logged_date:c||void 0})};return t.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[t.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),t.jsx(xe,{type:"number",min:"0",max:"999",placeholder:"0",value:r,onChange:m=>a(m.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),t.jsx(xe,{type:"number",min:"0",max:"59",placeholder:"0",value:o,onChange:m=>i(m.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),t.jsx(xe,{type:"date",value:c,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",t.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),t.jsx(xe,{placeholder:"What did you work on?",value:l,onChange:m=>d(m.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"ghost",size:"sm",onClick:n,className:"h-7 text-xs",children:"Cancel"}),t.jsx(K,{type:"submit",size:"sm",disabled:s,className:"h-7 text-xs",children:s?"Saving…":"Log time"})]})]})}function d0({entry:e,onDelete:s,isDeleting:n}){const r=e.started_at!=null&&e.stopped_at==null;return t.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[t.jsx("div",{className:O("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?t.jsx(Xm,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?t.jsx(Qt,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(Sm,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r?t.jsx(i0,{startedAt:e.started_at}):t.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:aa(e.duration_minutes??0)}),t.jsx(Ln,{variant:"muted",className:O("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":e.source==="timer"?"Timer":"Manual"})]}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!r&&t.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:oe(new Date(e.logged_date),"MMM d, yyyy")})]}),!r&&t.jsx(K,{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(e.id),disabled:n,children:t.jsx(Tt,{className:"h-3.5 w-3.5"})})]})}function c0({issueId:e,className:s}){const[n,r]=x.useState(!1),{data:a,isLoading:o}=e0(e),{data:i}=t0(e),l=s0(e),d=n0(e),c=r0(e),u=a0(e),f=(a==null?void 0:a.time_logs)??[],m=(a==null?void 0:a.total_minutes)??0,h=i!=null,g=N=>{l.mutate(N,{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:N=>R.error(N.message??"Failed to start timer")})},S=()=>{c.mutate(void 0,{onSuccess:N=>{const w=N.time_log.duration_minutes??0;R.success(`Timer stopped — ${aa(w)} logged`)},onError:()=>R.error("Failed to stop timer")})},b=N=>{u.mutate(N,{onSuccess:()=>R.success("Time entry removed"),onError:()=>R.error("Failed to remove entry")})};return t.jsxs("div",{className:O("px-6 py-4 space-y-4",s),children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),t.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:m>0?aa(m):"—"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!n&&t.jsxs(K,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>r(!0),children:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Log time"]}),h?t.jsxs(K,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:S,disabled:c.isPending,children:[t.jsx(Km,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):t.jsxs(K,{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:[t.jsx(cr,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),n&&t.jsx(l0,{onSubmit:g,isPending:l.isPending,onCancel:()=>r(!1)}),o?t.jsx("div",{className:"space-y-2",children:[1,2].map(N=>t.jsxs("div",{className:"flex items-center gap-3 px-3",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3 w-1/3"}),t.jsx(te,{className:"h-2.5 w-1/4"})]})]},N))}):f.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx(Qt,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[f.length," ",f.length===1?"entry":"entries"]})]}),t.jsx("div",{children:f.map(N=>t.jsx(d0,{entry:N,onDelete:b,isDeleting:u.isPending},N.id))})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function os({onClick:e,active:s,title:n,children:r}){return t.jsx("button",{type:"button",title:n,onMouseDown:a=>{a.preventDefault(),e()},className:O("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 Ho(){return t.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}function Id({issueId:e,compact:s,className:n,onSuccess:r}){var C,A;const[a,o]=x.useState(!0),[i,l]=x.useState([]),[d,c]=x.useState(!1),u=x.useRef(null),f=x.useRef(async()=>{}),{user:m}=ke(),h=ym(e),g=$d(e),y=m&&`${((C=m.first_name)==null?void 0:C[0])??""}${((A=m.last_name)==null?void 0:A[0])??""}`.toUpperCase()||"?",S=x.useMemo(()=>Lc.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(f.current(),!0)}}}),[]),b=Pi({extensions:[Ai,$i,Ri.configure({placeholder:"Leave a comment…"}),S],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:D}){o(D.isEmpty)}}),N=!a||i.length>0,w=D=>{l(_=>{const I=new Set(_.map($=>`${$.name}-${$.size}`));return[..._,...D.filter($=>!I.has(`${$.name}-${$.size}`))]})},j=D=>{l(_=>_.filter((I,$)=>$!==D))},E=async()=>{if(!(!N||d)){c(!0);try{const D=b!=null&&b.isEmpty?"":(b==null?void 0:b.getHTML())??"",I=(await h.mutateAsync(D||" ")).comment.id;for(const $ of i)await g.mutateAsync({file:$,commentId:I});b==null||b.commands.clearContent(),o(!0),l([]),R.success("Comment added"),r==null||r()}catch{R.error("Failed to add comment")}finally{c(!1)}}};f.current=E;const p="h-3 w-3";return t.jsxs("div",{className:O("flex gap-3 items-start",n),children:[t.jsx(at,{className:"h-7 w-7 shrink-0 mt-1",children:t.jsx(ot,{className:"text-[11px] bg-muted text-muted-foreground",children:y})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:O("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[b&&t.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[t.jsx(os,{title:"Bold (⌘B)",active:b.isActive("bold"),onClick:()=>b.chain().focus().toggleBold().run(),children:t.jsx(nl,{className:p})}),t.jsx(os,{title:"Italic (⌘I)",active:b.isActive("italic"),onClick:()=>b.chain().focus().toggleItalic().run(),children:t.jsx(fl,{className:p})}),t.jsx(os,{title:"Strikethrough",active:b.isActive("strike"),onClick:()=>b.chain().focus().toggleStrike().run(),children:t.jsx(bl,{className:p})}),t.jsx(os,{title:"Inline code",active:b.isActive("code"),onClick:()=>b.chain().focus().toggleCode().run(),children:t.jsx(dl,{className:p})}),t.jsx(Ho,{}),t.jsx(os,{title:"Bullet list",active:b.isActive("bulletList"),onClick:()=>b.chain().focus().toggleBulletList().run(),children:t.jsx(xl,{className:p})}),t.jsx(os,{title:"Ordered list",active:b.isActive("orderedList"),onClick:()=>b.chain().focus().toggleOrderedList().run(),children:t.jsx(hl,{className:p})}),t.jsx(Ho,{}),t.jsx(os,{title:"Code block",active:b.isActive("codeBlock"),onClick:()=>b.chain().focus().toggleCodeBlock().run(),children:t.jsx(ll,{className:p})})]}),t.jsx(Ii,{editor:b,className:O("px-3 py-2.5 text-sm",s?"min-h-[68px]":"min-h-[80px]")})]}),i.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:i.map((D,_)=>t.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:[t.jsx(Xa,{mimeType:D.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate",children:D.name}),t.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",kr(D.size),")"]}),t.jsx("button",{type:"button",onClick:()=>j(_),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:t.jsx(Fe,{className:"h-3 w-3"})})]},_))}),t.jsxs("div",{className:"flex items-center justify-between mt-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(K,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var D;return(D=u.current)==null?void 0:D.click()},disabled:d,title:"Attach files",children:t.jsx(ja,{className:"h-3.5 w-3.5"})}),t.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),t.jsx(K,{size:"icon",className:"h-8 w-8",onClick:E,disabled:!N||d,children:t.jsx(Um,{className:"h-3.5 w-3.5"})})]}),t.jsx("input",{ref:u,type:"file",multiple:!0,className:"hidden",onChange:D=>{const _=Array.from(D.target.files??[]);_.length>0&&w(_),D.target.value=""}})]})]})}function u0({onClick:e,active:s,disabled:n,title:r,children:a}){return t.jsx("button",{type:"button",title:r,disabled:n,onMouseDown:o=>{o.preventDefault(),e()},className:O("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 Xn(){return t.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function Ja({content:e="",onChange:s,placeholder:n="Add a description…",className:r,toolbarClassName:a,editorClassName:o}){const i=Pi({extensions:[Ai.configure({heading:{levels:[1,2,3]}}),$i,Hc,Uc.configure({nested:!0}),Ri.configure({placeholder:n})],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:c}){s&&s(c.isEmpty?"":c.getHTML())}});if(!i)return null;const l=(c,u,f,m,h)=>t.jsx(u0,{title:c,onClick:f,active:m,disabled:h,children:u},c),d="h-3.5 w-3.5";return t.jsxs("div",{className:O("flex flex-col overflow-hidden",r),children:[t.jsxs("div",{className:O("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",a),children:[l("Undo",t.jsx(Zm,{className:d}),()=>i.chain().focus().undo().run(),!1,!i.can().undo()),l("Redo",t.jsx(Hm,{className:d}),()=>i.chain().focus().redo().run(),!1,!i.can().redo()),t.jsx(Xn,{}),l("Bold (⌘B)",t.jsx(nl,{className:d}),()=>i.chain().focus().toggleBold().run(),i.isActive("bold")),l("Italic (⌘I)",t.jsx(fl,{className:d}),()=>i.chain().focus().toggleItalic().run(),i.isActive("italic")),l("Underline (⌘U)",t.jsx(Jm,{className:d}),()=>i.chain().focus().toggleUnderline().run(),i.isActive("underline")),l("Strikethrough",t.jsx(bl,{className:d}),()=>i.chain().focus().toggleStrike().run(),i.isActive("strike")),l("Inline code",t.jsx(dl,{className:d}),()=>i.chain().focus().toggleCode().run(),i.isActive("code")),t.jsx(Xn,{}),l("Heading 1",t.jsx(Pm,{className:d}),()=>i.chain().focus().toggleHeading({level:1}).run(),i.isActive("heading",{level:1})),l("Heading 2",t.jsx(Am,{className:d}),()=>i.chain().focus().toggleHeading({level:2}).run(),i.isActive("heading",{level:2})),l("Heading 3",t.jsx($m,{className:d}),()=>i.chain().focus().toggleHeading({level:3}).run(),i.isActive("heading",{level:3})),t.jsx(Xn,{}),l("Bullet list",t.jsx(xl,{className:d}),()=>i.chain().focus().toggleBulletList().run(),i.isActive("bulletList")),l("Ordered list",t.jsx(hl,{className:d}),()=>i.chain().focus().toggleOrderedList().run(),i.isActive("orderedList")),l("Task list",t.jsx(Rm,{className:d}),()=>i.chain().focus().toggleTaskList().run(),i.isActive("taskList")),t.jsx(Xn,{}),l("Blockquote",t.jsx(Lm,{className:d}),()=>i.chain().focus().toggleBlockquote().run(),i.isActive("blockquote")),l("Code block",t.jsx(ll,{className:d}),()=>i.chain().focus().toggleCodeBlock().run(),i.isActive("codeBlock")),l("Divider line",t.jsx(En,{className:d}),()=>i.chain().focus().setHorizontalRule().run())]}),t.jsx(Ii,{editor:i,className:O("flex-1 px-5 py-4",o)})]})}function Za({html:e,className:s}){return e?t.jsx("div",{className:O("meridian-editor",s),dangerouslySetInnerHTML:{__html:e}}):null}function m0({body:e}){const s=e.trim();return s?/^<[a-z][\s\S]*>/i.test(s)?t.jsx(Za,{html:s,className:"text-xs"}):t.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:s}):null}const Uo={created:{icon:Ie,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:fa,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:On,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:tf,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:dr,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function f0(e,s){var a,o,i,l;const{action:n,changes:r}=e;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 t.jsxs(t.Fragment,{children:["changed status",d&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:bs[d]??d})]}),c&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:bs[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)),f=c.filter(h=>!d.includes(h)),m=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&&f.length>0?t.jsx(t.Fragment,{children:"updated assignees"}):u.length>0?t.jsxs(t.Fragment,{children:["assigned ",t.jsx("strong",{className:"font-medium text-foreground",children:u.map(m).join(", ")})]}):f.length>0?t.jsxs(t.Fragment,{children:["unassigned ",t.jsx("strong",{className:"font-medium text-foreground",children:f.map(m).join(", ")})]}):"updated assignees"}if(n==="updated"&&r){const d=[];for(const[c,u]of Object.entries(r)){const{from:f,to:m}=u;c==="title"||c==="description"?d.push(t.jsxs("span",{children:["updated ",t.jsx("strong",{className:"font-medium text-foreground",children:c})]},c)):c==="priority"?d.push(t.jsxs("span",{children:["changed ",t.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),f!=null&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:Ot[f]??String(f)})]}),m!=null&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:Ot[m]??String(m)})]})]},c)):c==="type"?d.push(t.jsxs("span",{children:["changed ",t.jsx("strong",{className:"font-medium text-foreground",children:"type"}),f!=null&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:Kt[f]??String(f)})]}),m!=null&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:Kt[m]??String(m)})]})]},c)):d.push(t.jsxs("span",{children:["updated ",t.jsx("strong",{className:"font-medium text-foreground",children:c.replace(/_/g," ")})]},c))}return d.length===0?"made changes":t.jsx(t.Fragment,{children:d.reduce((c,u,f)=>f===0?[u]:[...c,t.jsx("span",{children:" and "},`sep-${f}`),u],[])})}return n.replace(/_/g," ")}function Fd({issueId:e,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}=md(),{data:f,isLoading:m}=gm(e),{data:h,isLoading:g}=bm(e),{data:y}=Ad(e),S=b=>{var N;if(c&&b===c.id){const w=c.first_name??"",j=c.last_name??"",E=`${w} ${j}`.trim()||c.email,p=(w[0]??j[0]??((N=c.email)==null?void 0:N[0])??"U").toUpperCase();return{name:E,initials:p}}return(u==null?void 0:u.get(b))??{name:"Unknown",initials:"?"}};return t.jsxs("div",{className:s,children:[t.jsx("div",{className:"flex items-center gap-0.5 px-6 pt-4 pb-2 flex-wrap",children:["comments","activity","attachments","time"].map(b=>{const N=b==="comments"?(f==null?void 0:f.length)??0:b==="activity"?(h==null?void 0:h.length)??0:void 0,w=b==="comments"?"Comments":b==="activity"?"Activity":b==="attachments"?"Attachments":"Time";return t.jsxs("button",{onClick:()=>d(b),className:O("px-3 py-1.5 text-xs font-medium rounded-md transition-colors",i===b?"bg-foreground/5 text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[w,N!=null&&N>0&&t.jsx("span",{className:"ml-1.5 text-[10px] tabular-nums text-muted-foreground",children:N})]},b)})}),i==="comments"&&t.jsxs("div",{className:"px-6 pb-5",children:[t.jsx("div",{className:"space-y-5 mb-5",children:m?t.jsxs("div",{className:"flex gap-3",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsx(te,{className:"h-16 flex-1"})]}):f&&f.length>0?(n?f.slice(-5):f).map(b=>{const N=S(b.author_id),w=(y??[]).filter(j=>j.comment_id===b.id);return t.jsxs("div",{className:"flex gap-3",children:[t.jsx(at,{className:"h-7 w-7 mt-0.5 shrink-0",children:t.jsx(ot,{className:"text-[11px] bg-muted text-muted-foreground",children:N.initials})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.name}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:oe(new Date(b.created_at),"MMM d, h:mm a")})]}),t.jsx(m0,{body:b.body}),w.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:w.map(j=>t.jsx(Qb,{attachment:j},j.id))})]})]},b.id)}):t.jsx("p",{className:"text-sm text-muted-foreground/50 py-2",children:"No comments yet."})}),n&&f&&f.length>5&&r&&t.jsxs("button",{onClick:r,className:"text-xs text-muted-foreground hover:text-foreground mb-4 underline underline-offset-2",children:["View all ",f.length," comments"]}),!o&&t.jsx(Id,{issueId:e})]}),i==="activity"&&t.jsx("div",{className:"px-6 pb-6",children:g?t.jsx("div",{className:"space-y-4 pt-1",children:[1,2,3].map(b=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(te,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),t.jsx(te,{className:"h-4 flex-1 mt-1"})]},b))}):h&&h.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-border"}),t.jsx("div",{className:"space-y-0",children:(n?h.slice(-5):h).map((b,N,w)=>{var A;const j=Uo[b.action]??Uo.updated,E=j.icon,p=((A=u==null?void 0:u.get(b.actor_id))==null?void 0:A.name)??"System",C=N===w.length-1;return t.jsxs("div",{className:O("relative flex gap-3",C?"pb-0":"pb-4"),children:[t.jsx("div",{className:O("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",j.bg),children:t.jsx(E,{className:O("h-3 w-3",j.color)})}),t.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[t.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[t.jsx("span",{className:"font-medium",children:p})," ",t.jsx("span",{className:"text-muted-foreground",children:f0(b,u)})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:oe(new Date(b.created_at),"MMM d, yyyy · h:mm a")})]})]},b.id)})})]}),n&&h.length>5&&r&&t.jsxs("button",{onClick:r,className:"text-xs text-muted-foreground hover:text-foreground mt-3 underline underline-offset-2",children:["View all ",h.length," events"]})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 py-2",children:"No activity yet."})}),i==="attachments"&&t.jsx(Zb,{issueId:e}),i==="time"&&t.jsx(c0,{issueId:e})]})}const zd=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(ki,{ref:r,className:O("relative overflow-hidden",e),...n,children:[t.jsx(Pc,{className:"h-full w-full rounded-[inherit]",children:s}),t.jsx(Wd,{}),t.jsx(Ac,{})]}));zd.displayName=ki.displayName;const Wd=x.forwardRef(({className:e,orientation:s="vertical",...n},r)=>t.jsx(Si,{ref:r,orientation:s,className:O("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]",e),...n,children:t.jsx($c,{className:"relative flex-1 rounded-full bg-border"})}));Wd.displayName=Si.displayName;function tt({zone:e,props:s}){const n=pm(e);return n.length?t.jsx(t.Fragment,{children:n.map((r,a)=>t.jsx(r,{...s},a))}):null}function h0(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function qd({issue:e,projectId:s,open:n,onClose:r}){const a=Ue(),{workspace:o,projectKey:i}=Ge(),{data:l}=el((e==null?void 0:e.id)??""),d=l??e,[c,u]=x.useState(!1),[f,m]=x.useState(""),[h,g]=x.useState(""),[y,S]=x.useState("comments"),[b,N]=x.useState(!1),w=ar((d==null?void 0:d.id)??"",s),{data:j}=sn(s),{data:E}=nn(s||void 0),{data:p}=Wn(s||void 0),{data:C}=Cn(s||void 0),A=(E??[]).filter(M=>M.status!=="completed"),D=d!=null&&d.parent_id?C==null?void 0:C.find(M=>M.id===d.parent_id):null,_=(C==null?void 0:C.filter(M=>M.parent_id===(d==null?void 0:d.id)))??[],I=d!=null&&d.task_list_id?p==null?void 0:p.find(M=>M.id===d.task_list_id):null,$=j&&j.length>0?Object.fromEntries(j.map(M=>[M.key,M.name])):bs;if(x.useEffect(()=>{d&&(m(d.title),g(d.description??"")),u(!1)},[d==null?void 0:d.id]),!d)return null;const F=()=>{f.trim()&&w.mutate({title:f.trim(),description:h.trim()||void 0},{onSuccess:()=>{u(!1),R.success("Issue updated")},onError:()=>R.error("Failed to update issue")})},T=()=>{m(d.title),g(d.description??""),u(!1)},X=M=>{w.mutate({status:M},{onSuccess:()=>R.success("Status updated"),onError:()=>R.error("Failed to update status")})},q=M=>{w.mutate({priority:M},{onSuccess:()=>R.success("Priority updated"),onError:()=>R.error("Failed to update priority")})},V=M=>{w.mutate({type:M},{onSuccess:()=>R.success("Type updated"),onError:()=>R.error("Failed to update type")})},W=M=>{w.mutate({assignee_ids:M},{onSuccess:()=>R.success("Assignees updated"),onError:()=>R.error("Failed to update assignees")})},z=M=>{w.mutate({sprint_id:M},{onSuccess:()=>R.success(M?"Sprint assigned":"Removed from sprint"),onError:()=>R.error("Failed to update sprint")})},Q=M=>{w.mutate({task_list_id:M},{onSuccess:()=>R.success(M?"Moved to list":"Removed from list"),onError:()=>R.error("Failed to update list")})},ee=M=>{w.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=>{w.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")})};return t.jsxs(t.Fragment,{children:[t.jsx(Ss,{open:n,onOpenChange:M=>!M&&r(),children:t.jsxs(Cs,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden",children:[(()=>{const M=j==null?void 0:j.find(ae=>ae.category==="completed"),Y=!!M&&d.status===M.key,L=(ae,P,ie)=>{const ge=ae;return t.jsx("button",{title:P,onClick:ie,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:t.jsx(ge,{className:"h-4 w-4"})},P)};return t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[t.jsxs("button",{onClick:()=>{var ae;M&&X(Y?((ae=j==null?void 0:j.find(P=>P.category==="unstarted"||P.category==="backlog"))==null?void 0:ae.key)??d.status:M.key)},className:O("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",Y?"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:[t.jsx(mt,{className:"h-3.5 w-3.5"}),Y?"Completed":"Mark complete"]}),t.jsxs("div",{className:"flex items-center",children:[L(Qm,"Upvote"),L(ja,"Attachments"),L(Qs,"Add sub-issue",()=>N(!0)),L(va,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${o}/projects/${i}/issues/${d.id}`),R.success("Link copied")}),L(zm,"Open full page",()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)}),c?t.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:T,children:"Cancel"}),t.jsxs(K,{size:"sm",className:"h-7 text-xs",onClick:F,disabled:!f.trim()||w.isPending,children:[t.jsx(mt,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:L(Dn,"More options")}),t.jsx(Xt,{align:"end",className:"w-40",children:t.jsxs(Je,{onClick:()=>u(!0),children:[t.jsx(dr,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),L(Ym,"Open in full page",()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)})]})]})})(),t.jsxs("div",{className:"px-6 pt-4 pb-2 shrink-0",children:[c?t.jsx(xe,{value:f,onChange:M=>m(M.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:d.identifier}),t.jsx(Ln,{variant:"muted",className:"text-[10px] shrink-0",children:Kt[d.type]??d.type})]}),!c&&t.jsx("h2",{className:"text-base font-medium leading-snug",children:d.title})]}),t.jsxs(zd,{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"px-6 py-4 space-y-5 min-w-0",children:[t.jsx(tt,{zone:"issue.details.before",props:{issue:d}}),t.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-1",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Status"}),t.jsxs(we,{value:d.status,onValueChange:X,children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries($).map(([M,Y])=>t.jsx(de,{value:M,className:"text-xs",children:Y},M))})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Priority"}),t.jsxs(we,{value:d.priority,onValueChange:q,children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Ot).map(([M,Y])=>t.jsx(de,{value:M,className:"text-xs",children:Y},M))})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Type"}),t.jsxs(we,{value:d.type,onValueChange:V,children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Kt).map(([M,Y])=>t.jsx(de,{value:M,className:"text-xs",children:Y},M))})]})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Assignees"}),t.jsx(qn,{value:d.assignee_ids??[],onChange:W,disabled:w.isPending})]}),t.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Sprint"}),t.jsxs(we,{value:d.sprint_id??"none",onValueChange:M=>z(M==="none"?null:M),children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[t.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No sprint"})]})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),A.map(M=>{const Y=h0(M);return t.jsx(de,{value:M.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:M.name}),Y&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:Y})]})},M.id)})]})]})]}),(p??[]).length>0&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"List"}),t.jsxs(we,{value:d.task_list_id??"none",onValueChange:M=>Q(M==="none"?null:M),children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[t.jsx(ya,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No list",children:I?I.name:"No list"})]})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(p??[]).map(M=>t.jsx(de,{value:M.id,className:"text-xs",children:M.name},M.id))]})]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Start Date"}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs bg-transparent hover:bg-accent transition-colors overflow-hidden",children:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(He,{className:"w-auto p-0",align:"start",children:[t.jsx(it,{mode:"single",selected:d.start_date?new Date(d.start_date):void 0,onSelect:ee,initialFocus:!0}),d.start_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>ee(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Due Date"}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs bg-transparent hover:bg-accent transition-colors overflow-hidden",children:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(He,{className:"w-auto p-0",align:"start",children:[t.jsx(it,{mode:"single",selected:d.due_date?new Date(d.due_date):void 0,onSelect:k,initialFocus:!0}),d.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>k(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),!d.parent_id&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Child Issues"}),t.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3 w-3"}),"Add"]})]}),D&&t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx(pa,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-muted-foreground shrink-0",children:"Parent:"}),t.jsx("button",{onClick:()=>a(`/${o}/projects/${i}/issues/${D.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:D.identifier}),t.jsx("span",{className:"text-foreground truncate",children:D.title})]}),_.length===0&&!D?t.jsx("p",{className:"text-xs text-muted-foreground/40 italic",children:"No child issues yet"}):t.jsx("div",{className:"space-y-1",children:_.map(M=>t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx(cl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${M.id}`)},className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:M.identifier}),t.jsx("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${M.id}`)},className:"text-muted-foreground truncate hover:text-foreground transition-colors text-left",children:M.title})]},M.id))})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Description"}),c?t.jsx(Ja,{content:h,onChange:g,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${d.id}-edit`):d.description?t.jsx(Za,{html:d.description,className:"text-sm"}):t.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})]})]}),t.jsx(tt,{zone:"issue.details.after",props:{issue:d}}),t.jsx(Fd,{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"&&t.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:t.jsx(Id,{issueId:d.id,compact:!0})})]})}),t.jsx(wr,{open:b,onClose:()=>N(!1),projectId:s,defaultParentId:d.id,defaultTaskListId:d.task_list_id})]})}function x0(){const{projectKey:e}=Ge(),[s,n]=x.useState(null),[r,a]=x.useState(!1),{data:o}=ws(e??""),i=(o==null?void 0:o.id)??"",{data:l,isLoading:d}=Cn(i||void 0),{data:c,isLoading:u}=sn(i||void 0),f=ng(i);if(!e)return null;const m=d||u||!o,h=g=>{f.mutate(g)};return t.jsxs("div",{className:"flex flex-col h-full gap-0",children:[t.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border shrink-0",children:t.jsxs(K,{size:"sm",onClick:()=>a(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create"]})}),t.jsx(tt,{zone:"project.board.before",props:{projectId:i}}),t.jsx("div",{className:"flex-1 min-h-0",children:m?t.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(g=>t.jsxs("div",{className:"min-w-[260px]",children:[t.jsx(te,{className:"h-5 w-24 mb-3 rounded"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(te,{className:"h-[82px] w-full rounded-lg"}),t.jsx(te,{className:"h-[82px] w-full rounded-lg"})]})]},g))}):t.jsx(mg,{issues:l??[],projectId:i,statuses:c??[],onIssueClick:n,onColumnsReorder:h})})]}),t.jsx(tt,{zone:"project.board.after",props:{projectId:i}}),t.jsx(qd,{issue:s,projectId:i,open:!!s,onClose:()=>n(null)}),t.jsx(wr,{open:r,onClose:()=>a(!1),projectId:i})]})}const Ko=({priority:e,className:s})=>{const n=O("h-3.5 w-3.5 shrink-0",fd[e],s);switch(e){case"urgent":return t.jsx(Xs,{className:n});case"high":return t.jsx(ir,{className:n});case"medium":return t.jsx(En,{className:n});case"low":return t.jsx(or,{className:n});default:return t.jsx(Nt,{className:O("h-3.5 w-3.5 shrink-0 text-zinc-300",s)})}};function Bd({issue:e,projectId:s,statuses:n,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:c=!1,children:u=[],onAddChild:f}){const m=Ue(),[h,g]=x.useState(null),[y,S]=x.useState(!1),b=ar(e.id,s);function N(p){b.mutate(p),g(null)}const w=(a==null?void 0:a[e.status])??"#94a3b8",j=o.find(p=>p.id===e.sprint_id),E=u.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{onClick:()=>d(e),className:O("group grid grid-cols-[70px_1fr_150px_120px_130px_140px_130px_32px] items-center px-6 py-3","hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",c&&"pl-14 bg-muted/10",b.isPending&&"opacity-70"),children:[t.jsx("span",{className:O("text-xs font-mono text-muted-foreground truncate",c&&"text-muted-foreground/60"),children:e.identifier}),t.jsxs("div",{className:"flex items-center gap-1 min-w-0 pr-3",children:[!c&&E&&t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.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?t.jsx(Vs,{className:"h-3.5 w-3.5"}):t.jsx(Gs,{className:"h-3.5 w-3.5"})})}),t.jsx(Ht,{side:"top",children:y?"Collapse":"Expand"})]}),!c&&!E&&t.jsx("span",{className:"w-4 shrink-0"}),c&&t.jsx("span",{className:"text-muted-foreground/40 shrink-0 text-xs",children:"↳"}),t.jsx("span",{className:O("text-sm text-foreground truncate",c&&"text-muted-foreground"),children:e.title}),!c&&E&&t.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground/60 ml-1 font-mono",children:u.length})]}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="status",onOpenChange:p=>g(p?"status":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:w}}),t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[e.status]??e.status})]})}),t.jsx(He,{className:"w-52 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Fs,{children:t.jsx(zs,{children:t.jsx(hs,{children:n.map(p=>t.jsxs(ut,{value:p.name,onSelect:()=>N({status:p.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:p.color}}),t.jsx("span",{className:"text-xs flex-1",children:p.name}),e.status===p.key&&t.jsx(mt,{className:"h-3.5 w-3.5 text-indigo-500"})]},p.key))})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="priority",onOpenChange:p=>g(p?"priority":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(Ko,{priority:e.priority}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Ot[e.priority]??e.priority})]})}),t.jsx(He,{className:"w-44 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Fs,{children:t.jsx(zs,{children:t.jsx(hs,{children:Object.entries(Ot).map(([p,C])=>t.jsxs(ut,{value:C,onSelect:()=>N({priority:p}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(Ko,{priority:p}),t.jsx("span",{className:"text-xs flex-1",children:C}),e.priority===p&&t.jsx(mt,{className:"h-3.5 w-3.5 text-indigo-500"})]},p))})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="sprint",onOpenChange:p=>g(p?"sprint":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:O("text-xs truncate",j?"text-foreground":"text-muted-foreground"),children:(j==null?void 0:j.name)??"No sprint"})]})}),t.jsx(He,{className:"w-56 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Fs,{children:t.jsx(zs,{children:t.jsxs(hs,{children:[t.jsxs(ut,{value:"no-sprint",onSelect:()=>N({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(Fe,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&t.jsx(mt,{className:"h-3.5 w-3.5 text-indigo-500"})]}),o.filter(p=>p.status!=="completed").map(p=>t.jsxs(ut,{value:p.name,onSelect:()=>N({sprint_id:p.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs truncate",children:p.name}),(p.start_date||p.end_date)&&t.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"):"—"]})]}),e.sprint_id===p.id&&t.jsx(mt,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},p.id))]})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="due",onOpenChange:p=>g(p?"due":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:O("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?oe(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),t.jsxs(He,{className:"w-auto p-0",align:"start",onClick:p=>p.stopPropagation(),children:[t.jsx(it,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:p=>N({due_date:p?oe(p,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>N({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsx(qn,{value:e.assignee_ids??[],onChange:p=>b.mutate({assignee_ids:p})})}),t.jsxs("div",{className:"flex items-center gap-1",onClick:p=>p.stopPropagation(),children:[!c&&f&&t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx("button",{onClick:()=>f(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:t.jsx(Im,{className:"h-3.5 w-3.5"})})}),t.jsx(Ht,{side:"top",children:"Add child issue"})]}),t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx("button",{onClick:()=>m(`/${i}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:t.jsx(ul,{className:"h-3.5 w-3.5"})})}),t.jsx(Ht,{side:"top",children:"Open full page"})]})]})]}),!c&&y&&u.map(p=>t.jsx(Bd,{issue:p,projectId:s,statuses:n,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:!0},p.id))]})}function Vo({taskList:e,issues:s,childrenMap:n,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,onAddIssue:f,onAddChild:m,onRenameList:h,onDeleteList:g}){const[y,S]=x.useState(!1),[b,N]=x.useState(!1),[w,j]=x.useState((e==null?void 0:e.name)??""),E=s.reduce((A,D)=>{var _;return A+(((_=n[D.id])==null?void 0:_.length)??0)},0),p=s.length+E,C=()=>{e&&w.trim()&&h&&h(e.id,w.trim()),N(!1)};return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx("button",{onClick:()=>S(!y),className:"text-muted-foreground hover:text-foreground transition-colors",children:y?t.jsx(Gs,{className:"h-3.5 w-3.5"}):t.jsx(Vs,{className:"h-3.5 w-3.5"})})}),t.jsx(Ht,{side:"right",children:y?"Expand":"Collapse"})]}),e?b?t.jsx("input",{autoFocus:!0,value:w,onChange:A=>j(A.target.value),onBlur:C,onKeyDown:A=>{A.key==="Enter"&&C(),A.key==="Escape"&&(N(!1),j(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):t.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),t.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:p}),t.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[t.jsxs("button",{onClick:()=>f((e==null?void 0:e.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:[t.jsx(Ie,{className:"h-3 w-3"}),"Add issue"]}),e&&t.jsxs(Ns,{children:[t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx(ks,{asChild:!0,children:t.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Dn,{className:"h-3.5 w-3.5"})})})}),t.jsx(Ht,{side:"top",children:"More options"})]}),t.jsxs(Xt,{align:"end",className:"w-36",children:[t.jsxs(Je,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{N(!0),j(e.name)},children:[t.jsx(dr,{className:"h-3.5 w-3.5"}),"Rename"]}),t.jsxs(Je,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>g==null?void 0:g(e.id),children:[t.jsx(Tt,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!y&&t.jsx("div",{className:"divide-y divide-border/60",children:s.length===0?t.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):s.map(A=>t.jsx(Bd,{issue:A,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,children:n[A.id]??[],onAddChild:m},A.id))})]})}function p0(){var ae;const{workspace:e,projectKey:s}=Ge(),[n,r]=x.useState(null),[a,o]=x.useState({open:!1}),[i,l]=x.useState(""),[d,c]=x.useState(!1),[u,f]=x.useState(""),[m,h]=x.useState("all"),[g,y]=x.useState("all"),[S,b]=x.useState("all"),{data:N}=ws(s??""),w=(N==null?void 0:N.id)??"",{data:j,isLoading:E}=Cn(w||void 0),{data:p}=sn(w||void 0),{data:C}=nn(w||void 0),{data:A}=Wn(w||void 0),D=pg(w),_=gg(w),I=bg(w),$=p&&p.length>0?p:Object.entries(bs).map(([P,ie],ge)=>({id:P,project_id:w,key:P,name:ie,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[P]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[P]??"backlog",position:ge})),F=Object.fromEntries($.map(P=>[P.key,P.name])),T=Object.fromEntries($.map(P=>[P.key,P.color])),X=C??[];if(!s||!e)return null;const q=(j??[]).filter(P=>{const ie=!u||P.title.toLowerCase().includes(u.toLowerCase())||P.identifier.toLowerCase().includes(u.toLowerCase()),ge=m==="all"||P.status===m,Te=g==="all"||P.priority===g,qe=S==="all"||(S==="none"?!P.sprint_id:P.sprint_id===S);return ie&&ge&&Te&&qe}).sort((P,ie)=>{const ge=parseInt(P.identifier.split("-")[1]??"0",10),Te=parseInt(ie.identifier.split("-")[1]??"0",10);return ge-Te}),V={};for(const P of j??[])P.parent_id&&(V[P.parent_id]||(V[P.parent_id]=[]),V[P.parent_id].push(P));const W=q.filter(P=>!P.parent_id),z=q.length,Q=new Set((A??[]).map(P=>P.id)),ee={__none__:[]};for(const P of A??[])ee[P.id]=[];for(const P of W){const ie=P.task_list_id&&Q.has(P.task_list_id)?P.task_list_id:"__none__";ee[ie].push(P)}function k(){i.trim()&&D.mutate({name:i.trim()},{onSuccess:()=>{l(""),c(!1),R.success("List created")},onError:()=>R.error("Failed to create list")})}function M(P,ie){_.mutate({id:P,name:ie},{onError:()=>R.error("Failed to rename list")})}function Y(P){const ie=A==null?void 0:A.find(ge=>ge.id===P);confirm(`Delete list "${ie==null?void 0:ie.name}"? Issues in this list will be moved to No List.`)&&I.mutate(P,{onSuccess:()=>R.success("List deleted"),onError:()=>R.error("Failed to delete list")})}const L="grid-cols-[70px_1fr_150px_120px_130px_140px_130px_32px]";return t.jsxs("div",{className:"p-2",children:[t.jsx(tt,{zone:"project.issues.before",props:{projectId:w}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-2",children:[d?t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(xe,{autoFocus:!0,placeholder:"List name...",value:i,onChange:P=>l(P.target.value),onKeyDown:P=>{P.key==="Enter"&&k(),P.key==="Escape"&&(c(!1),l(""))},className:"h-8 text-xs w-36"}),t.jsx(K,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:k,disabled:!i.trim()||D.isPending,children:"Add"}),t.jsx(K,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{c(!1),l("")},children:"Cancel"})]}):t.jsxs(K,{size:"sm",variant:"outline",onClick:()=>c(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"New List"]}),t.jsxs(K,{size:"sm",onClick:()=>o({open:!0}),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create"]})]})}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(we,{value:S,onValueChange:b,children:[t.jsx(ve,{className:"h-8 text-xs w-[140px] bg-transparent",children:t.jsx(Ee,{placeholder:"Sprint"})}),t.jsxs(je,{children:[t.jsx(de,{value:"all",className:"text-xs",children:"All sprints"}),t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),X.map(P=>t.jsx(de,{value:P.id,className:"text-xs",children:P.name},P.id))]})]}),t.jsxs(we,{value:m,onValueChange:h,children:[t.jsx(ve,{className:"h-8 text-xs w-[130px] bg-transparent",children:t.jsx(Ee,{placeholder:"Status"})}),t.jsxs(je,{children:[t.jsx(de,{value:"all",className:"text-xs",children:"All statuses"}),$.map(({key:P,name:ie})=>t.jsx(de,{value:P,className:"text-xs",children:ie},P))]})]}),t.jsxs(we,{value:g,onValueChange:y,children:[t.jsx(ve,{className:"h-8 text-xs w-[130px] bg-transparent",children:t.jsx(Ee,{placeholder:"Priority"})}),t.jsxs(je,{children:[t.jsx(de,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(Ot).map(([P,ie])=>t.jsx(de,{value:P,className:"text-xs",children:ie},P))]})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx(ur,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),t.jsx(xe,{placeholder:"Search...",value:u,onChange:P=>f(P.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),t.jsxs("div",{className:O("grid items-center px-6 py-2.5 border-b border-border",L),children:[t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"ID"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Title"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),t.jsx("span",{})]}),E?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(P=>t.jsxs("div",{className:O("grid items-center px-6 py-3 gap-4",L),children:[t.jsx(te,{className:"h-4 w-14"}),t.jsx(te,{className:"h-4 w-56"}),t.jsx(te,{className:"h-5 w-20"}),t.jsx(te,{className:"h-4 w-16"}),t.jsx(te,{className:"h-4 w-20"}),t.jsx(te,{className:"h-4 w-24"}),t.jsx(te,{className:"h-6 w-16"}),t.jsx("span",{})]},P))}):z===0&&(j??[]).length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),t.jsxs(K,{size:"sm",onClick:()=>o({open:!0}),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create issue"]})]}):W.length===0&&(j??[]).length>0?t.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):t.jsx(ma,{delayDuration:200,children:t.jsxs("div",{className:"divide-y divide-border",children:[(A??[]).map(P=>t.jsx(Vo,{taskList:P,issues:ee[P.id]??[],childrenMap:V,projectId:w,statuses:$,statusLabels:F,statusColorMap:T,sprints:X,workspace:e,projectKey:s,onOpen:r,onAddIssue:ie=>o({open:!0,defaultTaskListId:ie}),onAddChild:ie=>o({open:!0,defaultParentId:ie}),onRenameList:M,onDeleteList:Y},P.id)),(((ae=ee.__none__)==null?void 0:ae.length)>0||(A??[]).length===0)&&t.jsx(Vo,{taskList:null,issues:ee.__none__??[],childrenMap:V,projectId:w,statuses:$,statusLabels:F,statusColorMap:T,sprints:X,workspace:e,projectKey:s,onOpen:r,onAddIssue:P=>o({open:!0,defaultTaskListId:P}),onAddChild:P=>o({open:!0,defaultParentId:P})})]})}),!E&&z>0&&t.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[z," issue",z!==1?"s":""]})})]}),t.jsx(tt,{zone:"project.issues.after",props:{projectId:w}}),t.jsx(qd,{issue:n,projectId:w,open:!!n,onClose:()=>r(null)}),t.jsx(wr,{open:a.open,onClose:()=>o({open:!1}),projectId:w,defaultTaskListId:a.defaultTaskListId,defaultParentId:a.defaultParentId})]})}function g0(e,s=[]){let n=[];function r(o,i){const l=x.createContext(i),d=n.length;n=[...n,i];const c=f=>{var b;const{scope:m,children:h,...g}=f,y=((b=m==null?void 0:m[e])==null?void 0:b[d])||l,S=x.useMemo(()=>g,Object.values(g));return t.jsx(y.Provider,{value:S,children:h})};c.displayName=o+"Provider";function u(f,m){var y;const h=((y=m==null?void 0:m[e])==null?void 0:y[d])||l,g=x.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${f}\` 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[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return a.scopeName=e,[r,b0(a,...s)]}function b0(...e){const s=e[0];if(e.length===1)return s;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((l,{useScope:d,scopeName:c})=>{const f=d(o)[`__scope${c}`];return{...l,...f}},{});return x.useMemo(()=>({[`__scope${s.scopeName}`]:i}),[i])}};return n.scopeName=s.scopeName,n}var y0=Symbol("radix.slottable");function v0(e){const s=({children:n})=>t.jsx(t.Fragment,{children:n});return s.displayName=`${e}.Slottable`,s.__radixId=y0,s}var Yd="AlertDialog",[j0]=g0(Yd,[Mi]),At=Mi(),Ld=e=>{const{__scopeAlertDialog:s,...n}=e,r=At(s);return t.jsx(Sn,{...r,...n,modal:!0})};Ld.displayName=Yd;var w0="AlertDialogTrigger",N0=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(Fc,{...a,...r,ref:s})});N0.displayName=w0;var k0="AlertDialogPortal",Hd=e=>{const{__scopeAlertDialog:s,...n}=e,r=At(s);return t.jsx(kn,{...r,...n})};Hd.displayName=k0;var S0="AlertDialogOverlay",Ud=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(ys,{...a,...r,ref:s})});Ud.displayName=S0;var Ws="AlertDialogContent",[C0,M0]=j0(Ws),D0=v0("AlertDialogContent"),Kd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=At(n),i=x.useRef(null),l=Ci(s,i),d=x.useRef(null);return t.jsx(Rc,{contentName:Ws,titleName:Vd,docsSlug:"alert-dialog",children:t.jsx(C0,{scope:n,cancelRef:d,children:t.jsxs(vs,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:Ic(a.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=d.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[t.jsx(D0,{children:r}),t.jsx(E0,{contentRef:i})]})})})});Kd.displayName=Ws;var Vd="AlertDialogTitle",Gd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(Hs,{...a,...r,ref:s})});Gd.displayName=Vd;var Qd="AlertDialogDescription",Xd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(Us,{...a,...r,ref:s})});Xd.displayName=Qd;var _0="AlertDialogAction",Jd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(rr,{...a,...r,ref:s})});Jd.displayName=_0;var Zd="AlertDialogCancel",ec=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=M0(Zd,n),o=At(n),i=Ci(s,a);return t.jsx(rr,{...o,...r,ref:i})});ec.displayName=Zd;var E0=({contentRef:e})=>{const s=`\`${Ws}\` requires a description for the component to be accessible for screen reader users.
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 Kh(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function Vh(){return Aa(/^Mac/)}function Gh(){return Aa(/^iPhone/)}function ko(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function Qh(){return Aa(/^iPad/)||Vh()&&navigator.maxTouchPoints>1}function zl(){return Gh()||Qh()}function Aa(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const Xh=24,Jh=typeof window<"u"?x.useLayoutEffect:x.useEffect;function So(...e){return(...s)=>{for(let n of e)typeof n=="function"&&n(...s)}}const $r=typeof document<"u"&&window.visualViewport;function Co(e){let s=window.getComputedStyle(e);return/(auto|scroll)/.test(s.overflow+s.overflowX+s.overflowY)}function Wl(e){for(Co(e)&&(e=e.parentElement);e&&!Co(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const Zh=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Gn=0,Rr;function ex(e={}){let{isDisabled:s}=e;Jh(()=>{if(!s)return Gn++,Gn===1&&zl()&&(Rr=tx()),()=>{Gn--,Gn===0&&(Rr==null||Rr())}},[s])}function tx(){let e,s=0,n=f=>{e=Wl(f.target),!(e===document.documentElement&&e===document.body)&&(s=f.changedTouches[0].pageY)},r=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,h=e.scrollTop,g=e.scrollHeight-e.clientHeight;g!==0&&((h<=0&&m>s||h>=g&&m<s)&&f.preventDefault(),s=m)},a=f=>{let m=f.target;na(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},o=f=>{let m=f.target;na(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",$r&&($r.height<window.innerHeight?requestAnimationFrame(()=>{Mo(m)}):$r.addEventListener("resize",()=>Mo(m),{once:!0}))}))},i=()=>{window.scrollTo(0,0)},l=window.pageXOffset,d=window.pageYOffset,c=So(sx(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=So(fn(document,"touchstart",n,{passive:!1,capture:!0}),fn(document,"touchmove",r,{passive:!1,capture:!0}),fn(document,"touchend",a,{passive:!1,capture:!0}),fn(document,"focus",o,!0),fn(window,"scroll",i));return()=>{c(),u(),window.scrollTo(l,d)}}function sx(e,s,n){let r=e.style[s];return e.style[s]=n,()=>{e.style[s]=r}}function fn(e,s,n,r){return e.addEventListener(s,n,r),()=>{e.removeEventListener(s,n,r)}}function Mo(e){let s=document.scrollingElement||document.documentElement;for(;e&&e!==s;){let n=Wl(e);if(n!==document.documentElement&&n!==document.body&&n!==e){let r=n.getBoundingClientRect().top,a=e.getBoundingClientRect().top,o=e.getBoundingClientRect().bottom;const i=n.getBoundingClientRect().bottom+Xh;o>i&&(n.scrollTop+=a-r)}e=n.parentElement}}function na(e){return e instanceof HTMLInputElement&&!Zh.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function nx(e,s){typeof e=="function"?e(s):e!=null&&(e.current=s)}function rx(...e){return s=>e.forEach(n=>nx(n,s))}function ql(...e){return x.useCallback(rx(...e),e)}const Bl=new WeakMap;function ze(e,s,n=!1){if(!e||!(e instanceof HTMLElement))return;let r={};Object.entries(s).forEach(([a,o])=>{if(a.startsWith("--")){e.style.setProperty(a,o);return}r[a]=e.style[a],e.style[a]=o}),!n&&Bl.set(e,r)}function ax(e,s){if(!e||!(e instanceof HTMLElement))return;let n=Bl.get(e);n&&(e.style[s]=n[s])}const Re=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Qn(e,s){if(!e)return null;const n=window.getComputedStyle(e),r=n.transform||n.webkitTransform||n.mozTransform;let a=r.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Re(s)?13:12]):(a=r.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Re(s)?5:4]):null)}function ox(e){return 8*(Math.log(e+1)-2)}function Ir(e,s){if(!e)return()=>{};const n=e.style.cssText;return Object.assign(e.style,s),()=>{e.style.cssText=n}}function ix(...e){return(...s)=>{for(const n of e)typeof n=="function"&&n(...s)}}const De={DURATION:.5,EASE:[.32,.72,0,1]},Yl=.4,lx=.25,dx=100,Ll=8,as=16,ra=26,Fr="vaul-dragging";function Ul(e){const s=v.useRef(e);return v.useEffect(()=>{s.current=e}),v.useMemo(()=>(...n)=>s.current==null?void 0:s.current.call(s,...n),[])}function cx({defaultProp:e,onChange:s}){const n=v.useState(e),[r]=n,a=v.useRef(r),o=Ul(s);return v.useEffect(()=>{a.current!==r&&(o(r),a.current=r)},[r,a,o]),n}function Hl({prop:e,defaultProp:s,onChange:n=()=>{}}){const[r,a]=cx({defaultProp:s,onChange:n}),o=e!==void 0,i=o?e:r,l=Ul(n),d=v.useCallback(c=>{if(o){const f=typeof c=="function"?c(e):c;f!==e&&l(f)}else a(c)},[o,e,a,l]);return[i,d]}function ux({activeSnapPointProp:e,setActiveSnapPointProp:s,snapPoints:n,drawerRef:r,overlayRef:a,fadeFromIndex:o,onSnapPointChange:i,direction:l="bottom",container:d,snapToSequentialPoint:c}){const[u,f]=Hl({prop:e,defaultProp:n==null?void 0:n[0],onChange:s}),[m,h]=v.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);v.useEffect(()=>{function C(){h({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const g=v.useMemo(()=>u===(n==null?void 0:n[n.length-1])||null,[n,u]),y=v.useMemo(()=>{var C;return(C=n==null?void 0:n.findIndex($=>$===u))!=null?C:null},[n,u]),S=n&&n.length>0&&(o||o===0)&&!Number.isNaN(o)&&n[o]===u||!n,b=v.useMemo(()=>{const C=d?{width:d.getBoundingClientRect().width,height:d.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var $;return($=n==null?void 0:n.map(D=>{const O=typeof D=="string";let F=0;if(O&&(F=parseInt(D,10)),Re(l)){const R=O?F:m?D*C.height:0;return m?l==="bottom"?C.height-R:-C.height+R:R}const _=O?F:m?D*C.width:0;return m?l==="right"?C.width-_:-C.width+_:_}))!=null?$:[]},[n,m,d]),N=v.useMemo(()=>y!==null?b==null?void 0:b[y]:null,[b,y]),w=v.useCallback(C=>{var $;const D=($=b==null?void 0:b.findIndex(O=>O===C))!=null?$:null;i(D),ze(r.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Re(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),b&&D!==b.length-1&&o!==void 0&&D!==o&&D<o?ze(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"0"}):ze(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"1"}),f(n==null?void 0:n[Math.max(D,0)])},[r.current,n,b,o,a,f]);v.useEffect(()=>{if(u||e){var C;const $=(C=n==null?void 0:n.findIndex(D=>D===e||D===u))!=null?C:-1;b&&$!==-1&&typeof b[$]=="number"&&w(b[$])}},[u,e,n,b,w]);function j({draggedDistance:C,closeDrawer:$,velocity:D,dismissible:O}){if(o===void 0)return;const F=l==="bottom"||l==="right"?(N??0)-C:(N??0)+C,_=y===o-1,R=y===0,T=C>0;if(_&&ze(a.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`}),!c&&D>2&&!T){O?$():w(b[0]);return}if(!c&&D>2&&T&&b&&n){w(b[n.length-1]);return}const X=b==null?void 0:b.reduce((V,W)=>typeof V!="number"||typeof W!="number"?V:Math.abs(W-F)<Math.abs(V-F)?W:V),q=Re(l)?window.innerHeight:window.innerWidth;if(D>Yl&&Math.abs(C)<q*.4){const V=T?1:-1;if(V>0&&g&&n){w(b[n.length-1]);return}if(R&&V<0&&O&&$(),y===null)return;w(b[y+V]);return}w(X)}function E({draggedDistance:C}){if(N===null)return;const $=l==="bottom"||l==="right"?N-C:N+C;(l==="bottom"||l==="right")&&$<b[b.length-1]||(l==="top"||l==="left")&&$>b[b.length-1]||ze(r.current,{transform:Re(l)?`translate3d(0, ${$}px, 0)`:`translate3d(${$}px, 0, 0)`})}function p(C,$){if(!n||typeof y!="number"||!b||o===void 0)return null;const D=y===o-1;if(y>=o&&$)return 0;if(D&&!$)return 1;if(!S&&!D)return null;const F=D?y+1:y-1,_=D?b[F]-b[F-1]:b[F+1]-b[F],R=C/Math.abs(_);return D?1-R:R}return{isLastSnapPoint:g,activeSnapPoint:u,shouldFade:S,getPercentageDragged:p,setActiveSnapPoint:f,activeSnapPointIndex:y,onRelease:j,onDrag:E,snapPointsOffset:b}}const mx=()=>()=>{};function fx(){const{direction:e,isOpen:s,shouldScaleBackground:n,setBackgroundColorOnScale:r,noBodyStyles:a}=Fn(),o=v.useRef(null),i=x.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-ra)/window.innerWidth}v.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;ix(r&&!a?Ir(document.body,{background:"black"}):mx,Ir(d,{transformOrigin:Re(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${De.DURATION}s`,transitionTimingFunction:`cubic-bezier(${De.EASE.join(",")})`}));const c=Ir(d,{borderRadius:`${Ll}px`,overflow:"hidden",...Re(e)?{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 hn=null;function hx({isOpen:e,modal:s,nested:n,hasBeenOpened:r,preventScrollRestoration:a,noBodyStyles:o}){const[i,l]=v.useState(()=>typeof window<"u"?window.location.href:""),d=v.useRef(0),c=v.useCallback(()=>{if(ko()&&hn===null&&e&&!o){hn={position:document.body.style.position,top:document.body.style.top,left:document.body.style.left,height:document.body.style.height,right:"unset"};const{scrollX:f,innerHeight:m}=window;document.body.style.setProperty("position","fixed","important"),Object.assign(document.body.style,{top:`${-d.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const h=m-window.innerHeight;h&&d.current>=m&&(document.body.style.top=`${-(d.current+h)}px`)}),300)}},[e]),u=v.useCallback(()=>{if(ko()&&hn!==null&&!o){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,hn),window.requestAnimationFrame(()=>{if(a&&i!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),hn=null}},[i]);return v.useEffect(()=>{function f(){d.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),v.useEffect(()=>{if(s)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[s,u]),v.useEffect(()=>{n||!r||(e?(!window.matchMedia("(display-mode: standalone)").matches&&c(),s||window.setTimeout(()=>{u()},500)):u())},[e,r,i,s,n,c,u]),{restorePositionSetting:u}}function xx({open:e,onOpenChange:s,children:n,onDrag:r,onRelease:a,snapPoints:o,shouldScaleBackground:i=!1,setBackgroundColorOnScale:l=!0,closeThreshold:d=lx,scrollLockTimeout:c=dx,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:m=o&&o.length-1,activeSnapPoint:h,setActiveSnapPoint:g,fixed:y,modal:S=!0,onClose:b,nested:N,noBodyStyles:w=!1,direction:j="bottom",defaultOpen:E=!1,disablePreventScroll:p=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:$=!1,repositionInputs:D=!0,onAnimationEnd:O,container:F,autoFocus:_=!1}){var R,T;const[X=!1,q]=Hl({defaultProp:E,prop:e,onChange:re=>{s==null||s(re),!re&&!N&&gt(),setTimeout(()=>{O==null||O(re)},De.DURATION*1e3),re&&!S&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),re||(document.body.style.pointerEvents="auto")}}),[V,W]=v.useState(!1),[z,Q]=v.useState(!1),[ee,k]=v.useState(!1),M=v.useRef(null),Y=v.useRef(null),L=v.useRef(null),ae=v.useRef(null),A=v.useRef(null),ie=v.useRef(!1),ge=v.useRef(null),Te=v.useRef(0),qe=v.useRef(!1),$t=v.useRef(!E),Zt=v.useRef(0),le=v.useRef(null),es=v.useRef(((R=le.current)==null?void 0:R.getBoundingClientRect().height)||0),ts=v.useRef(((T=le.current)==null?void 0:T.getBoundingClientRect().width)||0),ss=v.useRef(0),ns=v.useCallback(re=>{o&&re===Be.length-1&&(Y.current=new Date)},[]),{activeSnapPoint:rn,activeSnapPointIndex:dt,setActiveSnapPoint:pt,onRelease:Ms,snapPointsOffset:Be,onDrag:rs,shouldFade:Rt,getPercentageDragged:Ye}=ux({snapPoints:o,activeSnapPointProp:h,setActiveSnapPointProp:g,drawerRef:le,fadeFromIndex:m,overlayRef:M,onSnapPointChange:ns,direction:j,container:F,snapToSequentialPoint:C});ex({isDisabled:!X||z||!S||ee||!V||!D||!p});const{restorePositionSetting:gt}=hx({isOpen:X,modal:S,nested:N??!1,hasBeenOpened:V,preventScrollRestoration:$,noBodyStyles:w});function It(){return(window.innerWidth-ra)/window.innerWidth}function an(re){var G,se;!u&&!o||le.current&&!le.current.contains(re.target)||(es.current=((G=le.current)==null?void 0:G.getBoundingClientRect().height)||0,ts.current=((se=le.current)==null?void 0:se.getBoundingClientRect().width)||0,Q(!0),L.current=new Date,zl()&&window.addEventListener("touchend",()=>ie.current=!1,{once:!0}),re.target.setPointerCapture(re.pointerId),Te.current=Re(j)?re.pageY:re.pageX)}function St(re,G){var se;let H=re;const Z=(se=window.getSelection())==null?void 0:se.toString(),be=le.current?Qn(le.current,j):null,B=new Date;if(H.tagName==="SELECT"||H.hasAttribute("data-vaul-no-drag")||H.closest("[data-vaul-no-drag]"))return!1;if(j==="right"||j==="left")return!0;if(Y.current&&B.getTime()-Y.current.getTime()<500)return!1;if(be!==null&&(j==="bottom"?be>0:be<0))return!0;if(Z&&Z.length>0)return!1;if(A.current&&B.getTime()-A.current.getTime()<c&&be===0||G)return A.current=B,!1;for(;H;){if(H.scrollHeight>H.clientHeight){if(H.scrollTop!==0)return A.current=new Date,!1;if(H.getAttribute("role")==="dialog")return!0}H=H.parentNode}return!0}function on(re){if(le.current&&z){const G=j==="bottom"||j==="right"?1:-1,se=(Te.current-(Re(j)?re.pageY:re.pageX))*G,H=se>0,Z=o&&!u&&!H;if(Z&&dt===0)return;const be=Math.abs(se),B=document.querySelector("[data-vaul-drawer-wrapper]"),fe=j==="bottom"||j==="top"?es.current:ts.current;let he=be/fe;const Ae=Ye(be,H);if(Ae!==null&&(he=Ae),Z&&he>=1||!ie.current&&!St(re.target,H))return;if(le.current.classList.add(Fr),ie.current=!0,ze(le.current,{transition:"none"}),ze(M.current,{transition:"none"}),o&&rs({draggedDistance:se}),H&&!o){const Me=ox(se),at=Math.min(Me*-1,0)*G;ze(le.current,{transform:Re(j)?`translate3d(0, ${at}px, 0)`:`translate3d(${at}px, 0, 0)`});return}const Ce=1-he;if((Rt||m&&dt===m-1)&&(r==null||r(re,he),ze(M.current,{opacity:`${Ce}`,transition:"none"},!0)),B&&M.current&&i){const Me=Math.min(It()+he*(1-It()),1),at=8-he*8,Qe=Math.max(0,14-he*14);ze(B,{borderRadius:`${at}px`,transform:Re(j)?`scale(${Me}) translate3d(0, ${Qe}px, 0)`:`scale(${Me}) translate3d(${Qe}px, 0, 0)`,transition:"none"},!0)}if(!o){const Me=be*G;ze(le.current,{transform:Re(j)?`translate3d(0, ${Me}px, 0)`:`translate3d(${Me}px, 0, 0)`})}}}v.useEffect(()=>{window.requestAnimationFrame(()=>{$t.current=!0})},[]),v.useEffect(()=>{var re;function G(){if(!le.current||!D)return;const se=document.activeElement;if(na(se)||qe.current){var H;const Z=((H=window.visualViewport)==null?void 0:H.height)||0,be=window.innerHeight;let B=be-Z;const fe=le.current.getBoundingClientRect().height||0,he=fe>be*.8;ss.current||(ss.current=fe);const Ae=le.current.getBoundingClientRect().top;if(Math.abs(Zt.current-B)>60&&(qe.current=!qe.current),o&&o.length>0&&Be&&dt){const Ce=Be[dt]||0;B+=Ce}if(Zt.current=B,fe>Z||qe.current){const Ce=le.current.getBoundingClientRect().height;let Me=Ce;Ce>Z&&(Me=Z-(he?Ae:ra)),y?le.current.style.height=`${Ce-Math.max(B,0)}px`:le.current.style.height=`${Math.max(Me,Z-Ae)}px`}else Kh()||(le.current.style.height=`${ss.current}px`);o&&o.length>0&&!qe.current?le.current.style.bottom="0px":le.current.style.bottom=`${Math.max(B,0)}px`}}return(re=window.visualViewport)==null||re.addEventListener("resize",G),()=>{var se;return(se=window.visualViewport)==null?void 0:se.removeEventListener("resize",G)}},[dt,o,Be]);function bt(re){yt(),b==null||b(),re||q(!1),setTimeout(()=>{o&&pt(o[0])},De.DURATION*1e3)}function Ft(){if(!le.current)return;const re=document.querySelector("[data-vaul-drawer-wrapper]"),G=Qn(le.current,j);ze(le.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`}),ze(M.current,{transition:`opacity ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,opacity:"1"}),i&&G&&G>0&&X&&ze(re,{borderRadius:`${Ll}px`,overflow:"hidden",...Re(j)?{transform:`scale(${It()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${It()}) 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(){!z||!le.current||(le.current.classList.remove(Fr),ie.current=!1,Q(!1),ae.current=new Date)}function Ds(re){if(!z||!le.current)return;le.current.classList.remove(Fr),ie.current=!1,Q(!1),ae.current=new Date;const G=Qn(le.current,j);if(!re||!St(re.target,!1)||!G||Number.isNaN(G)||L.current===null)return;const se=ae.current.getTime()-L.current.getTime(),H=Te.current-(Re(j)?re.pageY:re.pageX),Z=Math.abs(H)/se;if(Z>.05&&(k(!0),setTimeout(()=>{k(!1)},200)),o){Ms({draggedDistance:H*(j==="bottom"||j==="right"?1:-1),closeDrawer:bt,velocity:Z,dismissible:u}),a==null||a(re,!0);return}if(j==="bottom"||j==="right"?H>0:H<0){Ft(),a==null||a(re,!0);return}if(Z>Yl){bt(),a==null||a(re,!1);return}var be;const B=Math.min((be=le.current.getBoundingClientRect().height)!=null?be:0,window.innerHeight);var fe;const he=Math.min((fe=le.current.getBoundingClientRect().width)!=null?fe:0,window.innerWidth),Ae=j==="left"||j==="right";if(Math.abs(G)>=(Ae?he:B)*d){bt(),a==null||a(re,!1);return}a==null||a(re,!0),Ft()}v.useEffect(()=>(X&&(ze(document.documentElement,{scrollBehavior:"auto"}),Y.current=new Date),()=>{ax(document.documentElement,"scrollBehavior")}),[X]);function vt(re){const G=re?(window.innerWidth-as)/window.innerWidth:1,se=re?-as:0;ge.current&&window.clearTimeout(ge.current),ze(le.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Re(j)?`scale(${G}) translate3d(0, ${se}px, 0)`:`scale(${G}) translate3d(${se}px, 0, 0)`}),!re&&le.current&&(ge.current=setTimeout(()=>{const H=Qn(le.current,j);ze(le.current,{transition:"none",transform:Re(j)?`translate3d(0, ${H}px, 0)`:`translate3d(${H}px, 0, 0)`})},500))}function _s(re,G){if(G<0)return;const se=(window.innerWidth-as)/window.innerWidth,H=se+G*(1-se),Z=-as+G*as;ze(le.current,{transform:Re(j)?`scale(${H}) translate3d(0, ${Z}px, 0)`:`scale(${H}) translate3d(${Z}px, 0, 0)`,transition:"none"})}function ln(re,G){const se=Re(j)?window.innerHeight:window.innerWidth,H=G?(se-as)/se:1,Z=G?-as:0;G&&ze(le.current,{transition:`transform ${De.DURATION}s cubic-bezier(${De.EASE.join(",")})`,transform:Re(j)?`scale(${H}) translate3d(0, ${Z}px, 0)`:`scale(${H}) translate3d(${Z}px, 0, 0)`})}return v.useEffect(()=>{S||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[S]),v.createElement(Sn,{defaultOpen:E,onOpenChange:re=>{!u&&!re||(re?W(!0):bt(!0),q(re))},open:X},v.createElement(Fl.Provider,{value:{activeSnapPoint:rn,snapPoints:o,setActiveSnapPoint:pt,drawerRef:le,overlayRef:M,onOpenChange:s,onPress:an,onRelease:Ds,onDrag:on,dismissible:u,shouldAnimate:$t,handleOnly:f,isOpen:X,isDragging:z,shouldFade:Rt,closeDrawer:bt,onNestedDrag:_s,onNestedOpenChange:vt,onNestedRelease:ln,keyboardIsOpen:qe,modal:S,snapPointsOffset:Be,activeSnapPointIndex:dt,direction:j,shouldScaleBackground:i,setBackgroundColorOnScale:l,noBodyStyles:w,container:F,autoFocus:_}},n))}const Kl=v.forwardRef(function({...e},s){const{overlayRef:n,snapPoints:r,onRelease:a,shouldFade:o,isOpen:i,modal:l,shouldAnimate:d}=Fn(),c=ql(s,n),u=r&&r.length>0;if(!l)return null;const f=v.useCallback(m=>a(m),[a]);return v.createElement(ys,{onMouseUp:f,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",...e})});Kl.displayName="Drawer.Overlay";const Vl=v.forwardRef(function({onPointerDownOutside:e,style:s,onOpenAutoFocus:n,...r},a){const{drawerRef:o,onPress:i,onRelease:l,onDrag:d,keyboardIsOpen:c,snapPointsOffset:u,activeSnapPointIndex:f,modal:m,isOpen:h,direction:g,snapPoints:y,container:S,handleOnly:b,shouldAnimate:N,autoFocus:w}=Fn(),[j,E]=v.useState(!1),p=ql(a,o),C=v.useRef(null),$=v.useRef(null),D=v.useRef(!1),O=y&&y.length>0;fx();const F=(R,T,X=0)=>{if(D.current)return!0;const q=Math.abs(R.y),V=Math.abs(R.x),W=V>q,z=["bottom","right"].includes(T)?1:-1;if(T==="left"||T==="right"){if(!(R.x*z<0)&&V>=0&&V<=X)return W}else if(!(R.y*z<0)&&q>=0&&q<=X)return!W;return D.current=!0,!0};v.useEffect(()=>{O&&window.requestAnimationFrame(()=>{E(!0)})},[]);function _(R){C.current=null,D.current=!1,l(R)}return v.createElement(vs,{"data-vaul-drawer-direction":g,"data-vaul-drawer":"","data-vaul-delayed-snap-points":j?"true":"false","data-vaul-snap-points":h&&O?"true":"false","data-vaul-custom-container":S?"true":"false","data-vaul-animate":N!=null&&N.current?"true":"false",...r,ref:p,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...s}:s,onPointerDown:R=>{b||(r.onPointerDown==null||r.onPointerDown.call(r,R),C.current={x:R.pageX,y:R.pageY},i(R))},onOpenAutoFocus:R=>{n==null||n(R),w||R.preventDefault()},onPointerDownOutside:R=>{if(e==null||e(R),!m||R.defaultPrevented){R.preventDefault();return}c.current&&(c.current=!1)},onFocusOutside:R=>{if(!m){R.preventDefault();return}},onPointerMove:R=>{if($.current=R,b||(r.onPointerMove==null||r.onPointerMove.call(r,R),!C.current))return;const T=R.pageY-C.current.y,X=R.pageX-C.current.x,q=R.pointerType==="touch"?10:2;F({x:X,y:T},g,q)?d(R):(Math.abs(X)>q||Math.abs(T)>q)&&(C.current=null)},onPointerUp:R=>{r.onPointerUp==null||r.onPointerUp.call(r,R),C.current=null,D.current=!1,l(R)},onPointerOut:R=>{r.onPointerOut==null||r.onPointerOut.call(r,R),_($.current)},onContextMenu:R=>{r.onContextMenu==null||r.onContextMenu.call(r,R),$.current&&_($.current)}})});Vl.displayName="Drawer.Content";const px=250,gx=120,bx=v.forwardRef(function({preventCycle:e=!1,children:s,...n},r){const{closeDrawer:a,isDragging:o,snapPoints:i,activeSnapPoint:l,setActiveSnapPoint:d,dismissible:c,handleOnly:u,isOpen:f,onPress:m,onDrag:h}=Fn(),g=v.useRef(null),y=v.useRef(!1);function S(){if(y.current){w();return}window.setTimeout(()=>{b()},gx)}function b(){if(o||e||y.current){w();return}if(w(),!i||i.length===0){c||a();return}if(l===i[i.length-1]&&c){a();return}const E=i.findIndex(C=>C===l);if(E===-1)return;const p=i[E+1];d(p)}function N(){g.current=window.setTimeout(()=>{y.current=!0},px)}function w(){g.current&&window.clearTimeout(g.current),y.current=!1}return v.createElement("div",{onClick:S,onPointerCancel:w,onPointerDown:j=>{u&&m(j),N()},onPointerMove:j=>{u&&h(j)},ref:r,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...n},v.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},s))});bx.displayName="Drawer.Handle";function yx(e){const s=Fn(),{container:n=s.container,...r}=e;return v.createElement(kn,{container:n,...r})}const Pt={Root:xx,Content:Vl,Overlay:Kl,Portal:yx,Title:Us,Description:Hs},Ss=({shouldScaleBackground:e=!1,direction:s="right",...n})=>t.jsx(Pt.Root,{shouldScaleBackground:e,direction:s,...n});Ss.displayName="Drawer";const vx=Pt.Portal,Gl=x.forwardRef(({className:e,...s},n)=>t.jsx(Pt.Overlay,{ref:n,className:P("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",e),...s}));Gl.displayName=Pt.Overlay.displayName;const Cs=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(vx,{children:[t.jsx(Gl,{}),t.jsx(Pt.Content,{ref:r,className:P("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",e),...n,children:s})]}));Cs.displayName="DrawerContent";const Js=({className:e,...s})=>t.jsx("div",{className:P("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...s});Js.displayName="DrawerHeader";const Zs=({className:e,...s})=>t.jsx("div",{className:P("flex-1 overflow-y-auto px-6 py-4",e),...s});Zs.displayName="DrawerBody";const zn=({className:e,...s})=>t.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2 px-6 py-4 border-t border-border shrink-0",e),...s});zn.displayName="DrawerFooter";const en=x.forwardRef(({className:e,...s},n)=>t.jsx(Pt.Title,{ref:n,className:P("text-base font-semibold text-foreground",e),...s}));en.displayName=Pt.Title.displayName;const jx=x.forwardRef(({className:e,...s},n)=>t.jsx(Pt.Description,{ref:n,className:P("text-sm text-muted-foreground",e),...s}));jx.displayName=Pt.Description.displayName;const wx=Mn("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),We=x.forwardRef(({className:e,...s},n)=>t.jsx(pi,{ref:n,className:P(wx(),e),...s}));We.displayName=pi.displayName;const yr=x.forwardRef(({className:e,...s},n)=>t.jsx("textarea",{className:P("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",e),ref:n,...s}));yr.displayName="Textarea";const Do=[{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}],zr=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function Nx(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function kx({chip:e,onRemove:s}){const{attributes:n,listeners:r,setNodeRef:a,transform:o,transition:i,isDragging:l}=da({id:e.key});return t.jsxs("div",{ref:a,style:{transform:ca.Transform.toString(o),transition:i},className:P("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:[t.jsx("span",{...n,...r,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:t.jsx(fl,{className:"h-3 w-3"})}),t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),t.jsx("span",{className:"text-[11px]",children:e.name}),t.jsx("button",{type:"button",onClick:s,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:t.jsx(Fe,{className:"h-3 w-3"})})]})}const Sx=3;function Cx({open:e,onClose:s}){var X;const[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState(!1),[u,f]=x.useState(!1),[m,h]=x.useState(Do),[g,y]=x.useState(""),[S,b]=x.useState(zr[2]),{workspace:N}=ke(),w=Xf(),j=Gf(n,{enabled:e}),E=Qf(a,{enabled:e});x.useEffect(()=>{e&&j.data&&!d&&o(j.data)},[e,j.data,d]);const p=E.available===!1||w.isError&&((X=w.error)==null?void 0:X.status)===409,C=a.trim().length>=Sx&&/^[A-Z0-9]+$/i.test(a.trim()),$=_i(Ei(Oi,{activationConstraint:{distance:5}})),D=q=>{r(q)},O=()=>{n.trim()&&!d&&j.flush()},F=()=>{r(""),o(""),l(""),c(!1),f(!1),h(Do),y(""),b(zr[2]),w.reset(),s()},_=()=>{if(!g.trim())return;const q=Nx(g.trim());if(m.some(V=>V.key===q)){I.error("A status with this name already exists");return}h(V=>[...V,{name:g.trim(),key:q,color:S,category:"started",position:V.length}]),y("")},R=q=>{const{active:V,over:W}=q;!W||V.id===W.id||h(z=>{const Q=z.findIndex(k=>k.key===V.id),ee=z.findIndex(k=>k.key===W.id);return Zn(z,Q,ee).map((k,M)=>({...k,position:M}))})},T=q=>{q.preventDefault(),!(!n.trim()||!a.trim()||!C||p)&&w.mutate({name:n.trim(),identifier:a.trim().toUpperCase(),description:i.trim()||void 0,workspace_id:N.id,initial_statuses:m},{onSuccess:()=>{I.success("Project created"),F()},onError:V=>{(V==null?void 0:V.status)===409?I.error("This project key is already in use."):I.error(V.message??"Failed to create project")}})};return t.jsx(Ss,{open:e,onOpenChange:q=>!q&&F(),children:t.jsxs(Cs,{className:"max-w-md",children:[t.jsx(Js,{children:t.jsx(en,{children:"New project"})}),t.jsxs("form",{onSubmit:T,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(Zs,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{htmlFor:"project-name",children:"Name"}),t.jsx(xe,{id:"project-name",placeholder:"My Project",value:n,onChange:q=>D(q.target.value),onBlur:O,autoFocus:!0}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"project-id",children:["Identifier",t.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),t.jsx(xe,{id:"project-id",placeholder:"PROJ",value:a,onChange:q=>{o(q.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),c(!0)},maxLength:5,className:P("font-mono",p&&"border-destructive"),"aria-invalid":p}),p&&t.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"project-desc",children:["Description",t.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(yr,{id:"project-desc",placeholder:"What is this project about?",value:i,onChange:q=>l(q.target.value),className:"min-h-[80px]"})]}),t.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[t.jsx("button",{type:"button",onClick:()=>f(!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:t.jsxs("span",{className:"flex items-center gap-1.5",children:[u?t.jsx(Vs,{className:"h-3.5 w-3.5"}):t.jsx(Gs,{className:"h-3.5 w-3.5"}),"Statuses",t.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",m.length,")"]})]})}),u&&t.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[t.jsx(Ti,{sensors:$,onDragEnd:R,children:t.jsx(la,{items:m.map(q=>q.key),strategy:Pi,children:t.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(q=>t.jsx(kx,{chip:q,onRemove:()=>h(V=>V.filter(W=>W.key!==q.key).map((W,z)=>({...W,position:z})))},q.key))})})}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:zr.map(q=>t.jsx("button",{type:"button",onClick:()=>b(q),className:P("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",S===q?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:q}},q))}),t.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[t.jsx(xe,{placeholder:"Status name…",value:g,onChange:q=>y(q.target.value),onKeyDown:q=>{q.key==="Enter"&&(q.preventDefault(),_())},className:"h-7 text-xs flex-1"}),t.jsx(K,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:_,disabled:!g.trim(),children:t.jsx(Ie,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),t.jsxs(zn,{children:[t.jsx(K,{type:"button",variant:"ghost",onClick:F,children:"Cancel"}),t.jsx(K,{type:"submit",disabled:!n.trim()||!a.trim()||!C||p||w.isPending,children:w.isPending?"Creating...":"Create project"})]})]})]})})}const we=Ec,Ee=Oc,ve=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(gi,{ref:r,className:P("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",e),...n,children:[s,t.jsx(Sc,{asChild:!0,children:t.jsx(Vs,{className:"h-4 w-4 opacity-50"})})]}));ve.displayName=gi.displayName;const Ql=x.forwardRef(({className:e,...s},n)=>t.jsx(bi,{ref:n,className:P("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(ga,{className:"h-4 w-4"})}));Ql.displayName=bi.displayName;const Xl=x.forwardRef(({className:e,...s},n)=>t.jsx(yi,{ref:n,className:P("flex cursor-default items-center justify-center py-1",e),...s,children:t.jsx(Vs,{className:"h-4 w-4"})}));Xl.displayName=yi.displayName;const je=x.forwardRef(({className:e,children:s,position:n="popper",...r},a)=>t.jsx(Cc,{children:t.jsxs(vi,{ref:a,className:P("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",e),position:n,...r,children:[t.jsx(Ql,{}),t.jsx(Mc,{className:P("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),t.jsx(Xl,{})]})}));je.displayName=vi.displayName;const Mx=x.forwardRef(({className:e,...s},n)=>t.jsx(ji,{ref:n,className:P("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...s}));Mx.displayName=ji.displayName;const ce=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(wi,{ref:r,className:P("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",e),...n,children:[t.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:t.jsx(Dc,{children:t.jsx(it,{className:"h-4 w-4"})})}),t.jsx(_c,{children:s})]}));ce.displayName=wi.displayName;const Dx=x.forwardRef(({className:e,...s},n)=>t.jsx(Ni,{ref:n,className:P("-mx-1 my-1 h-px bg-border",e),...s}));Dx.displayName=Ni.displayName;const Wn={project:e=>["projects",e,"access"]};function Jl(e){return Ne({queryKey:Wn.project(e),queryFn:()=>J.get(`/admin/projects/${e}/access`),enabled:!!e})}function Zl(e){const s=ue();return de({mutationFn:({userId:n,role:r})=>J.post(`/admin/projects/${e}/members`,{user_id:n,role:r}),onSuccess:()=>{s.invalidateQueries({queryKey:Wn.project(e)})}})}function ed(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/projects/${e}/members/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Wn.project(e)})}})}function td(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/projects/${e}/teams`,{team_id:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Wn.project(e)})}})}function sd(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/projects/${e}/teams/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Wn.project(e)})}})}function _x({open:e,onClose:s,projectId:n,projectName:r}){const{workspace:a}=ke(),o=(a==null?void 0:a.id)??"",{data:i,isLoading:l}=Jl(n),{data:d}=Tn(o),{data:c}=Ca(o),u=Zl(n),f=ed(n),m=td(n),h=sd(n),[g,y]=x.useState(""),[S,b]=x.useState(""),N=new Set((i==null?void 0:i.members.map(p=>p.user_id))??[]),w=new Set((i==null?void 0:i.teams.map(p=>p.team_id))??[]),j=(d??[]).filter(p=>!N.has(p.user_id)),E=(c??[]).filter(p=>!w.has(p.id));return t.jsx(pr,{open:e,onOpenChange:p=>!p&&s(),children:t.jsxs(In,{className:"sm:max-w-[480px]",children:[t.jsx(gr,{children:t.jsxs(br,{children:["Access — ",r]})}),t.jsxs("div",{className:"space-y-5 pt-1",children:[t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?t.jsx("div",{className:"space-y-2",children:[1,2].map(p=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"h-7 w-7 rounded-full"}),t.jsx(te,{className:"h-3.5 w-32"})]},p))}):(i==null?void 0:i.members.length)===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):t.jsx("div",{className:"space-y-1",children:i==null?void 0:i.members.map(p=>{var _;const C=p.user,$=(C==null?void 0:C.first_name)??"",D=(C==null?void 0:C.last_name)??"",O=`${$} ${D}`.trim()||(C==null?void 0:C.email)||"Unknown",F=($[0]??D[0]??((_=C==null?void 0:C.email)==null?void 0:_[0])??"U").toUpperCase();return t.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[t.jsx(st,{className:"h-7 w-7 shrink-0",children:t.jsx(nt,{className:"text-[11px] font-medium",children:F})}),t.jsx("span",{className:"flex-1 text-sm truncate",children:O}),t.jsx("span",{className:P("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}),t.jsx("button",{onClick:()=>f.mutate(p.user_id,{onSuccess:()=>I.success("Access removed"),onError:()=>I.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]},p.id)})}),j.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(On,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs(we,{value:g,onValueChange:y,children:[t.jsx(ve,{className:"h-8 text-xs flex-1",children:t.jsx(Ee,{placeholder:"Add person…"})}),t.jsx(je,{children:j.map(p=>{const C=p.user,$=(C==null?void 0:C.first_name)??"",D=(C==null?void 0:C.last_name)??"",O=`${$} ${D}`.trim()||(C==null?void 0:C.email)||"Unknown";return t.jsx(ce,{value:p.user_id,children:O},p.user_id)})})]}),g&&t.jsx(K,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:u.isPending,onClick:()=>u.mutate({userId:g},{onSuccess:()=>{I.success("Access granted"),y("")},onError:()=>I.error("Failed to grant access")}),children:"Add"})]})]}),t.jsxs("div",{children:[t.jsx("div",{className:"flex items-center justify-between mb-2",children:t.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?t.jsx("div",{className:"space-y-2",children:[1].map(p=>t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(te,{className:"h-7 w-7 rounded-lg"}),t.jsx(te,{className:"h-3.5 w-28"})]},p))}):(i==null?void 0:i.teams.length)===0?t.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):t.jsx("div",{className:"space-y-1",children:i==null?void 0:i.teams.map(p=>{const C=p.team;return t.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[t.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:t.jsx(xs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsx("span",{className:"flex-1 text-sm truncate",children:(C==null?void 0:C.name)??"Unknown team"}),C&&t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[C.member_count," ",C.member_count===1?"member":"members"]}),t.jsx("button",{onClick:()=>h.mutate(p.team_id,{onSuccess:()=>I.success("Team access removed"),onError:()=>I.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]},p.id)})}),E.length>0&&t.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[t.jsx(xs,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs(we,{value:S,onValueChange:b,children:[t.jsx(ve,{className:"h-8 text-xs flex-1",children:t.jsx(Ee,{placeholder:"Add team…"})}),t.jsx(je,{children:E.map(p=>t.jsx(ce,{value:p.id,children:p.name},p.id))})]}),S&&t.jsx(K,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:m.isPending,onClick:()=>m.mutate(S,{onSuccess:()=>{I.success("Team access granted"),b("")},onError:()=>I.error("Failed to add team")}),children:"Add"})]})]}),t.jsx("div",{className:"flex justify-end pt-1",children:t.jsx(K,{variant:"outline",size:"sm",onClick:s,children:"Close"})})]})]})})}const nd=6048e5,Ex=864e5,Dy=36e5,Xn=43200,_o=1440,Eo=Symbol.for("constructDateFrom");function Oe(e,s){return typeof e=="function"?e(s):e&&typeof e=="object"&&Eo in e?e[Eo](s):e instanceof Date?new e.constructor(s):new Date(s)}function pe(e,s){return Oe(s||e,e)}function $a(e,s,n){const r=pe(e,n==null?void 0:n.in);return isNaN(s)?Oe((n==null?void 0:n.in)||e,NaN):(s&&r.setDate(r.getDate()+s),r)}function rd(e,s,n){const r=pe(e,n==null?void 0:n.in);if(isNaN(s))return Oe((n==null?void 0:n.in)||e,NaN);if(!s)return r;const a=r.getDate(),o=Oe((n==null?void 0:n.in)||e,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 Ox={};function tn(){return Ox}function Bs(e,s){var l,d,c,u;const n=tn(),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(e,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 jn(e,s){return Bs(e,{...s,weekStartsOn:1})}function ad(e,s){const n=pe(e,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=jn(a),i=Oe(n,0);i.setFullYear(r,0,4),i.setHours(0,0,0,0);const l=jn(i);return n.getTime()>=o.getTime()?r+1:n.getTime()>=l.getTime()?r:r-1}function sr(e){const s=pe(e),n=new Date(Date.UTC(s.getFullYear(),s.getMonth(),s.getDate(),s.getHours(),s.getMinutes(),s.getSeconds(),s.getMilliseconds()));return n.setUTCFullYear(s.getFullYear()),+e-+n}function Jt(e,...s){const n=Oe.bind(null,e||s.find(r=>typeof r=="object"));return s.map(n)}function wn(e,s){const n=pe(e,s==null?void 0:s.in);return n.setHours(0,0,0,0),n}function Ra(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s),o=wn(r),i=wn(a),l=+o-sr(o),d=+i-sr(i);return Math.round((l-d)/Ex)}function Tx(e,s){const n=ad(e,s),r=Oe(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),jn(r)}function Px(e,s,n){return $a(e,s*7,n)}function Ax(e,s,n){return rd(e,s*12,n)}function $x(e,s){let n,r=s==null?void 0:s.in;return e.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 Rx(e,s){let n,r=s==null?void 0:s.in;return e.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 er(e,s){const n=+pe(e)-+pe(s);return n<0?-1:n>0?1:n}function Ia(e){return Oe(e,Date.now())}function Fa(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s);return+wn(r)==+wn(a)}function od(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function Ix(e){return!(!od(e)&&typeof e!="number"||isNaN(+pe(e)))}function za(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s),o=r.getFullYear()-a.getFullYear(),i=r.getMonth()-a.getMonth();return o*12+i}function Fx(e){return s=>{const r=(e?Math[e]:Math.trunc)(s);return r===0?0:r}}function zx(e,s){return+pe(e)-+pe(s)}function Wx(e,s){const n=pe(e,s==null?void 0:s.in);return n.setHours(23,59,59,999),n}function id(e,s){const n=pe(e,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 qx(e,s){const n=pe(e,s==null?void 0:s.in);return+Wx(n,s)==+id(n,s)}function Bx(e,s,n){const[r,a,o]=Jt(n==null?void 0:n.in,e,e,s),i=er(a,o),l=Math.abs(za(a,o));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-i*l);let d=er(a,o)===-i;qx(r)&&l===1&&er(r,o)===1&&(d=!1);const c=i*(l-+d);return c===0?0:c}function Yx(e,s,n){const r=zx(e,s)/1e3;return Fx(n==null?void 0:n.roundingMethod)(r)}function ld(e,s){const[n,r]=Jt(e,s.start,s.end);return{start:n,end:r}}function Lx(e,s){const{start:n,end:r}=ld(s==null?void 0:s.in,e);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 Ux(e,s){const n=pe(e,s==null?void 0:s.in);return n.setDate(1),n.setHours(0,0,0,0),n}function Hx(e,s){const n=pe(e,s==null?void 0:s.in),r=n.getFullYear();return n.setFullYear(r+1,0,0),n.setHours(23,59,59,999),n}function dd(e,s){const n=pe(e,s==null?void 0:s.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}function Kx(e,s){const{start:n,end:r}=ld(s==null?void 0:s.in,e);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 cd(e,s){var l,d,c,u;const n=tn(),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(e,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 Vx(e,s){return cd(e,{...s,weekStartsOn:1})}const Gx={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"}},Qx=(e,s,n)=>{let r;const a=Gx[e];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 Wr(e){return(s={})=>{const n=s.width?String(s.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const Xx={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Jx={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Zx={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ep={date:Wr({formats:Xx,defaultWidth:"full"}),time:Wr({formats:Jx,defaultWidth:"full"}),dateTime:Wr({formats:Zx,defaultWidth:"full"})},tp={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},sp=(e,s,n,r)=>tp[e];function xn(e){return(s,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let a;if(r==="formatting"&&e.formattingValues){const i=e.defaultFormattingWidth||e.defaultWidth,l=n!=null&&n.width?String(n.width):i;a=e.formattingValues[l]||e.formattingValues[i]}else{const i=e.defaultWidth,l=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[l]||e.values[i]}const o=e.argumentCallback?e.argumentCallback(s):s;return a[o]}}const np={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},rp={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},ap={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"]},op={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"]},ip={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"}},lp={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"}},dp=(e,s)=>{const n=Number(e),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"},cp={ordinalNumber:dp,era:xn({values:np,defaultWidth:"wide"}),quarter:xn({values:rp,defaultWidth:"wide",argumentCallback:e=>e-1}),month:xn({values:ap,defaultWidth:"wide"}),day:xn({values:op,defaultWidth:"wide"}),dayPeriod:xn({values:ip,defaultWidth:"wide",formattingValues:lp,defaultFormattingWidth:"wide"})};function pn(e){return(s,n={})=>{const r=n.width,a=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=s.match(a);if(!o)return null;const i=o[0],l=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?mp(l,f=>f.test(i)):up(l,f=>f.test(i));let c;c=e.valueCallback?e.valueCallback(d):d,c=n.valueCallback?n.valueCallback(c):c;const u=s.slice(i.length);return{value:c,rest:u}}}function up(e,s){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&s(e[n]))return n}function mp(e,s){for(let n=0;n<e.length;n++)if(s(e[n]))return n}function fp(e){return(s,n={})=>{const r=s.match(e.matchPattern);if(!r)return null;const a=r[0],o=s.match(e.parsePattern);if(!o)return null;let i=e.valueCallback?e.valueCallback(o[0]):o[0];i=n.valueCallback?n.valueCallback(i):i;const l=s.slice(a.length);return{value:i,rest:l}}}const hp=/^(\d+)(th|st|nd|rd)?/i,xp=/\d+/i,pp={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},gp={any:[/^b/i,/^(a|c)/i]},bp={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},yp={any:[/1/i,/2/i,/3/i,/4/i]},vp={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},jp={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]},wp={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},Np={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]},kp={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},Sp={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}},Cp={ordinalNumber:fp({matchPattern:hp,parsePattern:xp,valueCallback:e=>parseInt(e,10)}),era:pn({matchPatterns:pp,defaultMatchWidth:"wide",parsePatterns:gp,defaultParseWidth:"any"}),quarter:pn({matchPatterns:bp,defaultMatchWidth:"wide",parsePatterns:yp,defaultParseWidth:"any",valueCallback:e=>e+1}),month:pn({matchPatterns:vp,defaultMatchWidth:"wide",parsePatterns:jp,defaultParseWidth:"any"}),day:pn({matchPatterns:wp,defaultMatchWidth:"wide",parsePatterns:Np,defaultParseWidth:"any"}),dayPeriod:pn({matchPatterns:kp,defaultMatchWidth:"any",parsePatterns:Sp,defaultParseWidth:"any"})},ds={code:"en-US",formatDistance:Qx,formatLong:ep,formatRelative:sp,localize:cp,match:Cp,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Mp(e,s){const n=pe(e,s==null?void 0:s.in);return Ra(n,dd(n))+1}function Wa(e,s){const n=pe(e,s==null?void 0:s.in),r=+jn(n)-+Tx(n);return Math.round(r/nd)+1}function ud(e,s){var u,f,m,h;const n=pe(e,s==null?void 0:s.in),r=n.getFullYear(),a=tn(),o=(s==null?void 0:s.firstWeekContainsDate)??((f=(u=s==null?void 0:s.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??a.firstWeekContainsDate??((h=(m=a.locale)==null?void 0:m.options)==null?void 0:h.firstWeekContainsDate)??1,i=Oe((s==null?void 0:s.in)||e,0);i.setFullYear(r+1,0,o),i.setHours(0,0,0,0);const l=Bs(i,s),d=Oe((s==null?void 0:s.in)||e,0);d.setFullYear(r,0,o),d.setHours(0,0,0,0);const c=Bs(d,s);return+n>=+l?r+1:+n>=+c?r:r-1}function Dp(e,s){var l,d,c,u;const n=tn(),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=ud(e,s),o=Oe((s==null?void 0:s.in)||e,0);return o.setFullYear(a,0,r),o.setHours(0,0,0,0),Bs(o,s)}function qa(e,s){const n=pe(e,s==null?void 0:s.in),r=+Bs(n,s)-+Dp(n,s);return Math.round(r/nd)+1}function ye(e,s){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(s,"0");return n+r}const Bt={y(e,s){const n=e.getFullYear(),r=n>0?n:1-n;return ye(s==="yy"?r%100:r,s.length)},M(e,s){const n=e.getMonth();return s==="M"?String(n+1):ye(n+1,2)},d(e,s){return ye(e.getDate(),s.length)},a(e,s){const n=e.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(e,s){return ye(e.getHours()%12||12,s.length)},H(e,s){return ye(e.getHours(),s.length)},m(e,s){return ye(e.getMinutes(),s.length)},s(e,s){return ye(e.getSeconds(),s.length)},S(e,s){const n=s.length,r=e.getMilliseconds(),a=Math.trunc(r*Math.pow(10,n-3));return ye(a,s.length)}},Es={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Oo={G:function(e,s,n){const r=e.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(e,s,n){if(s==="yo"){const r=e.getFullYear(),a=r>0?r:1-r;return n.ordinalNumber(a,{unit:"year"})}return Bt.y(e,s)},Y:function(e,s,n,r){const a=ud(e,r),o=a>0?a:1-a;if(s==="YY"){const i=o%100;return ye(i,2)}return s==="Yo"?n.ordinalNumber(o,{unit:"year"}):ye(o,s.length)},R:function(e,s){const n=ad(e);return ye(n,s.length)},u:function(e,s){const n=e.getFullYear();return ye(n,s.length)},Q:function(e,s,n){const r=Math.ceil((e.getMonth()+1)/3);switch(s){case"Q":return String(r);case"QQ":return ye(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(e,s,n){const r=Math.ceil((e.getMonth()+1)/3);switch(s){case"q":return String(r);case"qq":return ye(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(e,s,n){const r=e.getMonth();switch(s){case"M":case"MM":return Bt.M(e,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(e,s,n){const r=e.getMonth();switch(s){case"L":return String(r+1);case"LL":return ye(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(e,s,n,r){const a=qa(e,r);return s==="wo"?n.ordinalNumber(a,{unit:"week"}):ye(a,s.length)},I:function(e,s,n){const r=Wa(e);return s==="Io"?n.ordinalNumber(r,{unit:"week"}):ye(r,s.length)},d:function(e,s,n){return s==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):Bt.d(e,s)},D:function(e,s,n){const r=Mp(e);return s==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ye(r,s.length)},E:function(e,s,n){const r=e.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(e,s,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(s){case"e":return String(o);case"ee":return ye(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(e,s,n,r){const a=e.getDay(),o=(a-r.weekStartsOn+8)%7||7;switch(s){case"c":return String(o);case"cc":return ye(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(e,s,n){const r=e.getDay(),a=r===0?7:r;switch(s){case"i":return String(a);case"ii":return ye(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(e,s,n){const a=e.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(e,s,n){const r=e.getHours();let a;switch(r===12?a=Es.noon:r===0?a=Es.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(e,s,n){const r=e.getHours();let a;switch(r>=17?a=Es.evening:r>=12?a=Es.afternoon:r>=4?a=Es.morning:a=Es.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(e,s,n){if(s==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return Bt.h(e,s)},H:function(e,s,n){return s==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):Bt.H(e,s)},K:function(e,s,n){const r=e.getHours()%12;return s==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ye(r,s.length)},k:function(e,s,n){let r=e.getHours();return r===0&&(r=24),s==="ko"?n.ordinalNumber(r,{unit:"hour"}):ye(r,s.length)},m:function(e,s,n){return s==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):Bt.m(e,s)},s:function(e,s,n){return s==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):Bt.s(e,s)},S:function(e,s){return Bt.S(e,s)},X:function(e,s,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(s){case"X":return Po(r);case"XXXX":case"XX":return is(r);case"XXXXX":case"XXX":default:return is(r,":")}},x:function(e,s,n){const r=e.getTimezoneOffset();switch(s){case"x":return Po(r);case"xxxx":case"xx":return is(r);case"xxxxx":case"xxx":default:return is(r,":")}},O:function(e,s,n){const r=e.getTimezoneOffset();switch(s){case"O":case"OO":case"OOO":return"GMT"+To(r,":");case"OOOO":default:return"GMT"+is(r,":")}},z:function(e,s,n){const r=e.getTimezoneOffset();switch(s){case"z":case"zz":case"zzz":return"GMT"+To(r,":");case"zzzz":default:return"GMT"+is(r,":")}},t:function(e,s,n){const r=Math.trunc(+e/1e3);return ye(r,s.length)},T:function(e,s,n){return ye(+e,s.length)}};function To(e,s=""){const n=e>0?"-":"+",r=Math.abs(e),a=Math.trunc(r/60),o=r%60;return o===0?n+String(a):n+String(a)+s+ye(o,2)}function Po(e,s){return e%60===0?(e>0?"-":"+")+ye(Math.abs(e)/60,2):is(e,s)}function is(e,s=""){const n=e>0?"-":"+",r=Math.abs(e),a=ye(Math.trunc(r/60),2),o=ye(r%60,2);return n+a+s+o}const Ao=(e,s)=>{switch(e){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"})}},md=(e,s)=>{switch(e){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"})}},_p=(e,s)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],a=n[2];if(!a)return Ao(e,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}}",Ao(r,s)).replace("{{time}}",md(a,s))},Ep={p:md,P:_p},Op=/^D+$/,Tp=/^Y+$/,Pp=["D","DD","YY","YYYY"];function Ap(e){return Op.test(e)}function $p(e){return Tp.test(e)}function Rp(e,s,n){const r=Ip(e,s,n);if(console.warn(r),Pp.includes(e))throw new RangeError(r)}function Ip(e,s,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${s}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Fp=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zp=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wp=/^'([^]*?)'?$/,qp=/''/g,Bp=/[a-zA-Z]/;function oe(e,s,n){var u,f,m,h,g,y,S,b;const r=tn(),a=(n==null?void 0:n.locale)??r.locale??ds,o=(n==null?void 0:n.firstWeekContainsDate)??((f=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??r.firstWeekContainsDate??((h=(m=r.locale)==null?void 0:m.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(e,n==null?void 0:n.in);if(!Ix(l))throw new RangeError("Invalid time value");let d=s.match(zp).map(N=>{const w=N[0];if(w==="p"||w==="P"){const j=Ep[w];return j(N,a.formatLong)}return N}).join("").match(Fp).map(N=>{if(N==="''")return{isToken:!1,value:"'"};const w=N[0];if(w==="'")return{isToken:!1,value:Yp(N)};if(Oo[w])return{isToken:!0,value:N};if(w.match(Bp))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:N}});a.localize.preprocessor&&(d=a.localize.preprocessor(l,d));const c={firstWeekContainsDate:o,weekStartsOn:i,locale:a};return d.map(N=>{if(!N.isToken)return N.value;const w=N.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&$p(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Ap(w))&&Rp(w,s,String(e));const j=Oo[w[0]];return j(l,w,a.localize,c)}).join("")}function Yp(e){const s=e.match(Wp);return s?s[1].replace(qp,"'"):e}function Lp(e,s,n){const r=tn(),a=(n==null?void 0:n.locale)??r.locale??ds,o=2520,i=er(e,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]=Jt(n==null?void 0:n.in,...i>0?[s,e]:[e,s]),u=Yx(c,d),f=(sr(c)-sr(d))/1e3,m=Math.round((u-f)/60);let h;if(m<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):m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<_o){const g=Math.round(m/60);return a.formatDistance("aboutXHours",g,l)}else{if(m<o)return a.formatDistance("xDays",1,l);if(m<Xn){const g=Math.round(m/_o);return a.formatDistance("xDays",g,l)}else if(m<Xn*2)return h=Math.round(m/Xn),a.formatDistance("aboutXMonths",h,l)}if(h=Bx(c,d),h<12){const g=Math.round(m/Xn);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 Up(e,s){return Lp(e,Ia(e),s)}function Hp(e,s){const n=pe(e,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 Kp(e,s){return pe(e,s==null?void 0:s.in).getMonth()}function Vp(e,s){return pe(e,s==null?void 0:s.in).getFullYear()}function Gp(e,s){return+pe(e)>+pe(s)}function Qp(e,s){return+pe(e)<+pe(s)}function Xp(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s);return r.getFullYear()===a.getFullYear()&&r.getMonth()===a.getMonth()}function Jp(e,s,n){const[r,a]=Jt(n==null?void 0:n.in,e,s);return r.getFullYear()===a.getFullYear()}function Zp(e,s){return Fa(Oe(e,e),Ia(e))}function eg(e,s,n){return $a(e,-1,n)}function tg(e,s){return Fa(Oe(e,e),eg(Ia(e)))}function sg(e,s,n){const r=pe(e,n==null?void 0:n.in),a=r.getFullYear(),o=r.getDate(),i=Oe(e,0);i.setFullYear(a,s,15),i.setHours(0,0,0,0);const l=Hp(i);return r.setMonth(s,Math.min(o,l)),r}function ng(e,s,n){const r=pe(e,n==null?void 0:n.in);return isNaN(+r)?Oe(e,NaN):(r.setFullYear(s),r)}function rg(){const[e,s]=x.useState(!1),[n,r]=x.useState(null),[a,o]=x.useState(""),{workspace:i}=Ge(),{data:l,isLoading:d}=Pn(),c=Jf(),u=He(),f=(l??[]).filter(m=>!a||m.name.toLowerCase().includes(a.toLowerCase())||m.identifier.toLowerCase().includes(a.toLowerCase()));return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),t.jsxs(K,{size:"sm",onClick:()=>s(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create"]})]}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("div",{className:"flex items-center gap-2",children:t.jsx(K,{variant:"outline",size:"sm",className:"text-xs h-8",children:"Add filter"})}),t.jsxs("div",{className:"relative",children:[t.jsx(mr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),t.jsx(xe,{placeholder:"Search...",value:a,onChange:m=>o(m.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),t.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),t.jsx("span",{})]}),d?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(m=>t.jsxs("div",{className:"grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[t.jsx(te,{className:"h-4 w-48"}),t.jsx(te,{className:"h-4 w-12"}),t.jsx(te,{className:"h-5 w-16 rounded-full"}),t.jsx(te,{className:"h-4 w-24"}),t.jsx("div",{})]},m))}):f.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xt,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:a?"No projects match":"No projects yet"}),t.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&&t.jsxs(K,{size:"sm",onClick:()=>s(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create project"]})]}):t.jsx("div",{className:"divide-y divide-border",children:f.map(m=>t.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/${m.identifier}/board`),children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:m.name}),m.description&&t.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:m.description})]}),t.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:m.identifier}),t.jsx("div",{children:t.jsxs("span",{className:P("inline-flex items-center gap-1.5 text-xs",m.status==="active"&&"text-emerald-600",m.status==="paused"&&"text-amber-600",m.status==="archived"&&"text-muted-foreground"),children:[t.jsx("span",{className:P("h-1.5 w-1.5 rounded-full shrink-0",m.status==="active"&&"bg-emerald-500",m.status==="paused"&&"bg-amber-500",m.status==="archived"&&"bg-zinc-400")}),m.status.charAt(0).toUpperCase()+m.status.slice(1)]})}),t.jsx("span",{className:"text-sm text-muted-foreground",children:oe(new Date(m.created_at),"MMM d, yyyy")}),t.jsx("div",{className:"flex justify-end",onClick:h=>h.stopPropagation(),children:t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsx(K,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:t.jsx(Dn,{className:"h-4 w-4"})})}),t.jsxs(Xt,{align:"end",children:[t.jsxs(Je,{onClick:()=>u(`/${i}/projects/${m.identifier}/board`),children:[t.jsx(xt,{className:"h-4 w-4"}),"Open board"]}),t.jsxs(Je,{onClick:()=>u(`/${i}/projects/${m.identifier}/issues`),children:[t.jsx(Qs,{className:"h-4 w-4"}),"View issues"]}),t.jsxs(Je,{onClick:()=>r({id:m.id,name:m.name}),children:[t.jsx(dr,{className:"h-4 w-4"}),"Manage access"]}),t.jsx(An,{}),t.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${m.name}"? This cannot be undone.`)&&c.mutate(m.id,{onSuccess:()=>I.success("Project deleted"),onError:()=>I.error("Failed to delete project")})},children:[t.jsx(Tt,{className:"h-4 w-4"}),"Delete"]})]})]})})]},m.id))}),!d&&f.length>0&&t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[t.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",f.length," of ",f.length," result",f.length!==1?"s":""]}),t.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[t.jsx("span",{children:"1 of 1 pages"}),t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),t.jsx(Cx,{open:e,onClose:()=>s(!1)}),n&&t.jsx(_x,{open:!!n,onClose:()=>r(null),projectId:n.id,projectName:n.name})]})}const Ba={byProject:e=>["projects",e,"statuses"]};function sn(e){return Ne({queryKey:Ba.byProject(e??""),queryFn:()=>J.get(`/admin/projects/${e}/statuses`),select:s=>s.statuses,enabled:!!e})}function ag(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/projects/${e}/statuses`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ba.byProject(e)})}})}function og(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:n}),onSuccess:()=>{s.invalidateQueries({queryKey:Ba.byProject(e)})}})}const Ya={all:["users"],list:()=>[...Ya.all,"list"]};function fd(){return Ne({queryKey:Ya.list(),queryFn:()=>J.get("/admin/users"),select:e=>e.users,staleTime:1e3*60*5})}function hd(){return Ne({queryKey:[...Ya.list(),"map"],queryFn:()=>J.get("/admin/users"),select:e=>new Map(e.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 bs={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},Ot={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},xd={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Kt={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},ig=({priority:e})=>{const s=P("h-3 w-3 shrink-0",xd[e]);switch(e){case"urgent":return t.jsx(Xs,{className:s});case"high":return t.jsx(lr,{className:s});case"medium":return t.jsx(En,{className:s});case"low":return t.jsx(ir,{className:s});default:return t.jsx(Nt,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function pd({issue:e,onClick:s}){var u,f;const{data:n}=hd(),{attributes:r,listeners:a,setNodeRef:o,transform:i,transition:l,isDragging:d}=da({id:e.id}),c={transform:ca.Transform.toString(i),transition:l};return t.jsxs("div",{ref:o,style:c,...r,...a,onClick:s,className:P("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",d&&"opacity-40 shadow-lg ring-2 ring-indigo/30"),children:[t.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[t.jsx("span",{className:"text-[11px] font-mono text-muted-foreground",children:e.identifier}),t.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&t.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(m=>{const h=n==null?void 0:n.get(m);return t.jsx(st,{className:"h-4 w-4 border border-background",children:t.jsx(nt,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(h==null?void 0:h.initials)??"?"})},m)}),(((u=e.assignee_ids)==null?void 0:u.length)??0)>2&&t.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((f=e.assignee_ids)==null?void 0:f.length)??0)-2]})]}),t.jsx(ig,{priority:e.priority})]})]})]})}function qr(e,s){const n=e.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 lg=({category:e,color:s})=>{const n="h-3.5 w-3.5 shrink-0",r={color:s};switch(e){case"completed":return t.jsx(js,{className:n,style:r});case"started":return t.jsx(Qt,{className:n,style:r});default:return t.jsx(Nt,{className:n,style:r})}};function dg({id:e,label:s,color:n,category:r,issues:a,sortable:o,onIssueClick:i}){const{setNodeRef:l,isOver:d}=qc({id:e}),{attributes:c,listeners:u,setNodeRef:f,transform:m,transition:h,isDragging:g}=da({id:e,disabled:!o}),y=o?{transform:ca.Transform.toString(m),transition:h}:void 0,S=qr(n,.08),b=qr(n,.16),N=qr(n,.35);return t.jsxs("div",{ref:f,style:y,className:P("flex flex-col min-w-[260px] max-w-[280px] w-full",g&&"opacity-50"),children:[t.jsxs("div",{className:P("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&t.jsx("span",{...c,...u,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:t.jsx(fl,{className:"h-3.5 w-3.5"})}),t.jsx(lg,{category:r,color:n}),t.jsx("span",{className:"text-xs font-medium text-foreground",children:s}),t.jsx("span",{className:"ml-1 text-[11px] text-muted-foreground bg-muted rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",children:a.length})]}),t.jsxs("div",{ref:l,className:P("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:d?b:S,boxShadow:d?`inset 0 0 0 1px ${N}`:void 0},children:[t.jsx(la,{items:a.map(w=>w.id),strategy:Bc,children:a.map(w=>t.jsx(pd,{issue:w,onClick:()=>i==null?void 0:i(w)},w.id))}),a.length===0&&t.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:t.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const Br=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],cg=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function ug({open:e,onClose:s,projectId:n}){const[r,a]=x.useState(""),[o,i]=x.useState(Br[0]),[l,d]=x.useState(""),[c,u]=x.useState("started"),f=ag(n),m=l||o,h=()=>{r.trim()&&f.mutate({name:r.trim(),color:m,category:c},{onSuccess:()=>{I.success("Status created"),a(""),i(Br[0]),d(""),u("started"),s()},onError:()=>I.error("Failed to create status")})};return t.jsx(Ss,{open:e,onOpenChange:g=>!g&&s(),children:t.jsxs(Cs,{className:"sm:max-w-sm",children:[t.jsx(Js,{children:t.jsx(en,{className:"text-sm font-medium",children:"New Status"})}),t.jsx(Zs,{children:t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),t.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"})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[Br.map(g=>t.jsx("button",{onClick:()=>{i(g),d("")},className:P("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)),t.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[t.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),t.jsx(xe,{placeholder:"#hex",value:l,onChange:g=>d(g.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),t.jsxs(we,{value:c,onValueChange:g=>u(g),children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:cg.map(g=>t.jsx(ce,{value:g.value,className:"text-xs",children:g.label},g.value))})]})]})]})}),t.jsxs(zn,{className:"mt-2",children:[t.jsx(K,{variant:"ghost",size:"sm",onClick:s,className:"text-xs",children:"Cancel"}),t.jsx(K,{size:"sm",onClick:h,disabled:!r.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function mg({projectId:e}){const[s,n]=x.useState(!1);return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:t.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:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Add status"]})}),t.jsx(ug,{open:s,onClose:()=>n(!1),projectId:e})]})}function Yr(e,s){var r;const n={};for(const a of s)n[a.key]=[];for(const a of e)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 fg(e,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 e[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 hg({issues:e,projectId:s,statuses:n,onIssueClick:r,onColumnsReorder:a}){const[o,i]=x.useState(()=>n.map(D=>D.id)),[l,d]=x.useState(()=>Yr(e,n)),[c,u]=x.useState(null),[f,m]=x.useState(null),h=x.useRef(null),g=x.useRef(!1),y=ue();x.useEffect(()=>{g.current||d(D=>fg(D,e,n))},[e,n]);const S=[...n].sort((D,O)=>{const F=o.indexOf(D.id),_=o.indexOf(O.id);return F===-1&&_===-1?D.position-O.position:F===-1?1:_===-1?-1:F-_}),b=_i(Ei(Oi,{activationConstraint:{distance:5}})),N=x.useCallback(D=>{if(f){const O=D.droppableContainers.filter(F=>o.includes(F.id));return Yc({...D,droppableContainers:O})}return Lc(D)},[f,o]),w=x.useCallback(D=>{for(const[O,F]of Object.entries(l))if(F.some(_=>_.id===D))return O;return null},[l]),j=x.useCallback(D=>n.some(O=>O.id===D),[n]),E=D=>{const O=D.active.id;if(g.current=!0,j(O)){m(O);return}for(const[F,_]of Object.entries(l)){const R=_.find(T=>T.id===O);if(R){u(R),h.current=F;return}}},p=D=>{const{active:O,over:F}=D;if(!F||f)return;const _=O.id,R=F.id;if(j(_))return;const T=w(_),X=n.find(V=>V.key===R||V.id===R),q=(X==null?void 0:X.key)??w(R);!T||!q||T===q||d(V=>{const W=[...V[T]??[]],z=[...V[q]??[]],Q=W.findIndex(M=>M.id===_);if(Q===-1)return V;const[ee]=W.splice(Q,1),k={...ee,status:q};if(X)z.push(k);else{const M=z.findIndex(Y=>Y.id===R);if(M===-1)z.push(k);else{const Y=O.rect.current.translated!=null&&O.rect.current.translated.top>F.rect.top+F.rect.height/2;z.splice(Y?M+1:M,0,k)}}return{...V,[T]:W,[q]:z}})},C=D=>{var V;const{active:O,over:F}=D;if(u(null),g.current=!1,f){if(m(null),!F||O.id===F.id)return;const W=o.indexOf(O.id),z=o.indexOf(F.id);if(W===-1||z===-1||W===z)return;const Q=Zn(o,W,z);i(Q),a==null||a(Q);return}if(!F){const W=h.current;h.current=null,W&&d(Yr(e,n));return}const _=O.id,R=F.id,T=h.current;h.current=null;const X=n.find(W=>W.key===R||W.id===R),q=(X==null?void 0:X.key)??w(R);if(!(!T||!q))if(T===q)d(W=>{const z=W[T]??[],Q=z.findIndex(k=>k.id===_),ee=z.findIndex(k=>k.id===R);return Q===-1||ee===-1||Q===ee?W:{...W,[T]:Zn(z,Q,ee)}});else{if(!n.find(Q=>Q.key===R||Q.id===R))d(Q=>{const ee=[...Q[q]??[]],k=ee.findIndex(A=>A.id===_);if(k===-1)return Q;const M=D.active.rect.current.translated!=null&&D.active.rect.current.translated.top>D.over.rect.top+D.over.rect.height/2,[Y]=ee.splice(k,1),L=ee.findIndex(A=>A.id===R);if(L===-1)return ee.splice(k,0,Y),Q;const ae=M?L+1:L;return ee.splice(ae,0,Y),{...Q,[q]:ee}});else{const Q=((V=D.active.rect.current.translated)==null?void 0:V.top)??1/0,ee=D.over.rect.top+D.over.rect.height/2;Q<ee&&d(k=>{const M=k[q]??[],Y=M.findIndex(L=>L.id===_);return Y<=0?k:{...k,[q]:Zn(M,Y,0)}})}const z=y.getQueryData(Pe.byProject(s));y.setQueryData(Pe.byProject(s),Q=>Q&&{...Q,issues:Q.issues.map(ee=>ee.id===_?{...ee,status:q}:ee)}),J.put(`/admin/issues/${_}`,{status:q}).then(()=>{y.invalidateQueries({queryKey:Pe.byProject(s)})}).catch(()=>{z&&y.setQueryData(Pe.byProject(s),z),d(Yr((z==null?void 0:z.issues)??e,n)),I.error("Failed to update issue status")})}},$=f?n.find(D=>D.id===f):null;return t.jsxs(Ti,{sensors:b,collisionDetection:N,onDragStart:E,onDragOver:p,onDragEnd:C,children:[t.jsxs("div",{className:"flex gap-4 h-full overflow-x-auto px-6 py-4 pb-6",children:[t.jsx(la,{items:o,strategy:Pi,children:S.map(D=>t.jsx(dg,{id:D.id,label:D.name,color:D.color,category:D.category,issues:l[D.key]??[],sortable:!0,onIssueClick:r},D.id))}),t.jsx(mg,{projectId:s})]}),t.jsxs(Uc,{children:[c&&t.jsx(pd,{issue:c}),$&&t.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:t.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:[t.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:$.color}}),$.name]})})]})]})}const Ys={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function nn(e){return Ne({queryKey:e?Ys.byProject(e):Ys.all,queryFn:()=>{const s=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return J.get(s)},select:s=>s.sprints,enabled:!!e})}function xg(e){const s=ue();return de({mutationFn:n=>J.post("/admin/sprints",{...n,project_id:e}),onSuccess:()=>{s.invalidateQueries({queryKey:Ys.byProject(e)})}})}function pg(e,s){const n=ue();return de({mutationFn:r=>J.put(`/admin/sprints/${e}`,r),onSuccess:()=>{n.invalidateQueries({queryKey:Ys.byProject(s)}),n.invalidateQueries({queryKey:Ys.detail(e)})}})}function gg(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/sprints/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ys.byProject(e)})}})}const vr={byProject:e=>["task-lists","project",e]};function qn(e){return Ne({queryKey:e?vr.byProject(e):["task-lists"],queryFn:()=>J.get(`/admin/projects/${e}/task-lists`),select:s=>s.task_lists,enabled:!!e})}function bg(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/projects/${e}/task-lists`,n),onSuccess:()=>{s.invalidateQueries({queryKey:vr.byProject(e)})}})}function yg(e){const s=ue();return de({mutationFn:({id:n,...r})=>J.put(`/admin/task-lists/${n}`,r),onSuccess:()=>{s.invalidateQueries({queryKey:vr.byProject(e)})}})}function vg(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/task-lists/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:vr.byProject(e)}),s.invalidateQueries({queryKey:Pe.byProject(e)})}})}const Ke=Pc,Ve=Ac,Ue=x.forwardRef(({className:e,align:s="center",sideOffset:n=4,...r},a)=>t.jsx(Tc,{children:t.jsx(ki,{ref:a,align:s,sideOffset:n,className:P("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",e),...r})}));Ue.displayName=ki.displayName;function $o(e,s,n){const r=(e==null?void 0:e[0])??"",a=(s==null?void 0:s[0])??"";return(r+a).toUpperCase()||((n==null?void 0:n[0])??"U").toUpperCase()}function Ro(e,s,n){return`${e??""} ${s??""}`.trim()||n}function Bn({value:e,onChange:s,disabled:n}){const[r,a]=x.useState(!1),[o,i]=x.useState(e),{data:l}=fd(),d=e.slice().sort().join(",");x.useEffect(()=>{i(e)},[d]);const c=f=>{const m=o.includes(f)?o.filter(h=>h!==f):[...o,f];i(m),s(m)},u=(l??[]).filter(f=>o.includes(f.id));return t.jsxs(Ke,{open:r,onOpenChange:a,children:[t.jsx(Ve,{asChild:!0,disabled:n,children:t.jsx("button",{type:"button",className:P("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?t.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t.jsx(On,{className:"h-3.5 w-3.5"}),"Assign"]}):t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("div",{className:"flex -space-x-1.5",children:u.slice(0,3).map(f=>t.jsx(st,{className:"h-5 w-5 border border-background ring-0",children:t.jsx(nt,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:$o(f.first_name,f.last_name,f.email)})},f.id))}),u.length>3&&t.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",u.length-3]}),t.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:u.length===1?Ro(u[0].first_name,u[0].last_name,u[0].email):`${u.length} assignees`})]})})}),t.jsx(Ue,{className:"w-60 p-0",align:"start",children:t.jsxs(Fs,{children:[t.jsx(Ta,{placeholder:"Search users...",className:"h-8 text-xs"}),t.jsxs(zs,{children:[t.jsx(Pa,{className:"text-xs py-4",children:"No users found."}),t.jsx(hs,{children:(l??[]).map(f=>{const m=o.includes(f.id),h=Ro(f.first_name,f.last_name,f.email),g=$o(f.first_name,f.last_name,f.email);return t.jsxs(mt,{value:h,onSelect:()=>c(f.id),className:"gap-2 py-1.5",children:[t.jsx(st,{className:"h-5 w-5 shrink-0",children:t.jsx(nt,{className:"text-[9px] bg-muted text-muted-foreground",children:g})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs font-medium truncate",children:h}),t.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:f.email})]}),t.jsx(it,{className:P("h-3.5 w-3.5 shrink-0",m?"opacity-100 text-indigo-500":"opacity-0")})]},f.id)})})]})]})})]})}function jg(e,s,n="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:n}).format(s).split(/\s/g).slice(2).join(" ")}const Lr={},gn={};function cs(e,s){try{const r=(Lr[e]||(Lr[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(s).split("GMT")[1];return r in gn?gn[r]:Io(r,r.split(":"))}catch{if(e in gn)return gn[e];const n=e==null?void 0:e.match(wg);return n?Io(e,n.slice(1)):NaN}}const wg=/([+-]\d\d):?(\d\d)?/;function Io(e,s){const n=+(s[0]||0),r=+(s[1]||0),a=+(s[2]||0)/60;return gn[e]=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(cs(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)),gd(this),aa(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=-cs(this.timeZone,this);return s>0?Math.floor(s):Math.ceil(s)}setTime(s){return Date.prototype.setTime.apply(this,arguments),aa(this),+this}[Symbol.for("constructDateFrom")](s){return new wt(+new Date(s),this.timeZone)}}const Fo=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Fo.test(e))return;const s=e.replace(Fo,"$1UTC");wt.prototype[s]&&(e.startsWith("get")?wt.prototype[e]=function(){return this.internal[s]()}:(wt.prototype[e]=function(){return Date.prototype[s].apply(this.internal,arguments),Ng(this),+this},wt.prototype[s]=function(){return Date.prototype[s].apply(this,arguments),aa(this),+this}))});function aa(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-cs(e.timeZone,e)*60))}function Ng(e){Date.prototype.setFullYear.call(e,e.internal.getUTCFullYear(),e.internal.getUTCMonth(),e.internal.getUTCDate()),Date.prototype.setHours.call(e,e.internal.getUTCHours(),e.internal.getUTCMinutes(),e.internal.getUTCSeconds(),e.internal.getUTCMilliseconds()),gd(e)}function gd(e){const s=cs(e.timeZone,e),n=s>0?Math.floor(s):Math.ceil(s),r=new Date(+e);r.setUTCHours(r.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),o=-new Date(+r).getTimezoneOffset(),i=a-o,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();i&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+i);const d=a-n;d&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+d);const c=new Date(+e);c.setUTCSeconds(0);const u=a>0?c.getSeconds():(c.getSeconds()-60)%60,f=Math.round(-(cs(e.timeZone,e)*60))%60;(f||u)&&(e.internal.setUTCSeconds(e.internal.getUTCSeconds()+f),Date.prototype.setUTCSeconds.call(e,Date.prototype.getUTCSeconds.call(e)+f+u));const m=cs(e.timeZone,e),h=m>0?Math.floor(m):Math.ceil(m),y=-new Date(+e).getTimezoneOffset()-h,S=h!==n,b=y-d;if(S&&b){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+b);const N=cs(e.timeZone,e),w=N>0?Math.floor(N):Math.ceil(N),j=h-w;j&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+j),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+j))}}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} (${jg(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 zo=5,kg=4;function Sg(e,s){const n=s.startOfMonth(e),r=n.getDay()>0?n.getDay():7,a=s.addDays(e,-r+1),o=s.addDays(a,zo*7-1);return s.getMonth(e)===s.getMonth(o)?zo:kg}function bd(e,s){const n=s.startOfMonth(e),r=n.getDay();return r===1?n:r===0?s.addDays(n,-1*6):s.addDays(n,-1*(r-1))}function Cg(e,s){const n=bd(e,s),r=Sg(e,s);return s.addDays(n,r*7-1)}const yd={...ds,labels:{labelDayButton:(e,s,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>oe(i,l,{locale:ds,...n});let o=a(e,"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:e=>`Week ${e}`,labelYearDropdown:"Choose the Year",labelGrid:(e,s,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,o)=>oe(a,o,{locale:ds,...s}),r(e,"LLLL yyyy")},labelGridcell:(e,s,n,r)=>{let a;r&&typeof r.format=="function"?a=r.format.bind(r):a=(i,l)=>oe(i,l,{locale:ds,...n});let o=a(e,"PPPP");return s!=null&&s.today&&(o=`Today, ${o}`),o},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,s,n)=>{let r;return n&&typeof n.format=="function"?r=n.format.bind(n):r=(a,o)=>oe(a,o,{locale:ds,...s}),r(e,"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):$a(r,a)},this.addMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addMonths?this.overrides.addMonths(r,a):rd(r,a)},this.addWeeks=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addWeeks?this.overrides.addWeeks(r,a):Px(r,a)},this.addYears=(r,a)=>{var o;return(o=this.overrides)!=null&&o.addYears?this.overrides.addYears(r,a):Ax(r,a)},this.differenceInCalendarDays=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarDays?this.overrides.differenceInCalendarDays(r,a):Ra(r,a)},this.differenceInCalendarMonths=(r,a)=>{var o;return(o=this.overrides)!=null&&o.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(r,a):za(r,a)},this.eachMonthOfInterval=r=>{var a;return(a=this.overrides)!=null&&a.eachMonthOfInterval?this.overrides.eachMonthOfInterval(r):Lx(r)},this.eachYearOfInterval=r=>{var l;const a=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(r):Kx(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):Cg(r,this)},this.endOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.endOfISOWeek?this.overrides.endOfISOWeek(r):Vx(r)},this.endOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.endOfMonth?this.overrides.endOfMonth(r):id(r)},this.endOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.endOfWeek?this.overrides.endOfWeek(r,a):cd(r,this.options)},this.endOfYear=r=>{var a;return(a=this.overrides)!=null&&a.endOfYear?this.overrides.endOfYear(r):Hx(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):Wa(r)},this.getMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getMonth?this.overrides.getMonth(r,this.options):Kp(r,this.options)},this.getYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getYear?this.overrides.getYear(r,this.options):Vp(r,this.options)},this.getWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.getWeek?this.overrides.getWeek(r,this.options):qa(r,this.options)},this.isAfter=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isAfter?this.overrides.isAfter(r,a):Gp(r,a)},this.isBefore=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isBefore?this.overrides.isBefore(r,a):Qp(r,a)},this.isDate=r=>{var a;return(a=this.overrides)!=null&&a.isDate?this.overrides.isDate(r):od(r)},this.isSameDay=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameDay?this.overrides.isSameDay(r,a):Fa(r,a)},this.isSameMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameMonth?this.overrides.isSameMonth(r,a):Xp(r,a)},this.isSameYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.isSameYear?this.overrides.isSameYear(r,a):Jp(r,a)},this.max=r=>{var a;return(a=this.overrides)!=null&&a.max?this.overrides.max(r):$x(r)},this.min=r=>{var a;return(a=this.overrides)!=null&&a.min?this.overrides.min(r):Rx(r)},this.setMonth=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setMonth?this.overrides.setMonth(r,a):sg(r,a)},this.setYear=(r,a)=>{var o;return(o=this.overrides)!=null&&o.setYear?this.overrides.setYear(r,a):ng(r,a)},this.startOfBroadcastWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(r,this):bd(r,this)},this.startOfDay=r=>{var a;return(a=this.overrides)!=null&&a.startOfDay?this.overrides.startOfDay(r):wn(r)},this.startOfISOWeek=r=>{var a;return(a=this.overrides)!=null&&a.startOfISOWeek?this.overrides.startOfISOWeek(r):jn(r)},this.startOfMonth=r=>{var a;return(a=this.overrides)!=null&&a.startOfMonth?this.overrides.startOfMonth(r):Ux(r)},this.startOfWeek=(r,a)=>{var o;return(o=this.overrides)!=null&&o.startOfWeek?this.overrides.startOfWeek(r,this.options):Bs(r,this.options)},this.startOfYear=r=>{var a;return(a=this.overrides)!=null&&a.startOfYear?this.overrides.startOfYear(r):dd(r)},this.options={locale:yd,...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 vd{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 Mg{constructor(s,n){this.date=s,this.weeks=n}}class Dg{constructor(s,n){this.days=n,this.weekNumber=s}}function _g(e){return v.createElement("button",{...e})}function Eg(e){return v.createElement("span",{...e})}function Og(e){const{size:s=24,orientation:n="left",className:r}=e;return v.createElement("svg",{className:r,width:s,height:s,viewBox:"0 0 24 24"},n==="up"&&v.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),n==="down"&&v.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),n==="left"&&v.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),n==="right"&&v.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function Tg(e){const{day:s,modifiers:n,...r}=e;return v.createElement("td",{...r})}function Pg(e){const{day:s,modifiers:n,...r}=e,a=v.useRef(null);return v.useEffect(()=>{var o;n.focused&&((o=a.current)==null||o.focus())},[n.focused]),v.createElement("button",{ref:a,...r})}var ne;(function(e){e.Root="root",e.Chevron="chevron",e.Day="day",e.DayButton="day_button",e.CaptionLabel="caption_label",e.Dropdowns="dropdowns",e.Dropdown="dropdown",e.DropdownRoot="dropdown_root",e.Footer="footer",e.MonthGrid="month_grid",e.MonthCaption="month_caption",e.MonthsDropdown="months_dropdown",e.Month="month",e.Months="months",e.Nav="nav",e.NextMonthButton="button_next",e.PreviousMonthButton="button_previous",e.Week="week",e.Weeks="weeks",e.Weekday="weekday",e.Weekdays="weekdays",e.WeekNumber="week_number",e.WeekNumberHeader="week_number_header",e.YearsDropdown="years_dropdown"})(ne||(ne={}));var _e;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(_e||(_e={}));var ft;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(ft||(ft={}));var et;(function(e){e.weeks_before_enter="weeks_before_enter",e.weeks_before_exit="weeks_before_exit",e.weeks_after_enter="weeks_after_enter",e.weeks_after_exit="weeks_after_exit",e.caption_after_enter="caption_after_enter",e.caption_after_exit="caption_after_exit",e.caption_before_enter="caption_before_enter",e.caption_before_exit="caption_before_exit"})(et||(et={}));function Ag(e){const{options:s,className:n,components:r,classNames:a,...o}=e,i=[a[ne.Dropdown],n].join(" "),l=s==null?void 0:s.find(({value:d})=>d===o.value);return v.createElement("span",{"data-disabled":o.disabled,className:a[ne.DropdownRoot]},v.createElement(r.Select,{className:i,...o},s==null?void 0:s.map(({value:d,label:c,disabled:u})=>v.createElement(r.Option,{key:d,value:d,disabled:u},c))),v.createElement("span",{className:a[ne.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,v.createElement(r.Chevron,{orientation:"down",size:18,className:a[ne.Chevron]})))}function $g(e){return v.createElement("div",{...e})}function Rg(e){return v.createElement("div",{...e})}function Ig(e){const{calendarMonth:s,displayIndex:n,...r}=e;return v.createElement("div",{...r},e.children)}function Fg(e){const{calendarMonth:s,displayIndex:n,...r}=e;return v.createElement("div",{...r})}function zg(e){return v.createElement("table",{...e})}function Wg(e){return v.createElement("div",{...e})}const jd=x.createContext(void 0);function Yn(){const e=x.useContext(jd);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function qg(e){const{components:s}=Yn();return v.createElement(s.Dropdown,{...e})}function Bg(e){const{onPreviousClick:s,onNextClick:n,previousMonth:r,nextMonth:a,...o}=e,{components:i,classNames:l,labels:{labelPrevious:d,labelNext:c}}=Yn(),u=x.useCallback(m=>{a&&(n==null||n(m))},[a,n]),f=x.useCallback(m=>{r&&(s==null||s(m))},[r,s]);return v.createElement("nav",{...o},v.createElement(i.PreviousMonthButton,{type:"button",className:l[ne.PreviousMonthButton],tabIndex:r?void 0:-1,"aria-disabled":r?void 0:!0,"aria-label":d(r),onClick:f},v.createElement(i.Chevron,{disabled:r?void 0:!0,className:l[ne.Chevron],orientation:"left"})),v.createElement(i.NextMonthButton,{type:"button",className:l[ne.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":c(a),onClick:u},v.createElement(i.Chevron,{disabled:a?void 0:!0,orientation:"right",className:l[ne.Chevron]})))}function Yg(e){const{components:s}=Yn();return v.createElement(s.Button,{...e})}function Lg(e){return v.createElement("option",{...e})}function Ug(e){const{components:s}=Yn();return v.createElement(s.Button,{...e})}function Hg(e){const{rootRef:s,...n}=e;return v.createElement("div",{...n,ref:s})}function Kg(e){return v.createElement("select",{...e})}function Vg(e){const{week:s,...n}=e;return v.createElement("tr",{...n})}function Gg(e){return v.createElement("th",{...e})}function Qg(e){return v.createElement("thead",{"aria-hidden":!0},v.createElement("tr",{...e}))}function Xg(e){const{week:s,...n}=e;return v.createElement("th",{...n})}function Jg(e){return v.createElement("th",{...e})}function Zg(e){return v.createElement("tbody",{...e})}function eb(e){const{components:s}=Yn();return v.createElement(s.Dropdown,{...e})}const tb=Object.freeze(Object.defineProperty({__proto__:null,Button:_g,CaptionLabel:Eg,Chevron:Og,Day:Tg,DayButton:Pg,Dropdown:Ag,DropdownNav:$g,Footer:Rg,Month:Ig,MonthCaption:Fg,MonthGrid:zg,Months:Wg,MonthsDropdown:qg,Nav:Bg,NextMonthButton:Yg,Option:Lg,PreviousMonthButton:Ug,Root:Hg,Select:Kg,Week:Vg,WeekNumber:Xg,WeekNumberHeader:Jg,Weekday:Gg,Weekdays:Qg,Weeks:Zg,YearsDropdown:eb},Symbol.toStringTag,{value:"Module"}));function _t(e,s,n=!1,r=kt){let{from:a,to:o}=e;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 La(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function jr(e){return!!(e&&typeof e=="object"&&"from"in e)}function Ua(e){return!!(e&&typeof e=="object"&&"after"in e)}function Ha(e){return!!(e&&typeof e=="object"&&"before"in e)}function wd(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function Nd(e,s){return Array.isArray(e)&&e.every(s.isDate)}function Et(e,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(e,l);if(Nd(l,n))return l.some(d=>a(e,d));if(jr(l))return _t(l,e,!1,n);if(wd(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(La(l)){const d=o(l.before,e),c=o(l.after,e),u=d>0,f=c<0;return i(l.before,l.after)?f&&u:u||f}return Ua(l)?o(e,l.after)>0:Ha(l)?o(l.before,e)>0:typeof l=="function"?l(e):!1})}function sb(e,s,n,r,a){const{disabled:o,hidden:i,modifiers:l,showOutsideDays:d,broadcastCalendar:c,today:u=a.today()}=s,{isSameDay:f,isSameMonth:m,startOfMonth:h,isBefore:g,endOfMonth:y,isAfter:S}=a,b=n&&h(n),N=r&&y(r),w={[_e.focused]:[],[_e.outside]:[],[_e.disabled]:[],[_e.hidden]:[],[_e.today]:[]},j={};for(const E of e){const{date:p,displayMonth:C}=E,$=!!(C&&!m(p,C)),D=!!(b&&g(p,b)),O=!!(N&&S(p,N)),F=!!(o&&Et(p,o,a)),_=!!(i&&Et(p,i,a))||D||O||!c&&!d&&$||c&&d===!1&&$,R=f(p,u);$&&w.outside.push(E),F&&w.disabled.push(E),_&&w.hidden.push(E),R&&w.today.push(E),l&&Object.keys(l).forEach(T=>{const X=l==null?void 0:l[T];X&&Et(p,X,a)&&(j[T]?j[T].push(E):j[T]=[E])})}return E=>{const p={[_e.focused]:!1,[_e.disabled]:!1,[_e.hidden]:!1,[_e.outside]:!1,[_e.today]:!1},C={};for(const $ in w){const D=w[$];p[$]=D.some(O=>O===E)}for(const $ in j)C[$]=j[$].some(D=>D===E);return{...p,...C}}}function nb(e,s,n={}){return Object.entries(e).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[ne.Day]])}function rb(e){return{...tb,...e}}function ab(e){const s={"data-mode":e.mode??void 0,"data-required":"required"in e?e.required:void 0,"data-multiple-months":e.numberOfMonths&&e.numberOfMonths>1||void 0,"data-week-numbers":e.showWeekNumber||void 0,"data-broadcast-calendar":e.broadcastCalendar||void 0,"data-nav-layout":e.navLayout||void 0};return Object.entries(e).forEach(([n,r])=>{n.startsWith("data-")&&(s[n]=r)}),s}function ob(){const e={};for(const s in ne)e[ne[s]]=`rdp-${ne[s]}`;for(const s in _e)e[_e[s]]=`rdp-${_e[s]}`;for(const s in ft)e[ft[s]]=`rdp-${ft[s]}`;for(const s in et)e[et[s]]=`rdp-${et[s]}`;return e}function kd(e,s,n){return(n??new rt(s)).formatMonthYear(e)}const ib=kd;function lb(e,s,n){return(n??new rt(s)).format(e,"d")}function db(e,s=kt){return s.format(e,"LLLL")}function cb(e,s,n){return(n??new rt(s)).format(e,"cccccc")}function ub(e,s=kt){return e<10?s.formatNumber(`0${e.toLocaleString()}`):s.formatNumber(`${e.toLocaleString()}`)}function mb(){return""}function Sd(e,s=kt){return s.format(e,"yyyy")}const fb=Sd,hb=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:kd,formatDay:lb,formatMonthCaption:ib,formatMonthDropdown:db,formatWeekNumber:ub,formatWeekNumberHeader:mb,formatWeekdayName:cb,formatYearCaption:fb,formatYearDropdown:Sd},Symbol.toStringTag,{value:"Module"}));function xb(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...hb,...e}}function Ka(e,s,n,r){let a=(r??new rt(n)).format(e,"PPPP");return s.today&&(a=`Today, ${a}`),s.selected&&(a=`${a}, selected`),a}const pb=Ka;function Va(e,s,n){return(n??new rt(s)).formatMonthYear(e)}const gb=Va;function Cd(e,s,n,r){let a=(r??new rt(n)).format(e,"PPPP");return s!=null&&s.today&&(a=`Today, ${a}`),a}function Md(e){return"Choose the Month"}function Dd(){return""}const bb="Go to the Next Month";function _d(e,s){return bb}function Ed(e){return"Go to the Previous Month"}function Od(e,s,n){return(n??new rt(s)).format(e,"cccc")}function Td(e,s){return`Week ${e}`}function Pd(e){return"Week Number"}function Ad(e){return"Choose the Year"}const yb=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:gb,labelDay:pb,labelDayButton:Ka,labelGrid:Va,labelGridcell:Cd,labelMonthDropdown:Md,labelNav:Dd,labelNext:_d,labelPrevious:Ed,labelWeekNumber:Td,labelWeekNumberHeader:Pd,labelWeekday:Od,labelYearDropdown:Ad},Symbol.toStringTag,{value:"Module"})),ut=(e,s,n)=>s||(n?typeof n=="function"?n:(...r)=>n:e);function vb(e,s){var r;const n=((r=s.locale)==null?void 0:r.labels)??{};return{...yb,...e??{},labelDayButton:ut(Ka,e==null?void 0:e.labelDayButton,n.labelDayButton),labelMonthDropdown:ut(Md,e==null?void 0:e.labelMonthDropdown,n.labelMonthDropdown),labelNext:ut(_d,e==null?void 0:e.labelNext,n.labelNext),labelPrevious:ut(Ed,e==null?void 0:e.labelPrevious,n.labelPrevious),labelWeekNumber:ut(Td,e==null?void 0:e.labelWeekNumber,n.labelWeekNumber),labelYearDropdown:ut(Ad,e==null?void 0:e.labelYearDropdown,n.labelYearDropdown),labelGrid:ut(Va,e==null?void 0:e.labelGrid,n.labelGrid),labelGridcell:ut(Cd,e==null?void 0:e.labelGridcell,n.labelGridcell),labelNav:ut(Dd,e==null?void 0:e.labelNav,n.labelNav),labelWeekNumberHeader:ut(Pd,e==null?void 0:e.labelWeekNumberHeader,n.labelWeekNumberHeader),labelWeekday:ut(Od,e==null?void 0:e.labelWeekday,n.labelWeekday)}}function jb(e,s,n,r,a){const{startOfMonth:o,startOfYear:i,endOfYear:l,eachMonthOfInterval:d,getMonth:c}=a;return d({start:i(e),end:l(e)}).map(m=>{const h=r.formatMonthDropdown(m,a),g=c(m),y=s&&m<o(s)||n&&m>o(n)||!1;return{value:g,label:h,disabled:y}})}function wb(e,s={},n={}){let r={...s==null?void 0:s[ne.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{r={...r,...n==null?void 0:n[a]}}),r}function Nb(e,s,n,r){const a=r??e.today(),o=n?e.startOfBroadcastWeek(a,e):s?e.startOfISOWeek(a):e.startOfWeek(a),i=[];for(let l=0;l<7;l++){const d=e.addDays(o,l);i.push(d)}return i}function kb(e,s,n,r,a=!1){if(!e||!s)return;const{startOfYear:o,endOfYear:i,eachYearOfInterval:l,getYear:d}=r,c=o(e),u=i(s),f=l({start:c,end:u});return a&&f.reverse(),f.map(m=>{const h=n.formatYearDropdown(m,r);return{value:d(m),label:h,disabled:!1}})}function Sb(e,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,e)},i=d=>{const c=o(d);return new Date(c.getFullYear(),c.getMonth(),c.getDate(),0,0,0,0)};return{today:()=>o(Le.tz(e)),newDate:(d,c,u)=>new Le(d,c,u,12,0,0,e),startOfDay:d=>o(d),startOfWeek:(d,c)=>{const u=o(d),f=(c==null?void 0:c.weekStartsOn)??a,m=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-m),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),f=[],m=new Le(c.getFullYear(),c.getMonth(),1,12,0,0,e),h=u.getFullYear()*12+u.getMonth();for(;m.getFullYear()*12+m.getMonth()<=h;)f.push(new Le(m,e)),m.setMonth(m.getMonth()+1,1);return f},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),f=[],m=new Le(c.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new Le(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(d,c)=>{var f;const u=i(d);return qa(u,{weekStartsOn:(c==null?void 0:c.weekStartsOn)??a,firstWeekContainsDate:(c==null?void 0:c.firstWeekContainsDate)??((f=r==null?void 0:r.options)==null?void 0:f.firstWeekContainsDate)??1})},getISOWeek:d=>{const c=i(d);return Wa(c)},differenceInCalendarDays:(d,c)=>{const u=i(d),f=i(c);return Ra(u,f)},differenceInCalendarMonths:(d,c)=>{const u=i(d),f=i(c);return za(u,f)}}}const Ln=e=>e instanceof HTMLElement?e:null,Ur=e=>[...e.querySelectorAll("[data-animated-month]")??[]],Cb=e=>Ln(e.querySelector("[data-animated-month]")),Hr=e=>Ln(e.querySelector("[data-animated-caption]")),Kr=e=>Ln(e.querySelector("[data-animated-weeks]")),Mb=e=>Ln(e.querySelector("[data-animated-nav]")),Db=e=>Ln(e.querySelector("[data-animated-weekdays]"));function _b(e,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||!e.current||!(e.current instanceof HTMLElement)||r.length===0||c.length===0||r.length!==c.length)return;const u=o.isSameMonth(r[0].date,c[0].date),f=o.isAfter(r[0].date,c[0].date),m=f?n[et.caption_after_enter]:n[et.caption_before_enter],h=f?n[et.weeks_after_enter]:n[et.weeks_before_enter],g=i.current,y=e.current.cloneNode(!0);if(y instanceof HTMLElement?(Ur(y).forEach(w=>{if(!(w instanceof HTMLElement))return;const j=Cb(w);j&&w.contains(j)&&w.removeChild(j);const E=Hr(w);E&&E.classList.remove(m);const p=Kr(w);p&&p.classList.remove(h)}),i.current=y):i.current=null,d.current||u||a)return;const S=g instanceof HTMLElement?Ur(g):[],b=Ur(e.current);if(b!=null&&b.every(N=>N instanceof HTMLElement)&&S&&S.every(N=>N instanceof HTMLElement)){d.current=!0,e.current.style.isolation="isolate";const N=Mb(e.current);N&&(N.style.zIndex="1"),b.forEach((w,j)=>{const E=S[j];if(!E)return;w.style.position="relative",w.style.overflow="hidden";const p=Hr(w);p&&p.classList.add(m);const C=Kr(w);C&&C.classList.add(h);const $=()=>{d.current=!1,e.current&&(e.current.style.isolation=""),N&&(N.style.zIndex=""),p&&p.classList.remove(m),C&&C.classList.remove(h),w.style.position="",w.style.overflow="",w.contains(E)&&w.removeChild(E)};E.style.pointerEvents="none",E.style.position="absolute",E.style.overflow="hidden",E.setAttribute("aria-hidden","true");const D=Db(E);D&&(D.style.opacity="0");const O=Hr(E);O&&(O.classList.add(f?n[et.caption_before_exit]:n[et.caption_after_exit]),O.addEventListener("animationend",$));const F=Kr(E);F&&F.classList.add(f?n[et.weeks_before_exit]:n[et.weeks_after_exit]),w.insertBefore(E,w.firstChild)})}})}function Eb(e,s,n,r){const a=e[0],o=e[e.length-1],{ISOWeek:i,fixedWeeks:l,broadcastCalendar:d}=n??{},{addDays:c,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:m,endOfISOWeek:h,endOfMonth:g,endOfWeek:y,isAfter:S,startOfBroadcastWeek:b,startOfISOWeek:N,startOfWeek:w}=r,j=d?b(a,r):i?N(a):w(a),E=d?m(o):i?h(g(o)):y(g(o)),p=s&&(d?m(s):i?h(s):y(s)),C=p&&S(E,p)?p:E,$=u(C,j),D=f(o,a)+1,O=[];for(let R=0;R<=$;R++){const T=c(j,R);O.push(T)}const _=(d?35:42)*D;if(l&&O.length<_){const R=_-O.length;for(let T=0;T<R;T++){const X=c(O[O.length-1],1);O.push(X)}}return O}function Ob(e){const s=[];return e.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 Tb(e,s,n,r){const{numberOfMonths:a=1}=n,o=[];for(let i=0;i<a;i++){const l=r.addMonths(e,i);if(s&&l>s)break;o.push(l)}return o}function Wo(e,s,n,r){const{month:a,defaultMonth:o,today:i=r.today(),numberOfMonths:l=1}=e;let d=a||o||i;const{differenceInCalendarMonths:c,addMonths:u,startOfMonth:f}=r;if(n&&c(n,d)<l-1){const m=-1*(l-1);d=u(n,m)}return s&&c(d,s)<0&&(d=s),f(d)}function Pb(e,s,n,r){const{addDays:a,endOfBroadcastWeek:o,endOfISOWeek:i,endOfMonth:l,endOfWeek:d,getISOWeek:c,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:m,startOfWeek:h}=r,g=e.reduce((y,S)=>{const b=n.broadcastCalendar?f(S,r):n.ISOWeek?m(S):h(S),N=n.broadcastCalendar?o(S):n.ISOWeek?i(l(S)):d(l(S)),w=s.filter(C=>C>=b&&C<=N),j=n.broadcastCalendar?35:42;if(n.fixedWeeks&&w.length<j){const C=s.filter($=>{const D=j-w.length;return $>N&&$<=a(N,D)});w.push(...C)}const E=w.reduce((C,$)=>{const D=n.ISOWeek?c($):u($),O=C.find(_=>_.weekNumber===D),F=new vd($,S,r);return O?O.days.push(F):C.push(new Dg(D,[F])),C},[]),p=new Mg(S,E);return y.push(p),y},[]);return n.reverseMonths?g.reverse():g}function Ab(e,s){let{startMonth:n,endMonth:r}=e;const{startOfYear:a,startOfDay:o,startOfMonth:i,endOfMonth:l,addYears:d,endOfYear:c,newDate:u,today:f}=s,{fromYear:m,toYear:h,fromMonth:g,toMonth:y}=e;!n&&g&&(n=g),!n&&m&&(n=s.newDate(m,0,1)),!r&&y&&(r=y),!r&&h&&(r=u(h,11,31));const S=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return n?n=i(n):m?n=u(m,0,1):!n&&S&&(n=a(d(e.today??f(),-100))),r?r=l(r):h?r=u(h,11,31):!r&&S&&(r=c(e.today??f())),[n&&o(n),r&&o(r)]}function $b(e,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(e);if(!s)return l(u,c);if(!(d(s,e)<o))return l(u,c)}function Rb(e,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(e);if(!s)return l(u,-c);if(!(d(u,s)<=0))return l(u,-c)}function Ib(e){const s=[];return e.reduce((n,r)=>n.concat(r.weeks.slice()),s.slice())}function wr(e,s){const[n,r]=x.useState(e);return[s===void 0?n:s,r]}function Fb(e,s){var j;const[n,r]=Ab(e,s),{startOfMonth:a,endOfMonth:o}=s,i=Wo(e,n,r,s),[l,d]=wr(i,e.month?i:void 0);x.useEffect(()=>{const E=Wo(e,n,r,s);d(E)},[e.timeZone]);const{months:c,weeks:u,days:f,previousMonth:m,nextMonth:h}=x.useMemo(()=>{const E=Tb(l,r,{numberOfMonths:e.numberOfMonths},s),p=Eb(E,e.endMonth?o(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},s),C=Pb(E,p,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},s),$=Ib(C),D=Ob(C),O=Rb(l,n,e,s),F=$b(l,r,e,s);return{months:C,weeks:$,days:D,previousMonth:O,nextMonth:F}},[s,l.getTime(),r==null?void 0:r.getTime(),n==null?void 0:n.getTime(),e.disableNavigation,e.broadcastCalendar,(j=e.endMonth)==null?void 0:j.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:g,onMonthChange:y}=e,S=E=>u.some(p=>p.days.some(C=>C.isEqualTo(E))),b=E=>{if(g)return;let p=a(E);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:f,navStart:n,navEnd:r,previousMonth:m,nextMonth:h,goToMonth:b,goToDay:E=>{S(E)||b(E.date)}}}var jt;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(jt||(jt={}));function qo(e){return!e[_e.disabled]&&!e[_e.hidden]&&!e[_e.outside]}function zb(e,s,n,r){let a,o=-1;for(const i of e){const l=s(i);qo(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=e.find(i=>qo(s(i)))),a}function Wb(e,s,n,r,a,o,i){const{ISOWeek:l,broadcastCalendar:d}=o,{addDays:c,addMonths:u,addWeeks:f,addYears:m,endOfBroadcastWeek:h,endOfISOWeek:g,endOfWeek:y,max:S,min:b,startOfBroadcastWeek:N,startOfISOWeek:w,startOfWeek:j}=i;let p={day:c,week:f,month:u,year:m,startOfWeek:C=>d?N(C,i):l?w(C):j(C),endOfWeek:C=>d?h(C):l?g(C):y(C)}[e](n,s==="after"?1:-1);return s==="before"&&r?p=S([r,p]):s==="after"&&a&&(p=b([a,p])),p}function $d(e,s,n,r,a,o,i,l=0){if(l>365)return;const d=Wb(e,s,n.date,r,a,o,i),c=!!(o.disabled&&Et(d,o.disabled,i)),u=!!(o.hidden&&Et(d,o.hidden,i)),f=d,m=new vd(d,f,i);return!c&&!u?m:$d(e,s,m,r,a,o,i,l+1)}function qb(e,s,n,r,a){const{autoFocus:o}=e,[i,l]=x.useState(),d=zb(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=$d(y,S,c,s.navStart,s.navEnd,e,a);b&&(e.disableNavigation&&!s.days.some(w=>w.isEqualTo(b))||(s.goToDay(b),u(b)))}}}function Bb(e,s){const{selected:n,required:r,onSelect:a}=e,[o,i]=wr(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:f}=e;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)===f?S=[h]:S=[...S,h];return a||i(S),a==null||a(S,h,g,y),S},isSelected:c}}function Yb(e,s,n=0,r=0,a=!1,o=kt){const{from:i,to:l}=s||{},{isSameDay:d,isAfter:c,isBefore:u}=o;let f;if(!i&&!l)f={from:e,to:n>0?void 0:e};else if(i&&!l)d(i,e)?n===0?f={from:i,to:e}:a?f={from:i,to:void 0}:f=void 0:u(e,i)?f={from:e,to:i}:f={from:i,to:e};else if(i&&l)if(d(i,e)&&d(l,e))a?f={from:i,to:l}:f=void 0;else if(d(i,e))f={from:i,to:n>0?void 0:e};else if(d(l,e))f={from:e,to:n>0?void 0:e};else if(u(e,i))f={from:e,to:l};else if(c(e,i))f={from:i,to:e};else if(c(e,l))f={from:i,to:e};else throw new Error("Invalid range");if(f!=null&&f.from&&(f!=null&&f.to)){const m=o.differenceInCalendarDays(f.to,f.from);r>0&&m>r?f={from:e,to:void 0}:n>1&&m<n&&(f={from:e,to:void 0})}return f}function Lb(e,s,n=kt){const r=Array.isArray(s)?s:[s];let a=e.from;const o=n.differenceInCalendarDays(e.to,e.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 Bo(e,s,n=kt){return _t(e,s.from,!1,n)||_t(e,s.to,!1,n)||_t(s,e.from,!1,n)||_t(s,e.to,!1,n)}function Ub(e,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)?_t(e,l,!1,n):Nd(l,n)?l.some(d=>_t(e,d,!1,n)):jr(l)?l.from&&l.to?Bo(e,{from:l.from,to:l.to},n):!1:wd(l)?Lb(e,l.dayOfWeek,n):La(l)?n.isAfter(l.before,l.after)?Bo(e,{from:n.addDays(l.after,1),to:n.addDays(l.before,-1)},n):Et(e.from,l,n)||Et(e.to,l,n):Ua(l)||Ha(l)?Et(e.from,l,n)||Et(e.to,l,n):!1))return!0;const i=r.filter(l=>typeof l=="function");if(i.length){let l=e.from;const d=n.differenceInCalendarDays(e.to,e.from);for(let c=0;c<=d;c++){if(i.some(u=>u(l)))return!0;l=n.addDays(l,1)}}return!1}function Hb(e,s){const{disabled:n,excludeDisabled:r,selected:a,required:o,onSelect:i}=e,[l,d]=wr(a,i?a:void 0),c=i?a:l;return{selected:c,select:(m,h,g)=>{const{min:y,max:S}=e,b=m?Yb(m,c,y,S,o,s):void 0;return r&&n&&(b!=null&&b.from)&&b.to&&Ub({from:b.from,to:b.to},n,s)&&(b.from=m,b.to=void 0),i||d(b),i==null||i(b,m,h,g),b},isSelected:m=>c&&_t(c,m,!1,s)}}function Kb(e,s){const{selected:n,required:r,onSelect:a}=e,[o,i]=wr(n,a?n:void 0),l=a?n:o,{isSameDay:d}=s;return{selected:l,select:(f,m,h)=>{let g=f;return!r&&l&&l&&d(f,l)&&(g=void 0),a||i(g),a==null||a(g,f,m,h),g},isSelected:f=>l?d(l,f):!1}}function Vb(e,s){const n=Kb(e,s),r=Bb(e,s),a=Hb(e,s);switch(e.mode){case"single":return n;case"multiple":return r;case"range":return a;default:return}}function ot(e,s){return e instanceof Le&&e.timeZone===s?e:new Le(e,s)}function Os(e,s,n){return ot(e,s)}function Yo(e,s,n){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Os(e,s):Array.isArray(e)?e.map(r=>r instanceof Date?Os(r,s):r):jr(e)?{...e,from:e.from?ot(e.from,s):e.from,to:e.to?ot(e.to,s):e.to}:La(e)?{before:Os(e.before,s),after:Os(e.after,s)}:Ua(e)?{after:Os(e.after,s)}:Ha(e)?{before:Os(e.before,s)}:e}function Vr(e,s,n){return e&&(Array.isArray(e)?e.map(r=>Yo(r,s)):Yo(e,s))}function Gb(e){var re;let s=e;const n=s.timeZone;if(n&&(s={...e,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=(re=s.selected)==null?void 0:re.map(G=>ot(G,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=Vr(s.disabled,n)),s.hidden!==void 0&&(s.hidden=Vr(s.hidden,n)),s.modifiers)){const G={};Object.keys(s.modifiers).forEach(se=>{var H;G[se]=Vr((H=s.modifiers)==null?void 0:H[se],n)}),s.modifiers=G}const{components:r,formatters:a,labels:o,dateLib:i,locale:l,classNames:d}=x.useMemo(()=>{const G={...yd,...s.locale},se=s.broadcastCalendar?1:s.weekStartsOn,H=s.noonSafe&&s.timeZone?Sb(s.timeZone,{weekStartsOn:se,locale:G}):void 0,Z=s.dateLib&&H?{...H,...s.dateLib}:s.dateLib??H,be=new rt({locale:G,weekStartsOn:se,firstWeekContainsDate:s.firstWeekContainsDate,useAdditionalWeekYearTokens:s.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:s.useAdditionalDayOfYearTokens,timeZone:s.timeZone,numerals:s.numerals},Z);return{dateLib:be,components:rb(s.components),formatters:xb(s.formatters),labels:vb(s.labels,be.options),locale:G,classNames:{...ob(),...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:f,numberOfMonths:m=1,onDayBlur:h,onDayClick:g,onDayFocus:y,onDayKeyDown:S,onDayMouseEnter:b,onDayMouseLeave:N,onNextClick:w,onPrevClick:j,showWeekNumber:E,styles:p}=s,{formatCaption:C,formatDay:$,formatMonthDropdown:D,formatWeekNumber:O,formatWeekNumberHeader:F,formatWeekdayName:_,formatYearDropdown:R}=a,T=Fb(s,i),{days:X,months:q,navStart:V,navEnd:W,previousMonth:z,nextMonth:Q,goToMonth:ee}=T,k=sb(X,s,V,W,i),{isSelected:M,select:Y,selected:L}=Vb(s,i)??{},{blur:ae,focused:A,isFocusTarget:ie,moveFocus:ge,setFocused:Te}=qb(s,T,k,M??(()=>!1),i),{labelDayButton:qe,labelGridcell:$t,labelGrid:Zt,labelMonthDropdown:le,labelNav:es,labelPrevious:ts,labelNext:ss,labelWeekday:ns,labelWeekNumber:rn,labelWeekNumberHeader:dt,labelYearDropdown:pt}=o,Ms=x.useMemo(()=>Nb(i,s.ISOWeek,s.broadcastCalendar,s.today),[i,s.ISOWeek,s.broadcastCalendar,s.today]),Be=u!==void 0||g!==void 0,rs=x.useCallback(()=>{z&&(ee(z),j==null||j(z))},[z,ee,j]),Rt=x.useCallback(()=>{Q&&(ee(Q),w==null||w(Q))},[ee,Q,w]),Ye=x.useCallback((G,se)=>H=>{H.preventDefault(),H.stopPropagation(),Te(G),!se.disabled&&(Y==null||Y(G.date,se,H),g==null||g(G.date,se,H))},[Y,g,Te]),gt=x.useCallback((G,se)=>H=>{Te(G),y==null||y(G.date,se,H)},[y,Te]),It=x.useCallback((G,se)=>H=>{ae(),h==null||h(G.date,se,H)},[ae,h]),an=x.useCallback((G,se)=>H=>{const Z={ArrowLeft:[H.shiftKey?"month":"day",s.dir==="rtl"?"after":"before"],ArrowRight:[H.shiftKey?"month":"day",s.dir==="rtl"?"before":"after"],ArrowDown:[H.shiftKey?"year":"week","after"],ArrowUp:[H.shiftKey?"year":"week","before"],PageUp:[H.shiftKey?"year":"month","before"],PageDown:[H.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(Z[H.key]){H.preventDefault(),H.stopPropagation();const[be,B]=Z[H.key];ge(be,B)}S==null||S(G.date,se,H)},[ge,S,s.dir]),St=x.useCallback((G,se)=>H=>{b==null||b(G.date,se,H)},[b]),on=x.useCallback((G,se)=>H=>{N==null||N(G.date,se,H)},[N]),bt=x.useCallback(G=>se=>{const H=Number(se.target.value),Z=i.setMonth(i.startOfMonth(G),H);ee(Z)},[i,ee]),Ft=x.useCallback(G=>se=>{const H=Number(se.target.value),Z=i.setYear(i.startOfMonth(G),H);ee(Z)},[i,ee]),{className:yt,style:Ds}=x.useMemo(()=>({className:[d[ne.Root],s.className].filter(Boolean).join(" "),style:{...p==null?void 0:p[ne.Root],...s.style}}),[d,s.className,s.style,p]),vt=ab(s),_s=x.useRef(null);_b(_s,!!s.animate,{classNames:d,months:q,focused:A,dateLib:i});const ln={dayPickerProps:s,selected:L,select:Y,isSelected:M,months:q,nextMonth:Q,previousMonth:z,goToMonth:ee,getModifiers:k,components:r,classNames:d,styles:p,labels:o,formatters:a};return v.createElement(jd.Provider,{value:ln},v.createElement(r.Root,{rootRef:s.animate?_s:void 0,className:yt,style:Ds,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},v.createElement(r.Months,{className:d[ne.Months],style:p==null?void 0:p[ne.Months]},!s.hideNavigation&&!f&&v.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:d[ne.Nav],style:p==null?void 0:p[ne.Nav],"aria-label":es(),onPreviousClick:rs,onNextClick:Rt,previousMonth:z,nextMonth:Q}),q.map((G,se)=>v.createElement(r.Month,{"data-animated-month":s.animate?"true":void 0,className:d[ne.Month],style:p==null?void 0:p[ne.Month],key:se,displayIndex:se,calendarMonth:G},f==="around"&&!s.hideNavigation&&se===0&&v.createElement(r.PreviousMonthButton,{type:"button",className:d[ne.PreviousMonthButton],tabIndex:z?void 0:-1,"aria-disabled":z?void 0:!0,"aria-label":ts(z),onClick:rs,"data-animated-button":s.animate?"true":void 0},v.createElement(r.Chevron,{disabled:z?void 0:!0,className:d[ne.Chevron],orientation:s.dir==="rtl"?"right":"left"})),v.createElement(r.MonthCaption,{"data-animated-caption":s.animate?"true":void 0,className:d[ne.MonthCaption],style:p==null?void 0:p[ne.MonthCaption],calendarMonth:G,displayIndex:se},c!=null&&c.startsWith("dropdown")?v.createElement(r.DropdownNav,{className:d[ne.Dropdowns],style:p==null?void 0:p[ne.Dropdowns]},(()=>{const H=c==="dropdown"||c==="dropdown-months"?v.createElement(r.MonthsDropdown,{key:"month",className:d[ne.MonthsDropdown],"aria-label":le(),classNames:d,components:r,disabled:!!s.disableNavigation,onChange:bt(G.date),options:jb(G.date,V,W,a,i),style:p==null?void 0:p[ne.Dropdown],value:i.getMonth(G.date)}):v.createElement("span",{key:"month"},D(G.date,i)),Z=c==="dropdown"||c==="dropdown-years"?v.createElement(r.YearsDropdown,{key:"year",className:d[ne.YearsDropdown],"aria-label":pt(i.options),classNames:d,components:r,disabled:!!s.disableNavigation,onChange:Ft(G.date),options:kb(V,W,a,i,!!s.reverseYears),style:p==null?void 0:p[ne.Dropdown],value:i.getYear(G.date)}):v.createElement("span",{key:"year"},R(G.date,i));return i.getMonthYearOrder()==="year-first"?[Z,H]:[H,Z]})(),v.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"}},C(G.date,i.options,i))):v.createElement(r.CaptionLabel,{className:d[ne.CaptionLabel],role:"status","aria-live":"polite"},C(G.date,i.options,i))),f==="around"&&!s.hideNavigation&&se===m-1&&v.createElement(r.NextMonthButton,{type:"button",className:d[ne.NextMonthButton],tabIndex:Q?void 0:-1,"aria-disabled":Q?void 0:!0,"aria-label":ss(Q),onClick:Rt,"data-animated-button":s.animate?"true":void 0},v.createElement(r.Chevron,{disabled:Q?void 0:!0,className:d[ne.Chevron],orientation:s.dir==="rtl"?"left":"right"})),se===m-1&&f==="after"&&!s.hideNavigation&&v.createElement(r.Nav,{"data-animated-nav":s.animate?"true":void 0,className:d[ne.Nav],style:p==null?void 0:p[ne.Nav],"aria-label":es(),onPreviousClick:rs,onNextClick:Rt,previousMonth:z,nextMonth:Q}),v.createElement(r.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":Zt(G.date,i.options,i)||void 0,className:d[ne.MonthGrid],style:p==null?void 0:p[ne.MonthGrid]},!s.hideWeekdays&&v.createElement(r.Weekdays,{"data-animated-weekdays":s.animate?"true":void 0,className:d[ne.Weekdays],style:p==null?void 0:p[ne.Weekdays]},E&&v.createElement(r.WeekNumberHeader,{"aria-label":dt(i.options),className:d[ne.WeekNumberHeader],style:p==null?void 0:p[ne.WeekNumberHeader],scope:"col"},F()),Ms.map(H=>v.createElement(r.Weekday,{"aria-label":ns(H,i.options,i),className:d[ne.Weekday],key:String(H),style:p==null?void 0:p[ne.Weekday],scope:"col"},_(H,i.options,i)))),v.createElement(r.Weeks,{"data-animated-weeks":s.animate?"true":void 0,className:d[ne.Weeks],style:p==null?void 0:p[ne.Weeks]},G.weeks.map(H=>v.createElement(r.Week,{className:d[ne.Week],key:H.weekNumber,style:p==null?void 0:p[ne.Week],week:H},E&&v.createElement(r.WeekNumber,{week:H,style:p==null?void 0:p[ne.WeekNumber],"aria-label":rn(H.weekNumber,{locale:l}),className:d[ne.WeekNumber],scope:"row",role:"rowheader"},O(H.weekNumber,i)),H.days.map(Z=>{const{date:be}=Z,B=k(Z);if(B[_e.focused]=!B.hidden&&!!(A!=null&&A.isEqualTo(Z)),B[ft.selected]=(M==null?void 0:M(be))||B.selected,jr(L)){const{from:Ce,to:Me}=L;B[ft.range_start]=!!(Ce&&Me&&i.isSameDay(be,Ce)),B[ft.range_end]=!!(Ce&&Me&&i.isSameDay(be,Me)),B[ft.range_middle]=_t(L,be,!0,i)}const fe=wb(B,p,s.modifiersStyles),he=nb(B,d,s.modifiersClassNames),Ae=!Be&&!B.hidden?$t(be,B,i.options,i):void 0;return v.createElement(r.Day,{key:`${Z.isoDate}_${Z.displayMonthId}`,day:Z,modifiers:B,className:he.join(" "),style:fe,role:"gridcell","aria-selected":B.selected||void 0,"aria-label":Ae,"data-day":Z.isoDate,"data-month":Z.outside?Z.dateMonthId:void 0,"data-selected":B.selected||void 0,"data-disabled":B.disabled||void 0,"data-hidden":B.hidden||void 0,"data-outside":Z.outside||void 0,"data-focused":B.focused||void 0,"data-today":B.today||void 0},!B.hidden&&Be?v.createElement(r.DayButton,{className:d[ne.DayButton],style:p==null?void 0:p[ne.DayButton],type:"button",day:Z,modifiers:B,disabled:!B.focused&&B.disabled||void 0,"aria-disabled":B.focused&&B.disabled||void 0,tabIndex:ie(Z)?0:-1,"aria-label":qe(be,B,i.options,i),onClick:Ye(Z,B),onBlur:It(Z,B),onFocus:gt(Z,B),onKeyDown:an(Z,B),onMouseEnter:St(Z,B),onMouseLeave:on(Z,B)},$(be,i.options,i)):!B.hidden&&$(Z.date,i.options,i))})))))))),s.footer&&v.createElement(r.Footer,{className:d[ne.Footer],style:p==null?void 0:p[ne.Footer],role:"status","aria-live":"polite"},s.footer)))}function lt({className:e,classNames:s,showOutsideDays:n=!0,...r}){return t.jsx(Gb,{showOutsideDays:n,className:P("p-3",e),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:P(Is({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"),button_next:P(Is({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:P(Is({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"?t.jsx(pa,{className:"h-4 w-4"}):t.jsx(Gs,{className:"h-4 w-4"})},...r})}lt.displayName="Calendar";function Qb(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function Nr({open:e,onClose:s,projectId:n,defaultStatus:r="backlog",defaultTaskListId:a,defaultParentId:o}){const i=He(),{workspace:l,projectKey:d}=Ge(),{workspace:c}=ke(),[u,f]=x.useState(""),[m,h]=x.useState(""),[g,y]=x.useState(r),[S,b]=x.useState("medium"),[N,w]=x.useState("task"),[j,E]=x.useState([]),[p,C]=x.useState(""),[$,D]=x.useState(a??""),[O,F]=x.useState(void 0),[_,R]=x.useState(void 0),T=sl(),{data:X}=sn(n),{data:q}=nn(n||void 0),{data:V}=qn(n||void 0),W=(q??[]).filter(k=>k.status!=="completed"),z=X&&X.length>0?Object.fromEntries(X.map(k=>[k.key,k.name])):bs,Q=()=>{f(""),h(""),y(r),b("medium"),w("task"),E([]),C(""),D(a??""),F(void 0),R(void 0),s()},ee=k=>{k.preventDefault(),u.trim()&&T.mutate({title:u.trim(),description:m.trim()||void 0,status:g,priority:S,type:N,project_id:n,workspace_id:c.id,assignee_ids:j.length>0?j:void 0,sprint_id:p||null,task_list_id:$||null,parent_id:o||null,start_date:O?oe(O,"yyyy-MM-dd"):null,due_date:_?oe(_,"yyyy-MM-dd"):null},{onSuccess:()=>{I.success("Issue created"),Q()},onError:M=>I.error(M.message??"Failed to create issue")})};return t.jsx(Ss,{open:e,onOpenChange:k=>!k&&Q(),children:t.jsxs(Cs,{className:"max-w-md",children:[t.jsx(Js,{children:t.jsx(en,{children:"New issue"})}),t.jsxs("form",{onSubmit:ee,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(Zs,{className:"space-y-4",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{htmlFor:"issue-title",children:"Title"}),t.jsx(xe,{id:"issue-title",placeholder:"Issue title",value:u,onChange:k=>f(k.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"issue-desc",children:["Description ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(yr,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:k=>h(k.target.value)})]}),t.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Status"}),t.jsxs(we,{value:g,onValueChange:y,children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(z).map(([k,M])=>t.jsx(ce,{value:k,className:"text-xs",children:M},k))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Priority"}),t.jsxs(we,{value:S,onValueChange:b,children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Ot).map(([k,M])=>t.jsx(ce,{value:k,className:"text-xs",children:M},k))})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Type"}),t.jsxs(we,{value:N,onValueChange:w,children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Kt).map(([k,M])=>t.jsx(ce,{value:k,className:"text-xs",children:M},k))})]})]})]}),o&&t.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&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["List ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(we,{value:$||"none",onValueChange:k=>D(k==="none"?"":k),children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{placeholder:"No list"})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs",children:t.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(V??[]).map(k=>t.jsx(ce,{value:k.id,className:"text-xs",children:k.name},k.id))]})]})]}),W.length>0&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Sprint ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(we,{value:p||"none",onValueChange:k=>C(k==="none"?"":k),children:[t.jsx(ve,{className:"h-8 text-xs",children:t.jsx(Ee,{placeholder:"No sprint"})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs",children:t.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),W.map(k=>{const M=Qb(k);return t.jsx(ce,{value:k.id,className:"text-xs",children:t.jsxs("div",{children:[t.jsx("span",{children:k.name}),M&&t.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:M})]})},k.id)})]})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Assignees ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsx(Bn,{value:j,onChange:E})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Start Date ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:O?"text-foreground":"text-muted-foreground",children:O?oe(O,"MMM d, yyyy"):"No start date"}),O&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),F(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}),t.jsx(Ue,{className:"w-auto p-0",align:"start",children:t.jsx(lt,{mode:"single",selected:O,onSelect:F,initialFocus:!0})})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{children:["Due Date ",t.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:_?"text-foreground":"text-muted-foreground",children:_?oe(_,"MMM d, yyyy"):"No due date"}),_&&t.jsx("button",{type:"button",onClick:k=>{k.stopPropagation(),R(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}),t.jsx(Ue,{className:"w-auto p-0",align:"start",children:t.jsx(lt,{mode:"single",selected:_,onSelect:R,initialFocus:!0})})]})]})]}),t.jsxs(zn,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[t.jsxs(K,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Q(),i(`/${l}/projects/${d}/issues/new`)},children:[t.jsx(ml,{className:"h-3.5 w-3.5"}),"Open full form"]}),t.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[t.jsx(K,{type:"button",variant:"ghost",onClick:Q,children:"Cancel"}),t.jsx(K,{type:"submit",disabled:!u.trim()||T.isPending,children:T.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Ga={byIssue:e=>["attachments",e]};function Rd(e){return Ne({queryKey:Ga.byIssue(e),queryFn:()=>J.get(`/admin/issues/${e}/attachments`),select:s=>s.attachments,enabled:!!e})}function Id(e){const s=ue();return de({mutationFn:({file:n,commentId:r})=>{const a=new FormData;return a.append("file",n),r&&a.append("comment_id",r),J.upload(`/admin/issues/${e}/attachments`,a)},onSuccess:()=>{s.invalidateQueries({queryKey:Ga.byIssue(e)})}})}function Xb(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/issues/${e}/attachments/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Ga.byIssue(e)})}})}function Nn(e){return e.startsWith("image/")}function kr(e){return e.startsWith("video/")}function Sr(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Qa(e,s){const n=document.createElement("a");n.href=e,n.download=s,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Xa({mimeType:e,className:s}){return Nn(e)?t.jsx(Tm,{className:s}):kr(e)?t.jsx(ur,{className:s}):e.startsWith("text/")||e.includes("json")?t.jsx(Om,{className:s}):e.includes("zip")||e.includes("tar")||e.includes("gz")?t.jsx(Em,{className:s}):e.includes("pdf")||e.includes("word")||e.includes("document")?t.jsx(Pm,{className:s}):t.jsx(Am,{className:s})}function Fd({attachment:e,onClose:s}){return e?t.jsx(Ss,{open:!0,onOpenChange:n=>!n&&s(),children:t.jsxs(Cs,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[t.jsxs(Js,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[t.jsx(en,{className:"text-sm font-medium truncate",children:e.original_name}),t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Qa(e.url,e.original_name),children:[t.jsx(ba,{className:"h-3.5 w-3.5"}),"Download"]})]}),t.jsxs(Zs,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[Nn(e.mime_type)&&t.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),kr(e.mime_type)&&t.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),t.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[t.jsx("span",{children:Sr(e.size)}),t.jsx("span",{children:"·"}),t.jsx("span",{children:e.mime_type}),t.jsx("span",{children:"·"}),t.jsxs("span",{children:["Uploaded ",oe(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function Jb({attachment:e}){const[s,n]=x.useState(null),r=Nn(e.mime_type)||kr(e.mime_type),a=()=>{r?n(e):Qa(e.url,e.original_name)};return t.jsxs(t.Fragment,{children:[Nn(e.mime_type)?t.jsx("button",{type:"button",onClick:a,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:t.jsx("img",{src:e.url,alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):t.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:[t.jsx(Xa,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),t.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:Sr(e.size)}),!r&&t.jsx(ba,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),s&&t.jsx(Fd,{attachment:s,onClose:()=>n(null)})]})}function Zb({attachment:e,onOpen:s,onDelete:n,isDeleting:r}){const a=Nn(e.mime_type)||kr(e.mime_type),o=()=>{a?s(e):Qa(e.url,e.original_name)};return t.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[t.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:t.jsx(Xa,{mimeType:e.mime_type,className:"h-4 w-4"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("button",{type:"button",onClick:o,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),t.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[t.jsx("span",{children:Sr(e.size)}),t.jsx("span",{children:"·"}),t.jsx("span",{children:oe(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsx("span",{className:"italic",children:"from comment"})]}),!a&&t.jsxs(t.Fragment,{children:[t.jsx("span",{children:"·"}),t.jsxs("span",{className:"flex items-center gap-0.5",children:[t.jsx(ba,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),t.jsx(K,{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(e.id),disabled:r,children:t.jsx(Tt,{className:"h-3.5 w-3.5"})})]})}function e0({onFiles:e,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&&e(l)},[e]);return t.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:P("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:[t.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:t.jsx(sf,{className:"h-4 w-4 text-muted-foreground"})}),t.jsx("p",{className:"text-xs font-medium text-foreground",children:s?"Uploading…":"Drop files or click to browse"}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),t.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:i=>{const l=Array.from(i.target.files??[]);l.length>0&&e(l),i.target.value=""}})]})}function t0({issueId:e,className:s}){const[n,r]=x.useState(null),{data:a,isLoading:o}=Rd(e),i=Id(e),l=Xb(e),d=u=>{u.forEach(f=>{i.mutate({file:f},{onSuccess:()=>I.success(`${f.name} uploaded`),onError:()=>I.error(`Failed to upload ${f.name}`)})})},c=u=>{l.mutate(u,{onSuccess:()=>I.success("Attachment removed"),onError:()=>I.error("Failed to remove attachment")})};return t.jsxs("div",{className:P("px-6 py-4 space-y-4",s),children:[t.jsx(e0,{onFiles:d,isUploading:i.isPending}),o?t.jsx("div",{className:"space-y-2",children:[1,2].map(u=>t.jsxs("div",{className:"flex items-center gap-3 px-3",children:[t.jsx(te,{className:"h-8 w-8 rounded-md shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3 w-2/3"}),t.jsx(te,{className:"h-2.5 w-1/3"})]})]},u))}):a&&a.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[t.jsx(wa,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[a.length," ",a.length===1?"file":"files"]})]}),t.jsx("div",{children:a.map(u=>t.jsx(Zb,{attachment:u,onOpen:r,onDelete:c,isDeleting:l.isPending},u.id))})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),t.jsx(Fd,{attachment:n,onClose:()=>r(null)})]})}const Vt={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function s0(e){return Ne({queryKey:Vt.byIssue(e),queryFn:()=>J.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function n0(e){return Ne({queryKey:Vt.activeTimer(e),queryFn:()=>J.get(`/admin/issues/${e}/time-logs/timer`),select:s=>s.active_timer,enabled:!!e,refetchInterval:1e4})}function r0(e){const s=ue();return de({mutationFn:n=>J.post(`/admin/issues/${e}/time-logs`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}function a0(e){const s=ue();return de({mutationFn:()=>J.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.activeTimer(e)}),s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}function o0(e){const s=ue();return de({mutationFn:()=>J.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.activeTimer(e)}),s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}function i0(e){const s=ue();return de({mutationFn:n=>J.delete(`/admin/issues/${e}/time-logs/${n}`),onSuccess:()=>{s.invalidateQueries({queryKey:Vt.byIssue(e)})}})}const l0=Mn("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 Un({className:e,variant:s,...n}){return t.jsx("div",{className:P(l0({variant:s}),e),...n})}function oa(e){const s=Math.floor(e/60),n=e%60;return s===0?`${n}m`:n===0?`${s}h`:`${s}h ${n}m`}function Lo(e){const s=Date.now()-new Date(e).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 d0({startedAt:e}){const[s,n]=x.useState(()=>Lo(e));return x.useEffect(()=>{const r=setInterval(()=>n(Lo(e)),1e3);return()=>clearInterval(r)},[e]),t.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:s})}function c0({onSubmit:e,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]),f=m=>{m.preventDefault();const h=parseInt(r||"0",10),g=parseInt(o||"0",10),y=h*60+g;if(y<=0){I.error("Please enter a duration greater than 0.");return}e({duration_minutes:y,description:l.trim()||void 0,logged_date:c||void 0})};return t.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[t.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),t.jsxs("div",{className:"flex gap-2",children:[t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),t.jsx(xe,{type:"number",min:"0",max:"999",placeholder:"0",value:r,onChange:m=>a(m.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),t.jsx(xe,{type:"number",min:"0",max:"59",placeholder:"0",value:o,onChange:m=>i(m.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex-1",children:[t.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),t.jsx(xe,{type:"date",value:c,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),t.jsxs("div",{children:[t.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",t.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),t.jsx(xe,{placeholder:"What did you work on?",value:l,onChange:m=>d(m.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"ghost",size:"sm",onClick:n,className:"h-7 text-xs",children:"Cancel"}),t.jsx(K,{type:"submit",size:"sm",disabled:s,className:"h-7 text-xs",children:s?"Saving…":"Log time"})]})]})}function u0({entry:e,onDelete:s,isDeleting:n}){const r=e.started_at!=null&&e.stopped_at==null;return t.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[t.jsx("div",{className:P("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?t.jsx(Zm,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?t.jsx(Qt,{className:"h-3.5 w-3.5 text-muted-foreground"}):t.jsx(Mm,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[r?t.jsx(d0,{startedAt:e.started_at}):t.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:oa(e.duration_minutes??0)}),t.jsx(Un,{variant:"muted",className:P("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":e.source==="timer"?"Timer":"Manual"})]}),e.description&&t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!r&&t.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:oe(new Date(e.logged_date),"MMM d, yyyy")})]}),!r&&t.jsx(K,{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(e.id),disabled:n,children:t.jsx(Tt,{className:"h-3.5 w-3.5"})})]})}function m0({issueId:e,className:s}){const[n,r]=x.useState(!1),{data:a,isLoading:o}=s0(e),{data:i}=n0(e),l=r0(e),d=a0(e),c=o0(e),u=i0(e),f=(a==null?void 0:a.time_logs)??[],m=(a==null?void 0:a.total_minutes)??0,h=i!=null,g=N=>{l.mutate(N,{onSuccess:()=>{r(!1),I.success("Time logged")},onError:()=>I.error("Failed to log time")})},y=()=>{d.mutate(void 0,{onSuccess:()=>I.success("Timer started"),onError:N=>I.error(N.message??"Failed to start timer")})},S=()=>{c.mutate(void 0,{onSuccess:N=>{const w=N.time_log.duration_minutes??0;I.success(`Timer stopped — ${oa(w)} logged`)},onError:()=>I.error("Failed to stop timer")})},b=N=>{u.mutate(N,{onSuccess:()=>I.success("Time entry removed"),onError:()=>I.error("Failed to remove entry")})};return t.jsxs("div",{className:P("px-6 py-4 space-y-4",s),children:[t.jsxs("div",{className:"flex items-center justify-between gap-3",children:[t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),t.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:m>0?oa(m):"—"})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!n&&t.jsxs(K,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>r(!0),children:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Log time"]}),h?t.jsxs(K,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:S,disabled:c.isPending,children:[t.jsx(Gm,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):t.jsxs(K,{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:[t.jsx(ur,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),n&&t.jsx(c0,{onSubmit:g,isPending:l.isPending,onCancel:()=>r(!1)}),o?t.jsx("div",{className:"space-y-2",children:[1,2].map(N=>t.jsxs("div",{className:"flex items-center gap-3 px-3",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3 w-1/3"}),t.jsx(te,{className:"h-2.5 w-1/4"})]})]},N))}):f.length>0?t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[t.jsx(Qt,{className:"h-3 w-3 text-muted-foreground"}),t.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[f.length," ",f.length===1?"entry":"entries"]})]}),t.jsx("div",{children:f.map(N=>t.jsx(u0,{entry:N,onDelete:b,isDeleting:u.isPending},N.id))})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function os({onClick:e,active:s,title:n,children:r}){return t.jsx("button",{type:"button",title:n,onMouseDown:a=>{a.preventDefault(),e()},className:P("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 Uo(){return t.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}function zd({issueId:e,compact:s,className:n,onSuccess:r}){var C,$;const[a,o]=x.useState(!0),[i,l]=x.useState([]),[d,c]=x.useState(!1),u=x.useRef(null),f=x.useRef(async()=>{}),{user:m}=ke(),h=jm(e),g=Id(e),y=m&&`${((C=m.first_name)==null?void 0:C[0])??""}${(($=m.last_name)==null?void 0:$[0])??""}`.toUpperCase()||"?",S=x.useMemo(()=>Hc.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(f.current(),!0)}}}),[]),b=Ai({extensions:[$i,Ri,Ii.configure({placeholder:"Leave a comment…"}),S],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:D}){o(D.isEmpty)}}),N=!a||i.length>0,w=D=>{l(O=>{const F=new Set(O.map(_=>`${_.name}-${_.size}`));return[...O,...D.filter(_=>!F.has(`${_.name}-${_.size}`))]})},j=D=>{l(O=>O.filter((F,_)=>_!==D))},E=async()=>{if(!(!N||d)){c(!0);try{const D=b!=null&&b.isEmpty?"":(b==null?void 0:b.getHTML())??"",F=(await h.mutateAsync(D||" ")).comment.id;for(const _ of i)await g.mutateAsync({file:_,commentId:F});b==null||b.commands.clearContent(),o(!0),l([]),I.success("Comment added"),r==null||r()}catch{I.error("Failed to add comment")}finally{c(!1)}}};f.current=E;const p="h-3 w-3";return t.jsxs("div",{className:P("flex gap-3 items-start",n),children:[t.jsx(st,{className:"h-7 w-7 shrink-0 mt-1",children:t.jsx(nt,{className:"text-[11px] bg-muted text-muted-foreground",children:y})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:P("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[b&&t.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[t.jsx(os,{title:"Bold (⌘B)",active:b.isActive("bold"),onClick:()=>b.chain().focus().toggleBold().run(),children:t.jsx(rl,{className:p})}),t.jsx(os,{title:"Italic (⌘I)",active:b.isActive("italic"),onClick:()=>b.chain().focus().toggleItalic().run(),children:t.jsx(hl,{className:p})}),t.jsx(os,{title:"Strikethrough",active:b.isActive("strike"),onClick:()=>b.chain().focus().toggleStrike().run(),children:t.jsx(yl,{className:p})}),t.jsx(os,{title:"Inline code",active:b.isActive("code"),onClick:()=>b.chain().focus().toggleCode().run(),children:t.jsx(cl,{className:p})}),t.jsx(Uo,{}),t.jsx(os,{title:"Bullet list",active:b.isActive("bulletList"),onClick:()=>b.chain().focus().toggleBulletList().run(),children:t.jsx(pl,{className:p})}),t.jsx(os,{title:"Ordered list",active:b.isActive("orderedList"),onClick:()=>b.chain().focus().toggleOrderedList().run(),children:t.jsx(xl,{className:p})}),t.jsx(Uo,{}),t.jsx(os,{title:"Code block",active:b.isActive("codeBlock"),onClick:()=>b.chain().focus().toggleCodeBlock().run(),children:t.jsx(dl,{className:p})})]}),t.jsx(Fi,{editor:b,className:P("px-3 py-2.5 text-sm",s?"min-h-[68px]":"min-h-[80px]")})]}),i.length>0&&t.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:i.map((D,O)=>t.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:[t.jsx(Xa,{mimeType:D.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate",children:D.name}),t.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",Sr(D.size),")"]}),t.jsx("button",{type:"button",onClick:()=>j(O),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:t.jsx(Fe,{className:"h-3 w-3"})})]},O))}),t.jsxs("div",{className:"flex items-center justify-between mt-2",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx(K,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var D;return(D=u.current)==null?void 0:D.click()},disabled:d,title:"Attach files",children:t.jsx(wa,{className:"h-3.5 w-3.5"})}),t.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[t.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),t.jsx(K,{size:"icon",className:"h-8 w-8",onClick:E,disabled:!N||d,children:t.jsx(Vm,{className:"h-3.5 w-3.5"})})]}),t.jsx("input",{ref:u,type:"file",multiple:!0,className:"hidden",onChange:D=>{const O=Array.from(D.target.files??[]);O.length>0&&w(O),D.target.value=""}})]})]})}function f0({onClick:e,active:s,disabled:n,title:r,children:a}){return t.jsx("button",{type:"button",title:r,disabled:n,onMouseDown:o=>{o.preventDefault(),e()},className:P("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 Jn(){return t.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function Ja({content:e="",onChange:s,placeholder:n="Add a description…",className:r,toolbarClassName:a,editorClassName:o}){const i=Ai({extensions:[$i.configure({heading:{levels:[1,2,3]}}),Ri,Kc,Vc.configure({nested:!0}),Ii.configure({placeholder:n})],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:c}){s&&s(c.isEmpty?"":c.getHTML())}});if(!i)return null;const l=(c,u,f,m,h)=>t.jsx(f0,{title:c,onClick:f,active:m,disabled:h,children:u},c),d="h-3.5 w-3.5";return t.jsxs("div",{className:P("flex flex-col overflow-hidden",r),children:[t.jsxs("div",{className:P("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",a),children:[l("Undo",t.jsx(tf,{className:d}),()=>i.chain().focus().undo().run(),!1,!i.can().undo()),l("Redo",t.jsx(Km,{className:d}),()=>i.chain().focus().redo().run(),!1,!i.can().redo()),t.jsx(Jn,{}),l("Bold (⌘B)",t.jsx(rl,{className:d}),()=>i.chain().focus().toggleBold().run(),i.isActive("bold")),l("Italic (⌘I)",t.jsx(hl,{className:d}),()=>i.chain().focus().toggleItalic().run(),i.isActive("italic")),l("Underline (⌘U)",t.jsx(ef,{className:d}),()=>i.chain().focus().toggleUnderline().run(),i.isActive("underline")),l("Strikethrough",t.jsx(yl,{className:d}),()=>i.chain().focus().toggleStrike().run(),i.isActive("strike")),l("Inline code",t.jsx(cl,{className:d}),()=>i.chain().focus().toggleCode().run(),i.isActive("code")),t.jsx(Jn,{}),l("Heading 1",t.jsx($m,{className:d}),()=>i.chain().focus().toggleHeading({level:1}).run(),i.isActive("heading",{level:1})),l("Heading 2",t.jsx(Rm,{className:d}),()=>i.chain().focus().toggleHeading({level:2}).run(),i.isActive("heading",{level:2})),l("Heading 3",t.jsx(Im,{className:d}),()=>i.chain().focus().toggleHeading({level:3}).run(),i.isActive("heading",{level:3})),t.jsx(Jn,{}),l("Bullet list",t.jsx(pl,{className:d}),()=>i.chain().focus().toggleBulletList().run(),i.isActive("bulletList")),l("Ordered list",t.jsx(xl,{className:d}),()=>i.chain().focus().toggleOrderedList().run(),i.isActive("orderedList")),l("Task list",t.jsx(Fm,{className:d}),()=>i.chain().focus().toggleTaskList().run(),i.isActive("taskList")),t.jsx(Jn,{}),l("Blockquote",t.jsx(Hm,{className:d}),()=>i.chain().focus().toggleBlockquote().run(),i.isActive("blockquote")),l("Code block",t.jsx(dl,{className:d}),()=>i.chain().focus().toggleCodeBlock().run(),i.isActive("codeBlock")),l("Divider line",t.jsx(En,{className:d}),()=>i.chain().focus().setHorizontalRule().run())]}),t.jsx(Fi,{editor:i,className:P("flex-1 px-5 py-4",o)})]})}function Za({html:e,className:s}){return e?t.jsx("div",{className:P("meridian-editor",s),dangerouslySetInnerHTML:{__html:e}}):null}function h0({body:e}){const s=e.trim();return s?/^<[a-z][\s\S]*>/i.test(s)?t.jsx(Za,{html:s,className:"text-xs"}):t.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:s}):null}const Ho={created:{icon:Ie,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:ha,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:On,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:nf,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:cr,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function x0(e,s){var a,o,i,l;const{action:n,changes:r}=e;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 t.jsxs(t.Fragment,{children:["changed status",d&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:bs[d]??d})]}),c&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:bs[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)),f=c.filter(h=>!d.includes(h)),m=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&&f.length>0?t.jsx(t.Fragment,{children:"updated assignees"}):u.length>0?t.jsxs(t.Fragment,{children:["assigned ",t.jsx("strong",{className:"font-medium text-foreground",children:u.map(m).join(", ")})]}):f.length>0?t.jsxs(t.Fragment,{children:["unassigned ",t.jsx("strong",{className:"font-medium text-foreground",children:f.map(m).join(", ")})]}):"updated assignees"}if(n==="updated"&&r){const d=[];for(const[c,u]of Object.entries(r)){const{from:f,to:m}=u;c==="title"||c==="description"?d.push(t.jsxs("span",{children:["updated ",t.jsx("strong",{className:"font-medium text-foreground",children:c})]},c)):c==="priority"?d.push(t.jsxs("span",{children:["changed ",t.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),f!=null&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:Ot[f]??String(f)})]}),m!=null&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:Ot[m]??String(m)})]})]},c)):c==="type"?d.push(t.jsxs("span",{children:["changed ",t.jsx("strong",{className:"font-medium text-foreground",children:"type"}),f!=null&&t.jsxs(t.Fragment,{children:[" from ",t.jsx("strong",{className:"font-medium text-foreground",children:Kt[f]??String(f)})]}),m!=null&&t.jsxs(t.Fragment,{children:[" to ",t.jsx("strong",{className:"font-medium text-foreground",children:Kt[m]??String(m)})]})]},c)):d.push(t.jsxs("span",{children:["updated ",t.jsx("strong",{className:"font-medium text-foreground",children:c.replace(/_/g," ")})]},c))}return d.length===0?"made changes":t.jsx(t.Fragment,{children:d.reduce((c,u,f)=>f===0?[u]:[...c,t.jsx("span",{children:" and "},`sep-${f}`),u],[])})}return n.replace(/_/g," ")}function Wd({issueId:e,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}=hd(),{data:f,isLoading:m}=ym(e),{data:h,isLoading:g}=vm(e),{data:y}=Rd(e),S=b=>{var N;if(c&&b===c.id){const w=c.first_name??"",j=c.last_name??"",E=`${w} ${j}`.trim()||c.email,p=(w[0]??j[0]??((N=c.email)==null?void 0:N[0])??"U").toUpperCase();return{name:E,initials:p}}return(u==null?void 0:u.get(b))??{name:"Unknown",initials:"?"}};return t.jsxs("div",{className:s,children:[t.jsx("div",{className:"flex items-center gap-0.5 px-6 pt-4 pb-2 flex-wrap",children:["comments","activity","attachments","time"].map(b=>{const N=b==="comments"?(f==null?void 0:f.length)??0:b==="activity"?(h==null?void 0:h.length)??0:void 0,w=b==="comments"?"Comments":b==="activity"?"Activity":b==="attachments"?"Attachments":"Time";return t.jsxs("button",{onClick:()=>d(b),className:P("px-3 py-1.5 text-xs font-medium rounded-md transition-colors",i===b?"bg-foreground/5 text-foreground":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[w,N!=null&&N>0&&t.jsx("span",{className:"ml-1.5 text-[10px] tabular-nums text-muted-foreground",children:N})]},b)})}),i==="comments"&&t.jsxs("div",{className:"px-6 pb-5",children:[t.jsx("div",{className:"space-y-5 mb-5",children:m?t.jsxs("div",{className:"flex gap-3",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsx(te,{className:"h-16 flex-1"})]}):f&&f.length>0?(n?f.slice(-5):f).map(b=>{const N=S(b.author_id),w=(y??[]).filter(j=>j.comment_id===b.id);return t.jsxs("div",{className:"flex gap-3",children:[t.jsx(st,{className:"h-7 w-7 mt-0.5 shrink-0",children:t.jsx(nt,{className:"text-[11px] bg-muted text-muted-foreground",children:N.initials})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-baseline gap-2 mb-1",children:[t.jsx("span",{className:"text-xs font-medium text-foreground",children:N.name}),t.jsx("span",{className:"text-[11px] text-muted-foreground",children:oe(new Date(b.created_at),"MMM d, h:mm a")})]}),t.jsx(h0,{body:b.body}),w.length>0&&t.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:w.map(j=>t.jsx(Jb,{attachment:j},j.id))})]})]},b.id)}):t.jsx("p",{className:"text-sm text-muted-foreground/50 py-2",children:"No comments yet."})}),n&&f&&f.length>5&&r&&t.jsxs("button",{onClick:r,className:"text-xs text-muted-foreground hover:text-foreground mb-4 underline underline-offset-2",children:["View all ",f.length," comments"]}),!o&&t.jsx(zd,{issueId:e})]}),i==="activity"&&t.jsx("div",{className:"px-6 pb-6",children:g?t.jsx("div",{className:"space-y-4 pt-1",children:[1,2,3].map(b=>t.jsxs("div",{className:"flex gap-3",children:[t.jsx(te,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),t.jsx(te,{className:"h-4 flex-1 mt-1"})]},b))}):h&&h.length>0?t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"relative",children:[t.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-border"}),t.jsx("div",{className:"space-y-0",children:(n?h.slice(-5):h).map((b,N,w)=>{var $;const j=Ho[b.action]??Ho.updated,E=j.icon,p=(($=u==null?void 0:u.get(b.actor_id))==null?void 0:$.name)??"System",C=N===w.length-1;return t.jsxs("div",{className:P("relative flex gap-3",C?"pb-0":"pb-4"),children:[t.jsx("div",{className:P("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",j.bg),children:t.jsx(E,{className:P("h-3 w-3",j.color)})}),t.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[t.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[t.jsx("span",{className:"font-medium",children:p})," ",t.jsx("span",{className:"text-muted-foreground",children:x0(b,u)})]}),t.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:oe(new Date(b.created_at),"MMM d, yyyy · h:mm a")})]})]},b.id)})})]}),n&&h.length>5&&r&&t.jsxs("button",{onClick:r,className:"text-xs text-muted-foreground hover:text-foreground mt-3 underline underline-offset-2",children:["View all ",h.length," events"]})]}):t.jsx("p",{className:"text-sm text-muted-foreground/50 py-2",children:"No activity yet."})}),i==="attachments"&&t.jsx(t0,{issueId:e}),i==="time"&&t.jsx(m0,{issueId:e})]})}const qd=x.forwardRef(({className:e,children:s,...n},r)=>t.jsxs(Si,{ref:r,className:P("relative overflow-hidden",e),...n,children:[t.jsx($c,{className:"h-full w-full rounded-[inherit]",children:s}),t.jsx(Bd,{}),t.jsx(Rc,{})]}));qd.displayName=Si.displayName;const Bd=x.forwardRef(({className:e,orientation:s="vertical",...n},r)=>t.jsx(Ci,{ref:r,orientation:s,className:P("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]",e),...n,children:t.jsx(Ic,{className:"relative flex-1 rounded-full bg-border"})}));Bd.displayName=Ci.displayName;function tt({zone:e,props:s}){const n=bm(e);return n.length?t.jsx(t.Fragment,{children:n.map((r,a)=>t.jsx(r,{...s},a))}):null}function p0(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function Yd({issue:e,projectId:s,open:n,onClose:r}){const a=He(),{workspace:o,projectKey:i}=Ge(),{data:l}=tl((e==null?void 0:e.id)??""),d=l??e,[c,u]=x.useState(!1),[f,m]=x.useState(""),[h,g]=x.useState(""),[y,S]=x.useState("comments"),[b,N]=x.useState(!1),w=or((d==null?void 0:d.id)??"",s),{data:j}=sn(s),{data:E}=nn(s||void 0),{data:p}=qn(s||void 0),{data:C}=Cn(s||void 0),$=(E??[]).filter(M=>M.status!=="completed"),D=d!=null&&d.parent_id?C==null?void 0:C.find(M=>M.id===d.parent_id):null,O=(C==null?void 0:C.filter(M=>M.parent_id===(d==null?void 0:d.id)))??[],F=d!=null&&d.task_list_id?p==null?void 0:p.find(M=>M.id===d.task_list_id):null,_=j&&j.length>0?Object.fromEntries(j.map(M=>[M.key,M.name])):bs;if(x.useEffect(()=>{d&&(m(d.title),g(d.description??"")),u(!1)},[d==null?void 0:d.id]),!d)return null;const R=()=>{f.trim()&&w.mutate({title:f.trim(),description:h.trim()||void 0},{onSuccess:()=>{u(!1),I.success("Issue updated")},onError:()=>I.error("Failed to update issue")})},T=()=>{m(d.title),g(d.description??""),u(!1)},X=M=>{w.mutate({status:M},{onSuccess:()=>I.success("Status updated"),onError:()=>I.error("Failed to update status")})},q=M=>{w.mutate({priority:M},{onSuccess:()=>I.success("Priority updated"),onError:()=>I.error("Failed to update priority")})},V=M=>{w.mutate({type:M},{onSuccess:()=>I.success("Type updated"),onError:()=>I.error("Failed to update type")})},W=M=>{w.mutate({assignee_ids:M},{onSuccess:()=>I.success("Assignees updated"),onError:()=>I.error("Failed to update assignees")})},z=M=>{w.mutate({sprint_id:M},{onSuccess:()=>I.success(M?"Sprint assigned":"Removed from sprint"),onError:()=>I.error("Failed to update sprint")})},Q=M=>{w.mutate({task_list_id:M},{onSuccess:()=>I.success(M?"Moved to list":"Removed from list"),onError:()=>I.error("Failed to update list")})},ee=M=>{w.mutate({start_date:M?oe(M,"yyyy-MM-dd"):null},{onSuccess:()=>I.success(M?"Start date set":"Start date cleared"),onError:()=>I.error("Failed to update start date")})},k=M=>{w.mutate({due_date:M?oe(M,"yyyy-MM-dd"):null},{onSuccess:()=>I.success(M?"Due date set":"Due date cleared"),onError:()=>I.error("Failed to update due date")})};return t.jsxs(t.Fragment,{children:[t.jsx(Ss,{open:n,onOpenChange:M=>!M&&r(),children:t.jsxs(Cs,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden",children:[(()=>{const M=j==null?void 0:j.find(ae=>ae.category==="completed"),Y=!!M&&d.status===M.key,L=(ae,A,ie)=>{const ge=ae;return t.jsx("button",{title:A,onClick:ie,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:t.jsx(ge,{className:"h-4 w-4"})},A)};return t.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[t.jsxs("button",{onClick:()=>{var ae;M&&X(Y?((ae=j==null?void 0:j.find(A=>A.category==="unstarted"||A.category==="backlog"))==null?void 0:ae.key)??d.status:M.key)},className:P("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",Y?"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:[t.jsx(it,{className:"h-3.5 w-3.5"}),Y?"Completed":"Mark complete"]}),t.jsxs("div",{className:"flex items-center",children:[L(Jm,"Upvote"),L(wa,"Attachments"),L(Qs,"Add sub-issue",()=>N(!0)),L(ja,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${o}/projects/${i}/issues/${d.id}`),I.success("Link copied")}),L(qm,"Open full page",()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)}),c?t.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:T,children:"Cancel"}),t.jsxs(K,{size:"sm",className:"h-7 text-xs",onClick:R,disabled:!f.trim()||w.isPending,children:[t.jsx(it,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:L(Dn,"More options")}),t.jsx(Xt,{align:"end",className:"w-40",children:t.jsxs(Je,{onClick:()=>u(!0),children:[t.jsx(cr,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),L(Um,"Open in full page",()=>{r(),a(`/${o}/projects/${i}/issues/${d.id}`)})]})]})})(),t.jsxs("div",{className:"px-6 pt-4 pb-2 shrink-0",children:[c?t.jsx(xe,{value:f,onChange:M=>m(M.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground shrink-0",children:d.identifier}),t.jsx(Un,{variant:"muted",className:"text-[10px] shrink-0",children:Kt[d.type]??d.type})]}),!c&&t.jsx("h2",{className:"text-base font-medium leading-snug",children:d.title})]}),t.jsxs(qd,{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"px-6 py-4 space-y-5 min-w-0",children:[t.jsx(tt,{zone:"issue.details.before",props:{issue:d}}),t.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-1",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Status"}),t.jsxs(we,{value:d.status,onValueChange:X,children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(_).map(([M,Y])=>t.jsx(ce,{value:M,className:"text-xs",children:Y},M))})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Priority"}),t.jsxs(we,{value:d.priority,onValueChange:q,children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Ot).map(([M,Y])=>t.jsx(ce,{value:M,className:"text-xs",children:Y},M))})]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Type"}),t.jsxs(we,{value:d.type,onValueChange:V,children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsx(Ee,{})}),t.jsx(je,{children:Object.entries(Kt).map(([M,Y])=>t.jsx(ce,{value:M,className:"text-xs",children:Y},M))})]})]})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Assignees"}),t.jsx(Bn,{value:d.assignee_ids??[],onChange:W,disabled:w.isPending})]}),t.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Sprint"}),t.jsxs(we,{value:d.sprint_id??"none",onValueChange:M=>z(M==="none"?null:M),children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[t.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No sprint"})]})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),$.map(M=>{const Y=p0(M);return t.jsx(ce,{value:M.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:M.name}),Y&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:Y})]})},M.id)})]})]})]}),(p??[]).length>0&&t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"List"}),t.jsxs(we,{value:d.task_list_id??"none",onValueChange:M=>Q(M==="none"?null:M),children:[t.jsx(ve,{className:"h-8 text-xs bg-transparent min-w-0",children:t.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[t.jsx(va,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No list",children:F?F.name:"No list"})]})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(p??[]).map(M=>t.jsx(ce,{value:M.id,className:"text-xs",children:M.name},M.id))]})]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Start Date"}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs bg-transparent hover:bg-accent transition-colors overflow-hidden",children:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(Ue,{className:"w-auto p-0",align:"start",children:[t.jsx(lt,{mode:"single",selected:d.start_date?new Date(d.start_date):void 0,onSelect:ee,initialFocus:!0}),d.start_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>ee(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})]}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Due Date"}),t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs bg-transparent hover:bg-accent transition-colors overflow-hidden",children:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(Ue,{className:"w-auto p-0",align:"start",children:[t.jsx(lt,{mode:"single",selected:d.due_date?new Date(d.due_date):void 0,onSelect:k,initialFocus:!0}),d.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>k(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),!d.parent_id&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("p",{className:"text-xs text-muted-foreground",children:"Child Issues"}),t.jsxs("button",{onClick:()=>N(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3 w-3"}),"Add"]})]}),D&&t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx(ga,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:"text-muted-foreground shrink-0",children:"Parent:"}),t.jsx("button",{onClick:()=>a(`/${o}/projects/${i}/issues/${D.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:D.identifier}),t.jsx("span",{className:"text-foreground truncate",children:D.title})]}),O.length===0&&!D?t.jsx("p",{className:"text-xs text-muted-foreground/40 italic",children:"No child issues yet"}):t.jsx("div",{className:"space-y-1",children:O.map(M=>t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx(ul,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${M.id}`)},className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:M.identifier}),t.jsx("button",{onClick:()=>{r(),a(`/${o}/projects/${i}/issues/${M.id}`)},className:"text-muted-foreground truncate hover:text-foreground transition-colors text-left",children:M.title})]},M.id))})]}),t.jsxs("div",{children:[t.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Description"}),c?t.jsx(Ja,{content:h,onChange:g,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${d.id}-edit`):d.description?t.jsx(Za,{html:d.description,className:"text-sm"}):t.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})]})]}),t.jsx("div",{className:"px-6 py-4",children:t.jsx(tt,{zone:"issue.details.after",props:{issue:d}})}),t.jsx(Wd,{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"&&t.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:t.jsx(zd,{issueId:d.id,compact:!0})})]})}),t.jsx(Nr,{open:b,onClose:()=>N(!1),projectId:s,defaultParentId:d.id,defaultTaskListId:d.task_list_id})]})}function g0(){const{projectKey:e}=Ge(),[s,n]=x.useState(null),[r,a]=x.useState(!1),{data:o}=ws(e??""),i=(o==null?void 0:o.id)??"",{data:l,isLoading:d}=Cn(i||void 0),{data:c,isLoading:u}=sn(i||void 0),f=og(i);if(!e)return null;const m=d||u||!o,h=g=>{f.mutate(g)};return t.jsxs("div",{className:"flex flex-col h-full gap-0",children:[t.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border shrink-0",children:t.jsxs(K,{size:"sm",onClick:()=>a(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create"]})}),t.jsx(tt,{zone:"project.board.before",props:{projectId:i}}),t.jsx("div",{className:"flex-1 min-h-0",children:m?t.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(g=>t.jsxs("div",{className:"min-w-[260px]",children:[t.jsx(te,{className:"h-5 w-24 mb-3 rounded"}),t.jsxs("div",{className:"space-y-2",children:[t.jsx(te,{className:"h-[82px] w-full rounded-lg"}),t.jsx(te,{className:"h-[82px] w-full rounded-lg"})]})]},g))}):t.jsx(hg,{issues:l??[],projectId:i,statuses:c??[],onIssueClick:n,onColumnsReorder:h})})]}),t.jsx(tt,{zone:"project.board.after",props:{projectId:i}}),t.jsx(Yd,{issue:s,projectId:i,open:!!s,onClose:()=>n(null)}),t.jsx(Nr,{open:r,onClose:()=>a(!1),projectId:i})]})}const Ko=({priority:e,className:s})=>{const n=P("h-3.5 w-3.5 shrink-0",xd[e],s);switch(e){case"urgent":return t.jsx(Xs,{className:n});case"high":return t.jsx(lr,{className:n});case"medium":return t.jsx(En,{className:n});case"low":return t.jsx(ir,{className:n});default:return t.jsx(Nt,{className:P("h-3.5 w-3.5 shrink-0 text-zinc-300",s)})}};function Ld({issue:e,projectId:s,statuses:n,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:c=!1,children:u=[],onAddChild:f}){const m=He(),[h,g]=x.useState(null),[y,S]=x.useState(!1),b=or(e.id,s);function N(p){b.mutate(p),g(null)}const w=(a==null?void 0:a[e.status])??"#94a3b8",j=o.find(p=>p.id===e.sprint_id),E=u.length>0;return t.jsxs(t.Fragment,{children:[t.jsxs("div",{onClick:()=>d(e),className:P("group grid grid-cols-[70px_1fr_150px_120px_130px_140px_130px_32px] items-center px-6 py-3","hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",c&&"pl-14 bg-muted/10",b.isPending&&"opacity-70"),children:[t.jsx("span",{className:P("text-xs font-mono text-muted-foreground truncate",c&&"text-muted-foreground/60"),children:e.identifier}),t.jsxs("div",{className:"flex items-center gap-1 min-w-0 pr-3",children:[!c&&E&&t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.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?t.jsx(Vs,{className:"h-3.5 w-3.5"}):t.jsx(Gs,{className:"h-3.5 w-3.5"})})}),t.jsx(Ut,{side:"top",children:y?"Collapse":"Expand"})]}),!c&&!E&&t.jsx("span",{className:"w-4 shrink-0"}),c&&t.jsx("span",{className:"text-muted-foreground/40 shrink-0 text-xs",children:"↳"}),t.jsx("span",{className:P("text-sm text-foreground truncate",c&&"text-muted-foreground"),children:e.title}),!c&&E&&t.jsx("span",{className:"shrink-0 text-[10px] text-muted-foreground/60 ml-1 font-mono",children:u.length})]}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="status",onOpenChange:p=>g(p?"status":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:w}}),t.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[e.status]??e.status})]})}),t.jsx(Ue,{className:"w-52 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Fs,{children:t.jsx(zs,{children:t.jsx(hs,{children:n.map(p=>t.jsxs(mt,{value:p.name,onSelect:()=>N({status:p.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:p.color}}),t.jsx("span",{className:"text-xs flex-1",children:p.name}),e.status===p.key&&t.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500"})]},p.key))})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="priority",onOpenChange:p=>g(p?"priority":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(Ko,{priority:e.priority}),t.jsx("span",{className:"text-xs text-muted-foreground",children:Ot[e.priority]??e.priority})]})}),t.jsx(Ue,{className:"w-44 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Fs,{children:t.jsx(zs,{children:t.jsx(hs,{children:Object.entries(Ot).map(([p,C])=>t.jsxs(mt,{value:C,onSelect:()=>N({priority:p}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(Ko,{priority:p}),t.jsx("span",{className:"text-xs flex-1",children:C}),e.priority===p&&t.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500"})]},p))})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="sprint",onOpenChange:p=>g(p?"sprint":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:P("text-xs truncate",j?"text-foreground":"text-muted-foreground"),children:(j==null?void 0:j.name)??"No sprint"})]})}),t.jsx(Ue,{className:"w-56 p-1",align:"start",onClick:p=>p.stopPropagation(),children:t.jsx(Fs,{children:t.jsx(zs,{children:t.jsxs(hs,{children:[t.jsxs(mt,{value:"no-sprint",onSelect:()=>N({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(Fe,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&t.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500"})]}),o.filter(p=>p.status!=="completed").map(p=>t.jsxs(mt,{value:p.name,onSelect:()=>N({sprint_id:p.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[t.jsx(xt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-xs truncate",children:p.name}),(p.start_date||p.end_date)&&t.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"):"—"]})]}),e.sprint_id===p.id&&t.jsx(it,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},p.id))]})})})})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsxs(Ke,{open:h==="due",onOpenChange:p=>g(p?"due":null),children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("span",{className:P("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?oe(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),t.jsxs(Ue,{className:"w-auto p-0",align:"start",onClick:p=>p.stopPropagation(),children:[t.jsx(lt,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:p=>N({due_date:p?oe(p,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>N({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),t.jsx("div",{onClick:p=>p.stopPropagation(),children:t.jsx(Bn,{value:e.assignee_ids??[],onChange:p=>b.mutate({assignee_ids:p})})}),t.jsxs("div",{className:"flex items-center gap-1",onClick:p=>p.stopPropagation(),children:[!c&&f&&t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx("button",{onClick:()=>f(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:t.jsx(zm,{className:"h-3.5 w-3.5"})})}),t.jsx(Ut,{side:"top",children:"Add child issue"})]}),t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx("button",{onClick:()=>m(`/${i}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:t.jsx(ml,{className:"h-3.5 w-3.5"})})}),t.jsx(Ut,{side:"top",children:"Open full page"})]})]})]}),!c&&y&&u.map(p=>t.jsx(Ld,{issue:p,projectId:s,statuses:n,statusLabels:r,statusColorMap:a,sprints:o,workspace:i,projectKey:l,onOpen:d,isChild:!0},p.id))]})}function Vo({taskList:e,issues:s,childrenMap:n,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,onAddIssue:f,onAddChild:m,onRenameList:h,onDeleteList:g}){const[y,S]=x.useState(!1),[b,N]=x.useState(!1),[w,j]=x.useState((e==null?void 0:e.name)??""),E=s.reduce(($,D)=>{var O;return $+(((O=n[D.id])==null?void 0:O.length)??0)},0),p=s.length+E,C=()=>{e&&w.trim()&&h&&h(e.id,w.trim()),N(!1)};return t.jsxs("div",{children:[t.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx("button",{onClick:()=>S(!y),className:"text-muted-foreground hover:text-foreground transition-colors",children:y?t.jsx(Gs,{className:"h-3.5 w-3.5"}):t.jsx(Vs,{className:"h-3.5 w-3.5"})})}),t.jsx(Ut,{side:"right",children:y?"Expand":"Collapse"})]}),e?b?t.jsx("input",{autoFocus:!0,value:w,onChange:$=>j($.target.value),onBlur:C,onKeyDown:$=>{$.key==="Enter"&&C(),$.key==="Escape"&&(N(!1),j(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):t.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):t.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),t.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:p}),t.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[t.jsxs("button",{onClick:()=>f((e==null?void 0:e.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:[t.jsx(Ie,{className:"h-3 w-3"}),"Add issue"]}),e&&t.jsxs(Ns,{children:[t.jsxs(us,{children:[t.jsx(ms,{asChild:!0,children:t.jsx(ks,{asChild:!0,children:t.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Dn,{className:"h-3.5 w-3.5"})})})}),t.jsx(Ut,{side:"top",children:"More options"})]}),t.jsxs(Xt,{align:"end",className:"w-36",children:[t.jsxs(Je,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{N(!0),j(e.name)},children:[t.jsx(cr,{className:"h-3.5 w-3.5"}),"Rename"]}),t.jsxs(Je,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>g==null?void 0:g(e.id),children:[t.jsx(Tt,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!y&&t.jsx("div",{className:"divide-y divide-border/60",children:s.length===0?t.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):s.map($=>t.jsx(Ld,{issue:$,projectId:r,statuses:a,statusLabels:o,statusColorMap:i,sprints:l,workspace:d,projectKey:c,onOpen:u,children:n[$.id]??[],onAddChild:m},$.id))})]})}function b0(){var ae;const{workspace:e,projectKey:s}=Ge(),[n,r]=x.useState(null),[a,o]=x.useState({open:!1}),[i,l]=x.useState(""),[d,c]=x.useState(!1),[u,f]=x.useState(""),[m,h]=x.useState("all"),[g,y]=x.useState("all"),[S,b]=x.useState("all"),{data:N}=ws(s??""),w=(N==null?void 0:N.id)??"",{data:j,isLoading:E}=Cn(w||void 0),{data:p}=sn(w||void 0),{data:C}=nn(w||void 0),{data:$}=qn(w||void 0),D=bg(w),O=yg(w),F=vg(w),_=p&&p.length>0?p:Object.entries(bs).map(([A,ie],ge)=>({id:A,project_id:w,key:A,name:ie,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[A]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[A]??"backlog",position:ge})),R=Object.fromEntries(_.map(A=>[A.key,A.name])),T=Object.fromEntries(_.map(A=>[A.key,A.color])),X=C??[];if(!s||!e)return null;const q=(j??[]).filter(A=>{const ie=!u||A.title.toLowerCase().includes(u.toLowerCase())||A.identifier.toLowerCase().includes(u.toLowerCase()),ge=m==="all"||A.status===m,Te=g==="all"||A.priority===g,qe=S==="all"||(S==="none"?!A.sprint_id:A.sprint_id===S);return ie&&ge&&Te&&qe}).sort((A,ie)=>{const ge=parseInt(A.identifier.split("-")[1]??"0",10),Te=parseInt(ie.identifier.split("-")[1]??"0",10);return ge-Te}),V={};for(const A of j??[])A.parent_id&&(V[A.parent_id]||(V[A.parent_id]=[]),V[A.parent_id].push(A));const W=q.filter(A=>!A.parent_id),z=q.length,Q=new Set(($??[]).map(A=>A.id)),ee={__none__:[]};for(const A of $??[])ee[A.id]=[];for(const A of W){const ie=A.task_list_id&&Q.has(A.task_list_id)?A.task_list_id:"__none__";ee[ie].push(A)}function k(){i.trim()&&D.mutate({name:i.trim()},{onSuccess:()=>{l(""),c(!1),I.success("List created")},onError:()=>I.error("Failed to create list")})}function M(A,ie){O.mutate({id:A,name:ie},{onError:()=>I.error("Failed to rename list")})}function Y(A){const ie=$==null?void 0:$.find(ge=>ge.id===A);confirm(`Delete list "${ie==null?void 0:ie.name}"? Issues in this list will be moved to No List.`)&&F.mutate(A,{onSuccess:()=>I.success("List deleted"),onError:()=>I.error("Failed to delete list")})}const L="grid-cols-[70px_1fr_150px_120px_130px_140px_130px_32px]";return t.jsxs("div",{className:"p-2",children:[t.jsx(tt,{zone:"project.issues.before",props:{projectId:w}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:t.jsxs("div",{className:"flex items-center gap-2",children:[d?t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsx(xe,{autoFocus:!0,placeholder:"List name...",value:i,onChange:A=>l(A.target.value),onKeyDown:A=>{A.key==="Enter"&&k(),A.key==="Escape"&&(c(!1),l(""))},className:"h-8 text-xs w-36"}),t.jsx(K,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:k,disabled:!i.trim()||D.isPending,children:"Add"}),t.jsx(K,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{c(!1),l("")},children:"Cancel"})]}):t.jsxs(K,{size:"sm",variant:"outline",onClick:()=>c(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"New List"]}),t.jsxs(K,{size:"sm",onClick:()=>o({open:!0}),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create"]})]})}),t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(we,{value:S,onValueChange:b,children:[t.jsx(ve,{className:"h-8 text-xs w-[140px] bg-transparent",children:t.jsx(Ee,{placeholder:"Sprint"})}),t.jsxs(je,{children:[t.jsx(ce,{value:"all",className:"text-xs",children:"All sprints"}),t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),X.map(A=>t.jsx(ce,{value:A.id,className:"text-xs",children:A.name},A.id))]})]}),t.jsxs(we,{value:m,onValueChange:h,children:[t.jsx(ve,{className:"h-8 text-xs w-[130px] bg-transparent",children:t.jsx(Ee,{placeholder:"Status"})}),t.jsxs(je,{children:[t.jsx(ce,{value:"all",className:"text-xs",children:"All statuses"}),_.map(({key:A,name:ie})=>t.jsx(ce,{value:A,className:"text-xs",children:ie},A))]})]}),t.jsxs(we,{value:g,onValueChange:y,children:[t.jsx(ve,{className:"h-8 text-xs w-[130px] bg-transparent",children:t.jsx(Ee,{placeholder:"Priority"})}),t.jsxs(je,{children:[t.jsx(ce,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(Ot).map(([A,ie])=>t.jsx(ce,{value:A,className:"text-xs",children:ie},A))]})]})]}),t.jsxs("div",{className:"relative",children:[t.jsx(mr,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),t.jsx(xe,{placeholder:"Search...",value:u,onChange:A=>f(A.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),t.jsxs("div",{className:P("grid items-center px-6 py-2.5 border-b border-border",L),children:[t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"ID"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Title"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),t.jsx("span",{})]}),E?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(A=>t.jsxs("div",{className:P("grid items-center px-6 py-3 gap-4",L),children:[t.jsx(te,{className:"h-4 w-14"}),t.jsx(te,{className:"h-4 w-56"}),t.jsx(te,{className:"h-5 w-20"}),t.jsx(te,{className:"h-4 w-16"}),t.jsx(te,{className:"h-4 w-20"}),t.jsx(te,{className:"h-4 w-24"}),t.jsx(te,{className:"h-6 w-16"}),t.jsx("span",{})]},A))}):z===0&&(j??[]).length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),t.jsxs(K,{size:"sm",onClick:()=>o({open:!0}),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Create issue"]})]}):W.length===0&&(j??[]).length>0?t.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:t.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):t.jsx(fa,{delayDuration:200,children:t.jsxs("div",{className:"divide-y divide-border",children:[($??[]).map(A=>t.jsx(Vo,{taskList:A,issues:ee[A.id]??[],childrenMap:V,projectId:w,statuses:_,statusLabels:R,statusColorMap:T,sprints:X,workspace:e,projectKey:s,onOpen:r,onAddIssue:ie=>o({open:!0,defaultTaskListId:ie}),onAddChild:ie=>o({open:!0,defaultParentId:ie}),onRenameList:M,onDeleteList:Y},A.id)),(((ae=ee.__none__)==null?void 0:ae.length)>0||($??[]).length===0)&&t.jsx(Vo,{taskList:null,issues:ee.__none__??[],childrenMap:V,projectId:w,statuses:_,statusLabels:R,statusColorMap:T,sprints:X,workspace:e,projectKey:s,onOpen:r,onAddIssue:A=>o({open:!0,defaultTaskListId:A}),onAddChild:A=>o({open:!0,defaultParentId:A})})]})}),!E&&z>0&&t.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[z," issue",z!==1?"s":""]})})]}),t.jsx(tt,{zone:"project.issues.after",props:{projectId:w}}),t.jsx(Yd,{issue:n,projectId:w,open:!!n,onClose:()=>r(null)}),t.jsx(Nr,{open:a.open,onClose:()=>o({open:!1}),projectId:w,defaultTaskListId:a.defaultTaskListId,defaultParentId:a.defaultParentId})]})}function y0(e,s=[]){let n=[];function r(o,i){const l=x.createContext(i),d=n.length;n=[...n,i];const c=f=>{var b;const{scope:m,children:h,...g}=f,y=((b=m==null?void 0:m[e])==null?void 0:b[d])||l,S=x.useMemo(()=>g,Object.values(g));return t.jsx(y.Provider,{value:S,children:h})};c.displayName=o+"Provider";function u(f,m){var y;const h=((y=m==null?void 0:m[e])==null?void 0:y[d])||l,g=x.useContext(h);if(g)return g;if(i!==void 0)return i;throw new Error(`\`${f}\` 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[e])||o;return x.useMemo(()=>({[`__scope${e}`]:{...l,[e]:d}}),[l,d])}};return a.scopeName=e,[r,v0(a,...s)]}function v0(...e){const s=e[0];if(e.length===1)return s;const n=()=>{const r=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const i=r.reduce((l,{useScope:d,scopeName:c})=>{const f=d(o)[`__scope${c}`];return{...l,...f}},{});return x.useMemo(()=>({[`__scope${s.scopeName}`]:i}),[i])}};return n.scopeName=s.scopeName,n}var j0=Symbol("radix.slottable");function w0(e){const s=({children:n})=>t.jsx(t.Fragment,{children:n});return s.displayName=`${e}.Slottable`,s.__radixId=j0,s}var Ud="AlertDialog",[N0]=y0(Ud,[Di]),At=Di(),Hd=e=>{const{__scopeAlertDialog:s,...n}=e,r=At(s);return t.jsx(Sn,{...r,...n,modal:!0})};Hd.displayName=Ud;var k0="AlertDialogTrigger",S0=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(Wc,{...a,...r,ref:s})});S0.displayName=k0;var C0="AlertDialogPortal",Kd=e=>{const{__scopeAlertDialog:s,...n}=e,r=At(s);return t.jsx(kn,{...r,...n})};Kd.displayName=C0;var M0="AlertDialogOverlay",Vd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(ys,{...a,...r,ref:s})});Vd.displayName=M0;var Ws="AlertDialogContent",[D0,_0]=N0(Ws),E0=w0("AlertDialogContent"),Gd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,children:r,...a}=e,o=At(n),i=x.useRef(null),l=Mi(s,i),d=x.useRef(null);return t.jsx(Fc,{contentName:Ws,titleName:Qd,docsSlug:"alert-dialog",children:t.jsx(D0,{scope:n,cancelRef:d,children:t.jsxs(vs,{role:"alertdialog",...o,...a,ref:l,onOpenAutoFocus:zc(a.onOpenAutoFocus,c=>{var u;c.preventDefault(),(u=d.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[t.jsx(E0,{children:r}),t.jsx(T0,{contentRef:i})]})})})});Gd.displayName=Ws;var Qd="AlertDialogTitle",Xd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(Us,{...a,...r,ref:s})});Xd.displayName=Qd;var Jd="AlertDialogDescription",Zd=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(Hs,{...a,...r,ref:s})});Zd.displayName=Jd;var O0="AlertDialogAction",ec=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,a=At(n);return t.jsx(ar,{...a,...r,ref:s})});ec.displayName=O0;var tc="AlertDialogCancel",sc=x.forwardRef((e,s)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=_0(tc,n),o=At(n),i=Mi(s,a);return t.jsx(ar,{...o,...r,ref:i})});sc.displayName=tc;var T0=({contentRef:e})=>{const s=`\`${Ws}\` requires a description for the component to be accessible for screen reader users.
471
471
 
472
- You can add a description to the \`${Ws}\` by passing a \`${Qd}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
472
+ You can add a description to the \`${Ws}\` by passing a \`${Jd}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
473
473
 
474
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 \`${Ws}\`. 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
475
 
476
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(s)},[s,e]),null},O0=Ld,T0=Hd,tc=Ud,sc=Kd,nc=Jd,rc=ec,ac=Gd,oc=Xd;const ic=O0,P0=T0,lc=x.forwardRef(({className:e,...s},n)=>t.jsx(tc,{className:O("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",e),...s,ref:n}));lc.displayName=tc.displayName;const eo=x.forwardRef(({className:e,...s},n)=>t.jsxs(P0,{children:[t.jsx(lc,{}),t.jsx(sc,{ref:n,className:O("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",e),...s})]}));eo.displayName=sc.displayName;const to=({className:e,...s})=>t.jsx("div",{className:O("flex flex-col space-y-2 text-center sm:text-left",e),...s});to.displayName="AlertDialogHeader";const so=({className:e,...s})=>t.jsx("div",{className:O("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});so.displayName="AlertDialogFooter";const no=x.forwardRef(({className:e,...s},n)=>t.jsx(ac,{ref:n,className:O("text-base font-semibold",e),...s}));no.displayName=ac.displayName;const ro=x.forwardRef(({className:e,...s},n)=>t.jsx(oc,{ref:n,className:O("text-sm text-muted-foreground",e),...s}));ro.displayName=oc.displayName;const ao=x.forwardRef(({className:e,...s},n)=>t.jsx(nc,{ref:n,className:O(Is(),e),...s}));ao.displayName=nc.displayName;const oo=x.forwardRef(({className:e,...s},n)=>t.jsx(rc,{ref:n,className:O(Is({variant:"outline"}),"mt-2 sm:mt-0",e),...s}));oo.displayName=rc.displayName;function A0({member:e,onRequestRemove:s}){var l;const n=e.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 t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsx(at,{className:"h-8 w-8 shrink-0",children:t.jsx(ot,{className:"text-xs font-medium",children:i})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:o}),(n==null?void 0:n.email)&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:n.email})]}),t.jsx(Ln,{className:O("shrink-0 text-[11px] border-0 w-20 justify-center",e.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:e.role}),t.jsx(K,{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(e.user_id,o),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}function $0({teamEntry:e,onRemove:s}){const n=e.team;return t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsx("div",{className:"h-8 w-8 rounded-lg bg-muted flex items-center justify-center shrink-0",children:t.jsx(xs,{className:"h-4 w-4 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:(n==null?void 0:n.name)??"Unknown team"}),n&&t.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[n.member_count," ",n.member_count===1?"member":"members"]})]}),t.jsx(K,{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(e.team_id),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}function R0(){const{projectKey:e}=Ge(),{workspace:s}=ke(),n=(s==null?void 0:s.id)??"",{data:r}=ws(e??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=Xl(a),{data:l}=fr(n),{data:d}=Ca(n),c=Jl(a),u=Zl(a),f=ed(a),m=td(a),[h,g]=x.useState(""),[y,S]=x.useState(""),[b,N]=x.useState(null),w=new Set((o==null?void 0:o.members.map(_=>_.user_id))??[]),j=new Set((o==null?void 0:o.teams.map(_=>_.team_id))??[]),E=(l??[]).filter(_=>!w.has(_.user_id)),p=(d??[]).filter(_=>!j.has(_.id)),C=(o==null?void 0:o.members.length)??0,A=(o==null?void 0:o.teams.length)??0;function D(){b&&u.mutate(b.userId,{onSuccess:()=>{R.success("Access removed"),N(null)},onError:()=>R.error("Failed to remove")})}return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold",children:"Access"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Manage who has access to this project."})]}),!i&&t.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[C," member",C!==1?"s":""," • ",A," team",A!==1?"s":""]})]}),i?t.jsxs("div",{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),t.jsx("div",{className:"divide-y divide-border",children:[1,2].map(_=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(te,{className:"h-8 w-8 rounded-full"}),t.jsx(te,{className:"h-4 w-44"}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{className:"h-5 w-20"})]},_))}),t.jsx("div",{className:"px-6 py-2 border-y border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),t.jsx("div",{className:"divide-y divide-border",children:[1].map(_=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(te,{className:"h-8 w-8 rounded-lg"}),t.jsx(te,{className:"h-4 w-32"}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{className:"h-4 w-20"})]},_))})]}):t.jsxs("div",{children:[t.jsxs("div",{children:[t.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:[t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"}),E.length>0&&t.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[t.jsxs(we,{value:h,onValueChange:g,children:[t.jsx(ve,{className:"h-8 text-xs w-full sm:w-56",children:t.jsx(Ee,{placeholder:"Add person…"})}),t.jsx(je,{children:E.map(_=>{const I=_.user,$=(I==null?void 0:I.first_name)??"",F=(I==null?void 0:I.last_name)??"",T=`${$} ${F}`.trim()||(I==null?void 0:I.email)||"Unknown";return t.jsx(de,{value:_.user_id,children:T},_.user_id)})})]}),t.jsxs(K,{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:[t.jsx(On,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),C===0?t.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No individual members."}):t.jsx("div",{className:"divide-y divide-border",children:o==null?void 0:o.members.map(_=>t.jsx(A0,{member:_,onRequestRemove:(I,$)=>N({userId:I,displayName:$})},_.id))})]}),t.jsxs("div",{className:"border-t border-border",children:[t.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:[t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"}),p.length>0&&t.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[t.jsxs(we,{value:y,onValueChange:S,children:[t.jsx(ve,{className:"h-8 text-xs w-full sm:w-56",children:t.jsx(Ee,{placeholder:"Add team…"})}),t.jsx(je,{children:p.map(_=>t.jsx(de,{value:_.id,children:_.name},_.id))})]}),t.jsxs(K,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:!y||f.isPending,onClick:()=>f.mutate(y,{onSuccess:()=>{R.success("Team access granted"),S("")},onError:()=>R.error("Failed to add team")}),children:[t.jsx(xs,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),A===0?t.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No teams have access."}):t.jsx("div",{className:"divide-y divide-border",children:o==null?void 0:o.teams.map(_=>t.jsx($0,{teamEntry:_,onRemove:I=>m.mutate(I,{onSuccess:()=>R.success("Team access removed"),onError:()=>R.error("Failed to remove team")})},_.id))})]}),C===0&&A===0&&E.length===0&&p.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center border-t border-border",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xs,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No access entries yet"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add workspace people or teams first to grant project access."})]})]})]}),t.jsx(ic,{open:!!b,onOpenChange:_=>{_||N(null)},children:t.jsxs(eo,{className:"sm:max-w-md",children:[t.jsxs(to,{children:[t.jsx(no,{children:"Remove member access?"}),t.jsx(ro,{children:b?`${b.displayName} will lose access to this project.`:"This member will lose access to this project."})]}),t.jsxs(so,{children:[t.jsx(oo,{disabled:u.isPending,children:"Cancel"}),t.jsx(ao,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:_=>{_.preventDefault(),D()},disabled:u.isPending,children:u.isPending?"Removing...":"Remove"})]})]})})]})}function Go(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function Mt({label:e,children:s}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),t.jsx("div",{className:"flex-1 min-w-0",children:s})]})}const I0={backlog:t.jsx(Nt,{className:"h-3 w-3 text-zinc-400"}),todo:t.jsx(Nt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:t.jsx(Qt,{className:"h-3 w-3 text-indigo-500"}),in_review:t.jsx(_n,{className:"h-3 w-3 text-amber-500"}),done:t.jsx(js,{className:"h-3 w-3 text-emerald-500"}),cancelled:t.jsx(il,{className:"h-3 w-3 text-zinc-400"})},F0={urgent:t.jsx(Xs,{className:"h-3 w-3 text-red-500"}),high:t.jsx(ir,{className:"h-3 w-3 text-orange-500"}),medium:t.jsx(En,{className:"h-3 w-3 text-yellow-500"}),low:t.jsx(or,{className:"h-3 w-3 text-blue-400"})},z0={bug:t.jsx(rl,{className:"h-3 w-3 text-red-500"}),feature:t.jsx(pl,{className:"h-3 w-3 text-purple-500"}),task:t.jsx(gl,{className:"h-3 w-3 text-blue-500"}),chore:t.jsx(fa,{className:"h-3 w-3 text-zinc-500"})};function Vr({value:e,onValueChange:s,options:n,icons:r,placeholder:a}){return t.jsxs(we,{value:e,onValueChange:s,children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5",children:[r[e]??t.jsx(ol,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{children:n[e]??a??""})]})}),t.jsx(je,{children:Object.entries(n).map(([o,i])=>t.jsx(de,{value:o,className:"text-xs",children:t.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function W0(){const{workspace:e,projectKey:s,issueId:n}=Ge(),r=Ue(),[a,o]=x.useState(!1),[i,l]=x.useState(""),[d,c]=x.useState(""),[u,f]=x.useState(!1),{data:m}=ws(s??""),h=(m==null?void 0:m.id)??"",{data:g,isLoading:y}=el(n??""),S=ar(n??"",h),{data:b}=sn(h||void 0),{data:N}=nn(h||void 0),{data:w}=Wn(h||void 0),{data:j}=Cn(h||void 0),E=(N??[]).filter(T=>T.status!=="completed"),p=g!=null&&g.parent_id?j==null?void 0:j.find(T=>T.id===g.parent_id):null,C=(j==null?void 0:j.filter(T=>T.parent_id===n))??[],A=g!=null&&g.task_list_id?w==null?void 0:w.find(T=>T.id===g.task_list_id):null,D=b&&b.length>0?Object.fromEntries(b.map(T=>[T.key,T.name])):bs,_=b&&b.length>0?Object.fromEntries(b.map(T=>[T.key,T.category==="completed"?t.jsx(js,{className:"h-3 w-3",style:{color:T.color}}):T.category==="started"?t.jsx(Qt,{className:"h-3 w-3",style:{color:T.color}}):t.jsx(Nt,{className:"h-3 w-3",style:{color:T.color}})])):I0;if(x.useEffect(()=>{g&&(l(g.title),c(g.description??"")),o(!1)},[g==null?void 0:g.id]),!s||!n)return null;const I=()=>{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")})},$=()=>{g&&(l(g.title),c(g.description??"")),o(!1)},F=(T,X)=>{S.mutate(T,{onSuccess:()=>R.success(`${X} updated`),onError:()=>R.error(`Failed to update ${X.toLowerCase()}`)})};return y||!g?t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.jsx("div",{className:"sticky top-0 z-10 h-[57px] bg-white dark:bg-card border-b border-border"}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 space-y-4 shadow-sm",children:[t.jsx(te,{className:"h-7 w-3/4"}),t.jsx(te,{className:"h-32 w-full"})]}),t.jsx(te,{className:"h-24 w-full rounded-xl"}),t.jsx(te,{className:"h-48 w-full rounded-xl"})]}),t.jsx(te,{className:"h-[280px] w-full rounded-xl"})]})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.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:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>r(`/${e}/projects/${s}/issues`),children:[t.jsx(xa,{className:"h-3.5 w-3.5"}),(m==null?void 0:m.name)??"Issues"]}),t.jsx("span",{className:"text-border",children:"/"}),t.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:g.identifier}),t.jsx(Ln,{variant:"muted",className:"text-[10px] ml-1",children:Kt[g.type]??g.type})]}),t.jsx("div",{className:"flex items-center gap-2",children:a?t.jsxs(t.Fragment,{children:[t.jsx(K,{variant:"ghost",size:"sm",onClick:$,children:"Discard"}),t.jsx(K,{size:"sm",onClick:I,disabled:!i.trim()||S.isPending,className:"px-4",children:S.isPending?"Saving…":"Save changes"})]}):t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>o(!0),children:[t.jsx(dr,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsx(tt,{zone:"issue.details.before",props:{issue:g}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsx("div",{className:"px-6 pt-6 pb-3",children:a?t.jsx("input",{autoFocus:!0,value:i,onChange:T=>l(T.target.value),onKeyDown:T=>{T.key==="Enter"&&T.preventDefault()},className:O("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")}):t.jsx("h1",{className:"text-xl font-semibold text-foreground leading-snug",children:g.title})}),t.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:t.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),a?t.jsx(Ja,{content:d,onChange:c,placeholder:"Add a description…",className:"border-t border-border/50 min-h-[280px]"}):g.description?t.jsx("div",{className:"border-t border-border/50",children:t.jsx(Za,{html:g.description,className:"px-5 py-4"})}):t.jsx("div",{className:"border-t border-border/50 px-6 py-4",children:t.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})})]}),!g.parent_id&&t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Child Issues"}),t.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Add child issue"]})]}),C.length===0?t.jsx("div",{className:"px-5 py-4 text-xs text-muted-foreground/50 italic",children:"No child issues yet"}):t.jsx("div",{className:"px-5 py-2 divide-y divide-border/40",children:C.map(T=>t.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs",children:[t.jsx(cl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("button",{onClick:()=>r(`/${e}/projects/${s}/issues/${T.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:T.identifier}),t.jsx("button",{onClick:()=>r(`/${e}/projects/${s}/issues/${T.id}`),className:"text-foreground hover:text-foreground/70 truncate text-left transition-colors",children:T.title})]},T.id))})]}),t.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:t.jsx(Fd,{issueId:n})}),t.jsx(tt,{zone:"issue.details.after",props:{issue:g}})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(tt,{zone:"issue.details.sidebar",props:{issue:g}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),t.jsxs("div",{className:"px-4 py-1",children:[t.jsx(Mt,{label:"Status",children:t.jsx(Vr,{value:g.status,onValueChange:T=>F({status:T},"Status"),options:D,icons:_})}),t.jsx(Mt,{label:"Priority",children:t.jsx(Vr,{value:g.priority,onValueChange:T=>F({priority:T},"Priority"),options:Ot,icons:F0})}),t.jsx(Mt,{label:"Type",children:t.jsx(Vr,{value:g.type,onValueChange:T=>F({type:T},"Type"),options:Kt,icons:z0})}),t.jsx(Mt,{label:"Assignees",children:t.jsx(qn,{value:g.assignee_ids??[],onChange:T=>F({assignee_ids:T},"Assignees"),disabled:S.isPending})}),t.jsx(Mt,{label:"Sprint",children:t.jsxs(we,{value:g.sprint_id??"none",onValueChange:T=>F({sprint_id:T==="none"?null:T},"Sprint"),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),g.sprint_id?(()=>{const T=E.find(q=>q.id===g.sprint_id)??(N==null?void 0:N.find(q=>q.id===g.sprint_id));if(!T)return t.jsxs("span",{className:"truncate",children:[g.sprint_id.slice(0,8),"…"]});const X=Go(T);return t.jsxs("span",{className:"truncate",children:[T.name,X&&t.jsxs("span",{className:"text-muted-foreground ml-1",children:["· ",X]})]})})():t.jsx("span",{className:"text-muted-foreground",children:"No sprint"})]})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),E.map(T=>{const X=Go(T);return t.jsx(de,{value:T.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:T.name}),X&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:X})]})},T.id)})]})]})}),(w??[]).length>0&&t.jsx(Mt,{label:"List",children:t.jsxs(we,{value:g.task_list_id??"none",onValueChange:T=>F({task_list_id:T==="none"?null:T},"List"),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(ya,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:A?"truncate":"text-muted-foreground",children:(A==null?void 0:A.name)??"No list"})]})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(w??[]).map(T=>t.jsx(de,{value:T.id,className:"text-xs",children:T.name},T.id))]})]})}),t.jsx(Mt,{label:"Start Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(He,{className:"w-auto p-0",align:"start",children:[t.jsx(it,{mode:"single",selected:g.start_date?new Date(g.start_date):void 0,onSelect:T=>F({start_date:T?oe(T,"yyyy-MM-dd"):null},"Start date"),initialFocus:!0}),g.start_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>F({start_date:null},"Start date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),t.jsx(Mt,{label:"Due Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(He,{className:"w-auto p-0",align:"start",children:[t.jsx(it,{mode:"single",selected:g.due_date?new Date(g.due_date):void 0,onSelect:T=>F({due_date:T?oe(T,"yyyy-MM-dd"):null},"Due date"),initialFocus:!0}),g.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>F({due_date:null},"Due date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),p&&t.jsx(Mt,{label:"Parent",children:t.jsxs("button",{onClick:()=>r(`/${e}/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:[t.jsx(pa,{className:"h-3 w-3 text-muted-foreground shrink-0"}),t.jsx("span",{className:"font-mono text-muted-foreground shrink-0",children:p.identifier}),t.jsx("span",{className:"text-foreground truncate",children:p.title})]})})]})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Details"})}),t.jsxs("div",{className:"px-4 pt-3 pb-4 space-y-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:"text-muted-foreground",children:"Created"}),t.jsx("span",{className:"text-foreground",children:oe(new Date(g.created_at),"MMM d, yyyy")})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:"text-muted-foreground",children:"Updated"}),t.jsx("span",{className:"text-foreground",children:oe(new Date(g.updated_at),"MMM d, yyyy")})]})]})]})]})]})})]}),t.jsx(wr,{open:u,onClose:()=>f(!1),projectId:h,defaultParentId:n,defaultTaskListId:g.task_list_id})]})}function Yt({label:e,children:s}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),t.jsx("div",{className:"flex-1 min-w-0",children:s})]})}const q0={backlog:t.jsx(Nt,{className:"h-3 w-3 text-zinc-400"}),todo:t.jsx(Nt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:t.jsx(Qt,{className:"h-3 w-3 text-indigo-500"}),in_review:t.jsx(_n,{className:"h-3 w-3 text-amber-500"}),done:t.jsx(js,{className:"h-3 w-3 text-emerald-500"}),cancelled:t.jsx(il,{className:"h-3 w-3 text-zinc-400"})},B0={urgent:t.jsx(Xs,{className:"h-3 w-3 text-red-500"}),high:t.jsx(ir,{className:"h-3 w-3 text-orange-500"}),medium:t.jsx(En,{className:"h-3 w-3 text-yellow-500"}),low:t.jsx(or,{className:"h-3 w-3 text-blue-400"})},Y0={bug:t.jsx(rl,{className:"h-3 w-3 text-red-500"}),feature:t.jsx(pl,{className:"h-3 w-3 text-purple-500"}),task:t.jsx(gl,{className:"h-3 w-3 text-blue-500"}),chore:t.jsx(fa,{className:"h-3 w-3 text-zinc-500"})};function Gr({value:e,onValueChange:s,options:n,icons:r,placeholder:a}){return t.jsxs(we,{value:e,onValueChange:s,children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5",children:[r[e]??t.jsx(ol,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{children:n[e]??a??""})]})}),t.jsx(je,{children:Object.entries(n).map(([o,i])=>t.jsx(de,{value:o,className:"text-xs",children:t.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function L0(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function H0(){const{workspace:e,projectKey:s}=Ge(),n=Ue(),{workspace:r}=ke(),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState("backlog"),[u,f]=x.useState("medium"),[m,h]=x.useState("task"),[g,y]=x.useState([]),[S,b]=x.useState(""),[N,w]=x.useState(""),[j,E]=x.useState(void 0),[p,C]=x.useState(void 0),{data:A}=ws(s??""),D=(A==null?void 0:A.id)??"",_=tl(),{data:I}=sn(D||void 0),{data:$}=nn(D||void 0),{data:F}=Wn(D||void 0),T=($??[]).filter(W=>W.status!=="completed"),X=I&&I.length>0?Object.fromEntries(I.map(W=>[W.key,W.name])):bs,q=I&&I.length>0?Object.fromEntries(I.map(W=>[W.key,W.category==="completed"?t.jsx(js,{className:"h-3 w-3",style:{color:W.color}}):W.category==="started"?t.jsx(Qt,{className:"h-3 w-3",style:{color:W.color}}):t.jsx(Nt,{className:"h-3 w-3",style:{color:W.color}})])):q0;if(!s||!D)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:m,project_id:D,workspace_id:r.id,assignee_ids:g.length>0?g:void 0,sprint_id:S||null,task_list_id:N||null,start_date:j?oe(j,"yyyy-MM-dd"):null,due_date:p?oe(p,"yyyy-MM-dd"):null},{onSuccess:W=>{R.success("Issue created"),n(`/${e}/projects/${s}/issues/${W.issue.id}`,{replace:!0})},onError:W=>R.error(W.message??"Failed to create issue")})};return t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.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:[t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>n(`/${e}/projects/${s}/issues`),children:[t.jsx(xa,{className:"h-3.5 w-3.5"}),(A==null?void 0:A.name)??"Issues"]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(K,{variant:"ghost",size:"sm",onClick:()=>n(`/${e}/projects/${s}/issues`),children:"Discard"}),t.jsx(K,{size:"sm",onClick:V,disabled:!a.trim()||_.isPending,className:"px-4",children:_.isPending?"Creating…":"Create issue"})]})]}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsx("div",{className:"px-6 pt-6 pb-3",children:t.jsx("input",{autoFocus:!0,value:a,onChange:W=>o(W.target.value),onKeyDown:W=>{W.key==="Enter"&&W.preventDefault()},placeholder:"Issue title…",className:O("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")})}),t.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:t.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),t.jsx(Ja,{content:"",onChange:l,placeholder:"Add steps to reproduce, acceptance criteria, or context…",className:"border-t border-border/50 min-h-[320px]"})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),t.jsxs("div",{className:"px-4 py-1",children:[t.jsx(Yt,{label:"Status",children:t.jsx(Gr,{value:d,onValueChange:c,options:X,icons:q})}),t.jsx(Yt,{label:"Priority",children:t.jsx(Gr,{value:u,onValueChange:f,options:Ot,icons:B0})}),t.jsx(Yt,{label:"Type",children:t.jsx(Gr,{value:m,onValueChange:h,options:Kt,icons:Y0})}),t.jsx(Yt,{label:"Assignees",children:t.jsx(qn,{value:g,onChange:y})}),T.length>0&&t.jsx(Yt,{label:"Sprint",children:t.jsxs(we,{value:S||"none",onValueChange:W=>b(W==="none"?"":W),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No sprint"})]})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),T.map(W=>{const z=L0(W);return t.jsx(de,{value:W.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:W.name}),z&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:z})]})},W.id)})]})]})}),(F??[]).length>0&&t.jsx(Yt,{label:"List",children:t.jsxs(we,{value:N||"none",onValueChange:W=>w(W==="none"?"":W),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(ya,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No list"})]})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(F??[]).map(W=>t.jsx(de,{value:W.id,className:"text-xs",children:W.name},W.id))]})]})}),t.jsx(Yt,{label:"Start Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:j?"text-foreground":"text-muted-foreground",children:j?oe(j,"MMM d, yyyy"):"No start date"}),j&&t.jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),E(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3 w-3"})})]})}),t.jsx(He,{className:"w-auto p-0",align:"start",children:t.jsx(it,{mode:"single",selected:j,onSelect:E,initialFocus:!0})})]})}),t.jsx(Yt,{label:"Due Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:p?"text-foreground":"text-muted-foreground",children:p?oe(p,"MMM d, yyyy"):"No due date"}),p&&t.jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),C(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3 w-3"})})]})}),t.jsx(He,{className:"w-auto p-0",align:"start",children:t.jsx(it,{mode:"single",selected:p,onSelect:C,initialFocus:!0})})]})})]}),t.jsx("div",{className:"px-4 pt-2 pb-3 mt-1 border-t border-border/60",children:t.jsxs("p",{className:"text-[11px] text-muted-foreground/50 leading-relaxed",children:["Press ",t.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})})]})]})})]})}const U0={issue:{icon:Qs,label:"Issue"},project:{icon:xt,label:"Project"},comment:{icon:Wm,label:"Comment"},sprint:{icon:Xs,label:"Sprint"}};function K0(e){const s=new Date(e);return Qp(s)?Bp(s,{addSuffix:!0}):Jp(s)?`Yesterday ${oe(s,"h:mm a")}`:oe(s,"MMM d, yyyy")}function V0(){const{workspace:e}=Ge(),s=Ue(),{data:n,isLoading:r}=ah(),{data:a=[]}=Tn(),o=ih(),i=lh(),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 f;if(u.entity_type==="issue"&&((f=u.metadata)!=null&&f.project_id)){const m=d[u.metadata.project_id];if(m)return`/${e}/projects/${m.identifier}/issues/${u.entity_id}`}if(u.entity_type==="project"){const m=d[u.entity_id];if(m)return`/${e}/projects/${m.identifier}/board`}return null}return t.jsx("div",{className:"p-2",children:t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("h1",{className:"text-base font-semibold",children:"Notifications"}),l>0&&t.jsxs(K,{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:[t.jsx(km,{className:"h-3.5 w-3.5"}),"Mark all read"]})]}),t.jsxs("div",{className:"grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-2.5 border-b border-border",children:[t.jsx("span",{}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Type"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Message"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Time"}),t.jsx("span",{})]}),r?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(u=>t.jsxs("div",{className:"grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-3",children:[t.jsx("div",{}),t.jsx(te,{className:"h-5 w-20 rounded-full"}),t.jsx(te,{className:"h-4 w-3/4"}),t.jsx(te,{className:"h-4 w-20"}),t.jsx("div",{})]},u))}):n!=null&&n.length?t.jsx("div",{className:"divide-y divide-border",children:n.map(u=>{const f=U0[u.entity_type]??{icon:qs,label:u.entity_type},m=f.icon,h=c(u);return t.jsxs("div",{className:O("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:[t.jsx("div",{className:"flex items-center justify-center",children:!u.read&&t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-indigo-500 shrink-0"})}),t.jsx("div",{children:t.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:[t.jsx(m,{className:"h-3 w-3"}),f.label]})}),t.jsx("p",{className:O("text-sm truncate",u.read?"text-muted-foreground":"font-medium text-foreground"),children:u.message}),t.jsx("span",{className:"text-xs text-muted-foreground",children:K0(u.created_at)}),t.jsx("div",{className:"flex justify-end",onClick:g=>g.stopPropagation(),children:!u.read&&t.jsx(K,{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)})}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(qs,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No notifications"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"You're all caught up."})]}),!r&&!!(n!=null&&n.length)&&t.jsx("div",{className:"px-6 py-3 border-t border-border",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.length," notification",n.length!==1?"s":"",l>0?` · ${l} unread`:""]})})]})})}function G0({open:e,onClose:s,projectId:n}){const[r,a]=x.useState(""),[o,i]=x.useState(""),[l,d]=x.useState(),[c,u]=x.useState(),[f,m]=x.useState(!1),[h,g]=x.useState(!1),y=fg(n);function S(){a(""),i(""),d(void 0),u(void 0),s()}async function b(N){N.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 t.jsx(Ss,{open:e,onOpenChange:N=>!N&&S(),children:t.jsxs(Cs,{className:"sm:max-w-md",children:[t.jsx(Js,{children:t.jsx(en,{children:"New Sprint"})}),t.jsxs("form",{onSubmit:b,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(Zs,{className:"space-y-4 py-1",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"sprint-name",children:["Name ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(xe,{id:"sprint-name",placeholder:"e.g. Sprint 1",value:r,onChange:N=>a(N.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"sprint-goal",children:["Goal ",t.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),t.jsx(br,{id:"sprint-goal",placeholder:"What do you want to achieve in this sprint?",value:o,onChange:N=>i(N.target.value),className:"resize-none text-sm",rows:2})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Start Date"}),t.jsxs(Ke,{open:f,onOpenChange:m,children:[t.jsx(Ve,{asChild:!0,children:t.jsxs(K,{variant:"outline",className:O("w-full justify-start text-left font-normal text-sm h-9",!l&&"text-muted-foreground"),children:[t.jsx(ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),l?oe(l,"MMM d, yyyy"):"Pick date"]})}),t.jsx(He,{className:"w-auto p-0",align:"start",children:t.jsx(it,{mode:"single",selected:l,onSelect:N=>{d(N),m(!1)},disabled:N=>c?N>c:!1,initialFocus:!0})})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"End Date"}),t.jsxs(Ke,{open:h,onOpenChange:g,children:[t.jsx(Ve,{asChild:!0,children:t.jsxs(K,{variant:"outline",className:O("w-full justify-start text-left font-normal text-sm h-9",!c&&"text-muted-foreground"),children:[t.jsx(ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),c?oe(c,"MMM d, yyyy"):"Pick date"]})}),t.jsx(He,{className:"w-auto p-0",align:"start",children:t.jsx(it,{mode:"single",selected:c,onSelect:N=>{u(N),g(!1)},disabled:N=>l?N<l:!1,initialFocus:!0})})]})]})]})]}),t.jsxs(Fn,{children:[t.jsx(K,{type:"button",variant:"ghost",onClick:S,children:"Cancel"}),t.jsx(K,{type:"submit",disabled:!r.trim()||y.isPending,children:y.isPending?"Creating…":"Create Sprint"})]})]})]})})}const Q0={active:{label:"Active",icon:cr,badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",section:"Active Sprint"},planned:{label:"Planned",icon:Qt,badge:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",section:"Planned"},completed:{label:"Completed",icon:js,badge:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",section:"Completed"}};function X0({sprint:e,projectId:s,issueCount:n}){const r=hg(e.id,s),a=xg(s),o=Q0[e.status],i=o.icon;function l(){r.mutate({status:"active"},{onSuccess:()=>R.success(`"${e.name}" started`),onError:()=>R.error("Failed to start sprint")})}function d(){r.mutate({status:"completed"},{onSuccess:()=>R.success(`"${e.name}" completed`),onError:m=>R.error((m==null?void 0:m.message)??"Failed to complete sprint")})}function c(){confirm(`Delete sprint "${e.name}"? This cannot be undone.`)&&a.mutate(e.id,{onSuccess:()=>R.success("Sprint deleted"),onError:()=>R.error("Failed to delete sprint")})}const u=!!e.start_date,f=!!e.end_date;return t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:O("flex h-7 w-7 items-center justify-center rounded-full shrink-0",e.status==="active"?"bg-emerald-100 dark:bg-emerald-900/30":e.status==="completed"?"bg-blue-100 dark:bg-blue-900/30":"bg-zinc-100 dark:bg-zinc-800"),children:t.jsx(i,{className:O("h-3.5 w-3.5",e.status==="active"?"text-emerald-600 dark:text-emerald-400":e.status==="completed"?"text-blue-600 dark:text-blue-400":"text-zinc-500")})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e.name}),e.goal&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5 flex items-center gap-1",children:[t.jsx(Gm,{className:"h-3 w-3 shrink-0"}),e.goal]})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 w-52",children:[t.jsx(ha,{className:"h-3.5 w-3.5 shrink-0"}),u||f?t.jsxs("span",{children:[u?oe(new Date(e.start_date),"MMM d"):"—"," → ",f?oe(new Date(e.end_date),"MMM d, yyyy"):"—"]}):t.jsx("span",{className:"italic",children:"No dates set"})]}),t.jsxs("div",{className:"text-xs text-muted-foreground shrink-0 w-20 text-right",children:[n," issue",n!==1?"s":""]}),t.jsx(Ln,{className:O("shrink-0 text-[11px] border-0 w-20 justify-center",o.badge),children:o.label}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.status==="planned"&&t.jsxs(K,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:l,disabled:r.isPending,children:[t.jsx(cr,{className:"h-3 w-3"}),"Start"]}),e.status==="active"&&t.jsxs(K,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:d,disabled:r.isPending,children:[t.jsx(js,{className:"h-3 w-3"}),"Complete"]}),t.jsx(K,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:c,disabled:a.isPending,children:t.jsx(Tt,{className:"h-3.5 w-3.5"})})]})]})}function J0(){const{projectKey:e}=Ge(),[s,n]=x.useState(!1),{data:r}=ws(e??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=nn(a||void 0),{data:l}=Cn(a||void 0),d=(l??[]).reduce((f,m)=>(m.sprint_id&&(f[m.sprint_id]=(f[m.sprint_id]??0)+1),f),{}),c={active:(o??[]).filter(f=>f.status==="active"),planned:(o??[]).filter(f=>f.status==="planned"),completed:(o??[]).filter(f=>f.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 t.jsxs("div",{className:"p-2",children:[t.jsx(tt,{zone:"project.sprints.before",props:{projectId:a}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:t.jsxs(K,{size:"sm",onClick:()=>n(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"New Sprint"]})}),i?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(f=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(te,{className:"h-7 w-7 rounded-full"}),t.jsx(te,{className:"h-4 w-40"}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{className:"h-4 w-32"}),t.jsx(te,{className:"h-5 w-20"})]},f))}):(o??[]).length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(ha,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No sprints yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a sprint to start planning your work in time-boxed iterations."}),t.jsxs(K,{size:"sm",onClick:()=>n(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"New Sprint"]})]}):t.jsx("div",{children:u.map(({key:f,label:m,items:h})=>h.length===0?null:t.jsxs("div",{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:m})}),t.jsx("div",{className:"divide-y divide-border",children:h.map(g=>t.jsx(X0,{sprint:g,projectId:a,issueCount:d[g.id]??0},g.id))})]},f))})]}),t.jsx(tt,{zone:"project.sprints.after",props:{projectId:a}}),t.jsx(G0,{open:s,onClose:()=>n(!1),projectId:a})]})}const Ls={all:["roles"],list:()=>[...Ls.all,"list"],detail:e=>[...Ls.all,e]};function io(){return Ne({queryKey:Ls.list(),queryFn:()=>J.get("/admin/roles"),select:e=>e.roles,staleTime:1e3*60*2})}function Z0(){const e=me();return ce({mutationFn:s=>J.post("/admin/roles",s),onSuccess:()=>{e.invalidateQueries({queryKey:Ls.list()})}})}function ey(e){const s=me();return ce({mutationFn:n=>J.put(`/admin/roles/${e}`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ls.list()})}})}function ty(){const e=me();return ce({mutationFn:s=>J.delete(`/admin/roles/${s}`),onSuccess:()=>{e.invalidateQueries({queryKey:Ls.list()})}})}function sy(){const e=me();return ce({mutationFn:({userId:s,appRoleId:n})=>J.patch(`/admin/users/${s}/role`,{app_role_id:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}const sr=[{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 lo({value:e,className:s}){const[n,r]=x.useState(!1),a=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)};return t.jsx("button",{onClick:a,className:O("text-muted-foreground hover:text-foreground transition-colors",s),title:"Copy",children:n?t.jsx(mt,{className:"h-3.5 w-3.5 text-emerald-500"}):t.jsx(Cm,{className:"h-3.5 w-3.5"})})}function ny({open:e,onClose:s,workspaceId:n}){var g;const[r,a]=x.useState(""),[o,i]=x.useState("__admin"),[l,d]=x.useState(null),c=df(n),{data:u}=io();x.useEffect(()=>{e&&(a(""),d(null),i(u&&u.length>0?u[0].id:"__admin"))},[e,u]);const f=l?`${window.location.origin}/invite/${l.token}`:null,m=o==="__admin"?"Admin":((g=u==null?void 0:u.find(y=>y.id===o))==null?void 0:g.name)??"Member",h=y=>{y.preventDefault();const S=o==="__admin";c.mutate({email:r.trim()||void 0,role:S?"admin":"member",app_role_id:S?null:o},{onSuccess:b=>{d(b.invitation),R.success("Invitation created")},onError:b=>R.error(b.message||"Failed to create invitation")})};return t.jsx(xr,{open:e,onOpenChange:y=>!y&&s(),children:t.jsxs(Rn,{className:"sm:max-w-[520px]",children:[t.jsx(pr,{children:t.jsx(gr,{children:"Invite member"})}),f?t.jsxs("div",{className:"space-y-4 pt-1",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Share this link with"," ",l!=null&&l.email?t.jsx("span",{className:"font-medium text-foreground",children:l.email}):"anyone you want to invite",". They will join as"," ",t.jsx("span",{className:"font-medium text-foreground",children:m}),"."]}),t.jsxs("div",{className:"flex items-start gap-2 p-3 bg-muted/50 rounded-lg border border-border",children:[t.jsx(va,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5"}),t.jsx("span",{className:"text-xs font-mono text-foreground flex-1 min-w-0 break-all",children:f}),t.jsx(lo,{value:f,className:"shrink-0"})]}),t.jsxs("div",{className:"flex items-center justify-between pt-1",children:[t.jsx("button",{className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>d(null),children:"Create another"}),t.jsx(K,{size:"sm",onClick:s,children:"Done"})]})]}):t.jsxs("form",{onSubmit:h,className:"space-y-4 pt-1",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Email ",t.jsx("span",{className:"font-normal",children:"(optional)"})]}),t.jsx(xe,{type:"email",placeholder:"colleague@example.com",value:r,onChange:y=>a(y.target.value),className:"h-9",autoFocus:!0}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Leave blank to generate a shareable link."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),t.jsxs(we,{value:o,onValueChange:i,children:[t.jsx(ve,{className:"h-9",children:t.jsx(Ee,{})}),t.jsxs(je,{children:[t.jsx(de,{value:"__admin",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(Na,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{children:"Admin"}),t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"— Full workspace access"})]})}),u&&u.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-2 pt-2 pb-1",children:t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Roles"})}),u.map(y=>t.jsx(de,{value:y.id,children:y.name},y.id))]})]})]})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),t.jsx(K,{type:"submit",size:"sm",disabled:c.isPending,children:c.isPending?"Creating…":"Create invitation"})]})]})]})})}function ry({invitation:e,workspaceId:s}){const n=cf(s),r=`${window.location.origin}/invite/${e.token}`;return t.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:[t.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(va,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e.email??"Shareable link"}),t.jsx("span",{className:O("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",e.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:e.role==="admin"?"Admin":"Member"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[280px]",children:r}),t.jsx(lo,{value:r})]})]}),t.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground hidden sm:block",children:oe(new Date(e.created_at),"MMM d")}),t.jsx("button",{onClick:()=>n.mutate(e.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:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})]})}function ay({workspaceId:e}){const{workspace:s,setWorkspace:n}=ke(),{data:r,isLoading:a}=mr(),o=r==null?void 0:r.find(f=>f.id===(s==null?void 0:s.id)),i=of(e),[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:f=>{n({id:f.workspace.id,name:f.workspace.name,slug:f.workspace.slug}),R.success("Workspace updated")},onError:()=>R.error("Failed to update workspace")})};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Workspace details"})}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Name"}),a?t.jsx(te,{className:"h-8 w-64"}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(xe,{value:l,onChange:f=>d(f.target.value),className:"h-8 w-64 text-sm bg-transparent",placeholder:"Workspace name"}),c&&t.jsx(K,{size:"sm",className:"h-8",onClick:u,disabled:!l.trim()||i.isPending,children:i.isPending?"Saving…":"Save"})]})]}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"URL slug"}),a?t.jsx(te,{className:"h-4 w-40"}):t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"font-mono text-foreground",children:o==null?void 0:o.slug}),t.jsx(lo,{value:(o==null?void 0:o.slug)??""})]})]}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Plan"}),a?t.jsx(te,{className:"h-4 w-16"}):t.jsx("span",{className:"text-sm capitalize",children:(o==null?void 0:o.plan)??"free"})]}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Created"}),a?t.jsx(te,{className:"h-4 w-28"}):t.jsx("span",{className:"text-sm text-muted-foreground",children:o!=null&&o.created_at?oe(new Date(o.created_at),"MMMM d, yyyy"):"—"})]})]})}function oy({workspaceId:e,onInvite:s}){const{data:n,isLoading:r}=fr(e),{data:a,isLoading:o}=lf(e),i=uf(e),l=mf(e),d=sy(),{data:c}=io(),{user:u}=ke(),f=(a==null?void 0:a.filter(m=>m.status==="pending"))??[];return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:t.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Members",!r&&n&&t.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",n.length]})]})}),r?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(m=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3.5 w-32"}),t.jsx(te,{className:"h-3 w-48"})]})]},m))}):n!=null&&n.length?t.jsx("div",{className:"divide-y divide-border",children:n.map(m=>{var w;const h=m.user,g=(h==null?void 0:h.first_name)??"",y=(h==null?void 0:h.last_name)??"",S=`${g} ${y}`.trim()||(h==null?void 0:h.email)||"Unknown",b=(g[0]??y[0]??((w=h==null?void 0:h.email)==null?void 0:w[0])??"U").toUpperCase(),N=(h==null?void 0:h.id)===(u==null?void 0:u.id);return t.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:[t.jsx(at,{className:"h-7 w-7 shrink-0",children:t.jsx(ot,{className:"text-[11px] font-medium",children:b})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:S}),N&&t.jsx("span",{className:"text-[11px] text-muted-foreground",children:"(you)"})]}),(h==null?void 0:h.email)&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h.email})]}),t.jsx("span",{className:O("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",m.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:m.role==="admin"?"Admin":"Member"}),c&&c.length>0&&t.jsxs(we,{value:m.app_role_id??"none",onValueChange:j=>d.mutate({userId:m.user_id,appRoleId:j==="none"?null:j},{onSuccess:()=>R.success("Custom role updated"),onError:()=>R.error("Failed to update custom role")}),children:[t.jsx(ve,{className:"h-7 text-[11px] w-32 shrink-0",children:t.jsx(Ee,{placeholder:"Custom role"})}),t.jsxs(je,{children:[t.jsx(de,{value:"none",children:t.jsx("span",{className:"text-muted-foreground",children:"No custom role"})}),c.map(j=>t.jsx(de,{value:j.id,children:j.name},j.id))]})]}),!N&&t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:t.jsx(Dn,{className:"h-4 w-4"})})}),t.jsxs(Xt,{align:"end",className:"w-40",children:[t.jsx(Je,{onClick:()=>i.mutate({userId:m.user_id,role:m.role==="admin"?"member":"admin"},{onSuccess:()=>R.success("Role updated"),onError:()=>R.error("Failed to update role")}),children:m.role==="admin"?t.jsxs(t.Fragment,{children:[t.jsx(yl,{className:"h-3.5 w-3.5 mr-2"}),"Make member"]}):t.jsxs(t.Fragment,{children:[t.jsx(Na,{className:"h-3.5 w-3.5 mr-2"}),"Make admin"]})}),t.jsx(Pn,{}),t.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>l.mutate(m.user_id,{onSuccess:()=>R.success("Member removed"),onError:()=>R.error("Failed to remove member")}),children:[t.jsx(Tt,{className:"h-3.5 w-3.5 mr-2"}),"Remove"]})]})]})]},m.id)})}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(sf,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No members yet"}),t.jsx("button",{onClick:s,className:"text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}),t.jsxs("div",{className:"px-6 py-2 border-t border-b border-border bg-muted/20 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Pending invitations",!o&&f.length>0&&t.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",f.length]})]}),t.jsxs("button",{onClick:s,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3 w-3"}),"Invite"]})]}),o?t.jsx("div",{className:"divide-y divide-border",children:[1,2].map(m=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3.5 w-48"}),t.jsx(te,{className:"h-3 w-64"})]})]},m))}):f.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:"No pending invitations."}),t.jsx("button",{onClick:s,className:"mt-2 text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}):t.jsx("div",{className:"divide-y divide-border",children:f.map(m=>t.jsx(ry,{invitation:m,workspaceId:e},m.id))})]})}function iy({workspaceId:e,teamId:s,allMembers:n}){const{data:r,isLoading:a}=xf(e,s),o=pf(e,s),i=gf(e,s),[l,d]=x.useState(""),c=new Set((r==null?void 0:r.map(f=>f.user_id))??[]),u=n.filter(f=>!c.has(f.user_id));return t.jsxs("div",{className:"bg-muted/10 border-t border-border",children:[a?t.jsx("div",{className:"px-8 py-3",children:t.jsx(te,{className:"h-3 w-40"})}):(r==null?void 0:r.length)===0?t.jsx("p",{className:"px-8 py-3 text-xs text-muted-foreground",children:"No members in this team yet."}):t.jsx("div",{className:"divide-y divide-border/50",children:r==null?void 0:r.map(f=>{var b;const m=f.user,h=(m==null?void 0:m.first_name)??"",g=(m==null?void 0:m.last_name)??"",y=`${h} ${g}`.trim()||(m==null?void 0:m.email)||"Unknown",S=(h[0]??g[0]??((b=m==null?void 0:m.email)==null?void 0:b[0])??"U").toUpperCase();return t.jsxs("div",{className:"flex items-center gap-3 px-8 py-2.5 group hover:bg-muted/20 transition-colors",children:[t.jsx(at,{className:"h-6 w-6 shrink-0",children:t.jsx(ot,{className:"text-[10px] font-medium",children:S})}),t.jsx("span",{className:"flex-1 text-sm truncate",children:y}),t.jsx("button",{onClick:()=>i.mutate(f.user_id,{onSuccess:()=>R.success("Removed from team"),onError:()=>R.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Remove from team",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]},f.id)})}),u.length>0&&t.jsxs("div",{className:"px-8 py-2.5 flex items-center gap-2 border-t border-border/50",children:[t.jsx(On,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs(we,{value:l,onValueChange:d,children:[t.jsx(ve,{className:"h-7 text-xs flex-1 max-w-[200px]",children:t.jsx(Ee,{placeholder:"Add member…"})}),t.jsx(je,{children:u.map(f=>{const m=f.user,h=(m==null?void 0:m.first_name)??"",g=(m==null?void 0:m.last_name)??"",y=`${h} ${g}`.trim()||(m==null?void 0:m.email)||"Unknown";return t.jsx(de,{value:f.user_id,children:y},f.user_id)})})]}),l&&t.jsx(K,{size:"sm",className:"h-7 text-xs px-2",disabled:o.isPending,onClick:()=>o.mutate(l,{onSuccess:()=>{R.success("Added to team"),d("")},onError:()=>R.error("Failed to add")}),children:"Add"})]})]})}function ly({workspaceId:e}){const{data:s,isLoading:n}=Ca(e),{data:r}=fr(e),a=ff(e),o=hf(e),[i,l]=x.useState(new Set),[d,c]=x.useState(!1),[u,f]=x.useState(""),m=g=>{l(y=>{const S=new Set(y);return S.has(g)?S.delete(g):S.add(g),S})},h=g=>{g.preventDefault(),u.trim()&&a.mutate({name:u.trim()},{onSuccess:()=>{R.success("Team created"),f(""),c(!1)},onError:()=>R.error("Failed to create team")})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Teams",!n&&s&&t.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",s.length]})]}),t.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3 w-3"}),"New team"]})]}),d&&t.jsx("div",{className:"px-6 py-3 border-b border-border bg-muted/5",children:t.jsxs("form",{onSubmit:h,className:"flex items-center gap-2",children:[t.jsx(xe,{autoFocus:!0,placeholder:"Team name",value:u,onChange:g=>f(g.target.value),className:"h-8 text-sm flex-1 max-w-[240px]"}),t.jsx(K,{type:"submit",size:"sm",className:"h-8",disabled:!u.trim()||a.isPending,children:a.isPending?"Creating…":"Create"}),t.jsx(K,{type:"button",variant:"ghost",size:"sm",className:"h-8",onClick:()=>{c(!1),f("")},children:"Cancel"})]})}),n?t.jsx("div",{className:"divide-y divide-border",children:[1,2].map(g=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[t.jsx(te,{className:"h-7 w-7 rounded-lg shrink-0"}),t.jsx(te,{className:"h-3.5 w-32"})]},g))}):s!=null&&s.length?t.jsx("div",{className:"divide-y divide-border",children:s.map(g=>{const y=i.has(g.id);return t.jsxs("div",{children:[t.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:[t.jsx("button",{onClick:()=>m(g.id),className:"text-muted-foreground hover:text-foreground shrink-0 transition-colors",children:y?t.jsx(Vs,{className:"h-4 w-4"}):t.jsx(Gs,{className:"h-4 w-4"})}),t.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:t.jsx(xs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:g.name}),g.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:g.description})]}),t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[g.member_count," ",g.member_count===1?"member":"members"]}),t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:t.jsx(Dn,{className:"h-4 w-4"})})}),t.jsx(Xt,{align:"end",className:"w-36",children:t.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>o.mutate(g.id,{onSuccess:()=>R.success("Team deleted"),onError:()=>R.error("Failed to delete team")}),children:[t.jsx(Tt,{className:"h-3.5 w-3.5 mr-2"}),"Delete team"]})})]})]}),y&&t.jsx(iy,{workspaceId:e,teamId:g.id,allMembers:r??[]})]},g.id)})}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xs,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No teams yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Teams make it easy to grant project access to groups of people."}),t.jsx(K,{variant:"outline",size:"sm",onClick:()=>c(!0),children:"Create a team"})]})]})}const dy=["general","members","teams"];function cy(){const{workspace:e}=ke(),s=(e==null?void 0:e.id)??"",[n,r]=ei(),a=n.get("tab"),[o,i]=x.useState(dy.includes(a)?a:"general"),l=u=>{i(u),r({tab:u},{replace:!0})},[d,c]=x.useState(!1);return t.jsxs("div",{className:"p-2",children:[t.jsx(tt,{zone:"workspace.settings.before",props:{workspaceId:s}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2",children:[t.jsx("div",{className:"flex",children:["general","members","teams"].map(u=>t.jsx("button",{onClick:()=>l(u),className:O("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"&&t.jsxs(K,{size:"sm",onClick:()=>c(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Invite member"]})]}),o==="general"&&t.jsx(ay,{workspaceId:s}),o==="members"&&t.jsx(oy,{workspaceId:s,onInvite:()=>c(!0)}),o==="teams"&&t.jsx(ly,{workspaceId:s})]}),t.jsx(tt,{zone:"workspace.settings.after",props:{workspaceId:s}}),t.jsx(ny,{open:d,onClose:()=>c(!1),workspaceId:s})]})}function uy({open:e,onClose:s}){const[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(new Set),d=Z0();x.useEffect(()=>{e&&(r(""),o(""),l(new Set))},[e]);const c=sr.flatMap(y=>y.permissions.map(S=>S.key)),u=c.every(y=>i.has(y)),f=!u&&c.some(y=>i.has(y)),m=()=>{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 t.jsx(xr,{open:e,onOpenChange:y=>!y&&s(),children:t.jsxs(Rn,{className:"sm:max-w-[580px] max-h-[85vh] overflow-y-auto",children:[t.jsxs(pr,{children:[t.jsx(gr,{children:"Create role"}),t.jsx($l,{children:"Define a new custom role with a specific permission set."})]}),t.jsxs("form",{onSubmit:g,className:"space-y-5 pt-2",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),t.jsx(xe,{value:n,onChange:y=>r(y.target.value),placeholder:"e.g. Developer, PM, Viewer",className:"h-9",autoFocus:!0,required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Description ",t.jsx("span",{className:"font-normal",children:"(optional)"})]}),t.jsx(xe,{value:a,onChange:y=>o(y.target.value),placeholder:"What is this role for?",className:"h-9"})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),t.jsx("button",{type:"button",onClick:m,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:u?"Deselect all":"Select all"})]}),sr.map(y=>t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:y.group}),t.jsx("div",{className:"space-y-1.5",children:y.permissions.map(S=>t.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[t.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"}),t.jsx("span",{className:"text-sm group-hover:text-foreground text-muted-foreground transition-colors",children:S.label})]},S.key))})]},y.group))]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),t.jsx(K,{type:"submit",size:"sm",disabled:!n.trim()||d.isPending,children:d.isPending?"Creating…":"Create role"})]})]})]})})}function my({role:e,onDeleted:s}){const[n,r]=x.useState(e.name),[a,o]=x.useState(e.description??""),[i,l]=x.useState(new Set(e.permissions)),[d,c]=x.useState(!1),u=ey(e.id),f=ty();x.useEffect(()=>{r(e.name),o(e.description??""),l(new Set(e.permissions))},[e.id,e.name,e.description,e.permissions]);const m=n!==e.name||a!==(e.description??"")||i.size!==e.permissions.length||Array.from(i).some(j=>!e.permissions.includes(j)),h=sr.flatMap(j=>j.permissions.map(E=>E.key)),g=h.every(j=>i.has(j)),y=!g&&h.some(j=>i.has(j)),S=()=>{l(g?new Set:new Set(h))},b=j=>{l(E=>{const p=new Set(E);return p.has(j)?p.delete(j):p.add(j),p})},N=()=>{u.mutate({name:n.trim(),description:a.trim()||void 0,permissions:Array.from(i)},{onSuccess:()=>R.success("Role saved"),onError:j=>R.error(j.message||"Failed to save role")})},w=()=>{f.mutate(e.id,{onSuccess:()=>{R.success("Role deleted"),s(),c(!1)},onError:j=>R.error(j.message||"Failed to delete role")})};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-sm font-semibold",children:e.name}),e.is_system&&t.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:[t.jsx(lr,{className:"h-3 w-3"}),"System"]})]}),!e.is_system&&t.jsx("button",{onClick:()=>c(!0),className:"text-muted-foreground hover:text-destructive transition-colors",title:"Delete role",children:t.jsx(Tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-5",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),t.jsx(xe,{value:n,onChange:j=>r(j.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),t.jsx(xe,{value:a,onChange:j=>o(j.target.value),placeholder:"What is this role for?",className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),t.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"})]}),sr.map(j=>t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:j.group}),t.jsx("div",{className:"space-y-2",children:j.permissions.map(E=>t.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[t.jsx("input",{type:"checkbox",checked:i.has(E.key),onChange:()=>b(E.key),className:"h-3.5 w-3.5 rounded border-border accent-foreground cursor-pointer"}),t.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:E.label})]},E.key))})]},j.group))]}),t.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-border flex justify-end",children:t.jsx(K,{size:"sm",onClick:N,disabled:!m||!n.trim()||u.isPending,children:u.isPending?"Saving…":"Save changes"})}),t.jsx(ic,{open:d,onOpenChange:c,children:t.jsxs(eo,{children:[t.jsxs(to,{children:[t.jsxs(no,{children:['Delete "',e.name,'"?']}),t.jsx(ro,{children:"This role will be removed from all users assigned to it. This action cannot be undone."})]}),t.jsxs(so,{children:[t.jsx(oo,{children:"Cancel"}),t.jsx(ao,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function fy(){const{data:e,isLoading:s}=io(),[n,r]=x.useState(null),[a,o]=x.useState(!1),i=(e==null?void 0:e.filter(c=>c.is_system))??[],l=(e==null?void 0:e.filter(c=>!c.is_system))??[];x.useEffect(()=>{e&&e.length>0&&!n&&r(e[0].id)},[e]);const d=(e==null?void 0:e.find(c=>c.id===n))??null;return t.jsx("div",{className:"p-2 h-full",children:t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(Zr,{className:"h-5 w-5 text-muted-foreground"}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-base font-semibold",children:"Roles & Permissions"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Define what users with each custom role can do across the application."})]})]}),t.jsxs(K,{size:"sm",onClick:()=>o(!0),children:[t.jsx(Ie,{className:"h-4 w-4 mr-1.5"}),"Create role"]})]}),t.jsxs("div",{className:"flex flex-1 min-h-0",children:[t.jsx("div",{className:"w-56 shrink-0 border-r border-border flex flex-col overflow-y-auto",children:s?t.jsx("div",{className:"p-4 space-y-2",children:[1,2,3].map(c=>t.jsx(te,{className:"h-8 w-full"},c))}):t.jsxs(t.Fragment,{children:[i.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"px-3 pt-3 pb-1",children:t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"System Roles"})}),i.map(c=>t.jsxs("button",{onClick:()=>r(c.id),className:O("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:[t.jsx(lr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate",children:c.name})]},c.id))]}),l.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"px-3 pt-3 pb-1",children:t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom Roles"})}),l.map(c=>t.jsxs("button",{onClick:()=>r(c.id),className:O("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:[t.jsx("div",{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:c.name})]},c.id))]}),!s&&(!e||e.length===0)&&t.jsx("div",{className:"flex flex-col items-center justify-center py-10 px-3 text-center",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:"No roles yet."})})]})}),t.jsx("div",{className:"flex-1 min-w-0",children:d?t.jsx(my,{role:d,onDeleted:()=>{var u;const c=(e==null?void 0:e.filter(f=>f.id!==d.id))??[];r(((u=c[0])==null?void 0:u.id)??null)}},d.id):t.jsx("div",{className:"flex items-center justify-center h-full text-center p-8",children:t.jsxs("div",{children:[t.jsx(Zr,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"Select a role to edit"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Or"," ",t.jsx("button",{onClick:()=>o(!0),className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"create a new role"})]})]})})})]}),t.jsx(uy,{open:a,onClose:()=>o(!1)})]})})}function hy(e){return Ne({queryKey:["invite",e],queryFn:()=>J.get(`/auth/invite/${e}`),retry:!1,enabled:!!e})}function xy(){const{token:e}=Ge(),{isAuthenticated:s}=ke(),n=Ue(),{data:r,isLoading:a,error:o}=hy(e??""),i=vf(e??""),[l,d]=x.useState(""),[c,u]=x.useState(""),[f,m]=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,N=w=>{w.preventDefault();const j=b??f.trim();if(!j){R.error("Email is required");return}i.mutate({email:j,password:h,first_name:l,last_name:c},{onSuccess:()=>{n(`/${r.workspace.slug}/projects`,{replace:!0})},onError:E=>R.error(E.message??"Registration failed")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[380px]",children:[t.jsx("div",{className:"flex justify-center mb-8",children:t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}),a?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-48 mx-auto"}),t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-32 mx-auto"})]}):o?t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Invalid or expired invitation"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This invite link is no longer valid. Ask for a new one."}),t.jsx(yn,{to:"/login",children:t.jsx(K,{variant:"outline",size:"sm",className:"mt-2",children:"Go to login"})})]}):r?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"px-5 py-4 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(Nm,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"You've been invited to"})]}),t.jsx("p",{className:"text-base font-semibold",children:r.workspace.name})]}),t.jsxs("div",{className:"px-5 py-3 flex items-center gap-2.5",children:[r.invitation.role==="admin"?t.jsx(Na,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):t.jsx(yl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:["Joining as"," ",t.jsx("span",{className:"font-medium text-foreground capitalize",children:r.invitation.role}),r.invitation.role==="admin"?" — full access":" — can view and edit"]})]})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-5",children:[t.jsx("p",{className:"text-sm font-medium mb-4",children:"Create your account"}),t.jsxs("form",{onSubmit:N,className:"space-y-2",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(xe,{placeholder:"First name",value:l,onChange:w=>d(w.target.value),required:!0,className:"h-9 bg-transparent",autoFocus:!0}),t.jsx(xe,{placeholder:"Last name",value:c,onChange:w=>u(w.target.value),required:!0,className:"h-9 bg-transparent"})]}),b?t.jsxs("div",{className:"relative",children:[t.jsx(xe,{type:"email",value:b,readOnly:!0,className:"h-9 bg-muted/50 text-muted-foreground cursor-not-allowed"}),t.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"})]}):t.jsx(xe,{type:"email",placeholder:"Email",value:f,onChange:w=>m(w.target.value),required:!0,className:"h-9 bg-transparent",autoComplete:"email"}),t.jsxs("div",{className:"relative",children:[t.jsx(xe,{type:y?"text":"password",placeholder:"Password (min. 8 characters)",value:h,onChange:w=>g(w.target.value),required:!0,minLength:8,className:"h-9 bg-transparent pr-10",autoComplete:"new-password"}),t.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?t.jsx(ba,{className:"h-4 w-4"}):t.jsx(_n,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(K,{type:"submit",className:"w-full h-9 font-medium",disabled:i.isPending,children:i.isPending?"Creating account…":"Accept invitation"})})]})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Already have an account?"," ",t.jsx(yn,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]}):null]})})}const py=x.lazy(()=>Gc(()=>import("./ProjectTimelinePage-CXkvGaEM.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage})));function Qr({children:e}){const{isAuthenticated:s}=ke();return s?t.jsx(t.Fragment,{children:e}):t.jsx(As,{to:"/login",replace:!0})}function Qo({children:e}){const{isAuthenticated:s}=ke(),{data:n}=vl(),r=nr();return s?t.jsx(As,{to:"/",replace:!0}):n!=null&&n.needsSetup&&r.pathname==="/login"?t.jsx(As,{to:"/register",replace:!0}):n&&!n.needsSetup&&r.pathname==="/register"?t.jsx(As,{to:"/login",replace:!0}):t.jsx(t.Fragment,{children:e})}function gy(){const{workspace:e,setWorkspace:s}=ke(),n=Ue(),{data:r,isLoading:a}=mr(!e);return x.useEffect(()=>{if(e){n(`/${e.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})},[e,r,a,n,s]),t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function by(){const{workspace:e}=Ge(),{workspace:s,setWorkspace:n}=ke();Nf();const r=Ue(),{data:a,isLoading:o,isFetching:i}=mr();return x.useEffect(()=>{if(o||!a)return;const l=a.find(d=>d.slug===e);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,e,o,i,s==null?void 0:s.id,r,n]),o||!s||s.slug!==e?t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):t.jsxs(t.Fragment,{children:[t.jsx(uh,{}),t.jsx(zh,{})]})}function yy(){return t.jsxs(hc,{children:[t.jsx($e,{path:"/login",element:t.jsx(Qo,{children:t.jsx(Wh,{})})}),t.jsx($e,{path:"/register",element:t.jsx(Qo,{children:t.jsx(qh,{})})}),t.jsx($e,{path:"/invite/:token",element:t.jsx(xy,{})}),t.jsx($e,{path:"/setup",element:t.jsx(Qr,{children:t.jsx(Bh,{})})}),t.jsx($e,{index:!0,element:t.jsx(Qr,{children:t.jsx(gy,{})})}),t.jsxs($e,{path:"/:workspace",element:t.jsx(Qr,{children:t.jsx(by,{})}),children:[t.jsx($e,{index:!0,element:t.jsx(As,{to:"projects",replace:!0})}),t.jsx($e,{path:"projects",element:t.jsx(tg,{})}),t.jsxs($e,{path:"projects/:projectKey",element:t.jsx(mh,{}),children:[t.jsx($e,{path:"board",element:t.jsx(x0,{})}),t.jsx($e,{path:"issues",element:t.jsx(p0,{})}),t.jsx($e,{path:"issues/new",element:t.jsx(H0,{})}),t.jsx($e,{path:"issues/:issueId",element:t.jsx(W0,{})}),t.jsx($e,{path:"sprints",element:t.jsx(J0,{})}),t.jsx($e,{path:"timeline",element:t.jsx(x.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:t.jsx(py,{})})}),t.jsx($e,{path:"access",element:t.jsx(R0,{})})]}),t.jsx($e,{path:"notifications",element:t.jsx(V0,{})}),t.jsx($e,{path:"settings",element:t.jsx(cy,{})}),t.jsx($e,{path:"roles",element:t.jsx(fy,{})})]}),t.jsx($e,{path:"*",element:t.jsx(As,{to:"/",replace:!0})})]})}window.__React=v;window.__ReactJsxRuntime=dc;const vy=new cc({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const n=await import("/admin-extensions.js");Array.isArray(n==null?void 0:n.default)&&(e=n.default)}catch{}Fi(document.getElementById("root")).render(t.jsx(x.StrictMode,{children:t.jsx(xm,{widgets:[...rf,...e],children:t.jsx(Au,{children:t.jsxs(uc,{client:vy,children:[t.jsx($u,{children:t.jsx(Ru,{children:t.jsx(xc,{children:t.jsxs(ma,{delayDuration:300,children:[t.jsx(yy,{}),t.jsx(Nu,{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"}}})]})})})}),t.jsx(Qc,{initialIsOpen:!1})]})})})}))})();export{R as A,K as B,Gs as C,Pe as D,J as E,qd as I,Ie as P,tt as W,O as a,mt as b,H as c,Ra as d,Nt as e,Yp as f,$x as g,$a as h,Fa as i,qp as j,oe as k,wn as l,Cy as m,Jt as n,Ix as o,zx as p,Bx as q,od as r,Xp as s,pe as t,nd as u,ws as v,Cn as w,sn as x,nn as y,wr as z};
476
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{var r;document.getElementById((r=e.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(s)},[s,e]),null},P0=Hd,A0=Kd,nc=Vd,rc=Gd,ac=ec,oc=sc,ic=Xd,lc=Zd;const dc=P0,$0=A0,cc=x.forwardRef(({className:e,...s},n)=>t.jsx(nc,{className:P("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",e),...s,ref:n}));cc.displayName=nc.displayName;const eo=x.forwardRef(({className:e,...s},n)=>t.jsxs($0,{children:[t.jsx(cc,{}),t.jsx(rc,{ref:n,className:P("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",e),...s})]}));eo.displayName=rc.displayName;const to=({className:e,...s})=>t.jsx("div",{className:P("flex flex-col space-y-2 text-center sm:text-left",e),...s});to.displayName="AlertDialogHeader";const so=({className:e,...s})=>t.jsx("div",{className:P("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...s});so.displayName="AlertDialogFooter";const no=x.forwardRef(({className:e,...s},n)=>t.jsx(ic,{ref:n,className:P("text-base font-semibold",e),...s}));no.displayName=ic.displayName;const ro=x.forwardRef(({className:e,...s},n)=>t.jsx(lc,{ref:n,className:P("text-sm text-muted-foreground",e),...s}));ro.displayName=lc.displayName;const ao=x.forwardRef(({className:e,...s},n)=>t.jsx(ac,{ref:n,className:P(Is(),e),...s}));ao.displayName=ac.displayName;const oo=x.forwardRef(({className:e,...s},n)=>t.jsx(oc,{ref:n,className:P(Is({variant:"outline"}),"mt-2 sm:mt-0",e),...s}));oo.displayName=oc.displayName;function R0({member:e,onRequestRemove:s}){var l;const n=e.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 t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsx(st,{className:"h-8 w-8 shrink-0",children:t.jsx(nt,{className:"text-xs font-medium",children:i})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:o}),(n==null?void 0:n.email)&&t.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:n.email})]}),t.jsx(Un,{className:P("shrink-0 text-[11px] border-0 w-20 justify-center",e.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:e.role}),t.jsx(K,{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(e.user_id,o),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}function I0({teamEntry:e,onRemove:s}){const n=e.team;return t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsx("div",{className:"h-8 w-8 rounded-lg bg-muted flex items-center justify-center shrink-0",children:t.jsx(xs,{className:"h-4 w-4 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:(n==null?void 0:n.name)??"Unknown team"}),n&&t.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[n.member_count," ",n.member_count===1?"member":"members"]})]}),t.jsx(K,{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(e.team_id),children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})}function F0(){const{projectKey:e}=Ge(),{workspace:s}=ke(),n=(s==null?void 0:s.id)??"",{data:r}=ws(e??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=Jl(a),{data:l}=Tn(n),{data:d}=Ca(n),c=Zl(a),u=ed(a),f=td(a),m=sd(a),[h,g]=x.useState(""),[y,S]=x.useState(""),[b,N]=x.useState(null),w=new Set((o==null?void 0:o.members.map(O=>O.user_id))??[]),j=new Set((o==null?void 0:o.teams.map(O=>O.team_id))??[]),E=(l??[]).filter(O=>!w.has(O.user_id)),p=(d??[]).filter(O=>!j.has(O.id)),C=(o==null?void 0:o.members.length)??0,$=(o==null?void 0:o.teams.length)??0;function D(){b&&u.mutate(b.userId,{onSuccess:()=>{I.success("Access removed"),N(null)},onError:()=>I.error("Failed to remove")})}return t.jsxs("div",{className:"p-2",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[t.jsxs("div",{children:[t.jsx("h2",{className:"text-sm font-semibold",children:"Access"}),t.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Manage who has access to this project."})]}),!i&&t.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[C," member",C!==1?"s":""," • ",$," team",$!==1?"s":""]})]}),i?t.jsxs("div",{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),t.jsx("div",{className:"divide-y divide-border",children:[1,2].map(O=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(te,{className:"h-8 w-8 rounded-full"}),t.jsx(te,{className:"h-4 w-44"}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{className:"h-5 w-20"})]},O))}),t.jsx("div",{className:"px-6 py-2 border-y border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),t.jsx("div",{className:"divide-y divide-border",children:[1].map(O=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(te,{className:"h-8 w-8 rounded-lg"}),t.jsx(te,{className:"h-4 w-32"}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{className:"h-4 w-20"})]},O))})]}):t.jsxs("div",{children:[t.jsxs("div",{children:[t.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:[t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"}),E.length>0&&t.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[t.jsxs(we,{value:h,onValueChange:g,children:[t.jsx(ve,{className:"h-8 text-xs w-full sm:w-56",children:t.jsx(Ee,{placeholder:"Add person…"})}),t.jsx(je,{children:E.map(O=>{const F=O.user,_=(F==null?void 0:F.first_name)??"",R=(F==null?void 0:F.last_name)??"",T=`${_} ${R}`.trim()||(F==null?void 0:F.email)||"Unknown";return t.jsx(ce,{value:O.user_id,children:T},O.user_id)})})]}),t.jsxs(K,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:!h||c.isPending,onClick:()=>c.mutate({userId:h},{onSuccess:()=>{I.success("Access granted"),g("")},onError:()=>I.error("Failed to grant access")}),children:[t.jsx(On,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),C===0?t.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No individual members."}):t.jsx("div",{className:"divide-y divide-border",children:o==null?void 0:o.members.map(O=>t.jsx(R0,{member:O,onRequestRemove:(F,_)=>N({userId:F,displayName:_})},O.id))})]}),t.jsxs("div",{className:"border-t border-border",children:[t.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:[t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"}),p.length>0&&t.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[t.jsxs(we,{value:y,onValueChange:S,children:[t.jsx(ve,{className:"h-8 text-xs w-full sm:w-56",children:t.jsx(Ee,{placeholder:"Add team…"})}),t.jsx(je,{children:p.map(O=>t.jsx(ce,{value:O.id,children:O.name},O.id))})]}),t.jsxs(K,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:!y||f.isPending,onClick:()=>f.mutate(y,{onSuccess:()=>{I.success("Team access granted"),S("")},onError:()=>I.error("Failed to add team")}),children:[t.jsx(xs,{className:"h-3.5 w-3.5"}),"Add"]})]})]}),$===0?t.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No teams have access."}):t.jsx("div",{className:"divide-y divide-border",children:o==null?void 0:o.teams.map(O=>t.jsx(I0,{teamEntry:O,onRemove:F=>m.mutate(F,{onSuccess:()=>I.success("Team access removed"),onError:()=>I.error("Failed to remove team")})},O.id))})]}),C===0&&$===0&&E.length===0&&p.length===0&&t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center border-t border-border",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xs,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No access entries yet"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"Add workspace people or teams first to grant project access."})]})]})]}),t.jsx(dc,{open:!!b,onOpenChange:O=>{O||N(null)},children:t.jsxs(eo,{className:"sm:max-w-md",children:[t.jsxs(to,{children:[t.jsx(no,{children:"Remove member access?"}),t.jsx(ro,{children:b?`${b.displayName} will lose access to this project.`:"This member will lose access to this project."})]}),t.jsxs(so,{children:[t.jsx(oo,{disabled:u.isPending,children:"Cancel"}),t.jsx(ao,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:O=>{O.preventDefault(),D()},disabled:u.isPending,children:u.isPending?"Removing...":"Remove"})]})]})})]})}function Go(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function Mt({label:e,children:s}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),t.jsx("div",{className:"flex-1 min-w-0",children:s})]})}const z0={backlog:t.jsx(Nt,{className:"h-3 w-3 text-zinc-400"}),todo:t.jsx(Nt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:t.jsx(Qt,{className:"h-3 w-3 text-indigo-500"}),in_review:t.jsx(_n,{className:"h-3 w-3 text-amber-500"}),done:t.jsx(js,{className:"h-3 w-3 text-emerald-500"}),cancelled:t.jsx(ll,{className:"h-3 w-3 text-zinc-400"})},W0={urgent:t.jsx(Xs,{className:"h-3 w-3 text-red-500"}),high:t.jsx(lr,{className:"h-3 w-3 text-orange-500"}),medium:t.jsx(En,{className:"h-3 w-3 text-yellow-500"}),low:t.jsx(ir,{className:"h-3 w-3 text-blue-400"})},q0={bug:t.jsx(al,{className:"h-3 w-3 text-red-500"}),feature:t.jsx(gl,{className:"h-3 w-3 text-purple-500"}),task:t.jsx(bl,{className:"h-3 w-3 text-blue-500"}),chore:t.jsx(ha,{className:"h-3 w-3 text-zinc-500"})};function Gr({value:e,onValueChange:s,options:n,icons:r,placeholder:a}){return t.jsxs(we,{value:e,onValueChange:s,children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5",children:[r[e]??t.jsx(il,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{children:n[e]??a??""})]})}),t.jsx(je,{children:Object.entries(n).map(([o,i])=>t.jsx(ce,{value:o,className:"text-xs",children:t.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function B0(){const{workspace:e,projectKey:s,issueId:n}=Ge(),r=He(),[a,o]=x.useState(!1),[i,l]=x.useState(""),[d,c]=x.useState(""),[u,f]=x.useState(!1),{data:m}=ws(s??""),h=(m==null?void 0:m.id)??"",{data:g,isLoading:y}=tl(n??""),S=or(n??"",h),{data:b}=sn(h||void 0),{data:N}=nn(h||void 0),{data:w}=qn(h||void 0),{data:j}=Cn(h||void 0),E=(N??[]).filter(T=>T.status!=="completed"),p=g!=null&&g.parent_id?j==null?void 0:j.find(T=>T.id===g.parent_id):null,C=(j==null?void 0:j.filter(T=>T.parent_id===n))??[],$=g!=null&&g.task_list_id?w==null?void 0:w.find(T=>T.id===g.task_list_id):null,D=b&&b.length>0?Object.fromEntries(b.map(T=>[T.key,T.name])):bs,O=b&&b.length>0?Object.fromEntries(b.map(T=>[T.key,T.category==="completed"?t.jsx(js,{className:"h-3 w-3",style:{color:T.color}}):T.category==="started"?t.jsx(Qt,{className:"h-3 w-3",style:{color:T.color}}):t.jsx(Nt,{className:"h-3 w-3",style:{color:T.color}})])):z0;if(x.useEffect(()=>{g&&(l(g.title),c(g.description??"")),o(!1)},[g==null?void 0:g.id]),!s||!n)return null;const F=()=>{i.trim()&&S.mutate({title:i.trim(),description:d.trim()||void 0},{onSuccess:()=>{o(!1),I.success("Issue updated")},onError:()=>I.error("Failed to update issue")})},_=()=>{g&&(l(g.title),c(g.description??"")),o(!1)},R=(T,X)=>{S.mutate(T,{onSuccess:()=>I.success(`${X} updated`),onError:()=>I.error(`Failed to update ${X.toLowerCase()}`)})};return y||!g?t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.jsx("div",{className:"sticky top-0 z-10 h-[57px] bg-white dark:bg-card border-b border-border"}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 space-y-4 shadow-sm",children:[t.jsx(te,{className:"h-7 w-3/4"}),t.jsx(te,{className:"h-32 w-full"})]}),t.jsx(te,{className:"h-24 w-full rounded-xl"}),t.jsx(te,{className:"h-48 w-full rounded-xl"})]}),t.jsx(te,{className:"h-[280px] w-full rounded-xl"})]})})]}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.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:[t.jsxs("div",{className:"flex items-center gap-1.5",children:[t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>r(`/${e}/projects/${s}/issues`),children:[t.jsx(pa,{className:"h-3.5 w-3.5"}),(m==null?void 0:m.name)??"Issues"]}),t.jsx("span",{className:"text-border",children:"/"}),t.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:g.identifier}),t.jsx(Un,{variant:"muted",className:"text-[10px] ml-1",children:Kt[g.type]??g.type})]}),t.jsx("div",{className:"flex items-center gap-2",children:a?t.jsxs(t.Fragment,{children:[t.jsx(K,{variant:"ghost",size:"sm",onClick:_,children:"Discard"}),t.jsx(K,{size:"sm",onClick:F,disabled:!i.trim()||S.isPending,className:"px-4",children:S.isPending?"Saving…":"Save changes"})]}):t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>o(!0),children:[t.jsx(cr,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[t.jsxs("div",{className:"space-y-4",children:[t.jsx(tt,{zone:"issue.details.before",props:{issue:g}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsx("div",{className:"px-6 pt-6 pb-3",children:a?t.jsx("input",{autoFocus:!0,value:i,onChange:T=>l(T.target.value),onKeyDown:T=>{T.key==="Enter"&&T.preventDefault()},className:P("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")}):t.jsx("h1",{className:"text-xl font-semibold text-foreground leading-snug",children:g.title})}),t.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:t.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),a?t.jsx(Ja,{content:d,onChange:c,placeholder:"Add a description…",className:"border-t border-border/50 min-h-[280px]"}):g.description?t.jsx("div",{className:"border-t border-border/50",children:t.jsx(Za,{html:g.description,className:"px-5 py-4"})}):t.jsx("div",{className:"border-t border-border/50 px-6 py-4",children:t.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})})]}),!g.parent_id&&t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Child Issues"}),t.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3.5 w-3.5"}),"Add child issue"]})]}),C.length===0?t.jsx("div",{className:"px-5 py-4 text-xs text-muted-foreground/50 italic",children:"No child issues yet"}):t.jsx("div",{className:"px-5 py-2 divide-y divide-border/40",children:C.map(T=>t.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs",children:[t.jsx(ul,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsx("button",{onClick:()=>r(`/${e}/projects/${s}/issues/${T.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:T.identifier}),t.jsx("button",{onClick:()=>r(`/${e}/projects/${s}/issues/${T.id}`),className:"text-foreground hover:text-foreground/70 truncate text-left transition-colors",children:T.title})]},T.id))})]}),t.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:t.jsx(Wd,{issueId:n})}),t.jsx(tt,{zone:"issue.details.after",props:{issue:g}})]}),t.jsxs("div",{className:"space-y-4",children:[t.jsx(tt,{zone:"issue.details.sidebar",props:{issue:g}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),t.jsxs("div",{className:"px-4 py-1",children:[t.jsx(Mt,{label:"Status",children:t.jsx(Gr,{value:g.status,onValueChange:T=>R({status:T},"Status"),options:D,icons:O})}),t.jsx(Mt,{label:"Priority",children:t.jsx(Gr,{value:g.priority,onValueChange:T=>R({priority:T},"Priority"),options:Ot,icons:W0})}),t.jsx(Mt,{label:"Type",children:t.jsx(Gr,{value:g.type,onValueChange:T=>R({type:T},"Type"),options:Kt,icons:q0})}),t.jsx(Mt,{label:"Assignees",children:t.jsx(Bn,{value:g.assignee_ids??[],onChange:T=>R({assignee_ids:T},"Assignees"),disabled:S.isPending})}),t.jsx(Mt,{label:"Sprint",children:t.jsxs(we,{value:g.sprint_id??"none",onValueChange:T=>R({sprint_id:T==="none"?null:T},"Sprint"),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),g.sprint_id?(()=>{const T=E.find(q=>q.id===g.sprint_id)??(N==null?void 0:N.find(q=>q.id===g.sprint_id));if(!T)return t.jsxs("span",{className:"truncate",children:[g.sprint_id.slice(0,8),"…"]});const X=Go(T);return t.jsxs("span",{className:"truncate",children:[T.name,X&&t.jsxs("span",{className:"text-muted-foreground ml-1",children:["· ",X]})]})})():t.jsx("span",{className:"text-muted-foreground",children:"No sprint"})]})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),E.map(T=>{const X=Go(T);return t.jsx(ce,{value:T.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:T.name}),X&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:X})]})},T.id)})]})]})}),(w??[]).length>0&&t.jsx(Mt,{label:"List",children:t.jsxs(we,{value:g.task_list_id??"none",onValueChange:T=>R({task_list_id:T==="none"?null:T},"List"),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(va,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:$?"truncate":"text-muted-foreground",children:($==null?void 0:$.name)??"No list"})]})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(w??[]).map(T=>t.jsx(ce,{value:T.id,className:"text-xs",children:T.name},T.id))]})]})}),t.jsx(Mt,{label:"Start Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(Ue,{className:"w-auto p-0",align:"start",children:[t.jsx(lt,{mode:"single",selected:g.start_date?new Date(g.start_date):void 0,onSelect:T=>R({start_date:T?oe(T,"yyyy-MM-dd"):null},"Start date"),initialFocus:!0}),g.start_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>R({start_date:null},"Start date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),t.jsx(Mt,{label:"Due Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.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"})]})}),t.jsxs(Ue,{className:"w-auto p-0",align:"start",children:[t.jsx(lt,{mode:"single",selected:g.due_date?new Date(g.due_date):void 0,onSelect:T=>R({due_date:T?oe(T,"yyyy-MM-dd"):null},"Due date"),initialFocus:!0}),g.due_date&&t.jsx("div",{className:"border-t px-3 py-2",children:t.jsxs("button",{onClick:()=>R({due_date:null},"Due date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[t.jsx(Fe,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),p&&t.jsx(Mt,{label:"Parent",children:t.jsxs("button",{onClick:()=>r(`/${e}/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:[t.jsx(ga,{className:"h-3 w-3 text-muted-foreground shrink-0"}),t.jsx("span",{className:"font-mono text-muted-foreground shrink-0",children:p.identifier}),t.jsx("span",{className:"text-foreground truncate",children:p.title})]})})]})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Details"})}),t.jsxs("div",{className:"px-4 pt-3 pb-4 space-y-2.5",children:[t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:"text-muted-foreground",children:"Created"}),t.jsx("span",{className:"text-foreground",children:oe(new Date(g.created_at),"MMM d, yyyy")})]}),t.jsxs("div",{className:"flex items-center justify-between text-xs",children:[t.jsx("span",{className:"text-muted-foreground",children:"Updated"}),t.jsx("span",{className:"text-foreground",children:oe(new Date(g.updated_at),"MMM d, yyyy")})]})]})]})]})]})})]}),t.jsx(Nr,{open:u,onClose:()=>f(!1),projectId:h,defaultParentId:n,defaultTaskListId:g.task_list_id})]})}function Yt({label:e,children:s}){return t.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),t.jsx("div",{className:"flex-1 min-w-0",children:s})]})}const Y0={backlog:t.jsx(Nt,{className:"h-3 w-3 text-zinc-400"}),todo:t.jsx(Nt,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:t.jsx(Qt,{className:"h-3 w-3 text-indigo-500"}),in_review:t.jsx(_n,{className:"h-3 w-3 text-amber-500"}),done:t.jsx(js,{className:"h-3 w-3 text-emerald-500"}),cancelled:t.jsx(ll,{className:"h-3 w-3 text-zinc-400"})},L0={urgent:t.jsx(Xs,{className:"h-3 w-3 text-red-500"}),high:t.jsx(lr,{className:"h-3 w-3 text-orange-500"}),medium:t.jsx(En,{className:"h-3 w-3 text-yellow-500"}),low:t.jsx(ir,{className:"h-3 w-3 text-blue-400"})},U0={bug:t.jsx(al,{className:"h-3 w-3 text-red-500"}),feature:t.jsx(gl,{className:"h-3 w-3 text-purple-500"}),task:t.jsx(bl,{className:"h-3 w-3 text-blue-500"}),chore:t.jsx(ha,{className:"h-3 w-3 text-zinc-500"})};function Qr({value:e,onValueChange:s,options:n,icons:r,placeholder:a}){return t.jsxs(we,{value:e,onValueChange:s,children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5",children:[r[e]??t.jsx(il,{className:"h-3 w-3 text-muted-foreground"}),t.jsx("span",{children:n[e]??a??""})]})}),t.jsx(je,{children:Object.entries(n).map(([o,i])=>t.jsx(ce,{value:o,className:"text-xs",children:t.jsxs("div",{className:"flex items-center gap-2",children:[r[o],i]})},o))})]})}function H0(e){if(!e.start_date&&!e.end_date)return null;const s=e.start_date?oe(new Date(e.start_date),"MMM d"):"—",n=e.end_date?oe(new Date(e.end_date),"MMM d"):"—";return`${s} – ${n}`}function K0(){const{workspace:e,projectKey:s}=Ge(),n=He(),{workspace:r}=ke(),[a,o]=x.useState(""),[i,l]=x.useState(""),[d,c]=x.useState("backlog"),[u,f]=x.useState("medium"),[m,h]=x.useState("task"),[g,y]=x.useState([]),[S,b]=x.useState(""),[N,w]=x.useState(""),[j,E]=x.useState(void 0),[p,C]=x.useState(void 0),{data:$}=ws(s??""),D=($==null?void 0:$.id)??"",O=sl(),{data:F}=sn(D||void 0),{data:_}=nn(D||void 0),{data:R}=qn(D||void 0),T=(_??[]).filter(W=>W.status!=="completed"),X=F&&F.length>0?Object.fromEntries(F.map(W=>[W.key,W.name])):bs,q=F&&F.length>0?Object.fromEntries(F.map(W=>[W.key,W.category==="completed"?t.jsx(js,{className:"h-3 w-3",style:{color:W.color}}):W.category==="started"?t.jsx(Qt,{className:"h-3 w-3",style:{color:W.color}}):t.jsx(Nt,{className:"h-3 w-3",style:{color:W.color}})])):Y0;if(!s||!D)return null;const V=()=>{if(!a.trim()){I.error("Title is required");return}O.mutate({title:a.trim(),description:i||void 0,status:d,priority:u,type:m,project_id:D,workspace_id:r.id,assignee_ids:g.length>0?g:void 0,sprint_id:S||null,task_list_id:N||null,start_date:j?oe(j,"yyyy-MM-dd"):null,due_date:p?oe(p,"yyyy-MM-dd"):null},{onSuccess:W=>{I.success("Issue created"),n(`/${e}/projects/${s}/issues/${W.issue.id}`,{replace:!0})},onError:W=>I.error(W.message??"Failed to create issue")})};return t.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[t.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:[t.jsxs(K,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>n(`/${e}/projects/${s}/issues`),children:[t.jsx(pa,{className:"h-3.5 w-3.5"}),($==null?void 0:$.name)??"Issues"]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(K,{variant:"ghost",size:"sm",onClick:()=>n(`/${e}/projects/${s}/issues`),children:"Discard"}),t.jsx(K,{size:"sm",onClick:V,disabled:!a.trim()||O.isPending,className:"px-4",children:O.isPending?"Creating…":"Create issue"})]})]}),t.jsx("div",{className:"px-2 py-2",children:t.jsxs("div",{className:"grid grid-cols-[1fr_256px] gap-5 items-start",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[t.jsx("div",{className:"px-6 pt-6 pb-3",children:t.jsx("input",{autoFocus:!0,value:a,onChange:W=>o(W.target.value),onKeyDown:W=>{W.key==="Enter"&&W.preventDefault()},placeholder:"Issue title…",className:P("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")})}),t.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:t.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),t.jsx(Ja,{content:"",onChange:l,placeholder:"Add steps to reproduce, acceptance criteria, or context…",className:"border-t border-border/50 min-h-[320px]"})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[t.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),t.jsxs("div",{className:"px-4 py-1",children:[t.jsx(Yt,{label:"Status",children:t.jsx(Qr,{value:d,onValueChange:c,options:X,icons:q})}),t.jsx(Yt,{label:"Priority",children:t.jsx(Qr,{value:u,onValueChange:f,options:Ot,icons:L0})}),t.jsx(Yt,{label:"Type",children:t.jsx(Qr,{value:m,onValueChange:h,options:Kt,icons:U0})}),t.jsx(Yt,{label:"Assignees",children:t.jsx(Bn,{value:g,onChange:y})}),T.length>0&&t.jsx(Yt,{label:"Sprint",children:t.jsxs(we,{value:S||"none",onValueChange:W=>b(W==="none"?"":W),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(xt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No sprint"})]})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),T.map(W=>{const z=H0(W);return t.jsx(ce,{value:W.id,className:"text-xs",children:t.jsxs("div",{className:"flex items-baseline gap-1.5",children:[t.jsx("span",{children:W.name}),z&&t.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:z})]})},W.id)})]})]})}),(R??[]).length>0&&t.jsx(Yt,{label:"List",children:t.jsxs(we,{value:N||"none",onValueChange:W=>w(W==="none"?"":W),children:[t.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:t.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[t.jsx(va,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx(Ee,{placeholder:"No list"})]})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(R??[]).map(W=>t.jsx(ce,{value:W.id,className:"text-xs",children:W.name},W.id))]})]})}),t.jsx(Yt,{label:"Start Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:j?"text-foreground":"text-muted-foreground",children:j?oe(j,"MMM d, yyyy"):"No start date"}),j&&t.jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),E(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3 w-3"})})]})}),t.jsx(Ue,{className:"w-auto p-0",align:"start",children:t.jsx(lt,{mode:"single",selected:j,onSelect:E,initialFocus:!0})})]})}),t.jsx(Yt,{label:"Due Date",children:t.jsxs(Ke,{children:[t.jsx(Ve,{asChild:!0,children:t.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:[t.jsx(ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:p?"text-foreground":"text-muted-foreground",children:p?oe(p,"MMM d, yyyy"):"No due date"}),p&&t.jsx("button",{type:"button",onClick:W=>{W.stopPropagation(),C(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(Fe,{className:"h-3 w-3"})})]})}),t.jsx(Ue,{className:"w-auto p-0",align:"start",children:t.jsx(lt,{mode:"single",selected:p,onSelect:C,initialFocus:!0})})]})})]}),t.jsx("div",{className:"px-4 pt-2 pb-3 mt-1 border-t border-border/60",children:t.jsxs("p",{className:"text-[11px] text-muted-foreground/50 leading-relaxed",children:["Press ",t.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})})]})]})})]})}const V0={issue:{icon:Qs,label:"Issue"},project:{icon:xt,label:"Project"},comment:{icon:Bm,label:"Comment"},sprint:{icon:Xs,label:"Sprint"}};function G0(e){const s=new Date(e);return Zp(s)?Up(s,{addSuffix:!0}):tg(s)?`Yesterday ${oe(s,"h:mm a")}`:oe(s,"MMM d, yyyy")}function Q0(){const{workspace:e}=Ge(),s=He(),{data:n,isLoading:r}=lh(),{data:a=[]}=Pn(),o=ch(),i=uh(),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 f;if(u.entity_type==="issue"&&((f=u.metadata)!=null&&f.project_id)){const m=d[u.metadata.project_id];if(m)return`/${e}/projects/${m.identifier}/issues/${u.entity_id}`}if(u.entity_type==="project"){const m=d[u.entity_id];if(m)return`/${e}/projects/${m.identifier}/board`}return null}return t.jsx("div",{className:"p-2",children:t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[t.jsx("h1",{className:"text-base font-semibold",children:"Notifications"}),l>0&&t.jsxs(K,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>i.mutate(void 0,{onSuccess:()=>I.success("All marked as read"),onError:()=>I.error("Failed")}),disabled:i.isPending,children:[t.jsx(Cm,{className:"h-3.5 w-3.5"}),"Mark all read"]})]}),t.jsxs("div",{className:"grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-2.5 border-b border-border",children:[t.jsx("span",{}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Type"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Message"}),t.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Time"}),t.jsx("span",{})]}),r?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(u=>t.jsxs("div",{className:"grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-3",children:[t.jsx("div",{}),t.jsx(te,{className:"h-5 w-20 rounded-full"}),t.jsx(te,{className:"h-4 w-3/4"}),t.jsx(te,{className:"h-4 w-20"}),t.jsx("div",{})]},u))}):n!=null&&n.length?t.jsx("div",{className:"divide-y divide-border",children:n.map(u=>{const f=V0[u.entity_type]??{icon:qs,label:u.entity_type},m=f.icon,h=c(u);return t.jsxs("div",{className:P("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:[t.jsx("div",{className:"flex items-center justify-center",children:!u.read&&t.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-indigo-500 shrink-0"})}),t.jsx("div",{children:t.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:[t.jsx(m,{className:"h-3 w-3"}),f.label]})}),t.jsx("p",{className:P("text-sm truncate",u.read?"text-muted-foreground":"font-medium text-foreground"),children:u.message}),t.jsx("span",{className:"text-xs text-muted-foreground",children:G0(u.created_at)}),t.jsx("div",{className:"flex justify-end",onClick:g=>g.stopPropagation(),children:!u.read&&t.jsx(K,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground px-2",onClick:()=>o.mutate(u.id,{onError:()=>I.error("Failed")}),children:"Mark read"})})]},u.id)})}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(qs,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No notifications"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"You're all caught up."})]}),!r&&!!(n!=null&&n.length)&&t.jsx("div",{className:"px-6 py-3 border-t border-border",children:t.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.length," notification",n.length!==1?"s":"",l>0?` · ${l} unread`:""]})})]})})}function X0({open:e,onClose:s,projectId:n}){const[r,a]=x.useState(""),[o,i]=x.useState(""),[l,d]=x.useState(),[c,u]=x.useState(),[f,m]=x.useState(!1),[h,g]=x.useState(!1),y=xg(n);function S(){a(""),i(""),d(void 0),u(void 0),s()}async function b(N){N.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:()=>{I.success("Sprint created"),S()},onError:()=>I.error("Failed to create sprint")})}return t.jsx(Ss,{open:e,onOpenChange:N=>!N&&S(),children:t.jsxs(Cs,{className:"sm:max-w-md",children:[t.jsx(Js,{children:t.jsx(en,{children:"New Sprint"})}),t.jsxs("form",{onSubmit:b,className:"flex flex-col flex-1 overflow-hidden",children:[t.jsxs(Zs,{className:"space-y-4 py-1",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"sprint-name",children:["Name ",t.jsx("span",{className:"text-destructive",children:"*"})]}),t.jsx(xe,{id:"sprint-name",placeholder:"e.g. Sprint 1",value:r,onChange:N=>a(N.target.value),autoFocus:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs(We,{htmlFor:"sprint-goal",children:["Goal ",t.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),t.jsx(yr,{id:"sprint-goal",placeholder:"What do you want to achieve in this sprint?",value:o,onChange:N=>i(N.target.value),className:"resize-none text-sm",rows:2})]}),t.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"Start Date"}),t.jsxs(Ke,{open:f,onOpenChange:m,children:[t.jsx(Ve,{asChild:!0,children:t.jsxs(K,{variant:"outline",className:P("w-full justify-start text-left font-normal text-sm h-9",!l&&"text-muted-foreground"),children:[t.jsx(ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),l?oe(l,"MMM d, yyyy"):"Pick date"]})}),t.jsx(Ue,{className:"w-auto p-0",align:"start",children:t.jsx(lt,{mode:"single",selected:l,onSelect:N=>{d(N),m(!1)},disabled:N=>c?N>c:!1,initialFocus:!0})})]})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx(We,{children:"End Date"}),t.jsxs(Ke,{open:h,onOpenChange:g,children:[t.jsx(Ve,{asChild:!0,children:t.jsxs(K,{variant:"outline",className:P("w-full justify-start text-left font-normal text-sm h-9",!c&&"text-muted-foreground"),children:[t.jsx(ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),c?oe(c,"MMM d, yyyy"):"Pick date"]})}),t.jsx(Ue,{className:"w-auto p-0",align:"start",children:t.jsx(lt,{mode:"single",selected:c,onSelect:N=>{u(N),g(!1)},disabled:N=>l?N<l:!1,initialFocus:!0})})]})]})]})]}),t.jsxs(zn,{children:[t.jsx(K,{type:"button",variant:"ghost",onClick:S,children:"Cancel"}),t.jsx(K,{type:"submit",disabled:!r.trim()||y.isPending,children:y.isPending?"Creating…":"Create Sprint"})]})]})]})})}const J0={active:{label:"Active",icon:ur,badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",section:"Active Sprint"},planned:{label:"Planned",icon:Qt,badge:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",section:"Planned"},completed:{label:"Completed",icon:js,badge:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",section:"Completed"}};function Z0({sprint:e,projectId:s,issueCount:n}){const r=pg(e.id,s),a=gg(s),o=J0[e.status],i=o.icon;function l(){r.mutate({status:"active"},{onSuccess:()=>I.success(`"${e.name}" started`),onError:()=>I.error("Failed to start sprint")})}function d(){r.mutate({status:"completed"},{onSuccess:()=>I.success(`"${e.name}" completed`),onError:m=>I.error((m==null?void 0:m.message)??"Failed to complete sprint")})}function c(){confirm(`Delete sprint "${e.name}"? This cannot be undone.`)&&a.mutate(e.id,{onSuccess:()=>I.success("Sprint deleted"),onError:()=>I.error("Failed to delete sprint")})}const u=!!e.start_date,f=!!e.end_date;return t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[t.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[t.jsx("div",{className:P("flex h-7 w-7 items-center justify-center rounded-full shrink-0",e.status==="active"?"bg-emerald-100 dark:bg-emerald-900/30":e.status==="completed"?"bg-blue-100 dark:bg-blue-900/30":"bg-zinc-100 dark:bg-zinc-800"),children:t.jsx(i,{className:P("h-3.5 w-3.5",e.status==="active"?"text-emerald-600 dark:text-emerald-400":e.status==="completed"?"text-blue-600 dark:text-blue-400":"text-zinc-500")})}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e.name}),e.goal&&t.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5 flex items-center gap-1",children:[t.jsx(Xm,{className:"h-3 w-3 shrink-0"}),e.goal]})]})]}),t.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 w-52",children:[t.jsx(xa,{className:"h-3.5 w-3.5 shrink-0"}),u||f?t.jsxs("span",{children:[u?oe(new Date(e.start_date),"MMM d"):"—"," → ",f?oe(new Date(e.end_date),"MMM d, yyyy"):"—"]}):t.jsx("span",{className:"italic",children:"No dates set"})]}),t.jsxs("div",{className:"text-xs text-muted-foreground shrink-0 w-20 text-right",children:[n," issue",n!==1?"s":""]}),t.jsx(Un,{className:P("shrink-0 text-[11px] border-0 w-20 justify-center",o.badge),children:o.label}),t.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.status==="planned"&&t.jsxs(K,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:l,disabled:r.isPending,children:[t.jsx(ur,{className:"h-3 w-3"}),"Start"]}),e.status==="active"&&t.jsxs(K,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:d,disabled:r.isPending,children:[t.jsx(js,{className:"h-3 w-3"}),"Complete"]}),t.jsx(K,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:c,disabled:a.isPending,children:t.jsx(Tt,{className:"h-3.5 w-3.5"})})]})]})}function ey(){const{projectKey:e}=Ge(),[s,n]=x.useState(!1),{data:r}=ws(e??""),a=(r==null?void 0:r.id)??"",{data:o,isLoading:i}=nn(a||void 0),{data:l}=Cn(a||void 0),d=(l??[]).reduce((f,m)=>(m.sprint_id&&(f[m.sprint_id]=(f[m.sprint_id]??0)+1),f),{}),c={active:(o??[]).filter(f=>f.status==="active"),planned:(o??[]).filter(f=>f.status==="planned"),completed:(o??[]).filter(f=>f.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 t.jsxs("div",{className:"p-2",children:[t.jsx(tt,{zone:"project.sprints.before",props:{projectId:a}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:t.jsxs(K,{size:"sm",onClick:()=>n(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"New Sprint"]})}),i?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(f=>t.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[t.jsx(te,{className:"h-7 w-7 rounded-full"}),t.jsx(te,{className:"h-4 w-40"}),t.jsx("div",{className:"flex-1"}),t.jsx(te,{className:"h-4 w-32"}),t.jsx(te,{className:"h-5 w-20"})]},f))}):(o??[]).length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xa,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No sprints yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a sprint to start planning your work in time-boxed iterations."}),t.jsxs(K,{size:"sm",onClick:()=>n(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"New Sprint"]})]}):t.jsx("div",{children:u.map(({key:f,label:m,items:h})=>h.length===0?null:t.jsxs("div",{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:m})}),t.jsx("div",{className:"divide-y divide-border",children:h.map(g=>t.jsx(Z0,{sprint:g,projectId:a,issueCount:d[g.id]??0},g.id))})]},f))})]}),t.jsx(tt,{zone:"project.sprints.after",props:{projectId:a}}),t.jsx(X0,{open:s,onClose:()=>n(!1),projectId:a})]})}const Ls={all:["roles"],list:()=>[...Ls.all,"list"],detail:e=>[...Ls.all,e]};function io(){return Ne({queryKey:Ls.list(),queryFn:()=>J.get("/admin/roles"),select:e=>e.roles,staleTime:1e3*60*2})}function ty(){const e=ue();return de({mutationFn:s=>J.post("/admin/roles",s),onSuccess:()=>{e.invalidateQueries({queryKey:Ls.list()})}})}function sy(e){const s=ue();return de({mutationFn:n=>J.put(`/admin/roles/${e}`,n),onSuccess:()=>{s.invalidateQueries({queryKey:Ls.list()})}})}function ny(){const e=ue();return de({mutationFn:s=>J.delete(`/admin/roles/${s}`),onSuccess:()=>{e.invalidateQueries({queryKey:Ls.list()})}})}function ry(){const e=ue();return de({mutationFn:({userId:s,appRoleId:n})=>J.patch(`/admin/users/${s}/role`,{app_role_id:n}),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}const nr=[{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 lo({value:e,className:s}){const[n,r]=x.useState(!1),a=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)};return t.jsx("button",{onClick:a,className:P("text-muted-foreground hover:text-foreground transition-colors",s),title:"Copy",children:n?t.jsx(it,{className:"h-3.5 w-3.5 text-emerald-500"}):t.jsx(Dm,{className:"h-3.5 w-3.5"})})}function Qo({value:e,onChange:s,appRoles:n}){return t.jsxs(we,{value:e,onValueChange:s,children:[t.jsx(ve,{className:"h-9",children:t.jsx(Ee,{})}),t.jsxs(je,{children:[t.jsx(ce,{value:"__admin",children:t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(ka,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{children:"Admin"}),t.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"— Full workspace access"})]})}),n&&n.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-2 pt-2 pb-1",children:t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Roles"})}),n.map(r=>t.jsx(ce,{value:r.id,children:r.name},r.id))]})]})]})}function ay({open:e,onClose:s,workspaceId:n}){const[r,a]=x.useState("existing"),[o,i]=x.useState(""),[l,d]=x.useState(""),[c,u]=x.useState("__admin"),[f,m]=x.useState(""),[h,g]=x.useState("__admin"),[y,S]=x.useState(null),{data:b=[]}=fd(),{data:N=[]}=Tn(n),w=ff(n),j=uf(n),{data:E}=io(),p=x.useMemo(()=>new Set(N.map(_=>_.user_id)),[N]),C=x.useMemo(()=>b.filter(_=>!p.has(_.id)),[b,p]),$=x.useMemo(()=>{const _=o.toLowerCase().trim();return _?C.filter(R=>R.email.toLowerCase().includes(_)||`${R.first_name} ${R.last_name}`.toLowerCase().includes(_)):C},[C,o]);x.useEffect(()=>{if(e){const _=E&&E.length>0?E[0].id:"__admin";i(""),d(""),u(_),m(""),g(_),S(null),a("existing")}},[e,E]);const D=_=>{var R;return _==="__admin"?"Admin":((R=E==null?void 0:E.find(T=>T.id===_))==null?void 0:R.name)??"Member"},O=()=>{if(!l)return;const _=c==="__admin";w.mutate({user_id:l,role:_?"admin":"member"},{onSuccess:()=>{I.success("Member added"),s()},onError:R=>I.error(R.message||"Failed to add member")})},F=_=>{_.preventDefault();const R=h==="__admin";j.mutate({email:f.trim()||void 0,role:R?"admin":"member",app_role_id:R?null:h},{onSuccess:T=>{S(T.invitation),I.success("Invitation created")},onError:T=>I.error(T.message||"Failed to create invitation")})};return t.jsx(pr,{open:e,onOpenChange:_=>!_&&s(),children:t.jsxs(In,{className:"sm:max-w-[520px]",children:[t.jsx(gr,{children:t.jsx(br,{children:"Add member"})}),!y&&t.jsxs("div",{className:"flex rounded-lg border border-border p-0.5 bg-muted/40 gap-0.5",children:[t.jsx("button",{type:"button",onClick:()=>a("existing"),className:P("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"}),t.jsx("button",{type:"button",onClick:()=>a("invite"),className:P("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&&t.jsxs("div",{className:"space-y-3 pt-1",children:[t.jsx(xe,{placeholder:"Search by name or email…",value:o,onChange:_=>i(_.target.value),className:"h-9",autoFocus:!0}),t.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:C.length===0?t.jsxs("div",{className:"py-8 text-center px-4",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:"All users are already members."}),t.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"})]}):$.length===0?t.jsx("div",{className:"py-6 text-center",children:t.jsxs("p",{className:"text-sm text-muted-foreground",children:['No users match "',o,'"']})}):t.jsx("div",{className:"max-h-52 overflow-y-auto divide-y divide-border",children:$.map(_=>{const R=_.first_name??"",T=_.last_name??"",X=`${R} ${T}`.trim()||_.email,q=(R[0]??T[0]??_.email[0]??"U").toUpperCase(),V=l===_.id;return t.jsxs("button",{type:"button",onClick:()=>d(V?"":_.id),className:P("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:[t.jsx(st,{className:"h-7 w-7 shrink-0",children:t.jsx(nt,{className:"text-[11px] font-medium",children:q})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:X}),t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:_.email})]}),V&&t.jsx(it,{className:"h-4 w-4 text-indigo shrink-0"})]},_.id)})})}),C.length>0&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),t.jsx(Qo,{value:c,onChange:u,appRoles:E})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),t.jsx(K,{type:"button",size:"sm",disabled:!l||w.isPending,onClick:O,children:w.isPending?"Adding…":"Add to workspace"})]})]})]}),r==="invite"&&!y&&t.jsxs("form",{onSubmit:F,className:"space-y-4 pt-1",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Email ",t.jsx("span",{className:"font-normal",children:"(optional)"})]}),t.jsx(xe,{type:"email",placeholder:"colleague@example.com",value:f,onChange:_=>m(_.target.value),className:"h-9",autoFocus:!0}),t.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Leave blank to generate a shareable link."})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),t.jsx(Qo,{value:h,onChange:g,appRoles:E})]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),t.jsx(K,{type:"submit",size:"sm",disabled:j.isPending,children:j.isPending?"Creating…":"Create invitation"})]})]}),y&&t.jsxs("div",{className:"space-y-4 pt-1",children:[t.jsxs("p",{className:"text-sm text-muted-foreground",children:["Share this link with"," ",y.email?t.jsx("span",{className:"font-medium text-foreground",children:y.email}):"anyone you want to invite",". They will join as"," ",t.jsx("span",{className:"font-medium text-foreground",children:D(h)}),"."]}),t.jsxs("div",{className:"flex items-start gap-2 p-3 bg-muted/50 rounded-lg border border-border",children:[t.jsx(ja,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5"}),t.jsx("span",{className:"text-xs font-mono text-foreground flex-1 min-w-0 break-all",children:`${window.location.origin}/invite/${y.token}`}),t.jsx(lo,{value:`${window.location.origin}/invite/${y.token}`,className:"shrink-0"})]}),t.jsxs("div",{className:"flex items-center justify-between pt-1",children:[t.jsx("button",{className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>S(null),children:"Create another"}),t.jsx(K,{size:"sm",onClick:s,children:"Done"})]})]})]})})}function oy({invitation:e,workspaceId:s}){const n=mf(s),r=`${window.location.origin}/invite/${e.token}`;return t.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:[t.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:t.jsx(ja,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:e.email??"Shareable link"}),t.jsx("span",{className:P("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",e.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:e.role==="admin"?"Admin":"Member"})]}),t.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[t.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[280px]",children:r}),t.jsx(lo,{value:r})]})]}),t.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[t.jsx("span",{className:"text-xs text-muted-foreground hidden sm:block",children:oe(new Date(e.created_at),"MMM d")}),t.jsx("button",{onClick:()=>n.mutate(e.id,{onSuccess:()=>I.success("Invitation revoked"),onError:()=>I.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:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]})]})}function iy({workspaceId:e}){const{workspace:s,setWorkspace:n}=ke(),{data:r,isLoading:a}=fr(),o=r==null?void 0:r.find(f=>f.id===(s==null?void 0:s.id)),i=df(e),[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:f=>{n({id:f.workspace.id,name:f.workspace.name,slug:f.workspace.slug}),I.success("Workspace updated")},onError:()=>I.error("Failed to update workspace")})};return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:t.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Workspace details"})}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Name"}),a?t.jsx(te,{className:"h-8 w-64"}):t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(xe,{value:l,onChange:f=>d(f.target.value),className:"h-8 w-64 text-sm bg-transparent",placeholder:"Workspace name"}),c&&t.jsx(K,{size:"sm",className:"h-8",onClick:u,disabled:!l.trim()||i.isPending,children:i.isPending?"Saving…":"Save"})]})]}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"URL slug"}),a?t.jsx(te,{className:"h-4 w-40"}):t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsx("span",{className:"font-mono text-foreground",children:o==null?void 0:o.slug}),t.jsx(lo,{value:(o==null?void 0:o.slug)??""})]})]}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5 border-b border-border",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Plan"}),a?t.jsx(te,{className:"h-4 w-16"}):t.jsx("span",{className:"text-sm capitalize",children:(o==null?void 0:o.plan)??"free"})]}),t.jsxs("div",{className:"grid grid-cols-[180px_1fr] items-center gap-4 px-6 py-3.5",children:[t.jsx("span",{className:"text-sm text-muted-foreground",children:"Created"}),a?t.jsx(te,{className:"h-4 w-28"}):t.jsx("span",{className:"text-sm text-muted-foreground",children:o!=null&&o.created_at?oe(new Date(o.created_at),"MMMM d, yyyy"):"—"})]})]})}function ly({workspaceId:e,onInvite:s}){const{data:n,isLoading:r}=Tn(e),{data:a,isLoading:o}=cf(e),i=hf(e),l=xf(e),d=ry(),{data:c}=io(),{user:u}=ke(),f=(a==null?void 0:a.filter(m=>m.status==="pending"))??[];return t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:t.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Members",!r&&n&&t.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",n.length]})]})}),r?t.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(m=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3.5 w-32"}),t.jsx(te,{className:"h-3 w-48"})]})]},m))}):n!=null&&n.length?t.jsx("div",{className:"divide-y divide-border",children:n.map(m=>{var w;const h=m.user,g=(h==null?void 0:h.first_name)??"",y=(h==null?void 0:h.last_name)??"",S=`${g} ${y}`.trim()||(h==null?void 0:h.email)||"Unknown",b=(g[0]??y[0]??((w=h==null?void 0:h.email)==null?void 0:w[0])??"U").toUpperCase(),N=(h==null?void 0:h.id)===(u==null?void 0:u.id);return t.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:[t.jsx(st,{className:"h-7 w-7 shrink-0",children:t.jsx(nt,{className:"text-[11px] font-medium",children:b})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:S}),N&&t.jsx("span",{className:"text-[11px] text-muted-foreground",children:"(you)"})]}),(h==null?void 0:h.email)&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:h.email})]}),t.jsx("span",{className:P("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",m.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:m.role==="admin"?"Admin":"Member"}),c&&c.length>0&&t.jsxs(we,{value:m.app_role_id??"none",onValueChange:j=>d.mutate({userId:m.user_id,appRoleId:j==="none"?null:j},{onSuccess:()=>I.success("Custom role updated"),onError:()=>I.error("Failed to update custom role")}),children:[t.jsx(ve,{className:"h-7 text-[11px] w-32 shrink-0",children:t.jsx(Ee,{placeholder:"Custom role"})}),t.jsxs(je,{children:[t.jsx(ce,{value:"none",children:t.jsx("span",{className:"text-muted-foreground",children:"No custom role"})}),c.map(j=>t.jsx(ce,{value:j.id,children:j.name},j.id))]})]}),!N&&t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:t.jsx(Dn,{className:"h-4 w-4"})})}),t.jsxs(Xt,{align:"end",className:"w-40",children:[t.jsx(Je,{onClick:()=>i.mutate({userId:m.user_id,role:m.role==="admin"?"member":"admin"},{onSuccess:()=>I.success("Role updated"),onError:()=>I.error("Failed to update role")}),children:m.role==="admin"?t.jsxs(t.Fragment,{children:[t.jsx(vl,{className:"h-3.5 w-3.5 mr-2"}),"Make member"]}):t.jsxs(t.Fragment,{children:[t.jsx(ka,{className:"h-3.5 w-3.5 mr-2"}),"Make admin"]})}),t.jsx(An,{}),t.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>l.mutate(m.user_id,{onSuccess:()=>I.success("Member removed"),onError:()=>I.error("Failed to remove member")}),children:[t.jsx(Tt,{className:"h-3.5 w-3.5 mr-2"}),"Remove"]})]})]})]},m.id)})}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(rf,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No members yet"}),t.jsx("button",{onClick:s,className:"text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}),t.jsxs("div",{className:"px-6 py-2 border-t border-b border-border bg-muted/20 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Pending invitations",!o&&f.length>0&&t.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",f.length]})]}),t.jsxs("button",{onClick:s,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3 w-3"}),"Invite"]})]}),o?t.jsx("div",{className:"divide-y divide-border",children:[1,2].map(m=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[t.jsx(te,{className:"h-7 w-7 rounded-full shrink-0"}),t.jsxs("div",{className:"flex-1 space-y-1.5",children:[t.jsx(te,{className:"h-3.5 w-48"}),t.jsx(te,{className:"h-3 w-64"})]})]},m))}):f.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[t.jsx("p",{className:"text-sm text-muted-foreground",children:"No pending invitations."}),t.jsx("button",{onClick:s,className:"mt-2 text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}):t.jsx("div",{className:"divide-y divide-border",children:f.map(m=>t.jsx(oy,{invitation:m,workspaceId:e},m.id))})]})}function dy({workspaceId:e,teamId:s,allMembers:n}){const{data:r,isLoading:a}=bf(e,s),o=yf(e,s),i=vf(e,s),[l,d]=x.useState(""),c=new Set((r==null?void 0:r.map(f=>f.user_id))??[]),u=n.filter(f=>!c.has(f.user_id));return t.jsxs("div",{className:"bg-muted/10 border-t border-border",children:[a?t.jsx("div",{className:"px-8 py-3",children:t.jsx(te,{className:"h-3 w-40"})}):(r==null?void 0:r.length)===0?t.jsx("p",{className:"px-8 py-3 text-xs text-muted-foreground",children:"No members in this team yet."}):t.jsx("div",{className:"divide-y divide-border/50",children:r==null?void 0:r.map(f=>{var b;const m=f.user,h=(m==null?void 0:m.first_name)??"",g=(m==null?void 0:m.last_name)??"",y=`${h} ${g}`.trim()||(m==null?void 0:m.email)||"Unknown",S=(h[0]??g[0]??((b=m==null?void 0:m.email)==null?void 0:b[0])??"U").toUpperCase();return t.jsxs("div",{className:"flex items-center gap-3 px-8 py-2.5 group hover:bg-muted/20 transition-colors",children:[t.jsx(st,{className:"h-6 w-6 shrink-0",children:t.jsx(nt,{className:"text-[10px] font-medium",children:S})}),t.jsx("span",{className:"flex-1 text-sm truncate",children:y}),t.jsx("button",{onClick:()=>i.mutate(f.user_id,{onSuccess:()=>I.success("Removed from team"),onError:()=>I.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Remove from team",children:t.jsx(Fe,{className:"h-3.5 w-3.5"})})]},f.id)})}),u.length>0&&t.jsxs("div",{className:"px-8 py-2.5 flex items-center gap-2 border-t border-border/50",children:[t.jsx(On,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs(we,{value:l,onValueChange:d,children:[t.jsx(ve,{className:"h-7 text-xs flex-1 max-w-[200px]",children:t.jsx(Ee,{placeholder:"Add member…"})}),t.jsx(je,{children:u.map(f=>{const m=f.user,h=(m==null?void 0:m.first_name)??"",g=(m==null?void 0:m.last_name)??"",y=`${h} ${g}`.trim()||(m==null?void 0:m.email)||"Unknown";return t.jsx(ce,{value:f.user_id,children:y},f.user_id)})})]}),l&&t.jsx(K,{size:"sm",className:"h-7 text-xs px-2",disabled:o.isPending,onClick:()=>o.mutate(l,{onSuccess:()=>{I.success("Added to team"),d("")},onError:()=>I.error("Failed to add")}),children:"Add"})]})]})}function cy({workspaceId:e}){const{data:s,isLoading:n}=Ca(e),{data:r}=Tn(e),a=pf(e),o=gf(e),[i,l]=x.useState(new Set),[d,c]=x.useState(!1),[u,f]=x.useState(""),m=g=>{l(y=>{const S=new Set(y);return S.has(g)?S.delete(g):S.add(g),S})},h=g=>{g.preventDefault(),u.trim()&&a.mutate({name:u.trim()},{onSuccess:()=>{I.success("Team created"),f(""),c(!1)},onError:()=>I.error("Failed to create team")})};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:[t.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Teams",!n&&s&&t.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",s.length]})]}),t.jsxs("button",{onClick:()=>c(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[t.jsx(Ie,{className:"h-3 w-3"}),"New team"]})]}),d&&t.jsx("div",{className:"px-6 py-3 border-b border-border bg-muted/5",children:t.jsxs("form",{onSubmit:h,className:"flex items-center gap-2",children:[t.jsx(xe,{autoFocus:!0,placeholder:"Team name",value:u,onChange:g=>f(g.target.value),className:"h-8 text-sm flex-1 max-w-[240px]"}),t.jsx(K,{type:"submit",size:"sm",className:"h-8",disabled:!u.trim()||a.isPending,children:a.isPending?"Creating…":"Create"}),t.jsx(K,{type:"button",variant:"ghost",size:"sm",className:"h-8",onClick:()=>{c(!1),f("")},children:"Cancel"})]})}),n?t.jsx("div",{className:"divide-y divide-border",children:[1,2].map(g=>t.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[t.jsx(te,{className:"h-7 w-7 rounded-lg shrink-0"}),t.jsx(te,{className:"h-3.5 w-32"})]},g))}):s!=null&&s.length?t.jsx("div",{className:"divide-y divide-border",children:s.map(g=>{const y=i.has(g.id);return t.jsxs("div",{children:[t.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:[t.jsx("button",{onClick:()=>m(g.id),className:"text-muted-foreground hover:text-foreground shrink-0 transition-colors",children:y?t.jsx(Vs,{className:"h-4 w-4"}):t.jsx(Gs,{className:"h-4 w-4"})}),t.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:t.jsx(xs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),t.jsxs("div",{className:"flex-1 min-w-0",children:[t.jsx("p",{className:"text-sm font-medium truncate",children:g.name}),g.description&&t.jsx("p",{className:"text-xs text-muted-foreground truncate",children:g.description})]}),t.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[g.member_count," ",g.member_count===1?"member":"members"]}),t.jsxs(Ns,{children:[t.jsx(ks,{asChild:!0,children:t.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:t.jsx(Dn,{className:"h-4 w-4"})})}),t.jsx(Xt,{align:"end",className:"w-36",children:t.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>o.mutate(g.id,{onSuccess:()=>I.success("Team deleted"),onError:()=>I.error("Failed to delete team")}),children:[t.jsx(Tt,{className:"h-3.5 w-3.5 mr-2"}),"Delete team"]})})]})]}),y&&t.jsx(dy,{workspaceId:e,teamId:g.id,allMembers:r??[]})]},g.id)})}):t.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[t.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:t.jsx(xs,{className:"h-5 w-5 text-muted-foreground"})}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"No teams yet"}),t.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Teams make it easy to grant project access to groups of people."}),t.jsx(K,{variant:"outline",size:"sm",onClick:()=>c(!0),children:"Create a team"})]})]})}const uy=["general","members","teams"];function my(){const{workspace:e}=ke(),s=(e==null?void 0:e.id)??"",[n,r]=ti(),a=n.get("tab"),[o,i]=x.useState(uy.includes(a)?a:"general"),l=u=>{i(u),r({tab:u},{replace:!0})},[d,c]=x.useState(!1);return t.jsxs("div",{className:"p-2",children:[t.jsx(tt,{zone:"workspace.settings.before",props:{workspaceId:s}}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2",children:[t.jsx("div",{className:"flex",children:["general","members","teams"].map(u=>t.jsx("button",{onClick:()=>l(u),className:P("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"&&t.jsxs(K,{size:"sm",onClick:()=>c(!0),children:[t.jsx(Ie,{className:"h-4 w-4"}),"Add member"]})]}),o==="general"&&t.jsx(iy,{workspaceId:s}),o==="members"&&t.jsx(ly,{workspaceId:s,onInvite:()=>c(!0)}),o==="teams"&&t.jsx(cy,{workspaceId:s})]}),t.jsx(tt,{zone:"workspace.settings.after",props:{workspaceId:s}}),t.jsx(ay,{open:d,onClose:()=>c(!1),workspaceId:s})]})}function fy({open:e,onClose:s}){const[n,r]=x.useState(""),[a,o]=x.useState(""),[i,l]=x.useState(new Set),d=ty();x.useEffect(()=>{e&&(r(""),o(""),l(new Set))},[e]);const c=nr.flatMap(y=>y.permissions.map(S=>S.key)),u=c.every(y=>i.has(y)),f=!u&&c.some(y=>i.has(y)),m=()=>{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:()=>{I.success("Role created"),s()},onError:S=>I.error(S.message||"Failed to create role")})};return t.jsx(pr,{open:e,onOpenChange:y=>!y&&s(),children:t.jsxs(In,{className:"sm:max-w-[580px] max-h-[85vh] overflow-y-auto",children:[t.jsxs(gr,{children:[t.jsx(br,{children:"Create role"}),t.jsx(Rl,{children:"Define a new custom role with a specific permission set."})]}),t.jsxs("form",{onSubmit:g,className:"space-y-5 pt-2",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),t.jsx(xe,{value:n,onChange:y=>r(y.target.value),placeholder:"e.g. Developer, PM, Viewer",className:"h-9",autoFocus:!0,required:!0})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Description ",t.jsx("span",{className:"font-normal",children:"(optional)"})]}),t.jsx(xe,{value:a,onChange:y=>o(y.target.value),placeholder:"What is this role for?",className:"h-9"})]}),t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),t.jsx("button",{type:"button",onClick:m,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:u?"Deselect all":"Select all"})]}),nr.map(y=>t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:y.group}),t.jsx("div",{className:"space-y-1.5",children:y.permissions.map(S=>t.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[t.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"}),t.jsx("span",{className:"text-sm group-hover:text-foreground text-muted-foreground transition-colors",children:S.label})]},S.key))})]},y.group))]}),t.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[t.jsx(K,{type:"button",variant:"outline",size:"sm",onClick:s,children:"Cancel"}),t.jsx(K,{type:"submit",size:"sm",disabled:!n.trim()||d.isPending,children:d.isPending?"Creating…":"Create role"})]})]})]})})}function hy({role:e,onDeleted:s}){const[n,r]=x.useState(e.name),[a,o]=x.useState(e.description??""),[i,l]=x.useState(new Set(e.permissions)),[d,c]=x.useState(!1),u=sy(e.id),f=ny();x.useEffect(()=>{r(e.name),o(e.description??""),l(new Set(e.permissions))},[e.id,e.name,e.description,e.permissions]);const m=n!==e.name||a!==(e.description??"")||i.size!==e.permissions.length||Array.from(i).some(j=>!e.permissions.includes(j)),h=nr.flatMap(j=>j.permissions.map(E=>E.key)),g=h.every(j=>i.has(j)),y=!g&&h.some(j=>i.has(j)),S=()=>{l(g?new Set:new Set(h))},b=j=>{l(E=>{const p=new Set(E);return p.has(j)?p.delete(j):p.add(j),p})},N=()=>{u.mutate({name:n.trim(),description:a.trim()||void 0,permissions:Array.from(i)},{onSuccess:()=>I.success("Role saved"),onError:j=>I.error(j.message||"Failed to save role")})},w=()=>{f.mutate(e.id,{onSuccess:()=>{I.success("Role deleted"),s(),c(!1)},onError:j=>I.error(j.message||"Failed to delete role")})};return t.jsxs("div",{className:"flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("h2",{className:"text-sm font-semibold",children:e.name}),e.is_system&&t.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:[t.jsx(dr,{className:"h-3 w-3"}),"System"]})]}),!e.is_system&&t.jsx("button",{onClick:()=>c(!0),className:"text-muted-foreground hover:text-destructive transition-colors",title:"Delete role",children:t.jsx(Tt,{className:"h-4 w-4"})})]}),t.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-5",children:[t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),t.jsx(xe,{value:n,onChange:j=>r(j.target.value),className:"h-8 text-sm"})]}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),t.jsx(xe,{value:a,onChange:j=>o(j.target.value),placeholder:"What is this role for?",className:"h-8 text-sm"})]}),t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),t.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"})]}),nr.map(j=>t.jsxs("div",{children:[t.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:j.group}),t.jsx("div",{className:"space-y-2",children:j.permissions.map(E=>t.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[t.jsx("input",{type:"checkbox",checked:i.has(E.key),onChange:()=>b(E.key),className:"h-3.5 w-3.5 rounded border-border accent-foreground cursor-pointer"}),t.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:E.label})]},E.key))})]},j.group))]}),t.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-border flex justify-end",children:t.jsx(K,{size:"sm",onClick:N,disabled:!m||!n.trim()||u.isPending,children:u.isPending?"Saving…":"Save changes"})}),t.jsx(dc,{open:d,onOpenChange:c,children:t.jsxs(eo,{children:[t.jsxs(to,{children:[t.jsxs(no,{children:['Delete "',e.name,'"?']}),t.jsx(ro,{children:"This role will be removed from all users assigned to it. This action cannot be undone."})]}),t.jsxs(so,{children:[t.jsx(oo,{children:"Cancel"}),t.jsx(ao,{onClick:w,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function xy(){const{data:e,isLoading:s}=io(),[n,r]=x.useState(null),[a,o]=x.useState(!1),i=(e==null?void 0:e.filter(c=>c.is_system))??[],l=(e==null?void 0:e.filter(c=>!c.is_system))??[];x.useEffect(()=>{e&&e.length>0&&!n&&r(e[0].id)},[e]);const d=(e==null?void 0:e.find(c=>c.id===n))??null;return t.jsx("div",{className:"p-2 h-full",children:t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[t.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[t.jsxs("div",{className:"flex items-center gap-3",children:[t.jsx(ea,{className:"h-5 w-5 text-muted-foreground"}),t.jsxs("div",{children:[t.jsx("h1",{className:"text-base font-semibold",children:"Roles & Permissions"}),t.jsx("p",{className:"text-xs text-muted-foreground",children:"Define what users with each custom role can do across the application."})]})]}),t.jsxs(K,{size:"sm",onClick:()=>o(!0),children:[t.jsx(Ie,{className:"h-4 w-4 mr-1.5"}),"Create role"]})]}),t.jsxs("div",{className:"flex flex-1 min-h-0",children:[t.jsx("div",{className:"w-56 shrink-0 border-r border-border flex flex-col overflow-y-auto",children:s?t.jsx("div",{className:"p-4 space-y-2",children:[1,2,3].map(c=>t.jsx(te,{className:"h-8 w-full"},c))}):t.jsxs(t.Fragment,{children:[i.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"px-3 pt-3 pb-1",children:t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"System Roles"})}),i.map(c=>t.jsxs("button",{onClick:()=>r(c.id),className:P("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:[t.jsx(dr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate",children:c.name})]},c.id))]}),l.length>0&&t.jsxs("div",{children:[t.jsx("div",{className:"px-3 pt-3 pb-1",children:t.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom Roles"})}),l.map(c=>t.jsxs("button",{onClick:()=>r(c.id),className:P("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:[t.jsx("div",{className:"h-3 w-3 shrink-0"}),t.jsx("span",{className:"truncate",children:c.name})]},c.id))]}),!s&&(!e||e.length===0)&&t.jsx("div",{className:"flex flex-col items-center justify-center py-10 px-3 text-center",children:t.jsx("p",{className:"text-xs text-muted-foreground",children:"No roles yet."})})]})}),t.jsx("div",{className:"flex-1 min-w-0",children:d?t.jsx(hy,{role:d,onDeleted:()=>{var u;const c=(e==null?void 0:e.filter(f=>f.id!==d.id))??[];r(((u=c[0])==null?void 0:u.id)??null)}},d.id):t.jsx("div",{className:"flex items-center justify-center h-full text-center p-8",children:t.jsxs("div",{children:[t.jsx(ea,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),t.jsx("p",{className:"text-sm font-medium mb-1",children:"Select a role to edit"}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Or"," ",t.jsx("button",{onClick:()=>o(!0),className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"create a new role"})]})]})})})]}),t.jsx(fy,{open:a,onClose:()=>o(!1)})]})})}function py(e){return Ne({queryKey:["invite",e],queryFn:()=>J.get(`/auth/invite/${e}`),retry:!1,enabled:!!e})}function gy(){const{token:e}=Ge(),{isAuthenticated:s}=ke(),n=He(),{data:r,isLoading:a,error:o}=py(e??""),i=Nf(e??""),[l,d]=x.useState(""),[c,u]=x.useState(""),[f,m]=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,N=w=>{w.preventDefault();const j=b??f.trim();if(!j){I.error("Email is required");return}i.mutate({email:j,password:h,first_name:l,last_name:c},{onSuccess:()=>{n(`/${r.workspace.slug}/projects`,{replace:!0})},onError:E=>I.error(E.message??"Registration failed")})};return t.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:t.jsxs("div",{className:"w-full max-w-[380px]",children:[t.jsx("div",{className:"flex justify-center mb-8",children:t.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:t.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:t.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:t.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}),a?t.jsxs("div",{className:"space-y-3",children:[t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-48 mx-auto"}),t.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-32 mx-auto"})]}):o?t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-3",children:[t.jsx("p",{className:"text-sm font-medium",children:"Invalid or expired invitation"}),t.jsx("p",{className:"text-sm text-muted-foreground",children:"This invite link is no longer valid. Ask for a new one."}),t.jsx(yn,{to:"/login",children:t.jsx(K,{variant:"outline",size:"sm",className:"mt-2",children:"Go to login"})})]}):r?t.jsxs("div",{className:"space-y-4",children:[t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[t.jsxs("div",{className:"px-5 py-4 border-b border-border",children:[t.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[t.jsx(Sm,{className:"h-3.5 w-3.5 text-muted-foreground"}),t.jsx("span",{className:"text-xs text-muted-foreground",children:"You've been invited to"})]}),t.jsx("p",{className:"text-base font-semibold",children:r.workspace.name})]}),t.jsxs("div",{className:"px-5 py-3 flex items-center gap-2.5",children:[r.invitation.role==="admin"?t.jsx(ka,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):t.jsx(vl,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:["Joining as"," ",t.jsx("span",{className:"font-medium text-foreground capitalize",children:r.invitation.role}),r.invitation.role==="admin"?" — full access":" — can view and edit"]})]})]}),t.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-5",children:[t.jsx("p",{className:"text-sm font-medium mb-4",children:"Create your account"}),t.jsxs("form",{onSubmit:N,className:"space-y-2",children:[t.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[t.jsx(xe,{placeholder:"First name",value:l,onChange:w=>d(w.target.value),required:!0,className:"h-9 bg-transparent",autoFocus:!0}),t.jsx(xe,{placeholder:"Last name",value:c,onChange:w=>u(w.target.value),required:!0,className:"h-9 bg-transparent"})]}),b?t.jsxs("div",{className:"relative",children:[t.jsx(xe,{type:"email",value:b,readOnly:!0,className:"h-9 bg-muted/50 text-muted-foreground cursor-not-allowed"}),t.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"})]}):t.jsx(xe,{type:"email",placeholder:"Email",value:f,onChange:w=>m(w.target.value),required:!0,className:"h-9 bg-transparent",autoComplete:"email"}),t.jsxs("div",{className:"relative",children:[t.jsx(xe,{type:y?"text":"password",placeholder:"Password (min. 8 characters)",value:h,onChange:w=>g(w.target.value),required:!0,minLength:8,className:"h-9 bg-transparent pr-10",autoComplete:"new-password"}),t.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?t.jsx(ya,{className:"h-4 w-4"}):t.jsx(_n,{className:"h-4 w-4"})})]}),t.jsx("div",{className:"pt-1",children:t.jsx(K,{type:"submit",className:"w-full h-9 font-medium",disabled:i.isPending,children:i.isPending?"Creating account…":"Accept invitation"})})]})]}),t.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Already have an account?"," ",t.jsx(yn,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]}):null]})})}const by=x.lazy(()=>Xc(()=>import("./ProjectTimelinePage-Cm6JeB53.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage})));function Xr({children:e}){const{isAuthenticated:s}=ke();return s?t.jsx(t.Fragment,{children:e}):t.jsx(As,{to:"/login",replace:!0})}function Xo({children:e}){const{isAuthenticated:s}=ke(),{data:n}=jl(),r=rr();return s?t.jsx(As,{to:"/",replace:!0}):n!=null&&n.needsSetup&&r.pathname==="/login"?t.jsx(As,{to:"/register",replace:!0}):n&&!n.needsSetup&&r.pathname==="/register"?t.jsx(As,{to:"/login",replace:!0}):t.jsx(t.Fragment,{children:e})}function yy(){const{workspace:e,setWorkspace:s}=ke(),n=He(),{data:r,isLoading:a}=fr(!e);return x.useEffect(()=>{if(e){n(`/${e.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})},[e,r,a,n,s]),t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function vy(){const{workspace:e}=Ge(),{workspace:s,setWorkspace:n}=ke();Cf();const r=He(),{data:a,isLoading:o,isFetching:i}=fr();return x.useEffect(()=>{if(o||!a)return;const l=a.find(d=>d.slug===e);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,e,o,i,s==null?void 0:s.id,r,n]),o||!s||s.slug!==e?t.jsx("div",{className:"min-h-screen flex items-center justify-center",children:t.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):t.jsxs(t.Fragment,{children:[t.jsx(hh,{}),t.jsx(Bh,{})]})}function jy(){return t.jsxs(pc,{children:[t.jsx($e,{path:"/login",element:t.jsx(Xo,{children:t.jsx(Yh,{})})}),t.jsx($e,{path:"/register",element:t.jsx(Xo,{children:t.jsx(Lh,{})})}),t.jsx($e,{path:"/invite/:token",element:t.jsx(gy,{})}),t.jsx($e,{path:"/setup",element:t.jsx(Xr,{children:t.jsx(Uh,{})})}),t.jsx($e,{index:!0,element:t.jsx(Xr,{children:t.jsx(yy,{})})}),t.jsxs($e,{path:"/:workspace",element:t.jsx(Xr,{children:t.jsx(vy,{})}),children:[t.jsx($e,{index:!0,element:t.jsx(As,{to:"projects",replace:!0})}),t.jsx($e,{path:"projects",element:t.jsx(rg,{})}),t.jsxs($e,{path:"projects/:projectKey",element:t.jsx(xh,{}),children:[t.jsx($e,{path:"board",element:t.jsx(g0,{})}),t.jsx($e,{path:"issues",element:t.jsx(b0,{})}),t.jsx($e,{path:"issues/new",element:t.jsx(K0,{})}),t.jsx($e,{path:"issues/:issueId",element:t.jsx(B0,{})}),t.jsx($e,{path:"sprints",element:t.jsx(ey,{})}),t.jsx($e,{path:"timeline",element:t.jsx(x.Suspense,{fallback:t.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:t.jsx(by,{})})}),t.jsx($e,{path:"access",element:t.jsx(F0,{})})]}),t.jsx($e,{path:"notifications",element:t.jsx(Q0,{})}),t.jsx($e,{path:"settings",element:t.jsx(my,{})}),t.jsx($e,{path:"roles",element:t.jsx(xy,{})})]}),t.jsx($e,{path:"*",element:t.jsx(As,{to:"/",replace:!0})})]})}window.__React=v;window.__ReactJsxRuntime=uc;const wy=new mc({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const n=await import("/admin-extensions.js");Array.isArray(n==null?void 0:n.default)&&(e=n.default)}catch{}zi(document.getElementById("root")).render(t.jsx(x.StrictMode,{children:t.jsx(gm,{widgets:[...of,...e],children:t.jsx(Ru,{children:t.jsxs(fc,{client:wy,children:[t.jsx(Iu,{children:t.jsx(Fu,{children:t.jsx(gc,{children:t.jsxs(fa,{delayDuration:300,children:[t.jsx(jy,{}),t.jsx(Su,{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"}}})]})})})}),t.jsx(Jc,{initialIsOpen:!1})]})})})}))})();export{I as A,K as B,Gs as C,Pe as D,J as E,Yd as I,Ie as P,tt as W,P as a,it as b,U as c,Ra as d,Nt as e,Hp as f,Fx as g,$a as h,Fa as i,Lp as j,oe as k,wn as l,Dy as m,Jt as n,Wx as o,Bx as p,Ux as q,id as r,eg as s,pe as t,rd as u,ws as v,Cn as w,sn as x,nn as y,Nr as z};