@meridianjs/admin-dashboard 1.4.0 → 1.5.0

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,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-Bivujl9c.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-CeigSZIw.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-BoEtjgAn.js","assets/WorkspaceReportingPage-B4AKtxT7.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-B29RPQsw.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-CeigSZIw.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-BoEtjgAn.js","assets/WorkspaceReportingPage-BEG8uFWZ.js"])))=>i.map(i=>d[i]);
2
2
  var pP=Object.defineProperty;var xP=(e,t,r)=>t in e?pP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var pm=(e,t,r)=>xP(e,typeof t!="symbol"?t+"":t,r);import{j as a,u as We,a as Se,b as be,R as gP,Q as vP,c as yP}from"./vendor-query-CaIGp3JB.js";import{a as Wp,c as B,r as h,b as bP,u as zt,d as ql,N as bn,e as pt,L as Ur,O as Hl,f as Kl,h as Vn,g as $a,R as wP,i as Ic,j as jP,k as Ye,B as NP}from"./vendor-react-Lycsri1F.js";import{C as Dj,R as kP,T as SP,P as CP,S as Up,a as Tj,O as gi,b as Yl,c as vi,d as Tu,e as co,D as uo,f as Gl,g as Ij,h as Rj,i as _P,j as $j,I as zj,k as Lj,l as Fj,m as Bj,L as Wj,n as Uj,o as MP,p as OP,q as qj,r as Hj,F as Kj,u as Bi,t as ws,s as PP,v as Yj,w as Gj,x as EP,y as Vj,z as Xj,A as AP,B as Qj,V as DP,E as Zj,G as Jj,H as TP,J as IP,K as e1,M as RP,N as $P,Q as zP,U as t1,W as LP,X as FP,Y as r1,Z as Iu,_ as BP,$ as Ls,a0 as WP,a1 as UP,a2 as n1,a3 as qP,a4 as HP,a5 as a1,a6 as KP,a7 as YP,a8 as s1,a9 as GP,aa as VP,ab as XP,ac as QP,ad as ZP,ae as JP,af as eE,ag as tE,ah as rE,ai as nE,aj as aE,ak as i1,al as sE,am as iE,an as oE,ao as lE,ap as cE,aq as dE}from"./vendor-radix-CeigSZIw.js";import{u as o1,a as qp,P as l1,D as pl,S as Hp,h as c1,b as pd,c as Kp,C as Yp,d as uE,v as fE,r as mE,p as hE,e as pE,f as xE,M as gE,g as d1}from"./vendor-dnd-DuI-3XLF.js";import{P as u1,a as vE,D as yE,b as bE,e as wE,N as jE,c as NE,d as kE,m as Rc,E as SE,u as f1,i as m1,f as h1,g as p1,h as x1,j as CE,k as _E,w as ME}from"./vendor-editor-BoEtjgAn.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))n(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function r(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(s){if(s.ep)return;s.ep=!0;const i=r(s);fetch(s.href,i)}})();var g1,Fv=Wp;g1=Fv.createRoot,Fv.hydrateRoot;const OE="modulepreload",PE=function(e){return"/"+e},Bv={},v1=function(t,r,n){let s=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(r.map(c=>{if(c=PE(c),c in Bv)return;Bv[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const f=document.createElement("link");if(f.rel=d?"stylesheet":OE,d||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),d)return new Promise((m,p)=>{f.addEventListener("load",m),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};var EE=function(){return null},AE=e=>{switch(e){case"success":return IE;case"info":return $E;case"warning":return RE;case"error":return zE;default:return null}},DE=Array(12).fill(0),TE=({visible:e,className:t})=>B.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},B.createElement("div",{className:"sonner-spinner"},DE.map((r,n)=>B.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),IE=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.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"})),RE=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},B.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"})),$E=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.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"})),zE=B.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},B.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"})),LE=B.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"},B.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),B.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),FE=()=>{let[e,t]=B.useState(document.hidden);return B.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},bh=1,BE=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:r,...n}=e,s=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:bh++,i=this.toasts.find(l=>l.id===s),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...e,id:s,title:r}),{...l,...e,id:s,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:s}),s},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(r=>r({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let r;t.loading!==void 0&&(r=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let n=e instanceof Promise?e:e(),s=r!==void 0,i,o=n.then(async c=>{if(i=["resolve",c],B.isValidElement(c))s=!1,this.create({id:r,type:"default",message:c});else if(UE(c)&&!c.ok){s=!1;let d=typeof t.error=="function"?await t.error(`HTTP error! status: ${c.status}`):t.error,u=typeof t.description=="function"?await t.description(`HTTP error! status: ${c.status}`):t.description;this.create({id:r,type:"error",message:d,description:u})}else if(t.success!==void 0){s=!1;let d=typeof t.success=="function"?await t.success(c):t.success,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],t.error!==void 0){s=!1;let d=typeof t.error=="function"?await t.error(c):t.error,u=typeof t.description=="function"?await t.description(c):t.description;this.create({id:r,type:"error",message:d,description:u})}}).finally(()=>{var c;s&&(this.dismiss(r),r=void 0),(c=t.finally)==null||c.call(t)}),l=()=>new Promise((c,d)=>o.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof r!="string"&&typeof r!="number"?{unwrap:l}:Object.assign(r,{unwrap:l})},this.custom=(e,t)=>{let r=(t==null?void 0:t.id)||bh++;return this.create({jsx:e(r),id:r,...t}),r},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},zr=new BE,WE=(e,t)=>{let r=(t==null?void 0:t.id)||bh++;return zr.addToast({title:e,...t,id:r}),r},UE=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",qE=WE,HE=()=>zr.toasts,KE=()=>zr.getActiveToasts(),q=Object.assign(qE,{success:zr.success,info:zr.info,warning:zr.warning,error:zr.error,custom:zr.custom,message:zr.message,promise:zr.promise,dismiss:zr.dismiss,loading:zr.loading},{getHistory:HE,getToasts:KE});function YE(e,{insertAt:t}={}){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",t==="top"&&r.firstChild?r.insertBefore(n,r.firstChild):r.appendChild(n),n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e))}YE(`: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
3
  `);function $c(e){return e.label!==void 0}var GE=3,VE="32px",XE="16px",Wv=4e3,QE=356,ZE=14,JE=20,eA=200;function vn(...e){return e.filter(Boolean).join(" ")}function tA(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var rA=e=>{var t,r,n,s,i,o,l,c,d,u,f;let{invert:m,toast:p,unstyled:x,interacting:g,setHeights:v,visibleToasts:y,heights:j,index:N,toasts:w,expanded:k,removeToast:b,defaultRichColors:C,closeButton:_,style:S,cancelButtonStyle:I,actionButtonStyle:E,className:O="",descriptionClassName:F="",duration:D,position:U,gap:M,loadingIcon:H,expandByDefault:re,classNames:J,icons:R,closeButtonAriaLabel:A="Close toast",pauseWhenPageIsHidden:z}=e,[K,X]=B.useState(null),[G,T]=B.useState(null),[P,Z]=B.useState(!1),[L,Y]=B.useState(!1),[ae,ee]=B.useState(!1),[se,V]=B.useState(!1),[ie,he]=B.useState(!1),[xe,ve]=B.useState(0),[Q,ge]=B.useState(0),De=B.useRef(p.duration||D||Wv),Ue=B.useRef(null),Fe=B.useRef(null),Ve=N===0,ut=N+1<=y,Ke=p.type,Ze=p.dismissible!==!1,tr=p.className||"",Ir=p.descriptionClassName||"",rr=B.useMemo(()=>j.findIndex(de=>de.toastId===p.id)||0,[j,p.id]),vr=B.useMemo(()=>{var de;return(de=p.closeButton)!=null?de:_},[p.closeButton,_]),nr=B.useMemo(()=>p.duration||D||Wv,[p.duration,D]),yt=B.useRef(0),Lt=B.useRef(0),Kt=B.useRef(0),ar=B.useRef(null),[Rn,ua]=U.split("-"),Oe=B.useMemo(()=>j.reduce((de,_e,Te)=>Te>=rr?de:de+_e.height,0),[j,rr]),pe=FE(),Ne=p.invert||m,me=Ke==="loading";Lt.current=B.useMemo(()=>rr*M+Oe,[rr,Oe]),B.useEffect(()=>{De.current=nr},[nr]),B.useEffect(()=>{Z(!0)},[]),B.useEffect(()=>{let de=Fe.current;if(de){let _e=de.getBoundingClientRect().height;return ge(_e),v(Te=>[{toastId:p.id,height:_e,position:p.position},...Te]),()=>v(Te=>Te.filter(bt=>bt.toastId!==p.id))}},[v,p.id]),B.useLayoutEffect(()=>{if(!P)return;let de=Fe.current,_e=de.style.height;de.style.height="auto";let Te=de.getBoundingClientRect().height;de.style.height=_e,ge(Te),v(bt=>bt.find(rt=>rt.toastId===p.id)?bt.map(rt=>rt.toastId===p.id?{...rt,height:Te}:rt):[{toastId:p.id,height:Te,position:p.position},...bt])},[P,p.title,p.description,v,p.id]);let ye=B.useCallback(()=>{Y(!0),ve(Lt.current),v(de=>de.filter(_e=>_e.toastId!==p.id)),setTimeout(()=>{b(p)},eA)},[p,b,v,Lt]);B.useEffect(()=>{if(p.promise&&Ke==="loading"||p.duration===1/0||p.type==="loading")return;let de;return k||g||z&&pe?(()=>{if(Kt.current<yt.current){let _e=new Date().getTime()-yt.current;De.current=De.current-_e}Kt.current=new Date().getTime()})():De.current!==1/0&&(yt.current=new Date().getTime(),de=setTimeout(()=>{var _e;(_e=p.onAutoClose)==null||_e.call(p,p),ye()},De.current)),()=>clearTimeout(de)},[k,g,p,Ke,z,pe,ye]),B.useEffect(()=>{p.delete&&ye()},[ye,p.delete]);function Xe(){var de,_e,Te;return R!=null&&R.loading?B.createElement("div",{className:vn(J==null?void 0:J.loader,(de=p==null?void 0:p.classNames)==null?void 0:de.loader,"sonner-loader"),"data-visible":Ke==="loading"},R.loading):H?B.createElement("div",{className:vn(J==null?void 0:J.loader,(_e=p==null?void 0:p.classNames)==null?void 0:_e.loader,"sonner-loader"),"data-visible":Ke==="loading"},H):B.createElement(TE,{className:vn(J==null?void 0:J.loader,(Te=p==null?void 0:p.classNames)==null?void 0:Te.loader),visible:Ke==="loading"})}return B.createElement("li",{tabIndex:0,ref:Fe,className:vn(O,tr,J==null?void 0:J.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,J==null?void 0:J.default,J==null?void 0:J[Ke],(r=p==null?void 0:p.classNames)==null?void 0:r[Ke]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:C,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":P,"data-promise":!!p.promise,"data-swiped":ie,"data-removed":L,"data-visible":ut,"data-y-position":Rn,"data-x-position":ua,"data-index":N,"data-front":Ve,"data-swiping":ae,"data-dismissible":Ze,"data-type":Ke,"data-invert":Ne,"data-swipe-out":se,"data-swipe-direction":G,"data-expanded":!!(k||re&&P),style:{"--index":N,"--toasts-before":N,"--z-index":w.length-N,"--offset":`${L?xe:Lt.current}px`,"--initial-height":re?"auto":`${Q}px`,...S,...p.style},onDragEnd:()=>{ee(!1),X(null),ar.current=null},onPointerDown:de=>{me||!Ze||(Ue.current=new Date,ve(Lt.current),de.target.setPointerCapture(de.pointerId),de.target.tagName!=="BUTTON"&&(ee(!0),ar.current={x:de.clientX,y:de.clientY}))},onPointerUp:()=>{var de,_e,Te,bt;if(se||!Ze)return;ar.current=null;let rt=Number(((de=Fe.current)==null?void 0:de.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),nt=Number(((_e=Fe.current)==null?void 0:_e.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),yr=new Date().getTime()-((Te=Ue.current)==null?void 0:Te.getTime()),sr=K==="x"?rt:nt,$n=Math.abs(sr)/yr;if(Math.abs(sr)>=JE||$n>.11){ve(Lt.current),(bt=p.onDismiss)==null||bt.call(p,p),T(K==="x"?rt>0?"right":"left":nt>0?"down":"up"),ye(),V(!0),he(!1);return}ee(!1),X(null)},onPointerMove:de=>{var _e,Te,bt,rt;if(!ar.current||!Ze||((_e=window.getSelection())==null?void 0:_e.toString().length)>0)return;let nt=de.clientY-ar.current.y,yr=de.clientX-ar.current.x,sr=(Te=e.swipeDirections)!=null?Te:tA(U);!K&&(Math.abs(yr)>1||Math.abs(nt)>1)&&X(Math.abs(yr)>Math.abs(nt)?"x":"y");let $n={x:0,y:0};K==="y"?(sr.includes("top")||sr.includes("bottom"))&&(sr.includes("top")&&nt<0||sr.includes("bottom")&&nt>0)&&($n.y=nt):K==="x"&&(sr.includes("left")||sr.includes("right"))&&(sr.includes("left")&&yr<0||sr.includes("right")&&yr>0)&&($n.x=yr),(Math.abs($n.x)>0||Math.abs($n.y)>0)&&he(!0),(bt=Fe.current)==null||bt.style.setProperty("--swipe-amount-x",`${$n.x}px`),(rt=Fe.current)==null||rt.style.setProperty("--swipe-amount-y",`${$n.y}px`)}},vr&&!p.jsx?B.createElement("button",{"aria-label":A,"data-disabled":me,"data-close-button":!0,onClick:me||!Ze?()=>{}:()=>{var de;ye(),(de=p.onDismiss)==null||de.call(p,p)},className:vn(J==null?void 0:J.closeButton,(s=p==null?void 0:p.classNames)==null?void 0:s.closeButton)},(i=R==null?void 0:R.close)!=null?i:LE):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:B.createElement(B.Fragment,null,Ke||p.icon||p.promise?B.createElement("div",{"data-icon":"",className:vn(J==null?void 0:J.icon,(o=p==null?void 0:p.classNames)==null?void 0:o.icon)},p.promise||p.type==="loading"&&!p.icon?p.icon||Xe():null,p.type!=="loading"?p.icon||(R==null?void 0:R[Ke])||AE(Ke):null):null,B.createElement("div",{"data-content":"",className:vn(J==null?void 0:J.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},B.createElement("div",{"data-title":"",className:vn(J==null?void 0:J.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?B.createElement("div",{"data-description":"",className:vn(F,Ir,J==null?void 0:J.description,(d=p==null?void 0:p.classNames)==null?void 0:d.description)},typeof p.description=="function"?p.description():p.description):null),h.isValidElement(p.cancel)?p.cancel:p.cancel&&$c(p.cancel)?B.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||I,onClick:de=>{var _e,Te;$c(p.cancel)&&Ze&&((Te=(_e=p.cancel).onClick)==null||Te.call(_e,de),ye())},className:vn(J==null?void 0:J.cancelButton,(u=p==null?void 0:p.classNames)==null?void 0:u.cancelButton)},p.cancel.label):null,h.isValidElement(p.action)?p.action:p.action&&$c(p.action)?B.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||E,onClick:de=>{var _e,Te;$c(p.action)&&((Te=(_e=p.action).onClick)==null||Te.call(_e,de),!de.defaultPrevented&&ye())},className:vn(J==null?void 0:J.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function Uv(){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 nA(e,t){let r={};return[e,t].forEach((n,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?XE:VE;function c(d){["top","right","bottom","left"].forEach(u=>{r[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof n=="number"||typeof n=="string"?c(n):typeof n=="object"?["top","right","bottom","left"].forEach(d=>{n[d]===void 0?r[`${o}-${d}`]=l:r[`${o}-${d}`]=typeof n[d]=="number"?`${n[d]}px`:n[d]}):c(l)}),r}var aA=h.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:m,style:p,visibleToasts:x=GE,toastOptions:g,dir:v=Uv(),gap:y=ZE,loadingIcon:j,icons:N,containerAriaLabel:w="Notifications",pauseWhenPageIsHidden:k}=e,[b,C]=B.useState([]),_=B.useMemo(()=>Array.from(new Set([n].concat(b.filter(z=>z.position).map(z=>z.position)))),[b,n]),[S,I]=B.useState([]),[E,O]=B.useState(!1),[F,D]=B.useState(!1),[U,M]=B.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),H=B.useRef(null),re=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),J=B.useRef(null),R=B.useRef(!1),A=B.useCallback(z=>{C(K=>{var X;return(X=K.find(G=>G.id===z.id))!=null&&X.delete||zr.dismiss(z.id),K.filter(({id:G})=>G!==z.id)})},[]);return B.useEffect(()=>zr.subscribe(z=>{if(z.dismiss){C(K=>K.map(X=>X.id===z.id?{...X,delete:!0}:X));return}setTimeout(()=>{bP.flushSync(()=>{C(K=>{let X=K.findIndex(G=>G.id===z.id);return X!==-1?[...K.slice(0,X),{...K[X],...z},...K.slice(X+1)]:[z,...K]})})})}),[]),B.useEffect(()=>{if(u!=="system"){M(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?M("dark"):M("light")),typeof window>"u")return;let z=window.matchMedia("(prefers-color-scheme: dark)");try{z.addEventListener("change",({matches:K})=>{M(K?"dark":"light")})}catch{z.addListener(({matches:X})=>{try{M(X?"dark":"light")}catch(G){console.error(G)}})}},[u]),B.useEffect(()=>{b.length<=1&&O(!1)},[b]),B.useEffect(()=>{let z=K=>{var X,G;s.every(T=>K[T]||K.code===T)&&(O(!0),(X=H.current)==null||X.focus()),K.code==="Escape"&&(document.activeElement===H.current||(G=H.current)!=null&&G.contains(document.activeElement))&&O(!1)};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[s]),B.useEffect(()=>{if(H.current)return()=>{J.current&&(J.current.focus({preventScroll:!0}),J.current=null,R.current=!1)}},[H.current]),B.createElement("section",{ref:t,"aria-label":`${w} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((z,K)=>{var X;let[G,T]=z.split("-");return b.length?B.createElement("ol",{key:z,dir:v==="auto"?Uv():v,tabIndex:-1,ref:H,className:l,"data-sonner-toaster":!0,"data-theme":U,"data-y-position":G,"data-lifted":E&&b.length>1&&!i,"data-x-position":T,style:{"--front-toast-height":`${((X=S[0])==null?void 0:X.height)||0}px`,"--width":`${QE}px`,"--gap":`${y}px`,...p,...nA(c,d)},onBlur:P=>{R.current&&!P.currentTarget.contains(P.relatedTarget)&&(R.current=!1,J.current&&(J.current.focus({preventScroll:!0}),J.current=null))},onFocus:P=>{P.target instanceof HTMLElement&&P.target.dataset.dismissible==="false"||R.current||(R.current=!0,J.current=P.relatedTarget)},onMouseEnter:()=>O(!0),onMouseMove:()=>O(!0),onMouseLeave:()=>{F||O(!1)},onDragEnd:()=>O(!1),onPointerDown:P=>{P.target instanceof HTMLElement&&P.target.dataset.dismissible==="false"||D(!0)},onPointerUp:()=>D(!1)},b.filter(P=>!P.position&&K===0||P.position===z).map((P,Z)=>{var L,Y;return B.createElement(rA,{key:P.id,icons:N,index:Z,toast:P,defaultRichColors:f,duration:(L=g==null?void 0:g.duration)!=null?L:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:x,closeButton:(Y=g==null?void 0:g.closeButton)!=null?Y:o,interacting:F,position:z,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:A,toasts:b.filter(ae=>ae.position==P.position),heights:S.filter(ae=>ae.position==P.position),setHeights:I,expandByDefault:i,gap:y,loadingIcon:j,expanded:E,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))}),sA=(e,t,r,n,s,i,o,l)=>{let c=document.documentElement,d=["light","dark"];function u(p){(Array.isArray(e)?e:[e]).forEach(x=>{let g=x==="class",v=g&&i?s.map(y=>i[y]||y):s;g?(c.classList.remove(...v),c.classList.add(i&&i[p]?i[p]:p)):c.setAttribute(x,p)}),f(p)}function f(p){l&&d.includes(p)&&(c.style.colorScheme=p)}function m(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}if(n)u(n);else try{let p=localStorage.getItem(t)||r,x=o&&p==="system"?m():p;u(x)}catch{}},qv=["light","dark"],y1="(prefers-color-scheme: dark)",iA=typeof window>"u",Gp=h.createContext(void 0),oA={setTheme:e=>{},themes:[]},lA=()=>{var e;return(e=h.useContext(Gp))!=null?e:oA},cA=e=>h.useContext(Gp)?h.createElement(h.Fragment,null,e.children):h.createElement(uA,{...e}),dA=["light","dark"],uA=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:n=!0,storageKey:s="theme",themes:i=dA,defaultTheme:o=r?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:u,scriptProps:f})=>{let[m,p]=h.useState(()=>mA(s,o)),[x,g]=h.useState(()=>m==="system"?xm():m),v=c?Object.values(c):i,y=h.useCallback(k=>{let b=k;if(!b)return;k==="system"&&r&&(b=xm());let C=c?c[b]:b,_=t?hA(u):null,S=document.documentElement,I=E=>{E==="class"?(S.classList.remove(...v),C&&S.classList.add(C)):E.startsWith("data-")&&(C?S.setAttribute(E,C):S.removeAttribute(E))};if(Array.isArray(l)?l.forEach(I):I(l),n){let E=qv.includes(o)?o:null,O=qv.includes(b)?b:E;S.style.colorScheme=O}_==null||_()},[u]),j=h.useCallback(k=>{let b=typeof k=="function"?k(m):k;p(b);try{localStorage.setItem(s,b)}catch{}},[m]),N=h.useCallback(k=>{let b=xm(k);g(b),m==="system"&&r&&!e&&y("system")},[m,e]);h.useEffect(()=>{let k=window.matchMedia(y1);return k.addListener(N),N(k),()=>k.removeListener(N)},[N]),h.useEffect(()=>{let k=b=>{b.key===s&&(b.newValue?p(b.newValue):j(o))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[j]),h.useEffect(()=>{y(e??m)},[e,m]);let w=h.useMemo(()=>({theme:m,setTheme:j,forcedTheme:e,resolvedTheme:m==="system"?x:m,themes:r?[...i,"system"]:i,systemTheme:r?x:void 0}),[m,j,e,x,r,i]);return h.createElement(Gp.Provider,{value:w},h.createElement(fA,{forcedTheme:e,storageKey:s,attribute:l,enableSystem:r,enableColorScheme:n,defaultTheme:o,value:c,themes:i,nonce:u,scriptProps:f}),d)},fA=h.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:s,defaultTheme:i,value:o,themes:l,nonce:c,scriptProps:d})=>{let u=JSON.stringify([r,t,i,e,l,o,n,s]).slice(1,-1);return h.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${sA.toString()})(${u})`}})}),mA=(e,t)=>{if(iA)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},hA=e=>{let t=document.createElement("style");return e&&t.setAttribute("nonce",e),t.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(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},xm=e=>(e||(e=window.matchMedia(y1)),e.matches?"dark":"light");function pA({children:e}){return a.jsx(cA,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const b1=h.createContext(null),_s="meridian_token",$o="meridian_user",zc="meridian_workspace";function Hv(e){try{const t=e.split(".")[1],r=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(r));return{roles:Array.isArray(n.roles)?n.roles:[],permissions:Array.isArray(n.permissions)?n.permissions:[]}}catch{return{roles:[],permissions:[]}}}function xA({children:e}){const[t,r]=h.useState(()=>{try{const f=localStorage.getItem($o),m=localStorage.getItem(_s);if(!f)return null;const p=JSON.parse(f),{roles:x,permissions:g}=m?Hv(m):{roles:[],permissions:[]};return p.roles=x,p.permissions=g,p}catch{return null}}),[n,s]=h.useState(()=>{const f=localStorage.getItem(_s),m=localStorage.getItem($o);return f&&!m?(localStorage.removeItem(_s),null):f}),[i,o]=h.useState(()=>{try{const f=localStorage.getItem(zc);return f?JSON.parse(f):null}catch{return null}}),l=(f,m)=>{const{roles:p,permissions:x}=Hv(m),g={...f,roles:p,permissions:x};r(g),s(m),localStorage.setItem(_s,m),localStorage.setItem($o,JSON.stringify(g))},c=()=>{const f=localStorage.getItem(_s);f&&fetch("/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${f}`,"Content-Type":"application/json"}}).catch(()=>{}),r(null),s(null),o(null),localStorage.removeItem(_s),localStorage.removeItem($o),localStorage.removeItem(zc)};h.useEffect(()=>{const f=()=>{localStorage.getItem(_s)&&c()};return window.addEventListener("meridian:unauthorized",f),()=>window.removeEventListener("meridian:unauthorized",f)},[]);const d=f=>{o(f),f?localStorage.setItem(zc,JSON.stringify(f)):localStorage.removeItem(zc)},u=f=>{r(m=>{if(!m)return m;const p={...m,...f};return localStorage.setItem($o,JSON.stringify(p)),p})};return a.jsx(b1.Provider,{value:{user:t,token:n,workspace:i,isAuthenticated:!!n&&!!t,login:l,logout:c,setWorkspace:d,updateLocalUser:u},children:e})}function Ie(){const e=h.useContext(b1);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const w1=h.createContext(null);function gA({children:e}){const[t,r]=h.useState(!1);return h.useEffect(()=>{const n=s=>{(s.metaKey||s.ctrlKey)&&s.key==="k"&&(s.preventDefault(),r(i=>!i))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),a.jsx(w1.Provider,{value:{open:t,setOpen:r,toggle:()=>r(n=>!n)},children:e})}function Vp(){const e=h.useContext(w1);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function j1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=j1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function it(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=j1(e))&&(n&&(n+=" "),n+=t);return n}const Xp="-",vA=e=>{const t=bA(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(Xp);return l[0]===""&&l.length!==1&&l.shift(),N1(l,t)||yA(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},N1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),s=n?N1(e.slice(1),n):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(Xp);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},Kv=/^\[(.+)\]$/,yA=e=>{if(Kv.test(e)){const t=Kv.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},bA=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return jA(Object.entries(e.classGroups),r).forEach(([i,o])=>{wh(o,n,i,t)}),n},wh=(e,t,r,n)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:Yv(t,s);i.classGroupId=r;return}if(typeof s=="function"){if(wA(s)){wh(s(n),t,r,n);return}t.validators.push({validator:s,classGroupId:r});return}Object.entries(s).forEach(([i,o])=>{wh(o,Yv(t,i),r,n)})})},Yv=(e,t)=>{let r=e;return t.split(Xp).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},wA=e=>e.isThemeGetter,jA=(e,t)=>t?e.map(([r,n])=>{const s=n.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[t+o,l])):i);return[r,s]}):e,NA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const s=(i,o)=>{r.set(i,o),t++,t>e&&(t=0,n=r,r=new Map)};return{get(i){let o=r.get(i);if(o!==void 0)return o;if((o=n.get(i))!==void 0)return s(i,o),o},set(i,o){r.has(i)?r.set(i,o):s(i,o)}}},k1="!",kA=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,s=t[0],i=t.length,o=l=>{const c=[];let d=0,u=0,f;for(let v=0;v<l.length;v++){let y=l[v];if(d===0){if(y===s&&(n||l.slice(v,v+i)===t)){c.push(l.slice(u,v)),u=v+i;continue}if(y==="/"){f=v;continue}}y==="["?d++:y==="]"&&d--}const m=c.length===0?l:l.substring(u),p=m.startsWith(k1),x=p?m.substring(1):m,g=f&&f>u?f-u:void 0;return{modifiers:c,hasImportantModifier:p,baseClassName:x,maybePostfixModifierPosition:g}};return r?l=>r({className:l,parseClassName:o}):o},SA=e=>{if(e.length<=1)return e;const t=[];let r=[];return e.forEach(n=>{n[0]==="["?(t.push(...r.sort(),n),r=[]):r.push(n)}),t.push(...r.sort()),t},CA=e=>({cache:NA(e.cacheSize),parseClassName:kA(e),...vA(e)}),_A=/\s+/,MA=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(_A);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:p}=r(d);let x=!!p,g=n(x?m.substring(0,p):m);if(!g){if(!x){l=d+(l.length>0?" "+l:l);continue}if(g=n(m),!g){l=d+(l.length>0?" "+l:l);continue}x=!1}const v=SA(u).join(":"),y=f?v+k1:v,j=y+g;if(i.includes(j))continue;i.push(j);const N=s(g,x);for(let w=0;w<N.length;++w){const k=N[w];i.push(y+k)}l=d+(l.length>0?" "+l:l)}return l};function OA(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=S1(t))&&(n&&(n+=" "),n+=r);return n}const S1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=S1(e[n]))&&(r&&(r+=" "),r+=t);return r};function PA(e,...t){let r,n,s,i=o;function o(c){const d=t.reduce((u,f)=>f(u),e());return r=CA(d),n=r.cache.get,s=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=MA(c,r);return s(c,u),u}return function(){return i(OA.apply(null,arguments))}}const ft=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},C1=/^\[(?:([a-z-]+):)?(.+)\]$/i,EA=/^\d+\/\d+$/,AA=new Set(["px","full","screen"]),DA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,TA=/\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$/,IA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,RA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,$A=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ha=e=>Wi(e)||AA.has(e)||EA.test(e),Ja=e=>fo(e,"length",HA),Wi=e=>!!e&&!Number.isNaN(Number(e)),gm=e=>fo(e,"number",Wi),zo=e=>!!e&&Number.isInteger(Number(e)),zA=e=>e.endsWith("%")&&Wi(e.slice(0,-1)),Re=e=>C1.test(e),es=e=>DA.test(e),LA=new Set(["length","size","percentage"]),FA=e=>fo(e,LA,_1),BA=e=>fo(e,"position",_1),WA=new Set(["image","url"]),UA=e=>fo(e,WA,YA),qA=e=>fo(e,"",KA),Lo=()=>!0,fo=(e,t,r)=>{const n=C1.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},HA=e=>TA.test(e)&&!IA.test(e),_1=()=>!1,KA=e=>RA.test(e),YA=e=>$A.test(e),GA=()=>{const e=ft("colors"),t=ft("spacing"),r=ft("blur"),n=ft("brightness"),s=ft("borderColor"),i=ft("borderRadius"),o=ft("borderSpacing"),l=ft("borderWidth"),c=ft("contrast"),d=ft("grayscale"),u=ft("hueRotate"),f=ft("invert"),m=ft("gap"),p=ft("gradientColorStops"),x=ft("gradientColorStopPositions"),g=ft("inset"),v=ft("margin"),y=ft("opacity"),j=ft("padding"),N=ft("saturate"),w=ft("scale"),k=ft("sepia"),b=ft("skew"),C=ft("space"),_=ft("translate"),S=()=>["auto","contain","none"],I=()=>["auto","hidden","clip","visible","scroll"],E=()=>["auto",Re,t],O=()=>[Re,t],F=()=>["",ha,Ja],D=()=>["auto",Wi,Re],U=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],M=()=>["solid","dashed","dotted","double","none"],H=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],re=()=>["start","end","center","between","around","evenly","stretch"],J=()=>["","0",Re],R=()=>["auto","avoid","all","avoid-page","page","left","right","column"],A=()=>[Wi,Re];return{cacheSize:500,separator:":",theme:{colors:[Lo],spacing:[ha,Ja],blur:["none","",es,Re],brightness:A(),borderColor:[e],borderRadius:["none","","full",es,Re],borderSpacing:O(),borderWidth:F(),contrast:A(),grayscale:J(),hueRotate:A(),invert:J(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[zA,Ja],inset:E(),margin:E(),opacity:A(),padding:O(),saturate:A(),scale:A(),sepia:J(),skew:A(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Re]}],container:["container"],columns:[{columns:[es]}],"break-after":[{"break-after":R()}],"break-before":[{"break-before":R()}],"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:[...U(),Re]}],overflow:[{overflow:I()}],"overflow-x":[{"overflow-x":I()}],"overflow-y":[{"overflow-y":I()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",zo,Re]}],basis:[{basis:E()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Re]}],grow:[{grow:J()}],shrink:[{shrink:J()}],order:[{order:["first","last","none",zo,Re]}],"grid-cols":[{"grid-cols":[Lo]}],"col-start-end":[{col:["auto",{span:["full",zo,Re]},Re]}],"col-start":[{"col-start":D()}],"col-end":[{"col-end":D()}],"grid-rows":[{"grid-rows":[Lo]}],"row-start-end":[{row:["auto",{span:[zo,Re]},Re]}],"row-start":[{"row-start":D()}],"row-end":[{"row-end":D()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...re()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...re(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...re(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[j]}],px:[{px:[j]}],py:[{py:[j]}],ps:[{ps:[j]}],pe:[{pe:[j]}],pt:[{pt:[j]}],pr:[{pr:[j]}],pb:[{pb:[j]}],pl:[{pl:[j]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"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",Re,t]}],"min-w":[{"min-w":[Re,t,"min","max","fit"]}],"max-w":[{"max-w":[Re,t,"none","full","min","max","fit","prose",{screen:[es]},es]}],h:[{h:[Re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",es,Ja]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gm]}],"font-family":[{font:[Lo]}],"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",Re]}],"line-clamp":[{"line-clamp":["none",Wi,gm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ha,Re]}],"list-image":[{"list-image":["none",Re]}],"list-style-type":[{list:["none","disc","decimal",Re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...M(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ha,Ja]}],"underline-offset":[{"underline-offset":["auto",ha,Re]}],"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:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Re]}],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",Re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...U(),BA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},UA]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"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":[y]}],"border-style":[{border:[...M(),"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":[y]}],"divide-style":[{divide:M()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...M()]}],"outline-offset":[{"outline-offset":[ha,Re]}],"outline-w":[{outline:[ha,Ja]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:F()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[ha,Ja]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",es,qA]}],"shadow-color":[{shadow:[Lo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...H(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":H()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",es,Re]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[f]}],saturate:[{saturate:[N]}],sepia:[{sepia:[k]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[k]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Re]}],duration:[{duration:A()}],ease:[{ease:["linear","in","out","in-out",Re]}],delay:[{delay:A()}],animate:[{animate:["none","spin","ping","pulse","bounce",Re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[w]}],"scale-x":[{"scale-x":[w]}],"scale-y":[{"scale-y":[w]}],rotate:[{rotate:[zo,Re]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[b]}],"skew-y":[{"skew-y":[b]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Re]}],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",Re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[ha,Ja,gm]}],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"]}}},VA=PA(GA);function $(...e){return VA(it(e))}const Ru=CP,Xn=kP,Qn=SP,Cn=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(Dj,{ref:n,sideOffset:t,className:$("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),...r}));Cn.displayName=Dj.displayName;const M1=h.createContext([]);function XA({widgets:e,children:t}){return B.createElement(M1.Provider,{value:e},t)}function QA(e){return h.useContext(M1).filter(r=>r.zone===e).map(r=>r.component)}var Ej;const Yi=((Ej=window.__MERIDIAN_CONFIG__)==null?void 0:Ej.apiUrl)??void 0??"";class Qp extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n,this.name="ApiError"}}function O1(){return localStorage.getItem("meridian_token")}async function Fo(e,t={}){var i;const r=O1(),n={"Content-Type":"application/json",...t.headers};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Yi}${e}`,{...t,headers:n});if(!s.ok){let o;try{o=await s.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${s.status}`;throw s.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new Qp(s.status,l,o)}if(s.status!==204)return s.json()}const oe={get:e=>Fo(e,{method:"GET"}),post:(e,t)=>Fo(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>Fo(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>Fo(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>Fo(e,{method:"DELETE"}),upload:async(e,t)=>{var i;const r=O1(),n={};r&&(n.Authorization=`Bearer ${r}`);const s=await fetch(`${Yi}${e}`,{method:"POST",headers:n,body:t});if(!s.ok){let o;try{o=await s.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${s.status}`;throw s.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new Qp(s.status,l,o)}if(s.status!==204)return s.json()}},Tt={all:["issues"],byProject:(e,t)=>[...Tt.all,"project",e,...t?[t]:[]],detail:e=>[...Tt.all,e],comments:e=>[...Tt.all,e,"comments"],activities:e=>[...Tt.all,e,"activities"]};function Vl(e,t){return We({queryKey:e?Tt.byProject(e,t):Tt.all,queryFn:()=>{var n,s,i;const r=new URLSearchParams;return e&&r.set("project_id",e),(n=t==null?void 0:t.priority)!=null&&n.length&&r.set("priority",t.priority.join(",")),t!=null&&t.assignee_id&&r.set("assignee_id",t.assignee_id),(s=t==null?void 0:t.type)!=null&&s.length&&r.set("type",t.type.join(",")),(i=t==null?void 0:t.status)!=null&&i.length&&r.set("status",t.status.join(",")),oe.get(`/admin/issues?${r}`)},select:r=>r.issues,enabled:e!==void 0?!!e:!0})}function P1(e){return We({queryKey:Tt.detail(e),queryFn:()=>oe.get(`/admin/issues/${e}`),select:t=>t.issue,enabled:!!e})}function ZA(e){return We({queryKey:Tt.comments(e),queryFn:()=>oe.get(`/admin/issues/${e}/comments`),select:t=>t.comments,enabled:!!e})}function E1(){const e=Se();return be({mutationFn:t=>oe.post("/admin/issues",t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:Tt.byProject(r.project_id)})}})}function $u(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/issues/${e}`,n),onMutate:async n=>{await r.cancelQueries({queryKey:Tt.byProject(t)});const s=r.getQueryData(Tt.byProject(t));return r.setQueryData(Tt.byProject(t),i=>i&&{...i,issues:i.issues.map(o=>o.id===e?{...o,...n}:o)}),{previous:s}},onError:(n,s,i)=>{i!=null&&i.previous&&r.setQueryData(Tt.byProject(t),i.previous)},onSettled:()=>{r.invalidateQueries({queryKey:Tt.byProject(t)}),r.invalidateQueries({queryKey:Tt.detail(e)})}})}function JA(e){return We({queryKey:Tt.activities(e),queryFn:()=>oe.get(`/admin/issues/${e}/activities`),select:t=>t.activities,enabled:!!e})}function e5(e){const t=Se();return be({mutationFn:({body:r,metadata:n})=>oe.post(`/admin/issues/${e}/comments`,{body:r,metadata:n}),onSuccess:()=>{t.invalidateQueries({queryKey:Tt.comments(e)})}})}const Gv=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Vv=it,Xl=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return Vv(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(d=>{const u=r==null?void 0:r[d],f=i==null?void 0:i[d];if(u===null)return null;const m=Gv(u)||Gv(f);return s[d][m]}),l=r&&Object.entries(r).reduce((d,u)=>{let[f,m]=u;return m===void 0||(d[f]=m),d},{}),c=t==null||(n=t.compoundVariants)===null||n===void 0?void 0:n.reduce((d,u)=>{let{class:f,className:m,...p}=u;return Object.entries(p).every(x=>{let[g,v]=x;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...d,f,m]:d},[]);return Vv(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)},Ui=Xl("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"}}),ne=h.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...s},i)=>{const o=n?Up:"button";return a.jsx(o,{className:$(Ui({variant:t,size:r,className:e})),ref:i,...s})});ne.displayName="Button";const Ae=h.forwardRef(({className:e,type:t,...r},n)=>a.jsx("input",{type:t,className:$("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:n,...r}));Ae.displayName="Input";/**
4
4
  * @license lucide-react v0.468.0 - ISC
@@ -553,7 +553,7 @@ var pP=Object.defineProperty;var xP=(e,t,r)=>t in e?pP(e,t,{enumerable:!0,config
553
553
  */const ia=le("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 L5({issue:e}){const t=$u(e.id,e.project_id),[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(!1),c=e.metadata??{},d=Object.entries(c),u=()=>{if(!r.trim())return;const m={...c,[r.trim()]:s};t.mutate({metadata:m},{onSuccess:()=>{q.success("Metadata saved"),n(""),i(""),l(!1)},onError:()=>q.error("Failed to save metadata")})},f=m=>{const p={...c};delete p[m],t.mutate({metadata:Object.keys(p).length?p:null},{onSuccess:()=>q.success("Entry removed"),onError:()=>q.error("Failed to update metadata")})};return a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[a.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(o5,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!o&&a.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add field"]})]}),a.jsxs("div",{className:"px-5 py-3 space-y-2",children:[d.length===0&&!o&&a.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),d.map(([m,p])=>a.jsxs("div",{className:"flex items-center gap-2 group",children:[a.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:m}),a.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(p)}),a.jsx("button",{onClick:()=>f(m),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(Mr,{className:"h-3 w-3"})})]},m)),o&&a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[a.jsx(Ae,{autoFocus:!0,placeholder:"key",value:r,onChange:m=>n(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"}),a.jsx(Ae,{placeholder:"value",value:s,onChange:m=>i(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),a.jsx(ne,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!r.trim()||t.isPending,children:"Save"}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),n(""),i("")},children:"Cancel"})]})]})]})}const F5=[{zone:"issue.details.after",component:L5}];function ec(e=!0){return We({queryKey:["workspaces"],queryFn:()=>oe.get("/admin/workspaces"),select:t=>t.workspaces,enabled:e})}function B5(){const e=Se();return be({mutationFn:t=>oe.post("/admin/workspaces",t),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function W5(e){const t=Se();return be({mutationFn:r=>oe.put(`/admin/workspaces/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function U5(e){const t=Se();return be({mutationFn:r=>{const n=new FormData;return n.append("logo",r),oe.upload(`/admin/workspaces/${e}/logo`,n)},onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}function q5(e){const t=Se();return be({mutationFn:()=>oe.delete(`/admin/workspaces/${e}/logo`),onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}const cx={list:e=>["workspaces",e,"invitations"]};function H5(e){return We({queryKey:cx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/invitations`),select:t=>t.invitations,enabled:!!e})}function K5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/invitations`,r),onSuccess:()=>{t.invalidateQueries({queryKey:cx.list(e)})}})}function Y5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/invitations/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:cx.list(e)})}})}function G5(e){return be({mutationFn:t=>oe.post(`/admin/workspaces/${e}/invitations/${t}/resend`)})}const dx={list:e=>["workspaces",e,"members"]};function tc(e){return We({queryKey:dx.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/members`),select:t=>t.members,enabled:!!e})}function V5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/members`,r),onSuccess:()=>{t.invalidateQueries({queryKey:dx.list(e)})}})}function X5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:dx.list(e)})}})}const vs={list:e=>["workspaces",e,"teams"],members:(e,t)=>["workspaces",e,"teams",t,"members"]};function Bu(e){return We({queryKey:vs.list(e),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams`),select:t=>t.teams,enabled:!!e})}function Q5(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/workspaces/${e}/teams`,r),onSuccess:()=>{t.invalidateQueries({queryKey:vs.list(e)})}})}function Z5(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/workspaces/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:vs.list(e)})}})}function J5(e,t){return We({queryKey:vs.members(e,t),queryFn:()=>oe.get(`/admin/workspaces/${e}/teams/${t}/members`),select:r=>r.members,enabled:!!(e&&t)})}function eD(e,t){const r=Se();return be({mutationFn:n=>oe.post(`/admin/workspaces/${e}/teams/${t}/members`,{user_id:n}),onSuccess:()=>{r.invalidateQueries({queryKey:vs.members(e,t)}),r.invalidateQueries({queryKey:vs.list(e)})}})}function tD(e,t){const r=Se();return be({mutationFn:n=>oe.delete(`/admin/workspaces/${e}/teams/${t}/members/${n}`),onSuccess:()=>{r.invalidateQueries({queryKey:vs.members(e,t)}),r.invalidateQueries({queryKey:vs.list(e)})}})}function Wu(){return We({queryKey:["setup-status"],queryFn:()=>oe.get("/auth/setup"),staleTime:6e4,retry:!1})}function rD(){const{login:e}=Ie();return be({mutationFn:t=>oe.post("/auth/login",t),onSuccess:t=>{e(t.user,t.token)}})}function nD(){const{login:e}=Ie();return be({mutationFn:t=>oe.post("/auth/register",t),onSuccess:t=>{e(t.user,t.token)}})}function aD(){return be({mutationFn:e=>oe.post("/auth/forgot-password",e)})}function sD(){return be({mutationFn:e=>oe.post("/auth/reset-password",e)})}function iD(e){const{login:t}=Ie();return be({mutationFn:r=>oe.post(`/auth/invite/${e}`,r),onSuccess:r=>{t(r.user,r.token)}})}var Aj;const oD=((Aj=window.__MERIDIAN_CONFIG__)==null?void 0:Aj.apiUrl)??void 0??"";function lD(e,t){const r=`${oD}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(t)}`;return new EventSource(r)}function cD(){const{token:e,workspace:t}=Ie(),r=Se(),n=h.useRef(null);h.useEffect(()=>{if(!e||!t)return;const s=lD(e,t.id);n.current=s;const i=o=>{o.forEach(l=>r.invalidateQueries({queryKey:l}))};return s.addEventListener("issue.created",()=>{i([["issues"],["notifications"]])}),s.addEventListener("issue.status_changed",()=>{i([["issues"]])}),s.addEventListener("issue.assigned",()=>{i([["issues"],["notifications"]])}),s.addEventListener("comment.created",()=>{i([["issues"],["notifications"]])}),s.addEventListener("project.member_added",()=>{i([["notifications"]])}),s.onerror=()=>{},()=>{s.close(),n.current=null}},[e,t==null?void 0:t.id,r])}const vm=768;function dD(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${vm-1}px)`),n=()=>{t(window.innerWidth<vm)};return r.addEventListener("change",n),t(window.innerWidth<vm),()=>r.removeEventListener("change",n)},[]),!!e}const po=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},s)=>a.jsx(Tj,{ref:s,decorative:r,orientation:t,className:$("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...n}));po.displayName=Tj.displayName;const uD=Gl,fD=Yl,G1=h.forwardRef(({className:e,...t},r)=>a.jsx(gi,{className:$("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),...t,ref:r}));G1.displayName=gi.displayName;const mD=Xl("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"}}),V1=h.forwardRef(({side:e="right",className:t,children:r,...n},s)=>a.jsxs(fD,{children:[a.jsx(G1,{}),a.jsxs(vi,{ref:s,className:$(mD({side:e}),t),...n,children:[r,a.jsxs(Tu,{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:[a.jsx(tt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));V1.displayName=vi.displayName;const X1=({className:e,...t})=>a.jsx("div",{className:$("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...t});X1.displayName="SheetHeader";const Q1=h.forwardRef(({className:e,...t},r)=>a.jsx(co,{ref:r,className:$("text-base font-semibold text-foreground",e),...t}));Q1.displayName=co.displayName;const Z1=h.forwardRef(({className:e,...t},r)=>a.jsx(uo,{ref:r,className:$("text-sm text-muted-foreground",e),...t}));Z1.displayName=uo.displayName;function ce({className:e,...t}){return a.jsx("div",{className:$("animate-pulse rounded-md bg-muted",e),...t})}const hD="sidebar_state",pD=60*60*24*7,xD="16rem",gD="18rem",vD="3rem",yD="b",J1=h.createContext(null);function ux(){const e=h.useContext(J1);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function Uu({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:s,children:i,...o}){const l=dD(),[c,d]=h.useState(!1),[u,f]=h.useState(e),m=t??u,p=h.useCallback(y=>{const j=typeof y=="function"?y(m):y;r?r(j):f(j),document.cookie=`${hD}=${j}; path=/; max-age=${pD}`},[r,m]),x=h.useCallback(()=>l?d(y=>!y):p(y=>!y),[l,p,d]);h.useEffect(()=>{const y=j=>{j.key===yD&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),x())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[x]);const g=m?"expanded":"collapsed",v=h.useMemo(()=>({state:g,open:m,setOpen:p,isMobile:l,openMobile:c,setOpenMobile:d,toggleSidebar:x}),[g,m,p,l,c,d,x]);return a.jsx(J1.Provider,{value:v,children:a.jsx(Ru,{delayDuration:0,children:a.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":xD,"--sidebar-width-icon":vD,...s},className:$("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",n),...o,children:i})})})}function qu({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:s,...i}){const{isMobile:o,state:l,openMobile:c,setOpenMobile:d}=ux();return r==="none"?a.jsx("div",{"data-slot":"sidebar",className:$("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",n),...i,children:s}):o?a.jsx(uD,{open:c,onOpenChange:d,...i,children:a.jsxs(V1,{"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":gD},side:e,children:[a.jsxs(X1,{className:"sr-only",children:[a.jsx(Q1,{children:"Sidebar"}),a.jsx(Z1,{children:"Displays the mobile sidebar."})]}),a.jsx("div",{className:"flex h-full w-full flex-col",children:s})]})}):a.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":l,"data-collapsible":l==="collapsed"?r:"","data-variant":t,"data-side":e,"data-slot":"sidebar",children:[a.jsx("div",{"data-slot":"sidebar-gap",className:$("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",t==="floating"||t==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+1rem)]":"group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),a.jsx("div",{"data-slot":"sidebar-container",className:$("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)]",t==="floating"||t==="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",n),...i,children:a.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:s})})]})}function Hu({className:e,onClick:t,...r}){const{toggleSidebar:n}=ux();return a.jsxs(ne,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:$("size-7",e),onClick:s=>{t==null||t(s),n()},...r,children:[a.jsx(w5,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function Ku({className:e,...t}){return a.jsx("main",{"data-slot":"sidebar-inset",className:$("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),...t})}function Yu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:$("flex flex-col gap-2 p-2",e),...t})}function Gu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:$("flex flex-col gap-2 p-2",e),...t})}function Zv({className:e,...t}){return a.jsx(po,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:$("bg-sidebar-border mx-2 w-auto",e),...t})}function Vu({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:$("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function Ws({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:$("relative flex w-full min-w-0 flex-col p-2",e),...t})}function Jv({className:e,asChild:t=!1,...r}){const n=t?Up:"div";return a.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:$("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),...r})}function Us({className:e,...t}){return a.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:$("w-full text-sm",e),...t})}function jr({className:e,...t}){return a.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:$("flex w-full min-w-0 flex-col gap-1",e),...t})}function Mt({className:e,...t}){return a.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:$("group/menu-item relative",e),...t})}const bD=Xl("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"}}),St=h.forwardRef(function({asChild:t=!1,isActive:r=!1,variant:n="default",size:s="default",tooltip:i,className:o,...l},c){const d=t?Up:"button",{isMobile:u,state:f}=ux(),m=a.jsx(d,{ref:c,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":s,"data-active":r,className:$(bD({variant:n,size:s}),o),...l});return i?(typeof i=="string"&&(i={children:i}),a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:m}),a.jsx(Cn,{side:"right",align:"center",hidden:f!=="collapsed"||u,...i})]})):m});St.displayName="SidebarMenuButton";const wD=250,jD=300,Zr={all:["projects"],list:()=>[...Zr.all,"list"],detail:e=>[...Zr.all,e],byKey:e=>[...Zr.all,"key",e],activities:e=>[...Zr.all,e,"activities"]};function xo(){const{workspace:e}=Ie();return We({queryKey:[...Zr.list(),e==null?void 0:e.id],queryFn:()=>{const t=e!=null&&e.id?`?workspace_id=${e.id}`:"";return oe.get(`/admin/projects${t}`)},select:t=>t.projects,enabled:!!(e!=null&&e.id)})}function La(e){return We({queryKey:Zr.byKey(e),queryFn:()=>oe.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:t=>t.project,enabled:!!e})}function ND(e,t={}){const[r,n]=h.useState(e),s=t.enabled!==!1;return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>n(e),wD);return()=>clearTimeout(l)},[e,s]),{...We({queryKey:["projects","suggest-identifier",r],queryFn:()=>oe.get(`/admin/projects/suggest-identifier?name=${encodeURIComponent(r)}`),select:l=>l.identifier,enabled:s&&r.trim().length>0}),flush:()=>n(e)}}function kD(e,t={}){const r=e.toUpperCase().replace(/[^A-Z0-9]/g,""),[n,s]=h.useState(r),i=t.enabled!==!1&&r.length>=3;h.useEffect(()=>{if(!r){s("");return}const l=setTimeout(()=>s(r),jD);return()=>clearTimeout(l)},[r]);const o=We({queryKey:["projects","check-identifier",n],queryFn:()=>oe.get(`/admin/projects/check-identifier/${encodeURIComponent(n)}`),select:l=>l.available,enabled:i&&n.length>=3});return{available:o.data,isLoading:o.isLoading,isFetching:o.isFetching}}function SD(){const e=Se();return be({mutationFn:t=>oe.post("/admin/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:Zr.list()})}})}function CD(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/projects/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:Zr.list()})}})}function _D(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/projects/${e}/share`,{}),onSuccess:()=>{t.invalidateQueries({queryKey:Zr.detail(e)}),t.invalidateQueries({queryKey:Zr.list()})}})}function MD(e){const t=Se();return be({mutationFn:()=>oe.delete(`/admin/projects/${e}/share`),onSuccess:()=>{t.invalidateQueries({queryKey:Zr.detail(e)}),t.invalidateQueries({queryKey:Zr.list()})}})}function OD(e){return We({queryKey:Zr.activities(e),queryFn:()=>oe.get(`/admin/projects/${e}/activities`),select:t=>t.activities,enabled:!!e})}const Hr=MP,Kr=OP,PD=h.forwardRef(({className:e,inset:t,children:r,...n},s)=>a.jsxs(Ij,{ref:s,className:$("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",t&&"pl-8",e),...n,children:[r,a.jsx(Cr,{className:"ml-auto"})]}));PD.displayName=Ij.displayName;const ED=h.forwardRef(({className:e,...t},r)=>a.jsx(Rj,{ref:r,className:$("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),...t}));ED.displayName=Rj.displayName;const Or=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>a.jsx(_P,{children:a.jsx($j,{ref:n,sideOffset:t,className:$("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),...r})}));Or.displayName=$j.displayName;const at=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(zj,{ref:n,className:$("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",t&&"pl-8",e),...r}));at.displayName=zj.displayName;const AD=h.forwardRef(({className:e,children:t,checked:r,...n},s)=>a.jsxs(Lj,{ref:s,className:$("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:r,...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fj,{children:a.jsx(dr,{className:"h-4 w-4"})})}),t]}));AD.displayName=Lj.displayName;const DD=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Bj,{ref:n,className:$("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),...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Fj,{children:a.jsx(_r,{className:"h-2 w-2 fill-current"})})}),t]}));DD.displayName=Bj.displayName;const fx=h.forwardRef(({className:e,inset:t,...r},n)=>a.jsx(Wj,{ref:n,className:$("px-2 py-1.5 text-xs font-medium text-muted-foreground",t&&"pl-8",e),...r}));fx.displayName=Wj.displayName;const On=h.forwardRef(({className:e,...t},r)=>a.jsx(Uj,{ref:r,className:$("-mx-1 my-1 h-px bg-border",e),...t}));On.displayName=Uj.displayName;const Rt=h.forwardRef(({className:e,...t},r)=>a.jsx(qj,{ref:r,className:$("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...t}));Rt.displayName=qj.displayName;const yl=h.forwardRef(({className:e,...t},r)=>a.jsx(Hj,{ref:r,className:$("aspect-square h-full w-full",e),...t}));yl.displayName=Hj.displayName;const $t=h.forwardRef(({className:e,...t},r)=>a.jsx(Kj,{ref:r,className:$("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...t}));$t.displayName=Kj.displayName;function TD(){var s;const{workspace:e,setWorkspace:t}=Ie(),{data:r}=ec(),n=pt();return a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e!=null&&e.logo_url?a.jsx("img",{src:e.logo_url,alt:e.name,className:"size-8 rounded-lg object-cover shrink-0"}):a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx("span",{className:"text-[13px] font-bold",children:(((s=e==null?void 0:e.name)==null?void 0:s[0])??"M").toUpperCase()})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),a.jsx(mo,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[a.jsx(fx,{className:"text-xs text-muted-foreground font-normal",children:"Workspaces"}),r==null?void 0:r.map(i=>a.jsxs(at,{className:"cursor-pointer gap-2 p-2",onClick:()=>{t({id:i.id,name:i.name,slug:i.slug,logo_url:i.logo_url}),n(`/${i.slug}/projects`)},children:[i.logo_url?a.jsx("img",{src:i.logo_url,alt:i.name,className:"size-6 rounded-sm object-cover shrink-0"}):a.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:a.jsx("span",{className:"text-[10px] font-bold",children:i.name[0].toUpperCase()})}),a.jsx("span",{className:"flex-1 truncate",children:i.name}),i.id===(e==null?void 0:e.id)&&a.jsx(dr,{className:"size-3.5 text-muted-foreground shrink-0"})]},i.id)),a.jsx(On,{}),a.jsxs(at,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>n("/setup"),children:[a.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:a.jsx("span",{className:"text-xs font-semibold",children:"+"})}),a.jsx("span",{children:"Create workspace"})]})]})]})})})}function ID(){var i,o,l,c;const{user:e,logout:t}=Ie(),r=pt(),n=e&&(`${((i=e.first_name)==null?void 0:i[0])??""}${((o=e.last_name)==null?void 0:o[0])??""}`.toUpperCase()||((c=(l=e.email)==null?void 0:l[0])==null?void 0:c.toUpperCase()))||"?",s=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&a.jsx(yl,{src:e.avatar_url,alt:s??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:s}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(mo,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(fx,{className:"p-0 font-normal",children:a.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg",children:[(e==null?void 0:e.avatar_url)&&a.jsx(yl,{src:e.avatar_url,alt:s??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:s}),a.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),a.jsx(On,{}),a.jsxs(at,{className:"cursor-pointer gap-2",onClick:()=>r("/profile"),children:[a.jsx(Jl,{className:"size-4"}),"Profile"]}),a.jsx(On,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Lu,{className:"size-4"}),"Sign out"]})]})]})})})}function RD({...e}){var w,k,b;const{workspace:t,projectKey:r}=zt(),{data:n}=xo(),{toggle:s}=Vp(),{user:i}=Ie(),o=ql(),l=t??"",c=o.pathname===`/${l}/projects`,d=o.pathname===`/${l}/my-tasks`,u=o.pathname.includes("/notifications"),f=o.pathname.includes("/settings"),m=o.pathname.includes("/roles"),p=o.pathname===`/${l}/reporting`,x=o.pathname.startsWith("/reporting"),g=o.pathname.startsWith("/org/settings"),v=((w=i==null?void 0:i.roles)==null?void 0:w.includes("super-admin"))??!1,y=v||(((k=i==null?void 0:i.roles)==null?void 0:k.includes("admin"))??!1),j=((b=i==null?void 0:i.permissions)==null?void 0:b.includes("workspace:admin"))??!1,N=y||j;return a.jsxs(qu,{collapsible:"offcanvas",...e,children:[a.jsx(Yu,{children:a.jsx(TD,{})}),a.jsxs(Vu,{children:[a.jsx(Ws,{children:a.jsx(Us,{children:a.jsxs(jr,{children:[a.jsx(Mt,{children:a.jsxs(St,{onClick:s,tooltip:"Search",children:[a.jsx(ji,{}),a.jsx("span",{children:"Search"}),a.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:d,tooltip:"My Tasks",children:a.jsxs(bn,{to:`/${l}/my-tasks`,children:[a.jsx(Fu,{}),a.jsx("span",{children:"My Tasks"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:c,tooltip:"Projects",children:a.jsxs(bn,{to:`/${l}/projects`,end:!0,children:[a.jsx(qr,{}),a.jsx("span",{children:"Projects"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:u,tooltip:"Notifications",children:a.jsxs(bn,{to:`/${l}/notifications`,children:[a.jsx(ti,{}),a.jsx("span",{children:"Notifications"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:p,tooltip:"Reports",children:a.jsxs(bn,{to:`/${l}/reporting`,children:[a.jsx(xs,{}),a.jsx("span",{children:"Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:f,tooltip:"Settings",children:a.jsxs(bn,{to:`/${l}/settings`,children:[a.jsx(lx,{}),a.jsx("span",{children:"Workspace settings"})]})})})]})})}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(Zv,{}),a.jsxs(Ws,{children:[a.jsx(Jv,{children:"Recent"}),a.jsx(Us,{children:a.jsx(jr,{children:n.slice(0,5).map(C=>a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:C.identifier===r,tooltip:C.name,className:"data-[active=true]:bg-indigo-50 dark:data-[active=true]:bg-indigo-950/50 data-[active=true]:text-indigo-700 dark:data-[active=true]:text-indigo-300",children:a.jsxs(bn,{to:`/${l}/projects/${C.identifier}/board`,children:[a.jsx("span",{className:"font-mono text-[10px] text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:C.identifier}),a.jsx("span",{className:"truncate",children:C.name})]})})},C.id))})})]})]}),N&&a.jsxs(a.Fragment,{children:[a.jsx(Zv,{}),a.jsxs(Ws,{children:[a.jsx(Jv,{children:"Global"}),a.jsx(Us,{children:a.jsxs(jr,{children:[a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:x,tooltip:"Global Reports",children:a.jsxs(bn,{to:"/reporting",children:[a.jsx(xs,{}),a.jsx("span",{children:"Global Reports"})]})})}),a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:g,tooltip:"Org Settings",children:a.jsxs(bn,{to:"/org/settings",children:[a.jsx(ox,{}),a.jsx("span",{children:"Org Settings"})]})})})]})})]})]}),a.jsx(Ws,{className:"mt-auto",children:a.jsx(Us,{children:a.jsx(jr,{children:v&&a.jsx(Mt,{children:a.jsx(St,{asChild:!0,isActive:m,tooltip:"Roles & Permissions",children:a.jsxs(bn,{to:`/${l}/roles`,children:[a.jsx(Nh,{}),a.jsx("span",{children:"Custom Roles"})]})})})})})})]}),a.jsx(Gu,{children:a.jsx(ID,{})})]})}function Xu(){const{theme:e,setTheme:t}=lA();return a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:a.jsxs(ne,{variant:"ghost",size:"icon-sm",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[a.jsx(O5,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),a.jsx(b5,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),a.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),a.jsx(Cn,{children:"Toggle theme"})]})}const rc={all:["notifications"],list:()=>[...rc.all,"list"]};function $D(){return We({queryKey:rc.list(),queryFn:()=>oe.get("/admin/notifications"),select:e=>e.notifications})}function eN(){return We({queryKey:[...rc.list(),"unread"],queryFn:()=>oe.get("/admin/notifications?unread=true"),select:e=>e.count,refetchInterval:3e4})}function zD(){const e=Se();return be({mutationFn:t=>oe.post(`/admin/notifications/${t}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:rc.all})}})}function LD(){const e=Se();return be({mutationFn:()=>oe.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:rc.all})}})}function FD(){const e=ql(),{projectKey:t}=zt(),{data:r}=xo(),n=r==null?void 0:r.find(i=>i.identifier===t),s=e.pathname;return s.includes("/board")?{icon:qr,label:n?`${n.name} / Board`:"Board"}:s.includes("/issues")?{icon:Zn,label:n?`${n.name} / Issues`:"Issues"}:s.includes("/sprints")?{icon:ia,label:n?`${n.name} / Sprints`:"Sprints"}:s.includes("/timeline")?{icon:ri,label:n?`${n.name} / Timeline`:"Timeline"}:s.includes("/access")?{icon:ai,label:n?`${n.name} / Access`:"Access"}:s.includes("/reports")?{icon:xs,label:n?`${n.name} / Reports`:"Reports"}:s.includes("/activity")?{icon:zu,label:n?`${n.name} / Activity`:"Activity"}:s.endsWith("/projects")?{icon:Sd,label:"Projects"}:s.includes("/notifications")?{icon:ti,label:"Notifications"}:s.includes("/settings")?{icon:lx,label:"Settings"}:{icon:Sd,label:"Meridian"}}function BD(){const{data:e=0}=eN(),{icon:t,label:r}=FD(),{workspace:n}=Ie(),s=(n==null?void 0:n.slug)??"";return a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(Hu,{className:"-ml-1"}),a.jsx(po,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(t,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:r})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[a.jsx("span",{className:"hidden md:flex",children:a.jsx(Xu,{})}),a.jsx(ne,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:a.jsxs(Ur,{to:`/${s}/notifications`,children:[a.jsx(ti,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&a.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 WD(){const e=ql(),{workspace:t}=zt(),r=t??"",{data:n=0}=eN(),{toggle:s}=Vp(),i=[{key:"projects",label:"Projects",icon:B1,to:`/${r}/projects`,match:/\/projects($|\/)/},{key:"notifications",label:"Notifications",icon:ti,to:`/${r}/notifications`,match:/\/notifications/,badge:n>0?n>9?"9+":String(n):null},{key:"my-tasks",label:"My Tasks",icon:Fu,to:`/${r}/my-tasks`,match:/\/my-tasks/},{key:"profile",label:"Profile",icon:Jl,to:"/profile",match:/^\/profile/}];return a.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-background border-t border-border md:hidden",children:a.jsxs("div",{className:"flex items-stretch h-16 pb-safe",children:[i.map(({key:o,label:l,icon:c,to:d,match:u,badge:f})=>{const m=u.test(e.pathname);return a.jsxs(Ur,{to:d,className:$("flex flex-col items-center justify-center flex-1 gap-1 text-[10px] font-medium transition-colors relative",m?"text-indigo-600 dark:text-indigo-400":"text-muted-foreground hover:text-foreground"),children:[a.jsxs("div",{className:"relative",children:[a.jsx(c,{className:"h-5 w-5",strokeWidth:m?2:1.5}),f&&a.jsx("span",{className:"absolute -top-1 -right-1.5 h-3.5 w-3.5 rounded-full bg-indigo-600 text-[9px] font-bold text-white flex items-center justify-center leading-none",children:f})]}),a.jsx("span",{children:l})]},o)}),a.jsxs("button",{onClick:s,className:"flex flex-col items-center justify-center flex-1 gap-1 text-[10px] font-medium text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(ji,{className:"h-5 w-5",strokeWidth:1.5}),a.jsx("span",{children:"Search"})]})]})})}function UD(){const{user:e,token:t,login:r}=Ie();h.useEffect(()=>{!e||!t||!e.email||fetch("/admin/users/me",{headers:{Authorization:`Bearer ${t}`}}).then(n=>n.ok?n.json():null).then(n=>{n&&r({id:n.id,email:n.email,first_name:n.first_name??"",last_name:n.last_name??"",avatar_url:n.avatar_url??null},t)}).catch(()=>{})},[e==null?void 0:e.id])}function qD(){return UD(),a.jsxs(Uu,{children:[a.jsx(RD,{variant:"inset"}),a.jsxs(Ku,{className:"flex flex-col min-w-0",children:[a.jsx(BD,{}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden pb-16 md:pb-0",children:a.jsx(Hl,{})})]}),a.jsx(WD,{})]})}const nc={project:e=>["projects",e,"access"]};function oa(e){return We({queryKey:nc.project(e),queryFn:()=>oe.get(`/admin/projects/${e}/access`),enabled:!!e})}function tN(e){const t=Se();return be({mutationFn:({userId:r,role:n})=>oe.post(`/admin/projects/${e}/members`,{user_id:r,role:n}),onSuccess:()=>{t.invalidateQueries({queryKey:nc.project(e)})}})}function rN(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:nc.project(e)})}})}function nN(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/teams`,{team_id:r}),onSuccess:()=>{t.invalidateQueries({queryKey:nc.project(e)})}})}function aN(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:nc.project(e)})}})}const Fa=Gl,HD=Yl,sN=h.forwardRef(({className:e,...t},r)=>a.jsx(gi,{ref:r,className:$("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),...t}));sN.displayName=gi.displayName;const la=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(HD,{children:[a.jsx(sN,{}),a.jsxs(vi,{ref:n,className:$("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),...r,children:[t,a.jsxs(Tu,{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:[a.jsx(tt,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));la.displayName=vi.displayName;const Ba=({className:e,...t})=>a.jsx("div",{className:$("flex flex-col space-y-1.5",e),...t});Ba.displayName="DialogHeader";const mx=({className:e,...t})=>a.jsx("div",{className:$("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});mx.displayName="DialogFooter";const Wa=h.forwardRef(({className:e,...t},r)=>a.jsx(co,{ref:r,className:$("text-base font-semibold leading-none tracking-tight",e),...t}));Wa.displayName=co.displayName;const go=h.forwardRef(({className:e,...t},r)=>a.jsx(uo,{ref:r,className:$("text-sm text-muted-foreground",e),...t}));go.displayName=uo.displayName;function KD({open:e,onClose:t,project:r}){const[n,s]=h.useState(null),i=_D(r.id),o=MD(r.id),l=r.share_token,c=n??(l?`${window.location.origin}/share/${l}`:null),d=()=>{i.mutate(void 0,{onSuccess:p=>{const x=`${window.location.origin}/share/${p.project.share_token}`;s(x),q.success("Public link enabled")},onError:()=>q.error("Failed to enable public link")})},u=()=>{o.mutate(void 0,{onSuccess:()=>{s(null),q.success("Public link revoked")},onError:()=>q.error("Failed to revoke link")})},f=()=>{c&&navigator.clipboard.writeText(c).then(()=>{q.success("Link copied to clipboard")})},m=!!c;return a.jsx(Fa,{open:e,onOpenChange:p=>!p&&t(),children:a.jsxs(la,{className:"sm:max-w-md overflow-hidden",children:[a.jsxs(Ba,{children:[a.jsxs(Wa,{className:"flex items-center gap-2",children:[a.jsx(ni,{className:"h-4 w-4"}),"Share project"]}),a.jsx(go,{children:"Allow anyone with the link to view this project without logging in."})]}),a.jsx("div",{className:"space-y-4 pt-2",children:m?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2 overflow-hidden",children:[a.jsx(jh,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),a.jsx("span",{className:"text-xs text-muted-foreground min-w-0 flex-1 break-all",children:c})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"flex-1",onClick:f,children:[a.jsx(tx,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy link"]}),a.jsxs(ne,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:u,disabled:o.isPending,children:[a.jsx(Mr,{className:"h-3.5 w-3.5 mr-1.5"}),"Revoke"]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone with this link can view the board, issues, and timeline. No account required."})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-dashed border-border px-3 py-4 text-center justify-center",children:[a.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"This project is private"})]}),a.jsxs(ne,{className:"w-full",onClick:d,disabled:i.isPending,children:[a.jsx(jh,{className:"h-4 w-4 mr-2"}),"Enable public link"]}),a.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Generates a secret link for read-only access. No write permissions granted."})]})})]})})}function iN(e=768){const[t,r]=h.useState(()=>typeof window<"u"?window.innerWidth<e:!1);return h.useEffect(()=>{const n=window.matchMedia(`(max-width: ${e-1}px)`),s=i=>r(i.matches);return r(n.matches),n.addEventListener("change",s),()=>n.removeEventListener("change",s)},[e]),t}const ey=["board","issues","sprints","timeline","access","reports","activity"];function YD(){const{projectKey:e,workspace:t}=zt(),{data:r,error:n}=La(e??""),{user:s}=Ie(),{data:i}=oa((r==null?void 0:r.id)??""),[o,l]=h.useState(!1),c=pt(),d=ql(),[u]=Kl(),f=iN(),m=(s==null?void 0:s.roles)??[],p=m.includes("super-admin")||m.includes("admin"),x=i==null?void 0:i.members.some(k=>k.user_id===(s==null?void 0:s.id)&&k.role==="manager"),g=p||x;h.useEffect(()=>{n&&n instanceof Qp&&(n.status===403||n.status===404)&&c(`/${t}/projects`,{replace:!0})},[n,t,c]),h.useEffect(()=>{const k=u.get("tab");if(!k||!ey.includes(k))return;ey.every(C=>!d.pathname.endsWith(`/${C}`))&&c(`/${t}/projects/${e}/${k}`,{replace:!0})},[]);const v=`/${t}/projects/${e}`,y=[{to:`${v}/board`,label:"Board",icon:Sd,end:!0,desktopOnly:!0},{to:`${v}/issues`,label:"Issues",icon:Zn,end:!1},{to:`${v}/sprints`,label:"Sprints",icon:ia,end:!0},{to:`${v}/timeline`,label:"Timeline",icon:ri,end:!0,desktopOnly:!0},{to:`${v}/access`,label:"Access",icon:ai,end:!0},{to:`${v}/reports`,label:"Reports",icon:xs,end:!0},{to:`${v}/activity`,label:"Activity",icon:zu,end:!0}],j=y,N=y.filter(k=>!k.desktopOnly),w=d.pathname.endsWith("/board")||d.pathname.endsWith("/timeline");return f&&w?a.jsx(Vn,{to:`${v}/issues`,replace:!0}):a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{className:"border-b border-border bg-white dark:bg-card shrink-0 px-4 pt-4 md:px-6 md:pt-5",children:[a.jsxs("div",{className:"flex items-center gap-2.5 mb-3 md:mb-4",children:[r&&a.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:r.identifier}),a.jsx("h1",{className:"text-sm font-semibold",children:(r==null?void 0:r.name)??""})]}),a.jsxs("div",{className:"hidden md:flex items-center -mb-px",children:[a.jsx("div",{className:"flex flex-1",children:j.map(({to:k,label:b,icon:C,end:_})=>a.jsxs(bn,{to:k,end:_,className:({isActive:S})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${S?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(C,{className:"h-3.5 w-3.5",strokeWidth:1.5}),b]},k))}),g&&r&&a.jsx("div",{className:"pb-px pr-1",children:a.jsxs(ne,{variant:"ghost",size:"sm",onClick:()=>l(!0),className:"h-7 px-2 text-xs text-muted-foreground",children:[a.jsx(C5,{className:"h-3.5 w-3.5 mr-1"}),"Share"]})})]}),a.jsx("div",{className:"flex md:hidden overflow-x-auto -mb-px scrollbar-none",children:N.map(({to:k,label:b,icon:C,end:_})=>a.jsxs(bn,{to:k,end:_,className:({isActive:S})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 whitespace-nowrap transition-colors shrink-0 ${S?"border-indigo-600 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400 font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[a.jsx(C,{className:"h-3.5 w-3.5",strokeWidth:1.5}),b]},k))})]}),a.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:a.jsx(Hl,{})}),r&&a.jsx(KD,{open:o,onClose:()=>l(!1),project:r})]})}function GD(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsx(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(mo,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(On,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Lu,{className:"size-4"}),"Sign out"]})]})]})})})}function VD(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(qu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Yu,{children:a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(xs,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Reporting"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Time analytics"})]})]})})})}),a.jsx(Vu,{children:a.jsx(Ws,{children:a.jsx(Us,{children:a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Ql,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Gu,{children:a.jsx(GD,{})})]})}function XD(){return a.jsxs(Uu,{children:[a.jsx(VD,{}),a.jsxs(Ku,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(Hu,{className:"-ml-1"}),a.jsx(po,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(xs,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Reporting"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Xu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Hl,{})})]})]})}function QD(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsx(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(mo,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(On,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Lu,{className:"size-4"}),"Sign out"]})]})]})})})}function ZD(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(qu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Yu,{children:a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(ox,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Org Settings"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Global configuration"})]})]})})})}),a.jsx(Vu,{children:a.jsx(Ws,{children:a.jsx(Us,{children:a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Ql,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Gu,{children:a.jsx(QD,{})})]})}function JD(){return a.jsxs(Uu,{children:[a.jsx(ZD,{}),a.jsxs(Ku,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(Hu,{className:"-ml-1"}),a.jsx(po,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(ox,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Org Settings"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Xu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Hl,{})})]})]})}function eT(){var s,i;const{user:e,logout:t}=Ie(),r=e?`${((s=e.first_name)==null?void 0:s[0])??""}${((i=e.last_name)==null?void 0:i[0])??""}`.toUpperCase()||e.email[0].toUpperCase():"?",n=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[a.jsxs(Rt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&a.jsx(yl,{src:e.avatar_url,alt:n??"",className:"object-cover"}),a.jsx($t,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})]}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:n}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),a.jsx(mo,{className:"ml-auto size-4 shrink-0"})]})}),a.jsxs(Or,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[a.jsx(On,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[a.jsx(Lu,{className:"size-4"}),"Sign out"]})]})]})})})}function tT(){const{workspace:e}=Ie(),t=pt(),r=(e==null?void 0:e.slug)??"";return a.jsxs(qu,{collapsible:"offcanvas",variant:"inset",children:[a.jsx(Yu,{children:a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(St,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[a.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:a.jsx(Jl,{className:"size-4"})}),a.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[a.jsx("span",{className:"truncate font-semibold",children:"Profile"}),a.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Personal settings"})]})]})})})}),a.jsx(Vu,{children:a.jsx(Ws,{children:a.jsx(Us,{children:a.jsx(jr,{children:a.jsx(Mt,{children:a.jsxs(St,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[a.jsx(Ql,{}),a.jsx("span",{children:"Back to workspace"})]})})})})})}),a.jsx(Gu,{children:a.jsx(eT,{})})]})}function rT(){return a.jsxs(Uu,{children:[a.jsx(tT,{}),a.jsxs(Ku,{className:"flex flex-col min-w-0",children:[a.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:a.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[a.jsx(Hu,{className:"-ml-1"}),a.jsx(po,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Jl,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),a.jsx("span",{className:"font-medium",children:"Profile"})]}),a.jsx("div",{className:"ml-auto",children:a.jsx(Xu,{})})]})}),a.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:a.jsx(Hl,{})})]})]})}var ty=1,nT=.9,aT=.8,sT=.17,ym=.1,bm=.999,iT=.9999,oT=.99,lT=/[\\\/_+.#"@\[\(\{&]/,cT=/[\\\/_+.#"@\[\(\{&]/g,dT=/[\s-]/,oN=/[\s-]/g;function kh(e,t,r,n,s,i,o){if(i===t.length)return s===e.length?ty:oT;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),d=r.indexOf(c,s),u=0,f,m,p,x;d>=0;)f=kh(e,t,r,n,d+1,i+1,o),f>u&&(d===s?f*=ty:lT.test(e.charAt(d-1))?(f*=aT,p=e.slice(s,d-1).match(cT),p&&s>0&&(f*=Math.pow(bm,p.length))):dT.test(e.charAt(d-1))?(f*=nT,x=e.slice(s,d-1).match(oN),x&&s>0&&(f*=Math.pow(bm,x.length))):(f*=sT,s>0&&(f*=Math.pow(bm,d-s))),e.charAt(d)!==t.charAt(i)&&(f*=iT)),(f<ym&&r.charAt(d-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(d-1)!==n.charAt(i))&&(m=kh(e,t,r,n,d+1,i+2,o),m*ym>f&&(f=m*ym)),f>u&&(u=f),d=r.indexOf(c,d+1);return o[l]=u,u}function ry(e){return e.toLowerCase().replace(oN," ")}function uT(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,kh(e,t,ry(e),ry(t),0,0,{})}var Bo='[cmdk-group=""]',wm='[cmdk-group-items=""]',fT='[cmdk-group-heading=""]',hx='[cmdk-item=""]',ny=`${hx}:not([aria-disabled="true"])`,Sh="cmdk-item-select",Fs="data-value",mT=(e,t,r)=>uT(e,t,r),lN=h.createContext(void 0),ac=()=>h.useContext(lN),cN=h.createContext(void 0),px=()=>h.useContext(cN),dN=h.createContext(void 0),uN=h.forwardRef((e,t)=>{let r=Ri(()=>{var z,K;return{search:"",value:(K=(z=e.value)!=null?z:e.defaultValue)!=null?K:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=Ri(()=>new Set),s=Ri(()=>new Map),i=Ri(()=>new Map),o=Ri(()=>new Set),l=fN(e),{label:c,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:x,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,j=Bi(),N=Bi(),w=Bi(),k=h.useRef(null),b=kT();oi(()=>{if(u!==void 0){let z=u.trim();r.current.value=z,C.emit()}},[u]),oi(()=>{b(6,F)},[]);let C=h.useMemo(()=>({subscribe:z=>(o.current.add(z),()=>o.current.delete(z)),snapshot:()=>r.current,setState:(z,K,X)=>{var G,T,P;if(!Object.is(r.current[z],K)){if(r.current[z]=K,z==="search")O(),I(),b(1,E);else if(z==="value"&&(X||b(5,F),((G=l.current)==null?void 0:G.value)!==void 0)){let Z=K??"";(P=(T=l.current).onValueChange)==null||P.call(T,Z);return}C.emit()}},emit:()=>{o.current.forEach(z=>z())}}),[]),_=h.useMemo(()=>({value:(z,K,X)=>{var G;K!==((G=i.current.get(z))==null?void 0:G.value)&&(i.current.set(z,{value:K,keywords:X}),r.current.filtered.items.set(z,S(K,X)),b(2,()=>{I(),C.emit()}))},item:(z,K)=>(n.current.add(z),K&&(s.current.has(K)?s.current.get(K).add(z):s.current.set(K,new Set([z]))),b(3,()=>{O(),I(),r.current.value||E(),C.emit()}),()=>{i.current.delete(z),n.current.delete(z),r.current.filtered.items.delete(z);let X=D();b(4,()=>{O(),(X==null?void 0:X.getAttribute("id"))===z&&E(),C.emit()})}),group:z=>(s.current.has(z)||s.current.set(z,new Set),()=>{i.current.delete(z),s.current.delete(z)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:j,inputId:w,labelId:N,listInnerRef:k}),[]);function S(z,K){var X,G;let T=(G=(X=l.current)==null?void 0:X.filter)!=null?G:mT;return z?T(z,r.current.search,K):0}function I(){if(!r.current.search||l.current.shouldFilter===!1)return;let z=r.current.filtered.items,K=[];r.current.filtered.groups.forEach(G=>{let T=s.current.get(G),P=0;T.forEach(Z=>{let L=z.get(Z);P=Math.max(L,P)}),K.push([G,P])});let X=k.current;U().sort((G,T)=>{var P,Z;let L=G.getAttribute("id"),Y=T.getAttribute("id");return((P=z.get(Y))!=null?P:0)-((Z=z.get(L))!=null?Z:0)}).forEach(G=>{let T=G.closest(wm);T?T.appendChild(G.parentElement===T?G:G.closest(`${wm} > *`)):X.appendChild(G.parentElement===X?G:G.closest(`${wm} > *`))}),K.sort((G,T)=>T[1]-G[1]).forEach(G=>{var T;let P=(T=k.current)==null?void 0:T.querySelector(`${Bo}[${Fs}="${encodeURIComponent(G[0])}"]`);P==null||P.parentElement.appendChild(P)})}function E(){let z=U().find(X=>X.getAttribute("aria-disabled")!=="true"),K=z==null?void 0:z.getAttribute(Fs);C.setState("value",K||void 0)}function O(){var z,K,X,G;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let T=0;for(let P of n.current){let Z=(K=(z=i.current.get(P))==null?void 0:z.value)!=null?K:"",L=(G=(X=i.current.get(P))==null?void 0:X.keywords)!=null?G:[],Y=S(Z,L);r.current.filtered.items.set(P,Y),Y>0&&T++}for(let[P,Z]of s.current)for(let L of Z)if(r.current.filtered.items.get(L)>0){r.current.filtered.groups.add(P);break}r.current.filtered.count=T}function F(){var z,K,X;let G=D();G&&(((z=G.parentElement)==null?void 0:z.firstChild)===G&&((X=(K=G.closest(Bo))==null?void 0:K.querySelector(fT))==null||X.scrollIntoView({block:"nearest"})),G.scrollIntoView({block:"nearest"}))}function D(){var z;return(z=k.current)==null?void 0:z.querySelector(`${hx}[aria-selected="true"]`)}function U(){var z;return Array.from(((z=k.current)==null?void 0:z.querySelectorAll(ny))||[])}function M(z){let K=U()[z];K&&C.setState("value",K.getAttribute(Fs))}function H(z){var K;let X=D(),G=U(),T=G.findIndex(Z=>Z===X),P=G[T+z];(K=l.current)!=null&&K.loop&&(P=T+z<0?G[G.length-1]:T+z===G.length?G[0]:G[T+z]),P&&C.setState("value",P.getAttribute(Fs))}function re(z){let K=D(),X=K==null?void 0:K.closest(Bo),G;for(;X&&!G;)X=z>0?jT(X,Bo):NT(X,Bo),G=X==null?void 0:X.querySelector(ny);G?C.setState("value",G.getAttribute(Fs)):H(z)}let J=()=>M(U().length-1),R=z=>{z.preventDefault(),z.metaKey?J():z.altKey?re(1):H(1)},A=z=>{z.preventDefault(),z.metaKey?M(0):z.altKey?re(-1):H(-1)};return h.createElement(ws.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:z=>{var K;if((K=y.onKeyDown)==null||K.call(y,z),!z.defaultPrevented)switch(z.key){case"n":case"j":{v&&z.ctrlKey&&R(z);break}case"ArrowDown":{R(z);break}case"p":case"k":{v&&z.ctrlKey&&A(z);break}case"ArrowUp":{A(z);break}case"Home":{z.preventDefault(),M(0);break}case"End":{z.preventDefault(),J();break}case"Enter":if(!z.nativeEvent.isComposing&&z.keyCode!==229){z.preventDefault();let X=D();if(X){let G=new Event(Sh);X.dispatchEvent(G)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:CT},c),Qu(e,z=>h.createElement(cN.Provider,{value:C},h.createElement(lN.Provider,{value:_},z))))}),hT=h.forwardRef((e,t)=>{var r,n;let s=Bi(),i=h.useRef(null),o=h.useContext(dN),l=ac(),c=fN(e),d=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;oi(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let u=mN(s,i,[e.value,e.children,i],e.keywords),f=px(),m=li(b=>b.value&&b.value===u.current),p=li(b=>d||l.filter()===!1?!0:b.search?b.filtered.items.get(s)>0:!0);h.useEffect(()=>{let b=i.current;if(!(!b||e.disabled))return b.addEventListener(Sh,x),()=>b.removeEventListener(Sh,x)},[p,e.onSelect,e.disabled]);function x(){var b,C;g(),(C=(b=c.current).onSelect)==null||C.call(b,u.current)}function g(){f.setState("value",u.current,!0)}if(!p)return null;let{disabled:v,value:y,onSelect:j,forceMount:N,keywords:w,...k}=e;return h.createElement(ws.div,{ref:bl([i,t]),...k,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!m,"data-disabled":!!v,"data-selected":!!m,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:x},e.children)}),pT=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:s,...i}=e,o=Bi(),l=h.useRef(null),c=h.useRef(null),d=Bi(),u=ac(),f=li(p=>s||u.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);oi(()=>u.group(o),[]),mN(o,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:o,forceMount:s}),[s]);return h.createElement(ws.div,{ref:bl([l,t]),...i,"cmdk-group":"",role:"presentation",hidden:f?void 0:!0},r&&h.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},r),Qu(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},h.createElement(dN.Provider,{value:m},p))))}),xT=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,s=h.useRef(null),i=li(o=>!o.search);return!r&&!i?null:h.createElement(ws.div,{ref:bl([s,t]),...n,"cmdk-separator":"",role:"separator"})}),gT=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,s=e.value!=null,i=px(),o=li(u=>u.search),l=li(u=>u.value),c=ac(),d=h.useMemo(()=>{var u;let f=(u=c.listInnerRef.current)==null?void 0:u.querySelector(`${hx}[${Fs}="${encodeURIComponent(l)}"]`);return f==null?void 0:f.getAttribute("id")},[]);return h.useEffect(()=>{e.value!=null&&i.setState("search",e.value)},[e.value]),h.createElement(ws.input,{ref:t,...n,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":d,id:c.inputId,type:"text",value:s?e.value:o,onChange:u=>{s||i.setState("search",u.target.value),r==null||r(u.target.value)}})}),vT=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...s}=e,i=h.useRef(null),o=h.useRef(null),l=ac();return h.useEffect(()=>{if(o.current&&i.current){let c=o.current,d=i.current,u,f=new ResizeObserver(()=>{u=requestAnimationFrame(()=>{let m=c.offsetHeight;d.style.setProperty("--cmdk-list-height",m.toFixed(1)+"px")})});return f.observe(c),()=>{cancelAnimationFrame(u),f.unobserve(c)}}},[]),h.createElement(ws.div,{ref:bl([i,t]),...s,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},Qu(e,c=>h.createElement("div",{ref:bl([o,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),yT=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:s,contentClassName:i,container:o,...l}=e;return h.createElement(Gl,{open:r,onOpenChange:n},h.createElement(Yl,{container:o},h.createElement(gi,{"cmdk-overlay":"",className:s}),h.createElement(vi,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(uN,{ref:t,...l}))))}),bT=h.forwardRef((e,t)=>li(r=>r.filtered.count===0)?h.createElement(ws.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),wT=h.forwardRef((e,t)=>{let{progress:r,children:n,label:s="Loading...",...i}=e;return h.createElement(ws.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},Qu(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),Yr=Object.assign(uN,{List:vT,Item:hT,Input:gT,Group:pT,Separator:xT,Dialog:yT,Empty:bT,Loading:wT});function jT(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function NT(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function fN(e){let t=h.useRef(e);return oi(()=>{t.current=e}),t}var oi=typeof window>"u"?h.useEffect:h.useLayoutEffect;function Ri(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function bl(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function li(e){let t=px(),r=()=>e(t.snapshot());return PP.useSyncExternalStore(t.subscribe,r,r)}function mN(e,t,r,n=[]){let s=h.useRef(),i=ac();return oi(()=>{var o;let l=(()=>{var d;for(let u of r){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(d=u.current.textContent)==null?void 0:d.trim():s.current}})(),c=n.map(d=>d.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Fs,l),s.current=l}),s}var kT=()=>{let[e,t]=h.useState(),r=Ri(()=>new Map);return oi(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,s)=>{r.current.set(n,s),t({})}};function ST(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function Qu({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(ST(t),{ref:t.ref},r(t.props.children)):r(t)}var CT={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Vs=h.forwardRef(({className:e,...t},r)=>a.jsx(Yr,{ref:r,className:$("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Vs.displayName=Yr.displayName;const _T=({children:e,open:t,onOpenChange:r})=>a.jsx(Fa,{open:t,onOpenChange:r,children:a.jsx(la,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:a.jsx(Vs,{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})})}),Zu=h.forwardRef(({className:e,...t},r)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(ji,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Yr.Input,{ref:r,className:$("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),...t})]}));Zu.displayName=Yr.Input.displayName;const Xs=h.forwardRef(({className:e,...t},r)=>a.jsx(Yr.List,{ref:r,className:$("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...t}));Xs.displayName=Yr.List.displayName;const Ju=h.forwardRef((e,t)=>a.jsx(Yr.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));Ju.displayName=Yr.Empty.displayName;const is=h.forwardRef(({className:e,...t},r)=>a.jsx(Yr.Group,{ref:r,className:$("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),...t}));is.displayName=Yr.Group.displayName;const hN=h.forwardRef(({className:e,...t},r)=>a.jsx(Yr.Separator,{ref:r,className:$("-mx-1 h-px bg-border",e),...t}));hN.displayName=Yr.Separator.displayName;const dn=h.forwardRef(({className:e,...t},r)=>a.jsx(Yr.Item,{ref:r,className:$("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),...t}));dn.displayName=Yr.Item.displayName;function MT(){const{open:e,setOpen:t}=Vp(),r=pt(),{data:n}=xo(),{workspace:s}=Ie(),i=(s==null?void 0:s.slug)??"",o=l=>{t(!1),l()};return a.jsxs(_T,{open:e,onOpenChange:t,children:[a.jsx(Zu,{placeholder:"Search or jump to..."}),a.jsxs(Xs,{children:[a.jsx(Ju,{children:"No results found."}),a.jsxs(is,{heading:"Navigation",children:[a.jsxs(dn,{onSelect:()=>o(()=>r(`/${i}/projects`)),children:[a.jsx(Sd,{className:"text-muted-foreground"}),a.jsx("span",{children:"Projects"})]}),a.jsxs(dn,{onSelect:()=>o(()=>r(`/${i}/notifications`)),children:[a.jsx(ti,{className:"text-muted-foreground"}),a.jsx("span",{children:"Notifications"})]}),a.jsxs(dn,{onSelect:()=>o(()=>r(`/${i}/settings`)),children:[a.jsx(lx,{className:"text-muted-foreground"}),a.jsx("span",{children:"Settings"})]})]}),n&&n.length>0&&a.jsxs(a.Fragment,{children:[a.jsx(hN,{}),a.jsxs(is,{heading:"Projects",children:[n.map(l=>a.jsxs(dn,{value:`${l.name} board`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/board`)),children:[a.jsx(qr,{className:"text-muted-foreground"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),a.jsx("span",{className:"truncate",children:l.name}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),n.map(l=>a.jsxs(dn,{value:`${l.name} issues`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/issues`)),children:[a.jsx(Zn,{className:"text-muted-foreground"}),a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),a.jsx("span",{className:"truncate",children:l.name}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Sr({zone:e,props:t}){const r=QA(e);return r.length?a.jsx(a.Fragment,{children:r.map((n,s)=>a.jsx(n,{...t},n.displayName??n.name??s))}):null}function xx({flow:e,inviteToken:t,label:r,disabled:n}){const s=()=>{const i=`${Yi}/auth/google?flow=${e}${t?`&invite_token=${encodeURIComponent(t)}`:""}`;window.location.href=i};return a.jsxs(ne,{type:"button",variant:"outline",className:"w-full gap-2 bg-white dark:bg-black text-black dark:text-white",onClick:s,disabled:n,children:[a.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[a.jsx("path",{d:"M17.64 9.205c0-.639-.057-1.252-.164-1.841H9v3.481h4.844a4.14 4.14 0 0 1-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4"}),a.jsx("path",{d:"M9 18c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H.957v2.332A8.997 8.997 0 0 0 9 18z",fill:"#34A853"}),a.jsx("path",{d:"M3.964 10.71A5.41 5.41 0 0 1 3.682 9c0-.593.102-1.17.282-1.71V4.958H.957A8.996 8.996 0 0 0 0 9c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05"}),a.jsx("path",{d:"M9 3.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C13.463.891 11.426 0 9 0A8.997 8.997 0 0 0 .957 4.958L3.964 7.29C4.672 5.163 6.656 3.58 9 3.58z",fill:"#EA4335"})]}),r??"Continue with Google"]})}function sc(){var e;return((e=window.__MERIDIAN_CONFIG__)==null?void 0:e.appName)??"Meridian"}function OT(){var e;return(e=window.__MERIDIAN_CONFIG__)==null?void 0:e.logoUrl}function ic({className:e}){const t=OT();return t?a.jsx("img",{src:t,alt:sc(),className:e??"h-12 w-12"}):a.jsx("div",{className:e??"relative h-16 w-16 rounded-2xl bg-white dark:bg-card border border-border shadow-sm flex items-center justify-center",children:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}function PT(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(!1),o=pt(),l=rD(),{data:c}=Wu(),d=u=>{u.preventDefault(),l.mutate({email:e,password:r},{onSuccess:()=>o("/"),onError:f=>q.error(f.message??"Invalid email or password")})};return a.jsx("div",{className:"min-h-screen bg-white dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsx(Sr,{zone:"login.before",props:{}}),a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(ic,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",sc()]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),a.jsxs("form",{onSubmit:d,className:"space-y-2",children:[a.jsx(Ae,{type:"email",placeholder:"Email",value:e,onChange:u=>t(u.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{type:s?"text":"password",placeholder:"Password",value:r,onChange:u=>n(u.target.value),autoComplete:"current-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>i(!s),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:s?a.jsx(Zl,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsx(Ur,{to:"/forgot-password",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:l.isPending,children:l.isPending?"Signing in...":"Continue with Email"})})]}),(c==null?void 0:c.googleOAuthEnabled)&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(xx,{flow:"login"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",a.jsx(Ur,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]}),a.jsx(Sr,{zone:"login.after",props:{}})]})})}function ET(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=pt(),f=nD(),{data:m}=Wu(),p=(m==null?void 0:m.needsSetup)===!0,x=g=>{g.preventDefault(),f.mutate({email:s,password:o,first_name:e,last_name:r},{onSuccess:()=>u("/"),onError:v=>q.error(v.message??"Registration failed")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(ic,{}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:p?"Set up your account":"Create your account"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:p?"You're the first user — you'll be the super admin.":`Get started with ${sc()}`})]})]}),a.jsxs("form",{onSubmit:x,className:"space-y-2",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(Ae,{placeholder:"First name",value:e,onChange:g=>t(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx(Ae,{placeholder:"Last name",value:r,onChange:g=>n(g.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),a.jsx(Ae,{type:"email",placeholder:"Email",value:s,onChange:g=>i(g.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{type:c?"text":"password",placeholder:"Password",value:o,onChange:g=>l(g.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(Zl,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:f.isPending,children:f.isPending?"Creating account...":"Create Account"})})]}),(m==null?void 0:m.googleOAuthEnabled)&&a.jsxs("div",{className:"mt-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"h-px flex-1 bg-border"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx(xx,{flow:"register",label:p?"Set up with Google":"Continue with Google"})]}),a.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",a.jsx(Ur,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})})}function AT(){const[e,t]=h.useState(""),r=pt(),{setWorkspace:n}=Ie(),s=B5(),i=o=>{o.preventDefault(),e.trim()&&s.mutate({name:e.trim()},{onSuccess:l=>{const c={id:l.workspace.id,name:l.workspace.name,slug:l.workspace.slug};n(c),r(`/${c.slug}/projects`,{replace:!0})},onError:l=>q.error(l.message??"Failed to create workspace")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[380px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(ic,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Create your ",sc()," workspace"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),a.jsxs("form",{onSubmit:i,className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(Ae,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:o=>t(o.target.value),autoFocus:!0,required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||s.isPending,children:s.isPending?"Creating workspace...":"Create workspace"})]})]})})}function DT(){const{logout:e}=Ie();return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[380px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.jsx(ic,{}),a.jsxs("div",{className:"text-center",children:[a.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Waiting for ",sc()," access"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"You've been added to the system, but haven't been assigned to a workspace yet. An admin will add you shortly."})]})]}),a.jsx(ne,{variant:"outline",className:"w-full",onClick:e,children:"Sign out"})]})})}function TT(e){if(typeof document>"u")return;let t=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",t.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}const pN=B.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}),oc=()=>{const e=B.useContext(pN);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};TT(`[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(
554
554
  [data-state=closed]
555
555
  ){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 IT(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function RT(){return gx(/^Mac/)}function $T(){return gx(/^iPhone/)}function ay(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function zT(){return gx(/^iPad/)||RT()&&navigator.maxTouchPoints>1}function xN(){return $T()||zT()}function gx(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const LT=24,FT=typeof window<"u"?h.useLayoutEffect:h.useEffect;function sy(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const jm=typeof document<"u"&&window.visualViewport;function iy(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function gN(e){for(iy(e)&&(e=e.parentElement);e&&!iy(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const BT=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Lc=0,Nm;function WT(e={}){let{isDisabled:t}=e;FT(()=>{if(!t)return Lc++,Lc===1&&xN()&&(Nm=UT()),()=>{Lc--,Lc===0&&(Nm==null||Nm())}},[t])}function UT(){let e,t=0,r=f=>{e=gN(f.target),!(e===document.documentElement&&e===document.body)&&(t=f.changedTouches[0].pageY)},n=f=>{if(!e||e===document.documentElement||e===document.body){f.preventDefault();return}let m=f.changedTouches[0].pageY,p=e.scrollTop,x=e.scrollHeight-e.clientHeight;x!==0&&((p<=0&&m>t||p>=x&&m<t)&&f.preventDefault(),t=m)},s=f=>{let m=f.target;Ch(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;Ch(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",jm&&(jm.height<window.innerHeight?requestAnimationFrame(()=>{oy(m)}):jm.addEventListener("resize",()=>oy(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,d=sy(qT(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=sy(Wo(document,"touchstart",r,{passive:!1,capture:!0}),Wo(document,"touchmove",n,{passive:!1,capture:!0}),Wo(document,"touchend",s,{passive:!1,capture:!0}),Wo(document,"focus",i,!0),Wo(window,"scroll",o));return()=>{d(),u(),window.scrollTo(l,c)}}function qT(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function Wo(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function oy(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=gN(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,s=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=r.getBoundingClientRect().bottom+LT;i>o&&(r.scrollTop+=s-n)}e=r.parentElement}}function Ch(e){return e instanceof HTMLInputElement&&!BT.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function HT(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function KT(...e){return t=>e.forEach(r=>HT(r,t))}function vN(...e){return h.useCallback(KT(...e),e)}const yN=new WeakMap;function Ft(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([s,i])=>{if(s.startsWith("--")){e.style.setProperty(s,i);return}n[s]=e.style[s],e.style[s]=i}),!r&&yN.set(e,n)}function YT(e,t){if(!e||!(e instanceof HTMLElement))return;let r=yN.get(e);r&&(e.style[t]=r[t])}const Dt=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Fc(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let s=n.match(/^matrix3d\((.+)\)$/);return s?parseFloat(s[1].split(", ")[Dt(t)?13:12]):(s=n.match(/^matrix\((.+)\)$/),s?parseFloat(s[1].split(", ")[Dt(t)?5:4]):null)}function GT(e){return 8*(Math.log(e+1)-2)}function km(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function VT(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const wt={DURATION:.5,EASE:[.32,.72,0,1]},bN=.4,XT=.25,QT=100,wN=8,Ms=16,_h=26,Sm="vaul-dragging";function jN(e){const t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function ZT({defaultProp:e,onChange:t}){const r=B.useState(e),[n]=r,s=B.useRef(n),i=jN(t);return B.useEffect(()=>{s.current!==n&&(i(n),s.current=n)},[n,s,i]),r}function NN({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,s]=ZT({defaultProp:t,onChange:r}),i=e!==void 0,o=i?e:n,l=jN(r),c=B.useCallback(d=>{if(i){const f=typeof d=="function"?d(e):d;f!==e&&l(f)}else s(d)},[i,e,s,l]);return[o,c]}function JT({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:s,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:d}){const[u,f]=NN({prop:e,defaultProp:r==null?void 0:r[0],onChange:t}),[m,p]=B.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);B.useEffect(()=>{function C(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",C),()=>window.removeEventListener("resize",C)},[]);const x=B.useMemo(()=>u===(r==null?void 0:r[r.length-1])||null,[r,u]),g=B.useMemo(()=>{var C;return(C=r==null?void 0:r.findIndex(_=>_===u))!=null?C:null},[r,u]),v=r&&r.length>0&&(i||i===0)&&!Number.isNaN(i)&&r[i]===u||!r,y=B.useMemo(()=>{const C=c?{width:c.getBoundingClientRect().width,height:c.getBoundingClientRect().height}:typeof window<"u"?{width:window.innerWidth,height:window.innerHeight}:{width:0,height:0};var _;return(_=r==null?void 0:r.map(S=>{const I=typeof S=="string";let E=0;if(I&&(E=parseInt(S,10)),Dt(l)){const F=I?E:m?S*C.height:0;return m?l==="bottom"?C.height-F:-C.height+F:F}const O=I?E:m?S*C.width:0;return m?l==="right"?C.width-O:-C.width+O:O}))!=null?_:[]},[r,m,c]),j=B.useMemo(()=>g!==null?y==null?void 0:y[g]:null,[y,g]),N=B.useCallback(C=>{var _;const S=(_=y==null?void 0:y.findIndex(I=>I===C))!=null?_:null;o(S),Ft(n.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(l)?`translate3d(0, ${C}px, 0)`:`translate3d(${C}px, 0, 0)`}),y&&S!==y.length-1&&i!==void 0&&S!==i&&S<i?Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"0"}):Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),f(r==null?void 0:r[Math.max(S,0)])},[n.current,r,y,i,s,f]);B.useEffect(()=>{if(u||e){var C;const _=(C=r==null?void 0:r.findIndex(S=>S===e||S===u))!=null?C:-1;y&&_!==-1&&typeof y[_]=="number"&&N(y[_])}},[u,e,r,y,N]);function w({draggedDistance:C,closeDrawer:_,velocity:S,dismissible:I}){if(i===void 0)return;const E=l==="bottom"||l==="right"?(j??0)-C:(j??0)+C,O=g===i-1,F=g===0,D=C>0;if(O&&Ft(s.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),!d&&S>2&&!D){I?_():N(y[0]);return}if(!d&&S>2&&D&&y&&r){N(y[r.length-1]);return}const U=y==null?void 0:y.reduce((H,re)=>typeof H!="number"||typeof re!="number"?H:Math.abs(re-E)<Math.abs(H-E)?re:H),M=Dt(l)?window.innerHeight:window.innerWidth;if(S>bN&&Math.abs(C)<M*.4){const H=D?1:-1;if(H>0&&x&&r){N(y[r.length-1]);return}if(F&&H<0&&I&&_(),g===null)return;N(y[g+H]);return}N(U)}function k({draggedDistance:C}){if(j===null)return;const _=l==="bottom"||l==="right"?j-C:j+C;(l==="bottom"||l==="right")&&_<y[y.length-1]||(l==="top"||l==="left")&&_>y[y.length-1]||Ft(n.current,{transform:Dt(l)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function b(C,_){if(!r||typeof g!="number"||!y||i===void 0)return null;const S=g===i-1;if(g>=i&&_)return 0;if(S&&!_)return 1;if(!v&&!S)return null;const E=S?g+1:g-1,O=S?y[E]-y[E-1]:y[E+1]-y[E],F=C/Math.abs(O);return S?1-F:F}return{isLastSnapPoint:x,activeSnapPoint:u,shouldFade:v,getPercentageDragged:b,setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:w,onDrag:k,snapPointsOffset:y}}const e3=()=>()=>{};function t3(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:s}=oc(),i=B.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-_h)/window.innerWidth}B.useEffect(()=>{if(t&&r){i.current&&clearTimeout(i.current);const c=document.querySelector("[data-vaul-drawer-wrapper]")||document.querySelector("[vaul-drawer-wrapper]");if(!c)return;VT(n&&!s?km(document.body,{background:"black"}):e3,km(c,{transformOrigin:Dt(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`}));const d=km(c,{borderRadius:`${wN}px`,overflow:"hidden",...Dt(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()=>{d(),i.current=window.setTimeout(()=>{o?document.body.style.background=o:document.body.style.removeProperty("background")},wt.DURATION*1e3)}}},[t,r,o])}let Uo=null;function r3({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:s,noBodyStyles:i}){const[o,l]=B.useState(()=>typeof window<"u"?window.location.href:""),c=B.useRef(0),d=B.useCallback(()=>{if(ay()&&Uo===null&&e&&!i){Uo={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:`${-c.current}px`,left:`${-f}px`,right:"0px",height:"auto"}),window.setTimeout(()=>window.requestAnimationFrame(()=>{const p=m-window.innerHeight;p&&c.current>=m&&(document.body.style.top=`${-(c.current+p)}px`)}),300)}},[e]),u=B.useCallback(()=>{if(ay()&&Uo!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,Uo),window.requestAnimationFrame(()=>{if(s&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),Uo=null}},[o]);return B.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),B.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),B.useEffect(()=>{r||!n||(e?(!window.matchMedia("(display-mode: standalone)").matches&&d(),t||window.setTimeout(()=>{u()},500)):u())},[e,n,o,t,r,d,u]),{restorePositionSetting:u}}function n3({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:s,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=XT,scrollLockTimeout:d=QT,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:x,fixed:g,modal:v=!0,onClose:y,nested:j,noBodyStyles:N=!1,direction:w="bottom",defaultOpen:k=!1,disablePreventScroll:b=!0,snapToSequentialPoint:C=!1,preventScrollRestoration:_=!1,repositionInputs:S=!0,onAnimationEnd:I,container:E,autoFocus:O=!1}){var F,D;const[U=!1,M]=NN({defaultProp:k,prop:e,onChange:Oe=>{t==null||t(Oe),!Oe&&!j&&Ze(),setTimeout(()=>{I==null||I(Oe)},wt.DURATION*1e3),Oe&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),Oe||(document.body.style.pointerEvents="auto")}}),[H,re]=B.useState(!1),[J,R]=B.useState(!1),[A,z]=B.useState(!1),K=B.useRef(null),X=B.useRef(null),G=B.useRef(null),T=B.useRef(null),P=B.useRef(null),Z=B.useRef(!1),L=B.useRef(null),Y=B.useRef(0),ae=B.useRef(!1),ee=B.useRef(!k),se=B.useRef(0),V=B.useRef(null),ie=B.useRef(((F=V.current)==null?void 0:F.getBoundingClientRect().height)||0),he=B.useRef(((D=V.current)==null?void 0:D.getBoundingClientRect().width)||0),xe=B.useRef(0),ve=B.useCallback(Oe=>{i&&Oe===Fe.length-1&&(X.current=new Date)},[]),{activeSnapPoint:Q,activeSnapPointIndex:ge,setActiveSnapPoint:De,onRelease:Ue,snapPointsOffset:Fe,onDrag:Ve,shouldFade:ut,getPercentageDragged:Ke}=JT({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:x,drawerRef:V,fadeFromIndex:m,overlayRef:K,onSnapPointChange:ve,direction:w,container:E,snapToSequentialPoint:C});WT({isDisabled:!U||J||!v||A||!H||!S||!b});const{restorePositionSetting:Ze}=r3({isOpen:U,modal:v,nested:j??!1,hasBeenOpened:H,preventScrollRestoration:_,noBodyStyles:N});function tr(){return(window.innerWidth-_h)/window.innerWidth}function Ir(Oe){var pe,Ne;!u&&!i||V.current&&!V.current.contains(Oe.target)||(ie.current=((pe=V.current)==null?void 0:pe.getBoundingClientRect().height)||0,he.current=((Ne=V.current)==null?void 0:Ne.getBoundingClientRect().width)||0,R(!0),G.current=new Date,xN()&&window.addEventListener("touchend",()=>Z.current=!1,{once:!0}),Oe.target.setPointerCapture(Oe.pointerId),Y.current=Dt(w)?Oe.pageY:Oe.pageX)}function rr(Oe,pe){var Ne;let me=Oe;const ye=(Ne=window.getSelection())==null?void 0:Ne.toString(),Xe=V.current?Fc(V.current,w):null,de=new Date;if(me.tagName==="SELECT"||me.hasAttribute("data-vaul-no-drag")||me.closest("[data-vaul-no-drag]"))return!1;if(w==="right"||w==="left")return!0;if(X.current&&de.getTime()-X.current.getTime()<500)return!1;if(Xe!==null&&(w==="bottom"?Xe>0:Xe<0))return!0;if(ye&&ye.length>0)return!1;if(P.current&&de.getTime()-P.current.getTime()<d&&Xe===0||pe)return P.current=de,!1;for(;me;){if(me.scrollHeight>me.clientHeight){if(me.scrollTop!==0)return P.current=new Date,!1;if(me.getAttribute("role")==="dialog")return!0}me=me.parentNode}return!0}function vr(Oe){if(V.current&&J){const pe=w==="bottom"||w==="right"?1:-1,Ne=(Y.current-(Dt(w)?Oe.pageY:Oe.pageX))*pe,me=Ne>0,ye=i&&!u&&!me;if(ye&&ge===0)return;const Xe=Math.abs(Ne),de=document.querySelector("[data-vaul-drawer-wrapper]"),_e=w==="bottom"||w==="top"?ie.current:he.current;let Te=Xe/_e;const bt=Ke(Xe,me);if(bt!==null&&(Te=bt),ye&&Te>=1||!Z.current&&!rr(Oe.target,me))return;if(V.current.classList.add(Sm),Z.current=!0,Ft(V.current,{transition:"none"}),Ft(K.current,{transition:"none"}),i&&Ve({draggedDistance:Ne}),me&&!i){const nt=GT(Ne),yr=Math.min(nt*-1,0)*pe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${yr}px, 0)`:`translate3d(${yr}px, 0, 0)`});return}const rt=1-Te;if((ut||m&&ge===m-1)&&(n==null||n(Oe,Te),Ft(K.current,{opacity:`${rt}`,transition:"none"},!0)),de&&K.current&&o){const nt=Math.min(tr()+Te*(1-tr()),1),yr=8-Te*8,sr=Math.max(0,14-Te*14);Ft(de,{borderRadius:`${yr}px`,transform:Dt(w)?`scale(${nt}) translate3d(0, ${sr}px, 0)`:`scale(${nt}) translate3d(${sr}px, 0, 0)`,transition:"none"},!0)}if(!i){const nt=Xe*pe;Ft(V.current,{transform:Dt(w)?`translate3d(0, ${nt}px, 0)`:`translate3d(${nt}px, 0, 0)`})}}}B.useEffect(()=>{window.requestAnimationFrame(()=>{ee.current=!0})},[]),B.useEffect(()=>{var Oe;function pe(){if(!V.current||!S)return;const Ne=document.activeElement;if(Ch(Ne)||ae.current){var me;const ye=((me=window.visualViewport)==null?void 0:me.height)||0,Xe=window.innerHeight;let de=Xe-ye;const _e=V.current.getBoundingClientRect().height||0,Te=_e>Xe*.8;xe.current||(xe.current=_e);const bt=V.current.getBoundingClientRect().top;if(Math.abs(se.current-de)>60&&(ae.current=!ae.current),i&&i.length>0&&Fe&&ge){const rt=Fe[ge]||0;de+=rt}if(se.current=de,_e>ye||ae.current){const rt=V.current.getBoundingClientRect().height;let nt=rt;rt>ye&&(nt=ye-(Te?bt:_h)),g?V.current.style.height=`${rt-Math.max(de,0)}px`:V.current.style.height=`${Math.max(nt,ye-bt)}px`}else IT()||(V.current.style.height=`${xe.current}px`);i&&i.length>0&&!ae.current?V.current.style.bottom="0px":V.current.style.bottom=`${Math.max(de,0)}px`}}return(Oe=window.visualViewport)==null||Oe.addEventListener("resize",pe),()=>{var Ne;return(Ne=window.visualViewport)==null?void 0:Ne.removeEventListener("resize",pe)}},[ge,i,Fe]);function nr(Oe){Lt(),y==null||y(),Oe||M(!1),setTimeout(()=>{i&&De(i[0])},wt.DURATION*1e3)}function yt(){if(!V.current)return;const Oe=document.querySelector("[data-vaul-drawer-wrapper]"),pe=Fc(V.current,w);Ft(V.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`}),Ft(K.current,{transition:`opacity ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,opacity:"1"}),o&&pe&&pe>0&&U&&Ft(Oe,{borderRadius:`${wN}px`,overflow:"hidden",...Dt(w)?{transform:`scale(${tr()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${tr()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${wt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${wt.EASE.join(",")})`},!0)}function Lt(){!J||!V.current||(V.current.classList.remove(Sm),Z.current=!1,R(!1),T.current=new Date)}function Kt(Oe){if(!J||!V.current)return;V.current.classList.remove(Sm),Z.current=!1,R(!1),T.current=new Date;const pe=Fc(V.current,w);if(!Oe||!rr(Oe.target,!1)||!pe||Number.isNaN(pe)||G.current===null)return;const Ne=T.current.getTime()-G.current.getTime(),me=Y.current-(Dt(w)?Oe.pageY:Oe.pageX),ye=Math.abs(me)/Ne;if(ye>.05&&(z(!0),setTimeout(()=>{z(!1)},200)),i){Ue({draggedDistance:me*(w==="bottom"||w==="right"?1:-1),closeDrawer:nr,velocity:ye,dismissible:u}),s==null||s(Oe,!0);return}if(w==="bottom"||w==="right"?me>0:me<0){yt(),s==null||s(Oe,!0);return}if(ye>bN){nr(),s==null||s(Oe,!1);return}var Xe;const de=Math.min((Xe=V.current.getBoundingClientRect().height)!=null?Xe:0,window.innerHeight);var _e;const Te=Math.min((_e=V.current.getBoundingClientRect().width)!=null?_e:0,window.innerWidth),bt=w==="left"||w==="right";if(Math.abs(pe)>=(bt?Te:de)*c){nr(),s==null||s(Oe,!1);return}s==null||s(Oe,!0),yt()}B.useEffect(()=>(U&&(Ft(document.documentElement,{scrollBehavior:"auto"}),X.current=new Date),()=>{YT(document.documentElement,"scrollBehavior")}),[U]);function ar(Oe){const pe=Oe?(window.innerWidth-Ms)/window.innerWidth:1,Ne=Oe?-Ms:0;L.current&&window.clearTimeout(L.current),Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${pe}) translate3d(0, ${Ne}px, 0)`:`scale(${pe}) translate3d(${Ne}px, 0, 0)`}),!Oe&&V.current&&(L.current=setTimeout(()=>{const me=Fc(V.current,w);Ft(V.current,{transition:"none",transform:Dt(w)?`translate3d(0, ${me}px, 0)`:`translate3d(${me}px, 0, 0)`})},500))}function Rn(Oe,pe){if(pe<0)return;const Ne=(window.innerWidth-Ms)/window.innerWidth,me=Ne+pe*(1-Ne),ye=-Ms+pe*Ms;Ft(V.current,{transform:Dt(w)?`scale(${me}) translate3d(0, ${ye}px, 0)`:`scale(${me}) translate3d(${ye}px, 0, 0)`,transition:"none"})}function ua(Oe,pe){const Ne=Dt(w)?window.innerHeight:window.innerWidth,me=pe?(Ne-Ms)/Ne:1,ye=pe?-Ms:0;pe&&Ft(V.current,{transition:`transform ${wt.DURATION}s cubic-bezier(${wt.EASE.join(",")})`,transform:Dt(w)?`scale(${me}) translate3d(0, ${ye}px, 0)`:`scale(${me}) translate3d(${ye}px, 0, 0)`})}return B.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),B.createElement(Gl,{defaultOpen:k,onOpenChange:Oe=>{!u&&!Oe||(Oe?re(!0):nr(!0),M(Oe))},open:U},B.createElement(pN.Provider,{value:{activeSnapPoint:Q,snapPoints:i,setActiveSnapPoint:De,drawerRef:V,overlayRef:K,onOpenChange:t,onPress:Ir,onRelease:Kt,onDrag:vr,dismissible:u,shouldAnimate:ee,handleOnly:f,isOpen:U,isDragging:J,shouldFade:ut,closeDrawer:nr,onNestedDrag:Rn,onNestedOpenChange:ar,onNestedRelease:ua,keyboardIsOpen:ae,modal:v,snapPointsOffset:Fe,activeSnapPointIndex:ge,direction:w,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:N,container:E,autoFocus:O}},r))}const kN=B.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:s,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=oc(),d=vN(t,r),u=n&&n.length>0;if(!l)return null;const f=B.useCallback(m=>s(m),[s]);return B.createElement(gi,{onMouseUp:f,ref:d,"data-vaul-overlay":"","data-vaul-snap-points":o&&u?"true":"false","data-vaul-snap-points-overlay":o&&i?"true":"false","data-vaul-animate":c!=null&&c.current?"true":"false",...e})});kN.displayName="Drawer.Overlay";const SN=B.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},s){const{drawerRef:i,onPress:o,onRelease:l,onDrag:c,keyboardIsOpen:d,snapPointsOffset:u,activeSnapPointIndex:f,modal:m,isOpen:p,direction:x,snapPoints:g,container:v,handleOnly:y,shouldAnimate:j,autoFocus:N}=oc(),[w,k]=B.useState(!1),b=vN(s,i),C=B.useRef(null),_=B.useRef(null),S=B.useRef(!1),I=g&&g.length>0;t3();const E=(F,D,U=0)=>{if(S.current)return!0;const M=Math.abs(F.y),H=Math.abs(F.x),re=H>M,J=["bottom","right"].includes(D)?1:-1;if(D==="left"||D==="right"){if(!(F.x*J<0)&&H>=0&&H<=U)return re}else if(!(F.y*J<0)&&M>=0&&M<=U)return!re;return S.current=!0,!0};B.useEffect(()=>{I&&window.requestAnimationFrame(()=>{k(!0)})},[]);function O(F){C.current=null,S.current=!1,l(F)}return B.createElement(vi,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":w?"true":"false","data-vaul-snap-points":p&&I?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":j!=null&&j.current?"true":"false",...n,ref:b,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...t}:t,onPointerDown:F=>{y||(n.onPointerDown==null||n.onPointerDown.call(n,F),C.current={x:F.pageX,y:F.pageY},o(F))},onOpenAutoFocus:F=>{r==null||r(F),N||F.preventDefault()},onPointerDownOutside:F=>{if(e==null||e(F),!m||F.defaultPrevented){F.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:F=>{if(!m){F.preventDefault();return}},onPointerMove:F=>{if(_.current=F,y||(n.onPointerMove==null||n.onPointerMove.call(n,F),!C.current))return;const D=F.pageY-C.current.y,U=F.pageX-C.current.x,M=F.pointerType==="touch"?10:2;E({x:U,y:D},x,M)?c(F):(Math.abs(U)>M||Math.abs(D)>M)&&(C.current=null)},onPointerUp:F=>{n.onPointerUp==null||n.onPointerUp.call(n,F),C.current=null,S.current=!1,l(F)},onPointerOut:F=>{n.onPointerOut==null||n.onPointerOut.call(n,F),O(_.current)},onContextMenu:F=>{n.onContextMenu==null||n.onContextMenu.call(n,F),_.current&&O(_.current)}})});SN.displayName="Drawer.Content";const a3=250,s3=120,i3=B.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:s,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:d,handleOnly:u,isOpen:f,onPress:m,onDrag:p}=oc(),x=B.useRef(null),g=B.useRef(!1);function v(){if(g.current){N();return}window.setTimeout(()=>{y()},s3)}function y(){if(i||e||g.current){N();return}if(N(),!o||o.length===0){d||s();return}if(l===o[o.length-1]&&d){s();return}const k=o.findIndex(C=>C===l);if(k===-1)return;const b=o[k+1];c(b)}function j(){x.current=window.setTimeout(()=>{g.current=!0},a3)}function N(){x.current&&window.clearTimeout(x.current),g.current=!1}return B.createElement("div",{onClick:v,onPointerCancel:N,onPointerDown:w=>{u&&m(w),j()},onPointerMove:w=>{u&&p(w)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},B.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});i3.displayName="Drawer.Handle";function o3(e){const t=oc(),{container:r=t.container,...n}=e;return B.createElement(Yl,{container:r,...n})}const Ua={Root:n3,Content:SN,Overlay:kN,Portal:o3,Title:co,Description:uo},Ni=({shouldScaleBackground:e=!1,direction:t="right",...r})=>a.jsx(Ua.Root,{shouldScaleBackground:e,direction:t,...r});Ni.displayName="Drawer";const l3=Ua.Portal,CN=h.forwardRef(({className:e,...t},r)=>a.jsx(Ua.Overlay,{ref:r,className:$("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),...t}));CN.displayName=Ua.Overlay.displayName;const ki=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(l3,{children:[a.jsx(CN,{}),a.jsx(Ua.Content,{ref:n,className:$("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),...r,children:t})]}));ki.displayName="DrawerContent";const vo=({className:e,...t})=>a.jsx("div",{className:$("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...t});vo.displayName="DrawerHeader";const yo=({className:e,...t})=>a.jsx("div",{className:$("flex-1 overflow-y-auto px-6 py-4",e),...t});yo.displayName="DrawerBody";const lc=({className:e,...t})=>a.jsx("div",{className:$("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),...t});lc.displayName="DrawerFooter";const bo=h.forwardRef(({className:e,...t},r)=>a.jsx(Ua.Title,{ref:r,className:$("text-base font-semibold text-foreground",e),...t}));bo.displayName=Ua.Title.displayName;const c3=h.forwardRef(({className:e,...t},r)=>a.jsx(Ua.Description,{ref:r,className:$("text-sm text-muted-foreground",e),...t}));c3.displayName=Ua.Description.displayName;const d3=Xl("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),mt=h.forwardRef(({className:e,...t},r)=>a.jsx(Yj,{ref:r,className:$(d3(),e),...t}));mt.displayName=Yj.displayName;const ef=h.forwardRef(({className:e,...t},r)=>a.jsx("textarea",{className:$("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:r,...t}));ef.displayName="Textarea";const ly=[{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}],Cm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function u3(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function f3({chip:e,onRemove:t}){const{attributes:r,listeners:n,setNodeRef:s,transform:i,transition:o,isDragging:l}=Kp({id:e.key});return a.jsxs("div",{ref:s,style:{transform:Yp.Transform.toString(i),transition:o},className:$("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:[a.jsx("span",{...r,...n,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:a.jsx(L1,{className:"h-3 w-3"})}),a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),a.jsx("span",{className:"text-[11px]",children:e.name}),a.jsx("button",{type:"button",onClick:t,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:a.jsx(tt,{className:"h-3 w-3"})})]})}const m3=3;function h3({open:e,onClose:t}){var U;const[r,n]=h.useState(""),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[m,p]=h.useState(ly),[x,g]=h.useState(""),[v,y]=h.useState(Cm[2]),{workspace:j}=Ie(),N=SD(),w=ND(r,{enabled:e}),k=kD(s,{enabled:e});h.useEffect(()=>{e&&w.data&&!c&&i(w.data)},[e,w.data,c]);const b=k.available===!1||N.isError&&((U=N.error)==null?void 0:U.status)===409,C=s.trim().length>=m3&&/^[A-Z0-9]+$/i.test(s.trim()),_=o1(qp(l1,{activationConstraint:{distance:5}})),S=M=>{n(M)},I=()=>{r.trim()&&!c&&w.flush()},E=()=>{n(""),i(""),l(""),d(!1),f(!1),p(ly),g(""),y(Cm[2]),N.reset(),t()},O=()=>{if(!x.trim())return;const M=u3(x.trim());if(m.some(H=>H.key===M)){q.error("A status with this name already exists");return}p(H=>[...H,{name:x.trim(),key:M,color:v,category:"started",position:H.length}]),g("")},F=M=>{const{active:H,over:re}=M;!re||H.id===re.id||p(J=>{const R=J.findIndex(z=>z.key===H.id),A=J.findIndex(z=>z.key===re.id);return pd(J,R,A).map((z,K)=>({...z,position:K}))})},D=M=>{M.preventDefault(),!(!r.trim()||!s.trim()||!C||b)&&N.mutate({name:r.trim(),identifier:s.trim().toUpperCase(),description:o.trim()||void 0,workspace_id:j.id,initial_statuses:m},{onSuccess:()=>{q.success("Project created"),E()},onError:H=>{(H==null?void 0:H.status)===409?q.error("This project key is already in use."):q.error(H.message??"Failed to create project")}})};return a.jsx(Ni,{open:e,onOpenChange:M=>!M&&E(),dismissible:!1,children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(vo,{children:a.jsx(bo,{children:"New project"})}),a.jsxs("form",{onSubmit:D,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(yo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"project-name",children:"Name"}),a.jsx(Ae,{id:"project-name",placeholder:"My Project",value:r,onChange:M=>S(M.target.value),onBlur:I,autoFocus:!0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"project-id",children:["Identifier",a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),a.jsx(Ae,{id:"project-id",placeholder:"PROJ",value:s,onChange:M=>{i(M.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),d(!0)},maxLength:5,className:$("font-mono",b&&"border-destructive"),"aria-invalid":b}),b&&a.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"project-desc",children:["Description",a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(ef,{id:"project-desc",placeholder:"What is this project about?",value:o,onChange:M=>l(M.target.value),className:"min-h-[80px]"})]}),a.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[a.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:a.jsxs("span",{className:"flex items-center gap-1.5",children:[u?a.jsx(sa,{className:"h-3.5 w-3.5"}):a.jsx(Cr,{className:"h-3.5 w-3.5"}),"Statuses",a.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",m.length,")"]})]})}),u&&a.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[a.jsx(pl,{sensors:_,onDragEnd:F,children:a.jsx(Hp,{items:m.map(M=>M.key),strategy:c1,children:a.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(M=>a.jsx(f3,{chip:M,onRemove:()=>p(H=>H.filter(re=>re.key!==M.key).map((re,J)=>({...re,position:J})))},M.key))})})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:Cm.map(M=>a.jsx("button",{type:"button",onClick:()=>y(M),className:$("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",v===M?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:M}},M))}),a.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[a.jsx(Ae,{placeholder:"Status name…",value:x,onChange:M=>g(M.target.value),onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),O())},className:"h-7 text-xs flex-1"}),a.jsx(ne,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:O,disabled:!x.trim(),children:a.jsx(dt,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),a.jsxs(lc,{children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:E,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!r.trim()||!s.trim()||!C||b||N.isPending,children:N.isPending?"Creating...":"Create project"})]})]})]})})}const Le=RP,qe=$P,$e=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Gj,{ref:n,className:$("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),...r,children:[t,a.jsx(EP,{asChild:!0,children:a.jsx(sa,{className:"h-4 w-4 opacity-50"})})]}));$e.displayName=Gj.displayName;const _N=h.forwardRef(({className:e,...t},r)=>a.jsx(Vj,{ref:r,className:$("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(Jp,{className:"h-4 w-4"})}));_N.displayName=Vj.displayName;const MN=h.forwardRef(({className:e,...t},r)=>a.jsx(Xj,{ref:r,className:$("flex cursor-default items-center justify-center py-1",e),...t,children:a.jsx(sa,{className:"h-4 w-4"})}));MN.displayName=Xj.displayName;const ze=h.forwardRef(({className:e,children:t,position:r="popper",...n},s)=>a.jsx(AP,{children:a.jsxs(Qj,{ref:s,className:$("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",r==="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:r,...n,children:[a.jsx(_N,{}),a.jsx(DP,{className:$("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(MN,{})]})}));ze.displayName=Qj.displayName;const p3=h.forwardRef(({className:e,...t},r)=>a.jsx(Zj,{ref:r,className:$("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));p3.displayName=Zj.displayName;const we=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(Jj,{ref:n,className:$("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),...r,children:[a.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(TP,{children:a.jsx(dr,{className:"h-4 w-4"})})}),a.jsx(IP,{children:t})]}));we.displayName=Jj.displayName;const x3=h.forwardRef(({className:e,...t},r)=>a.jsx(e1,{ref:r,className:$("-mx-1 my-1 h-px bg-border",e),...t}));x3.displayName=e1.displayName;function g3({open:e,onClose:t,projectId:r,projectName:n}){const{workspace:s}=Ie(),i=(s==null?void 0:s.id)??"",{data:o,isLoading:l}=oa(r),{data:c}=tc(i),{data:d}=Bu(i),u=tN(r),f=rN(r),m=nN(r),p=aN(r),[x,g]=h.useState(""),[v,y]=h.useState(""),j=new Set((o==null?void 0:o.members.map(b=>b.user_id))??[]),N=new Set((o==null?void 0:o.teams.map(b=>b.team_id))??[]),w=(c??[]).filter(b=>!j.has(b.user_id)),k=(d??[]).filter(b=>!N.has(b.id));return a.jsx(Fa,{open:e,onOpenChange:b=>!b&&t(),children:a.jsxs(la,{className:"sm:max-w-[480px]",children:[a.jsx(Ba,{children:a.jsxs(Wa,{children:["Access — ",n]})}),a.jsxs("div",{className:"space-y-5 pt-1",children:[a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?a.jsx("div",{className:"space-y-2",children:[1,2].map(b=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ce,{className:"h-7 w-7 rounded-full"}),a.jsx(ce,{className:"h-3.5 w-32"})]},b))}):(o==null?void 0:o.members.length)===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):a.jsx("div",{className:"space-y-1",children:o==null?void 0:o.members.map(b=>{var O;const C=b.user,_=(C==null?void 0:C.first_name)??"",S=(C==null?void 0:C.last_name)??"",I=`${_} ${S}`.trim()||(C==null?void 0:C.email)||"Unknown",E=(_[0]??S[0]??((O=C==null?void 0:C.email)==null?void 0:O[0])??"U").toUpperCase();return a.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0",children:a.jsx($t,{className:"text-[11px] font-medium",children:E})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:I}),a.jsx("span",{className:$("text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",b.role==="manager"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:b.role}),a.jsx("button",{onClick:()=>f.mutate(b.user_id,{onSuccess:()=>q.success("Access removed"),onError:()=>q.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]},b.id)})}),w.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(ho,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs flex-1",children:a.jsx(qe,{placeholder:"Add person…"})}),a.jsx(ze,{children:w.map(b=>{const C=b.user,_=(C==null?void 0:C.first_name)??"",S=(C==null?void 0:C.last_name)??"",I=`${_} ${S}`.trim()||(C==null?void 0:C.email)||"Unknown";return a.jsx(we,{value:b.user_id,children:I},b.user_id)})})]}),x&&a.jsx(ne,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:u.isPending,onClick:()=>u.mutate({userId:x},{onSuccess:()=>{q.success("Access granted"),g("")},onError:()=>q.error("Failed to grant access")}),children:"Add"})]})]}),a.jsxs("div",{children:[a.jsx("div",{className:"flex items-center justify-between mb-2",children:a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?a.jsx("div",{className:"space-y-2",children:[1].map(b=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ce,{className:"h-7 w-7 rounded-lg"}),a.jsx(ce,{className:"h-3.5 w-28"})]},b))}):(o==null?void 0:o.teams.length)===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):a.jsx("div",{className:"space-y-1",children:o==null?void 0:o.teams.map(b=>{const C=b.team;return a.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[a.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:a.jsx(ii,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsx("span",{className:"flex-1 text-sm truncate",children:(C==null?void 0:C.name)??"Unknown team"}),C&&a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[C.member_count," ",C.member_count===1?"member":"members"]}),a.jsx("button",{onClick:()=>p.mutate(b.team_id,{onSuccess:()=>q.success("Team access removed"),onError:()=>q.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]},b.id)})}),k.length>0&&a.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[a.jsx(ii,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs flex-1",children:a.jsx(qe,{placeholder:"Add team…"})}),a.jsx(ze,{children:k.map(b=>a.jsx(we,{value:b.id,children:b.name},b.id))})]}),v&&a.jsx(ne,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:m.isPending,onClick:()=>m.mutate(v,{onSuccess:()=>{q.success("Team access granted"),y("")},onError:()=>q.error("Failed to add team")}),children:"Add"})]})]}),a.jsx("div",{className:"flex justify-end pt-1",children:a.jsx(ne,{variant:"outline",size:"sm",onClick:t,children:"Close"})})]})]})})}const ON=6048e5,v3=864e5,y3=36e5,Bc=43200,cy=1440,dy=Symbol.for("constructDateFrom");function Nt(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&dy in e?e[dy](t):e instanceof Date?new e.constructor(t):new Date(t)}function He(e,t){return Nt(t||e,e)}function Wr(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(t)?Nt((r==null?void 0:r.in)||e,NaN):(t&&n.setDate(n.getDate()+t),n)}function vx(e,t,r){const n=He(e,r==null?void 0:r.in);if(isNaN(t))return Nt((r==null?void 0:r.in)||e,NaN);if(!t)return n;const s=n.getDate(),i=Nt((r==null?void 0:r.in)||e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return s>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),s),n)}let b3={};function wo(){return b3}function Vi(e,t){var l,c,d,u;const r=wo(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=He(e,t==null?void 0:t.in),i=s.getDay(),o=(i<n?7:0)+i-n;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function wl(e,t){return Vi(e,{...t,weekStartsOn:1})}function PN(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=Nt(r,0);s.setFullYear(n+1,0,4),s.setHours(0,0,0,0);const i=wl(s),o=Nt(r,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const l=wl(o);return r.getTime()>=i.getTime()?n+1:r.getTime()>=l.getTime()?n:n-1}function _d(e){const t=He(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),+e-+r}function ca(e,...t){const r=Nt.bind(null,e||t.find(n=>typeof n=="object"));return t.map(r)}function Xi(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function tf(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t),i=Xi(n),o=Xi(s),l=+i-_d(i),c=+o-_d(o);return Math.round((l-c)/v3)}function w3(e,t){const r=PN(e,t),n=Nt(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),wl(n)}function j3(e,t,r){return Wr(e,t*7,r)}function N3(e,t,r){return vx(e,t*12,r)}function k3(e,t){let r,n=t==null?void 0:t.in;return e.forEach(s=>{!n&&typeof s=="object"&&(n=Nt.bind(null,s));const i=He(s,n);(!r||r<i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function S3(e,t){let r,n=t==null?void 0:t.in;return e.forEach(s=>{!n&&typeof s=="object"&&(n=Nt.bind(null,s));const i=He(s,n);(!r||r>i||isNaN(+i))&&(r=i)}),Nt(n,r||NaN)}function xd(e,t){const r=+He(e)-+He(t);return r<0?-1:r>0?1:r}function yx(e){return Nt(e,Date.now())}function Qi(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t);return+Xi(n)==+Xi(s)}function EN(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function C3(e){return!(!EN(e)&&typeof e!="number"||isNaN(+He(e)))}function bx(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t),i=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return i*12+o}function AN(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t),i=uy(n,s),o=Math.abs(tf(n,s));n.setDate(n.getDate()-i*o);const l=+(uy(n,s)===-i),c=i*(o-l);return c===0?0:c}function uy(e,t){const r=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return r<0?-1:r>0?1:r}function DN(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function _3(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t),i=(+n-+s)/y3;return DN(r==null?void 0:r.roundingMethod)(i)}function M3(e,t){return+He(e)-+He(t)}function TN(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function wx(e,t){const r=He(e,t==null?void 0:t.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}function O3(e,t){const r=He(e,t==null?void 0:t.in);return+TN(r,t)==+wx(r,t)}function IN(e,t,r){const[n,s,i]=ca(r==null?void 0:r.in,e,e,t),o=xd(s,i),l=Math.abs(bx(s,i));if(l<1)return 0;s.getMonth()===1&&s.getDate()>27&&s.setDate(30),s.setMonth(s.getMonth()-o*l);let c=xd(s,i)===-o;O3(n)&&l===1&&xd(n,i)===1&&(c=!1);const d=o*(l-+c);return d===0?0:d}function P3(e,t,r){const n=M3(e,t)/1e3;return DN(r==null?void 0:r.roundingMethod)(n)}function RN(e,t){const[r,n]=ca(e,t.start,t.end);return{start:r,end:n}}function E3(e,t){const{start:r,end:n}=RN(t==null?void 0:t.in,e);let s=+r>+n;const i=s?+r:+n,o=s?n:r;o.setHours(0,0,0,0),o.setDate(1);let l=1;const c=[];for(;+o<=i;)c.push(Nt(r,o)),o.setMonth(o.getMonth()+l);return s?c.reverse():c}function $N(e,t){const r=He(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function A3(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear();return r.setFullYear(n+1,0,0),r.setHours(23,59,59,999),r}function zN(e,t){const r=He(e,t==null?void 0:t.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}function D3(e,t){const{start:r,end:n}=RN(t==null?void 0:t.in,e);let s=+r>+n;const i=s?+r:+n,o=s?n:r;o.setHours(0,0,0,0),o.setMonth(0,1);let l=1;const c=[];for(;+o<=i;)c.push(Nt(r,o)),o.setFullYear(o.getFullYear()+l);return s?c.reverse():c}function LN(e,t){var l,c,d,u;const r=wo(),n=(t==null?void 0:t.weekStartsOn)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??r.weekStartsOn??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=He(e,t==null?void 0:t.in),i=s.getDay(),o=(i<n?-7:0)+6-(i-n);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function T3(e,t){return LN(e,{...t,weekStartsOn:1})}const I3={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"}},R3=(e,t,r)=>{let n;const s=I3[e];return typeof s=="string"?n=s:t===1?n=s.one:n=s.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function _m(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const $3={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},z3={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},L3={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},F3={date:_m({formats:$3,defaultWidth:"full"}),time:_m({formats:z3,defaultWidth:"full"}),dateTime:_m({formats:L3,defaultWidth:"full"})},B3={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},W3=(e,t,r,n)=>B3[e];function qo(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let s;if(n==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;s=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;s=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const U3={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},q3={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},H3={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"]},K3={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"]},Y3={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"}},G3={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"}},V3=(e,t)=>{const r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},X3={ordinalNumber:V3,era:qo({values:U3,defaultWidth:"wide"}),quarter:qo({values:q3,defaultWidth:"wide",argumentCallback:e=>e-1}),month:qo({values:H3,defaultWidth:"wide"}),day:qo({values:K3,defaultWidth:"wide"}),dayPeriod:qo({values:Y3,defaultWidth:"wide",formattingValues:G3,defaultFormattingWidth:"wide"})};function Ho(e){return(t,r={})=>{const n=r.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?Z3(l,f=>f.test(o)):Q3(l,f=>f.test(o));let d;d=e.valueCallback?e.valueCallback(c):c,d=r.valueCallback?r.valueCallback(d):d;const u=t.slice(o.length);return{value:d,rest:u}}}function Q3(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function Z3(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function J3(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const s=n[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=r.valueCallback?r.valueCallback(o):o;const l=t.slice(s.length);return{value:o,rest:l}}}const eI=/^(\d+)(th|st|nd|rd)?/i,tI=/\d+/i,rI={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},nI={any:[/^b/i,/^(a|c)/i]},aI={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},sI={any:[/1/i,/2/i,/3/i,/4/i]},iI={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},oI={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]},lI={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},cI={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]},dI={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},uI={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}},fI={ordinalNumber:J3({matchPattern:eI,parsePattern:tI,valueCallback:e=>parseInt(e,10)}),era:Ho({matchPatterns:rI,defaultMatchWidth:"wide",parsePatterns:nI,defaultParseWidth:"any"}),quarter:Ho({matchPatterns:aI,defaultMatchWidth:"wide",parsePatterns:sI,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Ho({matchPatterns:iI,defaultMatchWidth:"wide",parsePatterns:oI,defaultParseWidth:"any"}),day:Ho({matchPatterns:lI,defaultMatchWidth:"wide",parsePatterns:cI,defaultParseWidth:"any"}),dayPeriod:Ho({matchPatterns:dI,defaultMatchWidth:"any",parsePatterns:uI,defaultParseWidth:"any"})},Bs={code:"en-US",formatDistance:R3,formatLong:F3,formatRelative:W3,localize:X3,match:fI,options:{weekStartsOn:0,firstWeekContainsDate:1}};function mI(e,t){const r=He(e,t==null?void 0:t.in);return tf(r,zN(r))+1}function jx(e,t){const r=He(e,t==null?void 0:t.in),n=+wl(r)-+w3(r);return Math.round(n/ON)+1}function FN(e,t){var u,f,m,p;const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=wo(),i=(t==null?void 0:t.firstWeekContainsDate)??((f=(u=t==null?void 0:t.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??s.firstWeekContainsDate??((p=(m=s.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=Nt((t==null?void 0:t.in)||e,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=Vi(o,t),c=Nt((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const d=Vi(c,t);return+r>=+l?n+1:+r>=+d?n:n-1}function hI(e,t){var l,c,d,u;const r=wo(),n=(t==null?void 0:t.firstWeekContainsDate)??((c=(l=t==null?void 0:t.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??r.firstWeekContainsDate??((u=(d=r.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,s=FN(e,t),i=Nt((t==null?void 0:t.in)||e,0);return i.setFullYear(s,0,n),i.setHours(0,0,0,0),Vi(i,t)}function Nx(e,t){const r=He(e,t==null?void 0:t.in),n=+Vi(r,t)-+hI(r,t);return Math.round(n/ON)+1}function Je(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const ts={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return Je(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):Je(r+1,2)},d(e,t){return Je(e.getDate(),t.length)},a(e,t){const r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];case"aaaa":default:return r==="am"?"a.m.":"p.m."}},h(e,t){return Je(e.getHours()%12||12,t.length)},H(e,t){return Je(e.getHours(),t.length)},m(e,t){return Je(e.getMinutes(),t.length)},s(e,t){return Je(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),s=Math.trunc(n*Math.pow(10,r-3));return Je(s,t.length)}},Pi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},fy={G:function(e,t,r){const n=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});case"GGGG":default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if(t==="yo"){const n=e.getFullYear(),s=n>0?n:1-n;return r.ordinalNumber(s,{unit:"year"})}return ts.y(e,t)},Y:function(e,t,r,n){const s=FN(e,n),i=s>0?s:1-s;if(t==="YY"){const o=i%100;return Je(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):Je(i,t.length)},R:function(e,t){const r=PN(e);return Je(r,t.length)},u:function(e,t){const r=e.getFullYear();return Je(r,t.length)},Q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return Je(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){const n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return Je(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){const n=e.getMonth();switch(t){case"M":case"MM":return ts.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){const n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return Je(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){const s=Nx(e,n);return t==="wo"?r.ordinalNumber(s,{unit:"week"}):Je(s,t.length)},I:function(e,t,r){const n=jx(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):Je(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):ts.d(e,t)},D:function(e,t,r){const n=mI(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):Je(n,t.length)},E:function(e,t,r){const n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});case"EEEE":default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return Je(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(s,{width:"short",context:"formatting"});case"eeee":default:return r.day(s,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const s=e.getDay(),i=(s-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return Je(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(s,{width:"narrow",context:"standalone"});case"cccccc":return r.day(s,{width:"short",context:"standalone"});case"cccc":default:return r.day(s,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),s=n===0?7:n;switch(t){case"i":return String(s);case"ii":return Je(s,t.length);case"io":return r.ordinalNumber(s,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});case"iiii":default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){const s=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let s;switch(n===12?s=Pi.noon:n===0?s=Pi.midnight:s=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let s;switch(n>=17?s=Pi.evening:n>=12?s=Pi.afternoon:n>=4?s=Pi.morning:s=Pi.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(e,t,r){if(t==="ho"){let n=e.getHours()%12;return n===0&&(n=12),r.ordinalNumber(n,{unit:"hour"})}return ts.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):ts.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):Je(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):Je(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):ts.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):ts.s(e,t)},S:function(e,t){return ts.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return hy(n);case"XXXX":case"XX":return Ts(n);case"XXXXX":case"XXX":default:return Ts(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return hy(n);case"xxxx":case"xx":return Ts(n);case"xxxxx":case"xxx":default:return Ts(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+my(n,":");case"OOOO":default:return"GMT"+Ts(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+my(n,":");case"zzzz":default:return"GMT"+Ts(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return Je(n,t.length)},T:function(e,t,r){return Je(+e,t.length)}};function my(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Math.trunc(n/60),i=n%60;return i===0?r+String(s):r+String(s)+t+Je(i,2)}function hy(e,t){return e%60===0?(e>0?"-":"+")+Je(Math.abs(e)/60,2):Ts(e,t)}function Ts(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),s=Je(Math.trunc(n/60),2),i=Je(n%60,2);return r+s+t+i}const py=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},BN=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},pI=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],s=r[2];if(!s)return py(e,t);let i;switch(n){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",py(n,t)).replace("{{time}}",BN(s,t))},xI={p:BN,P:pI},gI=/^D+$/,vI=/^Y+$/,yI=["D","DD","YY","YYYY"];function bI(e){return gI.test(e)}function wI(e){return vI.test(e)}function jI(e,t,r){const n=NI(e,t,r);if(console.warn(n),yI.includes(e))throw new RangeError(n)}function NI(e,t,r){const n=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${n} to the input \`${r}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const kI=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,SI=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,CI=/^'([^]*?)'?$/,_I=/''/g,MI=/[a-zA-Z]/;function ue(e,t,r){var u,f,m,p,x,g,v,y;const n=wo(),s=(r==null?void 0:r.locale)??n.locale??Bs,i=(r==null?void 0:r.firstWeekContainsDate)??((f=(u=r==null?void 0:r.locale)==null?void 0:u.options)==null?void 0:f.firstWeekContainsDate)??n.firstWeekContainsDate??((p=(m=n.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=(r==null?void 0:r.weekStartsOn)??((g=(x=r==null?void 0:r.locale)==null?void 0:x.options)==null?void 0:g.weekStartsOn)??n.weekStartsOn??((y=(v=n.locale)==null?void 0:v.options)==null?void 0:y.weekStartsOn)??0,l=He(e,r==null?void 0:r.in);if(!C3(l))throw new RangeError("Invalid time value");let c=t.match(SI).map(j=>{const N=j[0];if(N==="p"||N==="P"){const w=xI[N];return w(j,s.formatLong)}return j}).join("").match(kI).map(j=>{if(j==="''")return{isToken:!1,value:"'"};const N=j[0];if(N==="'")return{isToken:!1,value:OI(j)};if(fy[N])return{isToken:!0,value:j};if(N.match(MI))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:j}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(j=>{if(!j.isToken)return j.value;const N=j.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&wI(N)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&bI(N))&&jI(N,t,String(e));const w=fy[N[0]];return w(l,N,s.localize,d)}).join("")}function OI(e){const t=e.match(CI);return t?t[1].replace(_I,"'"):e}function Mh(e,t,r){const n=wo(),s=(r==null?void 0:r.locale)??n.locale??Bs,i=2520,o=xd(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},r,{addSuffix:r==null?void 0:r.addSuffix,comparison:o}),[c,d]=ca(r==null?void 0:r.in,...o>0?[t,e]:[e,t]),u=P3(d,c),f=(_d(d)-_d(c))/1e3,m=Math.round((u-f)/60);let p;if(m<2)return r!=null&&r.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,l):u<10?s.formatDistance("lessThanXSeconds",10,l):u<20?s.formatDistance("lessThanXSeconds",20,l):u<40?s.formatDistance("halfAMinute",0,l):u<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<cy){const x=Math.round(m/60);return s.formatDistance("aboutXHours",x,l)}else{if(m<i)return s.formatDistance("xDays",1,l);if(m<Bc){const x=Math.round(m/cy);return s.formatDistance("xDays",x,l)}else if(m<Bc*2)return p=Math.round(m/Bc),s.formatDistance("aboutXMonths",p,l)}if(p=IN(d,c),p<12){const x=Math.round(m/Bc);return s.formatDistance("xMonths",x,l)}else{const x=p%12,g=Math.trunc(p/12);return x<3?s.formatDistance("aboutXYears",g,l):x<9?s.formatDistance("overXYears",g,l):s.formatDistance("almostXYears",g+1,l)}}function PI(e,t){return Mh(e,yx(e),t)}function xl(e,t){return He(e,t==null?void 0:t.in).getDate()}function EI(e,t){return He(e,t==null?void 0:t.in).getDay()}function ys(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),s=r.getMonth(),i=Nt(r,0);return i.setFullYear(n,s+1,0),i.setHours(0,0,0,0),i.getDate()}function gd(e,t){return He(e,t==null?void 0:t.in).getMonth()}function AI(e,t){return He(e,t==null?void 0:t.in).getFullYear()}function DI(e,t){return+He(e)>+He(t)}function TI(e,t){return+He(e)<+He(t)}function II(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()&&n.getMonth()===s.getMonth()}function RI(e,t,r){const[n,s]=ca(r==null?void 0:r.in,e,t);return n.getFullYear()===s.getFullYear()}function $I(e,t){return Qi(Nt(e,e),yx(e))}function WN(e,t,r){return Wr(e,-t,r)}function zI(e,t){return Qi(Nt(e,e),WN(yx(e),1))}function LI(e,t,r){const n=He(e,r==null?void 0:r.in),s=n.getFullYear(),i=n.getDate(),o=Nt(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=ys(o);return n.setMonth(t,Math.min(i,l)),n}function FI(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(+n)?Nt(e,NaN):(n.setFullYear(t),n)}function BI(){const[e,t]=h.useState(!1),[r,n]=h.useState(null),[s,i]=h.useState(""),[o,l]=h.useState("all"),{workspace:c}=zt(),{data:d,isLoading:u}=xo(),f=CD(),m=pt(),p=(d??[]).filter(x=>(o==="all"||x.status===o)&&(!s||x.name.toLowerCase().includes(s.toLowerCase())||x.identifier.toLowerCase().includes(s.toLowerCase())));return a.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[a.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),a.jsxs(ne,{size:"sm",onClick:()=>t(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]}),a.jsxs("div",{className:"flex flex-col gap-2 px-4 md:px-6 py-3 md:py-4 border-b border-border md:flex-row md:items-center md:justify-between",children:[a.jsx("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-none",children:["all","active","paused","archived"].map(x=>a.jsx("button",{onClick:()=>l(x),className:$("px-3 h-7 rounded-md text-xs font-medium transition-colors whitespace-nowrap shrink-0",o===x?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:x==="all"?"All":x.charAt(0).toUpperCase()+x.slice(1)},x))}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Ae,{placeholder:"Search...",value:s,onChange:x=>i(x.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-2.5 border-b border-border",children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),a.jsx("span",{})]}),u?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(x=>a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[a.jsx(ce,{className:"h-4 w-48"}),a.jsx(ce,{className:"h-4 w-12"}),a.jsx(ce,{className:"h-5 w-16 rounded-full"}),a.jsx(ce,{className:"h-4 w-24"}),a.jsx("div",{})]},`d-${x}`),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3",children:[a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(ce,{className:"h-4 w-40"}),a.jsx(ce,{className:"h-3 w-24"})]}),a.jsx(ce,{className:"h-6 w-6 rounded-full"})]},`m-${x}`)]}))}):p.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:a.jsx(qr,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("p",{className:"text-sm font-medium mb-1",children:s||o!=="all"?"No projects match":"No projects yet"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:s||o!=="all"?"Try adjusting your filters.":"Create your first project to get started."}),!s&&o==="all"&&a.jsxs(ne,{size:"sm",onClick:()=>t(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create project"]})]}):a.jsx("div",{className:"divide-y divide-border",children:p.map(x=>a.jsxs("div",{children:[a.jsxs("div",{className:"hidden md: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:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:x.name}),x.description&&a.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:x.description})]}),a.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:x.identifier}),a.jsx("div",{children:a.jsxs("span",{className:$("inline-flex items-center gap-1.5 text-xs",x.status==="active"&&"text-emerald-600",x.status==="paused"&&"text-amber-600",x.status==="archived"&&"text-muted-foreground"),children:[a.jsx("span",{className:$("h-1.5 w-1.5 rounded-full shrink-0",x.status==="active"&&"bg-emerald-500",x.status==="paused"&&"bg-amber-500",x.status==="archived"&&"bg-zinc-400")}),x.status.charAt(0).toUpperCase()+x.status.slice(1)]})}),a.jsx("span",{className:"text-sm text-muted-foreground",children:ue(new Date(x.created_at),"MMM d, yyyy")}),a.jsx("div",{className:"flex justify-end",onClick:g=>g.stopPropagation(),children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsx(ne,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(Ca,{className:"h-4 w-4"})})}),a.jsxs(Or,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/board`),children:[a.jsx(qr,{className:"h-4 w-4"}),"Open board"]}),a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(Zn,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(ai,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(On,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>q.success("Project deleted"),onError:()=>q.error("Failed to delete project")})},children:[a.jsx(Mr,{className:"h-4 w-4"}),"Delete"]})]})]})})]}),a.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[a.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:x.name}),a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:x.identifier})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:$("h-1.5 w-1.5 rounded-full shrink-0",x.status==="active"&&"bg-emerald-500",x.status==="paused"&&"bg-amber-500",x.status==="archived"&&"bg-zinc-400")}),a.jsx("span",{className:$("text-xs",x.status==="active"&&"text-emerald-600",x.status==="paused"&&"text-amber-600",x.status==="archived"&&"text-muted-foreground"),children:x.status.charAt(0).toUpperCase()+x.status.slice(1)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:ue(new Date(x.created_at),"MMM d, yyyy")})]})]}),a.jsx("div",{onClick:g=>g.stopPropagation(),children:a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsx(ne,{variant:"ghost",size:"icon-sm",className:"h-8 w-8 text-muted-foreground",children:a.jsx(Ca,{className:"h-4 w-4"})})}),a.jsxs(Or,{align:"end",children:[a.jsxs(at,{onClick:()=>m(`/${c}/projects/${x.identifier}/issues`),children:[a.jsx(Zn,{className:"h-4 w-4"}),"View issues"]}),a.jsxs(at,{onClick:()=>n({id:x.id,name:x.name}),children:[a.jsx(ai,{className:"h-4 w-4"}),"Manage access"]}),a.jsx(On,{}),a.jsxs(at,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${x.name}"? This cannot be undone.`)&&f.mutate(x.id,{onSuccess:()=>q.success("Project deleted"),onError:()=>q.error("Failed to delete project")})},children:[a.jsx(Mr,{className:"h-4 w-4"}),"Delete"]})]})]})})]})]},x.id))}),!u&&p.length>0&&a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",p.length," of ",p.length," result",p.length!==1?"s":""]}),a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("span",{children:"1 of 1 pages"}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),a.jsx(h3,{open:e,onClose:()=>t(!1)}),r&&a.jsx(g3,{open:!!r,onClose:()=>n(null),projectId:r.id,projectName:r.name})]})}const cc={byProject:e=>["projects",e,"statuses"]};function jo(e){return We({queryKey:cc.byProject(e??""),queryFn:()=>oe.get(`/admin/projects/${e}/statuses`),select:t=>t.statuses,enabled:!!e})}function WI(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses`,r),onSuccess:()=>{t.invalidateQueries({queryKey:cc.byProject(e)})}})}function UI(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/projects/${e}/statuses/${t}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:cc.byProject(e)})}})}function qI(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/projects/${e}/statuses/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:cc.byProject(e)})}})}function HI(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:r}),onSuccess:()=>{t.invalidateQueries({queryKey:cc.byProject(e)})}})}const No={all:["users"],list:()=>[...No.all,"list"]};function dc(){return We({queryKey:No.list(),queryFn:()=>oe.get("/admin/users"),select:e=>e.users,staleTime:1e3*60*5})}const rf={all:["org-invitations"],list:()=>[...rf.all,"list"]};function KI(){return We({queryKey:rf.list(),queryFn:()=>oe.get("/admin/users/invitations"),select:e=>e.invitations,staleTime:1e3*30})}function YI(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/users/invitations/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:rf.list()})})}function GI(){return be({mutationFn:e=>oe.post(`/admin/users/invitations/${e}/resend`)})}function VI(){const e=Se();return be({mutationFn:({email:t,role:r})=>oe.post("/admin/users/invite",{email:t,role:r}),onSuccess:()=>e.invalidateQueries({queryKey:rf.list()})})}function XI(){const e=Se();return be({mutationFn:({userId:t,role:r})=>oe.patch(`/admin/users/${t}`,{role:r}),onSuccess:()=>e.invalidateQueries({queryKey:No.list()})})}function QI(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/users/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:No.list()})})}function ZI(){const e=Se();return be({mutationFn:t=>oe.post(`/admin/users/${t}/reactivate`),onSuccess:()=>e.invalidateQueries({queryKey:No.list()})})}function js(){return We({queryKey:[...No.list(),"map"],queryFn:()=>oe.get("/admin/users"),select:e=>new Map(e.users.map(t=>{var o;const r=t.first_name??"",n=t.last_name??"",s=`${r} ${n}`.trim()||t.email,i=(r[0]??n[0]??((o=t.email)==null?void 0:o[0])??"U").toUpperCase();return[t.id,{name:s,initials:i}]})),staleTime:1e3*60*5})}const ci={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},tn={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},uc={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},_a={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},JI=({priority:e})=>{const t=$("h-3 w-3 shrink-0",uc[e]);switch(e){case"urgent":return a.jsx(ia,{className:t});case"high":return a.jsx(bi,{className:t});case"medium":return a.jsx(za,{className:t});case"low":return a.jsx(yi,{className:t});default:return a.jsx(_r,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function UN({issue:e,childCount:t=0,onClick:r}){var f,m;const{data:n}=js(),{attributes:s,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:d}=Kp({id:e.id}),u={transform:Yp.Transform.toString(l),transition:c};return a.jsxs("div",{ref:o,style:u,...s,...i,onClick:r,className:$("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:[a.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),a.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mb-2",children:[a.jsx(Wt,{className:"h-2.5 w-2.5 shrink-0"}),a.jsx("span",{children:e.start_date?ue(new Date(e.start_date),"MMM d"):"?"}),a.jsx("span",{children:"→"}),a.jsx("span",{children:e.due_date?ue(new Date(e.due_date),"MMM d"):"?"})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[a.jsx("span",{className:"text-[11px] font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:e.identifier}),e.parent_id&&a.jsx("span",{className:"flex items-center text-zinc-400 dark:text-zinc-500 shrink-0",title:"Child issue",children:a.jsx(_n,{className:"h-3 w-3"})}),t>0&&a.jsxs("span",{className:"flex items-center gap-0.5 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded shrink-0",children:[a.jsx(_n,{className:"h-2.5 w-2.5"}),t]})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&a.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(p=>{const x=n==null?void 0:n.get(p);return a.jsx(Rt,{className:"h-4 w-4 border border-background",children:a.jsx($t,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(x==null?void 0:x.initials)??"?"})},p)}),(((f=e.assignee_ids)==null?void 0:f.length)??0)>2&&a.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((m=e.assignee_ids)==null?void 0:m.length)??0)-2]})]}),a.jsx(JI,{priority:e.priority})]})]})]})}function Wc(e,t){const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),s=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return isNaN(n)||isNaN(s)||isNaN(i)?`rgba(148,163,184,${t})`:`rgba(${n},${s},${i},${t})`}const e4=({category:e,color:t})=>{const r="h-3.5 w-3.5 shrink-0",n={color:t};switch(e){case"completed":return a.jsx(ea,{className:r,style:n});case"started":return a.jsx(Dn,{className:r,style:n});default:return a.jsx(_r,{className:r,style:n})}};function t4({id:e,label:t,color:r,category:n,issues:s,childCounts:i,sortable:o,onIssueClick:l,onRename:c,onDelete:d,isRenaming:u,renameValue:f,onRenameChange:m,onRenameSubmit:p,onRenameCancel:x}){const{setNodeRef:g,isOver:v}=uE({id:e}),{attributes:y,listeners:j,setNodeRef:N,transform:w,transition:k,isDragging:b}=Kp({id:e,disabled:!o}),C=h.useRef(null),_=h.useRef(!1);h.useEffect(()=>{u&&(_.current=!1,setTimeout(()=>{var D;return(D=C.current)==null?void 0:D.focus()},0))},[u]);const S=o?{transform:Yp.Transform.toString(w),transition:k}:void 0,I=Wc(r,.08),E=Wc(r,.16),O=Wc(r,.35),F=!!(c||d);return a.jsxs("div",{ref:N,style:S,className:$("flex flex-col min-w-[260px] max-w-[280px] w-full group/col",b&&"opacity-50"),children:[a.jsxs("div",{className:$("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&a.jsx("span",{...y,...j,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:a.jsx(L1,{className:"h-3.5 w-3.5"})}),a.jsx(e4,{category:n,color:r}),u?a.jsx("input",{ref:C,value:f??"",onChange:D=>m==null?void 0:m(D.target.value),onKeyDown:D=>{D.key==="Enter"&&(D.preventDefault(),p==null||p()),D.key==="Escape"&&(D.preventDefault(),_.current=!0,x==null||x())},onBlur:()=>{_.current||p==null||p()},className:"flex-1 text-xs font-medium bg-transparent border-b border-foreground/30 outline-none py-0.5 min-w-0"}):a.jsx("span",{className:"text-xs font-medium text-foreground",children:t}),a.jsx("span",{className:"ml-1 text-[11px] font-medium rounded-full px-1.5 py-0.5 tabular-nums min-w-[18px] text-center",style:{backgroundColor:Wc(r,.12),color:r},children:s.length}),F&&!u&&a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:a.jsx("button",{className:"ml-auto h-5 w-5 flex items-center justify-center rounded opacity-0 group-hover/col:opacity-100 hover:bg-muted transition-opacity text-muted-foreground hover:text-foreground",onClick:D=>D.stopPropagation(),children:a.jsx(Ca,{className:"h-3.5 w-3.5"})})}),a.jsxs(Or,{align:"end",className:"w-40",children:[c&&a.jsx(at,{onClick:c,children:"Rename"}),c&&d&&a.jsx(On,{}),d&&a.jsx(at,{className:"text-destructive focus:text-destructive",onClick:d,children:"Delete status"})]})]})]}),a.jsxs("div",{ref:g,className:$("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:v?E:I,boxShadow:v?`inset 0 0 0 1px ${O}`:void 0},children:[a.jsx(Hp,{items:s.map(D=>D.id),strategy:fE,children:s.map(D=>a.jsx(UN,{issue:D,childCount:(i==null?void 0:i.get(D.id))??0,onClick:()=>l==null?void 0:l(D)},D.id))}),s.length===0&&a.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:a.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const Mm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],r4=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function n4({open:e,onClose:t,projectId:r}){const[n,s]=h.useState(""),[i,o]=h.useState(Mm[0]),[l,c]=h.useState(""),[d,u]=h.useState("started"),f=WI(r),m=l||i,p=()=>{n.trim()&&f.mutate({name:n.trim(),color:m,category:d},{onSuccess:()=>{q.success("Status created"),s(""),o(Mm[0]),c(""),u("started"),t()},onError:()=>q.error("Failed to create status")})};return a.jsx(Ni,{open:e,onOpenChange:x=>!x&&t(),children:a.jsxs(ki,{className:"sm:max-w-sm",children:[a.jsx(vo,{children:a.jsx(bo,{className:"text-sm font-medium",children:"New Status"})}),a.jsx(yo,{children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),a.jsx(Ae,{placeholder:"e.g. In Review",value:n,onChange:x=>s(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),autoFocus:!0,className:"h-8 text-sm"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[Mm.map(x=>a.jsx("button",{onClick:()=>{o(x),c("")},className:$("h-6 w-6 rounded-full border-2 transition-transform hover:scale-110",i===x&&!l?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:x}},x)),a.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[a.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),a.jsx(Ae,{placeholder:"#hex",value:l,onChange:x=>c(x.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),a.jsxs(Le,{value:d,onValueChange:x=>u(x),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:r4.map(x=>a.jsx(we,{value:x.value,className:"text-xs",children:x.label},x.value))})]})]})]})}),a.jsxs(lc,{className:"mt-2",children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:t,className:"text-xs",children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:p,disabled:!n.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function a4({projectId:e}){const[t,r]=h.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:a.jsxs("button",{onClick:()=>r(!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:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Add status"]})}),a.jsx(n4,{open:t,onClose:()=>r(!1),projectId:e})]})}function s4({open:e,statusName:t,issueCount:r,otherStatuses:n,onConfirm:s,onCancel:i,isLoading:o}){const[l,c]=h.useState(""),d=()=>{r>0&&!l||s(r>0?l:null)};return a.jsx(Fa,{open:e,onOpenChange:u=>{u||i()},children:a.jsxs(la,{className:"sm:max-w-md",children:[a.jsxs(Ba,{children:[a.jsx(Wa,{children:"Delete status"}),a.jsx(go,{children:r>0?`${r} issue${r!==1?"s":""} in "${t}" will be moved to another status.`:`Delete the "${t}" status. This cannot be undone.`})]}),r>0&&a.jsxs("div",{className:"py-2",children:[a.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Move issues to"}),a.jsxs(Le,{value:l,onValueChange:c,children:[a.jsx($e,{children:a.jsx(qe,{placeholder:"Select a status..."})}),a.jsx(ze,{children:n.map(u=>a.jsx(we,{value:u.id,children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:u.color}}),u.name]})},u.id))})]})]}),a.jsxs(mx,{children:[a.jsx(ne,{variant:"outline",onClick:i,disabled:o,children:"Cancel"}),a.jsx(ne,{variant:"destructive",onClick:d,disabled:r>0&&!l||o,children:o?"Deleting…":"Delete status"})]})]})})}var kx={};(function e(t,r,n,s){var i=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),o=typeof Path2D=="function"&&typeof DOMMatrix=="function",l=function(){if(!t.OffscreenCanvas)return!1;try{var R=new OffscreenCanvas(1,1),A=R.getContext("2d");A.fillRect(0,0,1,1);var z=R.transferToImageBitmap();A.createPattern(z,"no-repeat")}catch{return!1}return!0}();function c(){}function d(R){var A=r.exports.Promise,z=A!==void 0?A:t.Promise;return typeof z=="function"?new z(R):(R(c,c),null)}var u=function(R,A){return{transform:function(z){if(R)return z;if(A.has(z))return A.get(z);var K=new OffscreenCanvas(z.width,z.height),X=K.getContext("2d");return X.drawImage(z,0,0),A.set(z,K),K},clear:function(){A.clear()}}}(l,new Map),f=function(){var R=Math.floor(16.666666666666668),A,z,K={},X=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(A=function(G){var T=Math.random();return K[T]=requestAnimationFrame(function P(Z){X===Z||X+R-1<Z?(X=Z,delete K[T],G()):K[T]=requestAnimationFrame(P)}),T},z=function(G){K[G]&&cancelAnimationFrame(K[G])}):(A=function(G){return setTimeout(G,R)},z=function(G){return clearTimeout(G)}),{frame:A,cancel:z}}(),m=function(){var R,A,z={};function K(X){function G(T,P){X.postMessage({options:T||{},callback:P})}X.init=function(P){var Z=P.transferControlToOffscreen();X.postMessage({canvas:Z},[Z])},X.fire=function(P,Z,L){if(A)return G(P,null),A;var Y=Math.random().toString(36).slice(2);return A=d(function(ae){function ee(se){se.data.callback===Y&&(delete z[Y],X.removeEventListener("message",ee),A=null,u.clear(),L(),ae())}X.addEventListener("message",ee),G(P,Y),z[Y]=ee.bind(null,{data:{callback:Y}})}),A},X.reset=function(){X.postMessage({reset:!0});for(var P in z)z[P](),delete z[P]}}return function(){if(R)return R;if(!n&&i){var X=["var CONFETTI, SIZE = {}, module = {};","("+e.toString()+")(this, module, true, SIZE);","onmessage = function(msg) {"," if (msg.data.options) {"," CONFETTI(msg.data.options).then(function () {"," if (msg.data.callback) {"," postMessage({ callback: msg.data.callback });"," }"," });"," } else if (msg.data.reset) {"," CONFETTI && CONFETTI.reset();"," } else if (msg.data.resize) {"," SIZE.width = msg.data.resize.width;"," SIZE.height = msg.data.resize.height;"," } else if (msg.data.canvas) {"," SIZE.width = msg.data.canvas.width;"," SIZE.height = msg.data.canvas.height;"," CONFETTI = module.exports.create(msg.data.canvas);"," }","}"].join(`
556
- `);try{R=new Worker(URL.createObjectURL(new Blob([X])))}catch(G){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",G),null}K(R)}return R}}(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function x(R,A){return A?A(R):R}function g(R){return R!=null}function v(R,A,z){return x(R&&g(R[A])?R[A]:p[A],z)}function y(R){return R<0?0:Math.floor(R)}function j(R,A){return Math.floor(Math.random()*(A-R))+R}function N(R){return parseInt(R,16)}function w(R){return R.map(k)}function k(R){var A=String(R).replace(/[^0-9a-f]/gi,"");return A.length<6&&(A=A[0]+A[0]+A[1]+A[1]+A[2]+A[2]),{r:N(A.substring(0,2)),g:N(A.substring(2,4)),b:N(A.substring(4,6))}}function b(R){var A=v(R,"origin",Object);return A.x=v(A,"x",Number),A.y=v(A,"y",Number),A}function C(R){R.width=document.documentElement.clientWidth,R.height=document.documentElement.clientHeight}function _(R){var A=R.getBoundingClientRect();R.width=A.width,R.height=A.height}function S(R){var A=document.createElement("canvas");return A.style.position="fixed",A.style.top="0px",A.style.left="0px",A.style.pointerEvents="none",A.style.zIndex=R,A}function I(R,A,z,K,X,G,T,P,Z){R.save(),R.translate(A,z),R.rotate(G),R.scale(K,X),R.arc(0,0,1,T,P,Z),R.restore()}function E(R){var A=R.angle*(Math.PI/180),z=R.spread*(Math.PI/180);return{x:R.x,y:R.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:R.startVelocity*.5+Math.random()*R.startVelocity,angle2D:-A+(.5*z-Math.random()*z),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:R.color,shape:R.shape,tick:0,totalTicks:R.ticks,decay:R.decay,drift:R.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:R.gravity*3,ovalScalar:.6,scalar:R.scalar,flat:R.flat}}function O(R,A){A.x+=Math.cos(A.angle2D)*A.velocity+A.drift,A.y+=Math.sin(A.angle2D)*A.velocity+A.gravity,A.velocity*=A.decay,A.flat?(A.wobble=0,A.wobbleX=A.x+10*A.scalar,A.wobbleY=A.y+10*A.scalar,A.tiltSin=0,A.tiltCos=0,A.random=1):(A.wobble+=A.wobbleSpeed,A.wobbleX=A.x+10*A.scalar*Math.cos(A.wobble),A.wobbleY=A.y+10*A.scalar*Math.sin(A.wobble),A.tiltAngle+=.1,A.tiltSin=Math.sin(A.tiltAngle),A.tiltCos=Math.cos(A.tiltAngle),A.random=Math.random()+2);var z=A.tick++/A.totalTicks,K=A.x+A.random*A.tiltCos,X=A.y+A.random*A.tiltSin,G=A.wobbleX+A.random*A.tiltCos,T=A.wobbleY+A.random*A.tiltSin;if(R.fillStyle="rgba("+A.color.r+", "+A.color.g+", "+A.color.b+", "+(1-z)+")",R.beginPath(),o&&A.shape.type==="path"&&typeof A.shape.path=="string"&&Array.isArray(A.shape.matrix))R.fill(H(A.shape.path,A.shape.matrix,A.x,A.y,Math.abs(G-K)*.1,Math.abs(T-X)*.1,Math.PI/10*A.wobble));else if(A.shape.type==="bitmap"){var P=Math.PI/10*A.wobble,Z=Math.abs(G-K)*.1,L=Math.abs(T-X)*.1,Y=A.shape.bitmap.width*A.scalar,ae=A.shape.bitmap.height*A.scalar,ee=new DOMMatrix([Math.cos(P)*Z,Math.sin(P)*Z,-Math.sin(P)*L,Math.cos(P)*L,A.x,A.y]);ee.multiplySelf(new DOMMatrix(A.shape.matrix));var se=R.createPattern(u.transform(A.shape.bitmap),"no-repeat");se.setTransform(ee),R.globalAlpha=1-z,R.fillStyle=se,R.fillRect(A.x-Y/2,A.y-ae/2,Y,ae),R.globalAlpha=1}else if(A.shape==="circle")R.ellipse?R.ellipse(A.x,A.y,Math.abs(G-K)*A.ovalScalar,Math.abs(T-X)*A.ovalScalar,Math.PI/10*A.wobble,0,2*Math.PI):I(R,A.x,A.y,Math.abs(G-K)*A.ovalScalar,Math.abs(T-X)*A.ovalScalar,Math.PI/10*A.wobble,0,2*Math.PI);else if(A.shape==="star")for(var V=Math.PI/2*3,ie=4*A.scalar,he=8*A.scalar,xe=A.x,ve=A.y,Q=5,ge=Math.PI/Q;Q--;)xe=A.x+Math.cos(V)*he,ve=A.y+Math.sin(V)*he,R.lineTo(xe,ve),V+=ge,xe=A.x+Math.cos(V)*ie,ve=A.y+Math.sin(V)*ie,R.lineTo(xe,ve),V+=ge;else R.moveTo(Math.floor(A.x),Math.floor(A.y)),R.lineTo(Math.floor(A.wobbleX),Math.floor(X)),R.lineTo(Math.floor(G),Math.floor(T)),R.lineTo(Math.floor(K),Math.floor(A.wobbleY));return R.closePath(),R.fill(),A.tick<A.totalTicks}function F(R,A,z,K,X){var G=A.slice(),T=R.getContext("2d"),P,Z,L=d(function(Y){function ae(){P=Z=null,T.clearRect(0,0,K.width,K.height),u.clear(),X(),Y()}function ee(){n&&!(K.width===s.width&&K.height===s.height)&&(K.width=R.width=s.width,K.height=R.height=s.height),!K.width&&!K.height&&(z(R),K.width=R.width,K.height=R.height),T.clearRect(0,0,K.width,K.height),G=G.filter(function(se){return O(T,se)}),G.length?P=f.frame(ee):ae()}P=f.frame(ee),Z=ae});return{addFettis:function(Y){return G=G.concat(Y),L},canvas:R,promise:L,reset:function(){P&&f.cancel(P),Z&&Z()}}}function D(R,A){var z=!R,K=!!v(A||{},"resize"),X=!1,G=v(A,"disableForReducedMotion",Boolean),T=i&&!!v(A||{},"useWorker"),P=T?m():null,Z=z?C:_,L=R&&P?!!R.__confetti_initialized:!1,Y=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function ee(V,ie,he){for(var xe=v(V,"particleCount",y),ve=v(V,"angle",Number),Q=v(V,"spread",Number),ge=v(V,"startVelocity",Number),De=v(V,"decay",Number),Ue=v(V,"gravity",Number),Fe=v(V,"drift",Number),Ve=v(V,"colors",w),ut=v(V,"ticks",Number),Ke=v(V,"shapes"),Ze=v(V,"scalar"),tr=!!v(V,"flat"),Ir=b(V),rr=xe,vr=[],nr=R.width*Ir.x,yt=R.height*Ir.y;rr--;)vr.push(E({x:nr,y:yt,angle:ve,spread:Q,startVelocity:ge,color:Ve[rr%Ve.length],shape:Ke[j(0,Ke.length)],ticks:ut,decay:De,gravity:Ue,drift:Fe,scalar:Ze,flat:tr}));return ae?ae.addFettis(vr):(ae=F(R,vr,Z,ie,he),ae.promise)}function se(V){var ie=G||v(V,"disableForReducedMotion",Boolean),he=v(V,"zIndex",Number);if(ie&&Y)return d(function(ge){ge()});z&&ae?R=ae.canvas:z&&!R&&(R=S(he),document.body.appendChild(R)),K&&!L&&Z(R);var xe={width:R.width,height:R.height};P&&!L&&P.init(R),L=!0,P&&(R.__confetti_initialized=!0);function ve(){if(P){var ge={getBoundingClientRect:function(){if(!z)return R.getBoundingClientRect()}};Z(ge),P.postMessage({resize:{width:ge.width,height:ge.height}});return}xe.width=xe.height=null}function Q(){ae=null,K&&(X=!1,t.removeEventListener("resize",ve)),z&&R&&(document.body.contains(R)&&document.body.removeChild(R),R=null,L=!1)}return K&&!X&&(X=!0,t.addEventListener("resize",ve,!1)),P?P.fire(V,xe,Q):ee(V,xe,Q)}return se.reset=function(){P&&P.reset(),ae&&ae.reset()},se}var U;function M(){return U||(U=D(null,{useWorker:!0,resize:!0})),U}function H(R,A,z,K,X,G,T){var P=new Path2D(R),Z=new Path2D;Z.addPath(P,new DOMMatrix(A));var L=new Path2D;return L.addPath(Z,new DOMMatrix([Math.cos(T)*X,Math.sin(T)*X,-Math.sin(T)*G,Math.cos(T)*G,z,K])),L}function re(R){if(!o)throw new Error("path confetti are not supported in this browser");var A,z;typeof R=="string"?A=R:(A=R.path,z=R.matrix);var K=new Path2D(A),X=document.createElement("canvas"),G=X.getContext("2d");if(!z){for(var T=1e3,P=T,Z=T,L=0,Y=0,ae,ee,se=0;se<T;se+=2)for(var V=0;V<T;V+=2)G.isPointInPath(K,se,V,"nonzero")&&(P=Math.min(P,se),Z=Math.min(Z,V),L=Math.max(L,se),Y=Math.max(Y,V));ae=L-P,ee=Y-Z;var ie=10,he=Math.min(ie/ae,ie/ee);z=[he,0,0,he,-Math.round(ae/2+P)*he,-Math.round(ee/2+Z)*he]}return{type:"path",path:A,matrix:z}}function J(R){var A,z=1,K="#000000",X='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof R=="string"?A=R:(A=R.text,z="scalar"in R?R.scalar:z,X="fontFamily"in R?R.fontFamily:X,K="color"in R?R.color:K);var G=10*z,T=""+G+"px "+X,P=new OffscreenCanvas(G,G),Z=P.getContext("2d");Z.font=T;var L=Z.measureText(A),Y=Math.ceil(L.actualBoundingBoxRight+L.actualBoundingBoxLeft),ae=Math.ceil(L.actualBoundingBoxAscent+L.actualBoundingBoxDescent),ee=2,se=L.actualBoundingBoxLeft+ee,V=L.actualBoundingBoxAscent+ee;Y+=ee+ee,ae+=ee+ee,P=new OffscreenCanvas(Y,ae),Z=P.getContext("2d"),Z.font=T,Z.fillStyle=K,Z.fillText(A,se,V);var ie=1/z;return{type:"bitmap",bitmap:P.transferToImageBitmap(),matrix:[ie,0,0,ie,-Y*ie/2,-ae*ie/2]}}r.exports=function(){return M().apply(this,arguments)},r.exports.reset=function(){M().reset()},r.exports.create=D,r.exports.shapeFromPath=re,r.exports.shapeFromText=J})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),kx,!1);const i4=kx.exports;kx.exports.create;function Om(e,t){var n;const r={};for(const s of t)r[s.key]=[];for(const s of e)if(r[s.status]!==void 0)r[s.status].push(s);else{const i=((n=t[0])==null?void 0:n.key)??"backlog";r[i]=[...r[i]??[],s]}return r}function o4(e,t,r){var i;const n=new Map(t.map(o=>[o.id,o])),s={};for(const o of r)s[o.key]=[];for(const o of r)for(const l of e[o.key]??[]){const c=n.get(l.id);c&&c.status===o.key&&(s[o.key].push(c),n.delete(l.id))}for(const o of n.values()){const l=s[o.status];if(l)l.push(o);else{const c=(i=r[0])==null?void 0:i.key;c&&s[c].push(o)}}return s}function qN({issues:e,projectId:t,statuses:r,onIssueClick:n,onColumnsReorder:s,readOnly:i=!1,filters:o}){var G;const[l,c]=h.useState(()=>r.map(T=>T.id)),[d,u]=h.useState(()=>Om(e,r)),[f,m]=h.useState(null),[p,x]=h.useState(null),[g,v]=h.useState(null),[y,j]=h.useState(null),[N,w]=h.useState(""),k=h.useRef(null),b=h.useRef(!1),C=Se(),_=Tt.byProject(t,o),S=qI(t),I=UI(t,y??""),E=h.useMemo(()=>{const T=new Map;for(const P of e)P.parent_id&&T.set(P.parent_id,(T.get(P.parent_id)??0)+1);return T},[e]);h.useEffect(()=>{c(T=>{const P=new Set(r.map(Y=>Y.id)),Z=T.filter(Y=>P.has(Y)),L=r.map(Y=>Y.id).filter(Y=>!T.includes(Y));return Z.length===T.length&&L.length===0?T:[...Z,...L]})},[r]),h.useEffect(()=>{b.current||u(T=>o4(T,e,r))},[e,r]);const O=[...r].sort((T,P)=>{const Z=l.indexOf(T.id),L=l.indexOf(P.id);return Z===-1&&L===-1?T.position-P.position:Z===-1?1:L===-1?-1:Z-L}),F=o1(qp(l1,i?{activationConstraint:{distance:1/0}}:{activationConstraint:{distance:5}})),D=h.useCallback(T=>{if(p){const Z=T.droppableContainers.filter(L=>l.includes(L.id));return mE({...T,droppableContainers:Z})}const P=hE(T);return P.length>0?P:pE(T)},[p,l]),U=h.useCallback(T=>{for(const[P,Z]of Object.entries(d))if(Z.some(L=>L.id===T))return P;return null},[d]),M=h.useCallback(T=>r.some(P=>P.id===T),[r]),H=T=>{const P=T.active.id;if(b.current=!0,M(P)){x(P);return}for(const[Z,L]of Object.entries(d)){const Y=L.find(ae=>ae.id===P);if(Y){m(Y),k.current=Z;return}}},re=T=>{const{active:P,over:Z}=T;if(!Z||p)return;const L=P.id,Y=Z.id;if(M(L))return;const ae=U(L),ee=r.find(V=>V.key===Y||V.id===Y),se=(ee==null?void 0:ee.key)??U(Y);!ae||!se||ae===se||u(V=>{const ie=[...V[ae]??[]],he=[...V[se]??[]],xe=ie.findIndex(ge=>ge.id===L);if(xe===-1)return V;const[ve]=ie.splice(xe,1),Q={...ve,status:se};if(ee)he.push(Q);else{const ge=he.findIndex(De=>De.id===Y);if(ge===-1)he.push(Q);else{const De=P.rect.current.translated!=null&&P.rect.current.translated.top>Z.rect.top+Z.rect.height/2;he.splice(De?ge+1:ge,0,Q)}}return{...V,[ae]:ie,[se]:he}})},J=T=>{var V;const{active:P,over:Z}=T;if(m(null),b.current=!1,p){if(x(null),!Z||P.id===Z.id)return;const ie=l.indexOf(P.id),he=l.indexOf(Z.id);if(ie===-1||he===-1||ie===he)return;const xe=pd(l,ie,he);c(xe),s==null||s(xe);return}if(!Z){const ie=k.current;k.current=null,ie&&u(Om(e,r));return}const L=P.id,Y=Z.id,ae=k.current;k.current=null;const ee=r.find(ie=>ie.key===Y||ie.id===Y),se=(ee==null?void 0:ee.key)??U(Y);if(!(!ae||!se))if(ae===se)u(ie=>{const he=ie[ae]??[],xe=he.findIndex(Q=>Q.id===L),ve=he.findIndex(Q=>Q.id===Y);return xe===-1||ve===-1||xe===ve?ie:{...ie,[ae]:pd(he,xe,ve)}});else{if(!r.find(xe=>xe.key===Y||xe.id===Y))u(xe=>{const ve=[...xe[se]??[]],Q=ve.findIndex(Ve=>Ve.id===L);if(Q===-1)return xe;const ge=T.active.rect.current.translated!=null&&T.active.rect.current.translated.top>T.over.rect.top+T.over.rect.height/2,[De]=ve.splice(Q,1),Ue=ve.findIndex(Ve=>Ve.id===Y);if(Ue===-1)return ve.splice(Q,0,De),xe;const Fe=ge?Ue+1:Ue;return ve.splice(Fe,0,De),{...xe,[se]:ve}});else{const xe=((V=T.active.rect.current.translated)==null?void 0:V.top)??1/0,ve=T.over.rect.top+T.over.rect.height/2;xe<ve&&u(Q=>{const ge=Q[se]??[],De=ge.findIndex(Ue=>Ue.id===L);return De<=0?Q:{...Q,[se]:pd(ge,De,0)}})}const he=C.getQueryData(_);C.setQueryData(_,xe=>xe&&{...xe,issues:xe.issues.map(ve=>ve.id===L?{...ve,status:se}:ve)}),oe.put(`/admin/issues/${L}`,{status:se}).then(()=>{C.invalidateQueries({queryKey:_});const xe=r.find(ve=>ve.key===se);(xe==null?void 0:xe.category)==="completed"&&i4({particleCount:80,spread:60,origin:{y:.6}})}).catch(()=>{he&&C.setQueryData(_,he),u(Om((he==null?void 0:he.issues)??e,r)),q.error("Failed to update issue status")})}},R=T=>{v(T)},A=async T=>{if(!g)return;const P=d[g.key]??[];if(P.length>0){const Z=r.find(L=>L.id===T);if(!Z)return;try{await Promise.all(P.map(L=>oe.put(`/admin/issues/${L.id}`,{status:Z.key}))),C.invalidateQueries({queryKey:Tt.byProject(t)})}catch{q.error("Failed to move issues");return}}S.mutate(g.id,{onSuccess:()=>{q.success(`Status "${g.name}" deleted`),v(null)},onError:()=>q.error("Failed to delete status")})},z=()=>{const T=N.trim();!T||!y||I.mutate({name:T},{onSuccess:()=>{q.success("Status renamed"),j(null)},onError:()=>q.error("Failed to rename status")})},K=()=>{j(null)},X=p?r.find(T=>T.id===p):null;return a.jsxs(pl,{sensors:F,collisionDetection:D,onDragStart:H,onDragOver:re,onDragEnd:J,children:[a.jsxs("div",{className:"flex gap-4 min-h-full overflow-x-auto px-6 py-4 pb-6",children:[a.jsx(Hp,{items:l,strategy:c1,children:O.map(T=>a.jsx(t4,{id:T.id,label:T.name,color:T.color,category:T.category,issues:d[T.key]??[],childCounts:E,sortable:!0,onIssueClick:n,onRename:i?void 0:()=>{j(T.id),w(T.name)},onDelete:i?void 0:()=>R(T),isRenaming:y===T.id,renameValue:y===T.id?N:"",onRenameChange:w,onRenameSubmit:z,onRenameCancel:K},T.id))}),!i&&a.jsx(a4,{projectId:t})]}),a.jsxs(xE,{children:[f&&a.jsx(UN,{issue:f}),X&&a.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:a.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:[a.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:X.color}}),X.name]})})]}),g&&a.jsx(s4,{open:!!g,statusName:g.name,issueCount:((G=d[g.key])==null?void 0:G.length)??0,otherStatuses:r.filter(T=>T.id!==g.id),onConfirm:A,onCancel:()=>v(null),isLoading:S.isPending})]})}const Ot=LP,Pt=FP,_t=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(zP,{children:a.jsx(t1,{ref:s,align:t,sideOffset:r,className:$("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),...n})}));_t.displayName=t1.displayName;const l4=[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"},{value:"none",label:"None"}],c4=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"task",label:"Task"},{value:"epic",label:"Epic"},{value:"story",label:"Story"}];function Uc({label:e,activeCount:t,children:r}){const[n,s]=h.useState(!1);return a.jsxs(Ot,{open:n,onOpenChange:s,children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:$("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border text-xs font-medium transition-colors",t>0?"border-foreground/30 bg-foreground/5 text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[e,t>0&&a.jsx("span",{className:"flex items-center justify-center h-4 w-4 rounded-full bg-foreground text-background text-[10px] font-semibold",children:t}),a.jsx(sa,{className:"h-3 w-3 opacity-60"})]})}),a.jsx(_t,{className:"w-48 p-1",align:"start",children:r})]})}function Pm({options:e,selected:t,onToggle:r}){return a.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(n=>{const s=t.includes(n.value);return a.jsxs("button",{onClick:()=>r(n.value),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:$("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",s?"bg-foreground border-foreground":"border-border"),children:s&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),n.color&&a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:n.color}}),a.jsx("span",{className:"truncate",children:n.label})]},n.value)})})}function d4({statuses:e,members:t,filters:r,onChange:n}){var c,d,u,f,m,p,x;const s=(((c=r.priority)==null?void 0:c.length)??0)>0||!!r.assignee_id||(((d=r.type)==null?void 0:d.length)??0)>0||(((u=r.status)==null?void 0:u.length)??0)>0,i=(g,v)=>{const y=r[g]??[],j=y.includes(v)?y.filter(N=>N!==v):[...y,v];n({...r,[g]:j.length?j:void 0})},o=g=>{n({...r,assignee_id:r.assignee_id===g?void 0:g})},l=r.assignee_id?((f=t.find(g=>g.userId===r.assignee_id))==null?void 0:f.name)??"Assignee":"Assignee";return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Uc,{label:r.assignee_id?l:"Assignee",activeCount:r.assignee_id?1:0,children:a.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1.5",children:"No members"}),t.map(g=>{const v=r.assignee_id===g.userId;return a.jsxs("button",{onClick:()=>o(g.userId),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:$("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",v?"bg-foreground border-foreground":"border-border"),children:v&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),a.jsx("span",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium shrink-0",children:g.initials}),a.jsx("span",{className:"truncate",children:g.name})]},g.userId)})]})}),a.jsx(Uc,{label:"Priority",activeCount:((m=r.priority)==null?void 0:m.length)??0,children:a.jsx(Pm,{options:l4,selected:r.priority??[],onToggle:g=>i("priority",g)})}),a.jsx(Uc,{label:"Type",activeCount:((p=r.type)==null?void 0:p.length)??0,children:a.jsx(Pm,{options:c4,selected:r.type??[],onToggle:g=>i("type",g)})}),a.jsx(Uc,{label:"Status",activeCount:((x=r.status)==null?void 0:x.length)??0,children:a.jsx(Pm,{options:e.map(g=>({value:g.key,label:g.name,color:g.color})),selected:r.status??[],onToggle:g=>i("status",g)})}),s&&a.jsxs("button",{onClick:()=>n({}),className:"inline-flex items-center gap-1 h-7 px-2 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear"]})]})}const u4={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function Sx(){return We({queryKey:["org","calendar"],queryFn:()=>oe.get("/admin/org/calendar"),select:e=>({working_days:e.working_days??u4,timezone:e.timezone})})}function f4(){const e=Se();return be({mutationFn:t=>oe.put("/admin/org/calendar",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","calendar"]})}})}function Cx(e){const t=e??new Date().getFullYear();return We({queryKey:["org","holidays",t],queryFn:()=>oe.get(`/admin/org/holidays?year=${t}`),select:r=>r.holidays})}function m4(){const e=Se();return be({mutationFn:t=>oe.post("/admin/org/holidays",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function h4(){const e=Se();return be({mutationFn:({id:t,...r})=>oe.put(`/admin/org/holidays/${t}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function p4(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/org/holidays/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function x4(){return We({queryKey:["app-config"],queryFn:()=>oe.get("/admin/config"),staleTime:1/0})}const g4=["sun","mon","tue","wed","thu","fri","sat"];function v4(e,t,r){const n=g4[EI(e)];if(!t[n])return!1;const s=gd(e),i=xl(e);for(const o of r){const l=new Date(o.date);if(o.recurring){if(gd(l)===s&&xl(l)===i)return!1}else if(l.getFullYear()===e.getFullYear()&&gd(l)===s&&xl(l)===i)return!1}return!0}function Oh(e,t,r,n){let s=0,i=new Date(e);i.setHours(0,0,0,0);const o=new Date(t);for(o.setHours(0,0,0,0);i<=o;)v4(i,r,n)&&s++,i=Wr(i,1);return s}const Zi={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function ko(e){return We({queryKey:e?Zi.byProject(e):Zi.all,queryFn:()=>{const t=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return oe.get(t)},select:t=>t.sprints,enabled:!!e})}function y4(e){const t=Se();return be({mutationFn:r=>oe.post("/admin/sprints",{...r,project_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:Zi.byProject(e)})}})}function b4(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/sprints/${e}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:Zi.byProject(t)}),r.invalidateQueries({queryKey:Zi.detail(e)})}})}function w4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/sprints/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Zi.byProject(e)})}})}const nf={byProject:e=>["task-lists","project",e]};function fc(e){return We({queryKey:e?nf.byProject(e):["task-lists"],queryFn:()=>oe.get(`/admin/projects/${e}/task-lists`),select:t=>t.task_lists,enabled:!!e})}function j4(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/task-lists`,r),onSuccess:()=>{t.invalidateQueries({queryKey:nf.byProject(e)})}})}function N4(e){const t=Se();return be({mutationFn:({id:r,...n})=>oe.put(`/admin/task-lists/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:nf.byProject(e)})}})}function k4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/task-lists/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:nf.byProject(e)}),t.invalidateQueries({queryKey:Tt.byProject(e)})}})}function xy(e,t,r){const n=(e==null?void 0:e[0])??"",s=(t==null?void 0:t[0])??"";return(n+s).toUpperCase()||((r==null?void 0:r[0])??"U").toUpperCase()}function gy(e,t,r){return`${e??""} ${t??""}`.trim()||r}function mc({value:e,onChange:t,disabled:r,users:n}){const[s,i]=h.useState(!1),[o,l]=h.useState(e),{data:c}=dc(),d=n??c??[],u=e.slice().sort().join(",");h.useEffect(()=>{l(e)},[u]);const f=p=>{const x=o.includes(p)?o.filter(g=>g!==p):[...o,p];l(x),t(x)},m=d.filter(p=>o.includes(p.id));return a.jsxs(Ot,{open:s,onOpenChange:i,children:[a.jsx(Pt,{asChild:!0,disabled:r,children:a.jsx("button",{type:"button",className:$("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",r&&"pointer-events-none opacity-50"),children:m.length===0?a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(ho,{className:"h-3.5 w-3.5"}),"Assign"]}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"flex -space-x-1.5",children:m.slice(0,3).map(p=>a.jsx(Rt,{className:"h-5 w-5 border border-background ring-0",children:a.jsx($t,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:xy(p.first_name,p.last_name,p.email)})},p.id))}),m.length>3&&a.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",m.length-3]}),a.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:m.length===1?gy(m[0].first_name,m[0].last_name,m[0].email):`${m.length} assignees`})]})})}),a.jsx(_t,{className:"w-60 p-0",align:"start",children:a.jsxs(Vs,{children:[a.jsx(Zu,{placeholder:"Search users...",className:"h-8 text-xs"}),a.jsxs(Xs,{children:[a.jsx(Ju,{className:"text-xs py-4",children:"No users found."}),a.jsx(is,{children:d.map(p=>{const x=o.includes(p.id),g=gy(p.first_name,p.last_name,p.email),v=xy(p.first_name,p.last_name,p.email);return a.jsxs(dn,{value:g,onSelect:()=>f(p.id),className:"gap-2 py-1.5",children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:"text-[9px] bg-muted text-muted-foreground",children:v})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-medium truncate",children:g}),a.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:p.email})]}),a.jsx(dr,{className:$("h-3.5 w-3.5 shrink-0",x?"opacity-100 text-indigo-500":"opacity-0")})]},p.id)})})]})]})})]})}function S4(e,t,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:r}).format(t).split(/\s/g).slice(2).join(" ")}const Em={},cl={};function qs(e,t){try{const n=(Em[e]||(Em[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in cl?cl[n]:vy(n,n.split(":"))}catch{if(e in cl)return cl[e];const r=e==null?void 0:e.match(C4);return r?vy(e,r.slice(1)):NaN}}const C4=/([+-]\d\d):?(\d\d)?/;function vy(e,t){const r=+(t[0]||0),n=+(t[1]||0),s=+(t[2]||0)/60;return cl[e]=r*60+n>0?r*60+n+s:r*60-n-s}class Kn extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(qs(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),HN(this),Ph(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new Kn(...r,t):new Kn(Date.now(),t)}withTimeZone(t){return new Kn(+this,t)}getTimezoneOffset(){const t=-qs(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Ph(this),+this}[Symbol.for("constructDateFrom")](t){return new Kn(+new Date(t),this.timeZone)}}const yy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!yy.test(e))return;const t=e.replace(yy,"$1UTC");Kn.prototype[t]&&(e.startsWith("get")?Kn.prototype[e]=function(){return this.internal[t]()}:(Kn.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),_4(this),+this},Kn.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Ph(this),+this}))});function Ph(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-qs(e.timeZone,e)*60))}function _4(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()),HN(e)}function HN(e){const t=qs(e.timeZone,e),r=t>0?Math.floor(t):Math.ceil(t),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),o=s-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=s-r;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const u=s>0?d.getSeconds():(d.getSeconds()-60)%60,f=Math.round(-(qs(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=qs(e.timeZone,e),p=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-p,v=p!==r,y=g-c;if(v&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const j=qs(e.timeZone,e),N=j>0?Math.floor(j):Math.ceil(j),w=p-N;w&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+w),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w))}}class pr extends Kn{static tz(t,...r){return r.length?new pr(...r,t):new pr(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),s=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,s]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,s]=this.tzComponents();return`${t} GMT${r}${n}${s} (${S4(this.timeZone,this)})`}toLocaleString(t,r){return Date.prototype.toLocaleString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(t,r){return Date.prototype.toLocaleDateString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(t,r){return Date.prototype.toLocaleTimeString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),r=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[r,n,s]}withTimeZone(t){return new pr(+this,t)}[Symbol.for("constructDateFrom")](t){return new pr(+new Date(t),this.timeZone)}}const by=5,M4=4;function O4(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,s=t.addDays(e,-n+1),i=t.addDays(s,by*7-1);return t.getMonth(e)===t.getMonth(i)?by:M4}function KN(e,t){const r=t.startOfMonth(e),n=r.getDay();return n===1?r:n===0?t.addDays(r,-1*6):t.addDays(r,-1*(n-1))}function P4(e,t){const r=KN(e,t),n=O4(e,t);return t.addDays(r,n*7-1)}const YN={...Bs,labels:{labelDayButton:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>ue(o,l,{locale:Bs,...r});let i=s(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},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,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>ue(s,i,{locale:Bs,...t}),n(e,"LLLL yyyy")},labelGridcell:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>ue(o,l,{locale:Bs,...r});let i=s(e,"PPPP");return t!=null&&t.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>ue(s,i,{locale:Bs,...t}),n(e,"cccc")}}};class rn{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?pr.tz(this.options.timeZone):new this.Date},this.newDate=(n,s,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(n,s,i):this.options.timeZone?new pr(n,s,i,this.options.timeZone):new Date(n,s,i)},this.addDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,s):Wr(n,s)},this.addMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,s):vx(n,s)},this.addWeeks=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,s):j3(n,s)},this.addYears=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,s):N3(n,s)},this.differenceInCalendarDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,s):tf(n,s)},this.differenceInCalendarMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,s):bx(n,s)},this.eachMonthOfInterval=n=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):E3(n)},this.eachYearOfInterval=n=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(n):D3(n),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):P4(n,this)},this.endOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(n):T3(n)},this.endOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(n):wx(n)},this.endOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,s):LN(n,this.options)},this.endOfYear=n=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(n):A3(n)},this.format=(n,s,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(n,s,this.options):ue(n,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(n):jx(n)},this.getMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):gd(n,this.options)},this.getYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):AI(n,this.options)},this.getWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):Nx(n,this.options)},this.isAfter=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,s):DI(n,s)},this.isBefore=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,s):TI(n,s)},this.isDate=n=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(n):EN(n)},this.isSameDay=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,s):Qi(n,s)},this.isSameMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,s):II(n,s)},this.isSameYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,s):RI(n,s)},this.max=n=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(n):k3(n)},this.min=n=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(n):S3(n)},this.setMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,s):LI(n,s)},this.setYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,s):FI(n,s)},this.startOfBroadcastWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):KN(n,this)},this.startOfDay=n=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(n):Xi(n)},this.startOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(n):wl(n)},this.startOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(n):$N(n)},this.startOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Vi(n,this.options)},this.startOfYear=n=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(n):zN(n)},this.options={locale:YN,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let s=0;s<10;s++)n[s.toString()]=r.format(s);return n}replaceDigits(t){const r=this.getDigitMap();return t.replace(/\d/g,n=>r[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){var r;const t=(r=this.options.locale)==null?void 0:r.code;return t&&rn.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:r,timeZone:n,numerals:s}=this.options,i=r==null?void 0:r.code;if(i&&rn.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:n,numberingSystem:s}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}rn.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 da=new rn;class GN{constructor(t,r,n=da){this.date=t,this.displayMonth=r,this.outside=!!(r&&!n.isSameMonth(t,r)),this.dateLib=n,this.isoDate=n.format(t,"yyyy-MM-dd"),this.displayMonthId=n.format(r,"yyyy-MM"),this.dateMonthId=n.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class E4{constructor(t,r){this.date=t,this.weeks=r}}class A4{constructor(t,r){this.days=r,this.weekNumber=t}}function D4(e){return B.createElement("button",{...e})}function T4(e){return B.createElement("span",{...e})}function I4(e){const{size:t=24,orientation:r="left",className:n}=e;return B.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&B.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&B.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&B.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&B.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function R4(e){const{day:t,modifiers:r,...n}=e;return B.createElement("td",{...n})}function $4(e){const{day:t,modifiers:r,...n}=e,s=B.useRef(null);return B.useEffect(()=>{var i;r.focused&&((i=s.current)==null||i.focus())},[r.focused]),B.createElement("button",{ref:s,...n})}var Me;(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"})(Me||(Me={}));var jt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(jt||(jt={}));var Sn;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Sn||(Sn={}));var Xr;(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"})(Xr||(Xr={}));function z4(e){const{options:t,className:r,components:n,classNames:s,...i}=e,o=[s[Me.Dropdown],r].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return B.createElement("span",{"data-disabled":i.disabled,className:s[Me.DropdownRoot]},B.createElement(n.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:d,disabled:u})=>B.createElement(n.Option,{key:c,value:c,disabled:u},d))),B.createElement("span",{className:s[Me.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,B.createElement(n.Chevron,{orientation:"down",size:18,className:s[Me.Chevron]})))}function L4(e){return B.createElement("div",{...e})}function F4(e){return B.createElement("div",{...e})}function B4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return B.createElement("div",{...n},e.children)}function W4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return B.createElement("div",{...n})}function U4(e){return B.createElement("table",{...e})}function q4(e){return B.createElement("div",{...e})}const VN=h.createContext(void 0);function hc(){const e=h.useContext(VN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function H4(e){const{components:t}=hc();return B.createElement(t.Dropdown,{...e})}function K4(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:d}}=hc(),u=h.useCallback(m=>{s&&(r==null||r(m))},[s,r]),f=h.useCallback(m=>{n&&(t==null||t(m))},[n,t]);return B.createElement("nav",{...i},B.createElement(o.PreviousMonthButton,{type:"button",className:l[Me.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:f},B.createElement(o.Chevron,{disabled:n?void 0:!0,className:l[Me.Chevron],orientation:"left"})),B.createElement(o.NextMonthButton,{type:"button",className:l[Me.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:u},B.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[Me.Chevron]})))}function Y4(e){const{components:t}=hc();return B.createElement(t.Button,{...e})}function G4(e){return B.createElement("option",{...e})}function V4(e){const{components:t}=hc();return B.createElement(t.Button,{...e})}function X4(e){const{rootRef:t,...r}=e;return B.createElement("div",{...r,ref:t})}function Q4(e){return B.createElement("select",{...e})}function Z4(e){const{week:t,...r}=e;return B.createElement("tr",{...r})}function J4(e){return B.createElement("th",{...e})}function eR(e){return B.createElement("thead",{"aria-hidden":!0},B.createElement("tr",{...e}))}function tR(e){const{week:t,...r}=e;return B.createElement("th",{...r})}function rR(e){return B.createElement("th",{...e})}function nR(e){return B.createElement("tbody",{...e})}function aR(e){const{components:t}=hc();return B.createElement(t.Dropdown,{...e})}const sR=Object.freeze(Object.defineProperty({__proto__:null,Button:D4,CaptionLabel:T4,Chevron:I4,Day:R4,DayButton:$4,Dropdown:z4,DropdownNav:L4,Footer:F4,Month:B4,MonthCaption:W4,MonthGrid:U4,Months:q4,MonthsDropdown:H4,Nav:K4,NextMonthButton:Y4,Option:G4,PreviousMonthButton:V4,Root:X4,Select:Q4,Week:Z4,WeekNumber:tR,WeekNumberHeader:rR,Weekday:J4,Weekdays:eR,Weeks:nR,YearsDropdown:aR},Symbol.toStringTag,{value:"Module"}));function ba(e,t,r=!1,n=da){let{from:s,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=n;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(t,s)>=(r?1:0)&&o(i,t)>=(r?1:0)):!r&&i?l(i,t):!r&&s?l(s,t):!1}function _x(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function af(e){return!!(e&&typeof e=="object"&&"from"in e)}function Mx(e){return!!(e&&typeof e=="object"&&"after"in e)}function Ox(e){return!!(e&&typeof e=="object"&&"before"in e)}function XN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function QN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function wa(e,t,r=da){const n=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=r;return n.some(l=>{if(typeof l=="boolean")return l;if(r.isDate(l))return s(e,l);if(QN(l,r))return l.some(c=>s(e,c));if(af(l))return ba(l,e,!1,r);if(XN(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(_x(l)){const c=i(l.before,e),d=i(l.after,e),u=c>0,f=d<0;return o(l.before,l.after)?f&&u:u||f}return Mx(l)?i(e,l.after)>0:Ox(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function iR(e,t,r,n,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:u=s.today()}=t,{isSameDay:f,isSameMonth:m,startOfMonth:p,isBefore:x,endOfMonth:g,isAfter:v}=s,y=r&&p(r),j=n&&g(n),N={[jt.focused]:[],[jt.outside]:[],[jt.disabled]:[],[jt.hidden]:[],[jt.today]:[]},w={};for(const k of e){const{date:b,displayMonth:C}=k,_=!!(C&&!m(b,C)),S=!!(y&&x(b,y)),I=!!(j&&v(b,j)),E=!!(i&&wa(b,i,s)),O=!!(o&&wa(b,o,s))||S||I||!d&&!c&&_||d&&c===!1&&_,F=f(b,u);_&&N.outside.push(k),E&&N.disabled.push(k),O&&N.hidden.push(k),F&&N.today.push(k),l&&Object.keys(l).forEach(D=>{const U=l==null?void 0:l[D];U&&wa(b,U,s)&&(w[D]?w[D].push(k):w[D]=[k])})}return k=>{const b={[jt.focused]:!1,[jt.disabled]:!1,[jt.hidden]:!1,[jt.outside]:!1,[jt.today]:!1},C={};for(const _ in N){const S=N[_];b[_]=S.some(I=>I===k)}for(const _ in w)C[_]=w[_].some(S=>S===k);return{...b,...C}}}function oR(e,t,r={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[i])=>(r[i]?s.push(r[i]):t[jt[i]]?s.push(t[jt[i]]):t[Sn[i]]&&s.push(t[Sn[i]]),s),[t[Me.Day]])}function lR(e){return{...sR,...e}}function cR(e){const t={"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(([r,n])=>{r.startsWith("data-")&&(t[r]=n)}),t}function dR(){const e={};for(const t in Me)e[Me[t]]=`rdp-${Me[t]}`;for(const t in jt)e[jt[t]]=`rdp-${jt[t]}`;for(const t in Sn)e[Sn[t]]=`rdp-${Sn[t]}`;for(const t in Xr)e[Xr[t]]=`rdp-${Xr[t]}`;return e}function ZN(e,t,r){return(r??new rn(t)).formatMonthYear(e)}const uR=ZN;function fR(e,t,r){return(r??new rn(t)).format(e,"d")}function mR(e,t=da){return t.format(e,"LLLL")}function hR(e,t,r){return(r??new rn(t)).format(e,"cccccc")}function pR(e,t=da){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function xR(){return""}function JN(e,t=da){return t.format(e,"yyyy")}const gR=JN,vR=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:ZN,formatDay:fR,formatMonthCaption:uR,formatMonthDropdown:mR,formatWeekNumber:pR,formatWeekNumberHeader:xR,formatWeekdayName:hR,formatYearCaption:gR,formatYearDropdown:JN},Symbol.toStringTag,{value:"Module"}));function yR(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...vR,...e}}function Px(e,t,r,n){let s=(n??new rn(r)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const bR=Px;function Ex(e,t,r){return(r??new rn(t)).formatMonthYear(e)}const wR=Ex;function ek(e,t,r,n){let s=(n??new rn(r)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function tk(e){return"Choose the Month"}function rk(){return""}const jR="Go to the Next Month";function nk(e,t){return jR}function ak(e){return"Go to the Previous Month"}function sk(e,t,r){return(r??new rn(t)).format(e,"cccc")}function ik(e,t){return`Week ${e}`}function ok(e){return"Week Number"}function lk(e){return"Choose the Year"}const NR=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:wR,labelDay:bR,labelDayButton:Px,labelGrid:Ex,labelGridcell:ek,labelMonthDropdown:tk,labelNav:rk,labelNext:nk,labelPrevious:ak,labelWeekNumber:ik,labelWeekNumberHeader:ok,labelWeekday:sk,labelYearDropdown:lk},Symbol.toStringTag,{value:"Module"})),yn=(e,t,r)=>t||(r?typeof r=="function"?r:(...n)=>r:e);function kR(e,t){var n;const r=((n=t.locale)==null?void 0:n.labels)??{};return{...NR,...e??{},labelDayButton:yn(Px,e==null?void 0:e.labelDayButton,r.labelDayButton),labelMonthDropdown:yn(tk,e==null?void 0:e.labelMonthDropdown,r.labelMonthDropdown),labelNext:yn(nk,e==null?void 0:e.labelNext,r.labelNext),labelPrevious:yn(ak,e==null?void 0:e.labelPrevious,r.labelPrevious),labelWeekNumber:yn(ik,e==null?void 0:e.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:yn(lk,e==null?void 0:e.labelYearDropdown,r.labelYearDropdown),labelGrid:yn(Ex,e==null?void 0:e.labelGrid,r.labelGrid),labelGridcell:yn(ek,e==null?void 0:e.labelGridcell,r.labelGridcell),labelNav:yn(rk,e==null?void 0:e.labelNav,r.labelNav),labelWeekNumberHeader:yn(ok,e==null?void 0:e.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:yn(sk,e==null?void 0:e.labelWeekday,r.labelWeekday)}}function SR(e,t,r,n,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:o(e),end:l(e)}).map(m=>{const p=n.formatMonthDropdown(m,s),x=d(m),g=t&&m<i(t)||r&&m>i(r)||!1;return{value:x,label:p,disabled:g}})}function CR(e,t={},r={}){let n={...t==null?void 0:t[Me.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{n={...n,...r==null?void 0:r[s]}}),n}function _R(e,t,r,n){const s=n??e.today(),i=r?e.startOfBroadcastWeek(s,e):t?e.startOfISOWeek(s):e.startOfWeek(s),o=[];for(let l=0;l<7;l++){const c=e.addDays(i,l);o.push(c)}return o}function MR(e,t,r,n,s=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:c}=n,d=i(e),u=o(t),f=l({start:d,end:u});return s&&f.reverse(),f.map(m=>{const p=r.formatYearDropdown(m,n);return{value:c(m),label:p,disabled:!1}})}function OR(e,t={}){var l;const{weekStartsOn:r,locale:n}=t,s=r??((l=n==null?void 0:n.options)==null?void 0:l.weekStartsOn)??0,i=c=>{const d=typeof c=="number"||typeof c=="string"?new Date(c):c;return new pr(d.getFullYear(),d.getMonth(),d.getDate(),12,0,0,e)},o=c=>{const d=i(c);return new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,0,0,0)};return{today:()=>i(pr.tz(e)),newDate:(c,d,u)=>new pr(c,d,u,12,0,0,e),startOfDay:c=>i(c),startOfWeek:(c,d)=>{const u=i(c),f=(d==null?void 0:d.weekStartsOn)??s,m=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-m),u},startOfISOWeek:c=>{const d=i(c),u=(d.getDay()-1+7)%7;return d.setDate(d.getDate()-u),d},startOfMonth:c=>{const d=i(c);return d.setDate(1),d},startOfYear:c=>{const d=i(c);return d.setMonth(0,1),d},endOfWeek:(c,d)=>{const u=i(c),p=((((d==null?void 0:d.weekStartsOn)??s)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+p),u},endOfISOWeek:c=>{const d=i(c),u=(7-d.getDay())%7;return d.setDate(d.getDate()+u),d},endOfMonth:c=>{const d=i(c);return d.setMonth(d.getMonth()+1,0),d},endOfYear:c=>{const d=i(c);return d.setMonth(11,31),d},eachMonthOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),d.getMonth(),1,12,0,0,e),p=u.getFullYear()*12+u.getMonth();for(;m.getFullYear()*12+m.getMonth()<=p;)f.push(new pr(m,e)),m.setMonth(m.getMonth()+1,1);return f},addDays:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d),u},addWeeks:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d*7),u},addMonths:(c,d)=>{const u=i(c);return u.setMonth(u.getMonth()+d),u},addYears:(c,d)=>{const u=i(c);return u.setFullYear(u.getFullYear()+d),u},eachYearOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new pr(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(c,d)=>{var f;const u=o(c);return Nx(u,{weekStartsOn:(d==null?void 0:d.weekStartsOn)??s,firstWeekContainsDate:(d==null?void 0:d.firstWeekContainsDate)??((f=n==null?void 0:n.options)==null?void 0:f.firstWeekContainsDate)??1})},getISOWeek:c=>{const d=o(c);return jx(d)},differenceInCalendarDays:(c,d)=>{const u=o(c),f=o(d);return tf(u,f)},differenceInCalendarMonths:(c,d)=>{const u=o(c),f=o(d);return bx(u,f)}}}const pc=e=>e instanceof HTMLElement?e:null,Am=e=>[...e.querySelectorAll("[data-animated-month]")??[]],PR=e=>pc(e.querySelector("[data-animated-month]")),Dm=e=>pc(e.querySelector("[data-animated-caption]")),Tm=e=>pc(e.querySelector("[data-animated-weeks]")),ER=e=>pc(e.querySelector("[data-animated-nav]")),AR=e=>pc(e.querySelector("[data-animated-weekdays]"));function DR(e,t,{classNames:r,months:n,focused:s,dateLib:i}){const o=h.useRef(null),l=h.useRef(n),c=h.useRef(!1);h.useLayoutEffect(()=>{const d=l.current;if(l.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||d.length===0||n.length!==d.length)return;const u=i.isSameMonth(n[0].date,d[0].date),f=i.isAfter(n[0].date,d[0].date),m=f?r[Xr.caption_after_enter]:r[Xr.caption_before_enter],p=f?r[Xr.weeks_after_enter]:r[Xr.weeks_before_enter],x=o.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(Am(g).forEach(N=>{if(!(N instanceof HTMLElement))return;const w=PR(N);w&&N.contains(w)&&N.removeChild(w);const k=Dm(N);k&&k.classList.remove(m);const b=Tm(N);b&&b.classList.remove(p)}),o.current=g):o.current=null,c.current||u||s)return;const v=x instanceof HTMLElement?Am(x):[],y=Am(e.current);if(y!=null&&y.every(j=>j instanceof HTMLElement)&&v&&v.every(j=>j instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const j=ER(e.current);j&&(j.style.zIndex="1"),y.forEach((N,w)=>{const k=v[w];if(!k)return;N.style.position="relative",N.style.overflow="hidden";const b=Dm(N);b&&b.classList.add(m);const C=Tm(N);C&&C.classList.add(p);const _=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),j&&(j.style.zIndex=""),b&&b.classList.remove(m),C&&C.classList.remove(p),N.style.position="",N.style.overflow="",N.contains(k)&&N.removeChild(k)};k.style.pointerEvents="none",k.style.position="absolute",k.style.overflow="hidden",k.setAttribute("aria-hidden","true");const S=AR(k);S&&(S.style.opacity="0");const I=Dm(k);I&&(I.classList.add(f?r[Xr.caption_before_exit]:r[Xr.caption_after_exit]),I.addEventListener("animationend",_));const E=Tm(k);E&&E.classList.add(f?r[Xr.weeks_before_exit]:r[Xr.weeks_after_exit]),N.insertBefore(k,N.firstChild)})}})}function TR(e,t,r,n){const s=e[0],i=e[e.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:c}=r??{},{addDays:d,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:m,endOfISOWeek:p,endOfMonth:x,endOfWeek:g,isAfter:v,startOfBroadcastWeek:y,startOfISOWeek:j,startOfWeek:N}=n,w=c?y(s,n):o?j(s):N(s),k=c?m(i):o?p(x(i)):g(x(i)),b=t&&(c?m(t):o?p(t):g(t)),C=b&&v(k,b)?b:k,_=u(C,w),S=f(i,s)+1,I=[];for(let F=0;F<=_;F++){const D=d(w,F);I.push(D)}const O=(c?35:42)*S;if(l&&I.length<O){const F=O-I.length;for(let D=0;D<F;D++){const U=d(I[I.length-1],1);I.push(U)}}return I}function IR(e){const t=[];return e.reduce((r,n)=>{const s=n.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return r.concat(s.slice())},t.slice())}function RR(e,t,r,n){const{numberOfMonths:s=1}=r,i=[];for(let o=0;o<s;o++){const l=n.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function wy(e,t,r,n){const{month:s,defaultMonth:i,today:o=n.today(),numberOfMonths:l=1}=e;let c=s||i||o;const{differenceInCalendarMonths:d,addMonths:u,startOfMonth:f}=n;if(r&&d(r,c)<l-1){const m=-1*(l-1);c=u(r,m)}return t&&d(c,t)<0&&(c=t),f(c)}function $R(e,t,r,n){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:c,getISOWeek:d,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:m,startOfWeek:p}=n,x=e.reduce((g,v)=>{const y=r.broadcastCalendar?f(v,n):r.ISOWeek?m(v):p(v),j=r.broadcastCalendar?i(v):r.ISOWeek?o(l(v)):c(l(v)),N=t.filter(C=>C>=y&&C<=j),w=r.broadcastCalendar?35:42;if(r.fixedWeeks&&N.length<w){const C=t.filter(_=>{const S=w-N.length;return _>j&&_<=s(j,S)});N.push(...C)}const k=N.reduce((C,_)=>{const S=r.ISOWeek?d(_):u(_),I=C.find(O=>O.weekNumber===S),E=new GN(_,v,n);return I?I.days.push(E):C.push(new A4(S,[E])),C},[]),b=new E4(v,k);return g.push(b),g},[]);return r.reverseMonths?x.reverse():x}function zR(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:c,endOfYear:d,newDate:u,today:f}=t,{fromYear:m,toYear:p,fromMonth:x,toMonth:g}=e;!r&&x&&(r=x),!r&&m&&(r=t.newDate(m,0,1)),!n&&g&&(n=g),!n&&p&&(n=u(p,11,31));const v=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return r?r=o(r):m?r=u(m,0,1):!r&&v&&(r=s(c(e.today??f(),-100))),n?n=l(n):p?n=u(p,11,31):!n&&v&&(n=d(e.today??f())),[r&&i(r),n&&i(n)]}function LR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i:1,u=o(e);if(!t)return l(u,d);if(!(c(t,e)<i))return l(u,d)}function FR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i??1:1,u=o(e);if(!t)return l(u,-d);if(!(c(u,t)<=0))return l(u,-d)}function BR(e){const t=[];return e.reduce((r,n)=>r.concat(n.weeks.slice()),t.slice())}function sf(e,t){const[r,n]=h.useState(e);return[t===void 0?r:t,n]}function WR(e,t){var w;const[r,n]=zR(e,t),{startOfMonth:s,endOfMonth:i}=t,o=wy(e,r,n,t),[l,c]=sf(o,e.month?o:void 0);h.useEffect(()=>{const k=wy(e,r,n,t);c(k)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:m,nextMonth:p}=h.useMemo(()=>{const k=RR(l,n,{numberOfMonths:e.numberOfMonths},t),b=TR(k,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=$R(k,b,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),_=BR(C),S=IR(C),I=FR(l,r,e,t),E=LR(l,n,e,t);return{months:C,weeks:_,days:S,previousMonth:I,nextMonth:E}},[t,l.getTime(),n==null?void 0:n.getTime(),r==null?void 0:r.getTime(),e.disableNavigation,e.broadcastCalendar,(w=e.endMonth)==null?void 0:w.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:x,onMonthChange:g}=e,v=k=>u.some(b=>b.days.some(C=>C.isEqualTo(k))),y=k=>{if(x)return;let b=s(k);r&&b<s(r)&&(b=s(r)),n&&b>s(n)&&(b=s(n)),c(b),g==null||g(b)};return{months:d,weeks:u,days:f,navStart:r,navEnd:n,previousMonth:m,nextMonth:p,goToMonth:y,goToDay:k=>{v(k)||y(k.date)}}}var qn;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(qn||(qn={}));function jy(e){return!e[jt.disabled]&&!e[jt.hidden]&&!e[jt.outside]}function UR(e,t,r,n){let s,i=-1;for(const o of e){const l=t(o);jy(l)&&(l[jt.focused]&&i<qn.FocusedModifier?(s=o,i=qn.FocusedModifier):n!=null&&n.isEqualTo(o)&&i<qn.LastFocused?(s=o,i=qn.LastFocused):r(o.date)&&i<qn.Selected?(s=o,i=qn.Selected):l[jt.today]&&i<qn.Today&&(s=o,i=qn.Today))}return s||(s=e.find(o=>jy(t(o)))),s}function qR(e,t,r,n,s,i,o){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:u,addWeeks:f,addYears:m,endOfBroadcastWeek:p,endOfISOWeek:x,endOfWeek:g,max:v,min:y,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:w}=o;let b={day:d,week:f,month:u,year:m,startOfWeek:C=>c?j(C,o):l?N(C):w(C),endOfWeek:C=>c?p(C):l?x(C):g(C)}[e](r,t==="after"?1:-1);return t==="before"&&n?b=v([n,b]):t==="after"&&s&&(b=y([s,b])),b}function ck(e,t,r,n,s,i,o,l=0){if(l>365)return;const c=qR(e,t,r.date,n,s,i,o),d=!!(i.disabled&&wa(c,i.disabled,o)),u=!!(i.hidden&&wa(c,i.hidden,o)),f=c,m=new GN(c,f,o);return!d&&!u?m:ck(e,t,m,n,s,i,o,l+1)}function HR(e,t,r,n,s){const{autoFocus:i}=e,[o,l]=h.useState(),c=UR(t.days,r,n||(()=>!1),o),[d,u]=h.useState(i?c:void 0);return{isFocusTarget:g=>!!(c!=null&&c.isEqualTo(g)),setFocused:u,focused:d,blur:()=>{l(d),u(void 0)},moveFocus:(g,v)=>{if(!d)return;const y=ck(g,v,d,t.navStart,t.navEnd,e,s);y&&(e.disableNavigation&&!t.days.some(N=>N.isEqualTo(y))||(t.goToDay(y),u(y)))}}}function KR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=sf(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t,d=p=>(l==null?void 0:l.some(x=>c(x,p)))??!1,{min:u,max:f}=e;return{selected:l,select:(p,x,g)=>{let v=[...l??[]];if(d(p)){if((l==null?void 0:l.length)===u||n&&(l==null?void 0:l.length)===1)return;v=l==null?void 0:l.filter(y=>!c(y,p))}else(l==null?void 0:l.length)===f?v=[p]:v=[...v,p];return s||o(v),s==null||s(v,p,x,g),v},isSelected:d}}function YR(e,t,r=0,n=0,s=!1,i=da){const{from:o,to:l}=t||{},{isSameDay:c,isAfter:d,isBefore:u}=i;let f;if(!o&&!l)f={from:e,to:r>0?void 0:e};else if(o&&!l)c(o,e)?r===0?f={from:o,to:e}:s?f={from:o,to:void 0}:f=void 0:u(e,o)?f={from:e,to:o}:f={from:o,to:e};else if(o&&l)if(c(o,e)&&c(l,e))s?f={from:o,to:l}:f=void 0;else if(c(o,e))f={from:o,to:r>0?void 0:e};else if(c(l,e))f={from:e,to:r>0?void 0:e};else if(u(e,o))f={from:e,to:l};else if(d(e,o))f={from:o,to:e};else if(d(e,l))f={from:o,to:e};else throw new Error("Invalid range");if(f!=null&&f.from&&(f!=null&&f.to)){const m=i.differenceInCalendarDays(f.to,f.from);n>0&&m>n?f={from:e,to:void 0}:r>1&&m<r&&(f={from:e,to:void 0})}return f}function GR(e,t,r=da){const n=Array.isArray(t)?t:[t];let s=e.from;const i=r.differenceInCalendarDays(e.to,e.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(n.includes(s.getDay()))return!0;s=r.addDays(s,1)}return!1}function Ny(e,t,r=da){return ba(e,t.from,!1,r)||ba(e,t.to,!1,r)||ba(t,e.from,!1,r)||ba(t,e.to,!1,r)}function VR(e,t,r=da){const n=Array.isArray(t)?t:[t];if(n.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:r.isDate(l)?ba(e,l,!1,r):QN(l,r)?l.some(c=>ba(e,c,!1,r)):af(l)?l.from&&l.to?Ny(e,{from:l.from,to:l.to},r):!1:XN(l)?GR(e,l.dayOfWeek,r):_x(l)?r.isAfter(l.before,l.after)?Ny(e,{from:r.addDays(l.after,1),to:r.addDays(l.before,-1)},r):wa(e.from,l,r)||wa(e.to,l,r):Mx(l)||Ox(l)?wa(e.from,l,r)||wa(e.to,l,r):!1))return!0;const o=n.filter(l=>typeof l=="function");if(o.length){let l=e.from;const c=r.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(o.some(u=>u(l)))return!0;l=r.addDays(l,1)}}return!1}function XR(e,t){const{disabled:r,excludeDisabled:n,selected:s,required:i,onSelect:o}=e,[l,c]=sf(s,o?s:void 0),d=o?s:l;return{selected:d,select:(m,p,x)=>{const{min:g,max:v}=e,y=m?YR(m,d,g,v,i,t):void 0;return n&&r&&(y!=null&&y.from)&&y.to&&VR({from:y.from,to:y.to},r,t)&&(y.from=m,y.to=void 0),o||c(y),o==null||o(y,m,p,x),y},isSelected:m=>d&&ba(d,m,!1,t)}}function QR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=sf(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t;return{selected:l,select:(f,m,p)=>{let x=f;return!n&&l&&l&&c(f,l)&&(x=void 0),s||o(x),s==null||s(x,f,m,p),x},isSelected:f=>l?c(l,f):!1}}function ZR(e,t){const r=QR(e,t),n=KR(e,t),s=XR(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return s;default:return}}function cn(e,t){return e instanceof pr&&e.timeZone===t?e:new pr(e,t)}function Ei(e,t,r){return cn(e,t)}function ky(e,t,r){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Ei(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?Ei(n,t):n):af(e)?{...e,from:e.from?cn(e.from,t):e.from,to:e.to?cn(e.to,t):e.to}:_x(e)?{before:Ei(e.before,t),after:Ei(e.after,t)}:Mx(e)?{after:Ei(e.after,t)}:Ox(e)?{before:Ei(e.before,t)}:e}function Im(e,t,r){return e&&(Array.isArray(e)?e.map(n=>ky(n,t)):ky(e,t))}function JR(e){var Oe;let t=e;const r=t.timeZone;if(r&&(t={...e,timeZone:r},t.today&&(t.today=cn(t.today,r)),t.month&&(t.month=cn(t.month,r)),t.defaultMonth&&(t.defaultMonth=cn(t.defaultMonth,r)),t.startMonth&&(t.startMonth=cn(t.startMonth,r)),t.endMonth&&(t.endMonth=cn(t.endMonth,r)),t.mode==="single"&&t.selected?t.selected=cn(t.selected,r):t.mode==="multiple"&&t.selected?t.selected=(Oe=t.selected)==null?void 0:Oe.map(pe=>cn(pe,r)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?cn(t.selected.from,r):t.selected.from,to:t.selected.to?cn(t.selected.to,r):t.selected.to}),t.disabled!==void 0&&(t.disabled=Im(t.disabled,r)),t.hidden!==void 0&&(t.hidden=Im(t.hidden,r)),t.modifiers)){const pe={};Object.keys(t.modifiers).forEach(Ne=>{var me;pe[Ne]=Im((me=t.modifiers)==null?void 0:me[Ne],r)}),t.modifiers=pe}const{components:n,formatters:s,labels:i,dateLib:o,locale:l,classNames:c}=h.useMemo(()=>{const pe={...YN,...t.locale},Ne=t.broadcastCalendar?1:t.weekStartsOn,me=t.noonSafe&&t.timeZone?OR(t.timeZone,{weekStartsOn:Ne,locale:pe}):void 0,ye=t.dateLib&&me?{...me,...t.dateLib}:t.dateLib??me,Xe=new rn({locale:pe,weekStartsOn:Ne,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},ye);return{dateLib:Xe,components:lR(t.components),formatters:yR(t.formatters),labels:kR(t.labels,Xe.options),locale:pe,classNames:{...dR(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});const{captionLayout:d,mode:u,navLayout:f,numberOfMonths:m=1,onDayBlur:p,onDayClick:x,onDayFocus:g,onDayKeyDown:v,onDayMouseEnter:y,onDayMouseLeave:j,onNextClick:N,onPrevClick:w,showWeekNumber:k,styles:b}=t,{formatCaption:C,formatDay:_,formatMonthDropdown:S,formatWeekNumber:I,formatWeekNumberHeader:E,formatWeekdayName:O,formatYearDropdown:F}=s,D=WR(t,o),{days:U,months:M,navStart:H,navEnd:re,previousMonth:J,nextMonth:R,goToMonth:A}=D,z=iR(U,t,H,re,o),{isSelected:K,select:X,selected:G}=ZR(t,o)??{},{blur:T,focused:P,isFocusTarget:Z,moveFocus:L,setFocused:Y}=HR(t,D,z,K??(()=>!1),o),{labelDayButton:ae,labelGridcell:ee,labelGrid:se,labelMonthDropdown:V,labelNav:ie,labelPrevious:he,labelNext:xe,labelWeekday:ve,labelWeekNumber:Q,labelWeekNumberHeader:ge,labelYearDropdown:De}=i,Ue=h.useMemo(()=>_R(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Fe=u!==void 0||x!==void 0,Ve=h.useCallback(()=>{J&&(A(J),w==null||w(J))},[J,A,w]),ut=h.useCallback(()=>{R&&(A(R),N==null||N(R))},[A,R,N]),Ke=h.useCallback((pe,Ne)=>me=>{me.preventDefault(),me.stopPropagation(),Y(pe),!Ne.disabled&&(X==null||X(pe.date,Ne,me),x==null||x(pe.date,Ne,me))},[X,x,Y]),Ze=h.useCallback((pe,Ne)=>me=>{Y(pe),g==null||g(pe.date,Ne,me)},[g,Y]),tr=h.useCallback((pe,Ne)=>me=>{T(),p==null||p(pe.date,Ne,me)},[T,p]),Ir=h.useCallback((pe,Ne)=>me=>{const ye={ArrowLeft:[me.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[me.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[me.shiftKey?"year":"week","after"],ArrowUp:[me.shiftKey?"year":"week","before"],PageUp:[me.shiftKey?"year":"month","before"],PageDown:[me.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ye[me.key]){me.preventDefault(),me.stopPropagation();const[Xe,de]=ye[me.key];L(Xe,de)}v==null||v(pe.date,Ne,me)},[L,v,t.dir]),rr=h.useCallback((pe,Ne)=>me=>{y==null||y(pe.date,Ne,me)},[y]),vr=h.useCallback((pe,Ne)=>me=>{j==null||j(pe.date,Ne,me)},[j]),nr=h.useCallback(pe=>Ne=>{const me=Number(Ne.target.value),ye=o.setMonth(o.startOfMonth(pe),me);A(ye)},[o,A]),yt=h.useCallback(pe=>Ne=>{const me=Number(Ne.target.value),ye=o.setYear(o.startOfMonth(pe),me);A(ye)},[o,A]),{className:Lt,style:Kt}=h.useMemo(()=>({className:[c[Me.Root],t.className].filter(Boolean).join(" "),style:{...b==null?void 0:b[Me.Root],...t.style}}),[c,t.className,t.style,b]),ar=cR(t),Rn=h.useRef(null);DR(Rn,!!t.animate,{classNames:c,months:M,focused:P,dateLib:o});const ua={dayPickerProps:t,selected:G,select:X,isSelected:K,months:M,nextMonth:R,previousMonth:J,goToMonth:A,getModifiers:z,components:n,classNames:c,styles:b,labels:i,formatters:s};return B.createElement(VN.Provider,{value:ua},B.createElement(n.Root,{rootRef:t.animate?Rn:void 0,className:Lt,style:Kt,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...ar},B.createElement(n.Months,{className:c[Me.Months],style:b==null?void 0:b[Me.Months]},!t.hideNavigation&&!f&&B.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:R}),M.map((pe,Ne)=>B.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:c[Me.Month],style:b==null?void 0:b[Me.Month],key:Ne,displayIndex:Ne,calendarMonth:pe},f==="around"&&!t.hideNavigation&&Ne===0&&B.createElement(n.PreviousMonthButton,{type:"button",className:c[Me.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":he(J),onClick:Ve,"data-animated-button":t.animate?"true":void 0},B.createElement(n.Chevron,{disabled:J?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"right":"left"})),B.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[Me.MonthCaption],style:b==null?void 0:b[Me.MonthCaption],calendarMonth:pe,displayIndex:Ne},d!=null&&d.startsWith("dropdown")?B.createElement(n.DropdownNav,{className:c[Me.Dropdowns],style:b==null?void 0:b[Me.Dropdowns]},(()=>{const me=d==="dropdown"||d==="dropdown-months"?B.createElement(n.MonthsDropdown,{key:"month",className:c[Me.MonthsDropdown],"aria-label":V(),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:nr(pe.date),options:SR(pe.date,H,re,s,o),style:b==null?void 0:b[Me.Dropdown],value:o.getMonth(pe.date)}):B.createElement("span",{key:"month"},S(pe.date,o)),ye=d==="dropdown"||d==="dropdown-years"?B.createElement(n.YearsDropdown,{key:"year",className:c[Me.YearsDropdown],"aria-label":De(o.options),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:yt(pe.date),options:MR(H,re,s,o,!!t.reverseYears),style:b==null?void 0:b[Me.Dropdown],value:o.getYear(pe.date)}):B.createElement("span",{key:"year"},F(pe.date,o));return o.getMonthYearOrder()==="year-first"?[ye,me]:[me,ye]})(),B.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(pe.date,o.options,o))):B.createElement(n.CaptionLabel,{className:c[Me.CaptionLabel],role:"status","aria-live":"polite"},C(pe.date,o.options,o))),f==="around"&&!t.hideNavigation&&Ne===m-1&&B.createElement(n.NextMonthButton,{type:"button",className:c[Me.NextMonthButton],tabIndex:R?void 0:-1,"aria-disabled":R?void 0:!0,"aria-label":xe(R),onClick:ut,"data-animated-button":t.animate?"true":void 0},B.createElement(n.Chevron,{disabled:R?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Ne===m-1&&f==="after"&&!t.hideNavigation&&B.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:R}),B.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":se(pe.date,o.options,o)||void 0,className:c[Me.MonthGrid],style:b==null?void 0:b[Me.MonthGrid]},!t.hideWeekdays&&B.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[Me.Weekdays],style:b==null?void 0:b[Me.Weekdays]},k&&B.createElement(n.WeekNumberHeader,{"aria-label":ge(o.options),className:c[Me.WeekNumberHeader],style:b==null?void 0:b[Me.WeekNumberHeader],scope:"col"},E()),Ue.map(me=>B.createElement(n.Weekday,{"aria-label":ve(me,o.options,o),className:c[Me.Weekday],key:String(me),style:b==null?void 0:b[Me.Weekday],scope:"col"},O(me,o.options,o)))),B.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[Me.Weeks],style:b==null?void 0:b[Me.Weeks]},pe.weeks.map(me=>B.createElement(n.Week,{className:c[Me.Week],key:me.weekNumber,style:b==null?void 0:b[Me.Week],week:me},k&&B.createElement(n.WeekNumber,{week:me,style:b==null?void 0:b[Me.WeekNumber],"aria-label":Q(me.weekNumber,{locale:l}),className:c[Me.WeekNumber],scope:"row",role:"rowheader"},I(me.weekNumber,o)),me.days.map(ye=>{const{date:Xe}=ye,de=z(ye);if(de[jt.focused]=!de.hidden&&!!(P!=null&&P.isEqualTo(ye)),de[Sn.selected]=(K==null?void 0:K(Xe))||de.selected,af(G)){const{from:rt,to:nt}=G;de[Sn.range_start]=!!(rt&&nt&&o.isSameDay(Xe,rt)),de[Sn.range_end]=!!(rt&&nt&&o.isSameDay(Xe,nt)),de[Sn.range_middle]=ba(G,Xe,!0,o)}const _e=CR(de,b,t.modifiersStyles),Te=oR(de,c,t.modifiersClassNames),bt=!Fe&&!de.hidden?ee(Xe,de,o.options,o):void 0;return B.createElement(n.Day,{key:`${ye.isoDate}_${ye.displayMonthId}`,day:ye,modifiers:de,className:Te.join(" "),style:_e,role:"gridcell","aria-selected":de.selected||void 0,"aria-label":bt,"data-day":ye.isoDate,"data-month":ye.outside?ye.dateMonthId:void 0,"data-selected":de.selected||void 0,"data-disabled":de.disabled||void 0,"data-hidden":de.hidden||void 0,"data-outside":ye.outside||void 0,"data-focused":de.focused||void 0,"data-today":de.today||void 0},!de.hidden&&Fe?B.createElement(n.DayButton,{className:c[Me.DayButton],style:b==null?void 0:b[Me.DayButton],type:"button",day:ye,modifiers:de,disabled:!de.focused&&de.disabled||void 0,"aria-disabled":de.focused&&de.disabled||void 0,tabIndex:Z(ye)?0:-1,"aria-label":ae(Xe,de,o.options,o),onClick:Ke(ye,de),onBlur:tr(ye,de),onFocus:Ze(ye,de),onKeyDown:Ir(ye,de),onMouseEnter:rr(ye,de),onMouseLeave:vr(ye,de)},_(Xe,o.options,o)):!de.hidden&&_(ye.date,o.options,o))})))))))),t.footer&&B.createElement(n.Footer,{className:c[Me.Footer],style:b==null?void 0:b[Me.Footer],role:"status","aria-live":"polite"},t.footer)))}function gr({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a.jsx(JR,{showOutsideDays:r,className:$("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 pointer-events-none",nav:"flex items-center gap-1",button_previous:$(Ui({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),button_next:$(Ui({variant:"outline"}),"absolute right-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),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:$(Ui({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",...t},components:{Chevron:({orientation:s})=>s==="left"?a.jsx(gs,{className:"h-4 w-4"}):a.jsx(Cr,{className:"h-4 w-4"})},...n})}gr.displayName="Calendar";function e$(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,t$(s,...t)]}function t$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function r$(e){const t=n$(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(s$);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function n$(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=o$(s),l=i$(i,s.props);return s.type!==h.Fragment&&(l.ref=n?r1(n,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var a$=Symbol("radix.slottable");function s$(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===a$}function i$(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function o$(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var l$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dk=l$.reduce((e,t)=>{const r=r$(`Primitive.${t}`),n=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),of="Switch",[c$]=e$(of),[d$,u$]=c$(of),uk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[m,p]=h.useState(null),x=Iu(t,N=>p(N)),g=h.useRef(!1),v=m?u||!!m.closest("form"):!0,[y,j]=BP({prop:s,defaultProp:i??!1,onChange:d,caller:of});return a.jsxs(d$,{scope:r,checked:y,disabled:l,children:[a.jsx(dk.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":pk(y),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Ls(e.onClick,N=>{j(w=>!w),v&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})}),v&&a.jsx(hk,{control:m,bubbles:!g.current,name:n,value:c,checked:y,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});uk.displayName=of;var fk="SwitchThumb",mk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=u$(fk,r);return a.jsx(dk.span,{"data-state":pk(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});mk.displayName=fk;var f$="SwitchBubbleInput",hk=h.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},i)=>{const o=h.useRef(null),l=Iu(o,i),c=WP(r),d=UP(t);return h.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&p){const x=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(x)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});hk.displayName=f$;function pk(e){return e?"checked":"unchecked"}var xk=uk,m$=mk;const So=h.forwardRef(({className:e,...t},r)=>a.jsx(xk,{className:$("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(m$,{className:$("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));So.displayName=xk.displayName;function h$(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?ue(new Date(e.start_date),"MMM d"):"—",r=e.end_date?ue(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function lf({open:e,onClose:t,projectId:r,defaultStatus:n="backlog",defaultTaskListId:s,defaultParentId:i}){const o=pt(),{workspace:l,projectKey:c}=zt(),{workspace:d}=Ie(),[u,f]=h.useState(""),[m,p]=h.useState(""),[x,g]=h.useState(n),[v,y]=h.useState("medium"),[j,N]=h.useState("task"),[w,k]=h.useState([]),[b,C]=h.useState(""),[_,S]=h.useState(s??""),[I,E]=h.useState(void 0),[O,F]=h.useState(void 0),[D,U]=h.useState(!1),[M,H]=h.useState("weekly"),[re,J]=h.useState(void 0),R=E1(),{data:A}=oa(r),z=h.useMemo(()=>A?A.members.filter(Y=>Y.user).map(Y=>Y.user):void 0,[A]),{data:K}=jo(r),{data:X}=ko(r||void 0),{data:G}=fc(r||void 0),T=(X??[]).filter(Y=>Y.status!=="completed"),P=K&&K.length>0?Object.fromEntries(K.map(Y=>[Y.key,Y.name])):ci,Z=()=>{f(""),p(""),g(n),y("medium"),N("task"),k([]),C(""),S(s??""),E(void 0),F(void 0),U(!1),H("weekly"),J(void 0),t()},L=Y=>{Y.preventDefault(),u.trim()&&R.mutate({title:u.trim(),description:m.trim()||void 0,status:x,priority:v,type:j,project_id:r,workspace_id:d.id,assignee_ids:w.length>0?w:void 0,sprint_id:b||null,task_list_id:_||null,parent_id:i||null,start_date:I?ue(I,"yyyy-MM-dd"):null,due_date:O?ue(O,"yyyy-MM-dd"):null,recurrence_frequency:D?M:void 0,recurrence_end_date:D&&re?ue(re,"yyyy-MM-dd"):void 0},{onSuccess:()=>{q.success("Issue created"),Z()},onError:ae=>q.error(ae.message??"Failed to create issue")})};return a.jsx(Ni,{open:e,onOpenChange:Y=>!Y&&Z(),children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(vo,{children:a.jsx(bo,{children:"New issue"})}),a.jsxs("form",{onSubmit:L,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(yo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"issue-title",children:"Title"}),a.jsx(Ae,{id:"issue-title",placeholder:"Issue title",value:u,onChange:Y=>f(Y.target.value),autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"issue-desc",children:["Description ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(ef,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:Y=>p(Y.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Status"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(P).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Priority"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(tn).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Type"}),a.jsxs(Le,{value:j,onValueChange:N,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(_a).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]})]}),i&&a.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"}),(G??[]).length>0&&!i&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["List ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:_||"none",onValueChange:Y=>S(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No list"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(G??[]).map(Y=>a.jsx(we,{value:Y.id,className:"text-xs",children:Y.name},Y.id))]})]})]}),T.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Sprint ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:b||"none",onValueChange:Y=>C(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),T.map(Y=>{const ae=h$(Y);return a.jsx(we,{value:Y.id,className:"text-xs",children:a.jsxs("div",{children:[a.jsx("span",{children:Y.name}),ae&&a.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:ae})]})},Y.id)})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Assignees ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(mc,{value:w,onChange:k,users:z})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Start Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:I?"text-foreground":"text-muted-foreground",children:I?ue(I,"MMM d, yyyy"):"No start date"}),I&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),E(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:I,onSelect:E,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Due Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:O?"text-foreground":"text-muted-foreground",children:O?ue(O,"MMM d, yyyy"):"No due date"}),O&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),F(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:O,onSelect:F,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(So,{id:"recurring",checked:D,onCheckedChange:U}),a.jsxs(mt,{htmlFor:"recurring",className:"cursor-pointer font-normal flex items-center gap-1.5",children:[a.jsx(Gi,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Recurring"]})]}),D&&a.jsx("div",{className:"space-y-3 pl-4 border-l-2 border-indigo-200 dark:border-indigo-800",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Frequency"}),a.jsxs(Le,{value:M,onValueChange:Y=>H(Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Until ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-8 w-full rounded-md border border-input px-3 text-xs bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:re?"text-foreground":"text-muted-foreground",children:re?ue(re,"MMM d, yyyy"):"No end date"}),re&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),J(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:re,onSelect:J,initialFocus:!0})})]})]})]})})]})]}),a.jsxs(lc,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[a.jsxs(ne,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Z(),o(`/${l}/projects/${c}/issues/new`)},children:[a.jsx(nx,{className:"h-3.5 w-3.5"}),"Open full form"]}),a.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:Z,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!u.trim()||R.isPending,children:R.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Ax={byIssue:e=>["attachments",e]};function gk(e){return We({queryKey:Ax.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/attachments`),select:t=>t.attachments,enabled:!!e})}function vk(e){const t=Se();return be({mutationFn:({file:r,commentId:n})=>{const s=new FormData;return s.append("file",r),n&&s.append("comment_id",n),oe.upload(`/admin/issues/${e}/attachments`,s)},onSuccess:()=>{t.invalidateQueries({queryKey:Ax.byIssue(e)})}})}function p$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/attachments/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ax.byIssue(e)})}})}function jl(e){return e.startsWith("image/")}function cf(e){return e.startsWith("video/")}function df(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Md(e){if(e.startsWith("/"))return!0;try{const{protocol:t}=new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function Dx(e,t){if(!Md(e)){console.error("downloadFile: blocked unsafe URL",e);return}const r=document.createElement("a");r.href=e,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}function Tx({mimeType:e,className:t}){return jl(e)?a.jsx(d5,{className:t}):cf(e)?a.jsx(vl,{className:t}):e.startsWith("text/")||e.includes("json")?a.jsx(c5,{className:t}):e.includes("zip")||e.includes("tar")||e.includes("gz")?a.jsx(l5,{className:t}):e.includes("pdf")||e.includes("word")||e.includes("document")?a.jsx(u5,{className:t}):a.jsx(f5,{className:t})}function yk({attachment:e,onClose:t}){return e?a.jsx(Ni,{open:!0,onOpenChange:r=>!r&&t(),children:a.jsxs(ki,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[a.jsxs(vo,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[a.jsx(bo,{className:"text-sm font-medium truncate",children:e.original_name}),a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Dx(e.url,e.original_name),children:[a.jsx(rx,{className:"h-3.5 w-3.5"}),"Download"]})]}),a.jsxs(yo,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[jl(e.mime_type)&&Md(e.url)&&a.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),cf(e.mime_type)&&Md(e.url)&&a.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),a.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[a.jsx("span",{children:df(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:e.mime_type}),a.jsx("span",{children:"·"}),a.jsxs("span",{children:["Uploaded ",ue(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function x$({attachment:e}){const[t,r]=h.useState(null),n=jl(e.mime_type)||cf(e.mime_type),s=()=>{n?r(e):Dx(e.url,e.original_name)};return a.jsxs(a.Fragment,{children:[jl(e.mime_type)?a.jsx("button",{type:"button",onClick:s,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:a.jsx("img",{src:Md(e.url)?e.url:"",alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):a.jsxs("button",{type:"button",onClick:s,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:n?"View":"Download",children:[a.jsx(Tx,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),a.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:df(e.size)}),!n&&a.jsx(rx,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),t&&a.jsx(yk,{attachment:t,onClose:()=>r(null)})]})}function g$({attachment:e,onOpen:t,onDelete:r,isDeleting:n}){const s=jl(e.mime_type)||cf(e.mime_type),i=()=>{s?t(e):Dx(e.url,e.original_name)};return a.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("button",{type:"button",onClick:i,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:s?"View":"Download",children:a.jsx(Tx,{mimeType:e.mime_type,className:"h-4 w-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("button",{type:"button",onClick:i,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),a.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[a.jsx("span",{children:df(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:ue(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{className:"italic",children:"from comment"})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{className:"flex items-center gap-0.5",children:[a.jsx(rx,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),a.jsx(ne,{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:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function v$({onFiles:e,isUploading:t}){const[r,n]=h.useState(!1),s=h.useRef(null),i=h.useCallback(o=>{o.preventDefault(),n(!1);const l=Array.from(o.dataTransfer.files);l.length>0&&e(l)},[e]);return a.jsxs("div",{onDragOver:o=>{o.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:i,onClick:()=>{var o;return!t&&((o=s.current)==null?void 0:o.click())},className:$("flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed px-4 py-6","cursor-pointer transition-colors",r?"border-primary/60 bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30",t&&"opacity-60 cursor-wait"),children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:a.jsx(R5,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("p",{className:"text-xs font-medium text-foreground",children:t?"Uploading…":"Drop files or click to browse"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),a.jsx("input",{ref:s,type:"file",multiple:!0,className:"hidden",onChange:o=>{const l=Array.from(o.target.files??[]);l.length>0&&e(l),o.target.value=""}})]})}function y$({issueId:e,className:t}){const[r,n]=h.useState(null),{data:s,isLoading:i}=gk(e),o=vk(e),l=p$(e),c=u=>{u.forEach(f=>{o.mutate({file:f},{onSuccess:()=>q.success(`${f.name} uploaded`),onError:()=>q.error(`Failed to upload ${f.name}`)})})},d=u=>{l.mutate(u,{onSuccess:()=>q.success("Attachment removed"),onError:()=>q.error("Failed to remove attachment")})};return a.jsxs("div",{className:$("px-6 py-4 space-y-4",t),children:[a.jsx(v$,{onFiles:c,isUploading:o.isPending}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(u=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(ce,{className:"h-8 w-8 rounded-md shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(ce,{className:"h-3 w-2/3"}),a.jsx(ce,{className:"h-2.5 w-1/3"})]})]},u))}):s&&s.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(ix,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[s.length," ",s.length===1?"file":"files"]})]}),a.jsx("div",{children:s.map(u=>a.jsx(g$,{attachment:u,onOpen:n,onDelete:d,isDeleting:l.isPending},u.id))})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),a.jsx(yk,{attachment:r,onClose:()=>n(null)})]})}const bs={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function b$(e){return We({queryKey:bs.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function w$(e){return We({queryKey:bs.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e,refetchInterval:1e4})}function j$(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:bs.byIssue(e)})}})}function N$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{t.invalidateQueries({queryKey:bs.activeTimer(e)}),t.invalidateQueries({queryKey:bs.byIssue(e)})}})}function k$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:bs.activeTimer(e)}),t.invalidateQueries({queryKey:bs.byIssue(e)})}})}function S$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:bs.byIssue(e)})}})}const C$=Xl("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 Pn({className:e,variant:t,...r}){return a.jsx("div",{className:$(C$({variant:t}),e),...r})}function Eh(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function Sy(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3),n=Math.floor(r/3600),s=Math.floor(r%3600/60),i=r%60,o=String(s).padStart(2,"0"),l=String(i).padStart(2,"0");return n>0?`${n}:${o}:${l}`:`${o}:${l}`}function _$({startedAt:e}){const[t,r]=h.useState(()=>Sy(e));return h.useEffect(()=>{const n=setInterval(()=>r(Sy(e)),1e3);return()=>clearInterval(n)},[e]),a.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:t})}function M$({onSubmit:e,isPending:t,onCancel:r}){const[n,s]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(""),[d,u]=h.useState(new Date().toISOString().split("T")[0]),f=m=>{m.preventDefault();const p=parseInt(n||"0",10),x=parseInt(i||"0",10),g=p*60+x;if(g<=0){q.error("Please enter a duration greater than 0.");return}e({duration_minutes:g,description:l.trim()||void 0,logged_date:d||void 0})};return a.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),a.jsx(Ae,{type:"number",min:"0",max:"999",placeholder:"0",value:n,onChange:m=>s(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),a.jsx(Ae,{type:"number",min:"0",max:"59",placeholder:"0",value:i,onChange:m=>o(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),a.jsx(Ae,{type:"date",value:d,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",a.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),a.jsx(Ae,{placeholder:"What did you work on?",value:l,onChange:m=>c(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"h-7 text-xs",children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:t,className:"h-7 text-xs",children:t?"Saving…":"Log time"})]})]})}function O$({entry:e,userName:t,onDelete:r,isDeleting:n}){const s=e.started_at!=null&&e.stopped_at==null;return a.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("div",{className:$("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",s?"bg-emerald-50 dark:bg-emerald-950/40":"bg-muted"),children:s?a.jsx(A5,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?a.jsx(Dn,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(i5,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s?a.jsx(_$,{startedAt:e.started_at}):a.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:Eh(e.duration_minutes??0)}),a.jsx(Pn,{variant:"muted",className:$("text-[10px] px-1.5 py-0",s?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":""),children:s?"Running":e.source==="timer"?"Timer":"Manual"}),t&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:t})]}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!s&&a.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:ue(new Date(e.logged_date),"MMM d, yyyy")})]}),!s&&a.jsx(ne,{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:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function P$({issueId:e,className:t}){const[r,n]=h.useState(!1),{data:s,isLoading:i}=b$(e),{data:o}=w$(e),{data:l}=js(),c=j$(e),d=N$(e),u=k$(e),f=S$(e),m=(s==null?void 0:s.time_logs)??[],p=(s==null?void 0:s.total_minutes)??0,x=o!=null,g=N=>{c.mutate(N,{onSuccess:()=>{n(!1),q.success("Time logged")},onError:()=>q.error("Failed to log time")})},v=()=>{d.mutate(void 0,{onSuccess:()=>q.success("Timer started"),onError:N=>q.error(N.message??"Failed to start timer")})},y=()=>{u.mutate(void 0,{onSuccess:N=>{const w=N.time_log.duration_minutes??0;q.success(`Timer stopped — ${Eh(w)} logged`)},onError:()=>q.error("Failed to stop timer")})},j=N=>{f.mutate(N,{onSuccess:()=>q.success("Time entry removed"),onError:()=>q.error("Failed to remove entry")})};return a.jsxs("div",{className:$("px-6 py-4 space-y-4",t),children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),a.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:p>0?Eh(p):"—"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!r&&a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>n(!0),children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Log time"]}),x?a.jsxs(ne,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:y,disabled:u.isPending,children:[a.jsx(M5,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):a.jsxs(ne,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:v,disabled:d.isPending,children:[a.jsx(vl,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),r&&a.jsx(M$,{onSubmit:g,isPending:c.isPending,onCancel:()=>n(!1)}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(N=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(ce,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(ce,{className:"h-3 w-1/3"}),a.jsx(ce,{className:"h-2.5 w-1/4"})]})]},N))}):m.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(Dn,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[m.length," ",m.length===1?"entry":"entries"]})]}),a.jsx("div",{children:m.map(N=>{var w;return a.jsx(O$,{entry:N,userName:(w=l==null?void 0:l.get(N.user_id))==null?void 0:w.name,onDelete:j,isDeleting:f.isPending},N.id)})})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function E$(e){var t;const{char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:l}=e,c=n&&!s,d=wE(r),u=new RegExp(`\\s${d}$`),f=o?"^":"",m=s?"":d,p=c?new RegExp(`${f}${d}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${f}(?:^)?${d}[^\\s${m}]*`,"gm"),x=((t=l.nodeBefore)==null?void 0:t.isText)&&l.nodeBefore.text;if(!x)return null;const g=l.pos-x.length,v=Array.from(x.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const y=v.input.slice(Math.max(0,v.index-1),v.index),j=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!j)return null;const N=g+v.index;let w=N+v[0].length;return c&&u.test(x.slice(w-1,w+1))&&(v[0]+=" ",w+=1),N<l.pos&&w>=l.pos?{range:{from:N,to:w},query:v[0].slice(r.length),text:v[0]}:null}var A$=new u1("suggestion");function D$({pluginKey:e=A$,editor:t,char:r="@",allowSpaces:n=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:l="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:m=()=>[],render:p=()=>({}),allow:x=()=>!0,findSuggestionMatch:g=E$,shouldShow:v}){let y;const j=p==null?void 0:p(),N=()=>{const C=t.state.selection.$anchor.pos,_=t.view.coordsAtPos(C),{top:S,right:I,bottom:E,left:O}=_;try{return new DOMRect(O,S,I-O,E-S)}catch{return null}},w=(C,_)=>_?()=>{const S=e.getState(t.state),I=S==null?void 0:S.decorationId,E=C.dom.querySelector(`[data-decoration-id="${I}"]`);return(E==null?void 0:E.getBoundingClientRect())||null}:N;function k(C,_){var S;try{const E=e.getState(C.state),O=E!=null&&E.decorationId?C.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`):null,F={editor:t,range:(E==null?void 0:E.range)||{from:0,to:0},query:(E==null?void 0:E.query)||null,text:(E==null?void 0:E.text)||null,items:[],command:D=>f({editor:t,range:(E==null?void 0:E.range)||{from:0,to:0},props:D}),decorationNode:O,clientRect:w(C,O)};(S=j==null?void 0:j.onExit)==null||S.call(j,F)}catch{}const I=C.state.tr.setMeta(_,{exit:!0});C.dispatch(I)}const b=new vE({key:e,view(){return{update:async(C,_)=>{var S,I,E,O,F,D,U;const M=(S=this.key)==null?void 0:S.getState(_),H=(I=this.key)==null?void 0:I.getState(C.state),re=M.active&&H.active&&M.range.from!==H.range.from,J=!M.active&&H.active,R=M.active&&!H.active,A=!J&&!R&&M.query!==H.query,z=J||re&&A,K=A||re,X=R||re&&A;if(!z&&!K&&!X)return;const G=X&&!z?M:H,T=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);y={editor:t,range:G.range,query:G.query,text:G.text,items:[],command:P=>f({editor:t,range:G.range,props:P}),decorationNode:T,clientRect:w(C,T)},z&&((E=j==null?void 0:j.onBeforeStart)==null||E.call(j,y)),K&&((O=j==null?void 0:j.onBeforeUpdate)==null||O.call(j,y)),(K||z)&&(y.items=await m({editor:t,query:G.query})),X&&((F=j==null?void 0:j.onExit)==null||F.call(j,y)),K&&((D=j==null?void 0:j.onUpdate)==null||D.call(j,y)),z&&((U=j==null?void 0:j.onStart)==null||U.call(j,y))},destroy:()=>{var C;y&&((C=j==null?void 0:j.onExit)==null||C.call(j,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,S,I){const{isEditable:E}=t,{composing:O}=t.view,{selection:F}=C,{empty:D,from:U}=F,M={..._},H=C.getMeta(e);if(H&&H.exit)return M.active=!1,M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null,M;if(M.composing=O,E&&(D||t.view.composing)){(U<_.range.from||U>_.range.to)&&!O&&!_.composing&&(M.active=!1);const re=g({char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:F.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;re&&x({editor:t,state:I,range:re.range,isActive:_.active})&&(!v||v({editor:t,range:re.range,query:re.query,text:re.text,transaction:C}))?(M.active=!0,M.decorationId=_.decorationId?_.decorationId:J,M.range=re.range,M.query=re.query,M.text=re.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,_){var S,I,E,O;const{active:F,range:D}=b.getState(C.state);if(!F)return!1;if(_.key==="Escape"||_.key==="Esc"){const M=b.getState(C.state),H=(S=y==null?void 0:y.decorationNode)!=null?S:null,re=H??(M!=null&&M.decorationId?C.dom.querySelector(`[data-decoration-id="${M.decorationId}"]`):null);if(((I=j==null?void 0:j.onKeyDown)==null?void 0:I.call(j,{view:C,event:_,range:M.range}))||!1)return!0;const R={editor:t,range:M.range,query:M.query,text:M.text,items:[],command:A=>f({editor:t,range:M.range,props:A}),decorationNode:re,clientRect:re?()=>re.getBoundingClientRect()||null:null};return(E=j==null?void 0:j.onExit)==null||E.call(j,R),k(C,e),!0}return((O=j==null?void 0:j.onKeyDown)==null?void 0:O.call(j,{view:C,event:_,range:D}))||!1},decorations(C){const{active:_,range:S,decorationId:I,query:E}=b.getState(C);if(!_)return null;const O=!(E!=null&&E.length),F=[c];return O&&F.push(u),yE.create(C.doc,[bE.inline(S.from,S.to,{nodeName:l,class:F.join(" "),"data-decoration-id":I,"data-decoration-content":d})])}}});return b}function T$({editor:e,overrideSuggestionOptions:t,extensionName:r,char:n="@"}){const s=new u1;return{editor:e,char:n,pluginKey:s,command:({editor:i,range:o,props:l})=>{var c,d,u;const f=i.view.state.selection.$to.nodeAfter;((c=f==null?void 0:f.text)==null?void 0:c.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:r,attrs:{...l,mentionSuggestionChar:n}},{type:"text",text:" "}]).run(),(u=(d=i.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:o})=>{const l=i.doc.resolve(o.from),c=i.schema.nodes[r];return!!l.parent.type.contentMatch.matchType(c)},...t}}function bk(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>T$({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Cy(e,t){const r=bk(e),n=r.find(s=>s.char===t);return n||(r.length?r[0]:null)}var I$=jE.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var r,n;return`${(r=t==null?void 0:t.char)!=null?r:"@"}${(n=e.attrs.label)!=null?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:r}){var n,s;return["span",Rc(this.HTMLAttributes,e.HTMLAttributes),`${(n=r==null?void 0:r.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const r=Cy(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:r})];const n={...this.options};n.HTMLAttributes=Rc({"data-type":this.name},this.options.HTMLAttributes,t);const s=this.options.renderHTML({options:n,node:e,suggestion:r});return typeof s=="string"?["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),s]:s},...kE({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=r.exec(e);for(;n!==null;){const[,s,i,o]=n,l=i??o;t[s==="char"?"mentionSuggestionChar":s]=l,n=r.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t==="mentionSuggestionChar"?"char":t}="${r}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:Cy(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1;const{selection:n}=t,{empty:s,anchor:i}=n;if(!s)return!1;let o=new NE,l=0;return t.doc.nodesBetween(i-1,i,(c,d)=>{if(c.type.name===this.name)return r=!0,o=c,l=d,!1}),r&&e.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,l,l+o.nodeSize),r})}},addProseMirrorPlugins(){return bk(this).map(D$)}}),R$=I$;function $$({items:e,selectedIndex:t,onSelect:r}){const n=h.useRef(null);return h.useEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.querySelector(`[data-index="${t}"]`);s==null||s.scrollIntoView({block:"nearest"})},[t]),e.length===0?null:a.jsx("div",{className:$("z-50 min-w-[220px] max-w-[280px] rounded-md border border-border","bg-popover shadow-md overflow-hidden","animate-in fade-in-0 zoom-in-95"),children:a.jsx("div",{ref:n,className:"max-h-[200px] overflow-y-auto p-1",role:"listbox",children:e.map((s,i)=>{const o=s.label.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2)||"?",l=$x(s.label);return a.jsxs("button",{"data-index":i,role:"option","aria-selected":i===t,onMouseDown:c=>{c.preventDefault(),r(s)},className:$("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs cursor-pointer","transition-colors",i===t?"bg-accent text-accent-foreground":"hover:bg-accent/60"),children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:$("text-[9px] font-semibold",l.bg,l.text),children:o})}),a.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[a.jsx("span",{className:"font-medium text-foreground truncate leading-tight",children:s.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground truncate leading-tight",children:s.email})]})]},s.id)})})})}function Os({onClick:e,active:t,title:r,children:n}){return a.jsx("button",{type:"button",title:r,onMouseDown:s=>{s.preventDefault(),e()},className:$("flex h-6 w-6 items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted",t&&"bg-muted text-foreground"),children:n})}function _y(){return a.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}const qc={active:!1,items:[],selectedIndex:0,rect:null,command:null};function wk({issueId:e,projectId:t,compact:r,className:n,onSuccess:s}){const[i,o]=h.useState(!0),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,m]=h.useState(qc),p=h.useRef(null),x=h.useRef(async()=>{}),g=h.useRef(null),{user:v}=Ie(),y=e5(e),j=vk(e),{data:N}=oa(t??""),w=h.useMemo(()=>N!=null&&N.members?N.members.filter(T=>T.user).map(T=>{const P=T.user,Z=`${P.first_name??""} ${P.last_name??""}`.trim()||P.email;return{id:P.id,label:Z,email:P.email}}):[],[N]),k=h.useRef([]);k.current=w;const b=h.useRef(m);b.current=m;const C=h.useRef([]),_=h.useRef(null),S=h.useRef(0),I=(v==null?void 0:v.first_name)??"",E=(v==null?void 0:v.last_name)??"",O=`${I} ${E}`.trim()||(v==null?void 0:v.email)||"?",F=v&&`${I[0]??""}${E[0]??""}`.toUpperCase()||"?",D=$x(O),U=h.useMemo(()=>SE.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(x.current(),!0)}}}),[]),M=h.useMemo(()=>R$.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:T})=>{const P=k.current;if(!P.length)return[];const Z=T.toLowerCase();return P.filter(L=>!Z||L.label.toLowerCase().includes(Z)||L.email.toLowerCase().includes(Z)).slice(0,8)},render:()=>({onStart:T=>{var P;C.current=T.items,_.current=T.command,S.current=0,b.current({active:!0,items:T.items,selectedIndex:0,rect:((P=T.clientRect)==null?void 0:P.call(T))??null,command:T.command})},onUpdate:T=>{var P;C.current=T.items,_.current=T.command,S.current=0,b.current({active:!0,items:T.items,selectedIndex:0,rect:((P=T.clientRect)==null?void 0:P.call(T))??null,command:T.command})},onKeyDown:({event:T})=>{var Z;const P=C.current;if(!P.length)return!1;if(T.key==="Escape")return b.current(qc),!0;if(T.key==="ArrowDown"){const L=(S.current+1)%P.length;return S.current=L,b.current(Y=>({...Y,selectedIndex:L})),!0}if(T.key==="ArrowUp"){const L=(S.current-1+P.length)%P.length;return S.current=L,b.current(Y=>({...Y,selectedIndex:L})),!0}if(T.key==="Enter"){const L=P[S.current];return L&&((Z=_.current)==null||Z.call(_,L)),!0}return!1},onExit:()=>{b.current(qc),_.current=null}})}}),[]),H=f1({extensions:[m1,h1,p1.configure({placeholder:"Leave a comment… (type @ to mention)"}),U,M],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:T}){o(T.isEmpty)}}),re=!i||l.length>0,J=25*1024*1024,R=T=>{const P=T.filter(L=>L.size>J);P.length>0&&q.error(`Files must be under 25 MB: ${P.map(L=>L.name).join(", ")}`);const Z=T.filter(L=>L.size<=J);c(L=>{const Y=new Set(L.map(ae=>`${ae.name}-${ae.size}`));return[...L,...Z.filter(ae=>!Y.has(`${ae.name}-${ae.size}`))]})},A=T=>{c(P=>P.filter((Z,L)=>L!==T))},z=h.useCallback(T=>{var P;(P=_.current)==null||P.call(_,T),m(qc)},[]),K=async()=>{if(!(!re||d)){u(!0);try{const T=H!=null&&H.isEmpty?"":(H==null?void 0:H.getHTML())??"",P=[];T&&new DOMParser().parseFromString(T,"text/html").querySelectorAll("[data-type='mention']").forEach(se=>{const V=se.getAttribute("data-id");V&&!P.includes(V)&&P.push(V)});const Z=P.length>0?{mentioned_user_ids:P}:void 0,Y=(await y.mutateAsync({body:T||" ",metadata:Z})).comment.id;for(const ae of l)await j.mutateAsync({file:ae,commentId:Y});H==null||H.commands.clearContent(),o(!0),c([]),q.success("Comment added"),s==null||s()}catch{q.error("Failed to add comment")}finally{u(!1)}}};x.current=K;const X="h-3 w-3",G=h.useMemo(()=>{if(!f.rect||!g.current)return{bottom:"105%",left:0};const T=g.current.getBoundingClientRect(),P=Math.max(0,f.rect.left-T.left);return{top:f.rect.bottom-T.top+4,left:P}},[f.rect]);return a.jsxs("div",{className:$("flex gap-3 items-start",n),children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0 mt-1",children:a.jsx($t,{className:$("text-[11px] font-semibold",D.bg,D.text),children:F})}),a.jsxs("div",{className:"flex-1 min-w-0 relative",ref:g,children:[a.jsxs("div",{className:$("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[H&&a.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[a.jsx(Os,{title:"Bold (⌘B)",active:H.isActive("bold"),onClick:()=>H.chain().focus().toggleBold().run(),children:a.jsx(D1,{className:X})}),a.jsx(Os,{title:"Italic (⌘I)",active:H.isActive("italic"),onClick:()=>H.chain().focus().toggleItalic().run(),children:a.jsx(F1,{className:X})}),a.jsx(Os,{title:"Strikethrough",active:H.isActive("strike"),onClick:()=>H.chain().focus().toggleStrike().run(),children:a.jsx(H1,{className:X})}),a.jsx(Os,{title:"Inline code",active:H.isActive("code"),onClick:()=>H.chain().focus().toggleCode().run(),children:a.jsx(z1,{className:X})}),a.jsx(_y,{}),a.jsx(Os,{title:"Bullet list",active:H.isActive("bulletList"),onClick:()=>H.chain().focus().toggleBulletList().run(),children:a.jsx(sx,{className:X})}),a.jsx(Os,{title:"Ordered list",active:H.isActive("orderedList"),onClick:()=>H.chain().focus().toggleOrderedList().run(),children:a.jsx(W1,{className:X})}),a.jsx(_y,{}),a.jsx(Os,{title:"Code block",active:H.isActive("codeBlock"),onClick:()=>H.chain().focus().toggleCodeBlock().run(),children:a.jsx($1,{className:X})})]}),a.jsx(x1,{editor:H,className:$("px-3 py-2.5 text-sm",r?"min-h-[68px]":"min-h-[80px]")})]}),l.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:l.map((T,P)=>a.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:[a.jsx(Tx,{mimeType:T.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:T.name}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",df(T.size),")"]}),a.jsx("button",{type:"button",onClick:()=>A(P),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:a.jsx(tt,{className:"h-3 w-3"})})]},P))}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var T;return(T=p.current)==null?void 0:T.click()},disabled:d,title:"Attach files",children:a.jsx(ix,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),a.jsx(ne,{size:"icon",className:"h-8 w-8",onClick:K,disabled:!re||d,children:a.jsx(S5,{className:"h-3.5 w-3.5"})})]}),a.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:T=>{const P=Array.from(T.target.files??[]);P.length>0&&R(P),T.target.value=""}}),f.active&&f.items.length>0&&a.jsx("div",{className:"absolute z-[9999]",style:G,children:a.jsx($$,{items:f.items,selectedIndex:f.selectedIndex,onSelect:z})})]})]})}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:jk,setPrototypeOf:My,isFrozen:z$,getPrototypeOf:L$,getOwnPropertyDescriptor:F$}=Object;let{freeze:Pr,seal:fn,create:Ah}=Object,{apply:Dh,construct:Th}=typeof Reflect<"u"&&Reflect;Pr||(Pr=function(t){return t});fn||(fn=function(t){return t});Dh||(Dh=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(r,s)});Th||(Th=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new t(...n)});const Hc=Er(Array.prototype.forEach),B$=Er(Array.prototype.lastIndexOf),Oy=Er(Array.prototype.pop),Ko=Er(Array.prototype.push),W$=Er(Array.prototype.splice),vd=Er(String.prototype.toLowerCase),Rm=Er(String.prototype.toString),$m=Er(String.prototype.match),Yo=Er(String.prototype.replace),U$=Er(String.prototype.indexOf),q$=Er(String.prototype.trim),wn=Er(Object.prototype.hasOwnProperty),br=Er(RegExp.prototype.test),Go=H$(TypeError);function Er(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return Dh(e,t,n)}}function H$(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Th(e,r)}}function Be(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vd;My&&My(e,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=r(s);i!==s&&(z$(t)||(t[n]=i),s=i)}e[s]=!0}return e}function K$(e){for(let t=0;t<e.length;t++)wn(e,t)||(e[t]=null);return e}function Un(e){const t=Ah(null);for(const[r,n]of jk(e))wn(e,r)&&(Array.isArray(n)?t[r]=K$(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=Un(n):t[r]=n);return t}function Vo(e,t){for(;e!==null;){const n=F$(e,t);if(n){if(n.get)return Er(n.get);if(typeof n.value=="function")return Er(n.value)}e=L$(e)}function r(){return null}return r}const Py=Pr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zm=Pr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Lm=Pr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y$=Pr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Fm=Pr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G$=Pr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ey=Pr(["#text"]),Ay=Pr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bm=Pr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Dy=Pr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kc=Pr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V$=fn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),X$=fn(/<%[\w\W]*|[\w\W]*%>/gm),Q$=fn(/\$\{[\w\W]*/gm),Z$=fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),J$=fn(/^aria-[\-\w]+$/),Nk=fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),e6=fn(/^(?:\w+script|data):/i),t6=fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kk=fn(/^html$/i),r6=fn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ty=Object.freeze({__proto__:null,ARIA_ATTR:J$,ATTR_WHITESPACE:t6,CUSTOM_ELEMENT:r6,DATA_ATTR:Z$,DOCTYPE_NAME:kk,ERB_EXPR:X$,IS_ALLOWED_URI:Nk,IS_SCRIPT_OR_DATA:e6,MUSTACHE_EXPR:V$,TMPLIT_EXPR:Q$});const Xo={element:1,text:3,progressingInstruction:7,comment:8,document:9},n6=function(){return typeof window>"u"?null:window},a6=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Iy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Sk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n6();const t=Pe=>Sk(Pe);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Xo.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:p}=e,x=c.prototype,g=Vo(x,"cloneNode"),v=Vo(x,"remove"),y=Vo(x,"nextSibling"),j=Vo(x,"childNodes"),N=Vo(x,"parentNode");if(typeof o=="function"){const Pe=r.createElement("template");Pe.content&&Pe.content.ownerDocument&&(r=Pe.content.ownerDocument)}let w,k="";const{implementation:b,createNodeIterator:C,createDocumentFragment:_,getElementsByTagName:S}=r,{importNode:I}=n;let E=Iy();t.isSupported=typeof jk=="function"&&typeof N=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:F,TMPLIT_EXPR:D,DATA_ATTR:U,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:J}=Ty;let{IS_ALLOWED_URI:R}=Ty,A=null;const z=Be({},[...Py,...zm,...Lm,...Fm,...Ey]);let K=null;const X=Be({},[...Ay,...Bm,...Dy,...Kc]);let G=Object.seal(Ah(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),T=null,P=null;const Z=Object.seal(Ah(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let L=!0,Y=!0,ae=!1,ee=!0,se=!1,V=!0,ie=!1,he=!1,xe=!1,ve=!1,Q=!1,ge=!1,De=!0,Ue=!1;const Fe="user-content-";let Ve=!0,ut=!1,Ke={},Ze=null;const tr=Be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ir=null;const rr=Be({},["audio","video","img","source","image","track"]);let vr=null;const nr=Be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let ar=Kt,Rn=!1,ua=null;const Oe=Be({},[yt,Lt,Kt],Rm);let pe=Be({},["mi","mo","mn","ms","mtext"]),Ne=Be({},["annotation-xml"]);const me=Be({},["title","style","font","a","script"]);let ye=null;const Xe=["application/xhtml+xml","text/html"],de="text/html";let _e=null,Te=null;const bt=r.createElement("form"),rt=function(W){return W instanceof RegExp||W instanceof Function},nt=function(){let W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Te&&Te===W)){if((!W||typeof W!="object")&&(W={}),W=Un(W),ye=Xe.indexOf(W.PARSER_MEDIA_TYPE)===-1?de:W.PARSER_MEDIA_TYPE,_e=ye==="application/xhtml+xml"?Rm:vd,A=wn(W,"ALLOWED_TAGS")?Be({},W.ALLOWED_TAGS,_e):z,K=wn(W,"ALLOWED_ATTR")?Be({},W.ALLOWED_ATTR,_e):X,ua=wn(W,"ALLOWED_NAMESPACES")?Be({},W.ALLOWED_NAMESPACES,Rm):Oe,vr=wn(W,"ADD_URI_SAFE_ATTR")?Be(Un(nr),W.ADD_URI_SAFE_ATTR,_e):nr,Ir=wn(W,"ADD_DATA_URI_TAGS")?Be(Un(rr),W.ADD_DATA_URI_TAGS,_e):rr,Ze=wn(W,"FORBID_CONTENTS")?Be({},W.FORBID_CONTENTS,_e):tr,T=wn(W,"FORBID_TAGS")?Be({},W.FORBID_TAGS,_e):Un({}),P=wn(W,"FORBID_ATTR")?Be({},W.FORBID_ATTR,_e):Un({}),Ke=wn(W,"USE_PROFILES")?W.USE_PROFILES:!1,L=W.ALLOW_ARIA_ATTR!==!1,Y=W.ALLOW_DATA_ATTR!==!1,ae=W.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=W.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=W.SAFE_FOR_TEMPLATES||!1,V=W.SAFE_FOR_XML!==!1,ie=W.WHOLE_DOCUMENT||!1,ve=W.RETURN_DOM||!1,Q=W.RETURN_DOM_FRAGMENT||!1,ge=W.RETURN_TRUSTED_TYPE||!1,xe=W.FORCE_BODY||!1,De=W.SANITIZE_DOM!==!1,Ue=W.SANITIZE_NAMED_PROPS||!1,Ve=W.KEEP_CONTENT!==!1,ut=W.IN_PLACE||!1,R=W.ALLOWED_URI_REGEXP||Nk,ar=W.NAMESPACE||Kt,pe=W.MATHML_TEXT_INTEGRATION_POINTS||pe,Ne=W.HTML_INTEGRATION_POINTS||Ne,G=W.CUSTOM_ELEMENT_HANDLING||{},W.CUSTOM_ELEMENT_HANDLING&&rt(W.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=W.CUSTOM_ELEMENT_HANDLING.tagNameCheck),W.CUSTOM_ELEMENT_HANDLING&&rt(W.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=W.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),W.CUSTOM_ELEMENT_HANDLING&&typeof W.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=W.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Y=!1),Q&&(ve=!0),Ke&&(A=Be({},Ey),K=[],Ke.html===!0&&(Be(A,Py),Be(K,Ay)),Ke.svg===!0&&(Be(A,zm),Be(K,Bm),Be(K,Kc)),Ke.svgFilters===!0&&(Be(A,Lm),Be(K,Bm),Be(K,Kc)),Ke.mathMl===!0&&(Be(A,Fm),Be(K,Dy),Be(K,Kc))),W.ADD_TAGS&&(typeof W.ADD_TAGS=="function"?Z.tagCheck=W.ADD_TAGS:(A===z&&(A=Un(A)),Be(A,W.ADD_TAGS,_e))),W.ADD_ATTR&&(typeof W.ADD_ATTR=="function"?Z.attributeCheck=W.ADD_ATTR:(K===X&&(K=Un(K)),Be(K,W.ADD_ATTR,_e))),W.ADD_URI_SAFE_ATTR&&Be(vr,W.ADD_URI_SAFE_ATTR,_e),W.FORBID_CONTENTS&&(Ze===tr&&(Ze=Un(Ze)),Be(Ze,W.FORBID_CONTENTS,_e)),W.ADD_FORBID_CONTENTS&&(Ze===tr&&(Ze=Un(Ze)),Be(Ze,W.ADD_FORBID_CONTENTS,_e)),Ve&&(A["#text"]=!0),ie&&Be(A,["html","head","body"]),A.table&&(Be(A,["tbody"]),delete T.tbody),W.TRUSTED_TYPES_POLICY){if(typeof W.TRUSTED_TYPES_POLICY.createHTML!="function")throw Go('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof W.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Go('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=W.TRUSTED_TYPES_POLICY,k=w.createHTML("")}else w===void 0&&(w=a6(p,s)),w!==null&&typeof k=="string"&&(k=w.createHTML(""));Pr&&Pr(W),Te=W}},yr=Be({},[...zm,...Lm,...Y$]),sr=Be({},[...Fm,...G$]),$n=function(W){let fe=N(W);(!fe||!fe.tagName)&&(fe={namespaceURI:ar,tagName:"template"});const ke=vd(W.tagName),xt=vd(fe.tagName);return ua[W.namespaceURI]?W.namespaceURI===Lt?fe.namespaceURI===Kt?ke==="svg":fe.namespaceURI===yt?ke==="svg"&&(xt==="annotation-xml"||pe[xt]):!!yr[ke]:W.namespaceURI===yt?fe.namespaceURI===Kt?ke==="math":fe.namespaceURI===Lt?ke==="math"&&Ne[xt]:!!sr[ke]:W.namespaceURI===Kt?fe.namespaceURI===Lt&&!Ne[xt]||fe.namespaceURI===yt&&!pe[xt]?!1:!sr[ke]&&(me[ke]||!yr[ke]):!!(ye==="application/xhtml+xml"&&ua[W.namespaceURI]):!1},zn=function(W){Ko(t.removed,{element:W});try{N(W).removeChild(W)}catch{v(W)}},Cs=function(W,fe){try{Ko(t.removed,{attribute:fe.getAttributeNode(W),from:fe})}catch{Ko(t.removed,{attribute:null,from:fe})}if(fe.removeAttribute(W),W==="is")if(ve||Q)try{zn(fe)}catch{}else try{fe.setAttribute(W,"")}catch{}},Ev=function(W){let fe=null,ke=null;if(xe)W="<remove></remove>"+W;else{const At=$m(W,/^[\r\n\t ]+/);ke=At&&At[0]}ye==="application/xhtml+xml"&&ar===Kt&&(W='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+W+"</body></html>");const xt=w?w.createHTML(W):W;if(ar===Kt)try{fe=new m().parseFromString(xt,ye)}catch{}if(!fe||!fe.documentElement){fe=b.createDocument(ar,"template",null);try{fe.documentElement.innerHTML=Rn?k:xt}catch{}}const mr=fe.body||fe.documentElement;return W&&ke&&mr.insertBefore(r.createTextNode(ke),mr.childNodes[0]||null),ar===Kt?S.call(fe,ie?"html":"body")[0]:ie?fe.documentElement:mr},Av=function(W){return C.call(W.ownerDocument||W,W,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},mm=function(W){return W instanceof f&&(typeof W.nodeName!="string"||typeof W.textContent!="string"||typeof W.removeChild!="function"||!(W.attributes instanceof u)||typeof W.removeAttribute!="function"||typeof W.setAttribute!="function"||typeof W.namespaceURI!="string"||typeof W.insertBefore!="function"||typeof W.hasChildNodes!="function")},Dv=function(W){return typeof l=="function"&&W instanceof l};function fa(Pe,W,fe){Hc(Pe,ke=>{ke.call(t,W,fe,Te)})}const Tv=function(W){let fe=null;if(fa(E.beforeSanitizeElements,W,null),mm(W))return zn(W),!0;const ke=_e(W.nodeName);if(fa(E.uponSanitizeElement,W,{tagName:ke,allowedTags:A}),V&&W.hasChildNodes()&&!Dv(W.firstElementChild)&&br(/<[/\w!]/g,W.innerHTML)&&br(/<[/\w!]/g,W.textContent)||W.nodeType===Xo.progressingInstruction||V&&W.nodeType===Xo.comment&&br(/<[/\w]/g,W.data))return zn(W),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(ke))&&(!A[ke]||T[ke])){if(!T[ke]&&Rv(ke)&&(G.tagNameCheck instanceof RegExp&&br(G.tagNameCheck,ke)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ke)))return!1;if(Ve&&!Ze[ke]){const xt=N(W)||W.parentNode,mr=j(W)||W.childNodes;if(mr&&xt){const At=mr.length;for(let Rr=At-1;Rr>=0;--Rr){const ma=g(mr[Rr],!0);ma.__removalCount=(W.__removalCount||0)+1,xt.insertBefore(ma,y(W))}}}return zn(W),!0}return W instanceof c&&!$n(W)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&br(/<\/no(script|embed|frames)/i,W.innerHTML)?(zn(W),!0):(se&&W.nodeType===Xo.text&&(fe=W.textContent,Hc([O,F,D],xt=>{fe=Yo(fe,xt," ")}),W.textContent!==fe&&(Ko(t.removed,{element:W.cloneNode()}),W.textContent=fe)),fa(E.afterSanitizeElements,W,null),!1)},Iv=function(W,fe,ke){if(De&&(fe==="id"||fe==="name")&&(ke in r||ke in bt))return!1;if(!(Y&&!P[fe]&&br(U,fe))){if(!(L&&br(M,fe))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(fe,W))){if(!K[fe]||P[fe]){if(!(Rv(W)&&(G.tagNameCheck instanceof RegExp&&br(G.tagNameCheck,W)||G.tagNameCheck instanceof Function&&G.tagNameCheck(W))&&(G.attributeNameCheck instanceof RegExp&&br(G.attributeNameCheck,fe)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(fe,W))||fe==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&br(G.tagNameCheck,ke)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ke))))return!1}else if(!vr[fe]){if(!br(R,Yo(ke,re,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&W!=="script"&&U$(ke,"data:")===0&&Ir[W])){if(!(ae&&!br(H,Yo(ke,re,"")))){if(ke)return!1}}}}}}}return!0},Rv=function(W){return W!=="annotation-xml"&&$m(W,J)},$v=function(W){fa(E.beforeSanitizeAttributes,W,null);const{attributes:fe}=W;if(!fe||mm(W))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let xt=fe.length;for(;xt--;){const mr=fe[xt],{name:At,namespaceURI:Rr,value:ma}=mr,Oi=_e(At),hm=ma;let ir=At==="value"?hm:q$(hm);if(ke.attrName=Oi,ke.attrValue=ir,ke.keepAttr=!0,ke.forceKeepAttr=void 0,fa(E.uponSanitizeAttribute,W,ke),ir=ke.attrValue,Ue&&(Oi==="id"||Oi==="name")&&(Cs(At,W),ir=Fe+ir),V&&br(/((--!?|])>)|<\/(style|title|textarea)/i,ir)){Cs(At,W);continue}if(Oi==="attributename"&&$m(ir,"href")){Cs(At,W);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){Cs(At,W);continue}if(!ee&&br(/\/>/i,ir)){Cs(At,W);continue}se&&Hc([O,F,D],Lv=>{ir=Yo(ir,Lv," ")});const zv=_e(W.nodeName);if(!Iv(zv,Oi,ir)){Cs(At,W);continue}if(w&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Rr)switch(p.getAttributeType(zv,Oi)){case"TrustedHTML":{ir=w.createHTML(ir);break}case"TrustedScriptURL":{ir=w.createScriptURL(ir);break}}if(ir!==hm)try{Rr?W.setAttributeNS(Rr,At,ir):W.setAttribute(At,ir),mm(W)?zn(W):Oy(t.removed)}catch{Cs(At,W)}}fa(E.afterSanitizeAttributes,W,null)},hP=function Pe(W){let fe=null;const ke=Av(W);for(fa(E.beforeSanitizeShadowDOM,W,null);fe=ke.nextNode();)fa(E.uponSanitizeShadowNode,fe,null),Tv(fe),$v(fe),fe.content instanceof i&&Pe(fe.content);fa(E.afterSanitizeShadowDOM,W,null)};return t.sanitize=function(Pe){let W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,ke=null,xt=null,mr=null;if(Rn=!Pe,Rn&&(Pe="<!-->"),typeof Pe!="string"&&!Dv(Pe))if(typeof Pe.toString=="function"){if(Pe=Pe.toString(),typeof Pe!="string")throw Go("dirty is not a string, aborting")}else throw Go("toString is not a function");if(!t.isSupported)return Pe;if(he||nt(W),t.removed=[],typeof Pe=="string"&&(ut=!1),ut){if(Pe.nodeName){const ma=_e(Pe.nodeName);if(!A[ma]||T[ma])throw Go("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof l)fe=Ev("<!---->"),ke=fe.ownerDocument.importNode(Pe,!0),ke.nodeType===Xo.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?fe=ke:fe.appendChild(ke);else{if(!ve&&!se&&!ie&&Pe.indexOf("<")===-1)return w&&ge?w.createHTML(Pe):Pe;if(fe=Ev(Pe),!fe)return ve?null:ge?k:""}fe&&xe&&zn(fe.firstChild);const At=Av(ut?Pe:fe);for(;xt=At.nextNode();)Tv(xt),$v(xt),xt.content instanceof i&&hP(xt.content);if(ut)return Pe;if(ve){if(Q)for(mr=_.call(fe.ownerDocument);fe.firstChild;)mr.appendChild(fe.firstChild);else mr=fe;return(K.shadowroot||K.shadowrootmode)&&(mr=I.call(n,mr,!0)),mr}let Rr=ie?fe.outerHTML:fe.innerHTML;return ie&&A["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&br(kk,fe.ownerDocument.doctype.name)&&(Rr="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
556
+ `);try{R=new Worker(URL.createObjectURL(new Blob([X])))}catch(G){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",G),null}K(R)}return R}}(),p={particleCount:50,angle:90,spread:45,startVelocity:45,decay:.9,gravity:1,drift:0,ticks:200,x:.5,y:.5,shapes:["square","circle"],zIndex:100,colors:["#26ccff","#a25afd","#ff5e7e","#88ff5a","#fcff42","#ffa62d","#ff36ff"],disableForReducedMotion:!1,scalar:1};function x(R,A){return A?A(R):R}function g(R){return R!=null}function v(R,A,z){return x(R&&g(R[A])?R[A]:p[A],z)}function y(R){return R<0?0:Math.floor(R)}function j(R,A){return Math.floor(Math.random()*(A-R))+R}function N(R){return parseInt(R,16)}function w(R){return R.map(k)}function k(R){var A=String(R).replace(/[^0-9a-f]/gi,"");return A.length<6&&(A=A[0]+A[0]+A[1]+A[1]+A[2]+A[2]),{r:N(A.substring(0,2)),g:N(A.substring(2,4)),b:N(A.substring(4,6))}}function b(R){var A=v(R,"origin",Object);return A.x=v(A,"x",Number),A.y=v(A,"y",Number),A}function C(R){R.width=document.documentElement.clientWidth,R.height=document.documentElement.clientHeight}function _(R){var A=R.getBoundingClientRect();R.width=A.width,R.height=A.height}function S(R){var A=document.createElement("canvas");return A.style.position="fixed",A.style.top="0px",A.style.left="0px",A.style.pointerEvents="none",A.style.zIndex=R,A}function I(R,A,z,K,X,G,T,P,Z){R.save(),R.translate(A,z),R.rotate(G),R.scale(K,X),R.arc(0,0,1,T,P,Z),R.restore()}function E(R){var A=R.angle*(Math.PI/180),z=R.spread*(Math.PI/180);return{x:R.x,y:R.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:R.startVelocity*.5+Math.random()*R.startVelocity,angle2D:-A+(.5*z-Math.random()*z),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:R.color,shape:R.shape,tick:0,totalTicks:R.ticks,decay:R.decay,drift:R.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:R.gravity*3,ovalScalar:.6,scalar:R.scalar,flat:R.flat}}function O(R,A){A.x+=Math.cos(A.angle2D)*A.velocity+A.drift,A.y+=Math.sin(A.angle2D)*A.velocity+A.gravity,A.velocity*=A.decay,A.flat?(A.wobble=0,A.wobbleX=A.x+10*A.scalar,A.wobbleY=A.y+10*A.scalar,A.tiltSin=0,A.tiltCos=0,A.random=1):(A.wobble+=A.wobbleSpeed,A.wobbleX=A.x+10*A.scalar*Math.cos(A.wobble),A.wobbleY=A.y+10*A.scalar*Math.sin(A.wobble),A.tiltAngle+=.1,A.tiltSin=Math.sin(A.tiltAngle),A.tiltCos=Math.cos(A.tiltAngle),A.random=Math.random()+2);var z=A.tick++/A.totalTicks,K=A.x+A.random*A.tiltCos,X=A.y+A.random*A.tiltSin,G=A.wobbleX+A.random*A.tiltCos,T=A.wobbleY+A.random*A.tiltSin;if(R.fillStyle="rgba("+A.color.r+", "+A.color.g+", "+A.color.b+", "+(1-z)+")",R.beginPath(),o&&A.shape.type==="path"&&typeof A.shape.path=="string"&&Array.isArray(A.shape.matrix))R.fill(H(A.shape.path,A.shape.matrix,A.x,A.y,Math.abs(G-K)*.1,Math.abs(T-X)*.1,Math.PI/10*A.wobble));else if(A.shape.type==="bitmap"){var P=Math.PI/10*A.wobble,Z=Math.abs(G-K)*.1,L=Math.abs(T-X)*.1,Y=A.shape.bitmap.width*A.scalar,ae=A.shape.bitmap.height*A.scalar,ee=new DOMMatrix([Math.cos(P)*Z,Math.sin(P)*Z,-Math.sin(P)*L,Math.cos(P)*L,A.x,A.y]);ee.multiplySelf(new DOMMatrix(A.shape.matrix));var se=R.createPattern(u.transform(A.shape.bitmap),"no-repeat");se.setTransform(ee),R.globalAlpha=1-z,R.fillStyle=se,R.fillRect(A.x-Y/2,A.y-ae/2,Y,ae),R.globalAlpha=1}else if(A.shape==="circle")R.ellipse?R.ellipse(A.x,A.y,Math.abs(G-K)*A.ovalScalar,Math.abs(T-X)*A.ovalScalar,Math.PI/10*A.wobble,0,2*Math.PI):I(R,A.x,A.y,Math.abs(G-K)*A.ovalScalar,Math.abs(T-X)*A.ovalScalar,Math.PI/10*A.wobble,0,2*Math.PI);else if(A.shape==="star")for(var V=Math.PI/2*3,ie=4*A.scalar,he=8*A.scalar,xe=A.x,ve=A.y,Q=5,ge=Math.PI/Q;Q--;)xe=A.x+Math.cos(V)*he,ve=A.y+Math.sin(V)*he,R.lineTo(xe,ve),V+=ge,xe=A.x+Math.cos(V)*ie,ve=A.y+Math.sin(V)*ie,R.lineTo(xe,ve),V+=ge;else R.moveTo(Math.floor(A.x),Math.floor(A.y)),R.lineTo(Math.floor(A.wobbleX),Math.floor(X)),R.lineTo(Math.floor(G),Math.floor(T)),R.lineTo(Math.floor(K),Math.floor(A.wobbleY));return R.closePath(),R.fill(),A.tick<A.totalTicks}function F(R,A,z,K,X){var G=A.slice(),T=R.getContext("2d"),P,Z,L=d(function(Y){function ae(){P=Z=null,T.clearRect(0,0,K.width,K.height),u.clear(),X(),Y()}function ee(){n&&!(K.width===s.width&&K.height===s.height)&&(K.width=R.width=s.width,K.height=R.height=s.height),!K.width&&!K.height&&(z(R),K.width=R.width,K.height=R.height),T.clearRect(0,0,K.width,K.height),G=G.filter(function(se){return O(T,se)}),G.length?P=f.frame(ee):ae()}P=f.frame(ee),Z=ae});return{addFettis:function(Y){return G=G.concat(Y),L},canvas:R,promise:L,reset:function(){P&&f.cancel(P),Z&&Z()}}}function D(R,A){var z=!R,K=!!v(A||{},"resize"),X=!1,G=v(A,"disableForReducedMotion",Boolean),T=i&&!!v(A||{},"useWorker"),P=T?m():null,Z=z?C:_,L=R&&P?!!R.__confetti_initialized:!1,Y=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,ae;function ee(V,ie,he){for(var xe=v(V,"particleCount",y),ve=v(V,"angle",Number),Q=v(V,"spread",Number),ge=v(V,"startVelocity",Number),De=v(V,"decay",Number),Ue=v(V,"gravity",Number),Fe=v(V,"drift",Number),Ve=v(V,"colors",w),ut=v(V,"ticks",Number),Ke=v(V,"shapes"),Ze=v(V,"scalar"),tr=!!v(V,"flat"),Ir=b(V),rr=xe,vr=[],nr=R.width*Ir.x,yt=R.height*Ir.y;rr--;)vr.push(E({x:nr,y:yt,angle:ve,spread:Q,startVelocity:ge,color:Ve[rr%Ve.length],shape:Ke[j(0,Ke.length)],ticks:ut,decay:De,gravity:Ue,drift:Fe,scalar:Ze,flat:tr}));return ae?ae.addFettis(vr):(ae=F(R,vr,Z,ie,he),ae.promise)}function se(V){var ie=G||v(V,"disableForReducedMotion",Boolean),he=v(V,"zIndex",Number);if(ie&&Y)return d(function(ge){ge()});z&&ae?R=ae.canvas:z&&!R&&(R=S(he),document.body.appendChild(R)),K&&!L&&Z(R);var xe={width:R.width,height:R.height};P&&!L&&P.init(R),L=!0,P&&(R.__confetti_initialized=!0);function ve(){if(P){var ge={getBoundingClientRect:function(){if(!z)return R.getBoundingClientRect()}};Z(ge),P.postMessage({resize:{width:ge.width,height:ge.height}});return}xe.width=xe.height=null}function Q(){ae=null,K&&(X=!1,t.removeEventListener("resize",ve)),z&&R&&(document.body.contains(R)&&document.body.removeChild(R),R=null,L=!1)}return K&&!X&&(X=!0,t.addEventListener("resize",ve,!1)),P?P.fire(V,xe,Q):ee(V,xe,Q)}return se.reset=function(){P&&P.reset(),ae&&ae.reset()},se}var U;function M(){return U||(U=D(null,{useWorker:!0,resize:!0})),U}function H(R,A,z,K,X,G,T){var P=new Path2D(R),Z=new Path2D;Z.addPath(P,new DOMMatrix(A));var L=new Path2D;return L.addPath(Z,new DOMMatrix([Math.cos(T)*X,Math.sin(T)*X,-Math.sin(T)*G,Math.cos(T)*G,z,K])),L}function re(R){if(!o)throw new Error("path confetti are not supported in this browser");var A,z;typeof R=="string"?A=R:(A=R.path,z=R.matrix);var K=new Path2D(A),X=document.createElement("canvas"),G=X.getContext("2d");if(!z){for(var T=1e3,P=T,Z=T,L=0,Y=0,ae,ee,se=0;se<T;se+=2)for(var V=0;V<T;V+=2)G.isPointInPath(K,se,V,"nonzero")&&(P=Math.min(P,se),Z=Math.min(Z,V),L=Math.max(L,se),Y=Math.max(Y,V));ae=L-P,ee=Y-Z;var ie=10,he=Math.min(ie/ae,ie/ee);z=[he,0,0,he,-Math.round(ae/2+P)*he,-Math.round(ee/2+Z)*he]}return{type:"path",path:A,matrix:z}}function J(R){var A,z=1,K="#000000",X='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof R=="string"?A=R:(A=R.text,z="scalar"in R?R.scalar:z,X="fontFamily"in R?R.fontFamily:X,K="color"in R?R.color:K);var G=10*z,T=""+G+"px "+X,P=new OffscreenCanvas(G,G),Z=P.getContext("2d");Z.font=T;var L=Z.measureText(A),Y=Math.ceil(L.actualBoundingBoxRight+L.actualBoundingBoxLeft),ae=Math.ceil(L.actualBoundingBoxAscent+L.actualBoundingBoxDescent),ee=2,se=L.actualBoundingBoxLeft+ee,V=L.actualBoundingBoxAscent+ee;Y+=ee+ee,ae+=ee+ee,P=new OffscreenCanvas(Y,ae),Z=P.getContext("2d"),Z.font=T,Z.fillStyle=K,Z.fillText(A,se,V);var ie=1/z;return{type:"bitmap",bitmap:P.transferToImageBitmap(),matrix:[ie,0,0,ie,-Y*ie/2,-ae*ie/2]}}r.exports=function(){return M().apply(this,arguments)},r.exports.reset=function(){M().reset()},r.exports.create=D,r.exports.shapeFromPath=re,r.exports.shapeFromText=J})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),kx,!1);const i4=kx.exports;kx.exports.create;function Om(e,t){var n;const r={};for(const s of t)r[s.key]=[];for(const s of e)if(r[s.status]!==void 0)r[s.status].push(s);else{const i=((n=t[0])==null?void 0:n.key)??"backlog";r[i]=[...r[i]??[],s]}return r}function o4(e,t,r){var i;const n=new Map(t.map(o=>[o.id,o])),s={};for(const o of r)s[o.key]=[];for(const o of r)for(const l of e[o.key]??[]){const c=n.get(l.id);c&&c.status===o.key&&(s[o.key].push(c),n.delete(l.id))}for(const o of n.values()){const l=s[o.status];if(l)l.push(o);else{const c=(i=r[0])==null?void 0:i.key;c&&s[c].push(o)}}return s}function qN({issues:e,projectId:t,statuses:r,onIssueClick:n,onColumnsReorder:s,readOnly:i=!1,filters:o}){var G;const[l,c]=h.useState(()=>r.map(T=>T.id)),[d,u]=h.useState(()=>Om(e,r)),[f,m]=h.useState(null),[p,x]=h.useState(null),[g,v]=h.useState(null),[y,j]=h.useState(null),[N,w]=h.useState(""),k=h.useRef(null),b=h.useRef(!1),C=Se(),_=Tt.byProject(t,o),S=qI(t),I=UI(t,y??""),E=h.useMemo(()=>{const T=new Map;for(const P of e)P.parent_id&&T.set(P.parent_id,(T.get(P.parent_id)??0)+1);return T},[e]);h.useEffect(()=>{c(T=>{const P=new Set(r.map(Y=>Y.id)),Z=T.filter(Y=>P.has(Y)),L=r.map(Y=>Y.id).filter(Y=>!T.includes(Y));return Z.length===T.length&&L.length===0?T:[...Z,...L]})},[r]),h.useEffect(()=>{b.current||u(T=>o4(T,e,r))},[e,r]);const O=[...r].sort((T,P)=>{const Z=l.indexOf(T.id),L=l.indexOf(P.id);return Z===-1&&L===-1?T.position-P.position:Z===-1?1:L===-1?-1:Z-L}),F=o1(qp(l1,i?{activationConstraint:{distance:1/0}}:{activationConstraint:{distance:5}})),D=h.useCallback(T=>{if(p){const Z=T.droppableContainers.filter(L=>l.includes(L.id));return mE({...T,droppableContainers:Z})}const P=hE(T);return P.length>0?P:pE(T)},[p,l]),U=h.useCallback(T=>{for(const[P,Z]of Object.entries(d))if(Z.some(L=>L.id===T))return P;return null},[d]),M=h.useCallback(T=>r.some(P=>P.id===T),[r]),H=T=>{const P=T.active.id;if(b.current=!0,M(P)){x(P);return}for(const[Z,L]of Object.entries(d)){const Y=L.find(ae=>ae.id===P);if(Y){m(Y),k.current=Z;return}}},re=T=>{const{active:P,over:Z}=T;if(!Z||p)return;const L=P.id,Y=Z.id;if(M(L))return;const ae=U(L),ee=r.find(V=>V.key===Y||V.id===Y),se=(ee==null?void 0:ee.key)??U(Y);!ae||!se||ae===se||u(V=>{const ie=[...V[ae]??[]],he=[...V[se]??[]],xe=ie.findIndex(ge=>ge.id===L);if(xe===-1)return V;const[ve]=ie.splice(xe,1),Q={...ve,status:se};if(ee)he.push(Q);else{const ge=he.findIndex(De=>De.id===Y);if(ge===-1)he.push(Q);else{const De=P.rect.current.translated!=null&&P.rect.current.translated.top>Z.rect.top+Z.rect.height/2;he.splice(De?ge+1:ge,0,Q)}}return{...V,[ae]:ie,[se]:he}})},J=T=>{var V;const{active:P,over:Z}=T;if(m(null),p){if(x(null),b.current=!1,!Z||P.id===Z.id)return;const ie=l.indexOf(P.id),he=l.indexOf(Z.id);if(ie===-1||he===-1||ie===he)return;const xe=pd(l,ie,he);c(xe),s==null||s(xe);return}if(!Z){b.current=!1;const ie=k.current;k.current=null,ie&&u(Om(e,r));return}const L=P.id,Y=Z.id,ae=k.current;k.current=null;const ee=r.find(ie=>ie.key===Y||ie.id===Y),se=(ee==null?void 0:ee.key)??U(Y);if(!ae||!se){b.current=!1;return}if(ae===se)b.current=!1,u(ie=>{const he=ie[ae]??[],xe=he.findIndex(Q=>Q.id===L),ve=he.findIndex(Q=>Q.id===Y);return xe===-1||ve===-1||xe===ve?ie:{...ie,[ae]:pd(he,xe,ve)}});else{if(!r.find(xe=>xe.key===Y||xe.id===Y))u(xe=>{const ve=[...xe[se]??[]],Q=ve.findIndex(Ve=>Ve.id===L);if(Q===-1)return xe;const ge=T.active.rect.current.translated!=null&&T.active.rect.current.translated.top>T.over.rect.top+T.over.rect.height/2,[De]=ve.splice(Q,1),Ue=ve.findIndex(Ve=>Ve.id===Y);if(Ue===-1)return ve.splice(Q,0,De),xe;const Fe=ge?Ue+1:Ue;return ve.splice(Fe,0,De),{...xe,[se]:ve}});else{const xe=((V=T.active.rect.current.translated)==null?void 0:V.top)??1/0,ve=T.over.rect.top+T.over.rect.height/2;xe<ve&&u(Q=>{const ge=Q[se]??[],De=ge.findIndex(Ue=>Ue.id===L);return De<=0?Q:{...Q,[se]:pd(ge,De,0)}})}const he=C.getQueryData(_);C.cancelQueries({queryKey:_}),C.setQueryData(_,xe=>xe&&{...xe,issues:xe.issues.map(ve=>ve.id===L?{...ve,status:se}:ve)}),oe.put(`/admin/issues/${L}`,{status:se}).then(()=>{b.current=!1,C.invalidateQueries({queryKey:_});const xe=r.find(ve=>ve.key===se);(xe==null?void 0:xe.category)==="completed"&&i4({particleCount:80,spread:60,origin:{y:.6}})}).catch(()=>{b.current=!1,he&&C.setQueryData(_,he),u(Om((he==null?void 0:he.issues)??e,r)),q.error("Failed to update issue status")})}},R=T=>{v(T)},A=async T=>{if(!g)return;const P=d[g.key]??[];if(P.length>0){const Z=r.find(L=>L.id===T);if(!Z)return;try{await Promise.all(P.map(L=>oe.put(`/admin/issues/${L.id}`,{status:Z.key}))),C.invalidateQueries({queryKey:Tt.byProject(t)})}catch{q.error("Failed to move issues");return}}S.mutate(g.id,{onSuccess:()=>{q.success(`Status "${g.name}" deleted`),v(null)},onError:()=>q.error("Failed to delete status")})},z=()=>{const T=N.trim();!T||!y||I.mutate({name:T},{onSuccess:()=>{q.success("Status renamed"),j(null)},onError:()=>q.error("Failed to rename status")})},K=()=>{j(null)},X=p?r.find(T=>T.id===p):null;return a.jsxs(pl,{sensors:F,collisionDetection:D,onDragStart:H,onDragOver:re,onDragEnd:J,children:[a.jsxs("div",{className:"flex gap-4 min-h-full overflow-x-auto px-6 py-4 pb-6",children:[a.jsx(Hp,{items:l,strategy:c1,children:O.map(T=>a.jsx(t4,{id:T.id,label:T.name,color:T.color,category:T.category,issues:d[T.key]??[],childCounts:E,sortable:!0,onIssueClick:n,onRename:i?void 0:()=>{j(T.id),w(T.name)},onDelete:i?void 0:()=>R(T),isRenaming:y===T.id,renameValue:y===T.id?N:"",onRenameChange:w,onRenameSubmit:z,onRenameCancel:K},T.id))}),!i&&a.jsx(a4,{projectId:t})]}),a.jsxs(xE,{children:[f&&a.jsx(UN,{issue:f}),X&&a.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:a.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:[a.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:X.color}}),X.name]})})]}),g&&a.jsx(s4,{open:!!g,statusName:g.name,issueCount:((G=d[g.key])==null?void 0:G.length)??0,otherStatuses:r.filter(T=>T.id!==g.id),onConfirm:A,onCancel:()=>v(null),isLoading:S.isPending})]})}const Ot=LP,Pt=FP,_t=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},s)=>a.jsx(zP,{children:a.jsx(t1,{ref:s,align:t,sideOffset:r,className:$("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),...n})}));_t.displayName=t1.displayName;const l4=[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"},{value:"none",label:"None"}],c4=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"task",label:"Task"},{value:"epic",label:"Epic"},{value:"story",label:"Story"}];function Uc({label:e,activeCount:t,children:r}){const[n,s]=h.useState(!1);return a.jsxs(Ot,{open:n,onOpenChange:s,children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:$("inline-flex items-center gap-1.5 h-7 px-2.5 rounded-md border text-xs font-medium transition-colors",t>0?"border-foreground/30 bg-foreground/5 text-foreground":"border-border text-muted-foreground hover:text-foreground hover:bg-muted"),children:[e,t>0&&a.jsx("span",{className:"flex items-center justify-center h-4 w-4 rounded-full bg-foreground text-background text-[10px] font-semibold",children:t}),a.jsx(sa,{className:"h-3 w-3 opacity-60"})]})}),a.jsx(_t,{className:"w-48 p-1",align:"start",children:r})]})}function Pm({options:e,selected:t,onToggle:r}){return a.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(n=>{const s=t.includes(n.value);return a.jsxs("button",{onClick:()=>r(n.value),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:$("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",s?"bg-foreground border-foreground":"border-border"),children:s&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),n.color&&a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:n.color}}),a.jsx("span",{className:"truncate",children:n.label})]},n.value)})})}function d4({statuses:e,members:t,filters:r,onChange:n}){var c,d,u,f,m,p,x;const s=(((c=r.priority)==null?void 0:c.length)??0)>0||!!r.assignee_id||(((d=r.type)==null?void 0:d.length)??0)>0||(((u=r.status)==null?void 0:u.length)??0)>0,i=(g,v)=>{const y=r[g]??[],j=y.includes(v)?y.filter(N=>N!==v):[...y,v];n({...r,[g]:j.length?j:void 0})},o=g=>{n({...r,assignee_id:r.assignee_id===g?void 0:g})},l=r.assignee_id?((f=t.find(g=>g.userId===r.assignee_id))==null?void 0:f.name)??"Assignee":"Assignee";return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Uc,{label:r.assignee_id?l:"Assignee",activeCount:r.assignee_id?1:0,children:a.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground px-2 py-1.5",children:"No members"}),t.map(g=>{const v=r.assignee_id===g.userId;return a.jsxs("button",{onClick:()=>o(g.userId),className:"flex items-center gap-2 px-2 py-1.5 rounded text-xs hover:bg-muted w-full text-left",children:[a.jsx("div",{className:$("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",v?"bg-foreground border-foreground":"border-border"),children:v&&a.jsx(dr,{className:"h-2.5 w-2.5 text-background"})}),a.jsx("span",{className:"h-5 w-5 rounded-full bg-muted flex items-center justify-center text-[10px] font-medium shrink-0",children:g.initials}),a.jsx("span",{className:"truncate",children:g.name})]},g.userId)})]})}),a.jsx(Uc,{label:"Priority",activeCount:((m=r.priority)==null?void 0:m.length)??0,children:a.jsx(Pm,{options:l4,selected:r.priority??[],onToggle:g=>i("priority",g)})}),a.jsx(Uc,{label:"Type",activeCount:((p=r.type)==null?void 0:p.length)??0,children:a.jsx(Pm,{options:c4,selected:r.type??[],onToggle:g=>i("type",g)})}),a.jsx(Uc,{label:"Status",activeCount:((x=r.status)==null?void 0:x.length)??0,children:a.jsx(Pm,{options:e.map(g=>({value:g.key,label:g.name,color:g.color})),selected:r.status??[],onToggle:g=>i("status",g)})}),s&&a.jsxs("button",{onClick:()=>n({}),className:"inline-flex items-center gap-1 h-7 px-2 rounded text-xs text-muted-foreground hover:text-foreground hover:bg-muted transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear"]})]})}const u4={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function Sx(){return We({queryKey:["org","calendar"],queryFn:()=>oe.get("/admin/org/calendar"),select:e=>({working_days:e.working_days??u4,timezone:e.timezone})})}function f4(){const e=Se();return be({mutationFn:t=>oe.put("/admin/org/calendar",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","calendar"]})}})}function Cx(e){const t=e??new Date().getFullYear();return We({queryKey:["org","holidays",t],queryFn:()=>oe.get(`/admin/org/holidays?year=${t}`),select:r=>r.holidays})}function m4(){const e=Se();return be({mutationFn:t=>oe.post("/admin/org/holidays",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function h4(){const e=Se();return be({mutationFn:({id:t,...r})=>oe.put(`/admin/org/holidays/${t}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function p4(){const e=Se();return be({mutationFn:t=>oe.delete(`/admin/org/holidays/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function x4(){return We({queryKey:["app-config"],queryFn:()=>oe.get("/admin/config"),staleTime:1/0})}const g4=["sun","mon","tue","wed","thu","fri","sat"];function v4(e,t,r){const n=g4[EI(e)];if(!t[n])return!1;const s=gd(e),i=xl(e);for(const o of r){const l=new Date(o.date);if(o.recurring){if(gd(l)===s&&xl(l)===i)return!1}else if(l.getFullYear()===e.getFullYear()&&gd(l)===s&&xl(l)===i)return!1}return!0}function Oh(e,t,r,n){let s=0,i=new Date(e);i.setHours(0,0,0,0);const o=new Date(t);for(o.setHours(0,0,0,0);i<=o;)v4(i,r,n)&&s++,i=Wr(i,1);return s}const Zi={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function ko(e){return We({queryKey:e?Zi.byProject(e):Zi.all,queryFn:()=>{const t=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return oe.get(t)},select:t=>t.sprints,enabled:!!e})}function y4(e){const t=Se();return be({mutationFn:r=>oe.post("/admin/sprints",{...r,project_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:Zi.byProject(e)})}})}function b4(e,t){const r=Se();return be({mutationFn:n=>oe.put(`/admin/sprints/${e}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:Zi.byProject(t)}),r.invalidateQueries({queryKey:Zi.detail(e)})}})}function w4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/sprints/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Zi.byProject(e)})}})}const nf={byProject:e=>["task-lists","project",e]};function fc(e){return We({queryKey:e?nf.byProject(e):["task-lists"],queryFn:()=>oe.get(`/admin/projects/${e}/task-lists`),select:t=>t.task_lists,enabled:!!e})}function j4(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/projects/${e}/task-lists`,r),onSuccess:()=>{t.invalidateQueries({queryKey:nf.byProject(e)})}})}function N4(e){const t=Se();return be({mutationFn:({id:r,...n})=>oe.put(`/admin/task-lists/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:nf.byProject(e)})}})}function k4(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/task-lists/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:nf.byProject(e)}),t.invalidateQueries({queryKey:Tt.byProject(e)})}})}function xy(e,t,r){const n=(e==null?void 0:e[0])??"",s=(t==null?void 0:t[0])??"";return(n+s).toUpperCase()||((r==null?void 0:r[0])??"U").toUpperCase()}function gy(e,t,r){return`${e??""} ${t??""}`.trim()||r}function mc({value:e,onChange:t,disabled:r,users:n}){const[s,i]=h.useState(!1),[o,l]=h.useState(e),{data:c}=dc(),d=n??c??[],u=e.slice().sort().join(",");h.useEffect(()=>{l(e)},[u]);const f=p=>{const x=o.includes(p)?o.filter(g=>g!==p):[...o,p];l(x),t(x)},m=d.filter(p=>o.includes(p.id));return a.jsxs(Ot,{open:s,onOpenChange:i,children:[a.jsx(Pt,{asChild:!0,disabled:r,children:a.jsx("button",{type:"button",className:$("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",r&&"pointer-events-none opacity-50"),children:m.length===0?a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(ho,{className:"h-3.5 w-3.5"}),"Assign"]}):a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("div",{className:"flex -space-x-1.5",children:m.slice(0,3).map(p=>a.jsx(Rt,{className:"h-5 w-5 border border-background ring-0",children:a.jsx($t,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:xy(p.first_name,p.last_name,p.email)})},p.id))}),m.length>3&&a.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",m.length-3]}),a.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:m.length===1?gy(m[0].first_name,m[0].last_name,m[0].email):`${m.length} assignees`})]})})}),a.jsx(_t,{className:"w-60 p-0",align:"start",children:a.jsxs(Vs,{children:[a.jsx(Zu,{placeholder:"Search users...",className:"h-8 text-xs"}),a.jsxs(Xs,{children:[a.jsx(Ju,{className:"text-xs py-4",children:"No users found."}),a.jsx(is,{children:d.map(p=>{const x=o.includes(p.id),g=gy(p.first_name,p.last_name,p.email),v=xy(p.first_name,p.last_name,p.email);return a.jsxs(dn,{value:g,onSelect:()=>f(p.id),className:"gap-2 py-1.5",children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:"text-[9px] bg-muted text-muted-foreground",children:v})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs font-medium truncate",children:g}),a.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:p.email})]}),a.jsx(dr,{className:$("h-3.5 w-3.5 shrink-0",x?"opacity-100 text-indigo-500":"opacity-0")})]},p.id)})})]})]})})]})}function S4(e,t,r="long"){return new Intl.DateTimeFormat("en-US",{hour:"numeric",timeZone:e,timeZoneName:r}).format(t).split(/\s/g).slice(2).join(" ")}const Em={},cl={};function qs(e,t){try{const n=(Em[e]||(Em[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in cl?cl[n]:vy(n,n.split(":"))}catch{if(e in cl)return cl[e];const r=e==null?void 0:e.match(C4);return r?vy(e,r.slice(1)):NaN}}const C4=/([+-]\d\d):?(\d\d)?/;function vy(e,t){const r=+(t[0]||0),n=+(t[1]||0),s=+(t[2]||0)/60;return cl[e]=r*60+n>0?r*60+n+s:r*60-n-s}class Kn extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(qs(this.timeZone,this))?this.setTime(NaN):t.length?typeof t[0]=="number"&&(t.length===1||t.length===2&&typeof t[1]!="number")?this.setTime(t[0]):typeof t[0]=="string"?this.setTime(+new Date(t[0])):t[0]instanceof Date?this.setTime(+t[0]):(this.setTime(+new Date(...t)),HN(this),Ph(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new Kn(...r,t):new Kn(Date.now(),t)}withTimeZone(t){return new Kn(+this,t)}getTimezoneOffset(){const t=-qs(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Ph(this),+this}[Symbol.for("constructDateFrom")](t){return new Kn(+new Date(t),this.timeZone)}}const yy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!yy.test(e))return;const t=e.replace(yy,"$1UTC");Kn.prototype[t]&&(e.startsWith("get")?Kn.prototype[e]=function(){return this.internal[t]()}:(Kn.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),_4(this),+this},Kn.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Ph(this),+this}))});function Ph(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-qs(e.timeZone,e)*60))}function _4(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()),HN(e)}function HN(e){const t=qs(e.timeZone,e),r=t>0?Math.floor(t):Math.ceil(t),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const s=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),o=s-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=s-r;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const u=s>0?d.getSeconds():(d.getSeconds()-60)%60,f=Math.round(-(qs(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=qs(e.timeZone,e),p=m>0?Math.floor(m):Math.ceil(m),g=-new Date(+e).getTimezoneOffset()-p,v=p!==r,y=g-c;if(v&&y){Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+y);const j=qs(e.timeZone,e),N=j>0?Math.floor(j):Math.ceil(j),w=p-N;w&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+w),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+w))}}class pr extends Kn{static tz(t,...r){return r.length?new pr(...r,t):new pr(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),s=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+s}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,s]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${s}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,s]=this.tzComponents();return`${t} GMT${r}${n}${s} (${S4(this.timeZone,this)})`}toLocaleString(t,r){return Date.prototype.toLocaleString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleDateString(t,r){return Date.prototype.toLocaleDateString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}toLocaleTimeString(t,r){return Date.prototype.toLocaleTimeString.call(this,t,{...r,timeZone:(r==null?void 0:r.timeZone)||this.timeZone})}tzComponents(){const t=this.getTimezoneOffset(),r=t>0?"-":"+",n=String(Math.floor(Math.abs(t)/60)).padStart(2,"0"),s=String(Math.abs(t)%60).padStart(2,"0");return[r,n,s]}withTimeZone(t){return new pr(+this,t)}[Symbol.for("constructDateFrom")](t){return new pr(+new Date(t),this.timeZone)}}const by=5,M4=4;function O4(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,s=t.addDays(e,-n+1),i=t.addDays(s,by*7-1);return t.getMonth(e)===t.getMonth(i)?by:M4}function KN(e,t){const r=t.startOfMonth(e),n=r.getDay();return n===1?r:n===0?t.addDays(r,-1*6):t.addDays(r,-1*(n-1))}function P4(e,t){const r=KN(e,t),n=O4(e,t);return t.addDays(r,n*7-1)}const YN={...Bs,labels:{labelDayButton:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>ue(o,l,{locale:Bs,...r});let i=s(e,"PPPP");return t.today&&(i=`Today, ${i}`),t.selected&&(i=`${i}, selected`),i},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,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>ue(s,i,{locale:Bs,...t}),n(e,"LLLL yyyy")},labelGridcell:(e,t,r,n)=>{let s;n&&typeof n.format=="function"?s=n.format.bind(n):s=(o,l)=>ue(o,l,{locale:Bs,...r});let i=s(e,"PPPP");return t!=null&&t.today&&(i=`Today, ${i}`),i},labelNav:"Navigation bar",labelWeekNumberHeader:"Week Number",labelWeekday:(e,t,r)=>{let n;return r&&typeof r.format=="function"?n=r.format.bind(r):n=(s,i)=>ue(s,i,{locale:Bs,...t}),n(e,"cccc")}}};class rn{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?pr.tz(this.options.timeZone):new this.Date},this.newDate=(n,s,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(n,s,i):this.options.timeZone?new pr(n,s,i,this.options.timeZone):new Date(n,s,i)},this.addDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,s):Wr(n,s)},this.addMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,s):vx(n,s)},this.addWeeks=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,s):j3(n,s)},this.addYears=(n,s)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,s):N3(n,s)},this.differenceInCalendarDays=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,s):tf(n,s)},this.differenceInCalendarMonths=(n,s)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,s):bx(n,s)},this.eachMonthOfInterval=n=>{var s;return(s=this.overrides)!=null&&s.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):E3(n)},this.eachYearOfInterval=n=>{var l;const s=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(n):D3(n),i=new Set(s.map(c=>this.getYear(c)));if(i.size===s.length)return s;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):P4(n,this)},this.endOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.endOfISOWeek?this.overrides.endOfISOWeek(n):T3(n)},this.endOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.endOfMonth?this.overrides.endOfMonth(n):wx(n)},this.endOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,s):LN(n,this.options)},this.endOfYear=n=>{var s;return(s=this.overrides)!=null&&s.endOfYear?this.overrides.endOfYear(n):A3(n)},this.format=(n,s,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(n,s,this.options):ue(n,s,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.getISOWeek?this.overrides.getISOWeek(n):jx(n)},this.getMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):gd(n,this.options)},this.getYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):AI(n,this.options)},this.getWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):Nx(n,this.options)},this.isAfter=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,s):DI(n,s)},this.isBefore=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,s):TI(n,s)},this.isDate=n=>{var s;return(s=this.overrides)!=null&&s.isDate?this.overrides.isDate(n):EN(n)},this.isSameDay=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,s):Qi(n,s)},this.isSameMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,s):II(n,s)},this.isSameYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,s):RI(n,s)},this.max=n=>{var s;return(s=this.overrides)!=null&&s.max?this.overrides.max(n):k3(n)},this.min=n=>{var s;return(s=this.overrides)!=null&&s.min?this.overrides.min(n):S3(n)},this.setMonth=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,s):LI(n,s)},this.setYear=(n,s)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,s):FI(n,s)},this.startOfBroadcastWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):KN(n,this)},this.startOfDay=n=>{var s;return(s=this.overrides)!=null&&s.startOfDay?this.overrides.startOfDay(n):Xi(n)},this.startOfISOWeek=n=>{var s;return(s=this.overrides)!=null&&s.startOfISOWeek?this.overrides.startOfISOWeek(n):wl(n)},this.startOfMonth=n=>{var s;return(s=this.overrides)!=null&&s.startOfMonth?this.overrides.startOfMonth(n):$N(n)},this.startOfWeek=(n,s)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):Vi(n,this.options)},this.startOfYear=n=>{var s;return(s=this.overrides)!=null&&s.startOfYear?this.overrides.startOfYear(n):zN(n)},this.options={locale:YN,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let s=0;s<10;s++)n[s.toString()]=r.format(s);return n}replaceDigits(t){const r=this.getDigitMap();return t.replace(/\d/g,n=>r[n]||n)}formatNumber(t){return this.replaceDigits(t.toString())}getMonthYearOrder(){var r;const t=(r=this.options.locale)==null?void 0:r.code;return t&&rn.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:r,timeZone:n,numerals:s}=this.options,i=r==null?void 0:r.code;if(i&&rn.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:n,numberingSystem:s}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}rn.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 da=new rn;class GN{constructor(t,r,n=da){this.date=t,this.displayMonth=r,this.outside=!!(r&&!n.isSameMonth(t,r)),this.dateLib=n,this.isoDate=n.format(t,"yyyy-MM-dd"),this.displayMonthId=n.format(r,"yyyy-MM"),this.dateMonthId=n.format(t,"yyyy-MM")}isEqualTo(t){return this.dateLib.isSameDay(t.date,this.date)&&this.dateLib.isSameMonth(t.displayMonth,this.displayMonth)}}class E4{constructor(t,r){this.date=t,this.weeks=r}}class A4{constructor(t,r){this.days=r,this.weekNumber=t}}function D4(e){return B.createElement("button",{...e})}function T4(e){return B.createElement("span",{...e})}function I4(e){const{size:t=24,orientation:r="left",className:n}=e;return B.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&B.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&B.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&B.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&B.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function R4(e){const{day:t,modifiers:r,...n}=e;return B.createElement("td",{...n})}function $4(e){const{day:t,modifiers:r,...n}=e,s=B.useRef(null);return B.useEffect(()=>{var i;r.focused&&((i=s.current)==null||i.focus())},[r.focused]),B.createElement("button",{ref:s,...n})}var Me;(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"})(Me||(Me={}));var jt;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(jt||(jt={}));var Sn;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Sn||(Sn={}));var Xr;(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"})(Xr||(Xr={}));function z4(e){const{options:t,className:r,components:n,classNames:s,...i}=e,o=[s[Me.Dropdown],r].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return B.createElement("span",{"data-disabled":i.disabled,className:s[Me.DropdownRoot]},B.createElement(n.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:d,disabled:u})=>B.createElement(n.Option,{key:c,value:c,disabled:u},d))),B.createElement("span",{className:s[Me.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,B.createElement(n.Chevron,{orientation:"down",size:18,className:s[Me.Chevron]})))}function L4(e){return B.createElement("div",{...e})}function F4(e){return B.createElement("div",{...e})}function B4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return B.createElement("div",{...n},e.children)}function W4(e){const{calendarMonth:t,displayIndex:r,...n}=e;return B.createElement("div",{...n})}function U4(e){return B.createElement("table",{...e})}function q4(e){return B.createElement("div",{...e})}const VN=h.createContext(void 0);function hc(){const e=h.useContext(VN);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function H4(e){const{components:t}=hc();return B.createElement(t.Dropdown,{...e})}function K4(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:s,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:d}}=hc(),u=h.useCallback(m=>{s&&(r==null||r(m))},[s,r]),f=h.useCallback(m=>{n&&(t==null||t(m))},[n,t]);return B.createElement("nav",{...i},B.createElement(o.PreviousMonthButton,{type:"button",className:l[Me.PreviousMonthButton],tabIndex:n?void 0:-1,"aria-disabled":n?void 0:!0,"aria-label":c(n),onClick:f},B.createElement(o.Chevron,{disabled:n?void 0:!0,className:l[Me.Chevron],orientation:"left"})),B.createElement(o.NextMonthButton,{type:"button",className:l[Me.NextMonthButton],tabIndex:s?void 0:-1,"aria-disabled":s?void 0:!0,"aria-label":d(s),onClick:u},B.createElement(o.Chevron,{disabled:s?void 0:!0,orientation:"right",className:l[Me.Chevron]})))}function Y4(e){const{components:t}=hc();return B.createElement(t.Button,{...e})}function G4(e){return B.createElement("option",{...e})}function V4(e){const{components:t}=hc();return B.createElement(t.Button,{...e})}function X4(e){const{rootRef:t,...r}=e;return B.createElement("div",{...r,ref:t})}function Q4(e){return B.createElement("select",{...e})}function Z4(e){const{week:t,...r}=e;return B.createElement("tr",{...r})}function J4(e){return B.createElement("th",{...e})}function eR(e){return B.createElement("thead",{"aria-hidden":!0},B.createElement("tr",{...e}))}function tR(e){const{week:t,...r}=e;return B.createElement("th",{...r})}function rR(e){return B.createElement("th",{...e})}function nR(e){return B.createElement("tbody",{...e})}function aR(e){const{components:t}=hc();return B.createElement(t.Dropdown,{...e})}const sR=Object.freeze(Object.defineProperty({__proto__:null,Button:D4,CaptionLabel:T4,Chevron:I4,Day:R4,DayButton:$4,Dropdown:z4,DropdownNav:L4,Footer:F4,Month:B4,MonthCaption:W4,MonthGrid:U4,Months:q4,MonthsDropdown:H4,Nav:K4,NextMonthButton:Y4,Option:G4,PreviousMonthButton:V4,Root:X4,Select:Q4,Week:Z4,WeekNumber:tR,WeekNumberHeader:rR,Weekday:J4,Weekdays:eR,Weeks:nR,YearsDropdown:aR},Symbol.toStringTag,{value:"Module"}));function ba(e,t,r=!1,n=da){let{from:s,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=n;return s&&i?(o(i,s)<0&&([s,i]=[i,s]),o(t,s)>=(r?1:0)&&o(i,t)>=(r?1:0)):!r&&i?l(i,t):!r&&s?l(s,t):!1}function _x(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function af(e){return!!(e&&typeof e=="object"&&"from"in e)}function Mx(e){return!!(e&&typeof e=="object"&&"after"in e)}function Ox(e){return!!(e&&typeof e=="object"&&"before"in e)}function XN(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function QN(e,t){return Array.isArray(e)&&e.every(t.isDate)}function wa(e,t,r=da){const n=Array.isArray(t)?t:[t],{isSameDay:s,differenceInCalendarDays:i,isAfter:o}=r;return n.some(l=>{if(typeof l=="boolean")return l;if(r.isDate(l))return s(e,l);if(QN(l,r))return l.some(c=>s(e,c));if(af(l))return ba(l,e,!1,r);if(XN(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(_x(l)){const c=i(l.before,e),d=i(l.after,e),u=c>0,f=d<0;return o(l.before,l.after)?f&&u:u||f}return Mx(l)?i(e,l.after)>0:Ox(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function iR(e,t,r,n,s){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:u=s.today()}=t,{isSameDay:f,isSameMonth:m,startOfMonth:p,isBefore:x,endOfMonth:g,isAfter:v}=s,y=r&&p(r),j=n&&g(n),N={[jt.focused]:[],[jt.outside]:[],[jt.disabled]:[],[jt.hidden]:[],[jt.today]:[]},w={};for(const k of e){const{date:b,displayMonth:C}=k,_=!!(C&&!m(b,C)),S=!!(y&&x(b,y)),I=!!(j&&v(b,j)),E=!!(i&&wa(b,i,s)),O=!!(o&&wa(b,o,s))||S||I||!d&&!c&&_||d&&c===!1&&_,F=f(b,u);_&&N.outside.push(k),E&&N.disabled.push(k),O&&N.hidden.push(k),F&&N.today.push(k),l&&Object.keys(l).forEach(D=>{const U=l==null?void 0:l[D];U&&wa(b,U,s)&&(w[D]?w[D].push(k):w[D]=[k])})}return k=>{const b={[jt.focused]:!1,[jt.disabled]:!1,[jt.hidden]:!1,[jt.outside]:!1,[jt.today]:!1},C={};for(const _ in N){const S=N[_];b[_]=S.some(I=>I===k)}for(const _ in w)C[_]=w[_].some(S=>S===k);return{...b,...C}}}function oR(e,t,r={}){return Object.entries(e).filter(([,s])=>s===!0).reduce((s,[i])=>(r[i]?s.push(r[i]):t[jt[i]]?s.push(t[jt[i]]):t[Sn[i]]&&s.push(t[Sn[i]]),s),[t[Me.Day]])}function lR(e){return{...sR,...e}}function cR(e){const t={"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(([r,n])=>{r.startsWith("data-")&&(t[r]=n)}),t}function dR(){const e={};for(const t in Me)e[Me[t]]=`rdp-${Me[t]}`;for(const t in jt)e[jt[t]]=`rdp-${jt[t]}`;for(const t in Sn)e[Sn[t]]=`rdp-${Sn[t]}`;for(const t in Xr)e[Xr[t]]=`rdp-${Xr[t]}`;return e}function ZN(e,t,r){return(r??new rn(t)).formatMonthYear(e)}const uR=ZN;function fR(e,t,r){return(r??new rn(t)).format(e,"d")}function mR(e,t=da){return t.format(e,"LLLL")}function hR(e,t,r){return(r??new rn(t)).format(e,"cccccc")}function pR(e,t=da){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function xR(){return""}function JN(e,t=da){return t.format(e,"yyyy")}const gR=JN,vR=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:ZN,formatDay:fR,formatMonthCaption:uR,formatMonthDropdown:mR,formatWeekNumber:pR,formatWeekNumberHeader:xR,formatWeekdayName:hR,formatYearCaption:gR,formatYearDropdown:JN},Symbol.toStringTag,{value:"Module"}));function yR(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...vR,...e}}function Px(e,t,r,n){let s=(n??new rn(r)).format(e,"PPPP");return t.today&&(s=`Today, ${s}`),t.selected&&(s=`${s}, selected`),s}const bR=Px;function Ex(e,t,r){return(r??new rn(t)).formatMonthYear(e)}const wR=Ex;function ek(e,t,r,n){let s=(n??new rn(r)).format(e,"PPPP");return t!=null&&t.today&&(s=`Today, ${s}`),s}function tk(e){return"Choose the Month"}function rk(){return""}const jR="Go to the Next Month";function nk(e,t){return jR}function ak(e){return"Go to the Previous Month"}function sk(e,t,r){return(r??new rn(t)).format(e,"cccc")}function ik(e,t){return`Week ${e}`}function ok(e){return"Week Number"}function lk(e){return"Choose the Year"}const NR=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:wR,labelDay:bR,labelDayButton:Px,labelGrid:Ex,labelGridcell:ek,labelMonthDropdown:tk,labelNav:rk,labelNext:nk,labelPrevious:ak,labelWeekNumber:ik,labelWeekNumberHeader:ok,labelWeekday:sk,labelYearDropdown:lk},Symbol.toStringTag,{value:"Module"})),yn=(e,t,r)=>t||(r?typeof r=="function"?r:(...n)=>r:e);function kR(e,t){var n;const r=((n=t.locale)==null?void 0:n.labels)??{};return{...NR,...e??{},labelDayButton:yn(Px,e==null?void 0:e.labelDayButton,r.labelDayButton),labelMonthDropdown:yn(tk,e==null?void 0:e.labelMonthDropdown,r.labelMonthDropdown),labelNext:yn(nk,e==null?void 0:e.labelNext,r.labelNext),labelPrevious:yn(ak,e==null?void 0:e.labelPrevious,r.labelPrevious),labelWeekNumber:yn(ik,e==null?void 0:e.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:yn(lk,e==null?void 0:e.labelYearDropdown,r.labelYearDropdown),labelGrid:yn(Ex,e==null?void 0:e.labelGrid,r.labelGrid),labelGridcell:yn(ek,e==null?void 0:e.labelGridcell,r.labelGridcell),labelNav:yn(rk,e==null?void 0:e.labelNav,r.labelNav),labelWeekNumberHeader:yn(ok,e==null?void 0:e.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:yn(sk,e==null?void 0:e.labelWeekday,r.labelWeekday)}}function SR(e,t,r,n,s){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=s;return c({start:o(e),end:l(e)}).map(m=>{const p=n.formatMonthDropdown(m,s),x=d(m),g=t&&m<i(t)||r&&m>i(r)||!1;return{value:x,label:p,disabled:g}})}function CR(e,t={},r={}){let n={...t==null?void 0:t[Me.Day]};return Object.entries(e).filter(([,s])=>s===!0).forEach(([s])=>{n={...n,...r==null?void 0:r[s]}}),n}function _R(e,t,r,n){const s=n??e.today(),i=r?e.startOfBroadcastWeek(s,e):t?e.startOfISOWeek(s):e.startOfWeek(s),o=[];for(let l=0;l<7;l++){const c=e.addDays(i,l);o.push(c)}return o}function MR(e,t,r,n,s=!1){if(!e||!t)return;const{startOfYear:i,endOfYear:o,eachYearOfInterval:l,getYear:c}=n,d=i(e),u=o(t),f=l({start:d,end:u});return s&&f.reverse(),f.map(m=>{const p=r.formatYearDropdown(m,n);return{value:c(m),label:p,disabled:!1}})}function OR(e,t={}){var l;const{weekStartsOn:r,locale:n}=t,s=r??((l=n==null?void 0:n.options)==null?void 0:l.weekStartsOn)??0,i=c=>{const d=typeof c=="number"||typeof c=="string"?new Date(c):c;return new pr(d.getFullYear(),d.getMonth(),d.getDate(),12,0,0,e)},o=c=>{const d=i(c);return new Date(d.getFullYear(),d.getMonth(),d.getDate(),0,0,0,0)};return{today:()=>i(pr.tz(e)),newDate:(c,d,u)=>new pr(c,d,u,12,0,0,e),startOfDay:c=>i(c),startOfWeek:(c,d)=>{const u=i(c),f=(d==null?void 0:d.weekStartsOn)??s,m=(u.getDay()-f+7)%7;return u.setDate(u.getDate()-m),u},startOfISOWeek:c=>{const d=i(c),u=(d.getDay()-1+7)%7;return d.setDate(d.getDate()-u),d},startOfMonth:c=>{const d=i(c);return d.setDate(1),d},startOfYear:c=>{const d=i(c);return d.setMonth(0,1),d},endOfWeek:(c,d)=>{const u=i(c),p=((((d==null?void 0:d.weekStartsOn)??s)+6)%7-u.getDay()+7)%7;return u.setDate(u.getDate()+p),u},endOfISOWeek:c=>{const d=i(c),u=(7-d.getDay())%7;return d.setDate(d.getDate()+u),d},endOfMonth:c=>{const d=i(c);return d.setMonth(d.getMonth()+1,0),d},endOfYear:c=>{const d=i(c);return d.setMonth(11,31),d},eachMonthOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),d.getMonth(),1,12,0,0,e),p=u.getFullYear()*12+u.getMonth();for(;m.getFullYear()*12+m.getMonth()<=p;)f.push(new pr(m,e)),m.setMonth(m.getMonth()+1,1);return f},addDays:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d),u},addWeeks:(c,d)=>{const u=i(c);return u.setDate(u.getDate()+d*7),u},addMonths:(c,d)=>{const u=i(c);return u.setMonth(u.getMonth()+d),u},addYears:(c,d)=>{const u=i(c);return u.setFullYear(u.getFullYear()+d),u},eachYearOfInterval:c=>{const d=i(c.start),u=i(c.end),f=[],m=new pr(d.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new pr(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(c,d)=>{var f;const u=o(c);return Nx(u,{weekStartsOn:(d==null?void 0:d.weekStartsOn)??s,firstWeekContainsDate:(d==null?void 0:d.firstWeekContainsDate)??((f=n==null?void 0:n.options)==null?void 0:f.firstWeekContainsDate)??1})},getISOWeek:c=>{const d=o(c);return jx(d)},differenceInCalendarDays:(c,d)=>{const u=o(c),f=o(d);return tf(u,f)},differenceInCalendarMonths:(c,d)=>{const u=o(c),f=o(d);return bx(u,f)}}}const pc=e=>e instanceof HTMLElement?e:null,Am=e=>[...e.querySelectorAll("[data-animated-month]")??[]],PR=e=>pc(e.querySelector("[data-animated-month]")),Dm=e=>pc(e.querySelector("[data-animated-caption]")),Tm=e=>pc(e.querySelector("[data-animated-weeks]")),ER=e=>pc(e.querySelector("[data-animated-nav]")),AR=e=>pc(e.querySelector("[data-animated-weekdays]"));function DR(e,t,{classNames:r,months:n,focused:s,dateLib:i}){const o=h.useRef(null),l=h.useRef(n),c=h.useRef(!1);h.useLayoutEffect(()=>{const d=l.current;if(l.current=n,!t||!e.current||!(e.current instanceof HTMLElement)||n.length===0||d.length===0||n.length!==d.length)return;const u=i.isSameMonth(n[0].date,d[0].date),f=i.isAfter(n[0].date,d[0].date),m=f?r[Xr.caption_after_enter]:r[Xr.caption_before_enter],p=f?r[Xr.weeks_after_enter]:r[Xr.weeks_before_enter],x=o.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(Am(g).forEach(N=>{if(!(N instanceof HTMLElement))return;const w=PR(N);w&&N.contains(w)&&N.removeChild(w);const k=Dm(N);k&&k.classList.remove(m);const b=Tm(N);b&&b.classList.remove(p)}),o.current=g):o.current=null,c.current||u||s)return;const v=x instanceof HTMLElement?Am(x):[],y=Am(e.current);if(y!=null&&y.every(j=>j instanceof HTMLElement)&&v&&v.every(j=>j instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const j=ER(e.current);j&&(j.style.zIndex="1"),y.forEach((N,w)=>{const k=v[w];if(!k)return;N.style.position="relative",N.style.overflow="hidden";const b=Dm(N);b&&b.classList.add(m);const C=Tm(N);C&&C.classList.add(p);const _=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),j&&(j.style.zIndex=""),b&&b.classList.remove(m),C&&C.classList.remove(p),N.style.position="",N.style.overflow="",N.contains(k)&&N.removeChild(k)};k.style.pointerEvents="none",k.style.position="absolute",k.style.overflow="hidden",k.setAttribute("aria-hidden","true");const S=AR(k);S&&(S.style.opacity="0");const I=Dm(k);I&&(I.classList.add(f?r[Xr.caption_before_exit]:r[Xr.caption_after_exit]),I.addEventListener("animationend",_));const E=Tm(k);E&&E.classList.add(f?r[Xr.weeks_before_exit]:r[Xr.weeks_after_exit]),N.insertBefore(k,N.firstChild)})}})}function TR(e,t,r,n){const s=e[0],i=e[e.length-1],{ISOWeek:o,fixedWeeks:l,broadcastCalendar:c}=r??{},{addDays:d,differenceInCalendarDays:u,differenceInCalendarMonths:f,endOfBroadcastWeek:m,endOfISOWeek:p,endOfMonth:x,endOfWeek:g,isAfter:v,startOfBroadcastWeek:y,startOfISOWeek:j,startOfWeek:N}=n,w=c?y(s,n):o?j(s):N(s),k=c?m(i):o?p(x(i)):g(x(i)),b=t&&(c?m(t):o?p(t):g(t)),C=b&&v(k,b)?b:k,_=u(C,w),S=f(i,s)+1,I=[];for(let F=0;F<=_;F++){const D=d(w,F);I.push(D)}const O=(c?35:42)*S;if(l&&I.length<O){const F=O-I.length;for(let D=0;D<F;D++){const U=d(I[I.length-1],1);I.push(U)}}return I}function IR(e){const t=[];return e.reduce((r,n)=>{const s=n.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return r.concat(s.slice())},t.slice())}function RR(e,t,r,n){const{numberOfMonths:s=1}=r,i=[];for(let o=0;o<s;o++){const l=n.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function wy(e,t,r,n){const{month:s,defaultMonth:i,today:o=n.today(),numberOfMonths:l=1}=e;let c=s||i||o;const{differenceInCalendarMonths:d,addMonths:u,startOfMonth:f}=n;if(r&&d(r,c)<l-1){const m=-1*(l-1);c=u(r,m)}return t&&d(c,t)<0&&(c=t),f(c)}function $R(e,t,r,n){const{addDays:s,endOfBroadcastWeek:i,endOfISOWeek:o,endOfMonth:l,endOfWeek:c,getISOWeek:d,getWeek:u,startOfBroadcastWeek:f,startOfISOWeek:m,startOfWeek:p}=n,x=e.reduce((g,v)=>{const y=r.broadcastCalendar?f(v,n):r.ISOWeek?m(v):p(v),j=r.broadcastCalendar?i(v):r.ISOWeek?o(l(v)):c(l(v)),N=t.filter(C=>C>=y&&C<=j),w=r.broadcastCalendar?35:42;if(r.fixedWeeks&&N.length<w){const C=t.filter(_=>{const S=w-N.length;return _>j&&_<=s(j,S)});N.push(...C)}const k=N.reduce((C,_)=>{const S=r.ISOWeek?d(_):u(_),I=C.find(O=>O.weekNumber===S),E=new GN(_,v,n);return I?I.days.push(E):C.push(new A4(S,[E])),C},[]),b=new E4(v,k);return g.push(b),g},[]);return r.reverseMonths?x.reverse():x}function zR(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:s,startOfDay:i,startOfMonth:o,endOfMonth:l,addYears:c,endOfYear:d,newDate:u,today:f}=t,{fromYear:m,toYear:p,fromMonth:x,toMonth:g}=e;!r&&x&&(r=x),!r&&m&&(r=t.newDate(m,0,1)),!n&&g&&(n=g),!n&&p&&(n=u(p,11,31));const v=e.captionLayout==="dropdown"||e.captionLayout==="dropdown-years";return r?r=o(r):m?r=u(m,0,1):!r&&v&&(r=s(c(e.today??f(),-100))),n?n=l(n):p?n=u(p,11,31):!n&&v&&(n=d(e.today??f())),[r&&i(r),n&&i(n)]}function LR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i=1}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i:1,u=o(e);if(!t)return l(u,d);if(!(c(t,e)<i))return l(u,d)}function FR(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:s,numberOfMonths:i}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=s?i??1:1,u=o(e);if(!t)return l(u,-d);if(!(c(u,t)<=0))return l(u,-d)}function BR(e){const t=[];return e.reduce((r,n)=>r.concat(n.weeks.slice()),t.slice())}function sf(e,t){const[r,n]=h.useState(e);return[t===void 0?r:t,n]}function WR(e,t){var w;const[r,n]=zR(e,t),{startOfMonth:s,endOfMonth:i}=t,o=wy(e,r,n,t),[l,c]=sf(o,e.month?o:void 0);h.useEffect(()=>{const k=wy(e,r,n,t);c(k)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:m,nextMonth:p}=h.useMemo(()=>{const k=RR(l,n,{numberOfMonths:e.numberOfMonths},t),b=TR(k,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),C=$R(k,b,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),_=BR(C),S=IR(C),I=FR(l,r,e,t),E=LR(l,n,e,t);return{months:C,weeks:_,days:S,previousMonth:I,nextMonth:E}},[t,l.getTime(),n==null?void 0:n.getTime(),r==null?void 0:r.getTime(),e.disableNavigation,e.broadcastCalendar,(w=e.endMonth)==null?void 0:w.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:x,onMonthChange:g}=e,v=k=>u.some(b=>b.days.some(C=>C.isEqualTo(k))),y=k=>{if(x)return;let b=s(k);r&&b<s(r)&&(b=s(r)),n&&b>s(n)&&(b=s(n)),c(b),g==null||g(b)};return{months:d,weeks:u,days:f,navStart:r,navEnd:n,previousMonth:m,nextMonth:p,goToMonth:y,goToDay:k=>{v(k)||y(k.date)}}}var qn;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(qn||(qn={}));function jy(e){return!e[jt.disabled]&&!e[jt.hidden]&&!e[jt.outside]}function UR(e,t,r,n){let s,i=-1;for(const o of e){const l=t(o);jy(l)&&(l[jt.focused]&&i<qn.FocusedModifier?(s=o,i=qn.FocusedModifier):n!=null&&n.isEqualTo(o)&&i<qn.LastFocused?(s=o,i=qn.LastFocused):r(o.date)&&i<qn.Selected?(s=o,i=qn.Selected):l[jt.today]&&i<qn.Today&&(s=o,i=qn.Today))}return s||(s=e.find(o=>jy(t(o)))),s}function qR(e,t,r,n,s,i,o){const{ISOWeek:l,broadcastCalendar:c}=i,{addDays:d,addMonths:u,addWeeks:f,addYears:m,endOfBroadcastWeek:p,endOfISOWeek:x,endOfWeek:g,max:v,min:y,startOfBroadcastWeek:j,startOfISOWeek:N,startOfWeek:w}=o;let b={day:d,week:f,month:u,year:m,startOfWeek:C=>c?j(C,o):l?N(C):w(C),endOfWeek:C=>c?p(C):l?x(C):g(C)}[e](r,t==="after"?1:-1);return t==="before"&&n?b=v([n,b]):t==="after"&&s&&(b=y([s,b])),b}function ck(e,t,r,n,s,i,o,l=0){if(l>365)return;const c=qR(e,t,r.date,n,s,i,o),d=!!(i.disabled&&wa(c,i.disabled,o)),u=!!(i.hidden&&wa(c,i.hidden,o)),f=c,m=new GN(c,f,o);return!d&&!u?m:ck(e,t,m,n,s,i,o,l+1)}function HR(e,t,r,n,s){const{autoFocus:i}=e,[o,l]=h.useState(),c=UR(t.days,r,n||(()=>!1),o),[d,u]=h.useState(i?c:void 0);return{isFocusTarget:g=>!!(c!=null&&c.isEqualTo(g)),setFocused:u,focused:d,blur:()=>{l(d),u(void 0)},moveFocus:(g,v)=>{if(!d)return;const y=ck(g,v,d,t.navStart,t.navEnd,e,s);y&&(e.disableNavigation&&!t.days.some(N=>N.isEqualTo(y))||(t.goToDay(y),u(y)))}}}function KR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=sf(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t,d=p=>(l==null?void 0:l.some(x=>c(x,p)))??!1,{min:u,max:f}=e;return{selected:l,select:(p,x,g)=>{let v=[...l??[]];if(d(p)){if((l==null?void 0:l.length)===u||n&&(l==null?void 0:l.length)===1)return;v=l==null?void 0:l.filter(y=>!c(y,p))}else(l==null?void 0:l.length)===f?v=[p]:v=[...v,p];return s||o(v),s==null||s(v,p,x,g),v},isSelected:d}}function YR(e,t,r=0,n=0,s=!1,i=da){const{from:o,to:l}=t||{},{isSameDay:c,isAfter:d,isBefore:u}=i;let f;if(!o&&!l)f={from:e,to:r>0?void 0:e};else if(o&&!l)c(o,e)?r===0?f={from:o,to:e}:s?f={from:o,to:void 0}:f=void 0:u(e,o)?f={from:e,to:o}:f={from:o,to:e};else if(o&&l)if(c(o,e)&&c(l,e))s?f={from:o,to:l}:f=void 0;else if(c(o,e))f={from:o,to:r>0?void 0:e};else if(c(l,e))f={from:e,to:r>0?void 0:e};else if(u(e,o))f={from:e,to:l};else if(d(e,o))f={from:o,to:e};else if(d(e,l))f={from:o,to:e};else throw new Error("Invalid range");if(f!=null&&f.from&&(f!=null&&f.to)){const m=i.differenceInCalendarDays(f.to,f.from);n>0&&m>n?f={from:e,to:void 0}:r>1&&m<r&&(f={from:e,to:void 0})}return f}function GR(e,t,r=da){const n=Array.isArray(t)?t:[t];let s=e.from;const i=r.differenceInCalendarDays(e.to,e.from),o=Math.min(i,6);for(let l=0;l<=o;l++){if(n.includes(s.getDay()))return!0;s=r.addDays(s,1)}return!1}function Ny(e,t,r=da){return ba(e,t.from,!1,r)||ba(e,t.to,!1,r)||ba(t,e.from,!1,r)||ba(t,e.to,!1,r)}function VR(e,t,r=da){const n=Array.isArray(t)?t:[t];if(n.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:r.isDate(l)?ba(e,l,!1,r):QN(l,r)?l.some(c=>ba(e,c,!1,r)):af(l)?l.from&&l.to?Ny(e,{from:l.from,to:l.to},r):!1:XN(l)?GR(e,l.dayOfWeek,r):_x(l)?r.isAfter(l.before,l.after)?Ny(e,{from:r.addDays(l.after,1),to:r.addDays(l.before,-1)},r):wa(e.from,l,r)||wa(e.to,l,r):Mx(l)||Ox(l)?wa(e.from,l,r)||wa(e.to,l,r):!1))return!0;const o=n.filter(l=>typeof l=="function");if(o.length){let l=e.from;const c=r.differenceInCalendarDays(e.to,e.from);for(let d=0;d<=c;d++){if(o.some(u=>u(l)))return!0;l=r.addDays(l,1)}}return!1}function XR(e,t){const{disabled:r,excludeDisabled:n,selected:s,required:i,onSelect:o}=e,[l,c]=sf(s,o?s:void 0),d=o?s:l;return{selected:d,select:(m,p,x)=>{const{min:g,max:v}=e,y=m?YR(m,d,g,v,i,t):void 0;return n&&r&&(y!=null&&y.from)&&y.to&&VR({from:y.from,to:y.to},r,t)&&(y.from=m,y.to=void 0),o||c(y),o==null||o(y,m,p,x),y},isSelected:m=>d&&ba(d,m,!1,t)}}function QR(e,t){const{selected:r,required:n,onSelect:s}=e,[i,o]=sf(r,s?r:void 0),l=s?r:i,{isSameDay:c}=t;return{selected:l,select:(f,m,p)=>{let x=f;return!n&&l&&l&&c(f,l)&&(x=void 0),s||o(x),s==null||s(x,f,m,p),x},isSelected:f=>l?c(l,f):!1}}function ZR(e,t){const r=QR(e,t),n=KR(e,t),s=XR(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return s;default:return}}function cn(e,t){return e instanceof pr&&e.timeZone===t?e:new pr(e,t)}function Ei(e,t,r){return cn(e,t)}function ky(e,t,r){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Ei(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?Ei(n,t):n):af(e)?{...e,from:e.from?cn(e.from,t):e.from,to:e.to?cn(e.to,t):e.to}:_x(e)?{before:Ei(e.before,t),after:Ei(e.after,t)}:Mx(e)?{after:Ei(e.after,t)}:Ox(e)?{before:Ei(e.before,t)}:e}function Im(e,t,r){return e&&(Array.isArray(e)?e.map(n=>ky(n,t)):ky(e,t))}function JR(e){var Oe;let t=e;const r=t.timeZone;if(r&&(t={...e,timeZone:r},t.today&&(t.today=cn(t.today,r)),t.month&&(t.month=cn(t.month,r)),t.defaultMonth&&(t.defaultMonth=cn(t.defaultMonth,r)),t.startMonth&&(t.startMonth=cn(t.startMonth,r)),t.endMonth&&(t.endMonth=cn(t.endMonth,r)),t.mode==="single"&&t.selected?t.selected=cn(t.selected,r):t.mode==="multiple"&&t.selected?t.selected=(Oe=t.selected)==null?void 0:Oe.map(pe=>cn(pe,r)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?cn(t.selected.from,r):t.selected.from,to:t.selected.to?cn(t.selected.to,r):t.selected.to}),t.disabled!==void 0&&(t.disabled=Im(t.disabled,r)),t.hidden!==void 0&&(t.hidden=Im(t.hidden,r)),t.modifiers)){const pe={};Object.keys(t.modifiers).forEach(Ne=>{var me;pe[Ne]=Im((me=t.modifiers)==null?void 0:me[Ne],r)}),t.modifiers=pe}const{components:n,formatters:s,labels:i,dateLib:o,locale:l,classNames:c}=h.useMemo(()=>{const pe={...YN,...t.locale},Ne=t.broadcastCalendar?1:t.weekStartsOn,me=t.noonSafe&&t.timeZone?OR(t.timeZone,{weekStartsOn:Ne,locale:pe}):void 0,ye=t.dateLib&&me?{...me,...t.dateLib}:t.dateLib??me,Xe=new rn({locale:pe,weekStartsOn:Ne,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},ye);return{dateLib:Xe,components:lR(t.components),formatters:yR(t.formatters),labels:kR(t.labels,Xe.options),locale:pe,classNames:{...dR(),...t.classNames}}},[t.locale,t.broadcastCalendar,t.weekStartsOn,t.firstWeekContainsDate,t.useAdditionalWeekYearTokens,t.useAdditionalDayOfYearTokens,t.timeZone,t.numerals,t.dateLib,t.noonSafe,t.components,t.formatters,t.labels,t.classNames]);t.today||(t={...t,today:o.today()});const{captionLayout:d,mode:u,navLayout:f,numberOfMonths:m=1,onDayBlur:p,onDayClick:x,onDayFocus:g,onDayKeyDown:v,onDayMouseEnter:y,onDayMouseLeave:j,onNextClick:N,onPrevClick:w,showWeekNumber:k,styles:b}=t,{formatCaption:C,formatDay:_,formatMonthDropdown:S,formatWeekNumber:I,formatWeekNumberHeader:E,formatWeekdayName:O,formatYearDropdown:F}=s,D=WR(t,o),{days:U,months:M,navStart:H,navEnd:re,previousMonth:J,nextMonth:R,goToMonth:A}=D,z=iR(U,t,H,re,o),{isSelected:K,select:X,selected:G}=ZR(t,o)??{},{blur:T,focused:P,isFocusTarget:Z,moveFocus:L,setFocused:Y}=HR(t,D,z,K??(()=>!1),o),{labelDayButton:ae,labelGridcell:ee,labelGrid:se,labelMonthDropdown:V,labelNav:ie,labelPrevious:he,labelNext:xe,labelWeekday:ve,labelWeekNumber:Q,labelWeekNumberHeader:ge,labelYearDropdown:De}=i,Ue=h.useMemo(()=>_R(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Fe=u!==void 0||x!==void 0,Ve=h.useCallback(()=>{J&&(A(J),w==null||w(J))},[J,A,w]),ut=h.useCallback(()=>{R&&(A(R),N==null||N(R))},[A,R,N]),Ke=h.useCallback((pe,Ne)=>me=>{me.preventDefault(),me.stopPropagation(),Y(pe),!Ne.disabled&&(X==null||X(pe.date,Ne,me),x==null||x(pe.date,Ne,me))},[X,x,Y]),Ze=h.useCallback((pe,Ne)=>me=>{Y(pe),g==null||g(pe.date,Ne,me)},[g,Y]),tr=h.useCallback((pe,Ne)=>me=>{T(),p==null||p(pe.date,Ne,me)},[T,p]),Ir=h.useCallback((pe,Ne)=>me=>{const ye={ArrowLeft:[me.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[me.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[me.shiftKey?"year":"week","after"],ArrowUp:[me.shiftKey?"year":"week","before"],PageUp:[me.shiftKey?"year":"month","before"],PageDown:[me.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(ye[me.key]){me.preventDefault(),me.stopPropagation();const[Xe,de]=ye[me.key];L(Xe,de)}v==null||v(pe.date,Ne,me)},[L,v,t.dir]),rr=h.useCallback((pe,Ne)=>me=>{y==null||y(pe.date,Ne,me)},[y]),vr=h.useCallback((pe,Ne)=>me=>{j==null||j(pe.date,Ne,me)},[j]),nr=h.useCallback(pe=>Ne=>{const me=Number(Ne.target.value),ye=o.setMonth(o.startOfMonth(pe),me);A(ye)},[o,A]),yt=h.useCallback(pe=>Ne=>{const me=Number(Ne.target.value),ye=o.setYear(o.startOfMonth(pe),me);A(ye)},[o,A]),{className:Lt,style:Kt}=h.useMemo(()=>({className:[c[Me.Root],t.className].filter(Boolean).join(" "),style:{...b==null?void 0:b[Me.Root],...t.style}}),[c,t.className,t.style,b]),ar=cR(t),Rn=h.useRef(null);DR(Rn,!!t.animate,{classNames:c,months:M,focused:P,dateLib:o});const ua={dayPickerProps:t,selected:G,select:X,isSelected:K,months:M,nextMonth:R,previousMonth:J,goToMonth:A,getModifiers:z,components:n,classNames:c,styles:b,labels:i,formatters:s};return B.createElement(VN.Provider,{value:ua},B.createElement(n.Root,{rootRef:t.animate?Rn:void 0,className:Lt,style:Kt,dir:t.dir,id:t.id,lang:t.lang,nonce:t.nonce,title:t.title,role:t.role,"aria-label":t["aria-label"],"aria-labelledby":t["aria-labelledby"],...ar},B.createElement(n.Months,{className:c[Me.Months],style:b==null?void 0:b[Me.Months]},!t.hideNavigation&&!f&&B.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:R}),M.map((pe,Ne)=>B.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:c[Me.Month],style:b==null?void 0:b[Me.Month],key:Ne,displayIndex:Ne,calendarMonth:pe},f==="around"&&!t.hideNavigation&&Ne===0&&B.createElement(n.PreviousMonthButton,{type:"button",className:c[Me.PreviousMonthButton],tabIndex:J?void 0:-1,"aria-disabled":J?void 0:!0,"aria-label":he(J),onClick:Ve,"data-animated-button":t.animate?"true":void 0},B.createElement(n.Chevron,{disabled:J?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"right":"left"})),B.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[Me.MonthCaption],style:b==null?void 0:b[Me.MonthCaption],calendarMonth:pe,displayIndex:Ne},d!=null&&d.startsWith("dropdown")?B.createElement(n.DropdownNav,{className:c[Me.Dropdowns],style:b==null?void 0:b[Me.Dropdowns]},(()=>{const me=d==="dropdown"||d==="dropdown-months"?B.createElement(n.MonthsDropdown,{key:"month",className:c[Me.MonthsDropdown],"aria-label":V(),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:nr(pe.date),options:SR(pe.date,H,re,s,o),style:b==null?void 0:b[Me.Dropdown],value:o.getMonth(pe.date)}):B.createElement("span",{key:"month"},S(pe.date,o)),ye=d==="dropdown"||d==="dropdown-years"?B.createElement(n.YearsDropdown,{key:"year",className:c[Me.YearsDropdown],"aria-label":De(o.options),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:yt(pe.date),options:MR(H,re,s,o,!!t.reverseYears),style:b==null?void 0:b[Me.Dropdown],value:o.getYear(pe.date)}):B.createElement("span",{key:"year"},F(pe.date,o));return o.getMonthYearOrder()==="year-first"?[ye,me]:[me,ye]})(),B.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(pe.date,o.options,o))):B.createElement(n.CaptionLabel,{className:c[Me.CaptionLabel],role:"status","aria-live":"polite"},C(pe.date,o.options,o))),f==="around"&&!t.hideNavigation&&Ne===m-1&&B.createElement(n.NextMonthButton,{type:"button",className:c[Me.NextMonthButton],tabIndex:R?void 0:-1,"aria-disabled":R?void 0:!0,"aria-label":xe(R),onClick:ut,"data-animated-button":t.animate?"true":void 0},B.createElement(n.Chevron,{disabled:R?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Ne===m-1&&f==="after"&&!t.hideNavigation&&B.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:b==null?void 0:b[Me.Nav],"aria-label":ie(),onPreviousClick:Ve,onNextClick:ut,previousMonth:J,nextMonth:R}),B.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":se(pe.date,o.options,o)||void 0,className:c[Me.MonthGrid],style:b==null?void 0:b[Me.MonthGrid]},!t.hideWeekdays&&B.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[Me.Weekdays],style:b==null?void 0:b[Me.Weekdays]},k&&B.createElement(n.WeekNumberHeader,{"aria-label":ge(o.options),className:c[Me.WeekNumberHeader],style:b==null?void 0:b[Me.WeekNumberHeader],scope:"col"},E()),Ue.map(me=>B.createElement(n.Weekday,{"aria-label":ve(me,o.options,o),className:c[Me.Weekday],key:String(me),style:b==null?void 0:b[Me.Weekday],scope:"col"},O(me,o.options,o)))),B.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[Me.Weeks],style:b==null?void 0:b[Me.Weeks]},pe.weeks.map(me=>B.createElement(n.Week,{className:c[Me.Week],key:me.weekNumber,style:b==null?void 0:b[Me.Week],week:me},k&&B.createElement(n.WeekNumber,{week:me,style:b==null?void 0:b[Me.WeekNumber],"aria-label":Q(me.weekNumber,{locale:l}),className:c[Me.WeekNumber],scope:"row",role:"rowheader"},I(me.weekNumber,o)),me.days.map(ye=>{const{date:Xe}=ye,de=z(ye);if(de[jt.focused]=!de.hidden&&!!(P!=null&&P.isEqualTo(ye)),de[Sn.selected]=(K==null?void 0:K(Xe))||de.selected,af(G)){const{from:rt,to:nt}=G;de[Sn.range_start]=!!(rt&&nt&&o.isSameDay(Xe,rt)),de[Sn.range_end]=!!(rt&&nt&&o.isSameDay(Xe,nt)),de[Sn.range_middle]=ba(G,Xe,!0,o)}const _e=CR(de,b,t.modifiersStyles),Te=oR(de,c,t.modifiersClassNames),bt=!Fe&&!de.hidden?ee(Xe,de,o.options,o):void 0;return B.createElement(n.Day,{key:`${ye.isoDate}_${ye.displayMonthId}`,day:ye,modifiers:de,className:Te.join(" "),style:_e,role:"gridcell","aria-selected":de.selected||void 0,"aria-label":bt,"data-day":ye.isoDate,"data-month":ye.outside?ye.dateMonthId:void 0,"data-selected":de.selected||void 0,"data-disabled":de.disabled||void 0,"data-hidden":de.hidden||void 0,"data-outside":ye.outside||void 0,"data-focused":de.focused||void 0,"data-today":de.today||void 0},!de.hidden&&Fe?B.createElement(n.DayButton,{className:c[Me.DayButton],style:b==null?void 0:b[Me.DayButton],type:"button",day:ye,modifiers:de,disabled:!de.focused&&de.disabled||void 0,"aria-disabled":de.focused&&de.disabled||void 0,tabIndex:Z(ye)?0:-1,"aria-label":ae(Xe,de,o.options,o),onClick:Ke(ye,de),onBlur:tr(ye,de),onFocus:Ze(ye,de),onKeyDown:Ir(ye,de),onMouseEnter:rr(ye,de),onMouseLeave:vr(ye,de)},_(Xe,o.options,o)):!de.hidden&&_(ye.date,o.options,o))})))))))),t.footer&&B.createElement(n.Footer,{className:c[Me.Footer],style:b==null?void 0:b[Me.Footer],role:"status","aria-live":"polite"},t.footer)))}function gr({className:e,classNames:t,showOutsideDays:r=!0,...n}){return a.jsx(JR,{showOutsideDays:r,className:$("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 pointer-events-none",nav:"flex items-center gap-1",button_previous:$(Ui({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),button_next:$(Ui({variant:"outline"}),"absolute right-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),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:$(Ui({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",...t},components:{Chevron:({orientation:s})=>s==="left"?a.jsx(gs,{className:"h-4 w-4"}):a.jsx(Cr,{className:"h-4 w-4"})},...n})}gr.displayName="Calendar";function e$(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,t$(s,...t)]}function t$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}function r$(e){const t=n$(e),r=h.forwardRef((n,s)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(s$);if(c){const d=c.props.children,u=l.map(f=>f===c?h.Children.count(d)>1?h.Children.only(null):h.isValidElement(d)?d.props.children:null:f);return a.jsx(t,{...o,ref:s,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return a.jsx(t,{...o,ref:s,children:i})});return r.displayName=`${e}.Slot`,r}function n$(e){const t=h.forwardRef((r,n)=>{const{children:s,...i}=r;if(h.isValidElement(s)){const o=o$(s),l=i$(i,s.props);return s.type!==h.Fragment&&(l.ref=n?r1(n,o):o),h.cloneElement(s,l)}return h.Children.count(s)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var a$=Symbol("radix.slottable");function s$(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===a$}function i$(e,t){const r={...t};for(const n in t){const s=e[n],i=t[n];/^on[A-Z]/.test(n)?s&&i?r[n]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(r[n]=s):n==="style"?r[n]={...s,...i}:n==="className"&&(r[n]=[s,i].filter(Boolean).join(" "))}return{...e,...r}}function o$(e){var n,s;let t=(n=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:n.get,r=t&&"isReactWarning"in t&&t.isReactWarning;return r?e.ref:(t=(s=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:s.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var l$=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dk=l$.reduce((e,t)=>{const r=r$(`Primitive.${t}`),n=h.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),of="Switch",[c$]=e$(of),[d$,u$]=c$(of),uk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[m,p]=h.useState(null),x=Iu(t,N=>p(N)),g=h.useRef(!1),v=m?u||!!m.closest("form"):!0,[y,j]=BP({prop:s,defaultProp:i??!1,onChange:d,caller:of});return a.jsxs(d$,{scope:r,checked:y,disabled:l,children:[a.jsx(dk.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":pk(y),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Ls(e.onClick,N=>{j(w=>!w),v&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})}),v&&a.jsx(hk,{control:m,bubbles:!g.current,name:n,value:c,checked:y,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});uk.displayName=of;var fk="SwitchThumb",mk=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,s=u$(fk,r);return a.jsx(dk.span,{"data-state":pk(s.checked),"data-disabled":s.disabled?"":void 0,...n,ref:t})});mk.displayName=fk;var f$="SwitchBubbleInput",hk=h.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...s},i)=>{const o=h.useRef(null),l=Iu(o,i),c=WP(r),d=UP(t);return h.useEffect(()=>{const u=o.current;if(!u)return;const f=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(f,"checked").set;if(c!==r&&p){const x=new Event("click",{bubbles:n});p.call(u,r),u.dispatchEvent(x)}},[c,r,n]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});hk.displayName=f$;function pk(e){return e?"checked":"unchecked"}var xk=uk,m$=mk;const So=h.forwardRef(({className:e,...t},r)=>a.jsx(xk,{className:$("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input",e),...t,ref:r,children:a.jsx(m$,{className:$("pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")})}));So.displayName=xk.displayName;function h$(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?ue(new Date(e.start_date),"MMM d"):"—",r=e.end_date?ue(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function lf({open:e,onClose:t,projectId:r,defaultStatus:n="backlog",defaultTaskListId:s,defaultParentId:i}){const o=pt(),{workspace:l,projectKey:c}=zt(),{workspace:d}=Ie(),[u,f]=h.useState(""),[m,p]=h.useState(""),[x,g]=h.useState(n),[v,y]=h.useState("medium"),[j,N]=h.useState("task"),[w,k]=h.useState([]),[b,C]=h.useState(""),[_,S]=h.useState(s??""),[I,E]=h.useState(void 0),[O,F]=h.useState(void 0),[D,U]=h.useState(!1),[M,H]=h.useState("weekly"),[re,J]=h.useState(void 0),R=E1(),{data:A}=oa(r),z=h.useMemo(()=>A?A.members.filter(Y=>Y.user).map(Y=>Y.user):void 0,[A]),{data:K}=jo(r),{data:X}=ko(r||void 0),{data:G}=fc(r||void 0),T=(X??[]).filter(Y=>Y.status!=="completed"),P=K&&K.length>0?Object.fromEntries(K.map(Y=>[Y.key,Y.name])):ci,Z=()=>{f(""),p(""),g(n),y("medium"),N("task"),k([]),C(""),S(s??""),E(void 0),F(void 0),U(!1),H("weekly"),J(void 0),t()},L=Y=>{Y.preventDefault(),u.trim()&&R.mutate({title:u.trim(),description:m.trim()||void 0,status:x,priority:v,type:j,project_id:r,workspace_id:d.id,assignee_ids:w.length>0?w:void 0,sprint_id:b||null,task_list_id:_||null,parent_id:i||null,start_date:I?ue(I,"yyyy-MM-dd"):null,due_date:O?ue(O,"yyyy-MM-dd"):null,recurrence_frequency:D?M:void 0,recurrence_end_date:D&&re?ue(re,"yyyy-MM-dd"):void 0},{onSuccess:()=>{q.success("Issue created"),Z()},onError:ae=>q.error(ae.message??"Failed to create issue")})};return a.jsx(Ni,{open:e,onOpenChange:Y=>!Y&&Z(),children:a.jsxs(ki,{className:"max-w-md",children:[a.jsx(vo,{children:a.jsx(bo,{children:"New issue"})}),a.jsxs("form",{onSubmit:L,className:"flex flex-col flex-1 overflow-hidden",children:[a.jsxs(yo,{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{htmlFor:"issue-title",children:"Title"}),a.jsx(Ae,{id:"issue-title",placeholder:"Issue title",value:u,onChange:Y=>f(Y.target.value),autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{htmlFor:"issue-desc",children:["Description ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(ef,{id:"issue-desc",placeholder:"Add more context...",value:m,onChange:Y=>p(Y.target.value)})]}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Status"}),a.jsxs(Le,{value:x,onValueChange:g,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(P).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Priority"}),a.jsxs(Le,{value:v,onValueChange:y,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(tn).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Type"}),a.jsxs(Le,{value:j,onValueChange:N,children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(_a).map(([Y,ae])=>a.jsx(we,{value:Y,className:"text-xs",children:ae},Y))})]})]})]}),i&&a.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"}),(G??[]).length>0&&!i&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["List ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:_||"none",onValueChange:Y=>S(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No list"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(G??[]).map(Y=>a.jsx(we,{value:Y.id,className:"text-xs",children:Y.name},Y.id))]})]})]}),T.length>0&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Sprint ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Le,{value:b||"none",onValueChange:Y=>C(Y==="none"?"":Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{placeholder:"No sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs",children:a.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),T.map(Y=>{const ae=h$(Y);return a.jsx(we,{value:Y.id,className:"text-xs",children:a.jsxs("div",{children:[a.jsx("span",{children:Y.name}),ae&&a.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:ae})]})},Y.id)})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Assignees ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsx(mc,{value:w,onChange:k,users:z})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Start Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:I?"text-foreground":"text-muted-foreground",children:I?ue(I,"MMM d, yyyy"):"No start date"}),I&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),E(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:I,onSelect:E,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Due Date ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:O?"text-foreground":"text-muted-foreground",children:O?ue(O,"MMM d, yyyy"):"No due date"}),O&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),F(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:O,onSelect:F,initialFocus:!0})})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(So,{id:"recurring",checked:D,onCheckedChange:U}),a.jsxs(mt,{htmlFor:"recurring",className:"cursor-pointer font-normal flex items-center gap-1.5",children:[a.jsx(Gi,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Recurring"]})]}),D&&a.jsx("div",{className:"space-y-3 pl-4 border-l-2 border-indigo-200 dark:border-indigo-800",children:a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(mt,{children:"Frequency"}),a.jsxs(Le,{value:M,onValueChange:Y=>H(Y),children:[a.jsx($e,{className:"h-8 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(mt,{children:["Until ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-2 h-8 w-full rounded-md border border-input px-3 text-xs bg-transparent hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:re?"text-foreground":"text-muted-foreground",children:re?ue(re,"MMM d, yyyy"):"No end date"}),re&&a.jsx("button",{type:"button",onClick:Y=>{Y.stopPropagation(),J(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(tt,{className:"h-3.5 w-3.5"})})]})}),a.jsx(_t,{className:"w-auto p-0",align:"start",children:a.jsx(gr,{mode:"single",selected:re,onSelect:J,initialFocus:!0})})]})]})]})})]})]}),a.jsxs(lc,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[a.jsxs(ne,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{Z(),o(`/${l}/projects/${c}/issues/new`)},children:[a.jsx(nx,{className:"h-3.5 w-3.5"}),"Open full form"]}),a.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[a.jsx(ne,{type:"button",variant:"ghost",onClick:Z,children:"Cancel"}),a.jsx(ne,{type:"submit",disabled:!u.trim()||R.isPending,children:R.isPending?"Creating...":"Create issue"})]})]})]})]})})}const Ax={byIssue:e=>["attachments",e]};function gk(e){return We({queryKey:Ax.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/attachments`),select:t=>t.attachments,enabled:!!e})}function vk(e){const t=Se();return be({mutationFn:({file:r,commentId:n})=>{const s=new FormData;return s.append("file",r),n&&s.append("comment_id",n),oe.upload(`/admin/issues/${e}/attachments`,s)},onSuccess:()=>{t.invalidateQueries({queryKey:Ax.byIssue(e)})}})}function p$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/attachments/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ax.byIssue(e)})}})}function jl(e){return e.startsWith("image/")}function cf(e){return e.startsWith("video/")}function df(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Md(e){if(e.startsWith("/"))return!0;try{const{protocol:t}=new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function Dx(e,t){if(!Md(e)){console.error("downloadFile: blocked unsafe URL",e);return}const r=document.createElement("a");r.href=e,r.download=t,r.style.display="none",document.body.appendChild(r),r.click(),document.body.removeChild(r)}function Tx({mimeType:e,className:t}){return jl(e)?a.jsx(d5,{className:t}):cf(e)?a.jsx(vl,{className:t}):e.startsWith("text/")||e.includes("json")?a.jsx(c5,{className:t}):e.includes("zip")||e.includes("tar")||e.includes("gz")?a.jsx(l5,{className:t}):e.includes("pdf")||e.includes("word")||e.includes("document")?a.jsx(u5,{className:t}):a.jsx(f5,{className:t})}function yk({attachment:e,onClose:t}){return e?a.jsx(Ni,{open:!0,onOpenChange:r=>!r&&t(),children:a.jsxs(ki,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[a.jsxs(vo,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[a.jsx(bo,{className:"text-sm font-medium truncate",children:e.original_name}),a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Dx(e.url,e.original_name),children:[a.jsx(rx,{className:"h-3.5 w-3.5"}),"Download"]})]}),a.jsxs(yo,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[jl(e.mime_type)&&Md(e.url)&&a.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),cf(e.mime_type)&&Md(e.url)&&a.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),a.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[a.jsx("span",{children:df(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:e.mime_type}),a.jsx("span",{children:"·"}),a.jsxs("span",{children:["Uploaded ",ue(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function x$({attachment:e}){const[t,r]=h.useState(null),n=jl(e.mime_type)||cf(e.mime_type),s=()=>{n?r(e):Dx(e.url,e.original_name)};return a.jsxs(a.Fragment,{children:[jl(e.mime_type)?a.jsx("button",{type:"button",onClick:s,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:a.jsx("img",{src:Md(e.url)?e.url:"",alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):a.jsxs("button",{type:"button",onClick:s,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:n?"View":"Download",children:[a.jsx(Tx,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),a.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:df(e.size)}),!n&&a.jsx(rx,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),t&&a.jsx(yk,{attachment:t,onClose:()=>r(null)})]})}function g$({attachment:e,onOpen:t,onDelete:r,isDeleting:n}){const s=jl(e.mime_type)||cf(e.mime_type),i=()=>{s?t(e):Dx(e.url,e.original_name)};return a.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("button",{type:"button",onClick:i,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:s?"View":"Download",children:a.jsx(Tx,{mimeType:e.mime_type,className:"h-4 w-4"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("button",{type:"button",onClick:i,className:"text-xs font-medium text-foreground truncate block text-left w-full hover:underline",children:e.original_name}),a.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[a.jsx("span",{children:df(e.size)}),a.jsx("span",{children:"·"}),a.jsx("span",{children:ue(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsx("span",{className:"italic",children:"from comment"})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"·"}),a.jsxs("span",{className:"flex items-center gap-0.5",children:[a.jsx(rx,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),a.jsx(ne,{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:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function v$({onFiles:e,isUploading:t}){const[r,n]=h.useState(!1),s=h.useRef(null),i=h.useCallback(o=>{o.preventDefault(),n(!1);const l=Array.from(o.dataTransfer.files);l.length>0&&e(l)},[e]);return a.jsxs("div",{onDragOver:o=>{o.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:i,onClick:()=>{var o;return!t&&((o=s.current)==null?void 0:o.click())},className:$("flex flex-col items-center justify-center gap-1.5 rounded-xl border-2 border-dashed px-4 py-6","cursor-pointer transition-colors",r?"border-primary/60 bg-primary/5":"border-border hover:border-muted-foreground/40 hover:bg-muted/30",t&&"opacity-60 cursor-wait"),children:[a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:a.jsx(R5,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("p",{className:"text-xs font-medium text-foreground",children:t?"Uploading…":"Drop files or click to browse"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),a.jsx("input",{ref:s,type:"file",multiple:!0,className:"hidden",onChange:o=>{const l=Array.from(o.target.files??[]);l.length>0&&e(l),o.target.value=""}})]})}function y$({issueId:e,className:t}){const[r,n]=h.useState(null),{data:s,isLoading:i}=gk(e),o=vk(e),l=p$(e),c=u=>{u.forEach(f=>{o.mutate({file:f},{onSuccess:()=>q.success(`${f.name} uploaded`),onError:()=>q.error(`Failed to upload ${f.name}`)})})},d=u=>{l.mutate(u,{onSuccess:()=>q.success("Attachment removed"),onError:()=>q.error("Failed to remove attachment")})};return a.jsxs("div",{className:$("px-6 py-4 space-y-4",t),children:[a.jsx(v$,{onFiles:c,isUploading:o.isPending}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(u=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(ce,{className:"h-8 w-8 rounded-md shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(ce,{className:"h-3 w-2/3"}),a.jsx(ce,{className:"h-2.5 w-1/3"})]})]},u))}):s&&s.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[a.jsx(ix,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[s.length," ",s.length===1?"file":"files"]})]}),a.jsx("div",{children:s.map(u=>a.jsx(g$,{attachment:u,onOpen:n,onDelete:d,isDeleting:l.isPending},u.id))})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),a.jsx(yk,{attachment:r,onClose:()=>n(null)})]})}const bs={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"]};function b$(e){return We({queryKey:bs.byIssue(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function w$(e){return We({queryKey:bs.activeTimer(e),queryFn:()=>oe.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e,refetchInterval:1e4})}function j$(e){const t=Se();return be({mutationFn:r=>oe.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:bs.byIssue(e)})}})}function N$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:()=>{t.invalidateQueries({queryKey:bs.activeTimer(e)}),t.invalidateQueries({queryKey:bs.byIssue(e)})}})}function k$(e){const t=Se();return be({mutationFn:()=>oe.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:bs.activeTimer(e)}),t.invalidateQueries({queryKey:bs.byIssue(e)})}})}function S$(e){const t=Se();return be({mutationFn:r=>oe.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:bs.byIssue(e)})}})}const C$=Xl("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 Pn({className:e,variant:t,...r}){return a.jsx("div",{className:$(C$({variant:t}),e),...r})}function Eh(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function Sy(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3),n=Math.floor(r/3600),s=Math.floor(r%3600/60),i=r%60,o=String(s).padStart(2,"0"),l=String(i).padStart(2,"0");return n>0?`${n}:${o}:${l}`:`${o}:${l}`}function _$({startedAt:e}){const[t,r]=h.useState(()=>Sy(e));return h.useEffect(()=>{const n=setInterval(()=>r(Sy(e)),1e3);return()=>clearInterval(n)},[e]),a.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:t})}function M$({onSubmit:e,isPending:t,onCancel:r}){const[n,s]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(""),[d,u]=h.useState(new Date().toISOString().split("T")[0]),f=m=>{m.preventDefault();const p=parseInt(n||"0",10),x=parseInt(i||"0",10),g=p*60+x;if(g<=0){q.error("Please enter a duration greater than 0.");return}e({duration_minutes:g,description:l.trim()||void 0,logged_date:d||void 0})};return a.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),a.jsx(Ae,{type:"number",min:"0",max:"999",placeholder:"0",value:n,onChange:m=>s(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),a.jsx(Ae,{type:"number",min:"0",max:"59",placeholder:"0",value:i,onChange:m=>o(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),a.jsx(Ae,{type:"date",value:d,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",a.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),a.jsx(Ae,{placeholder:"What did you work on?",value:l,onChange:m=>c(m.target.value),className:"h-8 text-sm"})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"h-7 text-xs",children:"Cancel"}),a.jsx(ne,{type:"submit",size:"sm",disabled:t,className:"h-7 text-xs",children:t?"Saving…":"Log time"})]})]})}function O$({entry:e,userName:t,onDelete:r,isDeleting:n}){const s=e.started_at!=null&&e.stopped_at==null;return a.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[a.jsx("div",{className:$("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",s?"bg-emerald-50 dark:bg-emerald-950/40":"bg-muted"),children:s?a.jsx(A5,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?a.jsx(Dn,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(i5,{className:"h-3.5 w-3.5 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s?a.jsx(_$,{startedAt:e.started_at}):a.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:Eh(e.duration_minutes??0)}),a.jsx(Pn,{variant:"muted",className:$("text-[10px] px-1.5 py-0",s?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":""),children:s?"Running":e.source==="timer"?"Timer":"Manual"}),t&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:t})]}),e.description&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!s&&a.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:ue(new Date(e.logged_date),"MMM d, yyyy")})]}),!s&&a.jsx(ne,{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:()=>r(e.id),disabled:n,children:a.jsx(Mr,{className:"h-3.5 w-3.5"})})]})}function P$({issueId:e,className:t}){const[r,n]=h.useState(!1),{data:s,isLoading:i}=b$(e),{data:o}=w$(e),{data:l}=js(),c=j$(e),d=N$(e),u=k$(e),f=S$(e),m=(s==null?void 0:s.time_logs)??[],p=(s==null?void 0:s.total_minutes)??0,x=o!=null,g=N=>{c.mutate(N,{onSuccess:()=>{n(!1),q.success("Time logged")},onError:()=>q.error("Failed to log time")})},v=()=>{d.mutate(void 0,{onSuccess:()=>q.success("Timer started"),onError:N=>q.error(N.message??"Failed to start timer")})},y=()=>{u.mutate(void 0,{onSuccess:N=>{const w=N.time_log.duration_minutes??0;q.success(`Timer stopped — ${Eh(w)} logged`)},onError:()=>q.error("Failed to stop timer")})},j=N=>{f.mutate(N,{onSuccess:()=>q.success("Time entry removed"),onError:()=>q.error("Failed to remove entry")})};return a.jsxs("div",{className:$("px-6 py-4 space-y-4",t),children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),a.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:p>0?Eh(p):"—"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[!r&&a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>n(!0),children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Log time"]}),x?a.jsxs(ne,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:y,disabled:u.isPending,children:[a.jsx(M5,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):a.jsxs(ne,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:v,disabled:d.isPending,children:[a.jsx(vl,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),r&&a.jsx(M$,{onSubmit:g,isPending:c.isPending,onCancel:()=>n(!1)}),i?a.jsx("div",{className:"space-y-2",children:[1,2].map(N=>a.jsxs("div",{className:"flex items-center gap-3 px-3",children:[a.jsx(ce,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(ce,{className:"h-3 w-1/3"}),a.jsx(ce,{className:"h-2.5 w-1/4"})]})]},N))}):m.length>0?a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[a.jsx(Dn,{className:"h-3 w-3 text-muted-foreground"}),a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[m.length," ",m.length===1?"entry":"entries"]})]}),a.jsx("div",{children:m.map(N=>{var w;return a.jsx(O$,{entry:N,userName:(w=l==null?void 0:l.get(N.user_id))==null?void 0:w.name,onDelete:j,isDeleting:f.isPending},N.id)})})]}):a.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."})]})}function E$(e){var t;const{char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:l}=e,c=n&&!s,d=wE(r),u=new RegExp(`\\s${d}$`),f=o?"^":"",m=s?"":d,p=c?new RegExp(`${f}${d}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${f}(?:^)?${d}[^\\s${m}]*`,"gm"),x=((t=l.nodeBefore)==null?void 0:t.isText)&&l.nodeBefore.text;if(!x)return null;const g=l.pos-x.length,v=Array.from(x.matchAll(p)).pop();if(!v||v.input===void 0||v.index===void 0)return null;const y=v.input.slice(Math.max(0,v.index-1),v.index),j=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!j)return null;const N=g+v.index;let w=N+v[0].length;return c&&u.test(x.slice(w-1,w+1))&&(v[0]+=" ",w+=1),N<l.pos&&w>=l.pos?{range:{from:N,to:w},query:v[0].slice(r.length),text:v[0]}:null}var A$=new u1("suggestion");function D$({pluginKey:e=A$,editor:t,char:r="@",allowSpaces:n=!1,allowToIncludeChar:s=!1,allowedPrefixes:i=[" "],startOfLine:o=!1,decorationTag:l="span",decorationClass:c="suggestion",decorationContent:d="",decorationEmptyClass:u="is-empty",command:f=()=>null,items:m=()=>[],render:p=()=>({}),allow:x=()=>!0,findSuggestionMatch:g=E$,shouldShow:v}){let y;const j=p==null?void 0:p(),N=()=>{const C=t.state.selection.$anchor.pos,_=t.view.coordsAtPos(C),{top:S,right:I,bottom:E,left:O}=_;try{return new DOMRect(O,S,I-O,E-S)}catch{return null}},w=(C,_)=>_?()=>{const S=e.getState(t.state),I=S==null?void 0:S.decorationId,E=C.dom.querySelector(`[data-decoration-id="${I}"]`);return(E==null?void 0:E.getBoundingClientRect())||null}:N;function k(C,_){var S;try{const E=e.getState(C.state),O=E!=null&&E.decorationId?C.dom.querySelector(`[data-decoration-id="${E.decorationId}"]`):null,F={editor:t,range:(E==null?void 0:E.range)||{from:0,to:0},query:(E==null?void 0:E.query)||null,text:(E==null?void 0:E.text)||null,items:[],command:D=>f({editor:t,range:(E==null?void 0:E.range)||{from:0,to:0},props:D}),decorationNode:O,clientRect:w(C,O)};(S=j==null?void 0:j.onExit)==null||S.call(j,F)}catch{}const I=C.state.tr.setMeta(_,{exit:!0});C.dispatch(I)}const b=new vE({key:e,view(){return{update:async(C,_)=>{var S,I,E,O,F,D,U;const M=(S=this.key)==null?void 0:S.getState(_),H=(I=this.key)==null?void 0:I.getState(C.state),re=M.active&&H.active&&M.range.from!==H.range.from,J=!M.active&&H.active,R=M.active&&!H.active,A=!J&&!R&&M.query!==H.query,z=J||re&&A,K=A||re,X=R||re&&A;if(!z&&!K&&!X)return;const G=X&&!z?M:H,T=C.dom.querySelector(`[data-decoration-id="${G.decorationId}"]`);y={editor:t,range:G.range,query:G.query,text:G.text,items:[],command:P=>f({editor:t,range:G.range,props:P}),decorationNode:T,clientRect:w(C,T)},z&&((E=j==null?void 0:j.onBeforeStart)==null||E.call(j,y)),K&&((O=j==null?void 0:j.onBeforeUpdate)==null||O.call(j,y)),(K||z)&&(y.items=await m({editor:t,query:G.query})),X&&((F=j==null?void 0:j.onExit)==null||F.call(j,y)),K&&((D=j==null?void 0:j.onUpdate)==null||D.call(j,y)),z&&((U=j==null?void 0:j.onStart)==null||U.call(j,y))},destroy:()=>{var C;y&&((C=j==null?void 0:j.onExit)==null||C.call(j,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(C,_,S,I){const{isEditable:E}=t,{composing:O}=t.view,{selection:F}=C,{empty:D,from:U}=F,M={..._},H=C.getMeta(e);if(H&&H.exit)return M.active=!1,M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null,M;if(M.composing=O,E&&(D||t.view.composing)){(U<_.range.from||U>_.range.to)&&!O&&!_.composing&&(M.active=!1);const re=g({char:r,allowSpaces:n,allowToIncludeChar:s,allowedPrefixes:i,startOfLine:o,$position:F.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;re&&x({editor:t,state:I,range:re.range,isActive:_.active})&&(!v||v({editor:t,range:re.range,query:re.query,text:re.text,transaction:C}))?(M.active=!0,M.decorationId=_.decorationId?_.decorationId:J,M.range=re.range,M.query=re.query,M.text=re.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(C,_){var S,I,E,O;const{active:F,range:D}=b.getState(C.state);if(!F)return!1;if(_.key==="Escape"||_.key==="Esc"){const M=b.getState(C.state),H=(S=y==null?void 0:y.decorationNode)!=null?S:null,re=H??(M!=null&&M.decorationId?C.dom.querySelector(`[data-decoration-id="${M.decorationId}"]`):null);if(((I=j==null?void 0:j.onKeyDown)==null?void 0:I.call(j,{view:C,event:_,range:M.range}))||!1)return!0;const R={editor:t,range:M.range,query:M.query,text:M.text,items:[],command:A=>f({editor:t,range:M.range,props:A}),decorationNode:re,clientRect:re?()=>re.getBoundingClientRect()||null:null};return(E=j==null?void 0:j.onExit)==null||E.call(j,R),k(C,e),!0}return((O=j==null?void 0:j.onKeyDown)==null?void 0:O.call(j,{view:C,event:_,range:D}))||!1},decorations(C){const{active:_,range:S,decorationId:I,query:E}=b.getState(C);if(!_)return null;const O=!(E!=null&&E.length),F=[c];return O&&F.push(u),yE.create(C.doc,[bE.inline(S.from,S.to,{nodeName:l,class:F.join(" "),"data-decoration-id":I,"data-decoration-content":d})])}}});return b}function T$({editor:e,overrideSuggestionOptions:t,extensionName:r,char:n="@"}){const s=new u1;return{editor:e,char:n,pluginKey:s,command:({editor:i,range:o,props:l})=>{var c,d,u;const f=i.view.state.selection.$to.nodeAfter;((c=f==null?void 0:f.text)==null?void 0:c.startsWith(" "))&&(o.to+=1),i.chain().focus().insertContentAt(o,[{type:r,attrs:{...l,mentionSuggestionChar:n}},{type:"text",text:" "}]).run(),(u=(d=i.view.dom.ownerDocument.defaultView)==null?void 0:d.getSelection())==null||u.collapseToEnd()},allow:({state:i,range:o})=>{const l=i.doc.resolve(o.from),c=i.schema.nodes[r];return!!l.parent.type.contentMatch.matchType(c)},...t}}function bk(e){return(e.options.suggestions.length?e.options.suggestions:[e.options.suggestion]).map(t=>T$({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Cy(e,t){const r=bk(e),n=r.find(s=>s.char===t);return n||(r.length?r[0]:null)}var I$=jE.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:e,suggestion:t}){var r,n;return`${(r=t==null?void 0:t.char)!=null?r:"@"}${(n=e.attrs.label)!=null?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:e,node:t,suggestion:r}){var n,s;return["span",Rc(this.HTMLAttributes,e.HTMLAttributes),`${(n=r==null?void 0:r.char)!=null?n:"@"}${(s=t.attrs.label)!=null?s:t.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>e.id?{"data-id":e.id}:{}},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>e.label?{"data-label":e.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:e=>e.getAttribute("data-mention-suggestion-char"),renderHTML:e=>({"data-mention-suggestion-char":e.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){const r=Cy(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:r})];const n={...this.options};n.HTMLAttributes=Rc({"data-type":this.name},this.options.HTMLAttributes,t);const s=this.options.renderHTML({options:n,node:e,suggestion:r});return typeof s=="string"?["span",Rc({"data-type":this.name},this.options.HTMLAttributes,t),s]:s},...kE({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:e=>{const t={},r=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=r.exec(e);for(;n!==null;){const[,s,i,o]=n,l=i??o;t[s==="char"?"mentionSuggestionChar":s]=l,n=r.exec(e)}return t},serializeAttributes:e=>Object.entries(e).filter(([,t])=>t!=null).map(([t,r])=>`${t==="mentionSuggestionChar"?"char":t}="${r}"`).join(" ")}),renderText({node:e}){const t={options:this.options,node:e,suggestion:Cy(this,e.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(t)):this.options.renderText(t)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let r=!1;const{selection:n}=t,{empty:s,anchor:i}=n;if(!s)return!1;let o=new NE,l=0;return t.doc.nodesBetween(i-1,i,(c,d)=>{if(c.type.name===this.name)return r=!0,o=c,l=d,!1}),r&&e.insertText(this.options.deleteTriggerWithBackspace?"":o.attrs.mentionSuggestionChar,l,l+o.nodeSize),r})}},addProseMirrorPlugins(){return bk(this).map(D$)}}),R$=I$;function $$({items:e,selectedIndex:t,onSelect:r}){const n=h.useRef(null);return h.useEffect(()=>{var i;const s=(i=n.current)==null?void 0:i.querySelector(`[data-index="${t}"]`);s==null||s.scrollIntoView({block:"nearest"})},[t]),e.length===0?null:a.jsx("div",{className:$("z-50 min-w-[220px] max-w-[280px] rounded-md border border-border","bg-popover shadow-md overflow-hidden","animate-in fade-in-0 zoom-in-95"),children:a.jsx("div",{ref:n,className:"max-h-[200px] overflow-y-auto p-1",role:"listbox",children:e.map((s,i)=>{const o=s.label.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2)||"?",l=$x(s.label);return a.jsxs("button",{"data-index":i,role:"option","aria-selected":i===t,onMouseDown:c=>{c.preventDefault(),r(s)},className:$("flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-xs cursor-pointer","transition-colors",i===t?"bg-accent text-accent-foreground":"hover:bg-accent/60"),children:[a.jsx(Rt,{className:"h-5 w-5 shrink-0",children:a.jsx($t,{className:$("text-[9px] font-semibold",l.bg,l.text),children:o})}),a.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[a.jsx("span",{className:"font-medium text-foreground truncate leading-tight",children:s.label}),a.jsx("span",{className:"text-[10px] text-muted-foreground truncate leading-tight",children:s.email})]})]},s.id)})})})}function Os({onClick:e,active:t,title:r,children:n}){return a.jsx("button",{type:"button",title:r,onMouseDown:s=>{s.preventDefault(),e()},className:$("flex h-6 w-6 items-center justify-center rounded transition-colors shrink-0","text-muted-foreground hover:text-foreground hover:bg-muted",t&&"bg-muted text-foreground"),children:n})}function _y(){return a.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}const qc={active:!1,items:[],selectedIndex:0,rect:null,command:null};function wk({issueId:e,projectId:t,compact:r,className:n,onSuccess:s}){const[i,o]=h.useState(!0),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,m]=h.useState(qc),p=h.useRef(null),x=h.useRef(async()=>{}),g=h.useRef(null),{user:v}=Ie(),y=e5(e),j=vk(e),{data:N}=oa(t??""),w=h.useMemo(()=>N!=null&&N.members?N.members.filter(T=>T.user).map(T=>{const P=T.user,Z=`${P.first_name??""} ${P.last_name??""}`.trim()||P.email;return{id:P.id,label:Z,email:P.email}}):[],[N]),k=h.useRef([]);k.current=w;const b=h.useRef(m);b.current=m;const C=h.useRef([]),_=h.useRef(null),S=h.useRef(0),I=(v==null?void 0:v.first_name)??"",E=(v==null?void 0:v.last_name)??"",O=`${I} ${E}`.trim()||(v==null?void 0:v.email)||"?",F=v&&`${I[0]??""}${E[0]??""}`.toUpperCase()||"?",D=$x(O),U=h.useMemo(()=>SE.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(x.current(),!0)}}}),[]),M=h.useMemo(()=>R$.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:T})=>{const P=k.current;if(!P.length)return[];const Z=T.toLowerCase();return P.filter(L=>!Z||L.label.toLowerCase().includes(Z)||L.email.toLowerCase().includes(Z)).slice(0,8)},render:()=>({onStart:T=>{var P;C.current=T.items,_.current=T.command,S.current=0,b.current({active:!0,items:T.items,selectedIndex:0,rect:((P=T.clientRect)==null?void 0:P.call(T))??null,command:T.command})},onUpdate:T=>{var P;C.current=T.items,_.current=T.command,S.current=0,b.current({active:!0,items:T.items,selectedIndex:0,rect:((P=T.clientRect)==null?void 0:P.call(T))??null,command:T.command})},onKeyDown:({event:T})=>{var Z;const P=C.current;if(!P.length)return!1;if(T.key==="Escape")return b.current(qc),!0;if(T.key==="ArrowDown"){const L=(S.current+1)%P.length;return S.current=L,b.current(Y=>({...Y,selectedIndex:L})),!0}if(T.key==="ArrowUp"){const L=(S.current-1+P.length)%P.length;return S.current=L,b.current(Y=>({...Y,selectedIndex:L})),!0}if(T.key==="Enter"){const L=P[S.current];return L&&((Z=_.current)==null||Z.call(_,L)),!0}return!1},onExit:()=>{b.current(qc),_.current=null}})}}),[]),H=f1({extensions:[m1,h1,p1.configure({placeholder:"Leave a comment… (type @ to mention)"}),U,M],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:T}){o(T.isEmpty)}}),re=!i||l.length>0,J=25*1024*1024,R=T=>{const P=T.filter(L=>L.size>J);P.length>0&&q.error(`Files must be under 25 MB: ${P.map(L=>L.name).join(", ")}`);const Z=T.filter(L=>L.size<=J);c(L=>{const Y=new Set(L.map(ae=>`${ae.name}-${ae.size}`));return[...L,...Z.filter(ae=>!Y.has(`${ae.name}-${ae.size}`))]})},A=T=>{c(P=>P.filter((Z,L)=>L!==T))},z=h.useCallback(T=>{var P;(P=_.current)==null||P.call(_,T),m(qc)},[]),K=async()=>{if(!(!re||d)){u(!0);try{const T=H!=null&&H.isEmpty?"":(H==null?void 0:H.getHTML())??"",P=[];T&&new DOMParser().parseFromString(T,"text/html").querySelectorAll("[data-type='mention']").forEach(se=>{const V=se.getAttribute("data-id");V&&!P.includes(V)&&P.push(V)});const Z=P.length>0?{mentioned_user_ids:P}:void 0,Y=(await y.mutateAsync({body:T||" ",metadata:Z})).comment.id;for(const ae of l)await j.mutateAsync({file:ae,commentId:Y});H==null||H.commands.clearContent(),o(!0),c([]),q.success("Comment added"),s==null||s()}catch{q.error("Failed to add comment")}finally{u(!1)}}};x.current=K;const X="h-3 w-3",G=h.useMemo(()=>{if(!f.rect||!g.current)return{bottom:"105%",left:0};const T=g.current.getBoundingClientRect(),P=Math.max(0,f.rect.left-T.left);return{top:f.rect.bottom-T.top+4,left:P}},[f.rect]);return a.jsxs("div",{className:$("flex gap-3 items-start",n),children:[a.jsx(Rt,{className:"h-7 w-7 shrink-0 mt-1",children:a.jsx($t,{className:$("text-[11px] font-semibold",D.bg,D.text),children:F})}),a.jsxs("div",{className:"flex-1 min-w-0 relative",ref:g,children:[a.jsxs("div",{className:$("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[H&&a.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[a.jsx(Os,{title:"Bold (⌘B)",active:H.isActive("bold"),onClick:()=>H.chain().focus().toggleBold().run(),children:a.jsx(D1,{className:X})}),a.jsx(Os,{title:"Italic (⌘I)",active:H.isActive("italic"),onClick:()=>H.chain().focus().toggleItalic().run(),children:a.jsx(F1,{className:X})}),a.jsx(Os,{title:"Strikethrough",active:H.isActive("strike"),onClick:()=>H.chain().focus().toggleStrike().run(),children:a.jsx(H1,{className:X})}),a.jsx(Os,{title:"Inline code",active:H.isActive("code"),onClick:()=>H.chain().focus().toggleCode().run(),children:a.jsx(z1,{className:X})}),a.jsx(_y,{}),a.jsx(Os,{title:"Bullet list",active:H.isActive("bulletList"),onClick:()=>H.chain().focus().toggleBulletList().run(),children:a.jsx(sx,{className:X})}),a.jsx(Os,{title:"Ordered list",active:H.isActive("orderedList"),onClick:()=>H.chain().focus().toggleOrderedList().run(),children:a.jsx(W1,{className:X})}),a.jsx(_y,{}),a.jsx(Os,{title:"Code block",active:H.isActive("codeBlock"),onClick:()=>H.chain().focus().toggleCodeBlock().run(),children:a.jsx($1,{className:X})})]}),a.jsx(x1,{editor:H,className:$("px-3 py-2.5 text-sm",r?"min-h-[68px]":"min-h-[80px]")})]}),l.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:l.map((T,P)=>a.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:[a.jsx(Tx,{mimeType:T.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"truncate",children:T.name}),a.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",df(T.size),")"]}),a.jsx("button",{type:"button",onClick:()=>A(P),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:a.jsx(tt,{className:"h-3 w-3"})})]},P))}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(ne,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var T;return(T=p.current)==null?void 0:T.click()},disabled:d,title:"Attach files",children:a.jsx(ix,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[a.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),a.jsx(ne,{size:"icon",className:"h-8 w-8",onClick:K,disabled:!re||d,children:a.jsx(S5,{className:"h-3.5 w-3.5"})})]}),a.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:T=>{const P=Array.from(T.target.files??[]);P.length>0&&R(P),T.target.value=""}}),f.active&&f.items.length>0&&a.jsx("div",{className:"absolute z-[9999]",style:G,children:a.jsx($$,{items:f.items,selectedIndex:f.selectedIndex,onSelect:z})})]})]})}/*! @license DOMPurify 3.3.1 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.1/LICENSE */const{entries:jk,setPrototypeOf:My,isFrozen:z$,getPrototypeOf:L$,getOwnPropertyDescriptor:F$}=Object;let{freeze:Pr,seal:fn,create:Ah}=Object,{apply:Dh,construct:Th}=typeof Reflect<"u"&&Reflect;Pr||(Pr=function(t){return t});fn||(fn=function(t){return t});Dh||(Dh=function(t,r){for(var n=arguments.length,s=new Array(n>2?n-2:0),i=2;i<n;i++)s[i-2]=arguments[i];return t.apply(r,s)});Th||(Th=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return new t(...n)});const Hc=Er(Array.prototype.forEach),B$=Er(Array.prototype.lastIndexOf),Oy=Er(Array.prototype.pop),Ko=Er(Array.prototype.push),W$=Er(Array.prototype.splice),vd=Er(String.prototype.toLowerCase),Rm=Er(String.prototype.toString),$m=Er(String.prototype.match),Yo=Er(String.prototype.replace),U$=Er(String.prototype.indexOf),q$=Er(String.prototype.trim),wn=Er(Object.prototype.hasOwnProperty),br=Er(RegExp.prototype.test),Go=H$(TypeError);function Er(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),s=1;s<r;s++)n[s-1]=arguments[s];return Dh(e,t,n)}}function H$(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Th(e,r)}}function Be(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:vd;My&&My(e,null);let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){const i=r(s);i!==s&&(z$(t)||(t[n]=i),s=i)}e[s]=!0}return e}function K$(e){for(let t=0;t<e.length;t++)wn(e,t)||(e[t]=null);return e}function Un(e){const t=Ah(null);for(const[r,n]of jk(e))wn(e,r)&&(Array.isArray(n)?t[r]=K$(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=Un(n):t[r]=n);return t}function Vo(e,t){for(;e!==null;){const n=F$(e,t);if(n){if(n.get)return Er(n.get);if(typeof n.value=="function")return Er(n.value)}e=L$(e)}function r(){return null}return r}const Py=Pr(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),zm=Pr(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),Lm=Pr(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Y$=Pr(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Fm=Pr(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),G$=Pr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ey=Pr(["#text"]),Ay=Pr(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Bm=Pr(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Dy=Pr(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Kc=Pr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V$=fn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),X$=fn(/<%[\w\W]*|[\w\W]*%>/gm),Q$=fn(/\$\{[\w\W]*/gm),Z$=fn(/^data-[\-\w.\u00B7-\uFFFF]+$/),J$=fn(/^aria-[\-\w]+$/),Nk=fn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),e6=fn(/^(?:\w+script|data):/i),t6=fn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),kk=fn(/^html$/i),r6=fn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Ty=Object.freeze({__proto__:null,ARIA_ATTR:J$,ATTR_WHITESPACE:t6,CUSTOM_ELEMENT:r6,DATA_ATTR:Z$,DOCTYPE_NAME:kk,ERB_EXPR:X$,IS_ALLOWED_URI:Nk,IS_SCRIPT_OR_DATA:e6,MUSTACHE_EXPR:V$,TMPLIT_EXPR:Q$});const Xo={element:1,text:3,progressingInstruction:7,comment:8,document:9},n6=function(){return typeof window>"u"?null:window},a6=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const s="data-tt-policy-suffix";r&&r.hasAttribute(s)&&(n=r.getAttribute(s));const i="dompurify"+(n?"#"+n:"");try{return t.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Iy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Sk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:n6();const t=Pe=>Sk(Pe);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==Xo.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,s=n.currentScript,{DocumentFragment:i,HTMLTemplateElement:o,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=e.NamedNodeMap||e.MozNamedAttrMap,HTMLFormElement:f,DOMParser:m,trustedTypes:p}=e,x=c.prototype,g=Vo(x,"cloneNode"),v=Vo(x,"remove"),y=Vo(x,"nextSibling"),j=Vo(x,"childNodes"),N=Vo(x,"parentNode");if(typeof o=="function"){const Pe=r.createElement("template");Pe.content&&Pe.content.ownerDocument&&(r=Pe.content.ownerDocument)}let w,k="";const{implementation:b,createNodeIterator:C,createDocumentFragment:_,getElementsByTagName:S}=r,{importNode:I}=n;let E=Iy();t.isSupported=typeof jk=="function"&&typeof N=="function"&&b&&b.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:O,ERB_EXPR:F,TMPLIT_EXPR:D,DATA_ATTR:U,ARIA_ATTR:M,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:J}=Ty;let{IS_ALLOWED_URI:R}=Ty,A=null;const z=Be({},[...Py,...zm,...Lm,...Fm,...Ey]);let K=null;const X=Be({},[...Ay,...Bm,...Dy,...Kc]);let G=Object.seal(Ah(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),T=null,P=null;const Z=Object.seal(Ah(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let L=!0,Y=!0,ae=!1,ee=!0,se=!1,V=!0,ie=!1,he=!1,xe=!1,ve=!1,Q=!1,ge=!1,De=!0,Ue=!1;const Fe="user-content-";let Ve=!0,ut=!1,Ke={},Ze=null;const tr=Be({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Ir=null;const rr=Be({},["audio","video","img","source","image","track"]);let vr=null;const nr=Be({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),yt="http://www.w3.org/1998/Math/MathML",Lt="http://www.w3.org/2000/svg",Kt="http://www.w3.org/1999/xhtml";let ar=Kt,Rn=!1,ua=null;const Oe=Be({},[yt,Lt,Kt],Rm);let pe=Be({},["mi","mo","mn","ms","mtext"]),Ne=Be({},["annotation-xml"]);const me=Be({},["title","style","font","a","script"]);let ye=null;const Xe=["application/xhtml+xml","text/html"],de="text/html";let _e=null,Te=null;const bt=r.createElement("form"),rt=function(W){return W instanceof RegExp||W instanceof Function},nt=function(){let W=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Te&&Te===W)){if((!W||typeof W!="object")&&(W={}),W=Un(W),ye=Xe.indexOf(W.PARSER_MEDIA_TYPE)===-1?de:W.PARSER_MEDIA_TYPE,_e=ye==="application/xhtml+xml"?Rm:vd,A=wn(W,"ALLOWED_TAGS")?Be({},W.ALLOWED_TAGS,_e):z,K=wn(W,"ALLOWED_ATTR")?Be({},W.ALLOWED_ATTR,_e):X,ua=wn(W,"ALLOWED_NAMESPACES")?Be({},W.ALLOWED_NAMESPACES,Rm):Oe,vr=wn(W,"ADD_URI_SAFE_ATTR")?Be(Un(nr),W.ADD_URI_SAFE_ATTR,_e):nr,Ir=wn(W,"ADD_DATA_URI_TAGS")?Be(Un(rr),W.ADD_DATA_URI_TAGS,_e):rr,Ze=wn(W,"FORBID_CONTENTS")?Be({},W.FORBID_CONTENTS,_e):tr,T=wn(W,"FORBID_TAGS")?Be({},W.FORBID_TAGS,_e):Un({}),P=wn(W,"FORBID_ATTR")?Be({},W.FORBID_ATTR,_e):Un({}),Ke=wn(W,"USE_PROFILES")?W.USE_PROFILES:!1,L=W.ALLOW_ARIA_ATTR!==!1,Y=W.ALLOW_DATA_ATTR!==!1,ae=W.ALLOW_UNKNOWN_PROTOCOLS||!1,ee=W.ALLOW_SELF_CLOSE_IN_ATTR!==!1,se=W.SAFE_FOR_TEMPLATES||!1,V=W.SAFE_FOR_XML!==!1,ie=W.WHOLE_DOCUMENT||!1,ve=W.RETURN_DOM||!1,Q=W.RETURN_DOM_FRAGMENT||!1,ge=W.RETURN_TRUSTED_TYPE||!1,xe=W.FORCE_BODY||!1,De=W.SANITIZE_DOM!==!1,Ue=W.SANITIZE_NAMED_PROPS||!1,Ve=W.KEEP_CONTENT!==!1,ut=W.IN_PLACE||!1,R=W.ALLOWED_URI_REGEXP||Nk,ar=W.NAMESPACE||Kt,pe=W.MATHML_TEXT_INTEGRATION_POINTS||pe,Ne=W.HTML_INTEGRATION_POINTS||Ne,G=W.CUSTOM_ELEMENT_HANDLING||{},W.CUSTOM_ELEMENT_HANDLING&&rt(W.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(G.tagNameCheck=W.CUSTOM_ELEMENT_HANDLING.tagNameCheck),W.CUSTOM_ELEMENT_HANDLING&&rt(W.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(G.attributeNameCheck=W.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),W.CUSTOM_ELEMENT_HANDLING&&typeof W.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(G.allowCustomizedBuiltInElements=W.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),se&&(Y=!1),Q&&(ve=!0),Ke&&(A=Be({},Ey),K=[],Ke.html===!0&&(Be(A,Py),Be(K,Ay)),Ke.svg===!0&&(Be(A,zm),Be(K,Bm),Be(K,Kc)),Ke.svgFilters===!0&&(Be(A,Lm),Be(K,Bm),Be(K,Kc)),Ke.mathMl===!0&&(Be(A,Fm),Be(K,Dy),Be(K,Kc))),W.ADD_TAGS&&(typeof W.ADD_TAGS=="function"?Z.tagCheck=W.ADD_TAGS:(A===z&&(A=Un(A)),Be(A,W.ADD_TAGS,_e))),W.ADD_ATTR&&(typeof W.ADD_ATTR=="function"?Z.attributeCheck=W.ADD_ATTR:(K===X&&(K=Un(K)),Be(K,W.ADD_ATTR,_e))),W.ADD_URI_SAFE_ATTR&&Be(vr,W.ADD_URI_SAFE_ATTR,_e),W.FORBID_CONTENTS&&(Ze===tr&&(Ze=Un(Ze)),Be(Ze,W.FORBID_CONTENTS,_e)),W.ADD_FORBID_CONTENTS&&(Ze===tr&&(Ze=Un(Ze)),Be(Ze,W.ADD_FORBID_CONTENTS,_e)),Ve&&(A["#text"]=!0),ie&&Be(A,["html","head","body"]),A.table&&(Be(A,["tbody"]),delete T.tbody),W.TRUSTED_TYPES_POLICY){if(typeof W.TRUSTED_TYPES_POLICY.createHTML!="function")throw Go('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof W.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Go('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=W.TRUSTED_TYPES_POLICY,k=w.createHTML("")}else w===void 0&&(w=a6(p,s)),w!==null&&typeof k=="string"&&(k=w.createHTML(""));Pr&&Pr(W),Te=W}},yr=Be({},[...zm,...Lm,...Y$]),sr=Be({},[...Fm,...G$]),$n=function(W){let fe=N(W);(!fe||!fe.tagName)&&(fe={namespaceURI:ar,tagName:"template"});const ke=vd(W.tagName),xt=vd(fe.tagName);return ua[W.namespaceURI]?W.namespaceURI===Lt?fe.namespaceURI===Kt?ke==="svg":fe.namespaceURI===yt?ke==="svg"&&(xt==="annotation-xml"||pe[xt]):!!yr[ke]:W.namespaceURI===yt?fe.namespaceURI===Kt?ke==="math":fe.namespaceURI===Lt?ke==="math"&&Ne[xt]:!!sr[ke]:W.namespaceURI===Kt?fe.namespaceURI===Lt&&!Ne[xt]||fe.namespaceURI===yt&&!pe[xt]?!1:!sr[ke]&&(me[ke]||!yr[ke]):!!(ye==="application/xhtml+xml"&&ua[W.namespaceURI]):!1},zn=function(W){Ko(t.removed,{element:W});try{N(W).removeChild(W)}catch{v(W)}},Cs=function(W,fe){try{Ko(t.removed,{attribute:fe.getAttributeNode(W),from:fe})}catch{Ko(t.removed,{attribute:null,from:fe})}if(fe.removeAttribute(W),W==="is")if(ve||Q)try{zn(fe)}catch{}else try{fe.setAttribute(W,"")}catch{}},Ev=function(W){let fe=null,ke=null;if(xe)W="<remove></remove>"+W;else{const At=$m(W,/^[\r\n\t ]+/);ke=At&&At[0]}ye==="application/xhtml+xml"&&ar===Kt&&(W='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+W+"</body></html>");const xt=w?w.createHTML(W):W;if(ar===Kt)try{fe=new m().parseFromString(xt,ye)}catch{}if(!fe||!fe.documentElement){fe=b.createDocument(ar,"template",null);try{fe.documentElement.innerHTML=Rn?k:xt}catch{}}const mr=fe.body||fe.documentElement;return W&&ke&&mr.insertBefore(r.createTextNode(ke),mr.childNodes[0]||null),ar===Kt?S.call(fe,ie?"html":"body")[0]:ie?fe.documentElement:mr},Av=function(W){return C.call(W.ownerDocument||W,W,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},mm=function(W){return W instanceof f&&(typeof W.nodeName!="string"||typeof W.textContent!="string"||typeof W.removeChild!="function"||!(W.attributes instanceof u)||typeof W.removeAttribute!="function"||typeof W.setAttribute!="function"||typeof W.namespaceURI!="string"||typeof W.insertBefore!="function"||typeof W.hasChildNodes!="function")},Dv=function(W){return typeof l=="function"&&W instanceof l};function fa(Pe,W,fe){Hc(Pe,ke=>{ke.call(t,W,fe,Te)})}const Tv=function(W){let fe=null;if(fa(E.beforeSanitizeElements,W,null),mm(W))return zn(W),!0;const ke=_e(W.nodeName);if(fa(E.uponSanitizeElement,W,{tagName:ke,allowedTags:A}),V&&W.hasChildNodes()&&!Dv(W.firstElementChild)&&br(/<[/\w!]/g,W.innerHTML)&&br(/<[/\w!]/g,W.textContent)||W.nodeType===Xo.progressingInstruction||V&&W.nodeType===Xo.comment&&br(/<[/\w]/g,W.data))return zn(W),!0;if(!(Z.tagCheck instanceof Function&&Z.tagCheck(ke))&&(!A[ke]||T[ke])){if(!T[ke]&&Rv(ke)&&(G.tagNameCheck instanceof RegExp&&br(G.tagNameCheck,ke)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ke)))return!1;if(Ve&&!Ze[ke]){const xt=N(W)||W.parentNode,mr=j(W)||W.childNodes;if(mr&&xt){const At=mr.length;for(let Rr=At-1;Rr>=0;--Rr){const ma=g(mr[Rr],!0);ma.__removalCount=(W.__removalCount||0)+1,xt.insertBefore(ma,y(W))}}}return zn(W),!0}return W instanceof c&&!$n(W)||(ke==="noscript"||ke==="noembed"||ke==="noframes")&&br(/<\/no(script|embed|frames)/i,W.innerHTML)?(zn(W),!0):(se&&W.nodeType===Xo.text&&(fe=W.textContent,Hc([O,F,D],xt=>{fe=Yo(fe,xt," ")}),W.textContent!==fe&&(Ko(t.removed,{element:W.cloneNode()}),W.textContent=fe)),fa(E.afterSanitizeElements,W,null),!1)},Iv=function(W,fe,ke){if(De&&(fe==="id"||fe==="name")&&(ke in r||ke in bt))return!1;if(!(Y&&!P[fe]&&br(U,fe))){if(!(L&&br(M,fe))){if(!(Z.attributeCheck instanceof Function&&Z.attributeCheck(fe,W))){if(!K[fe]||P[fe]){if(!(Rv(W)&&(G.tagNameCheck instanceof RegExp&&br(G.tagNameCheck,W)||G.tagNameCheck instanceof Function&&G.tagNameCheck(W))&&(G.attributeNameCheck instanceof RegExp&&br(G.attributeNameCheck,fe)||G.attributeNameCheck instanceof Function&&G.attributeNameCheck(fe,W))||fe==="is"&&G.allowCustomizedBuiltInElements&&(G.tagNameCheck instanceof RegExp&&br(G.tagNameCheck,ke)||G.tagNameCheck instanceof Function&&G.tagNameCheck(ke))))return!1}else if(!vr[fe]){if(!br(R,Yo(ke,re,""))){if(!((fe==="src"||fe==="xlink:href"||fe==="href")&&W!=="script"&&U$(ke,"data:")===0&&Ir[W])){if(!(ae&&!br(H,Yo(ke,re,"")))){if(ke)return!1}}}}}}}return!0},Rv=function(W){return W!=="annotation-xml"&&$m(W,J)},$v=function(W){fa(E.beforeSanitizeAttributes,W,null);const{attributes:fe}=W;if(!fe||mm(W))return;const ke={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:K,forceKeepAttr:void 0};let xt=fe.length;for(;xt--;){const mr=fe[xt],{name:At,namespaceURI:Rr,value:ma}=mr,Oi=_e(At),hm=ma;let ir=At==="value"?hm:q$(hm);if(ke.attrName=Oi,ke.attrValue=ir,ke.keepAttr=!0,ke.forceKeepAttr=void 0,fa(E.uponSanitizeAttribute,W,ke),ir=ke.attrValue,Ue&&(Oi==="id"||Oi==="name")&&(Cs(At,W),ir=Fe+ir),V&&br(/((--!?|])>)|<\/(style|title|textarea)/i,ir)){Cs(At,W);continue}if(Oi==="attributename"&&$m(ir,"href")){Cs(At,W);continue}if(ke.forceKeepAttr)continue;if(!ke.keepAttr){Cs(At,W);continue}if(!ee&&br(/\/>/i,ir)){Cs(At,W);continue}se&&Hc([O,F,D],Lv=>{ir=Yo(ir,Lv," ")});const zv=_e(W.nodeName);if(!Iv(zv,Oi,ir)){Cs(At,W);continue}if(w&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Rr)switch(p.getAttributeType(zv,Oi)){case"TrustedHTML":{ir=w.createHTML(ir);break}case"TrustedScriptURL":{ir=w.createScriptURL(ir);break}}if(ir!==hm)try{Rr?W.setAttributeNS(Rr,At,ir):W.setAttribute(At,ir),mm(W)?zn(W):Oy(t.removed)}catch{Cs(At,W)}}fa(E.afterSanitizeAttributes,W,null)},hP=function Pe(W){let fe=null;const ke=Av(W);for(fa(E.beforeSanitizeShadowDOM,W,null);fe=ke.nextNode();)fa(E.uponSanitizeShadowNode,fe,null),Tv(fe),$v(fe),fe.content instanceof i&&Pe(fe.content);fa(E.afterSanitizeShadowDOM,W,null)};return t.sanitize=function(Pe){let W=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},fe=null,ke=null,xt=null,mr=null;if(Rn=!Pe,Rn&&(Pe="<!-->"),typeof Pe!="string"&&!Dv(Pe))if(typeof Pe.toString=="function"){if(Pe=Pe.toString(),typeof Pe!="string")throw Go("dirty is not a string, aborting")}else throw Go("toString is not a function");if(!t.isSupported)return Pe;if(he||nt(W),t.removed=[],typeof Pe=="string"&&(ut=!1),ut){if(Pe.nodeName){const ma=_e(Pe.nodeName);if(!A[ma]||T[ma])throw Go("root node is forbidden and cannot be sanitized in-place")}}else if(Pe instanceof l)fe=Ev("<!---->"),ke=fe.ownerDocument.importNode(Pe,!0),ke.nodeType===Xo.element&&ke.nodeName==="BODY"||ke.nodeName==="HTML"?fe=ke:fe.appendChild(ke);else{if(!ve&&!se&&!ie&&Pe.indexOf("<")===-1)return w&&ge?w.createHTML(Pe):Pe;if(fe=Ev(Pe),!fe)return ve?null:ge?k:""}fe&&xe&&zn(fe.firstChild);const At=Av(ut?Pe:fe);for(;xt=At.nextNode();)Tv(xt),$v(xt),xt.content instanceof i&&hP(xt.content);if(ut)return Pe;if(ve){if(Q)for(mr=_.call(fe.ownerDocument);fe.firstChild;)mr.appendChild(fe.firstChild);else mr=fe;return(K.shadowroot||K.shadowrootmode)&&(mr=I.call(n,mr,!0)),mr}let Rr=ie?fe.outerHTML:fe.innerHTML;return ie&&A["!doctype"]&&fe.ownerDocument&&fe.ownerDocument.doctype&&fe.ownerDocument.doctype.name&&br(kk,fe.ownerDocument.doctype.name)&&(Rr="<!DOCTYPE "+fe.ownerDocument.doctype.name+`>
557
557
  `+Rr),se&&Hc([O,F,D],ma=>{Rr=Yo(Rr,ma," ")}),w&&ge?w.createHTML(Rr):Rr},t.setConfig=function(){let Pe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};nt(Pe),he=!0},t.clearConfig=function(){Te=null,he=!1},t.isValidAttribute=function(Pe,W,fe){Te||nt({});const ke=_e(Pe),xt=_e(W);return Iv(ke,xt,fe)},t.addHook=function(Pe,W){typeof W=="function"&&Ko(E[Pe],W)},t.removeHook=function(Pe,W){if(W!==void 0){const fe=B$(E[Pe],W);return fe===-1?void 0:W$(E[Pe],fe,1)[0]}return Oy(E[Pe])},t.removeHooks=function(Pe){E[Pe]=[]},t.removeAllHooks=function(){E=Iy()},t}var s6=Sk();function i6({onClick:e,active:t,disabled:r,title:n,children:s}){return a.jsx("button",{type:"button",title:n,disabled:r,onMouseDown:i=>{i.preventDefault(),e()},className:$("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",t&&"bg-muted text-foreground"),children:s})}function Yc(){return a.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function Ix({content:e="",onChange:t,placeholder:r="Add a description…",className:n,toolbarClassName:s,editorClassName:i}){const o=f1({extensions:[m1.configure({heading:{levels:[1,2,3]}}),h1,CE,_E.configure({nested:!0}),p1.configure({placeholder:r})],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:d}){t&&t(d.isEmpty?"":d.getHTML())}});if(!o)return null;const l=(d,u,f,m,p)=>a.jsx(i6,{title:d,onClick:f,active:m,disabled:p,children:u},d),c="h-3.5 w-3.5";return a.jsxs("div",{className:$("flex flex-col overflow-hidden",n),children:[a.jsxs("div",{className:$("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",s),children:[l("Undo",a.jsx(I5,{className:c}),()=>o.chain().focus().undo().run(),!1,!o.can().undo()),l("Redo",a.jsx(k5,{className:c}),()=>o.chain().focus().redo().run(),!1,!o.can().redo()),a.jsx(Yc,{}),l("Bold (⌘B)",a.jsx(D1,{className:c}),()=>o.chain().focus().toggleBold().run(),o.isActive("bold")),l("Italic (⌘I)",a.jsx(F1,{className:c}),()=>o.chain().focus().toggleItalic().run(),o.isActive("italic")),l("Underline (⌘U)",a.jsx(T5,{className:c}),()=>o.chain().focus().toggleUnderline().run(),o.isActive("underline")),l("Strikethrough",a.jsx(H1,{className:c}),()=>o.chain().focus().toggleStrike().run(),o.isActive("strike")),l("Inline code",a.jsx(z1,{className:c}),()=>o.chain().focus().toggleCode().run(),o.isActive("code")),a.jsx(Yc,{}),l("Heading 1",a.jsx(m5,{className:c}),()=>o.chain().focus().toggleHeading({level:1}).run(),o.isActive("heading",{level:1})),l("Heading 2",a.jsx(h5,{className:c}),()=>o.chain().focus().toggleHeading({level:2}).run(),o.isActive("heading",{level:2})),l("Heading 3",a.jsx(p5,{className:c}),()=>o.chain().focus().toggleHeading({level:3}).run(),o.isActive("heading",{level:3})),a.jsx(Yc,{}),l("Bullet list",a.jsx(sx,{className:c}),()=>o.chain().focus().toggleBulletList().run(),o.isActive("bulletList")),l("Ordered list",a.jsx(W1,{className:c}),()=>o.chain().focus().toggleOrderedList().run(),o.isActive("orderedList")),l("Task list",a.jsx(v5,{className:c}),()=>o.chain().focus().toggleTaskList().run(),o.isActive("taskList")),a.jsx(Yc,{}),l("Blockquote",a.jsx(N5,{className:c}),()=>o.chain().focus().toggleBlockquote().run(),o.isActive("blockquote")),l("Code block",a.jsx($1,{className:c}),()=>o.chain().focus().toggleCodeBlock().run(),o.isActive("codeBlock")),l("Divider line",a.jsx(za,{className:c}),()=>o.chain().focus().setHorizontalRule().run())]}),a.jsx(x1,{editor:o,className:$("flex-1 px-5 py-4",i)})]})}function Rx({html:e,className:t}){return e?a.jsx("div",{className:$("meridian-editor",t),dangerouslySetInnerHTML:{__html:s6.sanitize(e,{ADD_ATTR:["data-type","data-id","data-label"]})}}):null}const Ry=[{bg:"bg-indigo-100 dark:bg-indigo-900/50",text:"text-indigo-700 dark:text-indigo-300"},{bg:"bg-violet-100 dark:bg-violet-900/50",text:"text-violet-700 dark:text-violet-300"},{bg:"bg-emerald-100 dark:bg-emerald-900/50",text:"text-emerald-700 dark:text-emerald-300"},{bg:"bg-amber-100 dark:bg-amber-900/50",text:"text-amber-700 dark:text-amber-300"},{bg:"bg-rose-100 dark:bg-rose-900/50",text:"text-rose-700 dark:text-rose-300"},{bg:"bg-sky-100 dark:bg-sky-900/50",text:"text-sky-700 dark:text-sky-300"},{bg:"bg-teal-100 dark:bg-teal-900/50",text:"text-teal-700 dark:text-teal-300"},{bg:"bg-orange-100 dark:bg-orange-900/50",text:"text-orange-700 dark:text-orange-300"}];function $x(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)&65535;return Ry[t%Ry.length]}function o6({body:e}){const t=e.trim();return t?/^<[a-z][\s\S]*>/i.test(t)?a.jsx(Rx,{html:t,className:"text-xs"}):a.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:t}):null}const $y={created:{icon:dt,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:Zp,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:ho,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:K1,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:si,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function l6(e,t){var s,i,o,l;const{action:r,changes:n}=e;if(r==="created")return"created this issue";if(r==="status_changed"){const c=(s=n==null?void 0:n.status)==null?void 0:s.from,d=(i=n==null?void 0:n.status)==null?void 0:i.to;return a.jsxs(a.Fragment,{children:["changed status",c&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:ci[c]??c})]}),d&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:ci[d]??d})]})]})}if(r==="assigned"||r==="unassigned"){const c=((o=n==null?void 0:n.assignee_ids)==null?void 0:o.to)??[],d=((l=n==null?void 0:n.assignee_ids)==null?void 0:l.from)??[],u=c.filter(p=>!d.includes(p)),f=d.filter(p=>!c.includes(p)),m=p=>{var x;return((x=t==null?void 0:t.get(p))==null?void 0:x.name)??p.slice(0,8)+"…"};return u.length>0&&f.length>0?a.jsx(a.Fragment,{children:"updated assignees"}):u.length>0?a.jsxs(a.Fragment,{children:["assigned ",a.jsx("strong",{className:"font-medium text-foreground",children:u.map(m).join(", ")})]}):f.length>0?a.jsxs(a.Fragment,{children:["unassigned ",a.jsx("strong",{className:"font-medium text-foreground",children:f.map(m).join(", ")})]}):"updated assignees"}if(r==="updated"&&n){const c=[];for(const[d,u]of Object.entries(n)){const{from:f,to:m}=u;d==="title"||d==="description"?c.push(a.jsxs("span",{children:["updated ",a.jsx("strong",{className:"font-medium text-foreground",children:d})]},d)):d==="priority"?c.push(a.jsxs("span",{children:["changed ",a.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),f!=null&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:tn[f]??String(f)})]}),m!=null&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:tn[m]??String(m)})]})]},d)):d==="type"?c.push(a.jsxs("span",{children:["changed ",a.jsx("strong",{className:"font-medium text-foreground",children:"type"}),f!=null&&a.jsxs(a.Fragment,{children:[" from ",a.jsx("strong",{className:"font-medium text-foreground",children:_a[f]??String(f)})]}),m!=null&&a.jsxs(a.Fragment,{children:[" to ",a.jsx("strong",{className:"font-medium text-foreground",children:_a[m]??String(m)})]})]},d)):c.push(a.jsxs("span",{children:["updated ",a.jsx("strong",{className:"font-medium text-foreground",children:d.replace(/_/g," ")})]},d))}return c.length===0?"made changes":a.jsx(a.Fragment,{children:c.reduce((d,u,f)=>f===0?[u]:[...d,a.jsx("span",{children:" and "},`sep-${f}`),u],[])})}return r.replace(/_/g," ")}function Ck({issueId:e,projectId:t,className:r,compact:n,onViewMore:s,onTabChange:i,hideCommentInput:o}){const[l,c]=h.useState("comments"),d=w=>{c(w),i==null||i(w)},u=h.useRef(null),f=h.useRef(null),{user:m}=Ie(),{data:p}=js(),{data:x,isLoading:g}=ZA(e),{data:v,isLoading:y}=JA(e),{data:j}=gk(e);h.useEffect(()=>{var k;const w=x==null?void 0:x.length;w!==void 0&&(f.current!==null&&w>f.current&&((k=u.current)==null||k.scrollIntoView({behavior:"smooth",block:"nearest"})),f.current=w)},[x==null?void 0:x.length]);const N=w=>{var k;if(m&&w===m.id){const b=m.first_name??"",C=m.last_name??"",_=`${b} ${C}`.trim()||m.email,S=(b[0]??C[0]??((k=m.email)==null?void 0:k[0])??"U").toUpperCase();return{name:_,initials:S}}return(p==null?void 0:p.get(w))??{name:"Unknown",initials:"?"}};return a.jsxs("div",{className:r,children:[a.jsx("div",{className:"flex items-center gap-0 px-6 pt-3 border-b border-zinc-100 dark:border-zinc-800",children:["comments","activity","attachments","time"].map(w=>{const k=w==="comments"?(x==null?void 0:x.length)??0:w==="activity"?(v==null?void 0:v.length)??0:void 0,b=w==="comments"?"Comments":w==="activity"?"Activity":w==="attachments"?"Attachments":"Time",C=l===w;return a.jsxs("button",{onClick:()=>d(w),className:$("pb-2.5 mr-5 text-xs font-medium transition-colors border-b-2 -mb-px",C?"text-indigo-700 dark:text-indigo-300 border-indigo-500 dark:border-indigo-400":"border-transparent text-zinc-500 dark:text-zinc-400 hover:text-zinc-800 dark:hover:text-zinc-200"),children:[b,k!=null&&k>0&&a.jsx("span",{className:$("ml-1.5 text-[10px] tabular-nums font-normal",C?"text-indigo-700 dark:text-indigo-500":"text-zinc-400"),children:k})]},w)})}),l==="comments"&&a.jsxs("div",{className:"px-6 pb-5 pt-4",children:[a.jsx("div",{className:"space-y-5 mb-5",children:g?a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ce,{className:"h-7 w-7 rounded-full shrink-0"}),a.jsx(ce,{className:"h-16 flex-1"})]}):x&&x.length>0?(n?x.slice(-5):x).map(w=>{const k=N(w.author_id),b=$x(k.name),C=(j??[]).filter(_=>_.comment_id===w.id);return a.jsxs("div",{className:"flex gap-3",children:[a.jsx(Rt,{className:"h-7 w-7 mt-0.5 shrink-0",children:a.jsx($t,{className:$("text-[11px] font-semibold",b.bg,b.text),children:k.initials})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[a.jsx("span",{className:"text-xs font-semibold text-zinc-900 dark:text-zinc-100",children:k.name}),a.jsx("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:ue(new Date(w.created_at),"MMM d, h:mm a")})]}),a.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900 border border-zinc-100 dark:border-zinc-800 px-3 py-2.5",children:a.jsx(o6,{body:w.body})}),C.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:C.map(_=>a.jsx(x$,{attachment:_},_.id))})]})]},w.id)}):a.jsxs("div",{className:"flex flex-col items-center py-6 gap-2",children:[a.jsx("div",{className:"h-9 w-9 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:a.jsx(U1,{className:"h-4 w-4 text-zinc-400 dark:text-zinc-500"})}),a.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500",children:"No comments yet"})]})}),n&&x&&x.length>5&&s&&a.jsxs("button",{onClick:s,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mb-4 font-medium transition-colors",children:["View all ",x.length," comments →"]}),a.jsx("div",{ref:u}),!o&&a.jsx(wk,{issueId:e,projectId:t})]}),l==="activity"&&a.jsx("div",{className:"px-6 pb-6 pt-4",children:y?a.jsx("div",{className:"space-y-4",children:[1,2,3].map(w=>a.jsxs("div",{className:"flex gap-3",children:[a.jsx(ce,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),a.jsx(ce,{className:"h-4 flex-1 mt-1"})]},w))}):v&&v.length>0?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"relative",children:[a.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-zinc-100 dark:bg-zinc-800"}),a.jsx("div",{className:"space-y-0",children:(n?v.slice(-5):v).map((w,k,b)=>{var E;const C=$y[w.action]??$y.updated,_=C.icon,S=((E=p==null?void 0:p.get(w.actor_id))==null?void 0:E.name)??"System",I=k===b.length-1;return a.jsxs("div",{className:$("relative flex gap-3",I?"pb-0":"pb-4"),children:[a.jsx("div",{className:$("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",C.bg),children:a.jsx(_,{className:$("h-3 w-3",C.color)})}),a.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[a.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[a.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:S})," ",a.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:l6(w,p)})]}),a.jsx("p",{className:"text-[11px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:ue(new Date(w.created_at),"MMM d, yyyy · h:mm a")})]})]},w.id)})})]}),n&&v.length>5&&s&&a.jsxs("button",{onClick:s,className:"text-xs text-indigo-700 hover:text-indigo-900 dark:text-indigo-300 dark:hover:text-indigo-100 mt-3 font-medium transition-colors",children:["View all ",v.length," events →"]})]}):a.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500 py-4",children:"No activity yet."})}),l==="attachments"&&a.jsx(y$,{issueId:e}),l==="time"&&a.jsx(P$,{issueId:e})]})}const _k=h.forwardRef(({className:e,children:t,...r},n)=>a.jsxs(n1,{ref:n,className:$("relative overflow-hidden",e),...r,children:[a.jsx(qP,{className:"h-full w-full rounded-[inherit]",children:t}),a.jsx(Mk,{}),a.jsx(HP,{})]}));_k.displayName=n1.displayName;const Mk=h.forwardRef(({className:e,orientation:t="vertical",...r},n)=>a.jsx(a1,{ref:n,orientation:t,className:$("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-1.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-1.5 flex-col border-t border-t-transparent p-[1px]",e),...r,children:a.jsx(KP,{className:"relative flex-1 rounded-full bg-border"})}));Mk.displayName=a1.displayName;function c6(e,t){let r=0,n=e;for(;n!=null&&n.parent_id;)n=t.find(s=>s.id===n.parent_id),r++;return r}function d6(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?ue(new Date(e.start_date),"MMM d"):"—",r=e.end_date?ue(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}const u6={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-sky-500",no_priority:"bg-zinc-400"};function f6(e,t){return e==="completed"?"bg-emerald-500":e==="in_progress"?"bg-indigo-500":e==="cancelled"?"bg-red-400":t!=null&&t.includes("block")?"bg-red-500":"bg-zinc-400"}const Ln=({children:e})=>a.jsx("p",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100 mb-1.5",children:e}),Qo=()=>a.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800"});function Ok({issue:e,projectId:t,open:r,onClose:n}){const s=pt(),{workspace:i,projectKey:o}=zt(),{data:l}=P1((e==null?void 0:e.id)??""),c=l??e,[d,u]=h.useState(!1),[f,m]=h.useState(""),[p,x]=h.useState(""),[g,v]=h.useState("comments"),[y,j]=h.useState(!1),[N,w]=h.useState(new Set),k=$u((c==null?void 0:c.id)??"",t),{data:b}=oa(t),C=h.useMemo(()=>b?b.members.filter(Q=>Q.user).map(Q=>Q.user):void 0,[b]),{data:_}=jo(t),{data:S}=ko(t||void 0),{data:I}=fc(t||void 0),{data:E}=Vl(t||void 0),{data:O}=Sx(),{data:F=[]}=Cx(new Date().getFullYear()),D=(S??[]).filter(Q=>Q.status!=="completed"),{data:U}=x4(),M=(U==null?void 0:U.maxChildIssueDepth)??1,re=(c?c6(c,E??[]):0)<M,J=c!=null&&c.parent_id?E==null?void 0:E.find(Q=>Q.id===c.parent_id):null,R=(E==null?void 0:E.filter(Q=>Q.parent_id===(c==null?void 0:c.id)))??[],A=c!=null&&c.task_list_id?I==null?void 0:I.find(Q=>Q.id===c.task_list_id):null,z=_&&_.length>0?Object.fromEntries(_.map(Q=>[Q.key,Q.name])):ci;if(h.useEffect(()=>{c&&(m(c.title),x(c.description??"")),u(!1)},[c==null?void 0:c.id]),!c)return null;const K=()=>{f.trim()&&k.mutate({title:f.trim(),description:p.trim()||void 0},{onSuccess:()=>{u(!1),q.success("Issue updated")},onError:()=>q.error("Failed to update issue")})},X=()=>{m(c.title),x(c.description??""),u(!1)},G=Q=>{k.mutate({status:Q},{onSuccess:()=>q.success("Status updated"),onError:()=>q.error("Failed to update status")})},T=Q=>{k.mutate({priority:Q},{onSuccess:()=>q.success("Priority updated"),onError:()=>q.error("Failed to update priority")})},P=Q=>{k.mutate({type:Q},{onSuccess:()=>q.success("Type updated"),onError:()=>q.error("Failed to update type")})},Z=Q=>{k.mutate({assignee_ids:Q},{onSuccess:()=>q.success("Assignees updated"),onError:()=>q.error("Failed to update assignees")})},L=Q=>{k.mutate({sprint_id:Q},{onSuccess:()=>q.success(Q?"Sprint assigned":"Removed from sprint"),onError:()=>q.error("Failed to update sprint")})},Y=Q=>{k.mutate({task_list_id:Q},{onSuccess:()=>q.success(Q?"Moved to list":"Removed from list"),onError:()=>q.error("Failed to update list")})},ae=Q=>{k.mutate({start_date:Q?ue(Q,"yyyy-MM-dd"):null},{onSuccess:()=>q.success(Q?"Start date set":"Start date cleared"),onError:()=>q.error("Failed to update start date")})},ee=Q=>{k.mutate({due_date:Q?ue(Q,"yyyy-MM-dd"):null},{onSuccess:()=>q.success(Q?"Due date set":"Due date cleared"),onError:()=>q.error("Failed to update due date")})},se=Q=>{if(Q){const ge=c.start_date?new Date(c.start_date):new Date,De=new Date(ge);De.setDate(De.getDate()+7),k.mutate({recurrence_frequency:"weekly",next_occurrence_date:ue(De,"yyyy-MM-dd"),recurrence_end_date:null},{onSuccess:()=>q.success("Recurrence enabled"),onError:()=>q.error("Failed to enable recurrence")})}else k.mutate({recurrence_frequency:null,next_occurrence_date:null,recurrence_end_date:null},{onSuccess:()=>q.success("Recurrence stopped"),onError:()=>q.error("Failed to stop recurrence")})},V=Q=>{const ge=c.start_date?new Date(c.start_date):new Date,De=new Date(ge);Q==="weekly"?De.setDate(De.getDate()+7):De.setMonth(De.getMonth()+1),k.mutate({recurrence_frequency:Q,next_occurrence_date:ue(De,"yyyy-MM-dd")},{onSuccess:()=>q.success("Frequency updated"),onError:()=>q.error("Failed to update frequency")})},ie=Q=>{k.mutate({recurrence_end_date:Q?ue(Q,"yyyy-MM-dd"):null},{onSuccess:()=>q.success(Q?"End date set":"End date cleared"),onError:()=>q.error("Failed to update end date")})},he=_==null?void 0:_.find(Q=>Q.category==="completed"),xe=!!he&&c.status===he.key,ve=(Q,ge,De)=>{const Ue=Q;return a.jsx("button",{title:ge,onClick:De,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:a.jsx(Ue,{className:"h-4 w-4"})},ge)};return a.jsxs(a.Fragment,{children:[a.jsx(Ni,{open:r,onOpenChange:Q=>!Q&&n(),children:a.jsxs(ki,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden bg-white dark:bg-zinc-950",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[a.jsxs("button",{onClick:()=>{var Q;he&&G(xe?((Q=_==null?void 0:_.find(ge=>ge.category==="unstarted"||ge.category==="backlog"))==null?void 0:Q.key)??c.status:he.key)},className:$("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",xe?"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:[a.jsx(dr,{className:"h-3.5 w-3.5"}),xe?"Completed":"Mark complete"]}),a.jsxs("div",{className:"flex items-center",children:[ve(E5,"Upvote"),ve(ix,"Attachments"),re&&ve(Zn,"Add sub-issue",()=>j(!0)),ve(ni,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${i}/projects/${o}/issues/${c.id}`),q.success("Link copied")}),ve(y5,"Open full page",()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)}),d?a.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[a.jsx(ne,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:X,children:"Cancel"}),a.jsxs(ne,{size:"sm",className:"h-7 text-xs",onClick:K,disabled:!f.trim()||k.isPending,children:[a.jsx(dr,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):a.jsxs(Hr,{children:[a.jsx(Kr,{asChild:!0,children:ve(Ca,"More options")}),a.jsx(Or,{align:"end",className:"w-40",children:a.jsxs(at,{onClick:()=>u(!0),children:[a.jsx(si,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),ve(j5,"Open in full page",()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)})]})]}),a.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:d?a.jsx(Ae,{value:f,onChange:Q=>m(Q.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[a.jsx("span",{className:"text-[11px] font-mono font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/60 px-1.5 py-0.5 rounded",children:c.identifier}),a.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase text-violet-500 dark:text-violet-400",children:_a[c.type]??c.type}),c.recurrence_frequency&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-emerald-700 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-950/50 border border-emerald-200 dark:border-emerald-800 px-1.5 py-0.5 rounded",children:[a.jsx(Gi,{className:"h-2.5 w-2.5"}),"Repeats ",c.recurrence_frequency==="weekly"?"Weekly":"Monthly"]}),c.recurrence_source_id&&a.jsxs("span",{className:"inline-flex items-center gap-1 text-[10px] font-medium text-zinc-500 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded",children:[a.jsx(Gi,{className:"h-2.5 w-2.5"}),"Recurring instance"]})]}),a.jsx("h2",{className:"text-[17px] font-semibold leading-snug text-zinc-900 dark:text-zinc-50",children:c.title})]})}),a.jsxs(_k,{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"px-6 pb-4 space-y-5 min-w-0",children:[a.jsx(Sr,{zone:"issue.details.before",props:{issue:c}}),a.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(Ln,{children:"Status"}),a.jsxs(Le,{value:c.status,onValueChange:G,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(z).map(([Q,ge])=>{const De=_==null?void 0:_.find(Ue=>Ue.key===Q);return a.jsx(we,{value:Q,className:"text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:$("h-2 w-2 rounded-full shrink-0 flex-none",f6(De==null?void 0:De.category,Q))}),a.jsx("span",{children:ge})]})},Q)})})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(Ln,{children:"Priority"}),a.jsxs(Le,{value:c.priority,onValueChange:T,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(tn).map(([Q,ge])=>a.jsx(we,{value:Q,className:"text-xs",children:a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:$("h-2 w-2 rounded-full shrink-0 flex-none",u6[Q]??"bg-zinc-400")}),a.jsx("span",{children:ge})]})},Q))})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx(Ln,{children:"Type"}),a.jsxs(Le,{value:c.type,onValueChange:P,children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsx(qe,{})}),a.jsx(ze,{children:Object.entries(_a).map(([Q,ge])=>a.jsx(we,{value:Q,className:"text-xs",children:ge},Q))})]})]})]}),a.jsx(Qo,{}),a.jsxs("div",{children:[a.jsx(Ln,{children:"Assignees"}),a.jsx(mc,{value:c.assignee_ids??[],onChange:Z,disabled:k.isPending,users:C})]}),a.jsx(Qo,{}),a.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Ln,{children:"Sprint"}),a.jsxs(Le,{value:c.sprint_id??"none",onValueChange:Q=>L(Q==="none"?null:Q),children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[a.jsx(qr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx(qe,{placeholder:"No sprint"})]})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),D.map(Q=>{const ge=d6(Q);return a.jsx(we,{value:Q.id,className:"text-xs",children:a.jsxs("div",{className:"flex items-baseline gap-1.5",children:[a.jsx("span",{children:Q.name}),ge&&a.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:ge})]})},Q.id)})]})]})]}),(I??[]).length>0&&a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Ln,{children:"List"}),a.jsxs(Le,{value:c.task_list_id??"none",onValueChange:Q=>Y(Q==="none"?null:Q),children:[a.jsx($e,{className:"h-8 text-xs min-w-0",children:a.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[a.jsx(ax,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx(qe,{placeholder:"No list",children:A?A.name:"No list"})]})}),a.jsxs(ze,{children:[a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(I??[]).map(Q=>a.jsx(we,{value:Q.id,className:"text-xs",children:Q.name},Q.id))]})]})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Ln,{children:"Start Date"}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:`truncate ${c.start_date?"text-foreground":"text-muted-foreground"}`,children:c.start_date?ue(new Date(c.start_date),"MMM d, yyyy"):"No date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.start_date?new Date(c.start_date):void 0,onSelect:ae,initialFocus:!0}),c.start_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ae(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})]}),(c==null?void 0:c.start_date)&&(c==null?void 0:c.due_date)&&(O==null?void 0:O.working_days)&&(()=>{const Q=Oh(new Date(c.start_date),new Date(c.due_date),O.working_days,F);return a.jsxs("div",{className:"shrink-0 self-end pb-1 text-[11px] text-muted-foreground whitespace-nowrap",children:[Q," biz day",Q!==1?"s":""]})})(),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx(Ln,{children:"Due Date"}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-8 w-full min-w-0 px-2 rounded border border-input text-xs hover:bg-accent transition-colors overflow-hidden",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:`truncate ${c.due_date?"text-foreground":"text-muted-foreground"}`,children:c.due_date?ue(new Date(c.due_date),"MMM d, yyyy"):"No date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.due_date?new Date(c.due_date):void 0,onSelect:ee,initialFocus:!0}),c.due_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ee(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),a.jsx(Qo,{}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(Ln,{children:"Recurring"}),a.jsx(So,{checked:!!c.recurrence_frequency,onCheckedChange:se,disabled:k.isPending})]}),c.recurrence_frequency&&a.jsxs("div",{className:"space-y-2 pl-3 border-l-2 border-indigo-200 dark:border-indigo-800",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:"Frequency"}),a.jsxs(Le,{value:c.recurrence_frequency,onValueChange:Q=>V(Q),children:[a.jsx($e,{className:"h-7 text-xs",children:a.jsx(qe,{})}),a.jsxs(ze,{children:[a.jsx(we,{value:"weekly",className:"text-xs",children:"Weekly"}),a.jsx(we,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:["Until ",a.jsx("span",{className:"font-normal",children:"(optional)"})]}),a.jsxs(Ot,{children:[a.jsx(Pt,{asChild:!0,children:a.jsxs("button",{className:"flex items-center gap-1 h-7 w-full px-2 rounded border border-input text-xs hover:bg-accent transition-colors text-left",children:[a.jsx(Wt,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),a.jsx("span",{className:c.recurrence_end_date?"text-foreground":"text-muted-foreground",children:c.recurrence_end_date?ue(new Date(c.recurrence_end_date),"MMM d, yyyy"):"No end date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",children:[a.jsx(gr,{mode:"single",selected:c.recurrence_end_date?new Date(c.recurrence_end_date):void 0,onSelect:ie,initialFocus:!0}),c.recurrence_end_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>ie(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear end date"]})})]})]})]})]})]}),a.jsx(Qo,{}),re&&a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100",children:"Child Issues"}),a.jsxs("button",{onClick:()=>j(!0),className:"flex items-center gap-1 px-2 py-0.5 rounded-md bg-indigo-50 dark:bg-indigo-950/50 text-indigo-700 dark:text-indigo-300 text-[11px] font-medium hover:bg-indigo-100 dark:hover:bg-indigo-900/60 transition-colors",children:[a.jsx(dt,{className:"h-3 w-3"}),"Add"]})]}),J&&a.jsxs("button",{onClick:()=>s(`/${i}/projects/${o}/issues/${J.id}`),className:"flex items-center gap-2 w-full px-3 py-1.5 rounded-md bg-zinc-100 dark:bg-zinc-800/60 border border-zinc-200 dark:border-zinc-700 hover:border-indigo-300 dark:hover:border-indigo-700 transition-colors text-left",children:[a.jsx(Jp,{className:"h-3.5 w-3.5 text-zinc-400 shrink-0"}),a.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-400 shrink-0",children:"Parent:"}),a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:J.identifier}),a.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-300 truncate",children:J.title})]}),R.length===0?a.jsxs("button",{onClick:()=>j(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[a.jsx(dt,{className:"h-3.5 w-3.5"}),"Create child issue"]}):a.jsx("div",{className:"space-y-1",children:R.map(Q=>{const ge=(E??[]).filter(Fe=>Fe.parent_id===Q.id),De=ge.length>0,Ue=N.has(Q.id);return a.jsxs("div",{children:[a.jsxs("div",{className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/40 dark:bg-indigo-950/30 border border-indigo-200 dark:border-indigo-800 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all group",children:[De?a.jsx("button",{onClick:()=>w(Fe=>{const Ve=new Set(Fe);return Ve.has(Q.id)?Ve.delete(Q.id):Ve.add(Q.id),Ve}),className:"shrink-0 text-indigo-400 dark:text-indigo-500 hover:text-indigo-600 dark:hover:text-indigo-300 transition-colors",children:Ue?a.jsx(sa,{className:"h-3.5 w-3.5"}):a.jsx(Cr,{className:"h-3.5 w-3.5"})}):a.jsx(_n,{className:"h-3.5 w-3.5 text-indigo-400 dark:text-indigo-500 shrink-0"}),a.jsxs("button",{onClick:()=>{n(),s(`/${i}/projects/${o}/issues/${Q.id}`)},className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:[a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:Q.identifier}),a.jsx("span",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:Q.title}),De&&a.jsxs("span",{className:"ml-auto shrink-0 flex items-center gap-0.5 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[a.jsx(_n,{className:"h-2.5 w-2.5"}),ge.length]})]})]}),De&&Ue&&a.jsx("div",{className:"mt-1 ml-6 space-y-1",children:ge.map(Fe=>a.jsxs("button",{onClick:()=>{n(),s(`/${i}/projects/${o}/issues/${Fe.id}`)},className:"w-full flex items-center gap-2.5 px-3 py-2 rounded-lg bg-indigo-50/20 dark:bg-indigo-950/20 border border-indigo-100 dark:border-indigo-900 hover:bg-indigo-100/70 hover:border-indigo-400 dark:hover:bg-indigo-950/50 dark:hover:border-indigo-600 hover:shadow-sm transition-all text-left group",children:[a.jsx(_n,{className:"h-3.5 w-3.5 text-indigo-300 dark:text-indigo-600 shrink-0"}),a.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-600 dark:text-indigo-400 shrink-0",children:Fe.identifier}),a.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-400 truncate group-hover:text-zinc-900 dark:group-hover:text-zinc-100 transition-colors",children:Fe.title})]},Fe.id))})]},Q.id)})})]}),a.jsx(Qo,{}),a.jsxs("div",{children:[a.jsx(Ln,{children:"Description"}),d?a.jsx(Ix,{content:p,onChange:x,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input"},`${c.id}-edit`):c.description?a.jsx("div",{className:"rounded-lg bg-zinc-50 dark:bg-zinc-900/60 border border-zinc-100 dark:border-zinc-800 px-3.5 py-3",children:a.jsx(Rx,{html:c.description,className:"text-sm"})}):a.jsxs("button",{onClick:()=>u(!0),className:"w-full flex items-center justify-center gap-2 py-3.5 rounded-lg border-2 border-dashed border-zinc-200 dark:border-zinc-800 text-xs text-zinc-400 dark:text-zinc-500 hover:border-indigo-300 hover:text-indigo-500 dark:hover:border-indigo-700 dark:hover:text-indigo-400 transition-all",children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Add description"]})]})]}),a.jsx("div",{className:"px-6 py-4",children:a.jsx(Sr,{zone:"issue.details.after",props:{issue:c}})}),a.jsx(Ck,{issueId:c.id,projectId:t,className:"border-t border-border",compact:!0,hideCommentInput:!0,onTabChange:v,onViewMore:()=>{n(),s(`/${i}/projects/${o}/issues/${c.id}`)}})]}),g==="comments"&&a.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:a.jsx(wk,{issueId:c.id,projectId:t,compact:!0})})]})}),a.jsx(lf,{open:y,onClose:()=>j(!1),projectId:t,defaultParentId:c.id,defaultTaskListId:c.task_list_id})]})}function m6(){const{projectKey:e,workspace:t}=zt(),r=iN(),[n,s]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState({}),{data:d}=La(e??""),u=(d==null?void 0:d.id)??"",{data:f,isLoading:m}=Vl(u||void 0,l),{data:p,isLoading:x}=jo(u||void 0),{data:g}=oa(u),{data:v}=js(),y=HI(u),j=h.useMemo(()=>!(g!=null&&g.members)||!v?[]:g.members.map(k=>{const b=v.get(k.user_id);return b?{userId:k.user_id,name:b.name,initials:b.initials}:null}).filter(k=>k!==null),[g,v]);if(r&&e&&t)return a.jsx(Vn,{to:`/${t}/projects/${e}/issues`,replace:!0});if(!e)return null;const N=m||x||!d,w=k=>{y.mutate(k)};return a.jsxs("div",{className:"flex flex-col h-full gap-0",children:[a.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[a.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border shrink-0",children:[a.jsx(d4,{statuses:p??[],members:j,filters:l,onChange:c}),a.jsxs(ne,{size:"sm",onClick:()=>o(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]}),a.jsx(Sr,{zone:"project.board.before",props:{projectId:u}}),a.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:N?a.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(k=>a.jsxs("div",{className:"min-w-[260px]",children:[a.jsx(ce,{className:"h-5 w-24 mb-3 rounded"}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(ce,{className:"h-[82px] w-full rounded-lg"}),a.jsx(ce,{className:"h-[82px] w-full rounded-lg"})]})]},k))}):a.jsx(qN,{issues:f??[],projectId:u,statuses:p??[],onIssueClick:s,onColumnsReorder:w,filters:l})})]}),a.jsx(Sr,{zone:"project.board.after",props:{projectId:u}}),a.jsx(Ok,{issue:n,projectId:u,open:!!n,onClose:()=>s(null)}),a.jsx(lf,{open:i,onClose:()=>o(!1),projectId:u})]})}const Ih=({priority:e,className:t})=>{const r=$("h-3.5 w-3.5 shrink-0",uc[e],t);switch(e){case"urgent":return a.jsx(ia,{className:r});case"high":return a.jsx(bi,{className:r});case"medium":return a.jsx(za,{className:r});case"low":return a.jsx(yi,{className:r});default:return a.jsx(_r,{className:$("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}},Rh="grid-cols-[70px_250px_150px_120px_130px_140px_130px_32px]";function Pk({issue:e,projectId:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:d=!1,children:u=[],childrenMap:f,onAddChild:m}){const p=pt(),[x,g]=h.useState(null),[v,y]=h.useState(!1),j=$u(e.id,t),{data:N}=oa(t),w=h.useMemo(()=>N?N.members.filter(S=>S.user).map(S=>S.user):void 0,[N]);function k(S){j.mutate(S),g(null)}const b=(s==null?void 0:s[e.status])??"#94a3b8",C=i.find(S=>S.id===e.sprint_id),_=u.length>0;return a.jsxs(a.Fragment,{children:[a.jsxs("div",{onClick:()=>c(e),className:$(`group grid ${Rh} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",d&&"bg-muted/10",j.isPending&&"opacity-70"),children:[a.jsx("span",{className:$("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 pl-6 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",d&&"text-muted-foreground"),children:e.identifier}),a.jsxs("div",{className:$("flex items-center gap-1 min-w-0 pr-3","sticky left-[70px] z-10 transition-colors","bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30",d&&"bg-white dark:bg-muted/20"),children:[_?a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:a.jsx("button",{onClick:S=>{S.stopPropagation(),y(!v)},className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:v?a.jsx(sa,{className:"h-3.5 w-3.5"}):a.jsx(Cr,{className:"h-3.5 w-3.5"})})}),a.jsx(Cn,{side:"top",children:v?"Collapse":"Expand"})]}):d?a.jsx(_n,{className:"h-3 w-3 text-muted-foreground shrink-0"}):a.jsx("span",{className:"w-4 shrink-0"}),a.jsx("span",{className:$("text-sm text-foreground truncate",d&&"text-primary"),children:e.title}),_&&a.jsxs("span",{className:"shrink-0 flex items-center gap-0.5 ml-1 text-[10px] font-medium text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 px-1 py-0.5 rounded",children:[a.jsx(_n,{className:"h-2.5 w-2.5"}),u.length]})]}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="status",onOpenChange:S=>g(S?"status":null),children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:b}}),a.jsx("span",{className:"text-xs text-primary truncate",children:n[e.status]??e.status})]})}),a.jsx(_t,{className:"w-52 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Vs,{children:a.jsx(Xs,{children:a.jsx(is,{children:r.map(S=>a.jsxs(dn,{value:S.name,onSelect:()=>k({status:S.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:S.color}}),a.jsx("span",{className:"text-xs flex-1",children:S.name}),e.status===S.key&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]},S.key))})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="priority",onOpenChange:S=>g(S?"priority":null),children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(Ih,{priority:e.priority}),a.jsx("span",{className:"text-xs text-primary",children:tn[e.priority]??e.priority})]})}),a.jsx(_t,{className:"w-44 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Vs,{children:a.jsx(Xs,{children:a.jsx(is,{children:Object.entries(tn).map(([S,I])=>a.jsxs(dn,{value:I,onSelect:()=>k({priority:S}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(Ih,{priority:S}),a.jsx("span",{className:"text-xs flex-1",children:I}),e.priority===S&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]},S))})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="sprint",onOpenChange:S=>g(S?"sprint":null),children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(qr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:$("text-xs truncate",C?"text-foreground":"text-muted-foreground"),children:(C==null?void 0:C.name)??"No sprint"})]})}),a.jsx(_t,{className:"w-56 p-1",align:"start",onClick:S=>S.stopPropagation(),children:a.jsx(Vs,{children:a.jsx(Xs,{children:a.jsxs(is,{children:[a.jsxs(dn,{value:"no-sprint",onSelect:()=>k({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(tt,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500"})]}),i.filter(S=>S.status!=="completed").map(S=>a.jsxs(dn,{value:S.name,onSelect:()=>k({sprint_id:S.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[a.jsx(qr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-xs truncate",children:S.name}),(S.start_date||S.end_date)&&a.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[S.start_date?ue(new Date(S.start_date),"MMM d"):"—"," → ",S.end_date?ue(new Date(S.end_date),"MMM d"):"—"]})]}),e.sprint_id===S.id&&a.jsx(dr,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},S.id))]})})})})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsxs(Ot,{open:x==="due",onOpenChange:S=>g(S?"due":null),children:[a.jsx(Pt,{asChild:!0,children:a.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:[a.jsx(Wt,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),a.jsx("span",{className:$("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?ue(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),a.jsxs(_t,{className:"w-auto p-0",align:"start",onClick:S=>S.stopPropagation(),children:[a.jsx(gr,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:S=>k({due_date:S?ue(S,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&a.jsx("div",{className:"border-t px-3 py-2",children:a.jsxs("button",{onClick:()=>k({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[a.jsx(tt,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),a.jsx("div",{onClick:S=>S.stopPropagation(),children:a.jsx(mc,{value:e.assignee_ids??[],onChange:S=>j.mutate({assignee_ids:S}),users:w})}),a.jsxs("div",{className:"flex items-center gap-1 pr-6",onClick:S=>S.stopPropagation(),children:[!d&&m&&a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:a.jsx("button",{onClick:()=>m(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:a.jsx(_n,{className:"h-3.5 w-3.5"})})}),a.jsx(Cn,{side:"top",children:"Add child issue"})]}),a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:a.jsx("button",{onClick:()=>p(`/${o}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:a.jsx(nx,{className:"h-3.5 w-3.5"})})}),a.jsx(Cn,{side:"top",children:"Open full page"})]})]})]}),v&&u.map(S=>a.jsx(Pk,{issue:S,projectId:t,statuses:r,statusLabels:n,statusColorMap:s,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:!0,children:(f==null?void 0:f[S.id])??[],childrenMap:f,onAddChild:m},S.id))]})}function zy({taskList:e,issues:t,childrenMap:r,projectId:n,statuses:s,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,onAddIssue:f,onAddChild:m,onRenameList:p,onDeleteList:x}){const[g,v]=h.useState(!1),[y,j]=h.useState(!1),[N,w]=h.useState((e==null?void 0:e.name)??""),k=t.reduce((_,S)=>{var I;return _+(((I=r[S.id])==null?void 0:I.length)??0)},0),b=t.length+k,C=()=>{e&&N.trim()&&p&&p(e.id,N.trim()),j(!1)};return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:a.jsx("button",{onClick:()=>v(!g),className:"text-muted-foreground hover:text-foreground transition-colors",children:g?a.jsx(Cr,{className:"h-3.5 w-3.5"}):a.jsx(sa,{className:"h-3.5 w-3.5"})})}),a.jsx(Cn,{side:"right",children:g?"Expand":"Collapse"})]}),e?y?a.jsx("input",{autoFocus:!0,value:N,onChange:_=>w(_.target.value),onBlur:C,onKeyDown:_=>{_.key==="Enter"&&C(),_.key==="Escape"&&(j(!1),w(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):a.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):a.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),a.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:b}),a.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[a.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:[a.jsx(dt,{className:"h-3 w-3"}),"Add issue"]}),e&&a.jsxs(Hr,{children:[a.jsxs(Xn,{children:[a.jsx(Qn,{asChild:!0,children:a.jsx(Kr,{asChild:!0,children:a.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Ca,{className:"h-3.5 w-3.5"})})})}),a.jsx(Cn,{side:"top",children:"More options"})]}),a.jsxs(Or,{align:"end",className:"w-36",children:[a.jsxs(at,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{j(!0),w(e.name)},children:[a.jsx(si,{className:"h-3.5 w-3.5"}),"Rename"]}),a.jsxs(at,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>x==null?void 0:x(e.id),children:[a.jsx(Mr,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!g&&a.jsx("div",{className:"divide-y divide-border/60",children:t.length===0?a.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):t.map(_=>a.jsx(Pk,{issue:_,projectId:n,statuses:s,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,children:r[_.id]??[],childrenMap:r,onAddChild:m},_.id))})]})}function h6(){var T;const e=pt(),{workspace:t,projectKey:r}=zt(),[n,s]=h.useState(null),[i,o]=h.useState({open:!1}),[l,c]=h.useState(""),[d,u]=h.useState(!1),[f,m]=h.useState(""),[p,x]=h.useState("all"),[g,v]=h.useState("all"),[y,j]=h.useState("all"),{data:N}=La(r??""),w=(N==null?void 0:N.id)??"",{data:k,isLoading:b}=Vl(w||void 0),{data:C}=jo(w||void 0),{data:_}=ko(w||void 0),{data:S}=fc(w||void 0),I=j4(w),E=N4(w),O=k4(w),F=C&&C.length>0?C:Object.entries(ci).map(([P,Z],L)=>({id:P,project_id:w,key:P,name:Z,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:L})),D=Object.fromEntries(F.map(P=>[P.key,P.name])),U=Object.fromEntries(F.map(P=>[P.key,P.color])),M=_??[];if(!r||!t)return null;const H=(k??[]).filter(P=>{const Z=!f||P.title.toLowerCase().includes(f.toLowerCase())||P.identifier.toLowerCase().includes(f.toLowerCase()),L=p==="all"||P.status===p,Y=g==="all"||P.priority===g,ae=y==="all"||(y==="none"?!P.sprint_id:P.sprint_id===y);return Z&&L&&Y&&ae}).sort((P,Z)=>{const L=parseInt(P.identifier.split("-")[1]??"0",10),Y=parseInt(Z.identifier.split("-")[1]??"0",10);return L-Y}),re={};for(const P of k??[])P.parent_id&&(re[P.parent_id]||(re[P.parent_id]=[]),re[P.parent_id].push(P));const J=H.filter(P=>!P.parent_id),R=H.length,A=new Set((S??[]).map(P=>P.id)),z={__none__:[]};for(const P of S??[])z[P.id]=[];for(const P of J){const Z=P.task_list_id&&A.has(P.task_list_id)?P.task_list_id:"__none__";z[Z].push(P)}function K(){l.trim()&&I.mutate({name:l.trim()},{onSuccess:()=>{c(""),u(!1),q.success("List created")},onError:()=>q.error("Failed to create list")})}function X(P,Z){E.mutate({id:P,name:Z},{onError:()=>q.error("Failed to rename list")})}function G(P){const Z=S==null?void 0:S.find(L=>L.id===P);confirm(`Delete list "${Z==null?void 0:Z.name}"? Issues in this list will be moved to No List.`)&&O.mutate(P,{onSuccess:()=>q.success("List deleted"),onError:()=>q.error("Failed to delete list")})}return a.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[a.jsx(Sr,{zone:"project.issues.before",props:{projectId:w}}),a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[a.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:a.jsxs("div",{className:"flex items-center gap-2",children:[d?a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(Ae,{autoFocus:!0,placeholder:"List name...",value:l,onChange:P=>c(P.target.value),onKeyDown:P=>{P.key==="Enter"&&K(),P.key==="Escape"&&(u(!1),c(""))},className:"h-8 text-xs w-36"}),a.jsx(ne,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:K,disabled:!l.trim()||I.isPending,children:"Add"}),a.jsx(ne,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{u(!1),c("")},children:"Cancel"})]}):a.jsxs(ne,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[a.jsx(dt,{className:"h-4 w-4"}),"New List"]}),a.jsxs(ne,{size:"sm",onClick:()=>o({open:!0}),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create"]})]})}),a.jsxs("div",{className:"flex flex-col gap-2 px-4 md:px-6 py-3 border-b border-border md:flex-row md:items-center md:justify-between md:gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2 md:overflow-x-auto md:scrollbar-none",children:[a.jsxs(Le,{value:y,onValueChange:j,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[140px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Sprint"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All sprints"}),a.jsx(we,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),M.map(P=>a.jsx(we,{value:P.id,className:"text-xs",children:P.name},P.id))]})]}),a.jsxs(Le,{value:p,onValueChange:x,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Status"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All statuses"}),F.map(({key:P,name:Z})=>a.jsx(we,{value:P,className:"text-xs",children:Z},P))]})]}),a.jsxs(Le,{value:g,onValueChange:v,children:[a.jsx($e,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:a.jsx(qe,{placeholder:"Priority"})}),a.jsxs(ze,{children:[a.jsx(we,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(tn).map(([P,Z])=>a.jsx(we,{value:P,className:"text-xs",children:Z},P))]})]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(ji,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Ae,{placeholder:"Search...",value:f,onChange:P=>m(P.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),a.jsx("div",{className:"hidden md:block overflow-x-auto",children:a.jsxs("div",{className:"min-w-[1025px]",children:[a.jsxs("div",{className:$("grid items-center py-2.5 border-b border-border",Rh),children:[a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),a.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),a.jsx("span",{className:"pr-6"})]}),b?a.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(P=>a.jsxs("div",{className:$("grid items-center px-6 py-3 gap-4",Rh),children:[a.jsx(ce,{className:"h-4 w-14"}),a.jsx(ce,{className:"h-4 w-56"}),a.jsx(ce,{className:"h-5 w-20"}),a.jsx(ce,{className:"h-4 w-16"}),a.jsx(ce,{className:"h-4 w-20"}),a.jsx(ce,{className:"h-4 w-24"}),a.jsx(ce,{className:"h-6 w-16"}),a.jsx("span",{})]},P))}):R===0&&(k??[]).length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),a.jsxs(ne,{size:"sm",onClick:()=>o({open:!0}),children:[a.jsx(dt,{className:"h-4 w-4"}),"Create issue"]})]}):J.length===0&&(k??[]).length>0?a.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):a.jsx(Ru,{delayDuration:200,children:a.jsxs("div",{className:"divide-y divide-border",children:[(S??[]).map(P=>a.jsx(zy,{taskList:P,issues:z[P.id]??[],childrenMap:re,projectId:w,statuses:F,statusLabels:D,statusColorMap:U,sprints:M,workspace:t,projectKey:r,onOpen:s,onAddIssue:Z=>o({open:!0,defaultTaskListId:Z}),onAddChild:Z=>o({open:!0,defaultParentId:Z}),onRenameList:X,onDeleteList:G},P.id)),(((T=z.__none__)==null?void 0:T.length)>0||(S??[]).length===0)&&a.jsx(zy,{taskList:null,issues:z.__none__??[],childrenMap:re,projectId:w,statuses:F,statusLabels:D,statusColorMap:U,sprints:M,workspace:t,projectKey:r,onOpen:s,onAddIssue:P=>o({open:!0,defaultTaskListId:P}),onAddChild:P=>o({open:!0,defaultParentId:P})})]})})]})}),a.jsx("div",{className:"md:hidden divide-y divide-border/60",children:b?[1,2,3,4].map(P=>a.jsx("div",{className:"flex items-start gap-3 px-4 py-3",children:a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"h-3 w-10 bg-muted rounded animate-pulse"}),a.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"})]}),a.jsx("div",{className:"h-3 w-32 bg-muted rounded animate-pulse"})]})},P)):J.length===0?null:J.map(P=>{const Z=(U==null?void 0:U[P.status])??"#94a3b8",L=M.find(Y=>Y.id===P.sprint_id);return a.jsx("div",{onClick:()=>e(`/${t}/projects/${r}/issues/${P.id}`),className:"flex items-start gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",children:a.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:P.identifier}),a.jsx("span",{className:"text-sm text-foreground truncate font-medium",children:P.title})]}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(Ih,{priority:P.priority}),a.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:Z}}),D[P.status]??P.status]}),L&&a.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:L.name}),P.due_date&&a.jsx("span",{className:"text-[11px] text-muted-foreground",children:ue(new Date(P.due_date),"MMM d")})]})]})},P.id)})}),!b&&R>0&&a.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:a.jsxs("span",{className:"text-xs text-muted-foreground",children:[R," issue",R!==1?"s":""]})})]}),a.jsx(Sr,{zone:"project.issues.after",props:{projectId:w}}),a.jsx(Ok,{issue:n,projectId:w,open:!!n,onClose:()=>s(null)}),a.jsx(lf,{open:i.open,onClose:()=>o({open:!1}),projectId:w,defaultTaskListId:i.defaultTaskListId,defaultParentId:i.defaultParentId})]})}function p6(e,t=[]){let r=[];function n(i,o){const l=h.createContext(o),c=r.length;r=[...r,o];const d=f=>{var y;const{scope:m,children:p,...x}=f,g=((y=m==null?void 0:m[e])==null?void 0:y[c])||l,v=h.useMemo(()=>x,Object.values(x));return a.jsx(g.Provider,{value:v,children:p})};d.displayName=i+"Provider";function u(f,m){var g;const p=((g=m==null?void 0:m[e])==null?void 0:g[c])||l,x=h.useContext(p);if(x)return x;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=r.map(o=>h.createContext(o));return function(l){const c=(l==null?void 0:l[e])||i;return h.useMemo(()=>({[`__scope${e}`]:{...l,[e]:c}}),[l,c])}};return s.scopeName=e,[n,x6(s,...t)]}function x6(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=n.reduce((l,{useScope:c,scopeName:d})=>{const f=c(i)[`__scope${d}`];return{...l,...f}},{});return h.useMemo(()=>({[`__scope${t.scopeName}`]:o}),[o])}};return r.scopeName=t.scopeName,r}var g6=Symbol("radix.slottable");function v6(e){const t=({children:r})=>a.jsx(a.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=g6,t}var Ek="AlertDialog",[y6]=p6(Ek,[s1]),qa=s1(),Ak=e=>{const{__scopeAlertDialog:t,...r}=e,n=qa(t);return a.jsx(Gl,{...n,...r,modal:!0})};Ak.displayName=Ek;var b6="AlertDialogTrigger",w6=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=qa(r);return a.jsx(GP,{...s,...n,ref:t})});w6.displayName=b6;var j6="AlertDialogPortal",Dk=e=>{const{__scopeAlertDialog:t,...r}=e,n=qa(t);return a.jsx(Yl,{...n,...r})};Dk.displayName=j6;var N6="AlertDialogOverlay",Tk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=qa(r);return a.jsx(gi,{...s,...n,ref:t})});Tk.displayName=N6;var qi="AlertDialogContent",[k6,S6]=y6(qi),C6=v6("AlertDialogContent"),Ik=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...s}=e,i=qa(r),o=h.useRef(null),l=Iu(t,o),c=h.useRef(null);return a.jsx(YP,{contentName:qi,titleName:Rk,docsSlug:"alert-dialog",children:a.jsx(k6,{scope:r,cancelRef:c,children:a.jsxs(vi,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Ls(s.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[a.jsx(C6,{children:n}),a.jsx(M6,{contentRef:o})]})})})});Ik.displayName=qi;var Rk="AlertDialogTitle",$k=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=qa(r);return a.jsx(co,{...s,...n,ref:t})});$k.displayName=Rk;var zk="AlertDialogDescription",Lk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=qa(r);return a.jsx(uo,{...s,...n,ref:t})});Lk.displayName=zk;var _6="AlertDialogAction",Fk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,s=qa(r);return a.jsx(Tu,{...s,...n,ref:t})});Fk.displayName=_6;var Bk="AlertDialogCancel",Wk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:s}=S6(Bk,r),i=qa(r),o=Iu(t,s);return a.jsx(Tu,{...i,...n,ref:o})});Wk.displayName=Bk;var M6=({contentRef:e})=>{const t=`\`${qi}\` requires a description for the component to be accessible for screen reader users.
558
558
 
559
559
  You can add a description to the \`${qi}\` by passing a \`${zk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
@@ -627,4 +627,4 @@ For more information, see https://radix-ui.com/primitives/docs/components/alert-
627
627
  --nojs-bg: black !important;
628
628
  --nojs-fg: white !important;
629
629
  }
630
- }`;const fP=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(uP,{ref:n,containerClassName:$("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:$("disabled:cursor-not-allowed",e),...r}));fP.displayName="InputOTP";const Bp=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:$("flex items-center",e),...t}));Bp.displayName="InputOTPGroup";const zs=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(dP),{char:i,hasFakeCaret:o,isActive:l}=s.slots[e];return a.jsxs("div",{ref:n,className:$("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...r,children:[i,o&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});zs.displayName="InputOTPSlot";const mP=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(za,{})}));mP.displayName="InputOTPSeparator";function Oj({className:e}){return a.jsxs("svg",{className:e??"size-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),a.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),a.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z",fill:"#FBBC05"}),a.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}function lte(){var L,Y,ae,ee;const[e,t]=Kl(),{user:r}=Ie(),{data:n,isLoading:s}=vO(),i=bZ(),o=wZ(),l=jZ(),c=SZ(),d=NZ(),u=kZ(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[j,N]=h.useState(""),[w,k]=h.useState(!1),[b,C]=h.useState(!1),[_,S]=h.useState(""),[I,E]=h.useState(""),[O,F]=h.useState(""),[D,U]=h.useState(!1),[M,H]=h.useState(0),re=h.useRef(null);h.useEffect(()=>{n&&(p(n.first_name??""),g(n.last_name??""),y(n.designation??""),N(n.phone_number??""))},[n]),h.useEffect(()=>{e.get("linked")==="true"&&(q.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((L=r.first_name)==null?void 0:L[0])??""}${((Y=r.last_name)==null?void 0:Y[0])??""}`.toUpperCase()||((ee=(ae=r.email)==null?void 0:ae[0])==null?void 0:ee.toUpperCase()))||"?",R=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>q.success("Avatar updated"),onError:he=>q.error(he.message??"Failed to upload avatar")}),se.target.value="")},A=()=>{l.mutate(void 0,{onSuccess:()=>q.success("Avatar removed"),onError:se=>q.error(se.message??"Failed to remove avatar")})},z=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>q.success("Profile updated"),onError:se=>q.error(se.message??"Failed to update profile")})},K=()=>{const se=localStorage.getItem("meridian_token");if(!se){q.error("You must be logged in to connect Google");return}window.location.href=`${Yi}/auth/google/link?token=${encodeURIComponent(se)}`},X=()=>{c.mutate(void 0,{onSuccess:()=>q.success("Google account disconnected"),onError:se=>q.error(se.message??"Failed to unlink Google account")})},G=h.useCallback(()=>{H(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{H(se=>se<=1?(re.current&&clearInterval(re.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const T=()=>{d.mutate(void 0,{onSuccess:()=>{C(!0),G(),q.success("Verification code sent to your email")},onError:se=>q.error(se.message??"Failed to send verification code")})},P=()=>{if(I.length<8){q.error("New password must be at least 8 characters");return}if(I!==O){q.error("Passwords do not match");return}u.mutate({otp:_,new_password:I},{onSuccess:()=>{q.success("Password updated"),Z()},onError:se=>q.error(se.message??"Failed to set password")})},Z=()=>{k(!1),C(!1),S(""),E(""),F(""),U(!1),H(0),re.current&&clearInterval(re.current)};return a.jsx("div",{className:"p-2 md:h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Jl,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-4 md:px-6 py-4 border-b border-border gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),a.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(Rt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?a.jsx(yl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,a.jsx($t,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:J})]}),o.isPending&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},disabled:o.isPending,children:[a.jsx(s5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:A,disabled:l.isPending,children:[a.jsx(Mr,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:R})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:m,onChange:se=>p(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:x,onChange:se=>g(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),s?a.jsx(ce,{className:"h-4 w-48"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:v,onChange:se=>y(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:j,onChange:se=>N(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),a.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:a.jsx(ne,{size:"sm",onClick:z,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),a.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:s?a.jsx(ce,{className:"h-8 w-48"}):n!=null&&n.google_id?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(ea,{className:"size-3.5 text-emerald-500 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),a.jsxs(ne,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:X,disabled:c.isPending,children:[a.jsx(ex,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:"Google"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),a.jsx(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:K,children:"Connect"})]})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-4 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),a.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(x5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Fa,{open:w,onOpenChange:se=>{se||Z()},children:a.jsxs(la,{className:"sm:max-w-md",children:[a.jsxs(Ba,{children:[a.jsx(Wa,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(go,{children:["We'll send a 6-digit verification code to ",a.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Verification code"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(fP,{maxLength:6,value:_,onChange:S,children:[a.jsxs(Bp,{children:[a.jsx(zs,{index:0}),a.jsx(zs,{index:1}),a.jsx(zs,{index:2})]}),a.jsx(mP,{}),a.jsxs(Bp,{children:[a.jsx(zs,{index:3}),a.jsx(zs,{index:4}),a.jsx(zs,{index:5})]})]}),b?M>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",M,"s"]}):a.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:T,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ne,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:T,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"New password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{type:D?"text":"password",value:I,onChange:se=>E(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>U(!D),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:D?a.jsx(Zl,{className:"size-3.5"}):a.jsx(wi,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Ae,{type:"password",value:O,onChange:se=>F(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(mx,{children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:Z,children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:P,disabled:u.isPending||_.length!==6||!I||!O,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function cte(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=aD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>q.error(l.message??"Something went wrong")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.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:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r?"If an account exists with that email, we've sent a reset link.":"Enter your email and we'll send you a reset link."})]})]}),r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),a.jsx(ne,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-2",children:[a.jsx(Ae,{type:"email",placeholder:"Email",value:e,onChange:o=>t(o.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10",autoFocus:!0}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:s.isPending,children:s.isPending?"Sending...":"Send reset link"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(Ur,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Ql,{className:"size-3.5"}),"Back to login"]})})]})})}function dte(){const[e]=Kl(),t=e.get("token")??"",r=pt(),n=sD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){q.error("Password must be at least 8 characters");return}if(s!==o){q.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{q.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>q.error(m.message??"Failed to reset password")})};return t?a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.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:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),a.jsxs("form",{onSubmit:u,className:"space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{type:c?"text":"password",placeholder:"New password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(Zl,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx(Ae,{type:"password",placeholder:"Confirm password",value:o,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(Ur,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Ql,{className:"size-3.5"}),"Back to login"]})})]})}):a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),a.jsx(Ur,{to:"/forgot-password",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const ute=h.lazy(()=>v1(()=>import("./ProjectTimelinePage-Bivujl9c.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),fte=h.lazy(()=>v1(()=>import("./WorkspaceReportingPage-B4AKtxT7.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Ds({children:e}){const{isAuthenticated:t}=Ie();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Vn,{to:"/login",replace:!0})}function mte({children:e}){var r;const{user:t}=Ie();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Vn,{to:"/",replace:!0})}function Pj({children:e}){var s,i,o;const{user:t}=Ie(),r=((s=t==null?void 0:t.roles)==null?void 0:s.includes("super-admin"))||((i=t==null?void 0:t.roles)==null?void 0:i.includes("admin")),n=(o=t==null?void 0:t.permissions)==null?void 0:o.includes("workspace:admin");return r||n?a.jsx(a.Fragment,{children:e}):a.jsx(Vn,{to:"/",replace:!0})}function hd({children:e}){const{isAuthenticated:t}=Ie(),{data:r}=Wu(),n=ql();return t?a.jsx(Vn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Vn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Vn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function hte(){const{workspace:e,setWorkspace:t,user:r}=Ie(),n=pt(),{data:s,isLoading:i}=ec(!e);return h.useEffect(()=>{var o,l;if(e){n(`/${e.slug}/projects`,{replace:!0});return}if(!i&&s!==void 0)if(s.length>0){const c=s[0];t({id:c.id,name:c.name,slug:c.slug}),n(`/${c.slug}/projects`,{replace:!0})}else{const c=((o=r==null?void 0:r.roles)==null?void 0:o.includes("super-admin"))||((l=r==null?void 0:r.roles)==null?void 0:l.includes("admin"));n(c?"/setup":"/awaiting-access",{replace:!0})}},[e,s,i,n,t,r]),a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function pte(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r}=Ie();cD();const n=pt(),{data:s,isLoading:i,isFetching:o}=ec();return h.useEffect(()=>{if(i||!s)return;const l=s.find(c=>c.slug===e);l?l.id!==(t==null?void 0:t.id)&&r({id:l.id,name:l.name,slug:l.slug}):s.length>0?n(`/${s[0].slug}/projects`,{replace:!0}):!t&&!o&&n("/setup",{replace:!0})},[s,e,i,o,t==null?void 0:t.id,n,r]),i||!t||t.slug!==e?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a.jsxs(a.Fragment,{children:[a.jsx(qD,{}),a.jsx(MT,{})]})}function xte(){return a.jsxs(jP,{children:[a.jsx(Ye,{path:"/login",element:a.jsx(hd,{children:a.jsx(PT,{})})}),a.jsx(Ye,{path:"/register",element:a.jsx(hd,{children:a.jsx(ET,{})})}),a.jsx(Ye,{path:"/forgot-password",element:a.jsx(hd,{children:a.jsx(cte,{})})}),a.jsx(Ye,{path:"/reset-password",element:a.jsx(hd,{children:a.jsx(dte,{})})}),a.jsx(Ye,{path:"/invite/:token",element:a.jsx(yz,{})}),a.jsx(Ye,{path:"/oauth/google/callback",element:a.jsx(Gee,{})}),a.jsx(Ye,{path:"/share/:token",element:a.jsx(Kee,{})}),a.jsx(Ye,{path:"/reporting",element:a.jsx(Ds,{children:a.jsx(Pj,{children:a.jsx(XD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(hZ,{})})}),a.jsx(Ye,{path:"/org/settings",element:a.jsx(Ds,{children:a.jsx(Pj,{children:a.jsx(JD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(DZ,{})})}),a.jsx(Ye,{path:"/profile",element:a.jsx(Ds,{children:a.jsx(rT,{})}),children:a.jsx(Ye,{index:!0,element:a.jsx(lte,{})})}),a.jsx(Ye,{path:"/setup",element:a.jsx(Ds,{children:a.jsx(AT,{})})}),a.jsx(Ye,{path:"/awaiting-access",element:a.jsx(Ds,{children:a.jsx(DT,{})})}),a.jsx(Ye,{index:!0,element:a.jsx(Ds,{children:a.jsx(hte,{})})}),a.jsxs(Ye,{path:"/:workspace",element:a.jsx(Ds,{children:a.jsx(pte,{})}),children:[a.jsx(Ye,{index:!0,element:a.jsx(Vn,{to:"projects",replace:!0})}),a.jsx(Ye,{path:"projects",element:a.jsx(BI,{})}),a.jsxs(Ye,{path:"projects/:projectKey",element:a.jsx(YD,{}),children:[a.jsx(Ye,{path:"board",element:a.jsx(m6,{})}),a.jsx(Ye,{path:"issues",element:a.jsx(h6,{})}),a.jsx(Ye,{path:"issues/new",element:a.jsx(U6,{})}),a.jsx(Ye,{path:"issues/:issueId",element:a.jsx(z6,{})}),a.jsx(Ye,{path:"sprints",element:a.jsx(nz,{})}),a.jsx(Ye,{path:"timeline",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(ute,{})})}),a.jsx(Ye,{path:"access",element:a.jsx(T6,{})}),a.jsx(Ye,{path:"reports",element:a.jsx(pZ,{})}),a.jsx(Ye,{path:"activity",element:a.jsx(yZ,{})})]}),a.jsx(Ye,{path:"my-tasks",element:a.jsx(Q6,{})}),a.jsx(Ye,{path:"notifications",element:a.jsx(J6,{})}),a.jsx(Ye,{path:"reporting",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(fte,{})})}),a.jsx(Ye,{path:"settings",element:a.jsx(hz,{})}),a.jsx(Ye,{path:"roles",element:a.jsx(mte,{children:a.jsx(gz,{})})})]}),a.jsx(Ye,{path:"*",element:a.jsx(Vn,{to:"/",replace:!0})})]})}window.__React=B;window.__ReactJsxRuntime=gP;const gte=new vP({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const r=await import("/admin-extensions.js");Array.isArray(r==null?void 0:r.default)&&(e=r.default)}catch{}g1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(XA,{widgets:[...F5,...e],children:a.jsx(pA,{children:a.jsxs(yP,{client:gte,children:[a.jsx(xA,{children:a.jsx(gA,{children:a.jsx(NP,{children:a.jsxs(Ru,{delayDuration:300,children:[a.jsx(xte,{}),a.jsx(aA,{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"}}})]})})})}),a.jsx(EE,{initialIsOpen:!1})]})})})}))})();export{Ie as A,ne as B,lf as C,rx as D,zee as G,Ok as I,dt as P,hZ as R,Sr as W,v1 as _,Wr as a,La as b,Oh as c,Vl as d,jo as e,ue as f,ko as g,Sx as h,v4 as i,Cx as j,js as k,Dee as l,vh as m,gh as n,Lee as o,Eee as p,$ee as q,yh as r,WN as s,_j as t,iN as u,aP as v,Fee as w,q as x,Tt as y,oe as z};
630
+ }`;const fP=h.forwardRef(({className:e,containerClassName:t,...r},n)=>a.jsx(uP,{ref:n,containerClassName:$("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:$("disabled:cursor-not-allowed",e),...r}));fP.displayName="InputOTP";const Bp=h.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:$("flex items-center",e),...t}));Bp.displayName="InputOTPGroup";const zs=h.forwardRef(({index:e,className:t,...r},n)=>{const s=h.useContext(dP),{char:i,hasFakeCaret:o,isActive:l}=s.slots[e];return a.jsxs("div",{ref:n,className:$("relative flex h-10 w-10 items-center justify-center border-y border-r border-input text-sm transition-all first:rounded-l-md first:border-l last:rounded-r-md",l&&"z-10 ring-2 ring-ring ring-offset-background",t),...r,children:[i,o&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});zs.displayName="InputOTPSlot";const mP=h.forwardRef(({...e},t)=>a.jsx("div",{ref:t,role:"separator",...e,children:a.jsx(za,{})}));mP.displayName="InputOTPSeparator";function Oj({className:e}){return a.jsxs("svg",{className:e??"size-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[a.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),a.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),a.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l3.66-2.84z",fill:"#FBBC05"}),a.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]})}function lte(){var L,Y,ae,ee;const[e,t]=Kl(),{user:r}=Ie(),{data:n,isLoading:s}=vO(),i=bZ(),o=wZ(),l=jZ(),c=SZ(),d=NZ(),u=kZ(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[j,N]=h.useState(""),[w,k]=h.useState(!1),[b,C]=h.useState(!1),[_,S]=h.useState(""),[I,E]=h.useState(""),[O,F]=h.useState(""),[D,U]=h.useState(!1),[M,H]=h.useState(0),re=h.useRef(null);h.useEffect(()=>{n&&(p(n.first_name??""),g(n.last_name??""),y(n.designation??""),N(n.phone_number??""))},[n]),h.useEffect(()=>{e.get("linked")==="true"&&(q.success("Google account connected successfully"),t(se=>(se.delete("linked"),se),{replace:!0}))},[e,t]);const J=r&&(`${((L=r.first_name)==null?void 0:L[0])??""}${((Y=r.last_name)==null?void 0:Y[0])??""}`.toUpperCase()||((ee=(ae=r.email)==null?void 0:ae[0])==null?void 0:ee.toUpperCase()))||"?",R=se=>{var ie;const V=(ie=se.target.files)==null?void 0:ie[0];V&&(o.mutate(V,{onSuccess:()=>q.success("Avatar updated"),onError:he=>q.error(he.message??"Failed to upload avatar")}),se.target.value="")},A=()=>{l.mutate(void 0,{onSuccess:()=>q.success("Avatar removed"),onError:se=>q.error(se.message??"Failed to remove avatar")})},z=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:j||null},{onSuccess:()=>q.success("Profile updated"),onError:se=>q.error(se.message??"Failed to update profile")})},K=()=>{const se=localStorage.getItem("meridian_token");if(!se){q.error("You must be logged in to connect Google");return}window.location.href=`${Yi}/auth/google/link?token=${encodeURIComponent(se)}`},X=()=>{c.mutate(void 0,{onSuccess:()=>q.success("Google account disconnected"),onError:se=>q.error(se.message??"Failed to unlink Google account")})},G=h.useCallback(()=>{H(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{H(se=>se<=1?(re.current&&clearInterval(re.current),0):se-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const T=()=>{d.mutate(void 0,{onSuccess:()=>{C(!0),G(),q.success("Verification code sent to your email")},onError:se=>q.error(se.message??"Failed to send verification code")})},P=()=>{if(I.length<8){q.error("New password must be at least 8 characters");return}if(I!==O){q.error("Passwords do not match");return}u.mutate({otp:_,new_password:I},{onSuccess:()=>{q.success("Password updated"),Z()},onError:se=>q.error(se.message??"Failed to set password")})},Z=()=>{k(!1),C(!1),S(""),E(""),F(""),U(!1),H(0),re.current&&clearInterval(re.current)};return a.jsx("div",{className:"p-2 md:h-full",children:a.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[a.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Jl,{className:"h-5 w-5 text-muted-foreground"}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),a.jsxs("div",{className:"flex-1 overflow-y-auto",children:[a.jsxs("div",{className:"flex flex-col md:flex-row md:items-center justify-between px-4 md:px-6 py-4 border-b border-border gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),a.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(Rt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?a.jsx(yl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,a.jsx($t,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:J})]}),o.isPending&&a.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:a.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(ne,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var se;return(se=f.current)==null?void 0:se.click()},disabled:o.isPending,children:[a.jsx(s5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&a.jsxs(ne,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:A,disabled:l.isPending,children:[a.jsx(Mr,{className:"size-3.5"}),"Remove"]})]}),a.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:R})]})]}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:m,onChange:se=>p(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:x,onChange:se=>g(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),s?a.jsx(ce,{className:"h-4 w-48"}):a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:v,onChange:se=>y(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-3.5 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),s?a.jsx(ce,{className:"h-8 w-56"}):a.jsx(Ae,{value:j,onChange:se=>N(se.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),a.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:a.jsx(ne,{size:"sm",onClick:z,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),a.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:s?a.jsx(ce,{className:"h-8 w-48"}):n!=null&&n.google_id?a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Google"}),a.jsx(ea,{className:"size-3.5 text-emerald-500 shrink-0"}),a.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),a.jsxs(ne,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:X,disabled:c.isPending,children:[a.jsx(ex,{className:"size-3.5"}),"Disconnect"]})]})]}):a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Oj,{className:"size-3.5 shrink-0"}),a.jsx("span",{className:"text-sm font-medium",children:"Google"}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),a.jsx(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:K,children:"Connect"})]})}),a.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:a.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-[180px_1fr] items-start md:items-center gap-1 md:gap-4 px-4 md:px-6 py-4 border-b border-border",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),a.jsxs(ne,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[a.jsx(x5,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),a.jsx(Fa,{open:w,onOpenChange:se=>{se||Z()},children:a.jsxs(la,{className:"sm:max-w-md",children:[a.jsxs(Ba,{children:[a.jsx(Wa,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),a.jsxs(go,{children:["We'll send a 6-digit verification code to ",a.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Verification code"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(fP,{maxLength:6,value:_,onChange:S,children:[a.jsxs(Bp,{children:[a.jsx(zs,{index:0}),a.jsx(zs,{index:1}),a.jsx(zs,{index:2})]}),a.jsx(mP,{}),a.jsxs(Bp,{children:[a.jsx(zs,{index:3}),a.jsx(zs,{index:4}),a.jsx(zs,{index:5})]})]}),b?M>0?a.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",M,"s"]}):a.jsx(ne,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:T,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):a.jsx(ne,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:T,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"New password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{type:D?"text":"password",value:I,onChange:se=>E(se.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),a.jsx("button",{type:"button",onClick:()=>U(!D),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:D?a.jsx(Zl,{className:"size-3.5"}):a.jsx(wi,{className:"size-3.5"})})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(mt,{className:"text-sm",children:"Confirm password"}),a.jsx(Ae,{type:"password",value:O,onChange:se=>F(se.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),a.jsxs(mx,{children:[a.jsx(ne,{variant:"ghost",size:"sm",onClick:Z,children:"Cancel"}),a.jsx(ne,{size:"sm",onClick:P,disabled:u.isPending||_.length!==6||!I||!O,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function cte(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),s=aD(),i=o=>{o.preventDefault(),s.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>q.error(l.message??"Something went wrong")})};return a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.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:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:r?"If an account exists with that email, we've sent a reset link.":"Enter your email and we'll send you a reset link."})]})]}),r?a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),a.jsx(ne,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):a.jsxs("form",{onSubmit:i,className:"space-y-2",children:[a.jsx(Ae,{type:"email",placeholder:"Email",value:e,onChange:o=>t(o.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10",autoFocus:!0}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:s.isPending,children:s.isPending?"Sending...":"Send reset link"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(Ur,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Ql,{className:"size-3.5"}),"Back to login"]})})]})})}function dte(){const[e]=Kl(),t=e.get("token")??"",r=pt(),n=sD(),[s,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),s.length<8){q.error("Password must be at least 8 characters");return}if(s!==o){q.error("Passwords do not match");return}n.mutate({token:t,password:s},{onSuccess:()=>{q.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>q.error(m.message??"Failed to reset password")})};return t?a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px]",children:[a.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[a.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:a.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:a.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:a.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),a.jsxs("form",{onSubmit:u,className:"space-y-2",children:[a.jsxs("div",{className:"relative",children:[a.jsx(Ae,{type:c?"text":"password",placeholder:"New password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),a.jsx("button",{type:"button",onClick:()=>d(!c),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:c?a.jsx(Zl,{className:"h-4 w-4"}):a.jsx(wi,{className:"h-4 w-4"})})]}),a.jsx(Ae,{type:"password",placeholder:"Confirm password",value:o,onChange:f=>l(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10"}),a.jsx("div",{className:"pt-1",children:a.jsx(ne,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),a.jsx("div",{className:"mt-6 text-center",children:a.jsxs(Ur,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(Ql,{className:"size-3.5"}),"Back to login"]})})]})}):a.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:a.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),a.jsx(Ur,{to:"/forgot-password",children:a.jsx(ne,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}const ute=h.lazy(()=>v1(()=>import("./ProjectTimelinePage-B29RPQsw.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),fte=h.lazy(()=>v1(()=>import("./WorkspaceReportingPage-BEG8uFWZ.js"),__vite__mapDeps([6,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function Ds({children:e}){const{isAuthenticated:t}=Ie();return t?a.jsx(a.Fragment,{children:e}):a.jsx(Vn,{to:"/login",replace:!0})}function mte({children:e}){var r;const{user:t}=Ie();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?a.jsx(a.Fragment,{children:e}):a.jsx(Vn,{to:"/",replace:!0})}function Pj({children:e}){var s,i,o;const{user:t}=Ie(),r=((s=t==null?void 0:t.roles)==null?void 0:s.includes("super-admin"))||((i=t==null?void 0:t.roles)==null?void 0:i.includes("admin")),n=(o=t==null?void 0:t.permissions)==null?void 0:o.includes("workspace:admin");return r||n?a.jsx(a.Fragment,{children:e}):a.jsx(Vn,{to:"/",replace:!0})}function hd({children:e}){const{isAuthenticated:t}=Ie(),{data:r}=Wu(),n=ql();return t?a.jsx(Vn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?a.jsx(Vn,{to:"/register",replace:!0}):r&&!r.needsSetup&&n.pathname==="/register"?a.jsx(Vn,{to:"/login",replace:!0}):a.jsx(a.Fragment,{children:e})}function hte(){const{workspace:e,setWorkspace:t,user:r}=Ie(),n=pt(),{data:s,isLoading:i}=ec(!e);return h.useEffect(()=>{var o,l;if(e){n(`/${e.slug}/projects`,{replace:!0});return}if(!i&&s!==void 0)if(s.length>0){const c=s[0];t({id:c.id,name:c.name,slug:c.slug}),n(`/${c.slug}/projects`,{replace:!0})}else{const c=((o=r==null?void 0:r.roles)==null?void 0:o.includes("super-admin"))||((l=r==null?void 0:r.roles)==null?void 0:l.includes("admin"));n(c?"/setup":"/awaiting-access",{replace:!0})}},[e,s,i,n,t,r]),a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})})}function pte(){const{workspace:e}=zt(),{workspace:t,setWorkspace:r}=Ie();cD();const n=pt(),{data:s,isLoading:i,isFetching:o}=ec();return h.useEffect(()=>{if(i||!s)return;const l=s.find(c=>c.slug===e);l?l.id!==(t==null?void 0:t.id)&&r({id:l.id,name:l.name,slug:l.slug}):s.length>0?n(`/${s[0].slug}/projects`,{replace:!0}):!t&&!o&&n("/setup",{replace:!0})},[s,e,i,o,t==null?void 0:t.id,n,r]),i||!t||t.slug!==e?a.jsx("div",{className:"min-h-screen flex items-center justify-center",children:a.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading..."})}):a.jsxs(a.Fragment,{children:[a.jsx(qD,{}),a.jsx(MT,{})]})}function xte(){return a.jsxs(jP,{children:[a.jsx(Ye,{path:"/login",element:a.jsx(hd,{children:a.jsx(PT,{})})}),a.jsx(Ye,{path:"/register",element:a.jsx(hd,{children:a.jsx(ET,{})})}),a.jsx(Ye,{path:"/forgot-password",element:a.jsx(hd,{children:a.jsx(cte,{})})}),a.jsx(Ye,{path:"/reset-password",element:a.jsx(hd,{children:a.jsx(dte,{})})}),a.jsx(Ye,{path:"/invite/:token",element:a.jsx(yz,{})}),a.jsx(Ye,{path:"/oauth/google/callback",element:a.jsx(Gee,{})}),a.jsx(Ye,{path:"/share/:token",element:a.jsx(Kee,{})}),a.jsx(Ye,{path:"/reporting",element:a.jsx(Ds,{children:a.jsx(Pj,{children:a.jsx(XD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(hZ,{})})}),a.jsx(Ye,{path:"/org/settings",element:a.jsx(Ds,{children:a.jsx(Pj,{children:a.jsx(JD,{})})}),children:a.jsx(Ye,{index:!0,element:a.jsx(DZ,{})})}),a.jsx(Ye,{path:"/profile",element:a.jsx(Ds,{children:a.jsx(rT,{})}),children:a.jsx(Ye,{index:!0,element:a.jsx(lte,{})})}),a.jsx(Ye,{path:"/setup",element:a.jsx(Ds,{children:a.jsx(AT,{})})}),a.jsx(Ye,{path:"/awaiting-access",element:a.jsx(Ds,{children:a.jsx(DT,{})})}),a.jsx(Ye,{index:!0,element:a.jsx(Ds,{children:a.jsx(hte,{})})}),a.jsxs(Ye,{path:"/:workspace",element:a.jsx(Ds,{children:a.jsx(pte,{})}),children:[a.jsx(Ye,{index:!0,element:a.jsx(Vn,{to:"projects",replace:!0})}),a.jsx(Ye,{path:"projects",element:a.jsx(BI,{})}),a.jsxs(Ye,{path:"projects/:projectKey",element:a.jsx(YD,{}),children:[a.jsx(Ye,{path:"board",element:a.jsx(m6,{})}),a.jsx(Ye,{path:"issues",element:a.jsx(h6,{})}),a.jsx(Ye,{path:"issues/new",element:a.jsx(U6,{})}),a.jsx(Ye,{path:"issues/:issueId",element:a.jsx(z6,{})}),a.jsx(Ye,{path:"sprints",element:a.jsx(nz,{})}),a.jsx(Ye,{path:"timeline",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(ute,{})})}),a.jsx(Ye,{path:"access",element:a.jsx(T6,{})}),a.jsx(Ye,{path:"reports",element:a.jsx(pZ,{})}),a.jsx(Ye,{path:"activity",element:a.jsx(yZ,{})})]}),a.jsx(Ye,{path:"my-tasks",element:a.jsx(Q6,{})}),a.jsx(Ye,{path:"notifications",element:a.jsx(J6,{})}),a.jsx(Ye,{path:"reporting",element:a.jsx(h.Suspense,{fallback:a.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:a.jsx(fte,{})})}),a.jsx(Ye,{path:"settings",element:a.jsx(hz,{})}),a.jsx(Ye,{path:"roles",element:a.jsx(mte,{children:a.jsx(gz,{})})})]}),a.jsx(Ye,{path:"*",element:a.jsx(Vn,{to:"/",replace:!0})})]})}window.__React=B;window.__ReactJsxRuntime=gP;const gte=new vP({defaultOptions:{queries:{staleTime:1e3*30,retry:1}}});(async()=>{let e=[];try{const r=await import("/admin-extensions.js");Array.isArray(r==null?void 0:r.default)&&(e=r.default)}catch{}g1(document.getElementById("root")).render(a.jsx(h.StrictMode,{children:a.jsx(XA,{widgets:[...F5,...e],children:a.jsx(pA,{children:a.jsxs(yP,{client:gte,children:[a.jsx(xA,{children:a.jsx(gA,{children:a.jsx(NP,{children:a.jsxs(Ru,{delayDuration:300,children:[a.jsx(xte,{}),a.jsx(aA,{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"}}})]})})})}),a.jsx(EE,{initialIsOpen:!1})]})})})}))})();export{Ie as A,ne as B,lf as C,rx as D,zee as G,Ok as I,dt as P,hZ as R,Sr as W,v1 as _,Wr as a,La as b,Oh as c,Vl as d,jo as e,ue as f,ko as g,Sx as h,v4 as i,Cx as j,js as k,Dee as l,vh as m,gh as n,Lee as o,Eee as p,$ee as q,yh as r,WN as s,_j as t,iN as u,aP as v,Fee as w,q as x,Tt as y,oe as z};