@meridianjs/admin-dashboard 2.1.0 → 2.3.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.
@@ -0,0 +1,642 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/ProjectTimelinePage-TWQPJXGx.js","assets/vendor-query-CaIGp3JB.js","assets/vendor-react-Lycsri1F.js","assets/vendor-radix-Bt8AkWnj.js","assets/vendor-dnd-DuI-3XLF.js","assets/vendor-editor-Cvk1s7Hk.js","assets/ProjectHealthPage-3V_xKn6W.js","assets/parseISO-BdsFsZH4.js","assets/HealthReportDetailPage-DNOCBj2U.js","assets/WorkspaceReportingPage-EtA8B4LZ.js"])))=>i.map(i=>d[i]);
2
+ var lE=Object.defineProperty;var cE=(e,t,r)=>t in e?lE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Cm=(e,t,r)=>cE(e,typeof t!="symbol"?t+"":t,r);import{j as s,u as Te,a as ye,b as ge,R as dE,Q as uE,c as fE}from"./vendor-query-CaIGp3JB.js";import{a as Jp,c as W,r as h,b as mE,u as Et,d as wo,N as rn,e as ct,L as Rt,O as Jl,f as ec,h as qn,g as Qs,R as hE,i as Bc,j as pE,k as Re,B as xE}from"./vendor-react-Lycsri1F.js";import{C as Qw,R as gE,T as vE,P as yE,S as ex,a as Zw,O as Si,b as tc,c as Ci,d as Uu,e as No,D as ko,f as rc,g as Jw,h as e1,i as bE,j as t1,I as r1,k as n1,l as s1,m as a1,L as i1,n as o1,o as jE,p as wE,q as NE,r as l1,t as c1,F as d1,u as Xi,v as Ra,s as kE,w as u1,x as SE,y as f1,z as CE,A as _E,B as m1,E as PE,G as h1,H as p1,J as ME,K as x1,V as OE,M as g1,N as v1,Q as EE,U as AE,W as y1,X as DE,Y as TE,Z as tx,_ as IE,$ as b1,a0 as So,a1 as Cs,a2 as j1,a3 as w1,a4 as RE,a5 as N1,a6 as $E,a7 as k1,a8 as zE,a9 as LE,aa as S1,ab as FE,ac as BE,ad as qE,ae as WE,af as UE,ag as HE,ah as KE,ai as YE,aj as GE,ak as VE,al as XE,am as C1,an as QE,ao as ZE,ap as JE,aq as eA,ar as tA,as as rA}from"./vendor-radix-Bt8AkWnj.js";import{u as _1,a as rx,P as P1,D as _l,S as nx,h as M1,b as wd,c as sx,C as ax,d as nA,v as sA,r as aA,p as iA,e as oA,f as lA,M as cA,g as O1}from"./vendor-dnd-DuI-3XLF.js";import{P as E1,a as dA,D as uA,b as fA,e as mA,N as hA,c as pA,d as xA,m as qc,E as gA,u as A1,i as D1,f as T1,g as I1,h as R1,j as vA,k as yA,w as bA}from"./vendor-editor-Cvk1s7Hk.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))n(a);new MutationObserver(a=>{for(const i of a)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(a){const i={};return a.integrity&&(i.integrity=a.integrity),a.referrerPolicy&&(i.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?i.credentials="include":a.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function n(a){if(a.ep)return;a.ep=!0;const i=r(a);fetch(a.href,i)}})();var $1,ry=Jp;$1=ry.createRoot,ry.hydrateRoot;const jA="modulepreload",wA=function(e){return"/"+e},ny={},Hu=function(t,r,n){let a=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"));a=Promise.allSettled(r.map(c=>{if(c=wA(c),c in ny)return;ny[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":jA,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 a.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return t().catch(i)})};var NA=function(){return null},kA=e=>{switch(e){case"success":return _A;case"info":return MA;case"warning":return PA;case"error":return OA;default:return null}},SA=Array(12).fill(0),CA=({visible:e,className:t})=>W.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},W.createElement("div",{className:"sonner-spinner"},SA.map((r,n)=>W.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${n}`})))),_A=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.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"})),PA=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},W.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"})),MA=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.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"})),OA=W.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},W.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"})),EA=W.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"},W.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),W.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),AA=()=>{let[e,t]=W.useState(document.hidden);return W.useEffect(()=>{let r=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",r),()=>window.removeEventListener("visibilitychange",r)},[]),e},Ah=1,DA=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,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:Ah++,i=this.toasts.find(l=>l.id===a),o=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),i?this.toasts=this.toasts.map(l=>l.id===a?(this.publish({...l,...e,id:a,title:r}),{...l,...e,id:a,dismissible:o,title:r}):l):this.addToast({title:r,...n,dismissible:o,id:a}),a},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(),a=r!==void 0,i,o=n.then(async c=>{if(i=["resolve",c],W.isValidElement(c))a=!1,this.create({id:r,type:"default",message:c});else if(IA(c)&&!c.ok){a=!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){a=!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){a=!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;a&&(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)||Ah++;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}},Wr=new DA,TA=(e,t)=>{let r=(t==null?void 0:t.id)||Ah++;return Wr.addToast({title:e,...t,id:r}),r},IA=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",RA=TA,$A=()=>Wr.toasts,zA=()=>Wr.getActiveToasts(),F=Object.assign(RA,{success:Wr.success,info:Wr.info,warning:Wr.warning,error:Wr.error,custom:Wr.custom,message:Wr.message,promise:Wr.promise,dismiss:Wr.dismiss,loading:Wr.loading},{getHistory:$A,getToasts:zA});function LA(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))}LA(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
3
+ `);function Wc(e){return e.label!==void 0}var FA=3,BA="32px",qA="16px",sy=4e3,WA=356,UA=14,HA=20,KA=200;function Tn(...e){return e.filter(Boolean).join(" ")}function YA(e){let[t,r]=e.split("-"),n=[];return t&&n.push(t),r&&n.push(r),n}var GA=e=>{var t,r,n,a,i,o,l,c,d,u,f;let{invert:m,toast:p,unstyled:x,interacting:g,setHeights:v,visibleToasts:y,heights:b,index:N,toasts:j,expanded:k,removeToast:w,defaultRichColors:S,closeButton:_,style:C,cancelButtonStyle:P,actionButtonStyle:O,className:E="",descriptionClassName:D="",duration:I,position:V,gap:Q,loadingIcon:q,expandByDefault:re,classNames:se,icons:T,closeButtonAriaLabel:M="Close toast",pauseWhenPageIsHidden:L}=e,[H,R]=W.useState(null),[Y,J]=W.useState(null),[A,U]=W.useState(!1),[$,ne]=W.useState(!1),[B,X]=W.useState(!1),[oe,G]=W.useState(!1),[te,de]=W.useState(!1),[me,Z]=W.useState(0),[xe,be]=W.useState(0),qe=W.useRef(p.duration||I||sy),We=W.useRef(null),Ge=W.useRef(null),ft=N===0,et=N+1<=y,Ke=p.type,Ze=p.dismissible!==!1,sr=p.className||"",Lr=p.descriptionClassName||"",ar=W.useMemo(()=>b.findIndex(ue=>ue.toastId===p.id)||0,[b,p.id]),wr=W.useMemo(()=>{var ue;return(ue=p.closeButton)!=null?ue:_},[p.closeButton,_]),ir=W.useMemo(()=>p.duration||I||sy,[p.duration,I]),jt=W.useRef(0),qt=W.useRef(0),Vt=W.useRef(0),or=W.useRef(null),[Xn,bs]=V.split("-"),Oe=W.useMemo(()=>b.reduce((ue,Pe,Ie)=>Ie>=ar?ue:ue+Pe.height,0),[b,ar]),ve=AA(),Ne=p.invert||m,pe=Ke==="loading";qt.current=W.useMemo(()=>ar*Q+Oe,[ar,Oe]),W.useEffect(()=>{qe.current=ir},[ir]),W.useEffect(()=>{U(!0)},[]),W.useEffect(()=>{let ue=Ge.current;if(ue){let Pe=ue.getBoundingClientRect().height;return be(Pe),v(Ie=>[{toastId:p.id,height:Pe,position:p.position},...Ie]),()=>v(Ie=>Ie.filter(wt=>wt.toastId!==p.id))}},[v,p.id]),W.useLayoutEffect(()=>{if(!A)return;let ue=Ge.current,Pe=ue.style.height;ue.style.height="auto";let Ie=ue.getBoundingClientRect().height;ue.style.height=Pe,be(Ie),v(wt=>wt.find(nt=>nt.toastId===p.id)?wt.map(nt=>nt.toastId===p.id?{...nt,height:Ie}:nt):[{toastId:p.id,height:Ie,position:p.position},...wt])},[A,p.title,p.description,v,p.id]);let je=W.useCallback(()=>{ne(!0),Z(qt.current),v(ue=>ue.filter(Pe=>Pe.toastId!==p.id)),setTimeout(()=>{w(p)},KA)},[p,w,v,qt]);W.useEffect(()=>{if(p.promise&&Ke==="loading"||p.duration===1/0||p.type==="loading")return;let ue;return k||g||L&&ve?(()=>{if(Vt.current<jt.current){let Pe=new Date().getTime()-jt.current;qe.current=qe.current-Pe}Vt.current=new Date().getTime()})():qe.current!==1/0&&(jt.current=new Date().getTime(),ue=setTimeout(()=>{var Pe;(Pe=p.onAutoClose)==null||Pe.call(p,p),je()},qe.current)),()=>clearTimeout(ue)},[k,g,p,Ke,L,ve,je]),W.useEffect(()=>{p.delete&&je()},[je,p.delete]);function Xe(){var ue,Pe,Ie;return T!=null&&T.loading?W.createElement("div",{className:Tn(se==null?void 0:se.loader,(ue=p==null?void 0:p.classNames)==null?void 0:ue.loader,"sonner-loader"),"data-visible":Ke==="loading"},T.loading):q?W.createElement("div",{className:Tn(se==null?void 0:se.loader,(Pe=p==null?void 0:p.classNames)==null?void 0:Pe.loader,"sonner-loader"),"data-visible":Ke==="loading"},q):W.createElement(CA,{className:Tn(se==null?void 0:se.loader,(Ie=p==null?void 0:p.classNames)==null?void 0:Ie.loader),visible:Ke==="loading"})}return W.createElement("li",{tabIndex:0,ref:Ge,className:Tn(E,sr,se==null?void 0:se.toast,(t=p==null?void 0:p.classNames)==null?void 0:t.toast,se==null?void 0:se.default,se==null?void 0:se[Ke],(r=p==null?void 0:p.classNames)==null?void 0:r[Ke]),"data-sonner-toast":"","data-rich-colors":(n=p.richColors)!=null?n:S,"data-styled":!(p.jsx||p.unstyled||x),"data-mounted":A,"data-promise":!!p.promise,"data-swiped":te,"data-removed":$,"data-visible":et,"data-y-position":Xn,"data-x-position":bs,"data-index":N,"data-front":ft,"data-swiping":B,"data-dismissible":Ze,"data-type":Ke,"data-invert":Ne,"data-swipe-out":oe,"data-swipe-direction":Y,"data-expanded":!!(k||re&&A),style:{"--index":N,"--toasts-before":N,"--z-index":j.length-N,"--offset":`${$?me:qt.current}px`,"--initial-height":re?"auto":`${xe}px`,...C,...p.style},onDragEnd:()=>{X(!1),R(null),or.current=null},onPointerDown:ue=>{pe||!Ze||(We.current=new Date,Z(qt.current),ue.target.setPointerCapture(ue.pointerId),ue.target.tagName!=="BUTTON"&&(X(!0),or.current={x:ue.clientX,y:ue.clientY}))},onPointerUp:()=>{var ue,Pe,Ie,wt;if(oe||!Ze)return;or.current=null;let nt=Number(((ue=Ge.current)==null?void 0:ue.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),st=Number(((Pe=Ge.current)==null?void 0:Pe.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Nr=new Date().getTime()-((Ie=We.current)==null?void 0:Ie.getTime()),lr=H==="x"?nt:st,Qn=Math.abs(lr)/Nr;if(Math.abs(lr)>=HA||Qn>.11){Z(qt.current),(wt=p.onDismiss)==null||wt.call(p,p),J(H==="x"?nt>0?"right":"left":st>0?"down":"up"),je(),G(!0),de(!1);return}X(!1),R(null)},onPointerMove:ue=>{var Pe,Ie,wt,nt;if(!or.current||!Ze||((Pe=window.getSelection())==null?void 0:Pe.toString().length)>0)return;let st=ue.clientY-or.current.y,Nr=ue.clientX-or.current.x,lr=(Ie=e.swipeDirections)!=null?Ie:YA(V);!H&&(Math.abs(Nr)>1||Math.abs(st)>1)&&R(Math.abs(Nr)>Math.abs(st)?"x":"y");let Qn={x:0,y:0};H==="y"?(lr.includes("top")||lr.includes("bottom"))&&(lr.includes("top")&&st<0||lr.includes("bottom")&&st>0)&&(Qn.y=st):H==="x"&&(lr.includes("left")||lr.includes("right"))&&(lr.includes("left")&&Nr<0||lr.includes("right")&&Nr>0)&&(Qn.x=Nr),(Math.abs(Qn.x)>0||Math.abs(Qn.y)>0)&&de(!0),(wt=Ge.current)==null||wt.style.setProperty("--swipe-amount-x",`${Qn.x}px`),(nt=Ge.current)==null||nt.style.setProperty("--swipe-amount-y",`${Qn.y}px`)}},wr&&!p.jsx?W.createElement("button",{"aria-label":M,"data-disabled":pe,"data-close-button":!0,onClick:pe||!Ze?()=>{}:()=>{var ue;je(),(ue=p.onDismiss)==null||ue.call(p,p)},className:Tn(se==null?void 0:se.closeButton,(a=p==null?void 0:p.classNames)==null?void 0:a.closeButton)},(i=T==null?void 0:T.close)!=null?i:EA):null,p.jsx||h.isValidElement(p.title)?p.jsx?p.jsx:typeof p.title=="function"?p.title():p.title:W.createElement(W.Fragment,null,Ke||p.icon||p.promise?W.createElement("div",{"data-icon":"",className:Tn(se==null?void 0:se.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||(T==null?void 0:T[Ke])||kA(Ke):null):null,W.createElement("div",{"data-content":"",className:Tn(se==null?void 0:se.content,(l=p==null?void 0:p.classNames)==null?void 0:l.content)},W.createElement("div",{"data-title":"",className:Tn(se==null?void 0:se.title,(c=p==null?void 0:p.classNames)==null?void 0:c.title)},typeof p.title=="function"?p.title():p.title),p.description?W.createElement("div",{"data-description":"",className:Tn(D,Lr,se==null?void 0:se.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&&Wc(p.cancel)?W.createElement("button",{"data-button":!0,"data-cancel":!0,style:p.cancelButtonStyle||P,onClick:ue=>{var Pe,Ie;Wc(p.cancel)&&Ze&&((Ie=(Pe=p.cancel).onClick)==null||Ie.call(Pe,ue),je())},className:Tn(se==null?void 0:se.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&&Wc(p.action)?W.createElement("button",{"data-button":!0,"data-action":!0,style:p.actionButtonStyle||O,onClick:ue=>{var Pe,Ie;Wc(p.action)&&((Ie=(Pe=p.action).onClick)==null||Ie.call(Pe,ue),!ue.defaultPrevented&&je())},className:Tn(se==null?void 0:se.actionButton,(f=p==null?void 0:p.classNames)==null?void 0:f.actionButton)},p.action.label):null))};function ay(){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 VA(e,t){let r={};return[e,t].forEach((n,a)=>{let i=a===1,o=i?"--mobile-offset":"--offset",l=i?qA:BA;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 XA=h.forwardRef(function(e,t){let{invert:r,position:n="bottom-right",hotkey:a=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:f,duration:m,style:p,visibleToasts:x=FA,toastOptions:g,dir:v=ay(),gap:y=UA,loadingIcon:b,icons:N,containerAriaLabel:j="Notifications",pauseWhenPageIsHidden:k}=e,[w,S]=W.useState([]),_=W.useMemo(()=>Array.from(new Set([n].concat(w.filter(L=>L.position).map(L=>L.position)))),[w,n]),[C,P]=W.useState([]),[O,E]=W.useState(!1),[D,I]=W.useState(!1),[V,Q]=W.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),q=W.useRef(null),re=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),se=W.useRef(null),T=W.useRef(!1),M=W.useCallback(L=>{S(H=>{var R;return(R=H.find(Y=>Y.id===L.id))!=null&&R.delete||Wr.dismiss(L.id),H.filter(({id:Y})=>Y!==L.id)})},[]);return W.useEffect(()=>Wr.subscribe(L=>{if(L.dismiss){S(H=>H.map(R=>R.id===L.id?{...R,delete:!0}:R));return}setTimeout(()=>{mE.flushSync(()=>{S(H=>{let R=H.findIndex(Y=>Y.id===L.id);return R!==-1?[...H.slice(0,R),{...H[R],...L},...H.slice(R+1)]:[L,...H]})})})}),[]),W.useEffect(()=>{if(u!=="system"){Q(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?Q("dark"):Q("light")),typeof window>"u")return;let L=window.matchMedia("(prefers-color-scheme: dark)");try{L.addEventListener("change",({matches:H})=>{Q(H?"dark":"light")})}catch{L.addListener(({matches:R})=>{try{Q(R?"dark":"light")}catch(Y){console.error(Y)}})}},[u]),W.useEffect(()=>{w.length<=1&&E(!1)},[w]),W.useEffect(()=>{let L=H=>{var R,Y;a.every(J=>H[J]||H.code===J)&&(E(!0),(R=q.current)==null||R.focus()),H.code==="Escape"&&(document.activeElement===q.current||(Y=q.current)!=null&&Y.contains(document.activeElement))&&E(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[a]),W.useEffect(()=>{if(q.current)return()=>{se.current&&(se.current.focus({preventScroll:!0}),se.current=null,T.current=!1)}},[q.current]),W.createElement("section",{ref:t,"aria-label":`${j} ${re}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},_.map((L,H)=>{var R;let[Y,J]=L.split("-");return w.length?W.createElement("ol",{key:L,dir:v==="auto"?ay():v,tabIndex:-1,ref:q,className:l,"data-sonner-toaster":!0,"data-theme":V,"data-y-position":Y,"data-lifted":O&&w.length>1&&!i,"data-x-position":J,style:{"--front-toast-height":`${((R=C[0])==null?void 0:R.height)||0}px`,"--width":`${WA}px`,"--gap":`${y}px`,...p,...VA(c,d)},onBlur:A=>{T.current&&!A.currentTarget.contains(A.relatedTarget)&&(T.current=!1,se.current&&(se.current.focus({preventScroll:!0}),se.current=null))},onFocus:A=>{A.target instanceof HTMLElement&&A.target.dataset.dismissible==="false"||T.current||(T.current=!0,se.current=A.relatedTarget)},onMouseEnter:()=>E(!0),onMouseMove:()=>E(!0),onMouseLeave:()=>{D||E(!1)},onDragEnd:()=>E(!1),onPointerDown:A=>{A.target instanceof HTMLElement&&A.target.dataset.dismissible==="false"||I(!0)},onPointerUp:()=>I(!1)},w.filter(A=>!A.position&&H===0||A.position===L).map((A,U)=>{var $,ne;return W.createElement(GA,{key:A.id,icons:N,index:U,toast:A,defaultRichColors:f,duration:($=g==null?void 0:g.duration)!=null?$:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:r,visibleToasts:x,closeButton:(ne=g==null?void 0:g.closeButton)!=null?ne:o,interacting:D,position:L,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:M,toasts:w.filter(B=>B.position==A.position),heights:C.filter(B=>B.position==A.position),setHeights:P,expandByDefault:i,gap:y,loadingIcon:b,expanded:O,pauseWhenPageIsHidden:k,swipeDirections:e.swipeDirections})})):null}))}),QA=(e,t,r,n,a,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?a.map(y=>i[y]||y):a;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{}},iy=["light","dark"],z1="(prefers-color-scheme: dark)",ZA=typeof window>"u",ix=h.createContext(void 0),JA={setTheme:e=>{},themes:[]},e5=()=>{var e;return(e=h.useContext(ix))!=null?e:JA},t5=e=>h.useContext(ix)?h.createElement(h.Fragment,null,e.children):h.createElement(n5,{...e}),r5=["light","dark"],n5=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:n=!0,storageKey:a="theme",themes:i=r5,defaultTheme:o=r?"system":"light",attribute:l="data-theme",value:c,children:d,nonce:u,scriptProps:f})=>{let[m,p]=h.useState(()=>a5(a,o)),[x,g]=h.useState(()=>m==="system"?_m():m),v=c?Object.values(c):i,y=h.useCallback(k=>{let w=k;if(!w)return;k==="system"&&r&&(w=_m());let S=c?c[w]:w,_=t?i5(u):null,C=document.documentElement,P=O=>{O==="class"?(C.classList.remove(...v),S&&C.classList.add(S)):O.startsWith("data-")&&(S?C.setAttribute(O,S):C.removeAttribute(O))};if(Array.isArray(l)?l.forEach(P):P(l),n){let O=iy.includes(o)?o:null,E=iy.includes(w)?w:O;C.style.colorScheme=E}_==null||_()},[u]),b=h.useCallback(k=>{let w=typeof k=="function"?k(m):k;p(w);try{localStorage.setItem(a,w)}catch{}},[m]),N=h.useCallback(k=>{let w=_m(k);g(w),m==="system"&&r&&!e&&y("system")},[m,e]);h.useEffect(()=>{let k=window.matchMedia(z1);return k.addListener(N),N(k),()=>k.removeListener(N)},[N]),h.useEffect(()=>{let k=w=>{w.key===a&&(w.newValue?p(w.newValue):b(o))};return window.addEventListener("storage",k),()=>window.removeEventListener("storage",k)},[b]),h.useEffect(()=>{y(e??m)},[e,m]);let j=h.useMemo(()=>({theme:m,setTheme:b,forcedTheme:e,resolvedTheme:m==="system"?x:m,themes:r?[...i,"system"]:i,systemTheme:r?x:void 0}),[m,b,e,x,r,i]);return h.createElement(ix.Provider,{value:j},h.createElement(s5,{forcedTheme:e,storageKey:a,attribute:l,enableSystem:r,enableColorScheme:n,defaultTheme:o,value:c,themes:i,nonce:u,scriptProps:f}),d)},s5=h.memo(({forcedTheme:e,storageKey:t,attribute:r,enableSystem:n,enableColorScheme:a,defaultTheme:i,value:o,themes:l,nonce:c,scriptProps:d})=>{let u=JSON.stringify([r,t,i,e,l,o,n,a]).slice(1,-1);return h.createElement("script",{...d,suppressHydrationWarning:!0,nonce:typeof window>"u"?c:"",dangerouslySetInnerHTML:{__html:`(${QA.toString()})(${u})`}})}),a5=(e,t)=>{if(ZA)return;let r;try{r=localStorage.getItem(e)||void 0}catch{}return r||t},i5=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)}},_m=e=>(e||(e=window.matchMedia(z1)),e.matches?"dark":"light");function o5({children:e}){return s.jsx(t5,{attribute:"class",defaultTheme:"system",enableSystem:!0,disableTransitionOnChange:!0,children:e})}const L1=h.createContext(null),Ua="meridian_token",Qo="meridian_user",Uc="meridian_workspace";function oy(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 l5({children:e}){const[t,r]=h.useState(()=>{try{const f=localStorage.getItem(Qo),m=localStorage.getItem(Ua);if(!f)return null;const p=JSON.parse(f),{roles:x,permissions:g}=m?oy(m):{roles:[],permissions:[]};return p.roles=x,p.permissions=g,p}catch{return null}}),[n,a]=h.useState(()=>{const f=localStorage.getItem(Ua),m=localStorage.getItem(Qo);return f&&!m?(localStorage.removeItem(Ua),null):f}),[i,o]=h.useState(()=>{try{const f=localStorage.getItem(Uc);return f?JSON.parse(f):null}catch{return null}}),l=(f,m)=>{const{roles:p,permissions:x}=oy(m),g={...f,roles:p,permissions:x};r(g),a(m),localStorage.setItem(Ua,m),localStorage.setItem(Qo,JSON.stringify(g))},c=()=>{const f=localStorage.getItem(Ua);f&&fetch("/auth/logout",{method:"POST",headers:{Authorization:`Bearer ${f}`,"Content-Type":"application/json"}}).catch(()=>{}),r(null),a(null),o(null),localStorage.removeItem(Ua),localStorage.removeItem(Qo),localStorage.removeItem(Uc)};h.useEffect(()=>{const f=()=>{localStorage.getItem(Ua)&&c()};return window.addEventListener("meridian:unauthorized",f),()=>window.removeEventListener("meridian:unauthorized",f)},[]);const d=f=>{o(f),f?localStorage.setItem(Uc,JSON.stringify(f)):localStorage.removeItem(Uc)},u=f=>{r(m=>{if(!m)return m;const p={...m,...f};return localStorage.setItem(Qo,JSON.stringify(p)),p})};return s.jsx(L1.Provider,{value:{user:t,token:n,workspace:i,isAuthenticated:!!n&&!!t,login:l,logout:c,setWorkspace:d,updateLocalUser:u},children:e})}function De(){const e=h.useContext(L1);if(!e)throw new Error("useAuth must be used within AuthProvider");return e}const F1=h.createContext(null);function c5({children:e}){const[t,r]=h.useState(!1);return h.useEffect(()=>{const n=a=>{(a.metaKey||a.ctrlKey)&&a.key==="k"&&(a.preventDefault(),r(i=>!i))};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[]),s.jsx(F1.Provider,{value:{open:t,setOpen:r,toggle:()=>r(n=>!n)},children:e})}function ox(){const e=h.useContext(F1);if(!e)throw new Error("useCommandPalette must be used within CommandPaletteProvider");return e}function B1(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;t<a;t++)e[t]&&(r=B1(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function lt(){for(var e,t,r=0,n="",a=arguments.length;r<a;r++)(e=arguments[r])&&(t=B1(e))&&(n&&(n+=" "),n+=t);return n}const lx="-",d5=e=>{const t=f5(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:n}=e;return{getClassGroupId:o=>{const l=o.split(lx);return l[0]===""&&l.length!==1&&l.shift(),q1(l,t)||u5(o)},getConflictingClassGroupIds:(o,l)=>{const c=r[o]||[];return l&&n[o]?[...c,...n[o]]:c}}},q1=(e,t)=>{var o;if(e.length===0)return t.classGroupId;const r=e[0],n=t.nextPart.get(r),a=n?q1(e.slice(1),n):void 0;if(a)return a;if(t.validators.length===0)return;const i=e.join(lx);return(o=t.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},ly=/^\[(.+)\]$/,u5=e=>{if(ly.test(e)){const t=ly.exec(e)[1],r=t==null?void 0:t.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},f5=e=>{const{theme:t,prefix:r}=e,n={nextPart:new Map,validators:[]};return h5(Object.entries(e.classGroups),r).forEach(([i,o])=>{Dh(o,n,i,t)}),n},Dh=(e,t,r,n)=>{e.forEach(a=>{if(typeof a=="string"){const i=a===""?t:cy(t,a);i.classGroupId=r;return}if(typeof a=="function"){if(m5(a)){Dh(a(n),t,r,n);return}t.validators.push({validator:a,classGroupId:r});return}Object.entries(a).forEach(([i,o])=>{Dh(o,cy(t,i),r,n)})})},cy=(e,t)=>{let r=e;return t.split(lx).forEach(n=>{r.nextPart.has(n)||r.nextPart.set(n,{nextPart:new Map,validators:[]}),r=r.nextPart.get(n)}),r},m5=e=>e.isThemeGetter,h5=(e,t)=>t?e.map(([r,n])=>{const a=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,a]}):e,p5=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,r=new Map,n=new Map;const a=(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 a(i,o),o},set(i,o){r.has(i)?r.set(i,o):a(i,o)}}},W1="!",x5=e=>{const{separator:t,experimentalParseClassName:r}=e,n=t.length===1,a=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===a&&(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(W1),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},g5=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},v5=e=>({cache:p5(e.cacheSize),parseClassName:x5(e),...d5(e)}),y5=/\s+/,b5=(e,t)=>{const{parseClassName:r,getClassGroupId:n,getConflictingClassGroupIds:a}=t,i=[],o=e.trim().split(y5);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=g5(u).join(":"),y=f?v+W1:v,b=y+g;if(i.includes(b))continue;i.push(b);const N=a(g,x);for(let j=0;j<N.length;++j){const k=N[j];i.push(y+k)}l=d+(l.length>0?" "+l:l)}return l};function j5(){let e=0,t,r,n="";for(;e<arguments.length;)(t=arguments[e++])&&(r=U1(t))&&(n&&(n+=" "),n+=r);return n}const U1=e=>{if(typeof e=="string")return e;let t,r="";for(let n=0;n<e.length;n++)e[n]&&(t=U1(e[n]))&&(r&&(r+=" "),r+=t);return r};function w5(e,...t){let r,n,a,i=o;function o(c){const d=t.reduce((u,f)=>f(u),e());return r=v5(d),n=r.cache.get,a=r.cache.set,i=l,l(c)}function l(c){const d=n(c);if(d)return d;const u=b5(c,r);return a(c,u),u}return function(){return i(j5.apply(null,arguments))}}const ht=e=>{const t=r=>r[e]||[];return t.isThemeGetter=!0,t},H1=/^\[(?:([a-z-]+):)?(.+)\]$/i,N5=/^\d+\/\d+$/,k5=new Set(["px","full","screen"]),S5=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,C5=/\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$/,_5=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,P5=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,M5=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ns=e=>Qi(e)||k5.has(e)||N5.test(e),ua=e=>Co(e,"length",$5),Qi=e=>!!e&&!Number.isNaN(Number(e)),Pm=e=>Co(e,"number",Qi),Zo=e=>!!e&&Number.isInteger(Number(e)),O5=e=>e.endsWith("%")&&Qi(e.slice(0,-1)),$e=e=>H1.test(e),fa=e=>S5.test(e),E5=new Set(["length","size","percentage"]),A5=e=>Co(e,E5,K1),D5=e=>Co(e,"position",K1),T5=new Set(["image","url"]),I5=e=>Co(e,T5,L5),R5=e=>Co(e,"",z5),Jo=()=>!0,Co=(e,t,r)=>{const n=H1.exec(e);return n?n[1]?typeof t=="string"?n[1]===t:t.has(n[1]):r(n[2]):!1},$5=e=>C5.test(e)&&!_5.test(e),K1=()=>!1,z5=e=>P5.test(e),L5=e=>M5.test(e),F5=()=>{const e=ht("colors"),t=ht("spacing"),r=ht("blur"),n=ht("brightness"),a=ht("borderColor"),i=ht("borderRadius"),o=ht("borderSpacing"),l=ht("borderWidth"),c=ht("contrast"),d=ht("grayscale"),u=ht("hueRotate"),f=ht("invert"),m=ht("gap"),p=ht("gradientColorStops"),x=ht("gradientColorStopPositions"),g=ht("inset"),v=ht("margin"),y=ht("opacity"),b=ht("padding"),N=ht("saturate"),j=ht("scale"),k=ht("sepia"),w=ht("skew"),S=ht("space"),_=ht("translate"),C=()=>["auto","contain","none"],P=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",$e,t],E=()=>[$e,t],D=()=>["",Ns,ua],I=()=>["auto",Qi,$e],V=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Q=()=>["solid","dashed","dotted","double","none"],q=()=>["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"],se=()=>["","0",$e],T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],M=()=>[Qi,$e];return{cacheSize:500,separator:":",theme:{colors:[Jo],spacing:[Ns,ua],blur:["none","",fa,$e],brightness:M(),borderColor:[e],borderRadius:["none","","full",fa,$e],borderSpacing:E(),borderWidth:D(),contrast:M(),grayscale:se(),hueRotate:M(),invert:se(),gap:E(),gradientColorStops:[e],gradientColorStopPositions:[O5,ua],inset:O(),margin:O(),opacity:M(),padding:E(),saturate:M(),scale:M(),sepia:se(),skew:M(),space:E(),translate:E()},classGroups:{aspect:[{aspect:["auto","square","video",$e]}],container:["container"],columns:[{columns:[fa]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"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:[...V(),$e]}],overflow:[{overflow:P()}],"overflow-x":[{"overflow-x":P()}],"overflow-y":[{"overflow-y":P()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],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,$e]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",$e]}],grow:[{grow:se()}],shrink:[{shrink:se()}],order:[{order:["first","last","none",Zo,$e]}],"grid-cols":[{"grid-cols":[Jo]}],"col-start-end":[{col:["auto",{span:["full",Zo,$e]},$e]}],"col-start":[{"col-start":I()}],"col-end":[{"col-end":I()}],"grid-rows":[{"grid-rows":[Jo]}],"row-start-end":[{row:["auto",{span:[Zo,$e]},$e]}],"row-start":[{"row-start":I()}],"row-end":[{"row-end":I()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",$e]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",$e]}],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:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],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":[S]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[S]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",$e,t]}],"min-w":[{"min-w":[$e,t,"min","max","fit"]}],"max-w":[{"max-w":[$e,t,"none","full","min","max","fit","prose",{screen:[fa]},fa]}],h:[{h:[$e,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[$e,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[$e,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[$e,t,"auto","min","max","fit"]}],"font-size":[{text:["base",fa,ua]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Pm]}],"font-family":[{font:[Jo]}],"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",$e]}],"line-clamp":[{"line-clamp":["none",Qi,Pm]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ns,$e]}],"list-image":[{"list-image":["none",$e]}],"list-style-type":[{list:["none","disc","decimal",$e]}],"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:[...Q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ns,ua]}],"underline-offset":[{"underline-offset":["auto",Ns,$e]}],"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:E()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",$e]}],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",$e]}],"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:[...V(),D5]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",A5]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},I5]}],"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:[...Q(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:Q()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...Q()]}],"outline-offset":[{"outline-offset":[Ns,$e]}],"outline-w":[{outline:[Ns,ua]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:D()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[Ns,ua]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",fa,R5]}],"shadow-color":[{shadow:[Jo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...q(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":q()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[n]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",fa,$e]}],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",$e]}],duration:[{duration:M()}],ease:[{ease:["linear","in","out","in-out",$e]}],delay:[{delay:M()}],animate:[{animate:["none","spin","ping","pulse","bounce",$e]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Zo,$e]}],"translate-x":[{"translate-x":[_]}],"translate-y":[{"translate-y":[_]}],"skew-x":[{"skew-x":[w]}],"skew-y":[{"skew-y":[w]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",$e]}],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",$e]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":E()}],"scroll-mx":[{"scroll-mx":E()}],"scroll-my":[{"scroll-my":E()}],"scroll-ms":[{"scroll-ms":E()}],"scroll-me":[{"scroll-me":E()}],"scroll-mt":[{"scroll-mt":E()}],"scroll-mr":[{"scroll-mr":E()}],"scroll-mb":[{"scroll-mb":E()}],"scroll-ml":[{"scroll-ml":E()}],"scroll-p":[{"scroll-p":E()}],"scroll-px":[{"scroll-px":E()}],"scroll-py":[{"scroll-py":E()}],"scroll-ps":[{"scroll-ps":E()}],"scroll-pe":[{"scroll-pe":E()}],"scroll-pt":[{"scroll-pt":E()}],"scroll-pr":[{"scroll-pr":E()}],"scroll-pb":[{"scroll-pb":E()}],"scroll-pl":[{"scroll-pl":E()}],"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",$e]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ns,ua,Pm]}],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"]}}},B5=w5(F5);function z(...e){return B5(lt(e))}const Ku=yE,ls=gE,cs=vE,Wn=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>s.jsx(Qw,{ref:n,sideOffset:t,className:z("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}));Wn.displayName=Qw.displayName;const Y1=h.createContext([]);function q5({widgets:e,children:t}){return W.createElement(Y1.Provider,{value:e},t)}function W5(e){return h.useContext(Y1).filter(r=>r.zone===e).map(r=>r.component)}var Vw;const ro=((Vw=window.__MERIDIAN_CONFIG__)==null?void 0:Vw.apiUrl)??void 0??"";class nc extends Error{constructor(t,r,n){super(r),this.status=t,this.data=n,this.name="ApiError"}}function G1(){return localStorage.getItem("meridian_token")}async function el(e,t={}){var i;const r=G1(),n={"Content-Type":"application/json",...t.headers};r&&(n.Authorization=`Bearer ${r}`);const a=await fetch(`${ro}${e}`,{...t,headers:n});if(!a.ok){let o;try{o=await a.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${a.status}`;throw a.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new nc(a.status,l,o)}if(a.status!==204)return a.json()}const ie={get:e=>el(e,{method:"GET"}),post:(e,t)=>el(e,{method:"POST",body:JSON.stringify(t)}),put:(e,t)=>el(e,{method:"PUT",body:JSON.stringify(t)}),patch:(e,t)=>el(e,{method:"PATCH",body:JSON.stringify(t)}),delete:e=>el(e,{method:"DELETE"}),upload:async(e,t)=>{var i;const r=G1(),n={};r&&(n.Authorization=`Bearer ${r}`);const a=await fetch(`${ro}${e}`,{method:"POST",headers:n,body:t});if(!a.ok){let o;try{o=await a.json()}catch{o=null}const l=((i=o==null?void 0:o.error)==null?void 0:i.message)??`HTTP ${a.status}`;throw a.status===401&&window.dispatchEvent(new CustomEvent("meridian:unauthorized")),new nc(a.status,l,o)}if(a.status!==204)return a.json()}},xt={all:["issues"],byProject:(e,t)=>[...xt.all,"project",e,...t?[t]:[]],paginated:e=>[...xt.all,"paginated",e],related:e=>[...xt.all,e,"related"],relations:e=>[...xt.all,e,"relations"],detail:e=>[...xt.all,e],comments:e=>[...xt.all,e,"comments"],activities:e=>[...xt.all,e,"activities"]};function Yu(e,t){return Te({queryKey:e?xt.byProject(e,t):xt.all,queryFn:async()=>{var u,f,m;const r=new URLSearchParams;e&&(r.set("project_id",e),r.set("limit","1000")),(u=t==null?void 0:t.priority)!=null&&u.length&&r.set("priority",t.priority.join(",")),t!=null&&t.assignee_id&&r.set("assignee_id",t.assignee_id),(f=t==null?void 0:t.type)!=null&&f.length&&r.set("type",t.type.join(",")),(m=t==null?void 0:t.status)!=null&&m.length&&r.set("status",t.status.join(","));const n=await ie.get(`/admin/issues?${r}`);if(n.count<=n.issues.length)return n;const a=n.issues.length,i=n.count-a,o=Math.ceil(i/a),l=Array.from({length:o},(p,x)=>{const g=new URLSearchParams(r);return g.set("offset",String(a*(x+1))),ie.get(`/admin/issues?${g}`)}),c=await Promise.all(l);return{issues:n.issues.concat(...c.map(p=>p.issues)),count:n.count}},select:r=>r.issues,enabled:!!e})}function V1(e){return Te({queryKey:xt.detail(e),queryFn:()=>ie.get(`/admin/issues/${e}`),select:t=>t.issue,enabled:!!e})}function X1(e){return Te({queryKey:xt.related(e),queryFn:()=>ie.get(`/admin/issues/${e}/related`),enabled:!!e})}function U5(e){return Te({queryKey:xt.comments(e),queryFn:()=>ie.get(`/admin/issues/${e}/comments`),select:t=>t.comments,enabled:!!e})}function Q1(){const e=ye();return ge({mutationFn:t=>ie.post("/admin/issues",t),onSuccess:(t,r)=>{e.invalidateQueries({queryKey:xt.byProject(r.project_id)}),e.invalidateQueries({queryKey:["issues","paginated"]})}})}function Gu(e,t){const r=ye();return ge({mutationFn:n=>ie.put(`/admin/issues/${e}`,n),onMutate:async n=>{await r.cancelQueries({queryKey:xt.byProject(t)});const a=r.getQueryData(xt.byProject(t));return r.setQueryData(xt.byProject(t),i=>i&&{...i,issues:i.issues.map(o=>o.id===e?{...o,...n}:o)}),{previous:a}},onError:(n,a,i)=>{i!=null&&i.previous&&r.setQueryData(xt.byProject(t),i.previous)},onSettled:()=>{r.invalidateQueries({queryKey:xt.byProject(t)}),r.invalidateQueries({queryKey:xt.detail(e)}),r.invalidateQueries({queryKey:["issues","paginated"]}),r.invalidateQueries({queryKey:xt.related(e)})}})}function H5(e){return Te({queryKey:xt.activities(e),queryFn:()=>ie.get(`/admin/issues/${e}/activities`),select:t=>t.activities,enabled:!!e})}function K5(e){const t=ye();return ge({mutationFn:({body:r,metadata:n})=>ie.post(`/admin/issues/${e}/comments`,{body:r,metadata:n}),onSuccess:()=>{t.invalidateQueries({queryKey:xt.comments(e)})}})}const dy=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,uy=lt,sc=(e,t)=>r=>{var n;if((t==null?void 0:t.variants)==null)return uy(e,r==null?void 0:r.class,r==null?void 0:r.className);const{variants:a,defaultVariants:i}=t,o=Object.keys(a).map(d=>{const u=r==null?void 0:r[d],f=i==null?void 0:i[d];if(u===null)return null;const m=dy(u)||dy(f);return a[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 uy(e,o,c,r==null?void 0:r.class,r==null?void 0:r.className)},Zi=sc("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"}}),ee=h.forwardRef(({className:e,variant:t,size:r,asChild:n=!1,...a},i)=>{const o=n?ex:"button";return s.jsx(o,{className:z(Zi({variant:t,size:r,className:e})),ref:i,...a})});ee.displayName="Button";const _e=h.forwardRef(({className:e,type:t,...r},n)=>s.jsx("input",{type:t,className:z("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}));_e.displayName="Input";/**
4
+ * @license lucide-react v0.468.0 - ISC
5
+ *
6
+ * This source code is licensed under the ISC license.
7
+ * See the LICENSE file in the root directory of this source tree.
8
+ */const Y5=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Z1=(...e)=>e.filter((t,r,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===r).join(" ").trim();/**
9
+ * @license lucide-react v0.468.0 - ISC
10
+ *
11
+ * This source code is licensed under the ISC license.
12
+ * See the LICENSE file in the root directory of this source tree.
13
+ */var G5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
14
+ * @license lucide-react v0.468.0 - ISC
15
+ *
16
+ * This source code is licensed under the ISC license.
17
+ * See the LICENSE file in the root directory of this source tree.
18
+ */const V5=h.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:r=2,absoluteStrokeWidth:n,className:a="",children:i,iconNode:o,...l},c)=>h.createElement("svg",{ref:c,...G5,width:t,height:t,stroke:e,strokeWidth:n?Number(r)*24/Number(t):r,className:Z1("lucide",a),...l},[...o.map(([d,u])=>h.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
19
+ * @license lucide-react v0.468.0 - ISC
20
+ *
21
+ * This source code is licensed under the ISC license.
22
+ * See the LICENSE file in the root directory of this source tree.
23
+ */const ce=(e,t)=>{const r=h.forwardRef(({className:n,...a},i)=>h.createElement(V5,{ref:i,iconNode:t,className:Z1(`lucide-${Y5(e)}`,n),...a}));return r.displayName=`${e}`,r};/**
24
+ * @license lucide-react v0.468.0 - ISC
25
+ *
26
+ * This source code is licensed under the ISC license.
27
+ * See the LICENSE file in the root directory of this source tree.
28
+ */const Ol=ce("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
29
+ * @license lucide-react v0.468.0 - ISC
30
+ *
31
+ * This source code is licensed under the ISC license.
32
+ * See the LICENSE file in the root directory of this source tree.
33
+ */const _i=ce("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
34
+ * @license lucide-react v0.468.0 - ISC
35
+ *
36
+ * This source code is licensed under the ISC license.
37
+ * See the LICENSE file in the root directory of this source tree.
38
+ */const $a=ce("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
39
+ * @license lucide-react v0.468.0 - ISC
40
+ *
41
+ * This source code is licensed under the ISC license.
42
+ * See the LICENSE file in the root directory of this source tree.
43
+ */const Ad=ce("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/**
44
+ * @license lucide-react v0.468.0 - ISC
45
+ *
46
+ * This source code is licensed under the ISC license.
47
+ * See the LICENSE file in the root directory of this source tree.
48
+ */const cx=ce("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
49
+ * @license lucide-react v0.468.0 - ISC
50
+ *
51
+ * This source code is licensed under the ISC license.
52
+ * See the LICENSE file in the root directory of this source tree.
53
+ */const Pi=ce("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
54
+ * @license lucide-react v0.468.0 - ISC
55
+ *
56
+ * This source code is licensed under the ISC license.
57
+ * See the LICENSE file in the root directory of this source tree.
58
+ */const mi=ce("Bell",[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}]]);/**
59
+ * @license lucide-react v0.468.0 - ISC
60
+ *
61
+ * This source code is licensed under the ISC license.
62
+ * See the LICENSE file in the root directory of this source tree.
63
+ */const J1=ce("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
64
+ * @license lucide-react v0.468.0 - ISC
65
+ *
66
+ * This source code is licensed under the ISC license.
67
+ * See the LICENSE file in the root directory of this source tree.
68
+ */const eN=ce("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
69
+ * @license lucide-react v0.468.0 - ISC
70
+ *
71
+ * This source code is licensed under the ISC license.
72
+ * See the LICENSE file in the root directory of this source tree.
73
+ */const El=ce("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
74
+ * @license lucide-react v0.468.0 - ISC
75
+ *
76
+ * This source code is licensed under the ISC license.
77
+ * See the LICENSE file in the root directory of this source tree.
78
+ */const tN=ce("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
79
+ * @license lucide-react v0.468.0 - ISC
80
+ *
81
+ * This source code is licensed under the ISC license.
82
+ * See the LICENSE file in the root directory of this source tree.
83
+ */const hi=ce("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/**
84
+ * @license lucide-react v0.468.0 - ISC
85
+ *
86
+ * This source code is licensed under the ISC license.
87
+ * See the LICENSE file in the root directory of this source tree.
88
+ */const Ht=ce("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
89
+ * @license lucide-react v0.468.0 - ISC
90
+ *
91
+ * This source code is licensed under the ISC license.
92
+ * See the LICENSE file in the root directory of this source tree.
93
+ */const X5=ce("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
94
+ * @license lucide-react v0.468.0 - ISC
95
+ *
96
+ * This source code is licensed under the ISC license.
97
+ * See the LICENSE file in the root directory of this source tree.
98
+ */const zs=ce("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/**
99
+ * @license lucide-react v0.468.0 - ISC
100
+ *
101
+ * This source code is licensed under the ISC license.
102
+ * See the LICENSE file in the root directory of this source tree.
103
+ */const fy=ce("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
104
+ * @license lucide-react v0.468.0 - ISC
105
+ *
106
+ * This source code is licensed under the ISC license.
107
+ * See the LICENSE file in the root directory of this source tree.
108
+ */const Ct=ce("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
109
+ * @license lucide-react v0.468.0 - ISC
110
+ *
111
+ * This source code is licensed under the ISC license.
112
+ * See the LICENSE file in the root directory of this source tree.
113
+ */const Zs=ce("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
114
+ * @license lucide-react v0.468.0 - ISC
115
+ *
116
+ * This source code is licensed under the ISC license.
117
+ * See the LICENSE file in the root directory of this source tree.
118
+ */const fs=ce("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
119
+ * @license lucide-react v0.468.0 - ISC
120
+ *
121
+ * This source code is licensed under the ISC license.
122
+ * See the LICENSE file in the root directory of this source tree.
123
+ */const pr=ce("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
124
+ * @license lucide-react v0.468.0 - ISC
125
+ *
126
+ * This source code is licensed under the ISC license.
127
+ * See the LICENSE file in the root directory of this source tree.
128
+ */const dx=ce("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
129
+ * @license lucide-react v0.468.0 - ISC
130
+ *
131
+ * This source code is licensed under the ISC license.
132
+ * See the LICENSE file in the root directory of this source tree.
133
+ */const _o=ce("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/**
134
+ * @license lucide-react v0.468.0 - ISC
135
+ *
136
+ * This source code is licensed under the ISC license.
137
+ * See the LICENSE file in the root directory of this source tree.
138
+ */const kn=ce("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
139
+ * @license lucide-react v0.468.0 - ISC
140
+ *
141
+ * This source code is licensed under the ISC license.
142
+ * See the LICENSE file in the root directory of this source tree.
143
+ */const rN=ce("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
144
+ * @license lucide-react v0.468.0 - ISC
145
+ *
146
+ * This source code is licensed under the ISC license.
147
+ * See the LICENSE file in the root directory of this source tree.
148
+ */const ux=ce("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
149
+ * @license lucide-react v0.468.0 - ISC
150
+ *
151
+ * This source code is licensed under the ISC license.
152
+ * See the LICENSE file in the root directory of this source tree.
153
+ */const Er=ce("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
154
+ * @license lucide-react v0.468.0 - ISC
155
+ *
156
+ * This source code is licensed under the ISC license.
157
+ * See the LICENSE file in the root directory of this source tree.
158
+ */const Q5=ce("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
159
+ * @license lucide-react v0.468.0 - ISC
160
+ *
161
+ * This source code is licensed under the ISC license.
162
+ * See the LICENSE file in the root directory of this source tree.
163
+ */const Ar=ce("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
164
+ * @license lucide-react v0.468.0 - ISC
165
+ *
166
+ * This source code is licensed under the ISC license.
167
+ * See the LICENSE file in the root directory of this source tree.
168
+ */const nN=ce("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
169
+ * @license lucide-react v0.468.0 - ISC
170
+ *
171
+ * This source code is licensed under the ISC license.
172
+ * See the LICENSE file in the root directory of this source tree.
173
+ */const sN=ce("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
174
+ * @license lucide-react v0.468.0 - ISC
175
+ *
176
+ * This source code is licensed under the ISC license.
177
+ * See the LICENSE file in the root directory of this source tree.
178
+ */const fx=ce("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
179
+ * @license lucide-react v0.468.0 - ISC
180
+ *
181
+ * This source code is licensed under the ISC license.
182
+ * See the LICENSE file in the root directory of this source tree.
183
+ */const Z5=ce("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/**
184
+ * @license lucide-react v0.468.0 - ISC
185
+ *
186
+ * This source code is licensed under the ISC license.
187
+ * See the LICENSE file in the root directory of this source tree.
188
+ */const mx=ce("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
189
+ * @license lucide-react v0.468.0 - ISC
190
+ *
191
+ * This source code is licensed under the ISC license.
192
+ * See the LICENSE file in the root directory of this source tree.
193
+ */const Ls=ce("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
194
+ * @license lucide-react v0.468.0 - ISC
195
+ *
196
+ * This source code is licensed under the ISC license.
197
+ * See the LICENSE file in the root directory of this source tree.
198
+ */const hx=ce("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
199
+ * @license lucide-react v0.468.0 - ISC
200
+ *
201
+ * This source code is licensed under the ISC license.
202
+ * See the LICENSE file in the root directory of this source tree.
203
+ */const ac=ce("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
204
+ * @license lucide-react v0.468.0 - ISC
205
+ *
206
+ * This source code is licensed under the ISC license.
207
+ * See the LICENSE file in the root directory of this source tree.
208
+ */const Mi=ce("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
209
+ * @license lucide-react v0.468.0 - ISC
210
+ *
211
+ * This source code is licensed under the ISC license.
212
+ * See the LICENSE file in the root directory of this source tree.
213
+ */const J5=ce("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/**
214
+ * @license lucide-react v0.468.0 - ISC
215
+ *
216
+ * This source code is licensed under the ISC license.
217
+ * See the LICENSE file in the root directory of this source tree.
218
+ */const eD=ce("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/**
219
+ * @license lucide-react v0.468.0 - ISC
220
+ *
221
+ * This source code is licensed under the ISC license.
222
+ * See the LICENSE file in the root directory of this source tree.
223
+ */const tD=ce("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/**
224
+ * @license lucide-react v0.468.0 - ISC
225
+ *
226
+ * This source code is licensed under the ISC license.
227
+ * See the LICENSE file in the root directory of this source tree.
228
+ */const rD=ce("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
229
+ * @license lucide-react v0.468.0 - ISC
230
+ *
231
+ * This source code is licensed under the ISC license.
232
+ * See the LICENSE file in the root directory of this source tree.
233
+ */const nD=ce("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/**
234
+ * @license lucide-react v0.468.0 - ISC
235
+ *
236
+ * This source code is licensed under the ISC license.
237
+ * See the LICENSE file in the root directory of this source tree.
238
+ */const px=ce("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/**
239
+ * @license lucide-react v0.468.0 - ISC
240
+ *
241
+ * This source code is licensed under the ISC license.
242
+ * See the LICENSE file in the root directory of this source tree.
243
+ */const ds=ce("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/**
244
+ * @license lucide-react v0.468.0 - ISC
245
+ *
246
+ * This source code is licensed under the ISC license.
247
+ * See the LICENSE file in the root directory of this source tree.
248
+ */const Th=ce("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/**
249
+ * @license lucide-react v0.468.0 - ISC
250
+ *
251
+ * This source code is licensed under the ISC license.
252
+ * See the LICENSE file in the root directory of this source tree.
253
+ */const aN=ce("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
254
+ * @license lucide-react v0.468.0 - ISC
255
+ *
256
+ * This source code is licensed under the ISC license.
257
+ * See the LICENSE file in the root directory of this source tree.
258
+ */const sD=ce("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
259
+ * @license lucide-react v0.468.0 - ISC
260
+ *
261
+ * This source code is licensed under the ISC license.
262
+ * See the LICENSE file in the root directory of this source tree.
263
+ */const aD=ce("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
264
+ * @license lucide-react v0.468.0 - ISC
265
+ *
266
+ * This source code is licensed under the ISC license.
267
+ * See the LICENSE file in the root directory of this source tree.
268
+ */const iD=ce("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
269
+ * @license lucide-react v0.468.0 - ISC
270
+ *
271
+ * This source code is licensed under the ISC license.
272
+ * See the LICENSE file in the root directory of this source tree.
273
+ */const iN=ce("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
274
+ * @license lucide-react v0.468.0 - ISC
275
+ *
276
+ * This source code is licensed under the ISC license.
277
+ * See the LICENSE file in the root directory of this source tree.
278
+ */const oD=ce("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
279
+ * @license lucide-react v0.468.0 - ISC
280
+ *
281
+ * This source code is licensed under the ISC license.
282
+ * See the LICENSE file in the root directory of this source tree.
283
+ */const Gr=ce("Layers",[["path",{d:"M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z",key:"zw3jo"}],["path",{d:"M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12",key:"1wduqc"}],["path",{d:"M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17",key:"kqbvx6"}]]);/**
284
+ * @license lucide-react v0.468.0 - ISC
285
+ *
286
+ * This source code is licensed under the ISC license.
287
+ * See the LICENSE file in the root directory of this source tree.
288
+ */const Dd=ce("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
289
+ * @license lucide-react v0.468.0 - ISC
290
+ *
291
+ * This source code is licensed under the ISC license.
292
+ * See the LICENSE file in the root directory of this source tree.
293
+ */const oN=ce("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/**
294
+ * @license lucide-react v0.468.0 - ISC
295
+ *
296
+ * This source code is licensed under the ISC license.
297
+ * See the LICENSE file in the root directory of this source tree.
298
+ */const lD=ce("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
299
+ * @license lucide-react v0.468.0 - ISC
300
+ *
301
+ * This source code is licensed under the ISC license.
302
+ * See the LICENSE file in the root directory of this source tree.
303
+ */const Ea=ce("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
304
+ * @license lucide-react v0.468.0 - ISC
305
+ *
306
+ * This source code is licensed under the ISC license.
307
+ * See the LICENSE file in the root directory of this source tree.
308
+ */const cD=ce("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
309
+ * @license lucide-react v0.468.0 - ISC
310
+ *
311
+ * This source code is licensed under the ISC license.
312
+ * See the LICENSE file in the root directory of this source tree.
313
+ */const lN=ce("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
314
+ * @license lucide-react v0.468.0 - ISC
315
+ *
316
+ * This source code is licensed under the ISC license.
317
+ * See the LICENSE file in the root directory of this source tree.
318
+ */const Ds=ce("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/**
319
+ * @license lucide-react v0.468.0 - ISC
320
+ *
321
+ * This source code is licensed under the ISC license.
322
+ * See the LICENSE file in the root directory of this source tree.
323
+ */const xx=ce("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
324
+ * @license lucide-react v0.468.0 - ISC
325
+ *
326
+ * This source code is licensed under the ISC license.
327
+ * See the LICENSE file in the root directory of this source tree.
328
+ */const Sn=ce("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
329
+ * @license lucide-react v0.468.0 - ISC
330
+ *
331
+ * This source code is licensed under the ISC license.
332
+ * See the LICENSE file in the root directory of this source tree.
333
+ */const Vu=ce("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
334
+ * @license lucide-react v0.468.0 - ISC
335
+ *
336
+ * This source code is licensed under the ISC license.
337
+ * See the LICENSE file in the root directory of this source tree.
338
+ */const dD=ce("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
339
+ * @license lucide-react v0.468.0 - ISC
340
+ *
341
+ * This source code is licensed under the ISC license.
342
+ * See the LICENSE file in the root directory of this source tree.
343
+ */const cN=ce("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
344
+ * @license lucide-react v0.468.0 - ISC
345
+ *
346
+ * This source code is licensed under the ISC license.
347
+ * See the LICENSE file in the root directory of this source tree.
348
+ */const Js=ce("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
349
+ * @license lucide-react v0.468.0 - ISC
350
+ *
351
+ * This source code is licensed under the ISC license.
352
+ * See the LICENSE file in the root directory of this source tree.
353
+ */const uD=ce("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
354
+ * @license lucide-react v0.468.0 - ISC
355
+ *
356
+ * This source code is licensed under the ISC license.
357
+ * See the LICENSE file in the root directory of this source tree.
358
+ */const fD=ce("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
359
+ * @license lucide-react v0.468.0 - ISC
360
+ *
361
+ * This source code is licensed under the ISC license.
362
+ * See the LICENSE file in the root directory of this source tree.
363
+ */const gx=ce("Paperclip",[["path",{d:"M13.234 20.252 21 12.3",key:"1cbrk9"}],["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 0 2.828 2 2 0 0 0 2.828 0l8.414-8.586a4 4 0 0 0 0-5.656 4 4 0 0 0-5.656 0l-8.415 8.585a6 6 0 1 0 8.486 8.486",key:"1pkts6"}]]);/**
364
+ * @license lucide-react v0.468.0 - ISC
365
+ *
366
+ * This source code is licensed under the ISC license.
367
+ * See the LICENSE file in the root directory of this source tree.
368
+ */const Fs=ce("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
369
+ * @license lucide-react v0.468.0 - ISC
370
+ *
371
+ * This source code is licensed under the ISC license.
372
+ * See the LICENSE file in the root directory of this source tree.
373
+ */const Al=ce("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
374
+ * @license lucide-react v0.468.0 - ISC
375
+ *
376
+ * This source code is licensed under the ISC license.
377
+ * See the LICENSE file in the root directory of this source tree.
378
+ */const ot=ce("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
379
+ * @license lucide-react v0.468.0 - ISC
380
+ *
381
+ * This source code is licensed under the ISC license.
382
+ * See the LICENSE file in the root directory of this source tree.
383
+ */const mD=ce("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
384
+ * @license lucide-react v0.468.0 - ISC
385
+ *
386
+ * This source code is licensed under the ISC license.
387
+ * See the LICENSE file in the root directory of this source tree.
388
+ */const hD=ce("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/**
389
+ * @license lucide-react v0.468.0 - ISC
390
+ *
391
+ * This source code is licensed under the ISC license.
392
+ * See the LICENSE file in the root directory of this source tree.
393
+ */const no=ce("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
394
+ * @license lucide-react v0.468.0 - ISC
395
+ *
396
+ * This source code is licensed under the ISC license.
397
+ * See the LICENSE file in the root directory of this source tree.
398
+ */const Td=ce("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
399
+ * @license lucide-react v0.468.0 - ISC
400
+ *
401
+ * This source code is licensed under the ISC license.
402
+ * See the LICENSE file in the root directory of this source tree.
403
+ */const za=ce("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
404
+ * @license lucide-react v0.468.0 - ISC
405
+ *
406
+ * This source code is licensed under the ISC license.
407
+ * See the LICENSE file in the root directory of this source tree.
408
+ */const pD=ce("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
409
+ * @license lucide-react v0.468.0 - ISC
410
+ *
411
+ * This source code is licensed under the ISC license.
412
+ * See the LICENSE file in the root directory of this source tree.
413
+ */const Id=ce("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
414
+ * @license lucide-react v0.468.0 - ISC
415
+ *
416
+ * This source code is licensed under the ISC license.
417
+ * See the LICENSE file in the root directory of this source tree.
418
+ */const vx=ce("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
419
+ * @license lucide-react v0.468.0 - ISC
420
+ *
421
+ * This source code is licensed under the ISC license.
422
+ * See the LICENSE file in the root directory of this source tree.
423
+ */const xD=ce("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
424
+ * @license lucide-react v0.468.0 - ISC
425
+ *
426
+ * This source code is licensed under the ISC license.
427
+ * See the LICENSE file in the root directory of this source tree.
428
+ */const gD=ce("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
429
+ * @license lucide-react v0.468.0 - ISC
430
+ *
431
+ * This source code is licensed under the ISC license.
432
+ * See the LICENSE file in the root directory of this source tree.
433
+ */const Ih=ce("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
434
+ * @license lucide-react v0.468.0 - ISC
435
+ *
436
+ * This source code is licensed under the ISC license.
437
+ * See the LICENSE file in the root directory of this source tree.
438
+ */const dN=ce("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
439
+ * @license lucide-react v0.468.0 - ISC
440
+ *
441
+ * This source code is licensed under the ISC license.
442
+ * See the LICENSE file in the root directory of this source tree.
443
+ */const Xu=ce("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/**
444
+ * @license lucide-react v0.468.0 - ISC
445
+ *
446
+ * This source code is licensed under the ISC license.
447
+ * See the LICENSE file in the root directory of this source tree.
448
+ */const uN=ce("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
449
+ * @license lucide-react v0.468.0 - ISC
450
+ *
451
+ * This source code is licensed under the ISC license.
452
+ * See the LICENSE file in the root directory of this source tree.
453
+ */const fN=ce("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
454
+ * @license lucide-react v0.468.0 - ISC
455
+ *
456
+ * This source code is licensed under the ISC license.
457
+ * See the LICENSE file in the root directory of this source tree.
458
+ */const vD=ce("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
459
+ * @license lucide-react v0.468.0 - ISC
460
+ *
461
+ * This source code is licensed under the ISC license.
462
+ * See the LICENSE file in the root directory of this source tree.
463
+ */const yD=ce("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
464
+ * @license lucide-react v0.468.0 - ISC
465
+ *
466
+ * This source code is licensed under the ISC license.
467
+ * See the LICENSE file in the root directory of this source tree.
468
+ */const my=ce("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/**
469
+ * @license lucide-react v0.468.0 - ISC
470
+ *
471
+ * This source code is licensed under the ISC license.
472
+ * See the LICENSE file in the root directory of this source tree.
473
+ */const bD=ce("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
474
+ * @license lucide-react v0.468.0 - ISC
475
+ *
476
+ * This source code is licensed under the ISC license.
477
+ * See the LICENSE file in the root directory of this source tree.
478
+ */const mN=ce("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
479
+ * @license lucide-react v0.468.0 - ISC
480
+ *
481
+ * This source code is licensed under the ISC license.
482
+ * See the LICENSE file in the root directory of this source tree.
483
+ */const jr=ce("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
484
+ * @license lucide-react v0.468.0 - ISC
485
+ *
486
+ * This source code is licensed under the ISC license.
487
+ * See the LICENSE file in the root directory of this source tree.
488
+ */const jD=ce("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/**
489
+ * @license lucide-react v0.468.0 - ISC
490
+ *
491
+ * This source code is licensed under the ISC license.
492
+ * See the LICENSE file in the root directory of this source tree.
493
+ */const hN=ce("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
494
+ * @license lucide-react v0.468.0 - ISC
495
+ *
496
+ * This source code is licensed under the ISC license.
497
+ * See the LICENSE file in the root directory of this source tree.
498
+ */const wD=ce("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
499
+ * @license lucide-react v0.468.0 - ISC
500
+ *
501
+ * This source code is licensed under the ISC license.
502
+ * See the LICENSE file in the root directory of this source tree.
503
+ */const ND=ce("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
504
+ * @license lucide-react v0.468.0 - ISC
505
+ *
506
+ * This source code is licensed under the ISC license.
507
+ * See the LICENSE file in the root directory of this source tree.
508
+ */const kD=ce("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
509
+ * @license lucide-react v0.468.0 - ISC
510
+ *
511
+ * This source code is licensed under the ISC license.
512
+ * See the LICENSE file in the root directory of this source tree.
513
+ */const SD=ce("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/**
514
+ * @license lucide-react v0.468.0 - ISC
515
+ *
516
+ * This source code is licensed under the ISC license.
517
+ * See the LICENSE file in the root directory of this source tree.
518
+ */const pN=ce("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
519
+ * @license lucide-react v0.468.0 - ISC
520
+ *
521
+ * This source code is licensed under the ISC license.
522
+ * See the LICENSE file in the root directory of this source tree.
523
+ */const Nn=ce("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
524
+ * @license lucide-react v0.468.0 - ISC
525
+ *
526
+ * This source code is licensed under the ISC license.
527
+ * See the LICENSE file in the root directory of this source tree.
528
+ */const CD=ce("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
529
+ * @license lucide-react v0.468.0 - ISC
530
+ *
531
+ * This source code is licensed under the ISC license.
532
+ * See the LICENSE file in the root directory of this source tree.
533
+ */const Rh=ce("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/**
534
+ * @license lucide-react v0.468.0 - ISC
535
+ *
536
+ * This source code is licensed under the ISC license.
537
+ * See the LICENSE file in the root directory of this source tree.
538
+ */const ic=ce("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
539
+ * @license lucide-react v0.468.0 - ISC
540
+ *
541
+ * This source code is licensed under the ISC license.
542
+ * See the LICENSE file in the root directory of this source tree.
543
+ */const Aa=ce("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
544
+ * @license lucide-react v0.468.0 - ISC
545
+ *
546
+ * This source code is licensed under the ISC license.
547
+ * See the LICENSE file in the root directory of this source tree.
548
+ */const Ps=ce("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
549
+ * @license lucide-react v0.468.0 - ISC
550
+ *
551
+ * This source code is licensed under the ISC license.
552
+ * See the LICENSE file in the root directory of this source tree.
553
+ */const Be=ce("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
554
+ * @license lucide-react v0.468.0 - ISC
555
+ *
556
+ * This source code is licensed under the ISC license.
557
+ * See the LICENSE file in the root directory of this source tree.
558
+ */const gs=ce("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 _D({issue:e}){const t=Gu(e.id,e.project_id),[r,n]=h.useState(""),[a,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()]:a};t.mutate({metadata:m},{onSuccess:()=>{F.success("Metadata saved"),n(""),i(""),l(!1)},onError:()=>F.error("Failed to save metadata")})},f=m=>{const p={...c};delete p[m],t.mutate({metadata:Object.keys(p).length?p:null},{onSuccess:()=>F.success("Entry removed"),onError:()=>F.error("Failed to update metadata")})};return s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[s.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Z5,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Metadata"})]}),!o&&s.jsxs("button",{onClick:()=>l(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Add field"]})]}),s.jsxs("div",{className:"px-5 py-3 space-y-2",children:[d.length===0&&!o&&s.jsx("p",{className:"text-xs text-muted-foreground/50 italic",children:"No metadata fields yet"}),d.map(([m,p])=>s.jsxs("div",{className:"flex items-center gap-2 group",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground w-28 shrink-0 truncate",children:m}),s.jsx("span",{className:"text-xs text-foreground flex-1 truncate",children:String(p)}),s.jsx("button",{onClick:()=>f(m),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:s.jsx(jr,{className:"h-3 w-3"})})]},m)),o&&s.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[s.jsx(_e,{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"}),s.jsx(_e,{placeholder:"value",value:a,onChange:m=>i(m.target.value),onKeyDown:m=>{m.key==="Enter"&&u(),m.key==="Escape"&&l(!1)},className:"h-7 text-xs flex-1"}),s.jsx(ee,{size:"sm",className:"h-7 px-2 text-xs",onClick:u,disabled:!r.trim()||t.isPending,children:"Save"}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",onClick:()=>{l(!1),n(""),i("")},children:"Cancel"})]})]})]})}const PD=[{zone:"issue.details.after",component:_D}],hy=`M3785.1,803.47v2393.05h-475.17V1422.73l-335,89.76l-288.44,77.29c-4.38,1.1-8.74,2.25-13.08,3.46
559
+ c-189.11,52.58-338.17,203.98-387.4,394.42c-11.36,43.93-17.41,89.93-17.41,137.28v1071.58h-475.16V2124.94
560
+ c0-46.53,3.13-92.35,9.2-137.28c12.14-89.82,36-176.05,69.99-257.08c32.7-77.98,74.79-151.16,124.81-218.09
561
+ c135.51-181.33,329.32-316.87,553-378.19l11.22-3.01L3785.1,803.47z`,py=`M690.07,1674.37c-125.6,80.57-232.72,187.69-313.29,313.29c-102.38,159.6-161.88,349.03-161.88,551.68v182.02
562
+ v475.17h475.17v-475.17v-36.01v-146.01c0-303.43,248.26-551.68,551.68-551.68h0c179.69,0,340.03,87.06,440.92,221.09
563
+ c0-27.94,0-55.87,0-83.81c0-45.88,2.76-91.74,8.3-137.28c0.6-4.95,1.24-9.89,1.9-14.83c13.24-98,39.36-193.89,77.61-285.09
564
+ c3.08-7.33,6.23-14.62,9.45-21.89c-156.74-97.16-341.22-153.37-538.19-153.37C1039.1,1512.49,849.68,1571.98,690.07,1674.37
565
+ L690.07,1674.37z`,MD=1800;function xN({width:e=28,height:t=28,showText:r=!0,loading:n=!1,className:a=""}){const i=h.useId().replace(/:/g,""),o=e||28,l=t||28,c=`logo-left-clip-${i}`,d=`logo-right-clip-${i}`,[u,f]=h.useState(n?1:0);return h.useEffect(()=>{if(!n)return;const m=setInterval(()=>{f(p=>p+1)},MD);return()=>clearInterval(m)},[n]),s.jsxs("div",{className:`inline-flex items-center gap-2 ${a}`,onMouseEnter:()=>!n&&f(m=>m+1),children:[s.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",x:"0",y:"0",width:o,height:l,viewBox:"0 0 4000 4000","aria-hidden":"true",children:[s.jsxs("defs",{children:[s.jsx("clipPath",{id:c,children:s.jsxs("rect",{x:"0",y:"4000",width:"4000",height:"0",children:[s.jsx("animate",{attributeName:"y",from:"4000",to:"0",dur:"0.55s",begin:"0s",fill:"freeze"}),s.jsx("animate",{attributeName:"height",from:"0",to:"4000",dur:"0.55s",begin:"0s",fill:"freeze"})]})}),s.jsx("clipPath",{id:d,children:s.jsxs("rect",{x:"0",y:"4000",width:"4000",height:"0",children:[s.jsx("animate",{attributeName:"y",from:"4000",to:"0",dur:"0.55s",begin:"0.45s",fill:"freeze"}),s.jsx("animate",{attributeName:"height",from:"0",to:"4000",dur:"0.55s",begin:"0.45s",fill:"freeze"})]})})]}),s.jsx("path",{d:py,fill:"currentColor",fillOpacity:"0.2",fillRule:"evenodd",clipRule:"evenodd"}),s.jsx("path",{d:hy,fill:"currentColor",fillOpacity:"0.2",fillRule:"evenodd",clipRule:"evenodd"}),s.jsx("path",{d:py,fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",clipPath:`url(#${c})`}),s.jsx("path",{d:hy,fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd",clipPath:`url(#${d})`})]},u),r&&s.jsx("span",{className:"text-xl font-bold",children:"Meridian.js"})]})}function Cn(e=!0){const t=typeof e=="boolean"?e:!0,r=typeof e=="object"?e.orgScope??!1:!1,n=typeof e=="object"?e.refetchInterval??!1:!1,a=r?"?org_scope=true":"";return Te({queryKey:["workspaces",r?"org":"default"],queryFn:()=>ie.get(`/admin/workspaces${a}`),select:i=>i.workspaces,enabled:t,refetchInterval:n,staleTime:1e3*60*2})}function OD(){const e=ye();return ge({mutationFn:t=>ie.post("/admin/workspaces",t),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]})}})}function ED(e){const t=ye();return ge({mutationFn:r=>ie.put(`/admin/workspaces/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:["workspaces"]})}})}function AD(e){const t=ye();return ge({mutationFn:r=>{const n=new FormData;return n.append("logo",r),ie.upload(`/admin/workspaces/${e}/logo`,n)},onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}function DD(e){const t=ye();return ge({mutationFn:()=>ie.delete(`/admin/workspaces/${e}/logo`),onSuccess:()=>t.invalidateQueries({queryKey:["workspaces"]})})}const yx={list:e=>["workspaces",e,"invitations"]};function TD(e){return Te({queryKey:yx.list(e),queryFn:()=>ie.get(`/admin/workspaces/${e}/invitations`),select:t=>t.invitations,enabled:!!e,staleTime:1e3*60*2})}function ID(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/workspaces/${e}/invitations`,r),onSuccess:()=>{t.invalidateQueries({queryKey:yx.list(e)})}})}function RD(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/workspaces/${e}/invitations/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:yx.list(e)})}})}function $D(e){return ge({mutationFn:t=>ie.post(`/admin/workspaces/${e}/invitations/${t}/resend`)})}const bx={list:e=>["workspaces",e,"members"]};function Po(e){return Te({queryKey:bx.list(e),queryFn:()=>ie.get(`/admin/workspaces/${e}/members`),select:t=>t.members,enabled:!!e,staleTime:1e3*60*2})}function zD(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/workspaces/${e}/members/batch`,r),onSuccess:()=>{t.invalidateQueries({queryKey:bx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}function LD(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/workspaces/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:bx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}const Da={list:e=>["workspaces",e,"teams"],members:(e,t)=>["workspaces",e,"teams",t,"members"]};function Qu(e){return Te({queryKey:Da.list(e),queryFn:()=>ie.get(`/admin/workspaces/${e}/teams`),select:t=>t.teams,enabled:!!e,staleTime:1e3*60*2})}function FD(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/workspaces/${e}/teams`,r),onSuccess:()=>{t.invalidateQueries({queryKey:Da.list(e)})}})}function BD(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/workspaces/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Da.list(e)})}})}function qD(e,t){return Te({queryKey:Da.members(e,t),queryFn:()=>ie.get(`/admin/workspaces/${e}/teams/${t}/members`),select:r=>r.members,enabled:!!(e&&t)})}function WD(e,t){const r=ye();return ge({mutationFn:n=>ie.post(`/admin/workspaces/${e}/teams/${t}/members`,{user_id:n}),onSuccess:()=>{r.invalidateQueries({queryKey:Da.members(e,t)}),r.invalidateQueries({queryKey:Da.list(e)})}})}function UD(e,t){const r=ye();return ge({mutationFn:n=>ie.delete(`/admin/workspaces/${e}/teams/${t}/members/${n}`),onSuccess:()=>{r.invalidateQueries({queryKey:Da.members(e,t)}),r.invalidateQueries({queryKey:Da.list(e)})}})}function Zu(e,t){const r=(t==null?void 0:t.enabled)??!0;return Te({queryKey:["workspaces","search",e],queryFn:()=>ie.get(`/admin/workspaces/search?q=${encodeURIComponent(e)}`),select:n=>n.workspaces,enabled:r,staleTime:1e4})}const jx={list:e=>["workspaces",e,"access-requests"]};function wx(e){return Te({queryKey:jx.list(e),queryFn:()=>ie.get(`/admin/workspaces/${e}/access-requests`),select:t=>t.access_requests,enabled:!!e,staleTime:1e3*60*2})}function Ju(){const e=ye();return ge({mutationFn:({workspaceId:t,message:r})=>ie.post(`/admin/workspaces/${t}/access-requests`,{message:r??null}),onSuccess:(t,{workspaceId:r})=>{e.invalidateQueries({queryKey:jx.list(r)})}})}function HD(e){const t=ye();return ge({mutationFn:({requestId:r,action:n})=>ie.patch(`/admin/workspaces/${e}/access-requests/${r}`,{action:n}),onSuccess:()=>{t.invalidateQueries({queryKey:jx.list(e)}),t.invalidateQueries({queryKey:["workspaces"]})}})}function gN(){return Te({queryKey:["workspaces","my-access-requests"],queryFn:()=>ie.get("/admin/workspaces/my-access-requests"),select:e=>e.requests})}function vN(){const e=ye();return ge({mutationFn:({workspaceId:t,requestId:r})=>ie.delete(`/admin/workspaces/${t}/access-requests/${r}`),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces","my-access-requests"]}),e.invalidateQueries({queryKey:["workspaces","search"]})}})}function ef(){return Te({queryKey:["setup-status"],queryFn:()=>ie.get("/auth/setup"),staleTime:6e4,retry:!1})}function KD(){return ge({mutationFn:e=>ie.post("/auth/register/send-otp",e)})}function YD(){const{login:e}=De();return ge({mutationFn:t=>ie.post("/auth/login",t),onSuccess:t=>{e(t.user,t.token)}})}function GD(){const{login:e}=De();return ge({mutationFn:t=>ie.post("/auth/register",t),onSuccess:t=>{e(t.user,t.token)}})}function VD(){return ge({mutationFn:e=>ie.post("/auth/forgot-password",e)})}function XD(){return ge({mutationFn:e=>ie.post("/auth/reset-password",e)})}function QD(e){const{login:t}=De();return ge({mutationFn:r=>ie.post(`/auth/invite/${e}`,r),onSuccess:r=>{t(r.user,r.token)}})}var Xw;const yN=((Xw=window.__MERIDIAN_CONFIG__)==null?void 0:Xw.apiUrl)??void 0??"";function ZD(e,t){const r=`${yN}/admin/events?token=${encodeURIComponent(e)}&workspaceId=${encodeURIComponent(t)}`;return new EventSource(r)}function Nx(e){const t=`${yN}/admin/events?token=${encodeURIComponent(e)}&mode=user`;return new EventSource(t)}function JD(){const{token:e,workspace:t}=De(),r=ye(),n=h.useRef(null);h.useEffect(()=>{if(!e||!t)return;const a=ZD(e,t.id);n.current=a;const i=o=>{o.forEach(l=>r.invalidateQueries({queryKey:l}))};return a.addEventListener("issue.created",()=>{i([["issues"],["notifications"]])}),a.addEventListener("issue.status_changed",()=>{i([["issues"]])}),a.addEventListener("issue.assigned",()=>{i([["issues"],["notifications"]])}),a.addEventListener("comment.created",()=>{i([["issues"],["notifications"]])}),a.addEventListener("project.member_added",()=>{i([["notifications"]])}),a.addEventListener("timer.started",()=>{i([["time-logs"]])}),a.addEventListener("timer.stopped",()=>{i([["time-logs"]])}),a.addEventListener("notification.created",()=>{i([["notifications"]])}),a.addEventListener("workspace.access_requested",()=>{i([["workspaces",t==null?void 0:t.id,"access-requests"],["notifications"]])}),a.addEventListener("workspace.access_request_resolved",()=>{i([["workspaces",t==null?void 0:t.id,"access-requests"],["workspaces"],["notifications"]])}),a.addEventListener("project.access_requested",o=>{const l=JSON.parse(o.data??"{}");i([["projects"],["projects",l.project_id,"access-requests"],["notifications"]])}),a.addEventListener("project.access_request_resolved",o=>{const l=JSON.parse(o.data??"{}");i([["projects"],["projects",l.project_id,"access-requests"],["notifications"]])}),a.addEventListener("project.access_request_cancelled",o=>{const l=JSON.parse(o.data??"{}");i([["projects"],["projects",l.project_id,"access-requests"],["notifications"]])}),a.addEventListener("workspace.access_request_cancelled",()=>{i([["workspaces",t==null?void 0:t.id,"access-requests"],["notifications"]])}),a.onerror=()=>{},()=>{a.close(),n.current=null}},[e,t==null?void 0:t.id,r])}const Mm=768;function eT(){const[e,t]=h.useState(void 0);return h.useEffect(()=>{const r=window.matchMedia(`(max-width: ${Mm-1}px)`),n=()=>{t(window.innerWidth<Mm)};return r.addEventListener("change",n),t(window.innerWidth<Mm),()=>r.removeEventListener("change",n)},[]),!!e}const Mo=h.forwardRef(({className:e,orientation:t="horizontal",decorative:r=!0,...n},a)=>s.jsx(Zw,{ref:a,decorative:r,orientation:t,className:z("shrink-0 bg-border",t==="horizontal"?"h-px w-full":"h-full w-px",e),...n}));Mo.displayName=Zw.displayName;const tT=rc,rT=tc,bN=h.forwardRef(({className:e,...t},r)=>s.jsx(Si,{className:z("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}));bN.displayName=Si.displayName;const nT=sc("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"}}),jN=h.forwardRef(({side:e="right",className:t,children:r,...n},a)=>s.jsxs(rT,{children:[s.jsx(bN,{}),s.jsxs(Ci,{ref:a,className:z(nT({side:e}),t),...n,children:[r,s.jsxs(Uu,{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:[s.jsx(Be,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));jN.displayName=Ci.displayName;const wN=({className:e,...t})=>s.jsx("div",{className:z("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border",e),...t});wN.displayName="SheetHeader";const NN=h.forwardRef(({className:e,...t},r)=>s.jsx(No,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));NN.displayName=No.displayName;const kN=h.forwardRef(({className:e,...t},r)=>s.jsx(ko,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));kN.displayName=ko.displayName;function le({className:e,...t}){return s.jsx("div",{className:z("animate-pulse rounded-md bg-muted",e),...t})}const sT="sidebar_state",aT=60*60*24*7,iT="16rem",oT="18rem",lT="3rem",cT="b",SN=h.createContext(null);function kx(){const e=h.useContext(SN);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}function tf({defaultOpen:e=!0,open:t,onOpenChange:r,className:n,style:a,children:i,...o}){const l=eT(),[c,d]=h.useState(!1),[u,f]=h.useState(e),m=t??u,p=h.useCallback(y=>{const b=typeof y=="function"?y(m):y;r?r(b):f(b),document.cookie=`${sT}=${b}; path=/; max-age=${aT}`},[r,m]),x=h.useCallback(()=>l?d(y=>!y):p(y=>!y),[l,p,d]);h.useEffect(()=>{const y=b=>{b.key===cT&&(b.metaKey||b.ctrlKey)&&(b.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 s.jsx(SN.Provider,{value:v,children:s.jsx(Ku,{delayDuration:0,children:s.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":iT,"--sidebar-width-icon":lT,...a},className:z("group/sidebar-wrapper has-[[data-variant=inset]]:bg-sidebar flex h-svh w-full",n),...o,children:i})})})}function rf({side:e="left",variant:t="sidebar",collapsible:r="offcanvas",className:n,children:a,...i}){const{isMobile:o,state:l,openMobile:c,setOpenMobile:d}=kx();return r==="none"?s.jsx("div",{"data-slot":"sidebar",className:z("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",n),...i,children:a}):o?s.jsx(tT,{open:c,onOpenChange:d,...i,children:s.jsxs(jN,{"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":oT},side:e,children:[s.jsxs(wN,{className:"sr-only",children:[s.jsx(NN,{children:"Sidebar"}),s.jsx(kN,{children:"Displays the mobile sidebar."})]}),s.jsx("div",{className:"flex h-full w-full flex-col",children:a})]})}):s.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:[s.jsx("div",{"data-slot":"sidebar-gap",className:z("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)]")}),s.jsx("div",{"data-slot":"sidebar-container",className:z("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:s.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:a})})]})}function nf({className:e,onClick:t,...r}){const{toggleSidebar:n}=kx();return s.jsxs(ee,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:z("size-7",e),onClick:a=>{t==null||t(a),n()},...r,children:[s.jsx(fD,{}),s.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function sf({className:e,...t}){return s.jsx("main",{"data-slot":"sidebar-inset",className:z("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 af({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:z("flex flex-col gap-2 p-2",e),...t})}function of({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:z("flex flex-col gap-2 p-2",e),...t})}function xy({className:e,...t}){return s.jsx(Mo,{"data-slot":"sidebar-separator","data-sidebar":"separator",className:z("bg-sidebar-border mx-2 w-auto",e),...t})}function lf({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:z("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",e),...t})}function ti({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group","data-sidebar":"group",className:z("relative flex w-full min-w-0 flex-col p-2",e),...t})}function gy({className:e,asChild:t=!1,...r}){const n=t?ex:"div";return s.jsx(n,{"data-slot":"sidebar-group-label","data-sidebar":"group-label",className:z("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 ri({className:e,...t}){return s.jsx("div",{"data-slot":"sidebar-group-content","data-sidebar":"group-content",className:z("w-full text-sm",e),...t})}function Cr({className:e,...t}){return s.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:z("flex w-full min-w-0 flex-col gap-1",e),...t})}function kt({className:e,...t}){return s.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:z("group/menu-item relative",e),...t})}const dT=sc("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"}}),vt=h.forwardRef(function({asChild:t=!1,isActive:r=!1,variant:n="default",size:a="default",tooltip:i,className:o,...l},c){const d=t?ex:"button",{isMobile:u,state:f}=kx(),m=s.jsx(d,{ref:c,"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":a,"data-active":r,className:z(dT({variant:n,size:a}),o),...l});return i?(typeof i=="string"&&(i={children:i}),s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:m}),s.jsx(Wn,{side:"right",align:"center",hidden:f!=="collapsed"||u,...i})]})):m});vt.displayName="SidebarMenuButton";const uT=250,fT=300,_r={all:["projects"],list:()=>[..._r.all,"list"],detail:e=>[..._r.all,e],byKey:e=>[..._r.all,"key",e],activities:e=>[..._r.all,e,"activities"]};function oc(e){const{workspace:t}=De(),r=e==null?void 0:e.workspaceIds,n=(e==null?void 0:e.orgScope)??!1,a=!(e!=null&&e.allWorkspaces)&&!(r!=null&&r.length)&&!n,i=a?t==null?void 0:t.id:void 0;return Te({queryKey:[..._r.list(),i??r??(n?"org":"all")],queryFn:()=>{const o=new URLSearchParams;i?o.set("workspace_id",i):r!=null&&r.length&&o.set("workspace_ids",r.join(",")),n&&o.set("org_scope","true");const l=o.toString()?`?${o}`:"";return ie.get(`/admin/projects${l}`)},select:o=>o.projects,enabled:a?!!(t!=null&&t.id):!0,staleTime:1e3*60*2})}function ea(e){return Te({queryKey:_r.byKey(e),queryFn:()=>ie.get(`/admin/projects/by-identifier/${encodeURIComponent(e)}`),select:t=>t.project,enabled:!!e})}function mT(e,t={}){const[r,n]=h.useState(e),a=t.enabled!==!1;return h.useEffect(()=>{if(!a)return;const l=setTimeout(()=>n(e),uT);return()=>clearTimeout(l)},[e,a]),{...Te({queryKey:["projects","suggest-identifier",r],queryFn:()=>ie.get(`/admin/projects/suggest-identifier?name=${encodeURIComponent(r)}`),select:l=>l.identifier,enabled:a&&r.trim().length>0}),flush:()=>n(e)}}function hT(e,t={}){const r=e.toUpperCase().replace(/[^A-Z0-9]/g,""),[n,a]=h.useState(r),i=t.enabled!==!1&&r.length>=3;h.useEffect(()=>{if(!r){a("");return}const l=setTimeout(()=>a(r),fT);return()=>clearTimeout(l)},[r]);const o=Te({queryKey:["projects","check-identifier",n],queryFn:()=>ie.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 pT(){const e=ye();return ge({mutationFn:t=>ie.post("/admin/projects",t),onSuccess:()=>{e.invalidateQueries({queryKey:_r.list()})}})}function xT(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/projects/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:_r.list()})}})}function gT(e){const t=ye();return ge({mutationFn:()=>ie.post(`/admin/projects/${e}/share`,{}),onSuccess:()=>{t.invalidateQueries({queryKey:_r.detail(e)}),t.invalidateQueries({queryKey:_r.list()})}})}function vT(e){const t=ye();return ge({mutationFn:()=>ie.delete(`/admin/projects/${e}/share`),onSuccess:()=>{t.invalidateQueries({queryKey:_r.detail(e)}),t.invalidateQueries({queryKey:_r.list()})}})}function yT(e){return Te({queryKey:_r.activities(e),queryFn:()=>ie.get(`/admin/projects/${e}/activities`),select:t=>t.activities,enabled:!!e})}function bT(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/projects/${e}/transfer`,r),onSuccess:()=>{t.invalidateQueries({queryKey:_r.list()}),t.invalidateQueries({queryKey:_r.detail(e)}),t.invalidateQueries({queryKey:["projects",e,"access"]})}})}const Vr=jE,Xr=wE,jT=NE,CN=h.forwardRef(({className:e,inset:t,children:r,...n},a)=>s.jsxs(Jw,{ref:a,className:z("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,s.jsx(pr,{className:"ml-auto"})]}));CN.displayName=Jw.displayName;const _N=h.forwardRef(({className:e,...t},r)=>s.jsx(e1,{ref:r,className:z("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}));_N.displayName=e1.displayName;const Dr=h.forwardRef(({className:e,sideOffset:t=4,...r},n)=>s.jsx(bE,{children:s.jsx(t1,{ref:n,sideOffset:t,className:z("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})}));Dr.displayName=t1.displayName;const Je=h.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(r1,{ref:n,className:z("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}));Je.displayName=r1.displayName;const wT=h.forwardRef(({className:e,children:t,checked:r,...n},a)=>s.jsxs(n1,{ref:a,className:z("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(s1,{children:s.jsx(Ct,{className:"h-4 w-4"})})}),t]}));wT.displayName=n1.displayName;const NT=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(a1,{ref:n,className:z("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:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(s1,{children:s.jsx(Er,{className:"h-2 w-2 fill-current"})})}),t]}));NT.displayName=a1.displayName;const Rd=h.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(i1,{ref:n,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",t&&"pl-8",e),...r}));Rd.displayName=i1.displayName;const _n=h.forwardRef(({className:e,...t},r)=>s.jsx(o1,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));_n.displayName=o1.displayName;const mn=rc,kT=tc,PN=h.forwardRef(({className:e,...t},r)=>s.jsx(Si,{ref:r,className:z("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}));PN.displayName=Si.displayName;const Zr=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(kT,{children:[s.jsx(PN,{}),s.jsxs(Ci,{ref:n,className:z("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,s.jsxs(Uu,{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:[s.jsx(Be,{className:"h-4 w-4"}),s.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Zr.displayName=Ci.displayName;const hn=({className:e,...t})=>s.jsx("div",{className:z("flex flex-col space-y-1.5",e),...t});hn.displayName="DialogHeader";const Oo=({className:e,...t})=>s.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Oo.displayName="DialogFooter";const pn=h.forwardRef(({className:e,...t},r)=>s.jsx(No,{ref:r,className:z("text-base font-semibold leading-none tracking-tight",e),...t}));pn.displayName=No.displayName;const Eo=h.forwardRef(({className:e,...t},r)=>s.jsx(ko,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));Eo.displayName=ko.displayName;const Pt=h.forwardRef(({className:e,...t},r)=>s.jsx(l1,{ref:r,className:z("relative flex h-8 w-8 shrink-0 overflow-hidden rounded-full",e),...t}));Pt.displayName=l1.displayName;const Dl=h.forwardRef(({className:e,...t},r)=>s.jsx(c1,{ref:r,className:z("aspect-square h-full w-full",e),...t}));Dl.displayName=c1.displayName;const Mt=h.forwardRef(({className:e,...t},r)=>s.jsx(d1,{ref:r,className:z("flex h-full w-full items-center justify-center rounded-full bg-muted text-xs font-medium text-muted-foreground",e),...t}));Mt.displayName=d1.displayName;function ST(){var y;const{workspace:e,setWorkspace:t}=De(),{data:r}=Cn(),[n,a]=h.useState(!1),{data:i=[]}=Zu("",{enabled:n}),o=Ju(),l=ct(),[c,d]=h.useState(new Set),[u,f]=h.useState(null),[m,p]=h.useState(""),x=[...r??[]].sort((b,N)=>b.name.localeCompare(N.name)),g=i.filter(b=>!b.is_member).sort((b,N)=>b.name.localeCompare(N.name)),v=()=>{u&&o.mutate({workspaceId:u.id,message:m.trim()||void 0},{onSuccess:()=>{d(b=>new Set([...b,u.id])),F.success(`Access request sent for ${u.name}`),f(null)},onError:b=>{F.error(b.message??"Failed to send request"),f(null)}})};return s.jsxs(s.Fragment,{children:[s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(Vr,{open:n,onOpenChange:a,children:[s.jsx(Xr,{asChild:!0,children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[e!=null&&e.logo_url?s.jsx("img",{src:e.logo_url,alt:e.name,className:"size-8 rounded-lg object-cover shrink-0"}):s.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:s.jsx("span",{className:"text-[13px] font-bold",children:(((y=e==null?void 0:e.name)==null?void 0:y[0])??"M").toUpperCase()})}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:(e==null?void 0:e.name)??"Meridian"}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.slug)??""})]}),s.jsx(_o,{className:"ml-auto size-4 shrink-0"})]})}),s.jsxs(Dr,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"bottom",align:"start",sideOffset:4,children:[s.jsx(Rd,{className:"text-xs text-muted-foreground font-normal",children:"My workspaces"}),s.jsx("div",{className:"max-h-48 overflow-y-auto",children:x.map(b=>s.jsxs(Je,{className:"cursor-pointer gap-2 p-2",onClick:()=>{t({id:b.id,name:b.name,slug:b.slug,logo_url:b.logo_url}),l(`/${b.slug}/projects`)},children:[b.logo_url?s.jsx("img",{src:b.logo_url,alt:b.name,className:"size-6 rounded-sm object-cover shrink-0"}):s.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-foreground text-background shrink-0",children:s.jsx("span",{className:"text-[10px] font-bold",children:b.name[0].toUpperCase()})}),s.jsx("span",{className:"flex-1 truncate",children:b.name}),b.id===(e==null?void 0:e.id)&&s.jsx(Ct,{className:"size-3.5 text-muted-foreground shrink-0"})]},b.id))}),g.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(_n,{}),s.jsx(Rd,{className:"text-xs text-muted-foreground font-normal",children:"Other workspaces"}),s.jsx("div",{className:"max-h-36 overflow-y-auto",children:g.map(b=>{const N=c.has(b.id);return s.jsxs(Je,{className:"cursor-pointer gap-2 p-2",onClick:()=>{N||(f({id:b.id,name:b.name}),p(""))},disabled:N,children:[s.jsx("div",{className:"flex size-6 items-center justify-center rounded-sm bg-muted text-muted-foreground shrink-0",children:s.jsx("span",{className:"text-[10px] font-bold",children:b.name[0].toUpperCase()})}),s.jsx("span",{className:"flex-1 truncate text-muted-foreground",children:b.name}),N?s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:"Requested"}):s.jsx(Sn,{className:"size-3.5 text-muted-foreground shrink-0"})]},b.id)})})]}),s.jsx(_n,{}),s.jsxs(Je,{className:"cursor-pointer gap-2 p-2 text-muted-foreground",onClick:()=>l("/setup"),children:[s.jsx("div",{className:"flex size-6 items-center justify-center rounded-md border bg-background",children:s.jsx("span",{className:"text-xs font-semibold",children:"+"})}),s.jsx("span",{children:"Create workspace"})]})]})]})})}),s.jsx(mn,{open:!!u,onOpenChange:b=>{b||f(null)},children:s.jsxs(Zr,{className:"max-w-sm",children:[s.jsx(hn,{children:s.jsxs(pn,{children:["Request access to ",u==null?void 0:u.name,"?"]})}),s.jsxs("div",{className:"space-y-3 py-1",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"A request will be sent to the workspace admins. You'll be notified once it's approved."}),s.jsx(_e,{placeholder:"Optional message to admins...",value:m,onChange:b=>p(b.target.value),className:"h-9 text-sm"})]}),s.jsxs(Oo,{children:[s.jsx(ee,{variant:"outline",size:"sm",onClick:()=>f(null),children:"Cancel"}),s.jsx(ee,{size:"sm",disabled:o.isPending,onClick:v,children:o.isPending?"Sending...":"Send request"})]})]})})]})}function CT(){var i,o,l,c;const{user:e,logout:t}=De(),r=ct(),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()))||"?",a=e?[e.first_name,e.last_name].filter(Boolean).join(" ")||e.email:"User";return s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[s.jsxs(Pt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&s.jsx(Dl,{src:e.avatar_url,alt:a??"",className:"object-cover"}),s.jsx(Mt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:a}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),s.jsx(_o,{className:"ml-auto size-4 shrink-0"})]})}),s.jsxs(Dr,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[s.jsx(Rd,{className:"p-0 font-normal",children:s.jsxs("div",{className:"flex items-center gap-2 px-1 py-1.5 text-left text-sm",children:[s.jsxs(Pt,{className:"h-8 w-8 rounded-lg",children:[(e==null?void 0:e.avatar_url)&&s.jsx(Dl,{src:e.avatar_url,alt:a??"",className:"object-cover"}),s.jsx(Mt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:n})]}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:a}),s.jsx("span",{className:"truncate text-xs text-muted-foreground",children:(e==null?void 0:e.email)??""})]})]})}),s.jsx(_n,{}),s.jsxs(Je,{className:"cursor-pointer gap-2",onClick:()=>r("/profile"),children:[s.jsx(ic,{className:"size-4"}),"Profile"]}),s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[s.jsx(Vu,{className:"size-4"}),"Sign out"]})]})]})})})}function _T({...e}){var O,E,D;const{workspace:t,projectKey:r}=Et(),{data:n}=oc(),a=(n??[]).reduce((I,V)=>I+(V.pending_request_count??0),0),{toggle:i}=ox(),{user:o,workspace:l}=De(),c=(l==null?void 0:l.id)??"",d=(o==null?void 0:o.roles)??[],u=d.includes("super-admin")||d.includes("admin"),{data:f=[]}=wx(c),m=u?f.length:0,p=wo(),x=t??"",g=p.pathname===`/${x}/projects`,v=p.pathname===`/${x}/my-tasks`,y=p.pathname.includes("/notifications"),b=p.pathname.includes("/settings"),N=p.pathname.includes("/roles"),j=p.pathname===`/${x}/reporting`,k=p.pathname.startsWith("/reporting"),w=p.pathname.startsWith("/org/settings"),S=((O=o==null?void 0:o.roles)==null?void 0:O.includes("super-admin"))??!1,_=S||(((E=o==null?void 0:o.roles)==null?void 0:E.includes("admin"))??!1),C=((D=o==null?void 0:o.permissions)==null?void 0:D.includes("workspace:admin"))??!1,P=_||C;return s.jsxs(rf,{collapsible:"offcanvas",...e,children:[s.jsx(af,{children:s.jsx(ST,{})}),s.jsxs(lf,{children:[s.jsx(ti,{children:s.jsx(ri,{children:s.jsxs(Cr,{children:[s.jsx(kt,{children:s.jsxs(vt,{onClick:i,tooltip:"Search",children:[s.jsx(za,{}),s.jsx("span",{children:"Search"}),s.jsx("kbd",{className:"ml-auto hidden text-[10px] text-sidebar-foreground/40 font-mono sm:inline-flex",children:"⌘K"})]})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:v,tooltip:"My Tasks",children:s.jsxs(rn,{to:`/${x}/my-tasks`,children:[s.jsx(Xu,{}),s.jsx("span",{children:"My Tasks"})]})})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:g,tooltip:"Projects",children:s.jsxs(rn,{to:`/${x}/projects`,end:!0,children:[s.jsx(Gr,{}),s.jsx("span",{className:"flex-1",children:"Projects"}),a>0&&s.jsx("span",{className:"ml-auto flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white",children:a>9?"9+":a})]})})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:y,tooltip:"Notifications",children:s.jsxs(rn,{to:`/${x}/notifications`,children:[s.jsx(mi,{}),s.jsx("span",{children:"Notifications"})]})})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:j,tooltip:"Reports",children:s.jsxs(rn,{to:`/${x}/reporting`,children:[s.jsx(zs,{}),s.jsx("span",{children:"Reports"})]})})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:b,tooltip:"Settings",children:s.jsxs(rn,{to:`/${x}/settings`,children:[s.jsx(vx,{}),s.jsx("span",{className:"flex-1",children:"Workspace settings"}),m>0&&s.jsx("span",{className:"ml-auto flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white",children:m>9?"9+":m})]})})})]})})}),n&&n.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(xy,{}),s.jsxs(ti,{children:[s.jsx(gy,{children:"Recent"}),s.jsx(ri,{children:s.jsx(Cr,{children:n.slice(0,5).map(I=>s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:I.identifier===r,tooltip:I.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:s.jsxs(rn,{to:`/${x}/projects/${I.identifier}/board`,children:[s.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:I.identifier}),s.jsx("span",{className:"truncate",children:I.name})]})})},I.id))})})]})]}),P&&s.jsxs(s.Fragment,{children:[s.jsx(xy,{}),s.jsxs(ti,{children:[s.jsx(gy,{children:"Global"}),s.jsx(ri,{children:s.jsxs(Cr,{children:[s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:k,tooltip:"Global Reports",children:s.jsxs(rn,{to:"/reporting",children:[s.jsx(zs,{}),s.jsx("span",{children:"Global Reports"})]})})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:w,tooltip:"Org Settings",children:s.jsxs(rn,{to:"/org/settings",children:[s.jsx(Id,{}),s.jsx("span",{children:"Org Settings"})]})})})]})})]})]}),s.jsx(ti,{className:"mt-auto",children:s.jsx(ri,{children:s.jsx(Cr,{children:S&&s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:N,tooltip:"Roles & Permissions",children:s.jsxs(rn,{to:`/${x}/roles`,children:[s.jsx(Ih,{}),s.jsx("span",{children:"Custom Roles"})]})})})})})})]}),s.jsx(of,{children:s.jsx(CT,{})})]})}function cf(){const{theme:e,setTheme:t}=e5();return s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsxs(ee,{variant:"ghost",size:"icon-sm",onClick:()=>t(e==="dark"?"light":"dark"),className:"text-muted-foreground hover:text-foreground",children:[s.jsx(vD,{className:"h-4 w-4 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"}),s.jsx(uD,{className:"absolute h-4 w-4 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"}),s.jsx("span",{className:"sr-only",children:"Toggle theme"})]})}),s.jsx(Wn,{children:"Toggle theme"})]})}const mr={byIssue:e=>["time-logs",e],activeTimer:e=>["time-logs",e,"active-timer"],globalActiveTimer:["time-logs","global-active-timer"]};function PT(e){return Te({queryKey:mr.byIssue(e),queryFn:()=>ie.get(`/admin/issues/${e}/time-logs`),enabled:!!e})}function MT(e){return Te({queryKey:mr.activeTimer(e),queryFn:()=>ie.get(`/admin/issues/${e}/time-logs/timer`),select:t=>t.active_timer,enabled:!!e})}function OT(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/issues/${e}/time-logs`,r),onSuccess:()=>{t.invalidateQueries({queryKey:mr.byIssue(e)})}})}function ET(e){const t=ye();return ge({mutationFn:()=>ie.post(`/admin/issues/${e}/time-logs/timer`,{action:"start"}),onSuccess:r=>{t.invalidateQueries({queryKey:mr.activeTimer(e)}),t.invalidateQueries({queryKey:mr.byIssue(e)}),t.invalidateQueries({queryKey:mr.globalActiveTimer}),r.stopped_timer&&r.stopped_timer.issue_id!==e&&(t.invalidateQueries({queryKey:mr.byIssue(r.stopped_timer.issue_id)}),t.invalidateQueries({queryKey:mr.activeTimer(r.stopped_timer.issue_id)}))}})}function AT(e){const t=ye();return ge({mutationFn:()=>ie.post(`/admin/issues/${e}/time-logs/timer`,{action:"stop"}),onSuccess:()=>{t.invalidateQueries({queryKey:mr.activeTimer(e)}),t.invalidateQueries({queryKey:mr.byIssue(e)}),t.invalidateQueries({queryKey:mr.globalActiveTimer})}})}function DT(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/issues/${e}/time-logs/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:mr.byIssue(e)})}})}function TT(e){const t=ye();return ge({mutationFn:({logId:r,data:n})=>ie.put(`/admin/issues/${e}/time-logs/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:mr.byIssue(e)})}})}function IT(){return Te({queryKey:mr.globalActiveTimer,queryFn:()=>ie.get("/admin/time-logs/active-timer"),select:e=>e.active_timer})}function RT(){const e=ye();return ge({mutationFn:()=>ie.post("/admin/time-logs/active-timer"),onSuccess:t=>{e.invalidateQueries({queryKey:mr.globalActiveTimer}),t.time_log&&(e.invalidateQueries({queryKey:mr.byIssue(t.time_log.issue_id)}),e.invalidateQueries({queryKey:mr.activeTimer(t.time_log.issue_id)}))}})}function $d(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function zd(e){const t=Date.now()-new Date(e).getTime(),r=Math.floor(t/1e3),n=Math.floor(r/3600),a=Math.floor(r%3600/60),i=r%60,o=String(a).padStart(2,"0"),l=String(i).padStart(2,"0");return n>0?`${n}:${o}:${l}`:`${o}:${l}`}function $T({startedAt:e}){const[t,r]=h.useState(()=>zd(e));return h.useEffect(()=>{const n=setInterval(()=>r(zd(e)),1e3);return()=>clearInterval(n)},[e]),s.jsx("span",{className:"font-mono tabular-nums text-xs font-semibold",children:t})}function zT(){const{data:e}=IT(),t=RT(),{workspace:r}=De(),n=(r==null?void 0:r.slug)??"";if(!e||!e.started_at)return null;const a=e.issue_identifier??"Issue",i=e.project_identifier?`/${n}/projects/${e.project_identifier}/issues/${e.issue_id}`:`/${n}/projects`,o=()=>{t.mutate(void 0,{onSuccess:l=>{var d;const c=((d=l.time_log)==null?void 0:d.duration_minutes)??0;F.success(`Timer stopped — ${$d(c)} logged`)},onError:()=>F.error("Failed to stop timer")})};return s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-emerald-200 dark:border-emerald-800 bg-emerald-50 dark:bg-emerald-950/40 px-2.5 py-1 text-emerald-700 dark:text-emerald-400",children:[s.jsx(mN,{className:"h-3 w-3 shrink-0"}),s.jsx(Rt,{to:i,className:"text-xs font-medium hover:underline truncate max-w-[100px]",title:e.issue_title??a,children:a}),s.jsx($T,{startedAt:e.started_at}),s.jsx(ee,{variant:"ghost",size:"icon",className:"h-5 w-5 rounded-full text-emerald-700 dark:text-emerald-400 hover:bg-emerald-200 dark:hover:bg-emerald-900 hover:text-emerald-900 dark:hover:text-emerald-200",onClick:o,disabled:t.isPending,children:s.jsx(uN,{className:"h-2.5 w-2.5 fill-current"})})]})}const lc={all:["notifications"],list:()=>[...lc.all,"list"]};function LT(){return Te({queryKey:lc.list(),queryFn:()=>ie.get("/admin/notifications"),select:e=>e.notifications})}function MN(){return Te({queryKey:[...lc.list(),"unread"],queryFn:()=>ie.get("/admin/notifications?unread=true"),select:e=>e.count})}function FT(){const e=ye();return ge({mutationFn:t=>ie.post(`/admin/notifications/${t}/read`),onSuccess:()=>{e.invalidateQueries({queryKey:lc.all})}})}function BT(){const e=ye();return ge({mutationFn:()=>ie.post("/admin/notifications/read-all"),onSuccess:()=>{e.invalidateQueries({queryKey:lc.all})}})}function qT(){const e=wo(),{projectKey:t}=Et(),{data:r}=oc(),n=r==null?void 0:r.find(i=>i.identifier===t),a=e.pathname;return a.includes("/board")?{icon:Gr,label:n?`${n.name} / Board`:"Board"}:a.includes("/issues")?{icon:ds,label:n?`${n.name} / Issues`:"Issues"}:a.includes("/sprints")?{icon:gs,label:n?`${n.name} / Sprints`:"Sprints"}:a.includes("/timeline")?{icon:hi,label:n?`${n.name} / Timeline`:"Timeline"}:a.includes("/access")?{icon:Sn,label:n?`${n.name} / Access`:"Access"}:a.includes("/reports")?{icon:zs,label:n?`${n.name} / Reports`:"Reports"}:a.includes("/activity")?{icon:Ol,label:n?`${n.name} / Activity`:"Activity"}:a.endsWith("/projects")?{icon:Dd,label:"Projects"}:a.includes("/notifications")?{icon:mi,label:"Notifications"}:a.includes("/settings")?{icon:vx,label:"Settings"}:{icon:Dd,label:"Meridian"}}function WT(){const{data:e=0}=MN(),{icon:t,label:r}=qT(),{workspace:n}=De(),a=(n==null?void 0:n.slug)??"";return s.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b transition-[width,height] ease-linear w-full",children:s.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[s.jsx(nf,{className:"-ml-1"}),s.jsx(Mo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(t,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),s.jsx("span",{className:"font-medium",children:r})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[s.jsx(zT,{}),s.jsx("span",{className:"hidden md:flex",children:s.jsx(cf,{})}),s.jsx(ee,{variant:"ghost",size:"icon",asChild:!0,className:"relative size-8 text-muted-foreground hover:text-foreground",children:s.jsxs(Rt,{to:`/${a}/notifications`,children:[s.jsx(mi,{className:"h-4 w-4",strokeWidth:1.5}),e>0&&s.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 UT(){const e=wo(),{workspace:t}=Et(),r=t??"",{data:n=0}=MN(),{toggle:a}=ox(),i=[{key:"projects",label:"Projects",icon:oN,to:`/${r}/projects`,match:/\/projects($|\/)/},{key:"notifications",label:"Notifications",icon:mi,to:`/${r}/notifications`,match:/\/notifications/,badge:n>0?n>9?"9+":String(n):null},{key:"my-tasks",label:"My Tasks",icon:Xu,to:`/${r}/my-tasks`,match:/\/my-tasks/},{key:"profile",label:"Profile",icon:ic,to:"/profile",match:/^\/profile/}];return s.jsx("nav",{className:"fixed bottom-0 left-0 right-0 z-50 bg-background border-t border-border md:hidden",children:s.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 s.jsxs(Rt,{to:d,className:z("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:[s.jsxs("div",{className:"relative",children:[s.jsx(c,{className:"h-5 w-5",strokeWidth:m?2:1.5}),f&&s.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})]}),s.jsx("span",{children:l})]},o)}),s.jsxs("button",{onClick:a,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:[s.jsx(za,{className:"h-5 w-5",strokeWidth:1.5}),s.jsx("span",{children:"Search"})]})]})})}function HT(){const{user:e,token:t,updateLocalUser:r,workspace:n,setWorkspace:a}=De();h.useEffect(()=>{!e||!t||!e.email||fetch("/admin/users/me",{headers:{Authorization:`Bearer ${t}`}}).then(i=>i.ok?i.json():null).then(i=>{i&&r({avatar_url:i.avatar_url??null})}).catch(()=>{})},[e==null?void 0:e.id]),h.useEffect(()=>{!n||n.logo_url!==void 0||t&&fetch("/admin/workspaces",{headers:{Authorization:`Bearer ${t}`}}).then(i=>i.ok?i.json():null).then(i=>{var l;const o=(l=i==null?void 0:i.workspaces)==null?void 0:l.find(c=>c.id===n.id);o&&a({...n,logo_url:o.logo_url??null})}).catch(()=>{})},[n==null?void 0:n.id])}function KT(){return HT(),s.jsxs(tf,{children:[s.jsx(_T,{variant:"inset"}),s.jsxs(sf,{className:"flex flex-col min-w-0",children:[s.jsx(WT,{}),s.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden pb-16 md:pb-0",children:s.jsx(Jl,{})})]}),s.jsx(UT,{})]})}const Ta={project:e=>["projects",e,"access"],requests:e=>["projects",e,"access-requests"]};function Yn(e){return Te({queryKey:Ta.project(e),queryFn:()=>ie.get(`/admin/projects/${e}/access`),enabled:!!e})}function ON(e){const t=ye();return ge({mutationFn:({userIds:r,role:n})=>ie.post(`/admin/projects/${e}/members/batch`,{user_ids:r,role:n}),onSuccess:()=>{t.invalidateQueries({queryKey:Ta.project(e)})}})}function EN(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/projects/${e}/members/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ta.project(e)})}})}function AN(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/projects/${e}/teams/batch`,{team_ids:r}),onSuccess:()=>{t.invalidateQueries({queryKey:Ta.project(e)})}})}function DN(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/projects/${e}/teams/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ta.project(e)})}})}function Sx(e){return Te({queryKey:Ta.requests(e),queryFn:()=>ie.get(`/admin/projects/${e}/access-requests`),enabled:!!e})}function YT(){const e=ye();return ge({mutationFn:({projectId:t,message:r})=>ie.post(`/admin/projects/${t}/access-requests`,{message:r}),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}function GT(){const e=ye();return ge({mutationFn:({identifier:t,message:r})=>ie.post(`/admin/projects/by-identifier/${encodeURIComponent(t)}/access-requests`,{message:r}),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}function VT(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/projects/by-identifier/${encodeURIComponent(t)}/access-requests`),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}function TN(e){const t=ye();return ge({mutationFn:({requestId:r,action:n})=>ie.patch(`/admin/projects/${e}/access-requests/${r}`,{action:n}),onSuccess:()=>{t.invalidateQueries({queryKey:Ta.requests(e)}),t.invalidateQueries({queryKey:Ta.project(e)}),t.invalidateQueries({queryKey:["projects"]})}})}function XT(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/projects/${t}/access-requests`),onSuccess:()=>{e.invalidateQueries({queryKey:["projects"]})}})}const so={byProject:e=>["projects",e,"health"],single:(e,t)=>["projects",e,"health",t]};function QT(e){return Te({queryKey:so.byProject(e??""),queryFn:()=>ie.get(`/admin/projects/${e}/health`),select:t=>t.updates,enabled:!!e})}function Kre(e,t){return Te({queryKey:so.single(e??"",t??""),queryFn:()=>ie.get(`/admin/projects/${e}/health/${t}`),select:r=>r.update,enabled:!!e&&!!t})}function Yre(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/projects/${e}/health`,r),onSuccess:()=>{t.invalidateQueries({queryKey:so.byProject(e)})}})}function Gre(e){const t=ye();return ge({mutationFn:({updateId:r,...n})=>ie.put(`/admin/projects/${e}/health/${r}`,n),onSuccess:(r,n)=>{t.invalidateQueries({queryKey:so.byProject(e)}),t.invalidateQueries({queryKey:so.single(e,n.updateId)})}})}function Vre(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/projects/${e}/health/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:so.byProject(e)})}})}function Xre(e){return ge({mutationFn:t=>ie.post(`/admin/projects/${e}/health/${t}/send`,{})})}function ZT({open:e,onClose:t,project:r}){const[n,a]=h.useState(null),i=gT(r.id),o=vT(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}`;a(x),F.success("Public link enabled")},onError:()=>F.error("Failed to enable public link")})},u=()=>{o.mutate(void 0,{onSuccess:()=>{a(null),F.success("Public link revoked")},onError:()=>F.error("Failed to revoke link")})},f=()=>{c&&navigator.clipboard.writeText(c).then(()=>{F.success("Link copied to clipboard")})},m=!!c;return s.jsx(mn,{open:e,onOpenChange:p=>!p&&t(),children:s.jsxs(Zr,{className:"sm:max-w-md overflow-hidden",children:[s.jsxs(hn,{children:[s.jsxs(pn,{className:"flex items-center gap-2",children:[s.jsx(Ea,{className:"h-4 w-4"}),"Share project"]}),s.jsx(Eo,{children:"Allow anyone with the link to view this project without logging in."})]}),s.jsx("div",{className:"space-y-4 pt-2",children:m?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/50 px-3 py-2 overflow-hidden",children:[s.jsx(Th,{className:"h-3.5 w-3.5 text-green-600 shrink-0"}),s.jsx("span",{className:"text-xs text-muted-foreground min-w-0 flex-1 break-all",children:c})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:f,children:[s.jsx(fx,{className:"h-3.5 w-3.5 mr-1.5"}),"Copy link"]}),s.jsxs(ee,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:u,disabled:o.isPending,children:[s.jsx(jr,{className:"h-3.5 w-3.5 mr-1.5"}),"Revoke"]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone with this link can view the board, issues, and timeline. No account required."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-dashed border-border px-3 py-4 text-center justify-center",children:[s.jsx(Sn,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"This project is private"})]}),s.jsxs(ee,{className:"w-full",onClick:d,disabled:i.isPending,children:[s.jsx(Th,{className:"h-4 w-4 mr-2"}),"Enable public link"]}),s.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)`),a=i=>r(i.matches);return r(n.matches),n.addEventListener("change",a),()=>n.removeEventListener("change",a)},[e]),t}const Om={on_track:{label:"On track",dot:"bg-green-500",badge:"text-green-700 bg-green-50 border-green-200 dark:text-green-400 dark:bg-green-950/40 dark:border-green-800"},delayed:{label:"Delayed",dot:"bg-orange-500",badge:"text-orange-700 bg-orange-50 border-orange-200 dark:text-orange-400 dark:bg-orange-950/40 dark:border-orange-800"},on_hold:{label:"On hold",dot:"bg-yellow-500",badge:"text-yellow-700 bg-yellow-50 border-yellow-200 dark:text-yellow-400 dark:bg-yellow-950/40 dark:border-yellow-800"},completed:{label:"Completed",dot:"bg-indigo-500",badge:"text-indigo-700 bg-indigo-50 border-indigo-200 dark:text-indigo-400 dark:bg-indigo-950/40 dark:border-indigo-800"}},vy=["board","issues","sprints","timeline","access","reports","activity"];function JT(){const{projectKey:e,workspace:t}=Et(),{data:r,error:n}=ea(e??""),{user:a}=De(),{data:i}=Yn((r==null?void 0:r.id)??""),{data:o}=Sx((r==null?void 0:r.id)??""),l=((o==null?void 0:o.requests)??[]).filter(C=>C.status==="pending").length,{data:c}=QT(r==null?void 0:r.id),d=(c==null?void 0:c[0])??null,[u,f]=h.useState(!1),m=ct(),p=wo(),[x]=ec(),g=IN(),v=(a==null?void 0:a.roles)??[],y=v.includes("super-admin")||v.includes("admin"),b=i==null?void 0:i.members.some(C=>C.user_id===(a==null?void 0:a.id)&&C.role==="manager"),N=y||b;h.useEffect(()=>{!n||!(n instanceof nc)||(n.status===404?m(`/${t}/projects`,{replace:!0}):n.status===403&&m(`/${t}/projects/${e}/request-access`,{replace:!0}))},[n,t,m,e]),h.useEffect(()=>{const C=x.get("tab");if(!C||!vy.includes(C))return;vy.every(O=>!p.pathname.endsWith(`/${O}`))&&m(`/${t}/projects/${e}/${C}`,{replace:!0})},[]);const j=`/${t}/projects/${e}`,k=[{to:`${j}/board`,label:"Board",icon:Dd,end:!0,desktopOnly:!0},{to:`${j}/issues`,label:"Issues",icon:ds,end:!1},{to:`${j}/sprints`,label:"Sprints",icon:gs,end:!0},{to:`${j}/timeline`,label:"Timeline",icon:hi,end:!0,desktopOnly:!0},{to:`${j}/access`,label:"Access",icon:Sn,end:!0},{to:`${j}/reports`,label:"Reports",icon:zs,end:!0},{to:`${j}/activity`,label:"Activity",icon:Ol,end:!0}],w=k,S=k.filter(C=>!C.desktopOnly),_=p.pathname.endsWith("/board")||p.pathname.endsWith("/timeline");return g&&_?s.jsx(qn,{to:`${j}/issues`,replace:!0}):s.jsxs("div",{className:"flex flex-col h-full",children:[s.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:[s.jsxs("div",{className:"flex items-center gap-2.5 mb-3 md:mb-4",children:[r&&s.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}),s.jsx("h1",{className:"text-sm font-semibold",children:(r==null?void 0:r.name)??""}),d&&s.jsxs(Rt,{to:"health",className:z("inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-xs font-medium border transition-opacity hover:opacity-80",Om[d.health].badge),children:[s.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",Om[d.health].dot)}),Om[d.health].label]})]}),s.jsxs("div",{className:"hidden md:flex items-center -mb-px",children:[s.jsx("div",{className:"flex flex-1",children:w.map(({to:C,label:P,icon:O,end:E})=>s.jsxs(rn,{to:C,end:E,className:({isActive:D})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 transition-colors ${D?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:[s.jsx(O,{className:"h-3.5 w-3.5",strokeWidth:1.5}),P,P==="Access"&&l>0&&s.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white",children:l>9?"9+":l})]},C))}),r&&s.jsx("div",{className:"pb-px",children:s.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"h-7 px-2 text-xs text-muted-foreground",children:s.jsxs(Rt,{to:"health",children:[s.jsx(Ol,{className:"h-3.5 w-3.5 mr-1"}),"Status"]})})}),N&&r&&s.jsx("div",{className:"pb-px pr-1",children:s.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>f(!0),className:"h-7 px-2 text-xs text-muted-foreground",children:[s.jsx(xD,{className:"h-3.5 w-3.5 mr-1"}),"Share"]})})]}),s.jsx("div",{className:"flex md:hidden overflow-x-auto -mb-px scrollbar-none",children:S.map(({to:C,label:P,icon:O,end:E})=>s.jsxs(rn,{to:C,end:E,className:({isActive:D})=>`flex items-center gap-1.5 px-3 py-2 text-sm border-b-2 whitespace-nowrap transition-colors shrink-0 ${D?"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:[s.jsx(O,{className:"h-3.5 w-3.5",strokeWidth:1.5}),P,P==="Access"&&l>0&&s.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white",children:l>9?"9+":l})]},C))})]}),s.jsx("div",{className:"flex flex-col flex-1 min-h-0",children:s.jsx(Jl,{})}),r&&s.jsx(ZT,{open:u,onClose:()=>f(!1),project:r})]})}function e3(){var a,i;const{user:e,logout:t}=De(),r=e?`${((a=e.first_name)==null?void 0:a[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 s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[s.jsx(Pt,{className:"h-8 w-8 rounded-lg shrink-0",children:s.jsx(Mt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:n}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),s.jsx(_o,{className:"ml-auto size-4 shrink-0"})]})}),s.jsxs(Dr,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[s.jsx(Vu,{className:"size-4"}),"Sign out"]})]})]})})})}function t3(){const{workspace:e}=De(),t=ct(),r=(e==null?void 0:e.slug)??"";return s.jsxs(rf,{collapsible:"offcanvas",variant:"inset",children:[s.jsx(af,{children:s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[s.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:s.jsx(zs,{className:"size-4"})}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:"Reporting"}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Time analytics"})]})]})})})}),s.jsx(lf,{children:s.jsx(ti,{children:s.jsx(ri,{children:s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(vt,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[s.jsx($a,{}),s.jsx("span",{children:"Back to workspace"})]})})})})})}),s.jsx(of,{children:s.jsx(e3,{})})]})}function r3(){return s.jsxs(tf,{children:[s.jsx(t3,{}),s.jsxs(sf,{className:"flex flex-col min-w-0",children:[s.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:s.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[s.jsx(nf,{className:"-ml-1"}),s.jsx(Mo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(zs,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),s.jsx("span",{className:"font-medium",children:"Reporting"})]}),s.jsx("div",{className:"ml-auto",children:s.jsx(cf,{})})]})}),s.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:s.jsx(Jl,{})})]})]})}function n3(){var a,i;const{user:e,logout:t}=De(),r=e?`${((a=e.first_name)==null?void 0:a[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 s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[s.jsx(Pt,{className:"h-8 w-8 rounded-lg shrink-0",children:s.jsx(Mt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:n}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),s.jsx(_o,{className:"ml-auto size-4 shrink-0"})]})}),s.jsxs(Dr,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[s.jsx(Vu,{className:"size-4"}),"Sign out"]})]})]})})})}function s3(){var o;const{workspace:e,user:t}=De(),r=ct(),n=wo(),a=(e==null?void 0:e.slug)??"",i=((o=t==null?void 0:t.roles)==null?void 0:o.includes("super-admin"))??!1;return s.jsxs(rf,{collapsible:"offcanvas",variant:"inset",children:[s.jsx(af,{children:s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[s.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:s.jsx(Id,{className:"size-4"})}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:"Org Settings"}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Global configuration"})]})]})})})}),s.jsx(lf,{children:s.jsx(ti,{children:s.jsx(ri,{children:s.jsxs(Cr,{children:[s.jsx(kt,{children:s.jsxs(vt,{onClick:()=>r(a?`/${a}/projects`:"/"),tooltip:"Back to workspace",children:[s.jsx($a,{}),s.jsx("span",{children:"Back to workspace"})]})}),s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:n.pathname==="/org/settings",tooltip:"Settings",children:s.jsxs(rn,{to:"/org/settings",children:[s.jsx(Id,{}),s.jsx("span",{children:"Settings"})]})})}),i&&s.jsx(kt,{children:s.jsx(vt,{asChild:!0,isActive:n.pathname==="/org/reports",tooltip:"Org Reports",children:s.jsxs(rn,{to:"/org/reports",children:[s.jsx(zs,{}),s.jsx("span",{children:"Org Reports"})]})})})]})})})}),s.jsx(of,{children:s.jsx(n3,{})})]})}function a3(){return s.jsxs(tf,{children:[s.jsx(s3,{}),s.jsxs(sf,{className:"flex flex-col min-w-0",children:[s.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:s.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[s.jsx(nf,{className:"-ml-1"}),s.jsx(Mo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Id,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),s.jsx("span",{className:"font-medium",children:"Org Settings"})]}),s.jsx("div",{className:"ml-auto",children:s.jsx(cf,{})})]})}),s.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:s.jsx(Jl,{})})]})]})}function i3(){var a,i;const{user:e,logout:t}=De(),r=e?`${((a=e.first_name)==null?void 0:a[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 s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",children:[s.jsxs(Pt,{className:"h-8 w-8 rounded-lg shrink-0",children:[(e==null?void 0:e.avatar_url)&&s.jsx(Dl,{src:e.avatar_url,alt:n??"",className:"object-cover"}),s.jsx(Mt,{className:"rounded-lg bg-foreground text-background text-xs font-medium",children:r})]}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:n}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:(e==null?void 0:e.email)??""})]}),s.jsx(_o,{className:"ml-auto size-4 shrink-0"})]})}),s.jsxs(Dr,{className:"w-(--radix-dropdown-menu-trigger-width) min-w-56 rounded-lg",side:"top",align:"end",sideOffset:4,children:[s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive cursor-pointer",onClick:t,children:[s.jsx(Vu,{className:"size-4"}),"Sign out"]})]})]})})})}function o3(){const{workspace:e}=De(),t=ct(),r=(e==null?void 0:e.slug)??"";return s.jsxs(rf,{collapsible:"offcanvas",variant:"inset",children:[s.jsx(af,{children:s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(vt,{size:"lg",className:"data-[state=open]:bg-sidebar-accent",children:[s.jsx("div",{className:"flex aspect-square size-8 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:s.jsx(ic,{className:"size-4"})}),s.jsxs("div",{className:"grid flex-1 text-left text-sm leading-tight",children:[s.jsx("span",{className:"truncate font-semibold",children:"Profile"}),s.jsx("span",{className:"truncate text-xs text-sidebar-foreground/60",children:"Personal settings"})]})]})})})}),s.jsx(lf,{children:s.jsx(ti,{children:s.jsx(ri,{children:s.jsx(Cr,{children:s.jsx(kt,{children:s.jsxs(vt,{onClick:()=>t(r?`/${r}/projects`:"/"),tooltip:"Back to workspace",children:[s.jsx($a,{}),s.jsx("span",{children:"Back to workspace"})]})})})})})}),s.jsx(of,{children:s.jsx(i3,{})})]})}function l3(){return s.jsxs(tf,{children:[s.jsx(o3,{}),s.jsxs(sf,{className:"flex flex-col min-w-0",children:[s.jsx("header",{className:"flex h-14 shrink-0 items-center gap-2 border-b w-full",children:s.jsxs("div",{className:"flex w-full items-center gap-1 px-4 lg:gap-2 lg:px-6",children:[s.jsx(nf,{className:"-ml-1"}),s.jsx(Mo,{orientation:"vertical",className:"mx-2 data-[orientation=vertical]:h-4"}),s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(ic,{className:"h-4 w-4 text-indigo-600 dark:text-indigo-400",strokeWidth:1.5}),s.jsx("span",{className:"font-medium",children:"Profile"})]}),s.jsx("div",{className:"ml-auto",children:s.jsx(cf,{})})]})}),s.jsx("div",{className:"flex flex-1 flex-col min-h-0 overflow-y-auto overflow-x-hidden",children:s.jsx(Jl,{})})]})]})}var yy=1,c3=.9,d3=.8,u3=.17,Em=.1,Am=.999,f3=.9999,m3=.99,h3=/[\\\/_+.#"@\[\(\{&]/,p3=/[\\\/_+.#"@\[\(\{&]/g,x3=/[\s-]/,RN=/[\s-]/g;function $h(e,t,r,n,a,i,o){if(i===t.length)return a===e.length?yy:m3;var l=`${a},${i}`;if(o[l]!==void 0)return o[l];for(var c=n.charAt(i),d=r.indexOf(c,a),u=0,f,m,p,x;d>=0;)f=$h(e,t,r,n,d+1,i+1,o),f>u&&(d===a?f*=yy:h3.test(e.charAt(d-1))?(f*=d3,p=e.slice(a,d-1).match(p3),p&&a>0&&(f*=Math.pow(Am,p.length))):x3.test(e.charAt(d-1))?(f*=c3,x=e.slice(a,d-1).match(RN),x&&a>0&&(f*=Math.pow(Am,x.length))):(f*=u3,a>0&&(f*=Math.pow(Am,d-a))),e.charAt(d)!==t.charAt(i)&&(f*=f3)),(f<Em&&r.charAt(d-1)===n.charAt(i+1)||n.charAt(i+1)===n.charAt(i)&&r.charAt(d-1)!==n.charAt(i))&&(m=$h(e,t,r,n,d+1,i+2,o),m*Em>f&&(f=m*Em)),f>u&&(u=f),d=r.indexOf(c,d+1);return o[l]=u,u}function by(e){return e.toLowerCase().replace(RN," ")}function g3(e,t,r){return e=r&&r.length>0?`${e+" "+r.join(" ")}`:e,$h(e,t,by(e),by(t),0,0,{})}var tl='[cmdk-group=""]',Dm='[cmdk-group-items=""]',v3='[cmdk-group-heading=""]',Cx='[cmdk-item=""]',jy=`${Cx}:not([aria-disabled="true"])`,zh="cmdk-item-select",Ja="data-value",y3=(e,t,r)=>g3(e,t,r),$N=h.createContext(void 0),cc=()=>h.useContext($N),zN=h.createContext(void 0),_x=()=>h.useContext(zN),LN=h.createContext(void 0),FN=h.forwardRef((e,t)=>{let r=Ki(()=>{var L,H;return{search:"",value:(H=(L=e.value)!=null?L:e.defaultValue)!=null?H:"",filtered:{count:0,items:new Map,groups:new Set}}}),n=Ki(()=>new Set),a=Ki(()=>new Map),i=Ki(()=>new Map),o=Ki(()=>new Set),l=BN(e),{label:c,children:d,value:u,onValueChange:f,filter:m,shouldFilter:p,loop:x,disablePointerSelection:g=!1,vimBindings:v=!0,...y}=e,b=Xi(),N=Xi(),j=Xi(),k=h.useRef(null),w=O3();pi(()=>{if(u!==void 0){let L=u.trim();r.current.value=L,S.emit()}},[u]),pi(()=>{w(6,D)},[]);let S=h.useMemo(()=>({subscribe:L=>(o.current.add(L),()=>o.current.delete(L)),snapshot:()=>r.current,setState:(L,H,R)=>{var Y,J,A;if(!Object.is(r.current[L],H)){if(r.current[L]=H,L==="search")E(),P(),w(1,O);else if(L==="value"&&(R||w(5,D),((Y=l.current)==null?void 0:Y.value)!==void 0)){let U=H??"";(A=(J=l.current).onValueChange)==null||A.call(J,U);return}S.emit()}},emit:()=>{o.current.forEach(L=>L())}}),[]),_=h.useMemo(()=>({value:(L,H,R)=>{var Y;H!==((Y=i.current.get(L))==null?void 0:Y.value)&&(i.current.set(L,{value:H,keywords:R}),r.current.filtered.items.set(L,C(H,R)),w(2,()=>{P(),S.emit()}))},item:(L,H)=>(n.current.add(L),H&&(a.current.has(H)?a.current.get(H).add(L):a.current.set(H,new Set([L]))),w(3,()=>{E(),P(),r.current.value||O(),S.emit()}),()=>{i.current.delete(L),n.current.delete(L),r.current.filtered.items.delete(L);let R=I();w(4,()=>{E(),(R==null?void 0:R.getAttribute("id"))===L&&O(),S.emit()})}),group:L=>(a.current.has(L)||a.current.set(L,new Set),()=>{i.current.delete(L),a.current.delete(L)}),filter:()=>l.current.shouldFilter,label:c||e["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:b,inputId:j,labelId:N,listInnerRef:k}),[]);function C(L,H){var R,Y;let J=(Y=(R=l.current)==null?void 0:R.filter)!=null?Y:y3;return L?J(L,r.current.search,H):0}function P(){if(!r.current.search||l.current.shouldFilter===!1)return;let L=r.current.filtered.items,H=[];r.current.filtered.groups.forEach(Y=>{let J=a.current.get(Y),A=0;J.forEach(U=>{let $=L.get(U);A=Math.max($,A)}),H.push([Y,A])});let R=k.current;V().sort((Y,J)=>{var A,U;let $=Y.getAttribute("id"),ne=J.getAttribute("id");return((A=L.get(ne))!=null?A:0)-((U=L.get($))!=null?U:0)}).forEach(Y=>{let J=Y.closest(Dm);J?J.appendChild(Y.parentElement===J?Y:Y.closest(`${Dm} > *`)):R.appendChild(Y.parentElement===R?Y:Y.closest(`${Dm} > *`))}),H.sort((Y,J)=>J[1]-Y[1]).forEach(Y=>{var J;let A=(J=k.current)==null?void 0:J.querySelector(`${tl}[${Ja}="${encodeURIComponent(Y[0])}"]`);A==null||A.parentElement.appendChild(A)})}function O(){let L=V().find(R=>R.getAttribute("aria-disabled")!=="true"),H=L==null?void 0:L.getAttribute(Ja);S.setState("value",H||void 0)}function E(){var L,H,R,Y;if(!r.current.search||l.current.shouldFilter===!1){r.current.filtered.count=n.current.size;return}r.current.filtered.groups=new Set;let J=0;for(let A of n.current){let U=(H=(L=i.current.get(A))==null?void 0:L.value)!=null?H:"",$=(Y=(R=i.current.get(A))==null?void 0:R.keywords)!=null?Y:[],ne=C(U,$);r.current.filtered.items.set(A,ne),ne>0&&J++}for(let[A,U]of a.current)for(let $ of U)if(r.current.filtered.items.get($)>0){r.current.filtered.groups.add(A);break}r.current.filtered.count=J}function D(){var L,H,R;let Y=I();Y&&(((L=Y.parentElement)==null?void 0:L.firstChild)===Y&&((R=(H=Y.closest(tl))==null?void 0:H.querySelector(v3))==null||R.scrollIntoView({block:"nearest"})),Y.scrollIntoView({block:"nearest"}))}function I(){var L;return(L=k.current)==null?void 0:L.querySelector(`${Cx}[aria-selected="true"]`)}function V(){var L;return Array.from(((L=k.current)==null?void 0:L.querySelectorAll(jy))||[])}function Q(L){let H=V()[L];H&&S.setState("value",H.getAttribute(Ja))}function q(L){var H;let R=I(),Y=V(),J=Y.findIndex(U=>U===R),A=Y[J+L];(H=l.current)!=null&&H.loop&&(A=J+L<0?Y[Y.length-1]:J+L===Y.length?Y[0]:Y[J+L]),A&&S.setState("value",A.getAttribute(Ja))}function re(L){let H=I(),R=H==null?void 0:H.closest(tl),Y;for(;R&&!Y;)R=L>0?P3(R,tl):M3(R,tl),Y=R==null?void 0:R.querySelector(jy);Y?S.setState("value",Y.getAttribute(Ja)):q(L)}let se=()=>Q(V().length-1),T=L=>{L.preventDefault(),L.metaKey?se():L.altKey?re(1):q(1)},M=L=>{L.preventDefault(),L.metaKey?Q(0):L.altKey?re(-1):q(-1)};return h.createElement(Ra.div,{ref:t,tabIndex:-1,...y,"cmdk-root":"",onKeyDown:L=>{var H;if((H=y.onKeyDown)==null||H.call(y,L),!L.defaultPrevented)switch(L.key){case"n":case"j":{v&&L.ctrlKey&&T(L);break}case"ArrowDown":{T(L);break}case"p":case"k":{v&&L.ctrlKey&&M(L);break}case"ArrowUp":{M(L);break}case"Home":{L.preventDefault(),Q(0);break}case"End":{L.preventDefault(),se();break}case"Enter":if(!L.nativeEvent.isComposing&&L.keyCode!==229){L.preventDefault();let R=I();if(R){let Y=new Event(zh);R.dispatchEvent(Y)}}}}},h.createElement("label",{"cmdk-label":"",htmlFor:_.inputId,id:_.labelId,style:A3},c),df(e,L=>h.createElement(zN.Provider,{value:S},h.createElement($N.Provider,{value:_},L))))}),b3=h.forwardRef((e,t)=>{var r,n;let a=Xi(),i=h.useRef(null),o=h.useContext(LN),l=cc(),c=BN(e),d=(n=(r=c.current)==null?void 0:r.forceMount)!=null?n:o==null?void 0:o.forceMount;pi(()=>{if(!d)return l.item(a,o==null?void 0:o.id)},[d]);let u=qN(a,i,[e.value,e.children,i],e.keywords),f=_x(),m=xi(w=>w.value&&w.value===u.current),p=xi(w=>d||l.filter()===!1?!0:w.search?w.filtered.items.get(a)>0:!0);h.useEffect(()=>{let w=i.current;if(!(!w||e.disabled))return w.addEventListener(zh,x),()=>w.removeEventListener(zh,x)},[p,e.onSelect,e.disabled]);function x(){var w,S;g(),(S=(w=c.current).onSelect)==null||S.call(w,u.current)}function g(){f.setState("value",u.current,!0)}if(!p)return null;let{disabled:v,value:y,onSelect:b,forceMount:N,keywords:j,...k}=e;return h.createElement(Ra.div,{ref:Tl([i,t]),...k,id:a,"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)}),j3=h.forwardRef((e,t)=>{let{heading:r,children:n,forceMount:a,...i}=e,o=Xi(),l=h.useRef(null),c=h.useRef(null),d=Xi(),u=cc(),f=xi(p=>a||u.filter()===!1?!0:p.search?p.filtered.groups.has(o):!0);pi(()=>u.group(o),[]),qN(o,l,[e.value,e.heading,c]);let m=h.useMemo(()=>({id:o,forceMount:a}),[a]);return h.createElement(Ra.div,{ref:Tl([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),df(e,p=>h.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":r?d:void 0},h.createElement(LN.Provider,{value:m},p))))}),w3=h.forwardRef((e,t)=>{let{alwaysRender:r,...n}=e,a=h.useRef(null),i=xi(o=>!o.search);return!r&&!i?null:h.createElement(Ra.div,{ref:Tl([a,t]),...n,"cmdk-separator":"",role:"separator"})}),N3=h.forwardRef((e,t)=>{let{onValueChange:r,...n}=e,a=e.value!=null,i=_x(),o=xi(u=>u.search),l=xi(u=>u.value),c=cc(),d=h.useMemo(()=>{var u;let f=(u=c.listInnerRef.current)==null?void 0:u.querySelector(`${Cx}[${Ja}="${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(Ra.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:a?e.value:o,onChange:u=>{a||i.setState("search",u.target.value),r==null||r(u.target.value)}})}),k3=h.forwardRef((e,t)=>{let{children:r,label:n="Suggestions",...a}=e,i=h.useRef(null),o=h.useRef(null),l=cc();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(Ra.div,{ref:Tl([i,t]),...a,"cmdk-list":"",role:"listbox","aria-label":n,id:l.listId},df(e,c=>h.createElement("div",{ref:Tl([o,l.listInnerRef]),"cmdk-list-sizer":""},c)))}),S3=h.forwardRef((e,t)=>{let{open:r,onOpenChange:n,overlayClassName:a,contentClassName:i,container:o,...l}=e;return h.createElement(rc,{open:r,onOpenChange:n},h.createElement(tc,{container:o},h.createElement(Si,{"cmdk-overlay":"",className:a}),h.createElement(Ci,{"aria-label":e.label,"cmdk-dialog":"",className:i},h.createElement(FN,{ref:t,...l}))))}),C3=h.forwardRef((e,t)=>xi(r=>r.filtered.count===0)?h.createElement(Ra.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),_3=h.forwardRef((e,t)=>{let{progress:r,children:n,label:a="Loading...",...i}=e;return h.createElement(Ra.div,{ref:t,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":r,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},df(e,o=>h.createElement("div",{"aria-hidden":!0},o)))}),Jr=Object.assign(FN,{List:k3,Item:b3,Input:N3,Group:j3,Separator:w3,Dialog:S3,Empty:C3,Loading:_3});function P3(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}function M3(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}function BN(e){let t=h.useRef(e);return pi(()=>{t.current=e}),t}var pi=typeof window>"u"?h.useEffect:h.useLayoutEffect;function Ki(e){let t=h.useRef();return t.current===void 0&&(t.current=e()),t}function Tl(e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}function xi(e){let t=_x(),r=()=>e(t.snapshot());return kE.useSyncExternalStore(t.subscribe,r,r)}function qN(e,t,r,n=[]){let a=h.useRef(),i=cc();return pi(()=>{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():a.current}})(),c=n.map(d=>d.trim());i.value(e,l,c),(o=t.current)==null||o.setAttribute(Ja,l),a.current=l}),a}var O3=()=>{let[e,t]=h.useState(),r=Ki(()=>new Map);return pi(()=>{r.current.forEach(n=>n()),r.current=new Map},[e]),(n,a)=>{r.current.set(n,a),t({})}};function E3(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function df({asChild:e,children:t},r){return e&&h.isValidElement(t)?h.cloneElement(E3(t),{ref:t.ref},r(t.props.children)):r(t)}var A3={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const ya=h.forwardRef(({className:e,...t},r)=>s.jsx(Jr,{ref:r,className:z("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));ya.displayName=Jr.displayName;const D3=({children:e,open:t,onOpenChange:r})=>s.jsx(mn,{open:t,onOpenChange:r,children:s.jsx(Zr,{className:"overflow-hidden p-0 shadow-lg max-w-[560px]",children:s.jsx(ya,{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})})}),dc=h.forwardRef(({className:e,...t},r)=>s.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[s.jsx(za,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),s.jsx(Jr.Input,{ref:r,className:z("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})]}));dc.displayName=Jr.Input.displayName;const ba=h.forwardRef(({className:e,...t},r)=>s.jsx(Jr.List,{ref:r,className:z("max-h-[320px] overflow-y-auto overflow-x-hidden",e),...t}));ba.displayName=Jr.List.displayName;const uc=h.forwardRef((e,t)=>s.jsx(Jr.Empty,{ref:t,className:"py-6 text-center text-sm text-muted-foreground",...e}));uc.displayName=Jr.Empty.displayName;const Ts=h.forwardRef(({className:e,...t},r)=>s.jsx(Jr.Group,{ref:r,className:z("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}));Ts.displayName=Jr.Group.displayName;const WN=h.forwardRef(({className:e,...t},r)=>s.jsx(Jr.Separator,{ref:r,className:z("-mx-1 h-px bg-border",e),...t}));WN.displayName=Jr.Separator.displayName;const an=h.forwardRef(({className:e,...t},r)=>s.jsx(Jr.Item,{ref:r,className:z("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}));an.displayName=Jr.Item.displayName;function T3(){const{open:e,setOpen:t}=ox(),r=ct(),{data:n}=oc(),{workspace:a}=De(),i=(a==null?void 0:a.slug)??"",o=l=>{t(!1),l()};return s.jsxs(D3,{open:e,onOpenChange:t,children:[s.jsx(dc,{placeholder:"Search or jump to..."}),s.jsxs(ba,{children:[s.jsx(uc,{children:"No results found."}),s.jsxs(Ts,{heading:"Navigation",children:[s.jsxs(an,{onSelect:()=>o(()=>r(`/${i}/projects`)),children:[s.jsx(Dd,{className:"text-muted-foreground"}),s.jsx("span",{children:"Projects"})]}),s.jsxs(an,{onSelect:()=>o(()=>r(`/${i}/notifications`)),children:[s.jsx(mi,{className:"text-muted-foreground"}),s.jsx("span",{children:"Notifications"})]}),s.jsxs(an,{onSelect:()=>o(()=>r(`/${i}/settings`)),children:[s.jsx(vx,{className:"text-muted-foreground"}),s.jsx("span",{children:"Settings"})]})]}),n&&n.length>0&&s.jsxs(s.Fragment,{children:[s.jsx(WN,{}),s.jsxs(Ts,{heading:"Projects",children:[n.map(l=>s.jsxs(an,{value:`${l.name} board`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/board`)),children:[s.jsx(Gr,{className:"text-muted-foreground"}),s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),s.jsx("span",{className:"truncate",children:l.name}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Board"})]})]},`${l.id}-board`)),n.map(l=>s.jsxs(an,{value:`${l.name} issues`,onSelect:()=>o(()=>r(`/${i}/projects/${l.identifier}/issues`)),children:[s.jsx(ds,{className:"text-muted-foreground"}),s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"font-mono text-[11px] text-muted-foreground shrink-0",children:l.identifier}),s.jsx("span",{className:"truncate",children:l.name}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"Issues"})]})]},`${l.id}-issues`))]})]})]})]})}function Or({zone:e,props:t}){const r=W5(e);return r.length?s.jsx(s.Fragment,{children:r.map((n,a)=>s.jsx(n,{...t},n.displayName??n.name??a))}):null}function Px({flow:e,inviteToken:t,label:r,disabled:n}){const a=()=>{const i=`${ro}/auth/google?flow=${e}${t?`&invite_token=${encodeURIComponent(t)}`:""}`;window.location.href=i};return s.jsxs(ee,{type:"button",variant:"outline",className:"w-full gap-2 bg-white dark:bg-black text-black dark:text-white",onClick:a,disabled:n,children:[s.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 18 18","aria-hidden":"true",children:[s.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"}),s.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"}),s.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"}),s.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 fc(){var e;return((e=window.__MERIDIAN_CONFIG__)==null?void 0:e.appName)??"Meridian"}function I3(){var e;return(e=window.__MERIDIAN_CONFIG__)==null?void 0:e.logoUrl}function Ao({className:e}){const t=I3();return t?s.jsx("img",{src:t,alt:fc(),className:e??"h-12 w-12"}):s.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:s.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:s.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:s.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})})}function R3(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[a,i]=h.useState(!1),o=ct(),l=YD(),{data:c}=ef(),d=u=>{u.preventDefault(),l.mutate({email:e,password:r},{onSuccess:()=>o("/"),onError:f=>F.error(f.message??"Invalid email or password")})};return s.jsx("div",{className:"min-h-screen bg-white dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[360px]",children:[s.jsx(Or,{zone:"login.before",props:{}}),s.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[s.jsx(Ao,{}),s.jsxs("div",{className:"text-center",children:[s.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",fc()]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Sign in to access the admin area"})]})]}),s.jsxs("form",{onSubmit:d,className:"space-y-2",children:[s.jsx(_e,{type:"email",placeholder:"Email",value:e,onChange:u=>t(u.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),s.jsxs("div",{className:"relative",children:[s.jsx(_e,{type:a?"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"}),s.jsx("button",{type:"button",onClick:()=>i(!a),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:a?s.jsx(ac,{className:"h-4 w-4"}):s.jsx(Mi,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex justify-end",children:s.jsx(Rt,{to:"/forgot-password",className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Forgot password?"})}),s.jsx("div",{className:"pt-1",children:s.jsx(ee,{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)&&s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-px flex-1 bg-border"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),s.jsx("div",{className:"h-px flex-1 bg-border"})]}),s.jsx(Px,{flow:"login"})]}),((c==null?void 0:c.needsSetup)||(c==null?void 0:c.registrationEnabled))&&s.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Don't have an account?"," ",s.jsx(Rt,{to:"/register",className:"text-indigo hover:opacity-80 transition-opacity",children:"Create one"})]}),s.jsx(Or,{zone:"login.after",props:{}})]})})}var $3=Object.defineProperty,z3=Object.defineProperties,L3=Object.getOwnPropertyDescriptors,Ld=Object.getOwnPropertySymbols,UN=Object.prototype.hasOwnProperty,HN=Object.prototype.propertyIsEnumerable,wy=(e,t,r)=>t in e?$3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F3=(e,t)=>{for(var r in t||(t={}))UN.call(t,r)&&wy(e,r,t[r]);if(Ld)for(var r of Ld(t))HN.call(t,r)&&wy(e,r,t[r]);return e},B3=(e,t)=>z3(e,L3(t)),q3=(e,t)=>{var r={};for(var n in e)UN.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ld)for(var n of Ld(e))t.indexOf(n)<0&&HN.call(e,n)&&(r[n]=e[n]);return r};function W3(e){let t=setTimeout(e,0),r=setTimeout(e,10),n=setTimeout(e,50);return[t,r,n]}function U3(e){let t=h.useRef();return h.useEffect(()=>{t.current=e}),t.current}var H3=18,KN=40,K3=`${KN}px`,Y3=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function G3({containerRef:e,inputRef:t,pushPasswordManagerStrategy:r,isFocused:n}){let[a,i]=h.useState(!1),[o,l]=h.useState(!1),[c,d]=h.useState(!1),u=h.useMemo(()=>r==="none"?!1:(r==="increase-width"||r==="experimental-no-flickering")&&a&&o,[a,o,r]),f=h.useCallback(()=>{let m=e.current,p=t.current;if(!m||!p||c||r==="none")return;let x=m,g=x.getBoundingClientRect().left+x.offsetWidth,v=x.getBoundingClientRect().top+x.offsetHeight/2,y=g-H3,b=v;document.querySelectorAll(Y3).length===0&&document.elementFromPoint(y,b)===m||(i(!0),d(!0))},[e,t,c,r]);return h.useEffect(()=>{let m=e.current;if(!m||r==="none")return;function p(){let g=window.innerWidth-m.getBoundingClientRect().right;l(g>=KN)}p();let x=setInterval(p,1e3);return()=>{clearInterval(x)}},[e,r]),h.useEffect(()=>{let m=n||document.activeElement===t.current;if(r==="none"||!m)return;let p=setTimeout(f,0),x=setTimeout(f,2e3),g=setTimeout(f,5e3),v=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(p),clearTimeout(x),clearTimeout(g),clearTimeout(v)}},[t,n,r,f]),{hasPWMBadge:a,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:K3}}var YN=h.createContext({}),GN=h.forwardRef((e,t)=>{var r=e,{value:n,onChange:a,maxLength:i,textAlign:o="left",pattern:l,placeholder:c,inputMode:d="numeric",onComplete:u,pushPasswordManagerStrategy:f="increase-width",pasteTransformer:m,containerClassName:p,noScriptCSSFallback:x=V3,render:g,children:v}=r,y=q3(r,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),b,N,j,k,w;let[S,_]=h.useState(typeof y.defaultValue=="string"?y.defaultValue:""),C=n??S,P=U3(C),O=h.useCallback(G=>{a==null||a(G),_(G)},[a]),E=h.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),D=h.useRef(null),I=h.useRef(null),V=h.useRef({value:C,onChange:O,isIOS:typeof window<"u"&&((N=(b=window==null?void 0:window.CSS)==null?void 0:b.supports)==null?void 0:N.call(b,"-webkit-touch-callout","none"))}),Q=h.useRef({prev:[(j=D.current)==null?void 0:j.selectionStart,(k=D.current)==null?void 0:k.selectionEnd,(w=D.current)==null?void 0:w.selectionDirection]});h.useImperativeHandle(t,()=>D.current,[]),h.useEffect(()=>{let G=D.current,te=I.current;if(!G||!te)return;V.current.value!==G.value&&V.current.onChange(G.value),Q.current.prev=[G.selectionStart,G.selectionEnd,G.selectionDirection];function de(){if(document.activeElement!==G){L(null),R(null);return}let xe=G.selectionStart,be=G.selectionEnd,qe=G.selectionDirection,We=G.maxLength,Ge=G.value,ft=Q.current.prev,et=-1,Ke=-1,Ze;if(Ge.length!==0&&xe!==null&&be!==null){let wr=xe===be,ir=xe===Ge.length&&Ge.length<We;if(wr&&!ir){let jt=xe;if(jt===0)et=0,Ke=1,Ze="forward";else if(jt===We)et=jt-1,Ke=jt,Ze="backward";else if(We>1&&Ge.length>1){let qt=0;if(ft[0]!==null&&ft[1]!==null){Ze=jt<ft[1]?"backward":"forward";let Vt=ft[0]===ft[1]&&ft[0]<We;Ze==="backward"&&!Vt&&(qt=-1)}et=qt+jt,Ke=qt+jt+1}}et!==-1&&Ke!==-1&&et!==Ke&&D.current.setSelectionRange(et,Ke,Ze)}let sr=et!==-1?et:xe,Lr=Ke!==-1?Ke:be,ar=Ze??qe;L(sr),R(Lr),Q.current.prev=[sr,Lr,ar]}if(document.addEventListener("selectionchange",de,{capture:!0}),de(),document.activeElement===G&&T(!0),!document.getElementById("input-otp-style")){let xe=document.createElement("style");if(xe.id="input-otp-style",document.head.appendChild(xe),xe.sheet){let be="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";rl(xe.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),rl(xe.sheet,`[data-input-otp]:autofill { ${be} }`),rl(xe.sheet,`[data-input-otp]:-webkit-autofill { ${be} }`),rl(xe.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),rl(xe.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let me=()=>{te&&te.style.setProperty("--root-height",`${G.clientHeight}px`)};me();let Z=new ResizeObserver(me);return Z.observe(G),()=>{document.removeEventListener("selectionchange",de,{capture:!0}),Z.disconnect()}},[]);let[q,re]=h.useState(!1),[se,T]=h.useState(!1),[M,L]=h.useState(null),[H,R]=h.useState(null);h.useEffect(()=>{W3(()=>{var G,te,de,me;(G=D.current)==null||G.dispatchEvent(new Event("input"));let Z=(te=D.current)==null?void 0:te.selectionStart,xe=(de=D.current)==null?void 0:de.selectionEnd,be=(me=D.current)==null?void 0:me.selectionDirection;Z!==null&&xe!==null&&(L(Z),R(xe),Q.current.prev=[Z,xe,be])})},[C,se]),h.useEffect(()=>{P!==void 0&&C!==P&&P.length<i&&C.length===i&&(u==null||u(C))},[i,u,P,C]);let Y=G3({containerRef:I,inputRef:D,pushPasswordManagerStrategy:f,isFocused:se}),J=h.useCallback(G=>{let te=G.currentTarget.value.slice(0,i);if(te.length>0&&E&&!E.test(te)){G.preventDefault();return}typeof P=="string"&&te.length<P.length&&document.dispatchEvent(new Event("selectionchange")),O(te)},[i,O,P,E]),A=h.useCallback(()=>{var G;if(D.current){let te=Math.min(D.current.value.length,i-1),de=D.current.value.length;(G=D.current)==null||G.setSelectionRange(te,de),L(te),R(de)}T(!0)},[i]),U=h.useCallback(G=>{var te,de;let me=D.current;if(!m&&(!V.current.isIOS||!G.clipboardData||!me))return;let Z=G.clipboardData.getData("text/plain"),xe=m?m(Z):Z;G.preventDefault();let be=(te=D.current)==null?void 0:te.selectionStart,qe=(de=D.current)==null?void 0:de.selectionEnd,We=(be!==qe?C.slice(0,be)+xe+C.slice(qe):C.slice(0,be)+xe+C.slice(be)).slice(0,i);if(We.length>0&&E&&!E.test(We))return;me.value=We,O(We);let Ge=Math.min(We.length,i-1),ft=We.length;me.setSelectionRange(Ge,ft),L(Ge),R(ft)},[i,O,E,C]),$=h.useMemo(()=>({position:"relative",cursor:y.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[y.disabled]),ne=h.useMemo(()=>({position:"absolute",inset:0,width:Y.willPushPWMBadge?`calc(100% + ${Y.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:Y.willPushPWMBadge?`inset(0 ${Y.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[Y.PWM_BADGE_SPACE_WIDTH,Y.willPushPWMBadge,o]),B=h.useMemo(()=>h.createElement("input",B3(F3({autoComplete:y.autoComplete||"one-time-code"},y),{"data-input-otp":!0,"data-input-otp-placeholder-shown":C.length===0||void 0,"data-input-otp-mss":M,"data-input-otp-mse":H,inputMode:d,pattern:E==null?void 0:E.source,"aria-placeholder":c,style:ne,maxLength:i,value:C,ref:D,onPaste:G=>{var te;U(G),(te=y.onPaste)==null||te.call(y,G)},onChange:J,onMouseOver:G=>{var te;re(!0),(te=y.onMouseOver)==null||te.call(y,G)},onMouseLeave:G=>{var te;re(!1),(te=y.onMouseLeave)==null||te.call(y,G)},onFocus:G=>{var te;A(),(te=y.onFocus)==null||te.call(y,G)},onBlur:G=>{var te;T(!1),(te=y.onBlur)==null||te.call(y,G)}})),[J,A,U,d,ne,i,H,M,y,E==null?void 0:E.source,C]),X=h.useMemo(()=>({slots:Array.from({length:i}).map((G,te)=>{var de;let me=se&&M!==null&&H!==null&&(M===H&&te===M||te>=M&&te<H),Z=C[te]!==void 0?C[te]:null,xe=C[0]!==void 0?null:(de=c==null?void 0:c[te])!=null?de:null;return{char:Z,placeholderChar:xe,isActive:me,hasFakeCaret:me&&Z===null}}),isFocused:se,isHovering:!y.disabled&&q}),[se,q,i,H,M,y.disabled,C]),oe=h.useMemo(()=>g?g(X):h.createElement(YN.Provider,{value:X},v),[v,X,g]);return h.createElement(h.Fragment,null,x!==null&&h.createElement("noscript",null,h.createElement("style",null,x)),h.createElement("div",{ref:I,"data-input-otp-container":!0,style:$,className:p},oe,h.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},B)))});GN.displayName="Input";function rl(e,t){try{e.insertRule(t)}catch{console.error("input-otp could not insert CSS rule:",t)}}var V3=`
566
+ [data-input-otp] {
567
+ --nojs-bg: white !important;
568
+ --nojs-fg: black !important;
569
+
570
+ background-color: var(--nojs-bg) !important;
571
+ color: var(--nojs-fg) !important;
572
+ caret-color: var(--nojs-fg) !important;
573
+ letter-spacing: .25em !important;
574
+ text-align: center !important;
575
+ border: 1px solid var(--nojs-fg) !important;
576
+ border-radius: 4px !important;
577
+ width: 100% !important;
578
+ }
579
+ @media (prefers-color-scheme: dark) {
580
+ [data-input-otp] {
581
+ --nojs-bg: black !important;
582
+ --nojs-fg: white !important;
583
+ }
584
+ }`;const Mx=h.forwardRef(({className:e,containerClassName:t,...r},n)=>s.jsx(GN,{ref:n,containerClassName:z("flex items-center gap-2 has-[:disabled]:opacity-50",t),className:z("disabled:cursor-not-allowed",e),...r}));Mx.displayName="InputOTP";const Fd=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:z("flex items-center",e),...t}));Fd.displayName="InputOTPGroup";const sn=h.forwardRef(({index:e,className:t,...r},n)=>{const a=h.useContext(YN),{char:i,hasFakeCaret:o,isActive:l}=a.slots[e];return s.jsxs("div",{ref:n,className:z("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&&s.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:s.jsx("div",{className:"h-4 w-px animate-caret-blink bg-foreground duration-1000"})})]})});sn.displayName="InputOTPSlot";const VN=h.forwardRef(({...e},t)=>s.jsx("div",{ref:t,role:"separator",...e,children:s.jsx(Js,{})}));VN.displayName="InputOTPSeparator";function X3(){const[e,t]=h.useState(""),[r,n]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),[u,f]=h.useState("form"),[m,p]=h.useState(""),x=ct(),g=GD(),v=KD(),{data:y}=ef(),b=(y==null?void 0:y.needsSetup)===!0,N=!b&&(y==null?void 0:y.registrationEnabled)===!0,j=async w=>{if(w.preventDefault(),N&&u==="form"){v.mutate({email:a},{onSuccess:()=>f("otp"),onError:S=>F.error(S.message??"Failed to send verification code")});return}g.mutate({email:a,password:o,first_name:e,last_name:r,...N?{otp:m}:{}},{onSuccess:()=>x("/"),onError:S=>F.error(S.message??"Registration failed")})},k=()=>{v.mutate({email:a},{onSuccess:()=>F.success("A new code has been sent"),onError:w=>F.error(w.message??"Failed to resend code")})};return s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[360px]",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[s.jsx(Ao,{}),s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:b?"Set up your account":"Create your account"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:b?"You're the first user — you'll be the super admin.":u==="otp"?`We sent a code to ${a}`:`Get started with ${fc()}`})]})]}),u==="otp"?s.jsxs("div",{className:"space-y-4",children:[s.jsx("div",{className:"flex justify-center",children:s.jsx(Mx,{maxLength:6,value:m,onChange:p,children:s.jsxs(Fd,{children:[s.jsx(sn,{index:0}),s.jsx(sn,{index:1}),s.jsx(sn,{index:2}),s.jsx(sn,{index:3}),s.jsx(sn,{index:4}),s.jsx(sn,{index:5})]})})}),s.jsx(ee,{className:"w-full h-10 font-medium",disabled:m.length<6||g.isPending,onClick:j,children:g.isPending?"Creating account...":"Verify & Create Account"}),s.jsxs("div",{className:"flex items-center justify-between text-sm",children:[s.jsxs("button",{type:"button",onClick:()=>{f("form"),p("")},className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx($a,{className:"h-3.5 w-3.5"}),"Back"]}),s.jsx("button",{type:"button",onClick:k,disabled:v.isPending,className:"text-muted-foreground hover:text-foreground transition-colors disabled:opacity-50",children:v.isPending?"Sending...":"Resend code"})]})]}):s.jsxs(s.Fragment,{children:[s.jsxs("form",{onSubmit:j,className:"space-y-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(_e,{placeholder:"First name",value:e,onChange:w=>t(w.target.value),required:!0,className:"bg-white dark:bg-card h-10"}),s.jsx(_e,{placeholder:"Last name",value:r,onChange:w=>n(w.target.value),required:!0,className:"bg-white dark:bg-card h-10"})]}),s.jsx(_e,{type:"email",placeholder:"Email",value:a,onChange:w=>i(w.target.value),autoComplete:"email",required:!0,className:"bg-white dark:bg-card h-10"}),s.jsxs("div",{className:"relative",children:[s.jsx(_e,{type:c?"text":"password",placeholder:"Password",value:o,onChange:w=>l(w.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10"}),s.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?s.jsx(ac,{className:"h-4 w-4"}):s.jsx(Mi,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"pt-1",children:s.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:g.isPending||v.isPending,children:v.isPending?"Sending code...":g.isPending?"Creating account...":N?"Continue":"Create Account"})})]}),(y==null?void 0:y.googleOAuthEnabled)&&s.jsxs("div",{className:"mt-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-px flex-1 bg-border"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),s.jsx("div",{className:"h-px flex-1 bg-border"})]}),s.jsx(Px,{flow:"register",label:b?"Set up with Google":"Continue with Google"})]}),s.jsxs("p",{className:"text-sm text-center text-muted-foreground mt-6",children:["Already have an account?"," ",s.jsx(Rt,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]})]})})}function Ox(e,t=300){const[r,n]=h.useState(e);return h.useEffect(()=>{const a=setTimeout(()=>n(e),t);return()=>clearTimeout(a)},[e,t]),r}function Ny(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Q3(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState(!1),c=ct(),d=ye(),{token:u,setWorkspace:f}=De();h.useEffect(()=>{if(!o||!u)return;const S=Nx(u);return S.addEventListener("workspace.access_request_resolved",_=>{try{JSON.parse(_.data??"{}").action==="approve"&&d.invalidateQueries({queryKey:["workspaces"]})}catch{}}),S.onerror=()=>{},()=>S.close()},[o,u,d]);const{data:m}=Cn(o?{refetchInterval:15e3}:!1);h.useEffect(()=>{if(o&&m&&m.length>0){const S=m[0];f({id:S.id,name:S.name,slug:S.slug,logo_url:S.logo_url??null}),c(`/${S.slug}/projects`,{replace:!0})}},[m,o]);const p=OD(),x=Ju(),g=Ox(e,300),{data:v=[]}=Zu(g),y=Ny(g),b=g.trim().length>0?v.find(S=>Ny(S.name)===y)??null:null,N=S=>{t(S.target.value),i(null),l(!1)},j=S=>{S.preventDefault(),e.trim()&&p.mutate({name:e.trim(),is_private:r},{onSuccess:_=>{const C={id:_.workspace.id,name:_.workspace.name,slug:_.workspace.slug};f(C),c(`/${C.slug}/projects`,{replace:!0})},onError:_=>{var P,O;const C=_;if(C.status===409){const E=(O=(P=C.data)==null?void 0:P.error)==null?void 0:O.workspace;if(E){i(E);return}}F.error(C.message??"Failed to create workspace")}})},k=S=>{x.mutate({workspaceId:S.id},{onSuccess:()=>l(!0),onError:_=>F.error(_.message??"Failed to send request")})},w=b?{id:b.id,name:b.name,slug:b.slug}:a;return s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[380px]",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[s.jsx(Ao,{}),s.jsxs("div",{className:"text-center",children:[s.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Create your ",fc()," workspace"]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"A workspace is where your team's projects and issues live."})]})]}),s.jsxs("form",{onSubmit:j,className:"space-y-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(_e,{placeholder:"Workspace name (e.g. Acme Corp)",value:e,onChange:N,autoFocus:!0,required:!0,className:z("bg-white dark:bg-card h-10",w&&!o&&"border-amber-400 focus-visible:ring-amber-300")}),s.jsx("p",{className:"text-xs text-muted-foreground px-0.5",children:"You can rename it later from settings."})]}),w&&!o&&s.jsxs("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800 px-3 py-2.5 space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx(hN,{className:"h-4 w-4 text-amber-600 dark:text-amber-400 shrink-0 mt-0.5"}),s.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:["A workspace named ",s.jsx("strong",{children:w.name})," already exists."]})]}),s.jsx(ee,{type:"button",size:"sm",variant:"outline",className:"w-full h-8 text-xs border-amber-300 hover:bg-amber-100 dark:border-amber-700 dark:hover:bg-amber-900/30",disabled:x.isPending,onClick:()=>k(w),children:x.isPending?"Sending request...":`Request access to ${w.name}`})]}),o&&w&&s.jsxs("div",{className:"rounded-lg border border-emerald-200 bg-emerald-50 dark:bg-emerald-950/20 dark:border-emerald-800 px-3 py-2.5 flex items-center gap-2",children:[s.jsx(kn,{className:"h-4 w-4 text-emerald-600 shrink-0"}),s.jsxs("p",{className:"text-sm text-emerald-800 dark:text-emerald-300",children:["Request sent to ",s.jsx("strong",{children:w.name}),". Admins will review it shortly."]})]}),s.jsxs("label",{className:"flex items-center gap-2.5 px-0.5 cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:r,onChange:S=>n(S.target.checked),className:"size-4 rounded border-border accent-indigo-600"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Sn,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-sm text-foreground",children:"Private workspace"})]}),s.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:"Only visible to members"})]}),s.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:!e.trim()||p.isPending,children:p.isPending?"Creating workspace...":"Create workspace"})]})]})})}function Z3(){const{token:e,logout:t,setWorkspace:r}=De(),n=ct(),a=ye(),{data:i=[]}=gN(),o=vN();h.useEffect(()=>{if(!e)return;const I=Nx(e);return I.addEventListener("workspace.access_request_resolved",V=>{try{JSON.parse(V.data??"{}").action==="approve"&&(a.invalidateQueries({queryKey:["workspaces"]}),a.invalidateQueries({queryKey:["my-access-requests"]}))}catch{}}),I.onerror=()=>{},()=>I.close()},[e,a]);const l=i.length>0,{data:c}=Cn({refetchInterval:l?6e4:!1});h.useEffect(()=>{if(c&&c.length>0){const I=c[0];r({id:I.id,name:I.name,slug:I.slug,logo_url:I.logo_url??null}),n(`/${I.slug}/projects`,{replace:!0})}},[c]);const[d,u]=h.useState(""),[f,m]=h.useState(!1),[p,x]=h.useState(null),[g,v]=h.useState(!1),[y,b]=h.useState(null),[N,j]=h.useState(""),k=h.useRef(null),w=h.useRef(null),S=Ox(d,250),{data:_=[]}=Zu(S),C=Ju();h.useEffect(()=>{function I(V){w.current&&!w.current.contains(V.target)&&k.current&&!k.current.contains(V.target)&&m(!1)}return document.addEventListener("pointerdown",I),()=>document.removeEventListener("pointerdown",I)},[]);const P=I=>{if(m(!1),!I.is_member&&!I.has_pending_request){b(I),j("");return}x(I),u(I.name),v(I.has_pending_request)},O=I=>{u(I.target.value),x(null),v(!1),m(!0)},E=()=>{y&&C.mutate({workspaceId:y.id,message:N.trim()||void 0},{onSuccess:()=>{b(null),x(y),u(y.name),v(!0)},onError:I=>{F.error(I.message??"Failed to send request"),b(null)}})},D=(I,V,Q)=>{o.mutate({workspaceId:I,requestId:V},{onSuccess:()=>{F.success(`Request to ${Q??"workspace"} cancelled`),(p==null?void 0:p.id)===I&&(x(null),u(""),v(!1))},onError:()=>F.error("Failed to cancel request")})};return s.jsxs("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:[s.jsxs("div",{className:"w-full max-w-[420px] space-y-6",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4",children:[s.jsx(Ao,{}),s.jsxs("div",{className:"text-center",children:[s.jsxs("h1",{className:"text-lg font-semibold text-foreground",children:["Welcome to ",fc()]}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"You haven't been assigned to a workspace yet. Create one or request access to an existing workspace."})]})]}),i.length>0&&s.jsxs("div",{className:"bg-white dark:bg-card border border-amber-200 dark:border-amber-800 rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ar,{className:"h-4 w-4 text-amber-600 shrink-0"}),s.jsx("span",{className:"text-sm font-medium",children:"Pending access requests"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Waiting for admin approval. You'll be redirected automatically once approved."}),s.jsx("div",{className:"space-y-2",children:i.map(I=>s.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md bg-amber-50 dark:bg-amber-950/20 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx(El,{className:"h-3.5 w-3.5 text-amber-600 shrink-0"}),s.jsx("span",{className:"text-sm font-medium truncate",children:I.workspace_name??I.workspace_id})]}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-muted-foreground hover:text-destructive shrink-0",disabled:o.isPending,onClick:()=>D(I.workspace_id,I.id,I.workspace_name),title:"Cancel request",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]},I.id))})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ot,{className:"h-4 w-4 text-indigo-600"}),s.jsx("span",{className:"text-sm font-medium",children:"Create a new workspace"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Start fresh with your own workspace. You'll be the admin."}),s.jsx(ee,{size:"sm",className:"w-full",onClick:()=>n("/setup"),children:"Create workspace"})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(za,{className:"h-4 w-4 text-muted-foreground"}),s.jsx("span",{className:"text-sm font-medium",children:"Join an existing workspace"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Search for a public workspace and request access."}),s.jsxs("div",{className:"relative",children:[s.jsx(_e,{ref:k,placeholder:"Search workspaces...",value:d,onChange:O,onFocus:()=>m(!0),className:"bg-white dark:bg-card h-9 text-sm"}),f&&_.length>0&&s.jsx("div",{ref:w,className:"absolute z-50 mt-1 w-full bg-white dark:bg-card border border-border rounded-md shadow-md overflow-hidden max-h-48 overflow-y-auto",children:_.map(I=>s.jsxs("button",{type:"button",className:z("w-full flex items-center justify-between px-3 py-2 text-sm hover:bg-accent text-left",(p==null?void 0:p.id)===I.id&&"bg-accent"),onClick:()=>P(I),children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx(El,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:"truncate",children:I.name})]}),I.is_member&&s.jsx("span",{className:"text-xs text-emerald-600 shrink-0 ml-2",children:"Member"}),!I.is_member&&I.has_pending_request&&s.jsx("span",{className:"text-xs text-amber-600 shrink-0 ml-2",children:"Pending"}),!I.is_member&&!I.has_pending_request&&s.jsx(pr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 ml-2"})]},I.id))})]}),p&&p.is_member&&s.jsx("div",{className:"pt-1",children:s.jsxs("p",{className:"text-xs text-emerald-600 flex items-center gap-1.5",children:[s.jsx(kn,{className:"h-3.5 w-3.5"}),"You're already a member of this workspace."]})}),(g||p&&p.has_pending_request)&&s.jsxs("div",{className:"flex items-center gap-2 text-sm text-amber-600 pt-1",children:[s.jsx(Ar,{className:"h-4 w-4 shrink-0"}),s.jsx("span",{children:"Request sent! Waiting for admin approval."})]})]}),s.jsx(ee,{variant:"ghost",className:"w-full text-muted-foreground",onClick:t,children:"Sign out"})]}),s.jsx(mn,{open:!!y,onOpenChange:I=>{I||b(null)},children:s.jsxs(Zr,{className:"max-w-sm",children:[s.jsx(hn,{children:s.jsxs(pn,{children:["Request access to ",y==null?void 0:y.name,"?"]})}),s.jsxs("div",{className:"space-y-3 py-1",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"A request will be sent to the workspace admins. You'll be notified once it's approved."}),s.jsx(_e,{placeholder:"Optional message to admins...",value:N,onChange:I=>j(I.target.value),className:"h-9 text-sm"})]}),s.jsxs(Oo,{children:[s.jsx(ee,{variant:"outline",size:"sm",onClick:()=>b(null),children:"Cancel"}),s.jsx(ee,{size:"sm",disabled:C.isPending,onClick:E,children:C.isPending?"Sending...":"Send request"})]})]})})]})}function J3(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 XN=W.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}),mc=()=>{const e=W.useContext(XN);if(!e)throw new Error("useDrawerContext must be used within a Drawer.Root");return e};J3(`[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(
585
+ [data-state=closed]
586
+ ){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 eI(){const e=navigator.userAgent;return typeof window<"u"&&(/Firefox/.test(e)&&/Mobile/.test(e)||/FxiOS/.test(e))}function tI(){return Ex(/^Mac/)}function rI(){return Ex(/^iPhone/)}function ky(){return/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}function nI(){return Ex(/^iPad/)||tI()&&navigator.maxTouchPoints>1}function QN(){return rI()||nI()}function Ex(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.platform):void 0}const sI=24,aI=typeof window<"u"?h.useLayoutEffect:h.useEffect;function Sy(...e){return(...t)=>{for(let r of e)typeof r=="function"&&r(...t)}}const Tm=typeof document<"u"&&window.visualViewport;function Cy(e){let t=window.getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowX+t.overflowY)}function ZN(e){for(Cy(e)&&(e=e.parentElement);e&&!Cy(e);)e=e.parentElement;return e||document.scrollingElement||document.documentElement}const iI=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);let Hc=0,Im;function oI(e={}){let{isDisabled:t}=e;aI(()=>{if(!t)return Hc++,Hc===1&&QN()&&(Im=lI()),()=>{Hc--,Hc===0&&(Im==null||Im())}},[t])}function lI(){let e,t=0,r=f=>{e=ZN(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)},a=f=>{let m=f.target;Lh(m)&&m!==document.activeElement&&(f.preventDefault(),m.style.transform="translateY(-2000px)",m.focus(),requestAnimationFrame(()=>{m.style.transform=""}))},i=f=>{let m=f.target;Lh(m)&&(m.style.transform="translateY(-2000px)",requestAnimationFrame(()=>{m.style.transform="",Tm&&(Tm.height<window.innerHeight?requestAnimationFrame(()=>{_y(m)}):Tm.addEventListener("resize",()=>_y(m),{once:!0}))}))},o=()=>{window.scrollTo(0,0)},l=window.pageXOffset,c=window.pageYOffset,d=Sy(cI(document.documentElement,"paddingRight",`${window.innerWidth-document.documentElement.clientWidth}px`));window.scrollTo(0,0);let u=Sy(nl(document,"touchstart",r,{passive:!1,capture:!0}),nl(document,"touchmove",n,{passive:!1,capture:!0}),nl(document,"touchend",a,{passive:!1,capture:!0}),nl(document,"focus",i,!0),nl(window,"scroll",o));return()=>{d(),u(),window.scrollTo(l,c)}}function cI(e,t,r){let n=e.style[t];return e.style[t]=r,()=>{e.style[t]=n}}function nl(e,t,r,n){return e.addEventListener(t,r,n),()=>{e.removeEventListener(t,r,n)}}function _y(e){let t=document.scrollingElement||document.documentElement;for(;e&&e!==t;){let r=ZN(e);if(r!==document.documentElement&&r!==document.body&&r!==e){let n=r.getBoundingClientRect().top,a=e.getBoundingClientRect().top,i=e.getBoundingClientRect().bottom;const o=r.getBoundingClientRect().bottom+sI;i>o&&(r.scrollTop+=a-n)}e=r.parentElement}}function Lh(e){return e instanceof HTMLInputElement&&!iI.has(e.type)||e instanceof HTMLTextAreaElement||e instanceof HTMLElement&&e.isContentEditable}function dI(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function uI(...e){return t=>e.forEach(r=>dI(r,t))}function JN(...e){return h.useCallback(uI(...e),e)}const ek=new WeakMap;function Wt(e,t,r=!1){if(!e||!(e instanceof HTMLElement))return;let n={};Object.entries(t).forEach(([a,i])=>{if(a.startsWith("--")){e.style.setProperty(a,i);return}n[a]=e.style[a],e.style[a]=i}),!r&&ek.set(e,n)}function fI(e,t){if(!e||!(e instanceof HTMLElement))return;let r=ek.get(e);r&&(e.style[t]=r[t])}const Lt=e=>{switch(e){case"top":case"bottom":return!0;case"left":case"right":return!1;default:return e}};function Kc(e,t){if(!e)return null;const r=window.getComputedStyle(e),n=r.transform||r.webkitTransform||r.mozTransform;let a=n.match(/^matrix3d\((.+)\)$/);return a?parseFloat(a[1].split(", ")[Lt(t)?13:12]):(a=n.match(/^matrix\((.+)\)$/),a?parseFloat(a[1].split(", ")[Lt(t)?5:4]):null)}function mI(e){return 8*(Math.log(e+1)-2)}function Rm(e,t){if(!e)return()=>{};const r=e.style.cssText;return Object.assign(e.style,t),()=>{e.style.cssText=r}}function hI(...e){return(...t)=>{for(const r of e)typeof r=="function"&&r(...t)}}const Nt={DURATION:.5,EASE:[.32,.72,0,1]},tk=.4,pI=.25,xI=100,rk=8,Ha=16,Fh=26,$m="vaul-dragging";function nk(e){const t=W.useRef(e);return W.useEffect(()=>{t.current=e}),W.useMemo(()=>(...r)=>t.current==null?void 0:t.current.call(t,...r),[])}function gI({defaultProp:e,onChange:t}){const r=W.useState(e),[n]=r,a=W.useRef(n),i=nk(t);return W.useEffect(()=>{a.current!==n&&(i(n),a.current=n)},[n,a,i]),r}function sk({prop:e,defaultProp:t,onChange:r=()=>{}}){const[n,a]=gI({defaultProp:t,onChange:r}),i=e!==void 0,o=i?e:n,l=nk(r),c=W.useCallback(d=>{if(i){const f=typeof d=="function"?d(e):d;f!==e&&l(f)}else a(d)},[i,e,a,l]);return[o,c]}function vI({activeSnapPointProp:e,setActiveSnapPointProp:t,snapPoints:r,drawerRef:n,overlayRef:a,fadeFromIndex:i,onSnapPointChange:o,direction:l="bottom",container:c,snapToSequentialPoint:d}){const[u,f]=sk({prop:e,defaultProp:r==null?void 0:r[0],onChange:t}),[m,p]=W.useState(typeof window<"u"?{innerWidth:window.innerWidth,innerHeight:window.innerHeight}:void 0);W.useEffect(()=>{function S(){p({innerWidth:window.innerWidth,innerHeight:window.innerHeight})}return window.addEventListener("resize",S),()=>window.removeEventListener("resize",S)},[]);const x=W.useMemo(()=>u===(r==null?void 0:r[r.length-1])||null,[r,u]),g=W.useMemo(()=>{var S;return(S=r==null?void 0:r.findIndex(_=>_===u))!=null?S:null},[r,u]),v=r&&r.length>0&&(i||i===0)&&!Number.isNaN(i)&&r[i]===u||!r,y=W.useMemo(()=>{const S=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(C=>{const P=typeof C=="string";let O=0;if(P&&(O=parseInt(C,10)),Lt(l)){const D=P?O:m?C*S.height:0;return m?l==="bottom"?S.height-D:-S.height+D:D}const E=P?O:m?C*S.width:0;return m?l==="right"?S.width-E:-S.width+E:E}))!=null?_:[]},[r,m,c]),b=W.useMemo(()=>g!==null?y==null?void 0:y[g]:null,[y,g]),N=W.useCallback(S=>{var _;const C=(_=y==null?void 0:y.findIndex(P=>P===S))!=null?_:null;o(C),Wt(n.current,{transition:`transform ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`,transform:Lt(l)?`translate3d(0, ${S}px, 0)`:`translate3d(${S}px, 0, 0)`}),y&&C!==y.length-1&&i!==void 0&&C!==i&&C<i?Wt(a.current,{transition:`opacity ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`,opacity:"0"}):Wt(a.current,{transition:`opacity ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`,opacity:"1"}),f(r==null?void 0:r[Math.max(C,0)])},[n.current,r,y,i,a,f]);W.useEffect(()=>{if(u||e){var S;const _=(S=r==null?void 0:r.findIndex(C=>C===e||C===u))!=null?S:-1;y&&_!==-1&&typeof y[_]=="number"&&N(y[_])}},[u,e,r,y,N]);function j({draggedDistance:S,closeDrawer:_,velocity:C,dismissible:P}){if(i===void 0)return;const O=l==="bottom"||l==="right"?(b??0)-S:(b??0)+S,E=g===i-1,D=g===0,I=S>0;if(E&&Wt(a.current,{transition:`opacity ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`}),!d&&C>2&&!I){P?_():N(y[0]);return}if(!d&&C>2&&I&&y&&r){N(y[r.length-1]);return}const V=y==null?void 0:y.reduce((q,re)=>typeof q!="number"||typeof re!="number"?q:Math.abs(re-O)<Math.abs(q-O)?re:q),Q=Lt(l)?window.innerHeight:window.innerWidth;if(C>tk&&Math.abs(S)<Q*.4){const q=I?1:-1;if(q>0&&x&&r){N(y[r.length-1]);return}if(D&&q<0&&P&&_(),g===null)return;N(y[g+q]);return}N(V)}function k({draggedDistance:S}){if(b===null)return;const _=l==="bottom"||l==="right"?b-S:b+S;(l==="bottom"||l==="right")&&_<y[y.length-1]||(l==="top"||l==="left")&&_>y[y.length-1]||Wt(n.current,{transform:Lt(l)?`translate3d(0, ${_}px, 0)`:`translate3d(${_}px, 0, 0)`})}function w(S,_){if(!r||typeof g!="number"||!y||i===void 0)return null;const C=g===i-1;if(g>=i&&_)return 0;if(C&&!_)return 1;if(!v&&!C)return null;const O=C?g+1:g-1,E=C?y[O]-y[O-1]:y[O+1]-y[O],D=S/Math.abs(E);return C?1-D:D}return{isLastSnapPoint:x,activeSnapPoint:u,shouldFade:v,getPercentageDragged:w,setActiveSnapPoint:f,activeSnapPointIndex:g,onRelease:j,onDrag:k,snapPointsOffset:y}}const yI=()=>()=>{};function bI(){const{direction:e,isOpen:t,shouldScaleBackground:r,setBackgroundColorOnScale:n,noBodyStyles:a}=mc(),i=W.useRef(null),o=h.useMemo(()=>document.body.style.backgroundColor,[]);function l(){return(window.innerWidth-Fh)/window.innerWidth}W.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;hI(n&&!a?Rm(document.body,{background:"black"}):yI,Rm(c,{transformOrigin:Lt(e)?"top":"left",transitionProperty:"transform, border-radius",transitionDuration:`${Nt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Nt.EASE.join(",")})`}));const d=Rm(c,{borderRadius:`${rk}px`,overflow:"hidden",...Lt(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")},Nt.DURATION*1e3)}}},[t,r,o])}let sl=null;function jI({isOpen:e,modal:t,nested:r,hasBeenOpened:n,preventScrollRestoration:a,noBodyStyles:i}){const[o,l]=W.useState(()=>typeof window<"u"?window.location.href:""),c=W.useRef(0),d=W.useCallback(()=>{if(ky()&&sl===null&&e&&!i){sl={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=W.useCallback(()=>{if(ky()&&sl!==null&&!i){const f=-parseInt(document.body.style.top,10),m=-parseInt(document.body.style.left,10);Object.assign(document.body.style,sl),window.requestAnimationFrame(()=>{if(a&&o!==window.location.href){l(window.location.href);return}window.scrollTo(m,f)}),sl=null}},[o]);return W.useEffect(()=>{function f(){c.current=window.scrollY}return f(),window.addEventListener("scroll",f),()=>{window.removeEventListener("scroll",f)}},[]),W.useEffect(()=>{if(t)return()=>{typeof document>"u"||document.querySelector("[data-vaul-drawer]")||u()}},[t,u]),W.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 wI({open:e,onOpenChange:t,children:r,onDrag:n,onRelease:a,snapPoints:i,shouldScaleBackground:o=!1,setBackgroundColorOnScale:l=!0,closeThreshold:c=pI,scrollLockTimeout:d=xI,dismissible:u=!0,handleOnly:f=!1,fadeFromIndex:m=i&&i.length-1,activeSnapPoint:p,setActiveSnapPoint:x,fixed:g,modal:v=!0,onClose:y,nested:b,noBodyStyles:N=!1,direction:j="bottom",defaultOpen:k=!1,disablePreventScroll:w=!0,snapToSequentialPoint:S=!1,preventScrollRestoration:_=!1,repositionInputs:C=!0,onAnimationEnd:P,container:O,autoFocus:E=!1}){var D,I;const[V=!1,Q]=sk({defaultProp:k,prop:e,onChange:Oe=>{t==null||t(Oe),!Oe&&!b&&Ze(),setTimeout(()=>{P==null||P(Oe)},Nt.DURATION*1e3),Oe&&!v&&typeof window<"u"&&window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"}),Oe||(document.body.style.pointerEvents="auto")}}),[q,re]=W.useState(!1),[se,T]=W.useState(!1),[M,L]=W.useState(!1),H=W.useRef(null),R=W.useRef(null),Y=W.useRef(null),J=W.useRef(null),A=W.useRef(null),U=W.useRef(!1),$=W.useRef(null),ne=W.useRef(0),B=W.useRef(!1),X=W.useRef(!k),oe=W.useRef(0),G=W.useRef(null),te=W.useRef(((D=G.current)==null?void 0:D.getBoundingClientRect().height)||0),de=W.useRef(((I=G.current)==null?void 0:I.getBoundingClientRect().width)||0),me=W.useRef(0),Z=W.useCallback(Oe=>{i&&Oe===Ge.length-1&&(R.current=new Date)},[]),{activeSnapPoint:xe,activeSnapPointIndex:be,setActiveSnapPoint:qe,onRelease:We,snapPointsOffset:Ge,onDrag:ft,shouldFade:et,getPercentageDragged:Ke}=vI({snapPoints:i,activeSnapPointProp:p,setActiveSnapPointProp:x,drawerRef:G,fadeFromIndex:m,overlayRef:H,onSnapPointChange:Z,direction:j,container:O,snapToSequentialPoint:S});oI({isDisabled:!V||se||!v||M||!q||!C||!w});const{restorePositionSetting:Ze}=jI({isOpen:V,modal:v,nested:b??!1,hasBeenOpened:q,preventScrollRestoration:_,noBodyStyles:N});function sr(){return(window.innerWidth-Fh)/window.innerWidth}function Lr(Oe){var ve,Ne;!u&&!i||G.current&&!G.current.contains(Oe.target)||(te.current=((ve=G.current)==null?void 0:ve.getBoundingClientRect().height)||0,de.current=((Ne=G.current)==null?void 0:Ne.getBoundingClientRect().width)||0,T(!0),Y.current=new Date,QN()&&window.addEventListener("touchend",()=>U.current=!1,{once:!0}),Oe.target.setPointerCapture(Oe.pointerId),ne.current=Lt(j)?Oe.pageY:Oe.pageX)}function ar(Oe,ve){var Ne;let pe=Oe;const je=(Ne=window.getSelection())==null?void 0:Ne.toString(),Xe=G.current?Kc(G.current,j):null,ue=new Date;if(pe.tagName==="SELECT"||pe.hasAttribute("data-vaul-no-drag")||pe.closest("[data-vaul-no-drag]"))return!1;if(j==="right"||j==="left")return!0;if(R.current&&ue.getTime()-R.current.getTime()<500)return!1;if(Xe!==null&&(j==="bottom"?Xe>0:Xe<0))return!0;if(je&&je.length>0)return!1;if(A.current&&ue.getTime()-A.current.getTime()<d&&Xe===0||ve)return A.current=ue,!1;for(;pe;){if(pe.scrollHeight>pe.clientHeight){if(pe.scrollTop!==0)return A.current=new Date,!1;if(pe.getAttribute("role")==="dialog")return!0}pe=pe.parentNode}return!0}function wr(Oe){if(G.current&&se){const ve=j==="bottom"||j==="right"?1:-1,Ne=(ne.current-(Lt(j)?Oe.pageY:Oe.pageX))*ve,pe=Ne>0,je=i&&!u&&!pe;if(je&&be===0)return;const Xe=Math.abs(Ne),ue=document.querySelector("[data-vaul-drawer-wrapper]"),Pe=j==="bottom"||j==="top"?te.current:de.current;let Ie=Xe/Pe;const wt=Ke(Xe,pe);if(wt!==null&&(Ie=wt),je&&Ie>=1||!U.current&&!ar(Oe.target,pe))return;if(G.current.classList.add($m),U.current=!0,Wt(G.current,{transition:"none"}),Wt(H.current,{transition:"none"}),i&&ft({draggedDistance:Ne}),pe&&!i){const st=mI(Ne),Nr=Math.min(st*-1,0)*ve;Wt(G.current,{transform:Lt(j)?`translate3d(0, ${Nr}px, 0)`:`translate3d(${Nr}px, 0, 0)`});return}const nt=1-Ie;if((et||m&&be===m-1)&&(n==null||n(Oe,Ie),Wt(H.current,{opacity:`${nt}`,transition:"none"},!0)),ue&&H.current&&o){const st=Math.min(sr()+Ie*(1-sr()),1),Nr=8-Ie*8,lr=Math.max(0,14-Ie*14);Wt(ue,{borderRadius:`${Nr}px`,transform:Lt(j)?`scale(${st}) translate3d(0, ${lr}px, 0)`:`scale(${st}) translate3d(${lr}px, 0, 0)`,transition:"none"},!0)}if(!i){const st=Xe*ve;Wt(G.current,{transform:Lt(j)?`translate3d(0, ${st}px, 0)`:`translate3d(${st}px, 0, 0)`})}}}W.useEffect(()=>{window.requestAnimationFrame(()=>{X.current=!0})},[]),W.useEffect(()=>{var Oe;function ve(){if(!G.current||!C)return;const Ne=document.activeElement;if(Lh(Ne)||B.current){var pe;const je=((pe=window.visualViewport)==null?void 0:pe.height)||0,Xe=window.innerHeight;let ue=Xe-je;const Pe=G.current.getBoundingClientRect().height||0,Ie=Pe>Xe*.8;me.current||(me.current=Pe);const wt=G.current.getBoundingClientRect().top;if(Math.abs(oe.current-ue)>60&&(B.current=!B.current),i&&i.length>0&&Ge&&be){const nt=Ge[be]||0;ue+=nt}if(oe.current=ue,Pe>je||B.current){const nt=G.current.getBoundingClientRect().height;let st=nt;nt>je&&(st=je-(Ie?wt:Fh)),g?G.current.style.height=`${nt-Math.max(ue,0)}px`:G.current.style.height=`${Math.max(st,je-wt)}px`}else eI()||(G.current.style.height=`${me.current}px`);i&&i.length>0&&!B.current?G.current.style.bottom="0px":G.current.style.bottom=`${Math.max(ue,0)}px`}}return(Oe=window.visualViewport)==null||Oe.addEventListener("resize",ve),()=>{var Ne;return(Ne=window.visualViewport)==null?void 0:Ne.removeEventListener("resize",ve)}},[be,i,Ge]);function ir(Oe){qt(),y==null||y(),Oe||Q(!1),setTimeout(()=>{i&&qe(i[0])},Nt.DURATION*1e3)}function jt(){if(!G.current)return;const Oe=document.querySelector("[data-vaul-drawer-wrapper]"),ve=Kc(G.current,j);Wt(G.current,{transform:"translate3d(0, 0, 0)",transition:`transform ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`}),Wt(H.current,{transition:`opacity ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`,opacity:"1"}),o&&ve&&ve>0&&V&&Wt(Oe,{borderRadius:`${rk}px`,overflow:"hidden",...Lt(j)?{transform:`scale(${sr()}) translate3d(0, calc(env(safe-area-inset-top) + 14px), 0)`,transformOrigin:"top"}:{transform:`scale(${sr()}) translate3d(calc(env(safe-area-inset-top) + 14px), 0, 0)`,transformOrigin:"left"},transitionProperty:"transform, border-radius",transitionDuration:`${Nt.DURATION}s`,transitionTimingFunction:`cubic-bezier(${Nt.EASE.join(",")})`},!0)}function qt(){!se||!G.current||(G.current.classList.remove($m),U.current=!1,T(!1),J.current=new Date)}function Vt(Oe){if(!se||!G.current)return;G.current.classList.remove($m),U.current=!1,T(!1),J.current=new Date;const ve=Kc(G.current,j);if(!Oe||!ar(Oe.target,!1)||!ve||Number.isNaN(ve)||Y.current===null)return;const Ne=J.current.getTime()-Y.current.getTime(),pe=ne.current-(Lt(j)?Oe.pageY:Oe.pageX),je=Math.abs(pe)/Ne;if(je>.05&&(L(!0),setTimeout(()=>{L(!1)},200)),i){We({draggedDistance:pe*(j==="bottom"||j==="right"?1:-1),closeDrawer:ir,velocity:je,dismissible:u}),a==null||a(Oe,!0);return}if(j==="bottom"||j==="right"?pe>0:pe<0){jt(),a==null||a(Oe,!0);return}if(je>tk){ir(),a==null||a(Oe,!1);return}var Xe;const ue=Math.min((Xe=G.current.getBoundingClientRect().height)!=null?Xe:0,window.innerHeight);var Pe;const Ie=Math.min((Pe=G.current.getBoundingClientRect().width)!=null?Pe:0,window.innerWidth),wt=j==="left"||j==="right";if(Math.abs(ve)>=(wt?Ie:ue)*c){ir(),a==null||a(Oe,!1);return}a==null||a(Oe,!0),jt()}W.useEffect(()=>(V&&(Wt(document.documentElement,{scrollBehavior:"auto"}),R.current=new Date),()=>{fI(document.documentElement,"scrollBehavior")}),[V]);function or(Oe){const ve=Oe?(window.innerWidth-Ha)/window.innerWidth:1,Ne=Oe?-Ha:0;$.current&&window.clearTimeout($.current),Wt(G.current,{transition:`transform ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`,transform:Lt(j)?`scale(${ve}) translate3d(0, ${Ne}px, 0)`:`scale(${ve}) translate3d(${Ne}px, 0, 0)`}),!Oe&&G.current&&($.current=setTimeout(()=>{const pe=Kc(G.current,j);Wt(G.current,{transition:"none",transform:Lt(j)?`translate3d(0, ${pe}px, 0)`:`translate3d(${pe}px, 0, 0)`})},500))}function Xn(Oe,ve){if(ve<0)return;const Ne=(window.innerWidth-Ha)/window.innerWidth,pe=Ne+ve*(1-Ne),je=-Ha+ve*Ha;Wt(G.current,{transform:Lt(j)?`scale(${pe}) translate3d(0, ${je}px, 0)`:`scale(${pe}) translate3d(${je}px, 0, 0)`,transition:"none"})}function bs(Oe,ve){const Ne=Lt(j)?window.innerHeight:window.innerWidth,pe=ve?(Ne-Ha)/Ne:1,je=ve?-Ha:0;ve&&Wt(G.current,{transition:`transform ${Nt.DURATION}s cubic-bezier(${Nt.EASE.join(",")})`,transform:Lt(j)?`scale(${pe}) translate3d(0, ${je}px, 0)`:`scale(${pe}) translate3d(${je}px, 0, 0)`})}return W.useEffect(()=>{v||window.requestAnimationFrame(()=>{document.body.style.pointerEvents="auto"})},[v]),W.createElement(rc,{defaultOpen:k,onOpenChange:Oe=>{!u&&!Oe||(Oe?re(!0):ir(!0),Q(Oe))},open:V},W.createElement(XN.Provider,{value:{activeSnapPoint:xe,snapPoints:i,setActiveSnapPoint:qe,drawerRef:G,overlayRef:H,onOpenChange:t,onPress:Lr,onRelease:Vt,onDrag:wr,dismissible:u,shouldAnimate:X,handleOnly:f,isOpen:V,isDragging:se,shouldFade:et,closeDrawer:ir,onNestedDrag:Xn,onNestedOpenChange:or,onNestedRelease:bs,keyboardIsOpen:B,modal:v,snapPointsOffset:Ge,activeSnapPointIndex:be,direction:j,shouldScaleBackground:o,setBackgroundColorOnScale:l,noBodyStyles:N,container:O,autoFocus:E}},r))}const ak=W.forwardRef(function({...e},t){const{overlayRef:r,snapPoints:n,onRelease:a,shouldFade:i,isOpen:o,modal:l,shouldAnimate:c}=mc(),d=JN(t,r),u=n&&n.length>0;if(!l)return null;const f=W.useCallback(m=>a(m),[a]);return W.createElement(Si,{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})});ak.displayName="Drawer.Overlay";const ik=W.forwardRef(function({onPointerDownOutside:e,style:t,onOpenAutoFocus:r,...n},a){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:b,autoFocus:N}=mc(),[j,k]=W.useState(!1),w=JN(a,i),S=W.useRef(null),_=W.useRef(null),C=W.useRef(!1),P=g&&g.length>0;bI();const O=(D,I,V=0)=>{if(C.current)return!0;const Q=Math.abs(D.y),q=Math.abs(D.x),re=q>Q,se=["bottom","right"].includes(I)?1:-1;if(I==="left"||I==="right"){if(!(D.x*se<0)&&q>=0&&q<=V)return re}else if(!(D.y*se<0)&&Q>=0&&Q<=V)return!re;return C.current=!0,!0};W.useEffect(()=>{P&&window.requestAnimationFrame(()=>{k(!0)})},[]);function E(D){S.current=null,C.current=!1,l(D)}return W.createElement(Ci,{"data-vaul-drawer-direction":x,"data-vaul-drawer":"","data-vaul-delayed-snap-points":j?"true":"false","data-vaul-snap-points":p&&P?"true":"false","data-vaul-custom-container":v?"true":"false","data-vaul-animate":b!=null&&b.current?"true":"false",...n,ref:w,style:u&&u.length>0?{"--snap-point-height":`${u[f??0]}px`,...t}:t,onPointerDown:D=>{y||(n.onPointerDown==null||n.onPointerDown.call(n,D),S.current={x:D.pageX,y:D.pageY},o(D))},onOpenAutoFocus:D=>{r==null||r(D),N||D.preventDefault()},onPointerDownOutside:D=>{if(e==null||e(D),!m||D.defaultPrevented){D.preventDefault();return}d.current&&(d.current=!1)},onFocusOutside:D=>{if(!m){D.preventDefault();return}},onPointerMove:D=>{if(_.current=D,y||(n.onPointerMove==null||n.onPointerMove.call(n,D),!S.current))return;const I=D.pageY-S.current.y,V=D.pageX-S.current.x,Q=D.pointerType==="touch"?10:2;O({x:V,y:I},x,Q)?c(D):(Math.abs(V)>Q||Math.abs(I)>Q)&&(S.current=null)},onPointerUp:D=>{n.onPointerUp==null||n.onPointerUp.call(n,D),S.current=null,C.current=!1,l(D)},onPointerOut:D=>{n.onPointerOut==null||n.onPointerOut.call(n,D),E(_.current)},onContextMenu:D=>{n.onContextMenu==null||n.onContextMenu.call(n,D),_.current&&E(_.current)}})});ik.displayName="Drawer.Content";const NI=250,kI=120,SI=W.forwardRef(function({preventCycle:e=!1,children:t,...r},n){const{closeDrawer:a,isDragging:i,snapPoints:o,activeSnapPoint:l,setActiveSnapPoint:c,dismissible:d,handleOnly:u,isOpen:f,onPress:m,onDrag:p}=mc(),x=W.useRef(null),g=W.useRef(!1);function v(){if(g.current){N();return}window.setTimeout(()=>{y()},kI)}function y(){if(i||e||g.current){N();return}if(N(),!o||o.length===0){d||a();return}if(l===o[o.length-1]&&d){a();return}const k=o.findIndex(S=>S===l);if(k===-1)return;const w=o[k+1];c(w)}function b(){x.current=window.setTimeout(()=>{g.current=!0},NI)}function N(){x.current&&window.clearTimeout(x.current),g.current=!1}return W.createElement("div",{onClick:v,onPointerCancel:N,onPointerDown:j=>{u&&m(j),b()},onPointerMove:j=>{u&&p(j)},ref:n,"data-vaul-drawer-visible":f?"true":"false","data-vaul-handle":"","aria-hidden":"true",...r},W.createElement("span",{"data-vaul-handle-hitarea":"","aria-hidden":"true"},t))});SI.displayName="Drawer.Handle";function CI(e){const t=mc(),{container:r=t.container,...n}=e;return W.createElement(tc,{container:r,...n})}const ta={Root:wI,Content:ik,Overlay:ak,Portal:CI,Title:No,Description:ko},Oi=({shouldScaleBackground:e=!1,direction:t="right",...r})=>s.jsx(ta.Root,{shouldScaleBackground:e,direction:t,...r});Oi.displayName="Drawer";const _I=ta.Portal,ok=h.forwardRef(({className:e,...t},r)=>s.jsx(ta.Overlay,{ref:r,className:z("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}));ok.displayName=ta.Overlay.displayName;const Ei=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(_I,{children:[s.jsx(ok,{}),s.jsx(ta.Content,{ref:n,className:z("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})]}));Ei.displayName="DrawerContent";const Do=({className:e,...t})=>s.jsx("div",{className:z("flex flex-col space-y-1.5 px-6 pt-6 pb-4 border-b border-border shrink-0",e),...t});Do.displayName="DrawerHeader";const To=({className:e,...t})=>s.jsx("div",{className:z("flex-1 overflow-y-auto px-6 py-4",e),...t});To.displayName="DrawerBody";const hc=({className:e,...t})=>s.jsx("div",{className:z("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});hc.displayName="DrawerFooter";const Io=h.forwardRef(({className:e,...t},r)=>s.jsx(ta.Title,{ref:r,className:z("text-base font-semibold text-foreground",e),...t}));Io.displayName=ta.Title.displayName;const PI=h.forwardRef(({className:e,...t},r)=>s.jsx(ta.Description,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));PI.displayName=ta.Description.displayName;const MI=sc("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),at=h.forwardRef(({className:e,...t},r)=>s.jsx(u1,{ref:r,className:z(MI(),e),...t}));at.displayName=u1.displayName;const pc=h.forwardRef(({className:e,...t},r)=>s.jsx("textarea",{className:z("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}));pc.displayName="Textarea";const Py=[{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}],zm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"];function OI(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_+|_+$/g,"")}function EI({chip:e,onRemove:t}){const{attributes:r,listeners:n,setNodeRef:a,transform:i,transition:o,isDragging:l}=sx({id:e.key});return s.jsxs("div",{ref:a,style:{transform:ax.Transform.toString(i),transition:o},className:z("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:[s.jsx("span",{...r,...n,className:"text-muted-foreground/50 hover:text-muted-foreground cursor-grab touch-none",children:s.jsx(aN,{className:"h-3 w-3"})}),s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e.color}}),s.jsx("span",{className:"text-[11px]",children:e.name}),s.jsx("button",{type:"button",onClick:t,className:"ml-0.5 text-muted-foreground/50 hover:text-muted-foreground transition-colors",children:s.jsx(Be,{className:"h-3 w-3"})})]})}const AI=3;function DI({open:e,onClose:t}){var V;const[r,n]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),[u,f]=h.useState(!1),[m,p]=h.useState(Py),[x,g]=h.useState(""),[v,y]=h.useState(zm[2]),{workspace:b}=De(),N=pT(),j=mT(r,{enabled:e}),k=hT(a,{enabled:e});h.useEffect(()=>{e&&j.data&&!c&&i(j.data)},[e,j.data,c]);const w=k.available===!1||N.isError&&((V=N.error)==null?void 0:V.status)===409,S=a.trim().length>=AI&&/^[A-Z0-9]+$/i.test(a.trim()),_=_1(rx(P1,{activationConstraint:{distance:5}})),C=Q=>{n(Q)},P=()=>{r.trim()&&!c&&j.flush()},O=()=>{n(""),i(""),l(""),d(!1),f(!1),p(Py),g(""),y(zm[2]),N.reset(),t()},E=()=>{if(!x.trim())return;const Q=OI(x.trim());if(m.some(q=>q.key===Q)){F.error("A status with this name already exists");return}p(q=>[...q,{name:x.trim(),key:Q,color:v,category:"started",position:q.length}]),g("")},D=Q=>{const{active:q,over:re}=Q;!re||q.id===re.id||p(se=>{const T=se.findIndex(L=>L.key===q.id),M=se.findIndex(L=>L.key===re.id);return wd(se,T,M).map((L,H)=>({...L,position:H}))})},I=Q=>{Q.preventDefault(),!(!r.trim()||!a.trim()||!S||w)&&N.mutate({name:r.trim(),identifier:a.trim().toUpperCase(),description:o.trim()||void 0,workspace_id:b.id,initial_statuses:m},{onSuccess:()=>{F.success("Project created"),O()},onError:q=>{(q==null?void 0:q.status)===409?F.error("This project key is already in use."):F.error(q.message??"Failed to create project")}})};return s.jsx(Oi,{open:e,onOpenChange:Q=>!Q&&O(),dismissible:!1,children:s.jsxs(Ei,{className:"max-w-md",children:[s.jsx(Do,{children:s.jsx(Io,{children:"New project"})}),s.jsxs("form",{onSubmit:I,className:"flex flex-col flex-1 overflow-hidden",children:[s.jsxs(To,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{htmlFor:"project-name",children:"Name"}),s.jsx(_e,{id:"project-name",placeholder:"My Project",value:r,onChange:Q=>C(Q.target.value),onBlur:P,autoFocus:!0}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Project key below will auto-fill when you finish typing; you can change it."})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{htmlFor:"project-id",children:["Identifier",s.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Used as issue prefix (e.g. PROJ-1)"})]}),s.jsx(_e,{id:"project-id",placeholder:"PROJ",value:a,onChange:Q=>{i(Q.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")),d(!0)},maxLength:5,className:z("font-mono",w&&"border-destructive"),"aria-invalid":w}),w&&s.jsx("p",{className:"text-xs text-destructive",children:"This project key is already in use."})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{htmlFor:"project-desc",children:["Description",s.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsx(pc,{id:"project-desc",placeholder:"What is this project about?",value:o,onChange:Q=>l(Q.target.value),className:"min-h-[80px]"})]}),s.jsxs("div",{className:"border border-border rounded-lg overflow-hidden",children:[s.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:s.jsxs("span",{className:"flex items-center gap-1.5",children:[u?s.jsx(Zs,{className:"h-3.5 w-3.5"}):s.jsx(pr,{className:"h-3.5 w-3.5"}),"Statuses",s.jsxs("span",{className:"text-muted-foreground font-normal",children:["(",m.length,")"]})]})}),u&&s.jsxs("div",{className:"px-3 pb-3 border-t border-border space-y-3 pt-3",children:[s.jsx(_l,{sensors:_,onDragEnd:D,children:s.jsx(nx,{items:m.map(Q=>Q.key),strategy:M1,children:s.jsx("div",{className:"flex flex-wrap gap-1.5",children:m.map(Q=>s.jsx(EI,{chip:Q,onRemove:()=>p(q=>q.filter(re=>re.key!==Q.key).map((re,se)=>({...re,position:se})))},Q.key))})})}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:zm.map(Q=>s.jsx("button",{type:"button",onClick:()=>y(Q),className:z("h-4 w-4 rounded-full border-2 transition-transform hover:scale-110",v===Q?"border-foreground scale-110":"border-transparent"),style:{backgroundColor:Q}},Q))}),s.jsxs("div",{className:"flex items-center gap-1.5 flex-1",children:[s.jsx(_e,{placeholder:"Status name…",value:x,onChange:Q=>g(Q.target.value),onKeyDown:Q=>{Q.key==="Enter"&&(Q.preventDefault(),E())},className:"h-7 text-xs flex-1"}),s.jsx(ee,{type:"button",size:"icon",variant:"ghost",className:"h-7 w-7 shrink-0",onClick:E,disabled:!x.trim(),children:s.jsx(ot,{className:"h-3.5 w-3.5"})})]})]})]})]})]}),s.jsxs(hc,{children:[s.jsx(ee,{type:"button",variant:"ghost",onClick:O,children:"Cancel"}),s.jsx(ee,{type:"submit",disabled:!r.trim()||!a.trim()||!S||w||N.isPending,children:N.isPending?"Creating...":"Create project"})]})]})]})})}const Tt=CE,It=_E,_t=h.forwardRef(({className:e,align:t="center",sideOffset:r=4,...n},a)=>s.jsx(SE,{children:s.jsx(f1,{ref:a,align:t,sideOffset:r,className:z("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=f1.displayName;function Is({options:e,selected:t,onSelectionChange:r,placeholder:n="Select…",className:a}){var d;const[i,o]=h.useState(!1);function l(u){t.includes(u)?r(t.filter(f=>f!==u)):r([...t,u])}const c=t.length===0?null:t.length===1?(d=e.find(u=>u.value===t[0]))==null?void 0:d.label:`${t.length} selected`;return s.jsxs(Tt,{open:i,onOpenChange:o,children:[s.jsx(It,{asChild:!0,children:s.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":i,className:z("h-8 justify-between text-xs font-normal min-w-36",!c&&"text-muted-foreground",a),children:[s.jsx("span",{className:"truncate",children:c??n}),s.jsx(_o,{className:"ml-2 h-3.5 w-3.5 shrink-0 opacity-50"})]})}),s.jsxs(_t,{className:"w-56 p-0",align:"start",children:[s.jsxs(ya,{children:[s.jsx(dc,{placeholder:"Search…",className:"h-8 text-xs"}),s.jsxs(ba,{children:[s.jsx(uc,{className:"text-xs py-4 text-center text-muted-foreground",children:"No results."}),s.jsx(Ts,{children:e.map(u=>s.jsxs(an,{value:u.label,onSelect:()=>l(u.value),className:"text-xs cursor-pointer",children:[s.jsx(Ct,{className:z("mr-2 h-3.5 w-3.5",t.includes(u.value)?"opacity-100":"opacity-0")}),u.label]},u.value))})]})]}),t.length>0&&s.jsx("div",{className:"border-t p-2",children:s.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs text-muted-foreground",onClick:()=>r([]),children:[s.jsx(Be,{className:"h-3 w-3 mr-1"}),"Clear all"]})})]})]})}function TI({open:e,onClose:t,projectId:r,projectName:n}){const{workspace:a}=De(),i=(a==null?void 0:a.id)??"",{data:o,isLoading:l}=Yn(r),{data:c}=Sx(r),{data:d}=Po(i),{data:u}=Qu(i),f=ON(r),m=EN(r),p=AN(r),x=DN(r),g=TN(r),v=(c==null?void 0:c.requests)??[],[y,b]=h.useState([]),[N,j]=h.useState([]),k=new Set((o==null?void 0:o.members.map(C=>C.user_id))??[]),w=new Set((o==null?void 0:o.teams.map(C=>C.team_id))??[]),S=(d??[]).filter(C=>!k.has(C.user_id)),_=(u??[]).filter(C=>!w.has(C.id));return s.jsx(mn,{open:e,onOpenChange:C=>!C&&t(),children:s.jsxs(Zr,{className:"sm:max-w-[480px]",children:[s.jsx(hn,{children:s.jsxs(pn,{className:"flex items-center gap-2",children:["Access — ",n,v.length>0&&s.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white",children:v.length})]})}),s.jsxs("div",{className:"space-y-5 pt-1",children:[v.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:"Requests"}),s.jsx("div",{className:"space-y-1",children:v.map(C=>{var D,I,V;const P=C.user,O=P?`${P.first_name??""} ${P.last_name??""}`.trim()||P.email:"Unknown",E=(((D=P==null?void 0:P.first_name)==null?void 0:D[0])??((I=P==null?void 0:P.last_name)==null?void 0:I[0])??((V=P==null?void 0:P.email)==null?void 0:V[0])??"U").toUpperCase();return s.jsxs("div",{className:"flex items-center gap-2.5 py-1",children:[s.jsx(Pt,{className:"h-7 w-7 shrink-0",children:s.jsx(Mt,{className:"text-[11px] font-medium",children:E})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm truncate",children:O}),C.message&&s.jsx("p",{className:"text-xs text-muted-foreground italic truncate",children:C.message})]}),s.jsx("button",{className:"h-6 px-2 text-xs rounded border border-border hover:bg-muted text-muted-foreground shrink-0",onClick:()=>g.mutate({requestId:C.id,action:"deny"},{onSuccess:()=>F.success("Request denied"),onError:()=>F.error("Failed")}),children:"Deny"}),s.jsxs("button",{className:"h-6 px-2 text-xs rounded bg-foreground text-background hover:opacity-90 shrink-0 flex items-center gap-1",onClick:()=>g.mutate({requestId:C.id,action:"approve"},{onSuccess:()=>F.success("Access granted"),onError:()=>F.error("Failed")}),children:[s.jsx(Ct,{className:"h-3 w-3"}),"Approve"]})]},C.id)})})]}),s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center justify-between mb-2",children:s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),l?s.jsx("div",{className:"space-y-2",children:[1,2].map(C=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{className:"h-7 w-7 rounded-full"}),s.jsx(le,{className:"h-3.5 w-32"})]},C))}):(o==null?void 0:o.members.length)===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No individual members."}):s.jsx("div",{className:"space-y-1",children:o==null?void 0:o.members.map(C=>{var V;const P=C.user,O=(P==null?void 0:P.first_name)??"",E=(P==null?void 0:P.last_name)??"",D=`${O} ${E}`.trim()||(P==null?void 0:P.email)||"Unknown",I=(O[0]??E[0]??((V=P==null?void 0:P.email)==null?void 0:V[0])??"U").toUpperCase();return s.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[s.jsx(Pt,{className:"h-7 w-7 shrink-0",children:s.jsx(Mt,{className:"text-[11px] font-medium",children:I})}),s.jsx("span",{className:"flex-1 text-sm truncate",children:D}),s.jsx("span",{className:z("text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",C.role==="manager"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:C.role}),s.jsx("button",{onClick:()=>m.mutate(C.user_id,{onSuccess:()=>F.success("Access removed"),onError:()=>F.error("Failed to remove")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]},C.id)})}),S.length>0&&s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsx(Nn,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx(Is,{options:S.map(C=>{const P=C.user,O=(P==null?void 0:P.first_name)??"",E=(P==null?void 0:P.last_name)??"";return{value:C.user_id,label:`${O} ${E}`.trim()||(P==null?void 0:P.email)||"Unknown"}}),selected:y,onSelectionChange:b,placeholder:"Add people…",className:"flex-1"}),y.length>0&&s.jsx(ee,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:f.isPending,onClick:()=>f.mutate({userIds:y},{onSuccess:C=>{F.success(`${C.added} member${C.added===1?"":"s"} added`),b([])},onError:()=>F.error("Failed to grant access")}),children:y.length===1?"Add":`Add ${y.length} members`})]})]}),s.jsxs("div",{children:[s.jsx("div",{className:"flex items-center justify-between mb-2",children:s.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),l?s.jsx("div",{className:"space-y-2",children:[1].map(C=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{className:"h-7 w-7 rounded-lg"}),s.jsx(le,{className:"h-3.5 w-28"})]},C))}):(o==null?void 0:o.teams.length)===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No teams have access."}):s.jsx("div",{className:"space-y-1",children:o==null?void 0:o.teams.map(C=>{const P=C.team;return s.jsxs("div",{className:"flex items-center gap-2.5 py-1 group",children:[s.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:s.jsx(Aa,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsx("span",{className:"flex-1 text-sm truncate",children:(P==null?void 0:P.name)??"Unknown team"}),P&&s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[P.member_count," ",P.member_count===1?"member":"members"]}),s.jsx("button",{onClick:()=>x.mutate(C.team_id,{onSuccess:()=>F.success("Team access removed"),onError:()=>F.error("Failed to remove team")}),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]},C.id)})}),_.length>0&&s.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[s.jsx(Aa,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx(Is,{options:_.map(C=>({value:C.id,label:C.name})),selected:N,onSelectionChange:j,placeholder:"Add teams…",className:"flex-1"}),N.length>0&&s.jsx(ee,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:p.isPending,onClick:()=>p.mutate(N,{onSuccess:C=>{F.success(`${C.added} team${C.added===1?"":"s"} added`),j([])},onError:()=>F.error("Failed to add teams")}),children:N.length===1?"Add":`Add ${N.length} teams`})]})]}),s.jsx("div",{className:"flex justify-end pt-1",children:s.jsx(ee,{variant:"outline",size:"sm",onClick:t,children:"Close"})})]})]})})}const Ue=DE,Ve=TE,Le=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(m1,{ref:n,className:z("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,s.jsx(PE,{asChild:!0,children:s.jsx(Zs,{className:"h-4 w-4 opacity-50"})})]}));Le.displayName=m1.displayName;const lk=h.forwardRef(({className:e,...t},r)=>s.jsx(h1,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(dx,{className:"h-4 w-4"})}));lk.displayName=h1.displayName;const ck=h.forwardRef(({className:e,...t},r)=>s.jsx(p1,{ref:r,className:z("flex cursor-default items-center justify-center py-1",e),...t,children:s.jsx(Zs,{className:"h-4 w-4"})}));ck.displayName=p1.displayName;const Fe=h.forwardRef(({className:e,children:t,position:r="popper",...n},a)=>s.jsx(ME,{children:s.jsxs(x1,{ref:a,className:z("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:[s.jsx(lk,{}),s.jsx(OE,{className:z("p-1",r==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),s.jsx(ck,{})]})}));Fe.displayName=x1.displayName;const II=h.forwardRef(({className:e,...t},r)=>s.jsx(g1,{ref:r,className:z("px-2 py-1.5 text-xs font-medium text-muted-foreground",e),...t}));II.displayName=g1.displayName;const ke=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(v1,{ref:n,className:z("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:[s.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(EE,{children:s.jsx(Ct,{className:"h-4 w-4"})})}),s.jsx(AE,{children:t})]}));ke.displayName=v1.displayName;const RI=h.forwardRef(({className:e,...t},r)=>s.jsx(y1,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));RI.displayName=y1.displayName;function $I(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 s.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 a=()=>{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 a.scopeName=e,[n,zI(a,...t)]}function zI(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.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 LI(e){const t=FI(e),r=h.forwardRef((n,a)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(qI);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 s.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return s.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function FI(e){const t=h.forwardRef((r,n)=>{const{children:a,...i}=r;if(h.isValidElement(a)){const o=UI(a),l=WI(i,a.props);return a.type!==h.Fragment&&(l.ref=n?tx(n,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var BI=Symbol("radix.slottable");function qI(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===BI}function WI(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function UI(e){var n,a;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=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var HI=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Ax=HI.reduce((e,t)=>{const r=LI(`Primitive.${t}`),n=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),uf="Checkbox",[KI]=$I(uf),[YI,Dx]=KI(uf);function GI(e){const{__scopeCheckbox:t,checked:r,children:n,defaultChecked:a,disabled:i,form:o,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:f}=e,[m,p]=b1({prop:r,defaultProp:a??!1,onChange:c,caller:uf}),[x,g]=h.useState(null),[v,y]=h.useState(null),b=h.useRef(!1),N=x?!!o||!!x.closest("form"):!0,j={checked:m,disabled:i,setChecked:p,control:x,setControl:g,name:l,form:o,value:u,hasConsumerStoppedPropagationRef:b,required:d,defaultChecked:ja(a)?!1:a,isFormControl:N,bubbleInput:v,setBubbleInput:y};return s.jsx(YI,{scope:t,...j,children:VI(f)?f(j):n})}var dk="CheckboxTrigger",uk=h.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:r,...n},a)=>{const{control:i,value:o,disabled:l,checked:c,required:d,setControl:u,setChecked:f,hasConsumerStoppedPropagationRef:m,isFormControl:p,bubbleInput:x}=Dx(dk,e),g=So(a,u),v=h.useRef(c);return h.useEffect(()=>{const y=i==null?void 0:i.form;if(y){const b=()=>f(v.current);return y.addEventListener("reset",b),()=>y.removeEventListener("reset",b)}},[i,f]),s.jsx(Ax.button,{type:"button",role:"checkbox","aria-checked":ja(c)?"mixed":c,"aria-required":d,"data-state":xk(c),"data-disabled":l?"":void 0,disabled:l,value:o,...n,ref:g,onKeyDown:Cs(t,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:Cs(r,y=>{f(b=>ja(b)?!0:!b),x&&p&&(m.current=y.isPropagationStopped(),m.current||y.stopPropagation())})})});uk.displayName=dk;var Tx=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,name:n,checked:a,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:d,form:u,...f}=e;return s.jsx(GI,{__scopeCheckbox:r,checked:a,defaultChecked:i,disabled:l,required:o,onCheckedChange:d,name:n,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>s.jsxs(s.Fragment,{children:[s.jsx(uk,{...f,ref:t,__scopeCheckbox:r}),m&&s.jsx(pk,{__scopeCheckbox:r})]})})});Tx.displayName=uf;var fk="CheckboxIndicator",mk=h.forwardRef((e,t)=>{const{__scopeCheckbox:r,forceMount:n,...a}=e,i=Dx(fk,r);return s.jsx(IE,{present:n||ja(i.checked)||i.checked===!0,children:s.jsx(Ax.span,{"data-state":xk(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});mk.displayName=fk;var hk="CheckboxBubbleInput",pk=h.forwardRef(({__scopeCheckbox:e,...t},r)=>{const{control:n,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:o,required:l,disabled:c,name:d,value:u,form:f,bubbleInput:m,setBubbleInput:p}=Dx(hk,e),x=So(r,p),g=j1(i),v=w1(n);h.useEffect(()=>{const b=m;if(!b)return;const N=window.HTMLInputElement.prototype,k=Object.getOwnPropertyDescriptor(N,"checked").set,w=!a.current;if(g!==i&&k){const S=new Event("click",{bubbles:w});b.indeterminate=ja(i),k.call(b,ja(i)?!1:i),b.dispatchEvent(S)}},[m,g,i,a]);const y=h.useRef(ja(i)?!1:i);return s.jsx(Ax.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??y.current,required:l,disabled:c,name:d,value:u,form:f,...t,tabIndex:-1,ref:x,style:{...t.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});pk.displayName=hk;function VI(e){return typeof e=="function"}function ja(e){return e==="indeterminate"}function xk(e){return ja(e)?"indeterminate":e?"checked":"unchecked"}const gk=h.forwardRef(({className:e,...t},r)=>s.jsx(Tx,{ref:r,className:z("peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",e),...t,children:s.jsx(mk,{className:z("flex items-center justify-center text-current"),children:s.jsx(Ct,{className:"h-4 w-4"})})}));gk.displayName=Tx.displayName;function XI({open:e,onClose:t,projectId:r,projectName:n,currentWorkspaceId:a}){const[i,o]=h.useState("workspace"),[l,c]=h.useState(""),[d,u]=h.useState(new Set),{data:f,isLoading:m}=Cn(),{data:p,isLoading:x}=Yn(r),g=bT(r),v=(f??[]).filter(j=>j.id!==a),y=v.find(j=>j.id===l);h.useEffect(()=>{i==="members"&&(p!=null&&p.members)&&u(new Set(p.members.map(j=>j.user_id)))},[i,p==null?void 0:p.members]),h.useEffect(()=>{e||(o("workspace"),c(""),u(new Set))},[e]);const b=j=>{u(k=>{const w=new Set(k);return w.has(j)?w.delete(j):w.add(j),w})},N=()=>{g.mutate({target_workspace_id:l,carry_over_user_ids:[...d]},{onSuccess:()=>{F.success("Project transferred"),t()},onError:j=>{var w,S,_;const k=((_=(S=(w=j==null?void 0:j.response)==null?void 0:w.data)==null?void 0:S.error)==null?void 0:_.message)??(j==null?void 0:j.message)??"Unknown error";F.error(`Transfer failed: ${k}`)}})};return s.jsx(mn,{open:e,onOpenChange:j=>!j&&t(),children:s.jsxs(Zr,{className:"sm:max-w-[480px]",children:[s.jsx(hn,{children:s.jsx(pn,{children:i==="workspace"?`Transfer "${n}"`:"Review Members"})}),i==="workspace"?s.jsxs("div",{className:"space-y-4 pt-1",children:[s.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800/40 dark:bg-amber-950/20 px-3.5 py-3",children:[s.jsx(hN,{className:"h-4 w-4 text-amber-600 dark:text-amber-500 shrink-0 mt-0.5"}),s.jsx("p",{className:"text-sm text-amber-700 dark:text-amber-400",children:"This will move the project and all its issues to another workspace."})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("p",{className:"text-sm font-medium",children:"Target workspace"}),m?s.jsx(le,{className:"h-9 w-full"}):v.length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No other workspaces available."}):s.jsxs(Ue,{value:l,onValueChange:c,children:[s.jsx(Le,{className:"w-full",children:s.jsx(Ve,{placeholder:"Select a workspace…"})}),s.jsx(Fe,{children:v.map(j=>s.jsx(ke,{value:j.id,children:j.name},j.id))})]})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:t,children:"Cancel"}),s.jsx(ee,{size:"sm",disabled:!l,onClick:()=>o("members"),children:"Next: Review Members →"})]})]}):s.jsxs("div",{className:"space-y-4 pt-1",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Select who to carry over. Selected members will be added to"," ",s.jsx("span",{className:"font-medium text-foreground",children:y==null?void 0:y.name})," if not already a member."]}),x?s.jsx("div",{className:"space-y-2.5",children:[1,2,3].map(j=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(le,{className:"h-4 w-4 rounded"}),s.jsx(le,{className:"h-7 w-7 rounded-full"}),s.jsx(le,{className:"h-3.5 w-36"})]},j))}):((p==null?void 0:p.members)??[]).length===0?s.jsx("p",{className:"text-sm text-muted-foreground",children:"No project members to review."}):s.jsx("div",{className:"space-y-1 max-h-56 overflow-y-auto pr-1",children:((p==null?void 0:p.members)??[]).map(j=>{var O;const k=j.user,w=(k==null?void 0:k.first_name)??"",S=(k==null?void 0:k.last_name)??"",_=`${w} ${S}`.trim()||(k==null?void 0:k.email)||"Unknown",C=(w[0]??S[0]??((O=k==null?void 0:k.email)==null?void 0:O[0])??"U").toUpperCase(),P=d.has(j.user_id);return s.jsxs("div",{className:"flex items-center gap-2.5 py-1.5 cursor-pointer",onClick:()=>b(j.user_id),children:[s.jsx(gk,{checked:P,onCheckedChange:()=>b(j.user_id),onClick:E=>E.stopPropagation(),className:"shrink-0"}),s.jsx(Pt,{className:"h-7 w-7 shrink-0",children:s.jsx(Mt,{className:"text-[11px] font-medium",children:C})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("span",{className:"text-sm truncate block",children:_}),(k==null?void 0:k.email)&&s.jsx("span",{className:"text-xs text-muted-foreground truncate block",children:k.email})]}),s.jsx("span",{className:z("text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",j.role==="manager"?"bg-indigo-50 text-indigo-700 dark:bg-indigo-950/30 dark:text-indigo-400":"bg-muted text-muted-foreground"),children:j.role})]},j.id)})}),((p==null?void 0:p.teams)??[]).length>0&&s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2.5",children:[s.jsx(Aa,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Project teams will be removed as they belong to the current workspace."})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>o("workspace"),children:"← Back"}),s.jsxs(ee,{size:"sm",disabled:g.isPending,onClick:N,children:[s.jsx(Ad,{className:"h-4 w-4"}),g.isPending?"Transferring…":"Transfer Project"]})]})]})]})})}const vk=6048e5,QI=864e5,Qre=6e4,ZI=36e5,Yc=43200,My=1440,Oy=Symbol.for("constructDateFrom");function Ot(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&Oy in e?e[Oy](t):e instanceof Date?new e.constructor(t):new Date(t)}function He(e,t){return Ot(t||e,e)}function Yr(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(t)?Ot((r==null?void 0:r.in)||e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Ix(e,t,r){const n=He(e,r==null?void 0:r.in);if(isNaN(t))return Ot((r==null?void 0:r.in)||e,NaN);if(!t)return n;const a=n.getDate(),i=Ot((r==null?void 0:r.in)||e,n.getTime());i.setMonth(n.getMonth()+t+1,0);const o=i.getDate();return a>=o?i:(n.setFullYear(i.getFullYear(),i.getMonth(),a),n)}let JI={};function Ro(){return JI}function ao(e,t){var l,c,d,u;const r=Ro(),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,a=He(e,t==null?void 0:t.in),i=a.getDay(),o=(i<n?7:0)+i-n;return a.setDate(a.getDate()-o),a.setHours(0,0,0,0),a}function Il(e,t){return ao(e,{...t,weekStartsOn:1})}function yk(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),a=Ot(r,0);a.setFullYear(n+1,0,4),a.setHours(0,0,0,0);const i=Il(a),o=Ot(r,0);o.setFullYear(n,0,4),o.setHours(0,0,0,0);const l=Il(o);return r.getTime()>=i.getTime()?n+1:r.getTime()>=l.getTime()?n:n-1}function Bd(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 vs(e,...t){const r=Ot.bind(null,e||t.find(n=>typeof n=="object"));return t.map(r)}function io(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(0,0,0,0),r}function ff(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t),i=io(n),o=io(a),l=+i-Bd(i),c=+o-Bd(o);return Math.round((l-c)/QI)}function e4(e,t){const r=yk(e,t),n=Ot(e,0);return n.setFullYear(r,0,4),n.setHours(0,0,0,0),Il(n)}function t4(e,t,r){return Yr(e,t*7,r)}function r4(e,t,r){return Ix(e,t*12,r)}function n4(e,t){let r,n=t==null?void 0:t.in;return e.forEach(a=>{!n&&typeof a=="object"&&(n=Ot.bind(null,a));const i=He(a,n);(!r||r<i||isNaN(+i))&&(r=i)}),Ot(n,r||NaN)}function s4(e,t){let r,n=t==null?void 0:t.in;return e.forEach(a=>{!n&&typeof a=="object"&&(n=Ot.bind(null,a));const i=He(a,n);(!r||r>i||isNaN(+i))&&(r=i)}),Ot(n,r||NaN)}function Nd(e,t){const r=+He(e)-+He(t);return r<0?-1:r>0?1:r}function Rx(e){return Ot(e,Date.now())}function oo(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t);return+io(n)==+io(a)}function bk(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function a4(e){return!(!bk(e)&&typeof e!="number"||isNaN(+He(e)))}function $x(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t),i=n.getFullYear()-a.getFullYear(),o=n.getMonth()-a.getMonth();return i*12+o}function jk(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t),i=Ey(n,a),o=Math.abs(ff(n,a));n.setDate(n.getDate()-i*o);const l=+(Ey(n,a)===-i),c=i*(o-l);return c===0?0:c}function Ey(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 wk(e){return t=>{const n=(e?Math[e]:Math.trunc)(t);return n===0?0:n}}function i4(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t),i=(+n-+a)/ZI;return wk(r==null?void 0:r.roundingMethod)(i)}function o4(e,t){return+He(e)-+He(t)}function Nk(e,t){const r=He(e,t==null?void 0:t.in);return r.setHours(23,59,59,999),r}function zx(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 l4(e,t){const r=He(e,t==null?void 0:t.in);return+Nk(r,t)==+zx(r,t)}function kk(e,t,r){const[n,a,i]=vs(r==null?void 0:r.in,e,e,t),o=Nd(a,i),l=Math.abs($x(a,i));if(l<1)return 0;a.getMonth()===1&&a.getDate()>27&&a.setDate(30),a.setMonth(a.getMonth()-o*l);let c=Nd(a,i)===-o;l4(n)&&l===1&&Nd(n,i)===1&&(c=!1);const d=o*(l-+c);return d===0?0:d}function c4(e,t,r){const n=o4(e,t)/1e3;return wk(r==null?void 0:r.roundingMethod)(n)}function Sk(e,t){const[r,n]=vs(e,t.start,t.end);return{start:r,end:n}}function d4(e,t){const{start:r,end:n}=Sk(t==null?void 0:t.in,e);let a=+r>+n;const i=a?+r:+n,o=a?n:r;o.setHours(0,0,0,0),o.setDate(1);let l=1;const c=[];for(;+o<=i;)c.push(Ot(r,o)),o.setMonth(o.getMonth()+l);return a?c.reverse():c}function Ck(e,t){const r=He(e,t==null?void 0:t.in);return r.setDate(1),r.setHours(0,0,0,0),r}function u4(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 _k(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 f4(e,t){const{start:r,end:n}=Sk(t==null?void 0:t.in,e);let a=+r>+n;const i=a?+r:+n,o=a?n:r;o.setHours(0,0,0,0),o.setMonth(0,1);let l=1;const c=[];for(;+o<=i;)c.push(Ot(r,o)),o.setFullYear(o.getFullYear()+l);return a?c.reverse():c}function Pk(e,t){var l,c,d,u;const r=Ro(),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,a=He(e,t==null?void 0:t.in),i=a.getDay(),o=(i<n?-7:0)+6-(i-n);return a.setDate(a.getDate()+o),a.setHours(23,59,59,999),a}function m4(e,t){return Pk(e,{...t,weekStartsOn:1})}const h4={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"}},p4=(e,t,r)=>{let n;const a=h4[e];return typeof a=="string"?n=a:t===1?n=a.one:n=a.other.replace("{{count}}",t.toString()),r!=null&&r.addSuffix?r.comparison&&r.comparison>0?"in "+n:n+" ago":n};function Lm(e){return(t={})=>{const r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}const x4={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},g4={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},v4={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},y4={date:Lm({formats:x4,defaultWidth:"full"}),time:Lm({formats:g4,defaultWidth:"full"}),dateTime:Lm({formats:v4,defaultWidth:"full"})},b4={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},j4=(e,t,r,n)=>b4[e];function al(e){return(t,r)=>{const n=r!=null&&r.context?String(r.context):"standalone";let a;if(n==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,l=r!=null&&r.width?String(r.width):o;a=e.formattingValues[l]||e.formattingValues[o]}else{const o=e.defaultWidth,l=r!=null&&r.width?String(r.width):e.defaultWidth;a=e.values[l]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return a[i]}}const w4={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},N4={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},k4={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"]},S4={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"]},C4={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"}},_4={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"}},P4=(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"},M4={ordinalNumber:P4,era:al({values:w4,defaultWidth:"wide"}),quarter:al({values:N4,defaultWidth:"wide",argumentCallback:e=>e-1}),month:al({values:k4,defaultWidth:"wide"}),day:al({values:S4,defaultWidth:"wide"}),dayPeriod:al({values:C4,defaultWidth:"wide",formattingValues:_4,defaultFormattingWidth:"wide"})};function il(e){return(t,r={})=>{const n=r.width,a=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(a);if(!i)return null;const o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],c=Array.isArray(l)?E4(l,f=>f.test(o)):O4(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 O4(e,t){for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}function E4(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}function A4(e){return(t,r={})=>{const n=t.match(e.matchPattern);if(!n)return null;const a=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(a.length);return{value:o,rest:l}}}const D4=/^(\d+)(th|st|nd|rd)?/i,T4=/\d+/i,I4={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},R4={any:[/^b/i,/^(a|c)/i]},$4={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},z4={any:[/1/i,/2/i,/3/i,/4/i]},L4={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},F4={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]},B4={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},q4={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]},W4={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},U4={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}},H4={ordinalNumber:A4({matchPattern:D4,parsePattern:T4,valueCallback:e=>parseInt(e,10)}),era:il({matchPatterns:I4,defaultMatchWidth:"wide",parsePatterns:R4,defaultParseWidth:"any"}),quarter:il({matchPatterns:$4,defaultMatchWidth:"wide",parsePatterns:z4,defaultParseWidth:"any",valueCallback:e=>e+1}),month:il({matchPatterns:L4,defaultMatchWidth:"wide",parsePatterns:F4,defaultParseWidth:"any"}),day:il({matchPatterns:B4,defaultMatchWidth:"wide",parsePatterns:q4,defaultParseWidth:"any"}),dayPeriod:il({matchPatterns:W4,defaultMatchWidth:"any",parsePatterns:U4,defaultParseWidth:"any"})},ei={code:"en-US",formatDistance:p4,formatLong:y4,formatRelative:j4,localize:M4,match:H4,options:{weekStartsOn:0,firstWeekContainsDate:1}};function K4(e,t){const r=He(e,t==null?void 0:t.in);return ff(r,_k(r))+1}function Lx(e,t){const r=He(e,t==null?void 0:t.in),n=+Il(r)-+e4(r);return Math.round(n/vk)+1}function Mk(e,t){var u,f,m,p;const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),a=Ro(),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)??a.firstWeekContainsDate??((p=(m=a.locale)==null?void 0:m.options)==null?void 0:p.firstWeekContainsDate)??1,o=Ot((t==null?void 0:t.in)||e,0);o.setFullYear(n+1,0,i),o.setHours(0,0,0,0);const l=ao(o,t),c=Ot((t==null?void 0:t.in)||e,0);c.setFullYear(n,0,i),c.setHours(0,0,0,0);const d=ao(c,t);return+r>=+l?n+1:+r>=+d?n:n-1}function Y4(e,t){var l,c,d,u;const r=Ro(),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,a=Mk(e,t),i=Ot((t==null?void 0:t.in)||e,0);return i.setFullYear(a,0,n),i.setHours(0,0,0,0),ao(i,t)}function Fx(e,t){const r=He(e,t==null?void 0:t.in),n=+ao(r,t)-+Y4(r,t);return Math.round(n/vk)+1}function tt(e,t){const r=e<0?"-":"",n=Math.abs(e).toString().padStart(t,"0");return r+n}const ma={y(e,t){const r=e.getFullYear(),n=r>0?r:1-r;return tt(t==="yy"?n%100:n,t.length)},M(e,t){const r=e.getMonth();return t==="M"?String(r+1):tt(r+1,2)},d(e,t){return tt(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 tt(e.getHours()%12||12,t.length)},H(e,t){return tt(e.getHours(),t.length)},m(e,t){return tt(e.getMinutes(),t.length)},s(e,t){return tt(e.getSeconds(),t.length)},S(e,t){const r=t.length,n=e.getMilliseconds(),a=Math.trunc(n*Math.pow(10,r-3));return tt(a,t.length)}},zi={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Ay={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(),a=n>0?n:1-n;return r.ordinalNumber(a,{unit:"year"})}return ma.y(e,t)},Y:function(e,t,r,n){const a=Mk(e,n),i=a>0?a:1-a;if(t==="YY"){const o=i%100;return tt(o,2)}return t==="Yo"?r.ordinalNumber(i,{unit:"year"}):tt(i,t.length)},R:function(e,t){const r=yk(e);return tt(r,t.length)},u:function(e,t){const r=e.getFullYear();return tt(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 tt(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 tt(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 ma.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 tt(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 a=Fx(e,n);return t==="wo"?r.ordinalNumber(a,{unit:"week"}):tt(a,t.length)},I:function(e,t,r){const n=Lx(e);return t==="Io"?r.ordinalNumber(n,{unit:"week"}):tt(n,t.length)},d:function(e,t,r){return t==="do"?r.ordinalNumber(e.getDate(),{unit:"date"}):ma.d(e,t)},D:function(e,t,r){const n=K4(e);return t==="Do"?r.ordinalNumber(n,{unit:"dayOfYear"}):tt(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 a=e.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return tt(i,2);case"eo":return r.ordinalNumber(i,{unit:"day"});case"eee":return r.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(a,{width:"short",context:"formatting"});case"eeee":default:return r.day(a,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){const a=e.getDay(),i=(a-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return tt(i,t.length);case"co":return r.ordinalNumber(i,{unit:"day"});case"ccc":return r.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(a,{width:"narrow",context:"standalone"});case"cccccc":return r.day(a,{width:"short",context:"standalone"});case"cccc":default:return r.day(a,{width:"wide",context:"standalone"})}},i:function(e,t,r){const n=e.getDay(),a=n===0?7:n;switch(t){case"i":return String(a);case"ii":return tt(a,t.length);case"io":return r.ordinalNumber(a,{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 a=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(e,t,r){const n=e.getHours();let a;switch(n===12?a=zi.noon:n===0?a=zi.midnight:a=n/12>=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return r.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(e,t,r){const n=e.getHours();let a;switch(n>=17?a=zi.evening:n>=12?a=zi.afternoon:n>=4?a=zi.morning:a=zi.night,t){case"B":case"BB":case"BBB":return r.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return r.dayPeriod(a,{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 ma.h(e,t)},H:function(e,t,r){return t==="Ho"?r.ordinalNumber(e.getHours(),{unit:"hour"}):ma.H(e,t)},K:function(e,t,r){const n=e.getHours()%12;return t==="Ko"?r.ordinalNumber(n,{unit:"hour"}):tt(n,t.length)},k:function(e,t,r){let n=e.getHours();return n===0&&(n=24),t==="ko"?r.ordinalNumber(n,{unit:"hour"}):tt(n,t.length)},m:function(e,t,r){return t==="mo"?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):ma.m(e,t)},s:function(e,t,r){return t==="so"?r.ordinalNumber(e.getSeconds(),{unit:"second"}):ma.s(e,t)},S:function(e,t){return ma.S(e,t)},X:function(e,t,r){const n=e.getTimezoneOffset();if(n===0)return"Z";switch(t){case"X":return Ty(n);case"XXXX":case"XX":return Va(n);case"XXXXX":case"XXX":default:return Va(n,":")}},x:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"x":return Ty(n);case"xxxx":case"xx":return Va(n);case"xxxxx":case"xxx":default:return Va(n,":")}},O:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+Dy(n,":");case"OOOO":default:return"GMT"+Va(n,":")}},z:function(e,t,r){const n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+Dy(n,":");case"zzzz":default:return"GMT"+Va(n,":")}},t:function(e,t,r){const n=Math.trunc(+e/1e3);return tt(n,t.length)},T:function(e,t,r){return tt(+e,t.length)}};function Dy(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.trunc(n/60),i=n%60;return i===0?r+String(a):r+String(a)+t+tt(i,2)}function Ty(e,t){return e%60===0?(e>0?"-":"+")+tt(Math.abs(e)/60,2):Va(e,t)}function Va(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=tt(Math.trunc(n/60),2),i=tt(n%60,2);return r+a+t+i}const Iy=(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"})}},Ok=(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"})}},G4=(e,t)=>{const r=e.match(/(P+)(p+)?/)||[],n=r[1],a=r[2];if(!a)return Iy(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}}",Iy(n,t)).replace("{{time}}",Ok(a,t))},V4={p:Ok,P:G4},X4=/^D+$/,Q4=/^Y+$/,Z4=["D","DD","YY","YYYY"];function J4(e){return X4.test(e)}function eR(e){return Q4.test(e)}function tR(e,t,r){const n=rR(e,t,r);if(console.warn(n),Z4.includes(e))throw new RangeError(n)}function rR(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 nR=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,sR=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,aR=/^'([^]*?)'?$/,iR=/''/g,oR=/[a-zA-Z]/;function fe(e,t,r){var u,f,m,p,x,g,v,y;const n=Ro(),a=(r==null?void 0:r.locale)??n.locale??ei,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(!a4(l))throw new RangeError("Invalid time value");let c=t.match(sR).map(b=>{const N=b[0];if(N==="p"||N==="P"){const j=V4[N];return j(b,a.formatLong)}return b}).join("").match(nR).map(b=>{if(b==="''")return{isToken:!1,value:"'"};const N=b[0];if(N==="'")return{isToken:!1,value:lR(b)};if(Ay[N])return{isToken:!0,value:b};if(N.match(oR))throw new RangeError("Format string contains an unescaped latin alphabet character `"+N+"`");return{isToken:!1,value:b}});a.localize.preprocessor&&(c=a.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:a};return c.map(b=>{if(!b.isToken)return b.value;const N=b.value;(!(r!=null&&r.useAdditionalWeekYearTokens)&&eR(N)||!(r!=null&&r.useAdditionalDayOfYearTokens)&&J4(N))&&tR(N,t,String(e));const j=Ay[N[0]];return j(l,N,a.localize,d)}).join("")}function lR(e){const t=e.match(aR);return t?t[1].replace(iR,"'"):e}function Bh(e,t,r){const n=Ro(),a=(r==null?void 0:r.locale)??n.locale??ei,i=2520,o=Nd(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]=vs(r==null?void 0:r.in,...o>0?[t,e]:[e,t]),u=c4(d,c),f=(Bd(d)-Bd(c))/1e3,m=Math.round((u-f)/60);let p;if(m<2)return r!=null&&r.includeSeconds?u<5?a.formatDistance("lessThanXSeconds",5,l):u<10?a.formatDistance("lessThanXSeconds",10,l):u<20?a.formatDistance("lessThanXSeconds",20,l):u<40?a.formatDistance("halfAMinute",0,l):u<60?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",1,l):m===0?a.formatDistance("lessThanXMinutes",1,l):a.formatDistance("xMinutes",m,l);if(m<45)return a.formatDistance("xMinutes",m,l);if(m<90)return a.formatDistance("aboutXHours",1,l);if(m<My){const x=Math.round(m/60);return a.formatDistance("aboutXHours",x,l)}else{if(m<i)return a.formatDistance("xDays",1,l);if(m<Yc){const x=Math.round(m/My);return a.formatDistance("xDays",x,l)}else if(m<Yc*2)return p=Math.round(m/Yc),a.formatDistance("aboutXMonths",p,l)}if(p=kk(d,c),p<12){const x=Math.round(m/Yc);return a.formatDistance("xMonths",x,l)}else{const x=p%12,g=Math.trunc(p/12);return x<3?a.formatDistance("aboutXYears",g,l):x<9?a.formatDistance("overXYears",g,l):a.formatDistance("almostXYears",g+1,l)}}function cR(e,t){return Bh(e,Rx(e),t)}function Pl(e,t){return He(e,t==null?void 0:t.in).getDate()}function dR(e,t){return He(e,t==null?void 0:t.in).getDay()}function Ia(e,t){const r=He(e,t==null?void 0:t.in),n=r.getFullYear(),a=r.getMonth(),i=Ot(r,0);return i.setFullYear(n,a+1,0),i.setHours(0,0,0,0),i.getDate()}function kd(e,t){return He(e,t==null?void 0:t.in).getMonth()}function uR(e,t){return He(e,t==null?void 0:t.in).getFullYear()}function fR(e,t){return+He(e)>+He(t)}function mR(e,t){return+He(e)<+He(t)}function hR(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t);return n.getFullYear()===a.getFullYear()&&n.getMonth()===a.getMonth()}function pR(e,t,r){const[n,a]=vs(r==null?void 0:r.in,e,t);return n.getFullYear()===a.getFullYear()}function xR(e,t){return oo(Ot(e,e),Rx(e))}function Ek(e,t,r){return Yr(e,-t,r)}function gR(e,t){return oo(Ot(e,e),Ek(Rx(e),1))}function vR(e,t,r){const n=He(e,r==null?void 0:r.in),a=n.getFullYear(),i=n.getDate(),o=Ot(e,0);o.setFullYear(a,t,15),o.setHours(0,0,0,0);const l=Ia(o);return n.setMonth(t,Math.min(i,l)),n}function yR(e,t,r){const n=He(e,r==null?void 0:r.in);return isNaN(+n)?Ot(e,NaN):(n.setFullYear(t),n)}function bR(){const[e,t]=h.useState(!1),[r,n]=h.useState(null),[a,i]=h.useState(null),[o,l]=h.useState(null),[c,d]=h.useState(""),[u,f]=h.useState(new Set),[m,p]=h.useState(""),[x,g]=h.useState("all"),{workspace:v}=Et(),{data:y,isLoading:b}=oc(),{data:N}=Cn(),j=xT(),k=YT(),w=XT(),S=ct(),_=N==null?void 0:N.find(O=>O.slug===v),C=O=>O.has_pending_request||u.has(O.id),P=(y??[]).filter(O=>(x==="all"||O.status===x)&&(!m||O.name.toLowerCase().includes(m.toLowerCase())||O.identifier.toLowerCase().includes(m.toLowerCase())));return s.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[s.jsx("h1",{className:"text-base font-semibold",children:"Projects"}),s.jsxs(ee,{size:"sm",onClick:()=>t(!0),children:[s.jsx(ot,{className:"h-4 w-4"}),"Create"]})]}),s.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:[s.jsx("div",{className:"flex items-center gap-1 overflow-x-auto scrollbar-none",children:["all","active","paused","archived"].map(O=>s.jsx("button",{onClick:()=>g(O),className:z("px-3 h-7 rounded-md text-xs font-medium transition-colors whitespace-nowrap shrink-0",x===O?"bg-foreground text-background":"text-muted-foreground hover:text-foreground hover:bg-muted"),children:O==="all"?"All":O.charAt(0).toUpperCase()+O.slice(1)},O))}),s.jsxs("div",{className:"relative",children:[s.jsx(za,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),s.jsx(_e,{placeholder:"Search...",value:m,onChange:O=>p(O.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),s.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:[s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Identifier"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Created"}),s.jsx("span",{})]}),b?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(O=>s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3",children:[s.jsx(le,{className:"h-4 w-48"}),s.jsx(le,{className:"h-4 w-12"}),s.jsx(le,{className:"h-5 w-16 rounded-full"}),s.jsx(le,{className:"h-4 w-24"}),s.jsx("div",{})]},`d-${O}`),s.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3",children:[s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(le,{className:"h-4 w-40"}),s.jsx(le,{className:"h-3 w-24"})]}),s.jsx(le,{className:"h-6 w-6 rounded-full"})]},`m-${O}`)]}))}):P.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(Gr,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:m||x!=="all"?"No projects match":"No projects yet"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:m||x!=="all"?"Try adjusting your filters.":"Create your first project to get started."}),!m&&x==="all"&&s.jsxs(ee,{size:"sm",onClick:()=>t(!0),children:[s.jsx(ot,{className:"h-4 w-4"}),"Create project"]})]}):s.jsx("div",{className:"divide-y divide-border",children:P.map(O=>s.jsxs("div",{children:[s.jsxs("div",{className:z("hidden md:grid grid-cols-[2fr_1fr_1fr_1fr_40px] items-center px-6 py-3 transition-colors group",O.is_member===!1?"opacity-60 cursor-default":"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer"),onClick:()=>O.is_member!==!1&&S(`/${v}/projects/${O.identifier}/board`),children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:O.name}),O.is_member===!1&&C(O)&&s.jsx("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded bg-amber-100 text-amber-700 shrink-0",children:"Pending"}),(O.pending_request_count??0)>0&&s.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white shrink-0",children:O.pending_request_count}),O.description&&s.jsx("span",{className:"text-xs text-muted-foreground truncate hidden xl:block",children:O.description})]}),s.jsx("span",{className:"text-sm text-muted-foreground font-mono",children:O.identifier}),s.jsx("div",{children:s.jsxs("span",{className:z("inline-flex items-center gap-1.5 text-xs",O.status==="active"&&"text-emerald-600",O.status==="paused"&&"text-amber-600",O.status==="archived"&&"text-muted-foreground"),children:[s.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",O.status==="active"&&"bg-emerald-500",O.status==="paused"&&"bg-amber-500",O.status==="archived"&&"bg-zinc-400")}),O.status.charAt(0).toUpperCase()+O.status.slice(1)]})}),s.jsx("span",{className:"text-sm text-muted-foreground",children:fe(new Date(O.created_at),"MMM d, yyyy")}),s.jsx("div",{className:"flex justify-end",onClick:E=>E.stopPropagation(),children:O.is_member===!1?C(O)?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Pending"}),s.jsx(ee,{variant:"ghost",size:"icon-sm",className:"h-6 w-6 text-muted-foreground",disabled:w.isPending,onClick:()=>w.mutate(O.id,{onSuccess:()=>{f(E=>{const D=new Set(E);return D.delete(O.id),D}),F.success("Access request cancelled")},onError:()=>F.error("Failed to cancel request")}),children:s.jsx(Be,{className:"h-3 w-3"})})]}):s.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 text-xs",onClick:()=>{l({id:O.id,name:O.name}),d("")},children:[s.jsx(Nn,{className:"h-3 w-3"}),"Request access"]}):s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsx(ee,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(Ls,{className:"h-4 w-4"})})}),s.jsxs(Dr,{align:"end",children:[s.jsxs(Je,{onClick:()=>S(`/${v}/projects/${O.identifier}/board`),children:[s.jsx(Gr,{className:"h-4 w-4"}),"Open board"]}),s.jsxs(Je,{onClick:()=>S(`/${v}/projects/${O.identifier}/issues`),children:[s.jsx(ds,{className:"h-4 w-4"}),"View issues"]}),s.jsxs(Je,{onClick:()=>n({id:O.id,name:O.name}),children:[s.jsx(Sn,{className:"h-4 w-4"}),"Manage access"]}),s.jsxs(Je,{onClick:()=>i({id:O.id,name:O.name}),children:[s.jsx(Ad,{className:"h-4 w-4"}),"Transfer to workspace"]}),s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${O.name}"? This cannot be undone.`)&&j.mutate(O.id,{onSuccess:()=>F.success("Project deleted"),onError:()=>F.error("Failed to delete project")})},children:[s.jsx(jr,{className:"h-4 w-4"}),"Delete"]})]})]})})]}),s.jsxs("div",{className:z("md:hidden flex items-center gap-3 px-4 py-3 transition-colors",O.is_member===!1?"opacity-60 cursor-default":"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer"),onClick:()=>O.is_member!==!1&&S(`/${v}/projects/${O.identifier}/issues`),children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[s.jsx("span",{className:"text-sm font-medium text-foreground truncate",children:O.name}),s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:O.identifier})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:z("h-1.5 w-1.5 rounded-full shrink-0",O.status==="active"&&"bg-emerald-500",O.status==="paused"&&"bg-amber-500",O.status==="archived"&&"bg-zinc-400")}),s.jsx("span",{className:z("text-xs",O.status==="active"&&"text-emerald-600",O.status==="paused"&&"text-amber-600",O.status==="archived"&&"text-muted-foreground"),children:O.status.charAt(0).toUpperCase()+O.status.slice(1)}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"·"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date(O.created_at),"MMM d, yyyy")})]})]}),s.jsx("div",{onClick:E=>E.stopPropagation(),children:O.is_member===!1?C(O)?s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:"Pending"}),s.jsx(ee,{variant:"ghost",size:"icon-sm",className:"h-7 w-7 text-muted-foreground",disabled:w.isPending,onClick:()=>w.mutate(O.id,{onSuccess:()=>{f(E=>{const D=new Set(E);return D.delete(O.id),D}),F.success("Access request cancelled")},onError:()=>F.error("Failed to cancel request")}),children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]}):s.jsx(ee,{variant:"outline",size:"sm",className:"h-8 text-xs",onClick:()=>{l({id:O.id,name:O.name}),d("")},children:"Request access"}):s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsx(ee,{variant:"ghost",size:"icon-sm",className:"h-8 w-8 text-muted-foreground",children:s.jsx(Ls,{className:"h-4 w-4"})})}),s.jsxs(Dr,{align:"end",children:[s.jsxs(Je,{onClick:()=>S(`/${v}/projects/${O.identifier}/issues`),children:[s.jsx(ds,{className:"h-4 w-4"}),"View issues"]}),s.jsxs(Je,{onClick:()=>n({id:O.id,name:O.name}),children:[s.jsx(Sn,{className:"h-4 w-4"}),"Manage access"]}),s.jsxs(Je,{onClick:()=>i({id:O.id,name:O.name}),children:[s.jsx(Ad,{className:"h-4 w-4"}),"Transfer to workspace"]}),s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>{confirm(`Delete "${O.name}"? This cannot be undone.`)&&j.mutate(O.id,{onSuccess:()=>F.success("Project deleted"),onError:()=>F.error("Failed to delete project")})},children:[s.jsx(jr,{className:"h-4 w-4"}),"Delete"]})]})]})})]})]},O.id))}),!b&&P.length>0&&s.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:["1 — ",P.length," of ",P.length," result",P.length!==1?"s":""]}),s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[s.jsx("span",{children:"1 of 1 pages"}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Prev"}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",disabled:!0,children:"Next"})]})]})]}),s.jsx(mn,{open:!!o,onOpenChange:O=>{O||l(null)},children:s.jsxs(Zr,{className:"max-w-sm",children:[s.jsx(hn,{children:s.jsxs(pn,{children:["Request access to ",o==null?void 0:o.name,"?"]})}),s.jsxs("div",{className:"space-y-3 py-1",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"A request will be sent to the project managers. You'll be notified once it's approved."}),s.jsx(_e,{placeholder:"Optional message...",value:c,onChange:O=>d(O.target.value),className:"h-9 text-sm"})]}),s.jsxs(Oo,{children:[s.jsx(ee,{variant:"outline",size:"sm",onClick:()=>l(null),children:"Cancel"}),s.jsx(ee,{size:"sm",disabled:k.isPending,onClick:()=>{o&&k.mutate({projectId:o.id,message:c.trim()||void 0},{onSuccess:()=>{f(O=>new Set([...O,o.id])),l(null),F.success("Access request sent")},onError:O=>{F.error(O.message??"Failed to send request"),l(null)}})},children:k.isPending?"Sending...":"Send request"})]})]})}),s.jsx(DI,{open:e,onClose:()=>t(!1)}),r&&s.jsx(TI,{open:!!r,onClose:()=>n(null),projectId:r.id,projectName:r.name}),a&&s.jsx(XI,{open:!!a,onClose:()=>i(null),projectId:a.id,projectName:a.name,currentWorkspaceId:(_==null?void 0:_.id)??""})]})}const xc={byProject:e=>["projects",e,"statuses"]};function $o(e){return Te({queryKey:xc.byProject(e??""),queryFn:()=>ie.get(`/admin/projects/${e}/statuses`),select:t=>t.statuses,enabled:!!e})}function jR(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/projects/${e}/statuses`,r),onSuccess:()=>{t.invalidateQueries({queryKey:xc.byProject(e)})}})}function wR(e,t){const r=ye();return ge({mutationFn:n=>ie.put(`/admin/projects/${e}/statuses/${t}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:xc.byProject(e)})}})}function NR(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/projects/${e}/statuses/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:xc.byProject(e)})}})}function kR(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/projects/${e}/statuses/reorder`,{orderedIds:r}),onSuccess:()=>{t.invalidateQueries({queryKey:xc.byProject(e)})}})}const Ai={all:["users"],list:e=>[...Ai.all,"list",e??{}]};function Ak(e){const{limit:t=20,offset:r=0,q:n=""}=e??{},a=new URLSearchParams;return a.set("limit",String(t)),a.set("offset",String(r)),n&&a.set("q",n),Te({queryKey:Ai.list({limit:t,offset:r,q:n}),queryFn:()=>ie.get(`/admin/users?${a}`),staleTime:1e3*60*5,placeholderData:i=>i})}const mf={all:["org-invitations"],list:e=>[...mf.all,"list",e??{}]};function SR(e){const{limit:t=20,offset:r=0,q:n=""}=e??{},a=new URLSearchParams;return a.set("limit",String(t)),a.set("offset",String(r)),n&&a.set("q",n),Te({queryKey:mf.list({limit:t,offset:r,q:n}),queryFn:()=>ie.get(`/admin/users/invitations?${a}`),staleTime:1e3*30,placeholderData:i=>i})}function CR(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/users/invitations/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:mf.all})})}function _R(){return ge({mutationFn:e=>ie.post(`/admin/users/invitations/${e}/resend`)})}function PR(){const e=ye();return ge({mutationFn:({email:t,role:r})=>ie.post("/admin/users/invite",{email:t,role:r}),onSuccess:()=>e.invalidateQueries({queryKey:mf.all})})}function MR(){const e=ye();return ge({mutationFn:({userId:t,role:r})=>ie.patch(`/admin/users/${t}`,{role:r}),onSuccess:()=>e.invalidateQueries({queryKey:Ai.all})})}function OR(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/users/${t}`),onSuccess:()=>e.invalidateQueries({queryKey:Ai.all})})}function ER(){const e=ye();return ge({mutationFn:t=>ie.post(`/admin/users/${t}/reactivate`),onSuccess:()=>e.invalidateQueries({queryKey:Ai.all})})}function Dk(){return Te({queryKey:[...Ai.all,"map"],queryFn:()=>ie.get("/admin/users/map"),select:e=>e.users,staleTime:1e3*60*5})}function La(){return Te({queryKey:[...Ai.all,"map"],queryFn:()=>ie.get("/admin/users/map"),select:e=>new Map(e.users.map(t=>{var o;const r=t.first_name??"",n=t.last_name??"",a=`${r} ${n}`.trim()||t.email,i=(r[0]??n[0]??((o=t.email)==null?void 0:o[0])??"U").toUpperCase();return[t.id,{name:a,initials:i}]})),staleTime:1e3*60*5})}const gi={backlog:"Backlog",todo:"Todo",in_progress:"In Progress",in_review:"In Review",done:"Done",cancelled:"Cancelled"},dn={urgent:"Urgent",high:"High",medium:"Medium",low:"Low",none:"None"},gc={urgent:"text-red-500",high:"text-orange-500",medium:"text-yellow-500",low:"text-blue-400",none:"text-zinc-400"},Bs={task:"Task",bug:"Bug",feature:"Feature",improvement:"Improvement",epic:"Epic"},AR=({priority:e})=>{const t=z("h-3 w-3 shrink-0",gc[e]);switch(e){case"urgent":return s.jsx(gs,{className:t});case"high":return s.jsx(Pi,{className:t});case"medium":return s.jsx(Js,{className:t});case"low":return s.jsx(_i,{className:t});default:return s.jsx(Er,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function Tk({issue:e,childCount:t=0,onClick:r}){var f,m;const{data:n}=La(),{attributes:a,listeners:i,setNodeRef:o,transform:l,transition:c,isDragging:d}=sx({id:e.id}),u={transform:ax.Transform.toString(l),transition:c};return s.jsxs("div",{ref:o,style:u,...a,...i,onClick:r,className:z("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:[s.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),s.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mb-2",children:[s.jsx(Ht,{className:"h-2.5 w-2.5 shrink-0"}),s.jsx("span",{children:e.start_date?fe(new Date(e.start_date),"MMM d"):"?"}),s.jsx("span",{children:"→"}),s.jsx("span",{children:e.due_date?fe(new Date(e.due_date),"MMM d"):"?"})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.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&&s.jsx("span",{className:"flex items-center text-zinc-400 dark:text-zinc-500 shrink-0",title:"Child issue",children:s.jsx(Ds,{className:"h-3 w-3"})}),t>0&&s.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:[s.jsx(Ds,{className:"h-2.5 w-2.5"}),t]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&s.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 s.jsx(Pt,{className:"h-4 w-4 border border-background",children:s.jsx(Mt,{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&&s.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]})]}),s.jsx(AR,{priority:e.priority})]})]})]})}const DR=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function Gc(e,t){const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return isNaN(n)||isNaN(a)||isNaN(i)?`rgba(148,163,184,${t})`:`rgba(${n},${a},${i},${t})`}const TR=({category:e,color:t})=>{const r="h-3.5 w-3.5 shrink-0",n={color:t};switch(e){case"completed":return s.jsx(kn,{className:r,style:n});case"started":return s.jsx(Ar,{className:r,style:n});default:return s.jsx(Er,{className:r,style:n})}};function IR({id:e,label:t,color:r,category:n,issues:a,childCounts:i,sortable:o,onIssueClick:l,onRename:c,onDelete:d,onUpdateCategory:u,isRenaming:f,renameValue:m,onRenameChange:p,onRenameSubmit:x,onRenameCancel:g}){const{setNodeRef:v,isOver:y}=nA({id:e}),{attributes:b,listeners:N,setNodeRef:j,transform:k,transition:w,isDragging:S}=sx({id:e,disabled:!o}),_=h.useRef(null),C=h.useRef(!1);h.useEffect(()=>{f&&(C.current=!1,setTimeout(()=>{var V;return(V=_.current)==null?void 0:V.focus()},0))},[f]);const P=o?{transform:ax.Transform.toString(k),transition:w}:void 0,O=Gc(r,.08),E=Gc(r,.16),D=Gc(r,.35),I=!!(c||d||u);return s.jsxs("div",{ref:j,style:P,className:z("flex flex-col min-w-[260px] max-w-[280px] w-full group/col",S&&"opacity-50"),children:[s.jsxs("div",{className:z("flex items-center gap-2 mb-2 px-1",o&&"cursor-grab"),children:[o&&s.jsx("span",{...b,...N,className:"text-muted-foreground/40 hover:text-muted-foreground touch-none",children:s.jsx(aN,{className:"h-3.5 w-3.5"})}),s.jsx(TR,{category:n,color:r}),f?s.jsx("input",{ref:_,value:m??"",onChange:V=>p==null?void 0:p(V.target.value),onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),x==null||x()),V.key==="Escape"&&(V.preventDefault(),C.current=!0,g==null||g())},onBlur:()=>{C.current||x==null||x()},className:"flex-1 text-xs font-medium bg-transparent border-b border-foreground/30 outline-none py-0.5 min-w-0"}):s.jsx("span",{className:"text-xs font-medium text-foreground",children:t}),s.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:Gc(r,.12),color:r},children:a.length}),I&&!f&&s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.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:V=>V.stopPropagation(),children:s.jsx(Ls,{className:"h-3.5 w-3.5"})})}),s.jsxs(Dr,{align:"end",className:"w-44",children:[c&&s.jsx(Je,{onClick:c,children:"Rename"}),u&&s.jsxs(jT,{children:[s.jsx(CN,{children:"Change category"}),s.jsx(_N,{children:DR.map(({value:V,label:Q})=>s.jsxs(Je,{onClick:()=>u(e,V),children:[Q,n===V&&s.jsx(Ct,{className:"ml-auto h-3 w-3"})]},V))})]}),d&&(c||u)&&s.jsx(_n,{}),d&&s.jsx(Je,{className:"text-destructive focus:text-destructive",onClick:d,children:"Delete status"})]})]})]}),s.jsxs("div",{ref:v,className:z("flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors"),style:{backgroundColor:y?E:O,boxShadow:y?`inset 0 0 0 1px ${D}`:void 0},children:[s.jsx(nx,{items:a.map(V=>V.id),strategy:sA,children:a.map(V=>s.jsx(Tk,{issue:V,childCount:(i==null?void 0:i.get(V.id))??0,onClick:()=>l==null?void 0:l(V)},V.id))}),a.length===0&&s.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:s.jsx("p",{className:"text-xs text-muted-foreground/40",children:"Drop here"})})]})]})}const Fm=["#94a3b8","#64748b","#6366f1","#f59e0b","#10b981","#ef4444","#3b82f6","#8b5cf6"],RR=[{value:"backlog",label:"Backlog"},{value:"unstarted",label:"Not Started"},{value:"started",label:"In Progress"},{value:"completed",label:"Done"},{value:"cancelled",label:"Cancelled"}];function $R({open:e,onClose:t,projectId:r}){const[n,a]=h.useState(""),[i,o]=h.useState(Fm[0]),[l,c]=h.useState(""),[d,u]=h.useState("started"),f=jR(r),m=l||i,p=()=>{n.trim()&&f.mutate({name:n.trim(),color:m,category:d},{onSuccess:()=>{F.success("Status created"),a(""),o(Fm[0]),c(""),u("started"),t()},onError:()=>F.error("Failed to create status")})};return s.jsx(Oi,{open:e,onOpenChange:x=>!x&&t(),children:s.jsxs(Ei,{className:"sm:max-w-sm",children:[s.jsx(Do,{children:s.jsx(Io,{className:"text-sm font-medium",children:"New Status"})}),s.jsx(To,{children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Name"}),s.jsx(_e,{placeholder:"e.g. In Review",value:n,onChange:x=>a(x.target.value),onKeyDown:x=>x.key==="Enter"&&p(),autoFocus:!0,className:"h-8 text-sm"})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Color"}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[Fm.map(x=>s.jsx("button",{onClick:()=>{o(x),c("")},className:z("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)),s.jsxs("div",{className:"flex items-center gap-1.5 ml-1",children:[s.jsx("div",{className:"h-6 w-6 rounded-full border border-border shrink-0",style:{backgroundColor:l||"#e5e7eb"}}),s.jsx(_e,{placeholder:"#hex",value:l,onChange:x=>c(x.target.value),className:"h-6 w-20 text-xs px-1.5"})]})]})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-xs text-muted-foreground mb-1.5",children:"Category"}),s.jsxs(Ue,{value:d,onValueChange:x=>u(x),children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:RR.map(x=>s.jsx(ke,{value:x.value,className:"text-xs",children:x.label},x.value))})]})]})]})}),s.jsxs(hc,{className:"mt-2",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:t,className:"text-xs",children:"Cancel"}),s.jsx(ee,{size:"sm",onClick:p,disabled:!n.trim()||f.isPending,className:"text-xs",children:"Create"})]})]})})}function zR({projectId:e}){const[t,r]=h.useState(!1);return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:s.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:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Add status"]})}),s.jsx($R,{open:t,onClose:()=>r(!1),projectId:e})]})}function LR({open:e,statusName:t,issueCount:r,otherStatuses:n,onConfirm:a,onCancel:i,isLoading:o}){const[l,c]=h.useState(""),d=()=>{r>0&&!l||a(r>0?l:null)};return s.jsx(mn,{open:e,onOpenChange:u=>{u||i()},children:s.jsxs(Zr,{className:"sm:max-w-md",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Delete status"}),s.jsx(Eo,{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&&s.jsxs("div",{className:"py-2",children:[s.jsx("label",{className:"text-sm font-medium mb-1.5 block",children:"Move issues to"}),s.jsxs(Ue,{value:l,onValueChange:c,children:[s.jsx(Le,{children:s.jsx(Ve,{placeholder:"Select a status..."})}),s.jsx(Fe,{children:n.map(u=>s.jsx(ke,{value:u.id,children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:u.color}}),u.name]})},u.id))})]})]}),s.jsxs(Oo,{children:[s.jsx(ee,{variant:"outline",onClick:i,disabled:o,children:"Cancel"}),s.jsx(ee,{variant:"destructive",onClick:d,disabled:r>0&&!l||o,children:o?"Deleting…":"Delete status"})]})]})})}var Bx={};(function e(t,r,n,a){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 T=new OffscreenCanvas(1,1),M=T.getContext("2d");M.fillRect(0,0,1,1);var L=T.transferToImageBitmap();M.createPattern(L,"no-repeat")}catch{return!1}return!0}();function c(){}function d(T){var M=r.exports.Promise,L=M!==void 0?M:t.Promise;return typeof L=="function"?new L(T):(T(c,c),null)}var u=function(T,M){return{transform:function(L){if(T)return L;if(M.has(L))return M.get(L);var H=new OffscreenCanvas(L.width,L.height),R=H.getContext("2d");return R.drawImage(L,0,0),M.set(L,H),H},clear:function(){M.clear()}}}(l,new Map),f=function(){var T=Math.floor(16.666666666666668),M,L,H={},R=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(M=function(Y){var J=Math.random();return H[J]=requestAnimationFrame(function A(U){R===U||R+T-1<U?(R=U,delete H[J],Y()):H[J]=requestAnimationFrame(A)}),J},L=function(Y){H[Y]&&cancelAnimationFrame(H[Y])}):(M=function(Y){return setTimeout(Y,T)},L=function(Y){return clearTimeout(Y)}),{frame:M,cancel:L}}(),m=function(){var T,M,L={};function H(R){function Y(J,A){R.postMessage({options:J||{},callback:A})}R.init=function(A){var U=A.transferControlToOffscreen();R.postMessage({canvas:U},[U])},R.fire=function(A,U,$){if(M)return Y(A,null),M;var ne=Math.random().toString(36).slice(2);return M=d(function(B){function X(oe){oe.data.callback===ne&&(delete L[ne],R.removeEventListener("message",X),M=null,u.clear(),$(),B())}R.addEventListener("message",X),Y(A,ne),L[ne]=X.bind(null,{data:{callback:ne}})}),M},R.reset=function(){R.postMessage({reset:!0});for(var A in L)L[A](),delete L[A]}}return function(){if(T)return T;if(!n&&i){var R=["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(`
587
+ `);try{T=new Worker(URL.createObjectURL(new Blob([R])))}catch(Y){return typeof console<"u"&&typeof console.warn=="function"&&console.warn("🎊 Could not load worker",Y),null}H(T)}return T}}(),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(T,M){return M?M(T):T}function g(T){return T!=null}function v(T,M,L){return x(T&&g(T[M])?T[M]:p[M],L)}function y(T){return T<0?0:Math.floor(T)}function b(T,M){return Math.floor(Math.random()*(M-T))+T}function N(T){return parseInt(T,16)}function j(T){return T.map(k)}function k(T){var M=String(T).replace(/[^0-9a-f]/gi,"");return M.length<6&&(M=M[0]+M[0]+M[1]+M[1]+M[2]+M[2]),{r:N(M.substring(0,2)),g:N(M.substring(2,4)),b:N(M.substring(4,6))}}function w(T){var M=v(T,"origin",Object);return M.x=v(M,"x",Number),M.y=v(M,"y",Number),M}function S(T){T.width=document.documentElement.clientWidth,T.height=document.documentElement.clientHeight}function _(T){var M=T.getBoundingClientRect();T.width=M.width,T.height=M.height}function C(T){var M=document.createElement("canvas");return M.style.position="fixed",M.style.top="0px",M.style.left="0px",M.style.pointerEvents="none",M.style.zIndex=T,M}function P(T,M,L,H,R,Y,J,A,U){T.save(),T.translate(M,L),T.rotate(Y),T.scale(H,R),T.arc(0,0,1,J,A,U),T.restore()}function O(T){var M=T.angle*(Math.PI/180),L=T.spread*(Math.PI/180);return{x:T.x,y:T.y,wobble:Math.random()*10,wobbleSpeed:Math.min(.11,Math.random()*.1+.05),velocity:T.startVelocity*.5+Math.random()*T.startVelocity,angle2D:-M+(.5*L-Math.random()*L),tiltAngle:(Math.random()*(.75-.25)+.25)*Math.PI,color:T.color,shape:T.shape,tick:0,totalTicks:T.ticks,decay:T.decay,drift:T.drift,random:Math.random()+2,tiltSin:0,tiltCos:0,wobbleX:0,wobbleY:0,gravity:T.gravity*3,ovalScalar:.6,scalar:T.scalar,flat:T.flat}}function E(T,M){M.x+=Math.cos(M.angle2D)*M.velocity+M.drift,M.y+=Math.sin(M.angle2D)*M.velocity+M.gravity,M.velocity*=M.decay,M.flat?(M.wobble=0,M.wobbleX=M.x+10*M.scalar,M.wobbleY=M.y+10*M.scalar,M.tiltSin=0,M.tiltCos=0,M.random=1):(M.wobble+=M.wobbleSpeed,M.wobbleX=M.x+10*M.scalar*Math.cos(M.wobble),M.wobbleY=M.y+10*M.scalar*Math.sin(M.wobble),M.tiltAngle+=.1,M.tiltSin=Math.sin(M.tiltAngle),M.tiltCos=Math.cos(M.tiltAngle),M.random=Math.random()+2);var L=M.tick++/M.totalTicks,H=M.x+M.random*M.tiltCos,R=M.y+M.random*M.tiltSin,Y=M.wobbleX+M.random*M.tiltCos,J=M.wobbleY+M.random*M.tiltSin;if(T.fillStyle="rgba("+M.color.r+", "+M.color.g+", "+M.color.b+", "+(1-L)+")",T.beginPath(),o&&M.shape.type==="path"&&typeof M.shape.path=="string"&&Array.isArray(M.shape.matrix))T.fill(q(M.shape.path,M.shape.matrix,M.x,M.y,Math.abs(Y-H)*.1,Math.abs(J-R)*.1,Math.PI/10*M.wobble));else if(M.shape.type==="bitmap"){var A=Math.PI/10*M.wobble,U=Math.abs(Y-H)*.1,$=Math.abs(J-R)*.1,ne=M.shape.bitmap.width*M.scalar,B=M.shape.bitmap.height*M.scalar,X=new DOMMatrix([Math.cos(A)*U,Math.sin(A)*U,-Math.sin(A)*$,Math.cos(A)*$,M.x,M.y]);X.multiplySelf(new DOMMatrix(M.shape.matrix));var oe=T.createPattern(u.transform(M.shape.bitmap),"no-repeat");oe.setTransform(X),T.globalAlpha=1-L,T.fillStyle=oe,T.fillRect(M.x-ne/2,M.y-B/2,ne,B),T.globalAlpha=1}else if(M.shape==="circle")T.ellipse?T.ellipse(M.x,M.y,Math.abs(Y-H)*M.ovalScalar,Math.abs(J-R)*M.ovalScalar,Math.PI/10*M.wobble,0,2*Math.PI):P(T,M.x,M.y,Math.abs(Y-H)*M.ovalScalar,Math.abs(J-R)*M.ovalScalar,Math.PI/10*M.wobble,0,2*Math.PI);else if(M.shape==="star")for(var G=Math.PI/2*3,te=4*M.scalar,de=8*M.scalar,me=M.x,Z=M.y,xe=5,be=Math.PI/xe;xe--;)me=M.x+Math.cos(G)*de,Z=M.y+Math.sin(G)*de,T.lineTo(me,Z),G+=be,me=M.x+Math.cos(G)*te,Z=M.y+Math.sin(G)*te,T.lineTo(me,Z),G+=be;else T.moveTo(Math.floor(M.x),Math.floor(M.y)),T.lineTo(Math.floor(M.wobbleX),Math.floor(R)),T.lineTo(Math.floor(Y),Math.floor(J)),T.lineTo(Math.floor(H),Math.floor(M.wobbleY));return T.closePath(),T.fill(),M.tick<M.totalTicks}function D(T,M,L,H,R){var Y=M.slice(),J=T.getContext("2d"),A,U,$=d(function(ne){function B(){A=U=null,J.clearRect(0,0,H.width,H.height),u.clear(),R(),ne()}function X(){n&&!(H.width===a.width&&H.height===a.height)&&(H.width=T.width=a.width,H.height=T.height=a.height),!H.width&&!H.height&&(L(T),H.width=T.width,H.height=T.height),J.clearRect(0,0,H.width,H.height),Y=Y.filter(function(oe){return E(J,oe)}),Y.length?A=f.frame(X):B()}A=f.frame(X),U=B});return{addFettis:function(ne){return Y=Y.concat(ne),$},canvas:T,promise:$,reset:function(){A&&f.cancel(A),U&&U()}}}function I(T,M){var L=!T,H=!!v(M||{},"resize"),R=!1,Y=v(M,"disableForReducedMotion",Boolean),J=i&&!!v(M||{},"useWorker"),A=J?m():null,U=L?S:_,$=T&&A?!!T.__confetti_initialized:!1,ne=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion)").matches,B;function X(G,te,de){for(var me=v(G,"particleCount",y),Z=v(G,"angle",Number),xe=v(G,"spread",Number),be=v(G,"startVelocity",Number),qe=v(G,"decay",Number),We=v(G,"gravity",Number),Ge=v(G,"drift",Number),ft=v(G,"colors",j),et=v(G,"ticks",Number),Ke=v(G,"shapes"),Ze=v(G,"scalar"),sr=!!v(G,"flat"),Lr=w(G),ar=me,wr=[],ir=T.width*Lr.x,jt=T.height*Lr.y;ar--;)wr.push(O({x:ir,y:jt,angle:Z,spread:xe,startVelocity:be,color:ft[ar%ft.length],shape:Ke[b(0,Ke.length)],ticks:et,decay:qe,gravity:We,drift:Ge,scalar:Ze,flat:sr}));return B?B.addFettis(wr):(B=D(T,wr,U,te,de),B.promise)}function oe(G){var te=Y||v(G,"disableForReducedMotion",Boolean),de=v(G,"zIndex",Number);if(te&&ne)return d(function(be){be()});L&&B?T=B.canvas:L&&!T&&(T=C(de),document.body.appendChild(T)),H&&!$&&U(T);var me={width:T.width,height:T.height};A&&!$&&A.init(T),$=!0,A&&(T.__confetti_initialized=!0);function Z(){if(A){var be={getBoundingClientRect:function(){if(!L)return T.getBoundingClientRect()}};U(be),A.postMessage({resize:{width:be.width,height:be.height}});return}me.width=me.height=null}function xe(){B=null,H&&(R=!1,t.removeEventListener("resize",Z)),L&&T&&(document.body.contains(T)&&document.body.removeChild(T),T=null,$=!1)}return H&&!R&&(R=!0,t.addEventListener("resize",Z,!1)),A?A.fire(G,me,xe):X(G,me,xe)}return oe.reset=function(){A&&A.reset(),B&&B.reset()},oe}var V;function Q(){return V||(V=I(null,{useWorker:!0,resize:!0})),V}function q(T,M,L,H,R,Y,J){var A=new Path2D(T),U=new Path2D;U.addPath(A,new DOMMatrix(M));var $=new Path2D;return $.addPath(U,new DOMMatrix([Math.cos(J)*R,Math.sin(J)*R,-Math.sin(J)*Y,Math.cos(J)*Y,L,H])),$}function re(T){if(!o)throw new Error("path confetti are not supported in this browser");var M,L;typeof T=="string"?M=T:(M=T.path,L=T.matrix);var H=new Path2D(M),R=document.createElement("canvas"),Y=R.getContext("2d");if(!L){for(var J=1e3,A=J,U=J,$=0,ne=0,B,X,oe=0;oe<J;oe+=2)for(var G=0;G<J;G+=2)Y.isPointInPath(H,oe,G,"nonzero")&&(A=Math.min(A,oe),U=Math.min(U,G),$=Math.max($,oe),ne=Math.max(ne,G));B=$-A,X=ne-U;var te=10,de=Math.min(te/B,te/X);L=[de,0,0,de,-Math.round(B/2+A)*de,-Math.round(X/2+U)*de]}return{type:"path",path:M,matrix:L}}function se(T){var M,L=1,H="#000000",R='"Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color", "Android Emoji", "Twemoji Mozilla", "system emoji", sans-serif';typeof T=="string"?M=T:(M=T.text,L="scalar"in T?T.scalar:L,R="fontFamily"in T?T.fontFamily:R,H="color"in T?T.color:H);var Y=10*L,J=""+Y+"px "+R,A=new OffscreenCanvas(Y,Y),U=A.getContext("2d");U.font=J;var $=U.measureText(M),ne=Math.ceil($.actualBoundingBoxRight+$.actualBoundingBoxLeft),B=Math.ceil($.actualBoundingBoxAscent+$.actualBoundingBoxDescent),X=2,oe=$.actualBoundingBoxLeft+X,G=$.actualBoundingBoxAscent+X;ne+=X+X,B+=X+X,A=new OffscreenCanvas(ne,B),U=A.getContext("2d"),U.font=J,U.fillStyle=H,U.fillText(M,oe,G);var te=1/L;return{type:"bitmap",bitmap:A.transferToImageBitmap(),matrix:[te,0,0,te,-ne*te/2,-B*te/2]}}r.exports=function(){return Q().apply(this,arguments)},r.exports.reset=function(){Q().reset()},r.exports.create=I,r.exports.shapeFromPath=re,r.exports.shapeFromText=se})(function(){return typeof window<"u"?window:typeof self<"u"?self:this||{}}(),Bx,!1);const FR=Bx.exports;Bx.exports.create;function Bm(e,t){var n;const r={};for(const a of t)r[a.key]=[];for(const a of e)if(r[a.status]!==void 0)r[a.status].push(a);else{const i=((n=t[0])==null?void 0:n.key)??"backlog";r[i]=[...r[i]??[],a]}return r}function BR(e,t,r){var i;const n=new Map(t.map(o=>[o.id,o])),a={};for(const o of r)a[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&&(a[o.key].push(c),n.delete(l.id))}for(const o of n.values()){const l=a[o.status];if(l)l.push(o);else{const c=(i=r[0])==null?void 0:i.key;c&&a[c].push(o)}}return a}function Ik({issues:e,projectId:t,statuses:r,onIssueClick:n,onColumnsReorder:a,readOnly:i=!1,filters:o}){var J;const[l,c]=h.useState(()=>r.map(A=>A.id)),[d,u]=h.useState(()=>Bm(e,r)),[f,m]=h.useState(null),[p,x]=h.useState(null),[g,v]=h.useState(null),[y,b]=h.useState(null),[N,j]=h.useState(""),k=h.useRef(null),w=h.useRef(!1),S=ye(),_=xt.byProject(t,o),C=NR(t),P=wR(t,y??""),O=ge({mutationFn:({statusId:A,category:U})=>ie.put(`/admin/projects/${t}/statuses/${A}`,{category:U}),onSuccess:()=>{S.invalidateQueries({queryKey:["projects",t,"statuses"]}),F.success("Category updated")},onError:()=>F.error("Failed to update category")}),E=h.useMemo(()=>{const A=new Map;for(const U of e)U.parent_id&&A.set(U.parent_id,(A.get(U.parent_id)??0)+1);return A},[e]);h.useEffect(()=>{c(A=>{const U=new Set(r.map(B=>B.id)),$=A.filter(B=>U.has(B)),ne=r.map(B=>B.id).filter(B=>!A.includes(B));return $.length===A.length&&ne.length===0?A:[...$,...ne]})},[r]),h.useEffect(()=>{w.current||u(A=>BR(A,e,r))},[e,r]);const D=[...r].sort((A,U)=>{const $=l.indexOf(A.id),ne=l.indexOf(U.id);return $===-1&&ne===-1?A.position-U.position:$===-1?1:ne===-1?-1:$-ne}),I=_1(rx(P1,i?{activationConstraint:{distance:1/0}}:{activationConstraint:{distance:5}})),V=h.useCallback(A=>{if(p){const $=A.droppableContainers.filter(ne=>l.includes(ne.id));return aA({...A,droppableContainers:$})}const U=iA(A);return U.length>0?U:oA(A)},[p,l]),Q=h.useCallback(A=>{for(const[U,$]of Object.entries(d))if($.some(ne=>ne.id===A))return U;return null},[d]),q=h.useCallback(A=>r.some(U=>U.id===A),[r]),re=A=>{const U=A.active.id;if(w.current=!0,q(U)){x(U);return}for(const[$,ne]of Object.entries(d)){const B=ne.find(X=>X.id===U);if(B){m(B),k.current=$;return}}},se=A=>{const{active:U,over:$}=A;if(!$||p)return;const ne=U.id,B=$.id;if(q(ne))return;const X=Q(ne),oe=r.find(te=>te.key===B||te.id===B),G=(oe==null?void 0:oe.key)??Q(B);!X||!G||X===G||u(te=>{const de=[...te[X]??[]],me=[...te[G]??[]],Z=de.findIndex(qe=>qe.id===ne);if(Z===-1)return te;const[xe]=de.splice(Z,1),be={...xe,status:G};if(oe)me.push(be);else{const qe=me.findIndex(We=>We.id===B);if(qe===-1)me.push(be);else{const We=U.rect.current.translated!=null&&U.rect.current.translated.top>$.rect.top+$.rect.height/2;me.splice(We?qe+1:qe,0,be)}}return{...te,[X]:de,[G]:me}})},T=A=>{var te;const{active:U,over:$}=A;if(m(null),p){if(x(null),w.current=!1,!$||U.id===$.id)return;const de=l.indexOf(U.id),me=l.indexOf($.id);if(de===-1||me===-1||de===me)return;const Z=wd(l,de,me);c(Z),a==null||a(Z);return}if(!$){w.current=!1;const de=k.current;k.current=null,de&&u(Bm(e,r));return}const ne=U.id,B=$.id,X=k.current;k.current=null;const oe=r.find(de=>de.key===B||de.id===B),G=(oe==null?void 0:oe.key)??Q(B);if(!X||!G){w.current=!1;return}if(X===G)w.current=!1,u(de=>{const me=de[X]??[],Z=me.findIndex(be=>be.id===ne),xe=me.findIndex(be=>be.id===B);return Z===-1||xe===-1||Z===xe?de:{...de,[X]:wd(me,Z,xe)}});else{if(!r.find(Z=>Z.key===B||Z.id===B))u(Z=>{const xe=[...Z[G]??[]],be=xe.findIndex(et=>et.id===ne);if(be===-1)return Z;const qe=A.active.rect.current.translated!=null&&A.active.rect.current.translated.top>A.over.rect.top+A.over.rect.height/2,[We]=xe.splice(be,1),Ge=xe.findIndex(et=>et.id===B);if(Ge===-1)return xe.splice(be,0,We),Z;const ft=qe?Ge+1:Ge;return xe.splice(ft,0,We),{...Z,[G]:xe}});else{const Z=((te=A.active.rect.current.translated)==null?void 0:te.top)??1/0,xe=A.over.rect.top+A.over.rect.height/2;Z<xe&&u(be=>{const qe=be[G]??[],We=qe.findIndex(Ge=>Ge.id===ne);return We<=0?be:{...be,[G]:wd(qe,We,0)}})}const me=S.getQueryData(_);S.cancelQueries({queryKey:_}),S.setQueryData(_,Z=>Z&&{...Z,issues:Z.issues.map(xe=>xe.id===ne?{...xe,status:G}:xe)}),ie.put(`/admin/issues/${ne}`,{status:G}).then(()=>{w.current=!1,S.invalidateQueries({queryKey:_});const Z=r.find(xe=>xe.key===G);(Z==null?void 0:Z.category)==="completed"&&FR({particleCount:80,spread:60,origin:{y:.6}})}).catch(()=>{w.current=!1,me&&S.setQueryData(_,me),u(Bm((me==null?void 0:me.issues)??e,r)),F.error("Failed to update issue status")})}},M=A=>{v(A)},L=async A=>{if(!g)return;const U=d[g.key]??[];if(U.length>0){const $=r.find(ne=>ne.id===A);if(!$)return;try{await Promise.all(U.map(ne=>ie.put(`/admin/issues/${ne.id}`,{status:$.key}))),S.invalidateQueries({queryKey:xt.byProject(t)})}catch{F.error("Failed to move issues");return}}C.mutate(g.id,{onSuccess:()=>{F.success(`Status "${g.name}" deleted`),v(null)},onError:()=>F.error("Failed to delete status")})},H=()=>{const A=N.trim();!A||!y||P.mutate({name:A},{onSuccess:()=>{F.success("Status renamed"),b(null)},onError:()=>F.error("Failed to rename status")})},R=()=>{b(null)},Y=p?r.find(A=>A.id===p):null;return s.jsxs(_l,{sensors:I,collisionDetection:V,onDragStart:re,onDragOver:se,onDragEnd:T,children:[s.jsxs("div",{className:"flex gap-4 min-h-full overflow-x-auto px-6 py-4 pb-6",children:[s.jsx(nx,{items:l,strategy:M1,children:D.map(A=>s.jsx(IR,{id:A.id,label:A.name,color:A.color,category:A.category,issues:d[A.key]??[],childCounts:E,sortable:!0,onIssueClick:n,onRename:i?void 0:()=>{b(A.id),j(A.name)},onDelete:i?void 0:()=>M(A),onUpdateCategory:i?void 0:(U,$)=>O.mutate({statusId:U,category:$}),isRenaming:y===A.id,renameValue:y===A.id?N:"",onRenameChange:j,onRenameSubmit:H,onRenameCancel:R},A.id))}),!i&&s.jsx(zR,{projectId:t})]}),s.jsxs(lA,{children:[f&&s.jsx(Tk,{issue:f}),Y&&s.jsx("div",{className:"opacity-80 min-w-[260px] max-w-[280px]",children:s.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:[s.jsx("div",{className:"h-3 w-3 rounded-full shrink-0",style:{backgroundColor:Y.color}}),Y.name]})})]}),g&&s.jsx(LR,{open:!!g,statusName:g.name,issueCount:((J=d[g.key])==null?void 0:J.length)??0,otherStatuses:r.filter(A=>A.id!==g.id),onConfirm:L,onCancel:()=>v(null),isLoading:C.isPending})]})}const qR=[{value:"urgent",label:"Urgent"},{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"},{value:"none",label:"None"}],WR=[{value:"bug",label:"Bug"},{value:"feature",label:"Feature"},{value:"task",label:"Task"},{value:"epic",label:"Epic"},{value:"story",label:"Story"}];function Vc({label:e,activeCount:t,children:r}){const[n,a]=h.useState(!1);return s.jsxs(Tt,{open:n,onOpenChange:a,children:[s.jsx(It,{asChild:!0,children:s.jsxs("button",{className:z("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&&s.jsx("span",{className:"flex items-center justify-center h-4 w-4 rounded-full bg-foreground text-background text-[10px] font-semibold",children:t}),s.jsx(Zs,{className:"h-3 w-3 opacity-60"})]})}),s.jsx(_t,{className:"w-48 p-1",align:"start",children:r})]})}function qm({options:e,selected:t,onToggle:r}){return s.jsx("div",{className:"flex flex-col gap-0.5",children:e.map(n=>{const a=t.includes(n.value);return s.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:[s.jsx("div",{className:z("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",a?"bg-foreground border-foreground":"border-border"),children:a&&s.jsx(Ct,{className:"h-2.5 w-2.5 text-background"})}),n.color&&s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:n.color}}),s.jsx("span",{className:"truncate",children:n.label})]},n.value)})})}function UR({statuses:e,members:t,filters:r,onChange:n}){var c,d,u,f,m,p,x;const a=(((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]??[],b=y.includes(v)?y.filter(N=>N!==v):[...y,v];n({...r,[g]:b.length?b: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 s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Vc,{label:r.assignee_id?l:"Assignee",activeCount:r.assignee_id?1:0,children:s.jsxs("div",{className:"flex flex-col gap-0.5",children:[t.length===0&&s.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 s.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:[s.jsx("div",{className:z("h-3.5 w-3.5 rounded border flex items-center justify-center shrink-0",v?"bg-foreground border-foreground":"border-border"),children:v&&s.jsx(Ct,{className:"h-2.5 w-2.5 text-background"})}),s.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}),s.jsx("span",{className:"truncate",children:g.name})]},g.userId)})]})}),s.jsx(Vc,{label:"Priority",activeCount:((m=r.priority)==null?void 0:m.length)??0,children:s.jsx(qm,{options:qR,selected:r.priority??[],onToggle:g=>i("priority",g)})}),s.jsx(Vc,{label:"Type",activeCount:((p=r.type)==null?void 0:p.length)??0,children:s.jsx(qm,{options:WR,selected:r.type??[],onToggle:g=>i("type",g)})}),s.jsx(Vc,{label:"Status",activeCount:((x=r.status)==null?void 0:x.length)??0,children:s.jsx(qm,{options:e.map(g=>({value:g.key,label:g.name,color:g.color})),selected:r.status??[],onToggle:g=>i("status",g)})}),a&&s.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:[s.jsx(Be,{className:"h-3 w-3"}),"Clear"]})]})}const HR={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function qx(){return Te({queryKey:["org","calendar"],queryFn:()=>ie.get("/admin/org/calendar"),select:e=>({working_days:e.working_days??HR,timezone:e.timezone})})}function KR(){const e=ye();return ge({mutationFn:t=>ie.put("/admin/org/calendar",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","calendar"]})}})}function Wx(e){const t=e??new Date().getFullYear();return Te({queryKey:["org","holidays",t],queryFn:()=>ie.get(`/admin/org/holidays?year=${t}`),select:r=>r.holidays})}function YR(){const e=ye();return ge({mutationFn:t=>ie.post("/admin/org/holidays",t),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function GR(){const e=ye();return ge({mutationFn:({id:t,...r})=>ie.put(`/admin/org/holidays/${t}`,r),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function VR(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/org/holidays/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:["org","holidays"]})}})}function Rk(){return Te({queryKey:["app-config"],queryFn:()=>ie.get("/admin/config"),staleTime:1/0})}const XR=["sun","mon","tue","wed","thu","fri","sat"];function QR(e,t,r){const n=XR[dR(e)];if(!t[n])return!1;const a=kd(e),i=Pl(e);for(const o of r){const l=new Date(o.date);if(o.recurring){if(kd(l)===a&&Pl(l)===i)return!1}else if(l.getFullYear()===e.getFullYear()&&kd(l)===a&&Pl(l)===i)return!1}return!0}function qh(e,t,r,n){let a=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;)QR(i,r,n)&&a++,i=Yr(i,1);return a}const lo={all:["sprints"],byProject:e=>["sprints","project",e],detail:e=>["sprints",e]};function zo(e){return Te({queryKey:e?lo.byProject(e):lo.all,queryFn:()=>{const t=e?`/admin/sprints?project_id=${e}`:"/admin/sprints";return ie.get(t)},select:t=>t.sprints,enabled:!!e})}function ZR(e){const t=ye();return ge({mutationFn:r=>ie.post("/admin/sprints",{...r,project_id:e}),onSuccess:()=>{t.invalidateQueries({queryKey:lo.byProject(e)})}})}function JR(e,t){const r=ye();return ge({mutationFn:n=>ie.put(`/admin/sprints/${e}`,n),onSuccess:()=>{r.invalidateQueries({queryKey:lo.byProject(t)}),r.invalidateQueries({queryKey:lo.detail(e)})}})}function e$(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/sprints/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:lo.byProject(e)})}})}const hf={byProject:e=>["task-lists","project",e]};function vc(e){return Te({queryKey:e?hf.byProject(e):["task-lists"],queryFn:()=>ie.get(`/admin/projects/${e}/task-lists`),select:t=>t.task_lists,enabled:!!e})}function t$(e){const t=ye();return ge({mutationFn:r=>ie.post(`/admin/projects/${e}/task-lists`,r),onSuccess:()=>{t.invalidateQueries({queryKey:hf.byProject(e)})}})}function r$(e){const t=ye();return ge({mutationFn:({id:r,...n})=>ie.put(`/admin/task-lists/${r}`,n),onSuccess:()=>{t.invalidateQueries({queryKey:hf.byProject(e)})}})}function n$(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/task-lists/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:hf.byProject(e)}),t.invalidateQueries({queryKey:xt.byProject(e)})}})}function Ry(e,t,r){const n=(e==null?void 0:e[0])??"",a=(t==null?void 0:t[0])??"";return(n+a).toUpperCase()||((r==null?void 0:r[0])??"U").toUpperCase()}function $y(e,t,r){return`${e??""} ${t??""}`.trim()||r}function yc({value:e,onChange:t,disabled:r,users:n,emptyLabel:a="Assign"}){const[i,o]=h.useState(!1),[l,c]=h.useState(e),{data:d}=Dk(),u=n??d??[],f=e.slice().sort().join(",");h.useEffect(()=>{c(e)},[f]);const m=x=>{const g=l.includes(x)?l.filter(v=>v!==x):[...l,x];c(g),t(g)},p=u.filter(x=>l.includes(x.id));return s.jsxs(Tt,{open:i,onOpenChange:o,children:[s.jsx(It,{asChild:!0,disabled:r,children:s.jsx("button",{type:"button",className:z("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:p.length===0?s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(Nn,{className:"h-3.5 w-3.5"}),a]}):s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("div",{className:"flex -space-x-1.5",children:p.slice(0,3).map(x=>s.jsx(Pt,{className:"h-5 w-5 border border-background ring-0",children:s.jsx(Mt,{className:"text-[9px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:Ry(x.first_name,x.last_name,x.email)})},x.id))}),p.length>3&&s.jsxs("span",{className:"text-[10px] text-muted-foreground ml-1",children:["+",p.length-3]}),s.jsx("span",{className:"text-xs text-foreground ml-1 hidden sm:inline",children:p.length===1?$y(p[0].first_name,p[0].last_name,p[0].email):`${p.length} assignees`})]})})}),s.jsx(_t,{className:"w-60 p-0",align:"start",children:s.jsxs(ya,{children:[s.jsx(dc,{placeholder:"Search users...",className:"h-8 text-xs"}),s.jsxs(ba,{children:[s.jsx(uc,{className:"text-xs py-4",children:"No users found."}),s.jsx(Ts,{children:u.map(x=>{const g=l.includes(x.id),v=$y(x.first_name,x.last_name,x.email),y=Ry(x.first_name,x.last_name,x.email);return s.jsxs(an,{value:v,onSelect:()=>m(x.id),className:"gap-2 py-1.5",children:[s.jsx(Pt,{className:"h-5 w-5 shrink-0",children:s.jsx(Mt,{className:"text-[9px] bg-muted text-muted-foreground",children:y})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs font-medium truncate",children:v}),s.jsx("p",{className:"text-[10px] text-muted-foreground truncate",children:x.email})]}),s.jsx(Ct,{className:z("h-3.5 w-3.5 shrink-0",g?"opacity-100 text-indigo-500":"opacity-0")})]},x.id)})})]})]})})]})}const s$=sc("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 s.jsx("div",{className:z(s$({variant:t}),e),...r})}function co({value:e,onChange:t,projectId:r,excludeId:n,disabled:a,emptyLabel:i="None"}){const[o,l]=h.useState(!1),[c,d]=h.useState(e),{data:u=[]}=Yu(r),{workspace:f,projectKey:m}=Et(),p=e.slice().sort().join(",");h.useEffect(()=>{d(e)},[p]);const x=u.filter(N=>N.id!==n),g=x.filter(N=>c.includes(N.id)),v=N=>{const j=c.includes(N)?c.filter(k=>k!==N):[...c,N];d(j),t(j)},y=(N,j)=>{N.stopPropagation();const k=c.filter(w=>w!==j);d(k),t(k)},b=(N,j)=>{N.stopPropagation(),f&&m&&window.open(`/${f}/projects/${m}/issues/${j}`,"_blank")};return s.jsxs(Tt,{open:o,onOpenChange:l,children:[s.jsx(It,{asChild:!0,disabled:a,children:s.jsx("button",{type:"button",className:z("flex flex-wrap items-center gap-1 min-h-[28px] w-full rounded-md px-1 py-1","transition-colors text-left",g.length===0&&"hover:bg-accent","focus:outline-none focus-visible:ring-1 focus-visible:ring-ring",a&&"pointer-events-none opacity-50"),children:g.length===0?s.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[s.jsx(Ea,{className:"h-3.5 w-3.5"}),i]}):s.jsx("div",{className:"flex flex-wrap gap-1",children:g.map(N=>s.jsxs(Pn,{variant:"secondary",className:"text-[10px] h-5 px-1.5 gap-1 font-normal max-w-[160px] hover:bg-indigo-100 dark:hover:bg-indigo-900/40 transition-colors",children:[s.jsxs("span",{role:"button",tabIndex:0,onClick:j=>b(j,N.id),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&b(j,N.id)},className:"flex items-center gap-1 min-w-0 cursor-pointer hover:text-foreground transition-colors",children:[s.jsx("span",{className:"font-mono text-muted-foreground shrink-0",children:N.identifier}),s.jsx("span",{className:"truncate",children:N.title})]}),s.jsx("span",{role:"button",tabIndex:0,onClick:j=>y(j,N.id),onKeyDown:j=>{(j.key==="Enter"||j.key===" ")&&y(j,N.id)},className:"ml-0.5 hover:text-destructive transition-colors cursor-pointer shrink-0",children:s.jsx(Be,{className:"h-2.5 w-2.5"})})]},N.id))})})}),s.jsx(_t,{className:"w-72 p-0",align:"start",children:s.jsxs(ya,{children:[s.jsx(dc,{placeholder:"Search issues...",className:"h-8 text-xs"}),s.jsxs(ba,{children:[s.jsx(uc,{className:"text-xs py-4",children:"No issues found."}),s.jsx(Ts,{children:x.map(N=>{const j=c.includes(N.id);return s.jsxs(an,{value:`${N.identifier} ${N.title}`,onSelect:()=>v(N.id),className:"gap-2 py-1.5",children:[s.jsx("div",{className:"flex-1 min-w-0",children:s.jsxs("p",{className:"text-xs truncate",children:[s.jsx("span",{className:"font-mono text-muted-foreground mr-1.5",children:N.identifier}),N.title]})}),s.jsx(Ct,{className:z("h-3.5 w-3.5 shrink-0",j?"opacity-100 text-indigo-500":"opacity-0")})]},N.id)})})]})]})})]})}/*! @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:$k,setPrototypeOf:zy,isFrozen:a$,getPrototypeOf:i$,getOwnPropertyDescriptor:o$}=Object;let{freeze:Tr,seal:Mn,create:Wh}=Object,{apply:Uh,construct:Hh}=typeof Reflect<"u"&&Reflect;Tr||(Tr=function(t){return t});Mn||(Mn=function(t){return t});Uh||(Uh=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];return t.apply(r,a)});Hh||(Hh=function(t){for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return new t(...n)});const Xc=Ir(Array.prototype.forEach),l$=Ir(Array.prototype.lastIndexOf),Ly=Ir(Array.prototype.pop),ol=Ir(Array.prototype.push),c$=Ir(Array.prototype.splice),Sd=Ir(String.prototype.toLowerCase),Wm=Ir(String.prototype.toString),Um=Ir(String.prototype.match),ll=Ir(String.prototype.replace),d$=Ir(String.prototype.indexOf),u$=Ir(String.prototype.trim),$n=Ir(Object.prototype.hasOwnProperty),kr=Ir(RegExp.prototype.test),cl=f$(TypeError);function Ir(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var r=arguments.length,n=new Array(r>1?r-1:0),a=1;a<r;a++)n[a-1]=arguments[a];return Uh(e,t,n)}}function f$(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return Hh(e,r)}}function ze(e,t){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Sd;zy&&zy(e,null);let n=t.length;for(;n--;){let a=t[n];if(typeof a=="string"){const i=r(a);i!==a&&(a$(t)||(t[n]=i),a=i)}e[a]=!0}return e}function m$(e){for(let t=0;t<e.length;t++)$n(e,t)||(e[t]=null);return e}function rs(e){const t=Wh(null);for(const[r,n]of $k(e))$n(e,r)&&(Array.isArray(n)?t[r]=m$(n):n&&typeof n=="object"&&n.constructor===Object?t[r]=rs(n):t[r]=n);return t}function dl(e,t){for(;e!==null;){const n=o$(e,t);if(n){if(n.get)return Ir(n.get);if(typeof n.value=="function")return Ir(n.value)}e=i$(e)}function r(){return null}return r}const Fy=Tr(["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"]),Hm=Tr(["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"]),Km=Tr(["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"]),h$=Tr(["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"]),Ym=Tr(["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"]),p$=Tr(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),By=Tr(["#text"]),qy=Tr(["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"]),Gm=Tr(["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"]),Wy=Tr(["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"]),Qc=Tr(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),x$=Mn(/\{\{[\w\W]*|[\w\W]*\}\}/gm),g$=Mn(/<%[\w\W]*|[\w\W]*%>/gm),v$=Mn(/\$\{[\w\W]*/gm),y$=Mn(/^data-[\-\w.\u00B7-\uFFFF]+$/),b$=Mn(/^aria-[\-\w]+$/),zk=Mn(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),j$=Mn(/^(?:\w+script|data):/i),w$=Mn(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Lk=Mn(/^html$/i),N$=Mn(/^[a-z][.\w]*(-[.\w]+)+$/i);var Uy=Object.freeze({__proto__:null,ARIA_ATTR:b$,ATTR_WHITESPACE:w$,CUSTOM_ELEMENT:N$,DATA_ATTR:y$,DOCTYPE_NAME:Lk,ERB_EXPR:g$,IS_ALLOWED_URI:zk,IS_SCRIPT_OR_DATA:j$,MUSTACHE_EXPR:x$,TMPLIT_EXPR:v$});const ul={element:1,text:3,progressingInstruction:7,comment:8,document:9},k$=function(){return typeof window>"u"?null:window},S$=function(t,r){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null;const a="data-tt-policy-suffix";r&&r.hasAttribute(a)&&(n=r.getAttribute(a));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}},Hy=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Fk(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:k$();const t=Ee=>Fk(Ee);if(t.version="3.3.1",t.removed=[],!e||!e.document||e.document.nodeType!==ul.document||!e.Element)return t.isSupported=!1,t;let{document:r}=e;const n=r,a=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=dl(x,"cloneNode"),v=dl(x,"remove"),y=dl(x,"nextSibling"),b=dl(x,"childNodes"),N=dl(x,"parentNode");if(typeof o=="function"){const Ee=r.createElement("template");Ee.content&&Ee.content.ownerDocument&&(r=Ee.content.ownerDocument)}let j,k="";const{implementation:w,createNodeIterator:S,createDocumentFragment:_,getElementsByTagName:C}=r,{importNode:P}=n;let O=Hy();t.isSupported=typeof $k=="function"&&typeof N=="function"&&w&&w.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:E,ERB_EXPR:D,TMPLIT_EXPR:I,DATA_ATTR:V,ARIA_ATTR:Q,IS_SCRIPT_OR_DATA:q,ATTR_WHITESPACE:re,CUSTOM_ELEMENT:se}=Uy;let{IS_ALLOWED_URI:T}=Uy,M=null;const L=ze({},[...Fy,...Hm,...Km,...Ym,...By]);let H=null;const R=ze({},[...qy,...Gm,...Wy,...Qc]);let Y=Object.seal(Wh(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}})),J=null,A=null;const U=Object.seal(Wh(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $=!0,ne=!0,B=!1,X=!0,oe=!1,G=!0,te=!1,de=!1,me=!1,Z=!1,xe=!1,be=!1,qe=!0,We=!1;const Ge="user-content-";let ft=!0,et=!1,Ke={},Ze=null;const sr=ze({},["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 Lr=null;const ar=ze({},["audio","video","img","source","image","track"]);let wr=null;const ir=ze({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),jt="http://www.w3.org/1998/Math/MathML",qt="http://www.w3.org/2000/svg",Vt="http://www.w3.org/1999/xhtml";let or=Vt,Xn=!1,bs=null;const Oe=ze({},[jt,qt,Vt],Wm);let ve=ze({},["mi","mo","mn","ms","mtext"]),Ne=ze({},["annotation-xml"]);const pe=ze({},["title","style","font","a","script"]);let je=null;const Xe=["application/xhtml+xml","text/html"],ue="text/html";let Pe=null,Ie=null;const wt=r.createElement("form"),nt=function(K){return K instanceof RegExp||K instanceof Function},st=function(){let K=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ie&&Ie===K)){if((!K||typeof K!="object")&&(K={}),K=rs(K),je=Xe.indexOf(K.PARSER_MEDIA_TYPE)===-1?ue:K.PARSER_MEDIA_TYPE,Pe=je==="application/xhtml+xml"?Wm:Sd,M=$n(K,"ALLOWED_TAGS")?ze({},K.ALLOWED_TAGS,Pe):L,H=$n(K,"ALLOWED_ATTR")?ze({},K.ALLOWED_ATTR,Pe):R,bs=$n(K,"ALLOWED_NAMESPACES")?ze({},K.ALLOWED_NAMESPACES,Wm):Oe,wr=$n(K,"ADD_URI_SAFE_ATTR")?ze(rs(ir),K.ADD_URI_SAFE_ATTR,Pe):ir,Lr=$n(K,"ADD_DATA_URI_TAGS")?ze(rs(ar),K.ADD_DATA_URI_TAGS,Pe):ar,Ze=$n(K,"FORBID_CONTENTS")?ze({},K.FORBID_CONTENTS,Pe):sr,J=$n(K,"FORBID_TAGS")?ze({},K.FORBID_TAGS,Pe):rs({}),A=$n(K,"FORBID_ATTR")?ze({},K.FORBID_ATTR,Pe):rs({}),Ke=$n(K,"USE_PROFILES")?K.USE_PROFILES:!1,$=K.ALLOW_ARIA_ATTR!==!1,ne=K.ALLOW_DATA_ATTR!==!1,B=K.ALLOW_UNKNOWN_PROTOCOLS||!1,X=K.ALLOW_SELF_CLOSE_IN_ATTR!==!1,oe=K.SAFE_FOR_TEMPLATES||!1,G=K.SAFE_FOR_XML!==!1,te=K.WHOLE_DOCUMENT||!1,Z=K.RETURN_DOM||!1,xe=K.RETURN_DOM_FRAGMENT||!1,be=K.RETURN_TRUSTED_TYPE||!1,me=K.FORCE_BODY||!1,qe=K.SANITIZE_DOM!==!1,We=K.SANITIZE_NAMED_PROPS||!1,ft=K.KEEP_CONTENT!==!1,et=K.IN_PLACE||!1,T=K.ALLOWED_URI_REGEXP||zk,or=K.NAMESPACE||Vt,ve=K.MATHML_TEXT_INTEGRATION_POINTS||ve,Ne=K.HTML_INTEGRATION_POINTS||Ne,Y=K.CUSTOM_ELEMENT_HANDLING||{},K.CUSTOM_ELEMENT_HANDLING&&nt(K.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=K.CUSTOM_ELEMENT_HANDLING.tagNameCheck),K.CUSTOM_ELEMENT_HANDLING&&nt(K.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=K.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),K.CUSTOM_ELEMENT_HANDLING&&typeof K.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=K.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),oe&&(ne=!1),xe&&(Z=!0),Ke&&(M=ze({},By),H=[],Ke.html===!0&&(ze(M,Fy),ze(H,qy)),Ke.svg===!0&&(ze(M,Hm),ze(H,Gm),ze(H,Qc)),Ke.svgFilters===!0&&(ze(M,Km),ze(H,Gm),ze(H,Qc)),Ke.mathMl===!0&&(ze(M,Ym),ze(H,Wy),ze(H,Qc))),K.ADD_TAGS&&(typeof K.ADD_TAGS=="function"?U.tagCheck=K.ADD_TAGS:(M===L&&(M=rs(M)),ze(M,K.ADD_TAGS,Pe))),K.ADD_ATTR&&(typeof K.ADD_ATTR=="function"?U.attributeCheck=K.ADD_ATTR:(H===R&&(H=rs(H)),ze(H,K.ADD_ATTR,Pe))),K.ADD_URI_SAFE_ATTR&&ze(wr,K.ADD_URI_SAFE_ATTR,Pe),K.FORBID_CONTENTS&&(Ze===sr&&(Ze=rs(Ze)),ze(Ze,K.FORBID_CONTENTS,Pe)),K.ADD_FORBID_CONTENTS&&(Ze===sr&&(Ze=rs(Ze)),ze(Ze,K.ADD_FORBID_CONTENTS,Pe)),ft&&(M["#text"]=!0),te&&ze(M,["html","head","body"]),M.table&&(ze(M,["tbody"]),delete J.tbody),K.TRUSTED_TYPES_POLICY){if(typeof K.TRUSTED_TYPES_POLICY.createHTML!="function")throw cl('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof K.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw cl('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');j=K.TRUSTED_TYPES_POLICY,k=j.createHTML("")}else j===void 0&&(j=S$(p,a)),j!==null&&typeof k=="string"&&(k=j.createHTML(""));Tr&&Tr(K),Ie=K}},Nr=ze({},[...Hm,...Km,...h$]),lr=ze({},[...Ym,...p$]),Qn=function(K){let he=N(K);(!he||!he.tagName)&&(he={namespaceURI:or,tagName:"template"});const Se=Sd(K.tagName),gt=Sd(he.tagName);return bs[K.namespaceURI]?K.namespaceURI===qt?he.namespaceURI===Vt?Se==="svg":he.namespaceURI===jt?Se==="svg"&&(gt==="annotation-xml"||ve[gt]):!!Nr[Se]:K.namespaceURI===jt?he.namespaceURI===Vt?Se==="math":he.namespaceURI===qt?Se==="math"&&Ne[gt]:!!lr[Se]:K.namespaceURI===Vt?he.namespaceURI===qt&&!Ne[gt]||he.namespaceURI===jt&&!ve[gt]?!1:!lr[Se]&&(pe[Se]||!Nr[Se]):!!(je==="application/xhtml+xml"&&bs[K.namespaceURI]):!1},Zn=function(K){ol(t.removed,{element:K});try{N(K).removeChild(K)}catch{v(K)}},Wa=function(K,he){try{ol(t.removed,{attribute:he.getAttributeNode(K),from:he})}catch{ol(t.removed,{attribute:null,from:he})}if(he.removeAttribute(K),K==="is")if(Z||xe)try{Zn(he)}catch{}else try{he.setAttribute(K,"")}catch{}},Yv=function(K){let he=null,Se=null;if(me)K="<remove></remove>"+K;else{const zt=Um(K,/^[\r\n\t ]+/);Se=zt&&zt[0]}je==="application/xhtml+xml"&&or===Vt&&(K='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+K+"</body></html>");const gt=j?j.createHTML(K):K;if(or===Vt)try{he=new m().parseFromString(gt,je)}catch{}if(!he||!he.documentElement){he=w.createDocument(or,"template",null);try{he.documentElement.innerHTML=Xn?k:gt}catch{}}const xr=he.body||he.documentElement;return K&&Se&&xr.insertBefore(r.createTextNode(Se),xr.childNodes[0]||null),or===Vt?C.call(he,te?"html":"body")[0]:te?he.documentElement:xr},Gv=function(K){return S.call(K.ownerDocument||K,K,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},km=function(K){return K instanceof f&&(typeof K.nodeName!="string"||typeof K.textContent!="string"||typeof K.removeChild!="function"||!(K.attributes instanceof u)||typeof K.removeAttribute!="function"||typeof K.setAttribute!="function"||typeof K.namespaceURI!="string"||typeof K.insertBefore!="function"||typeof K.hasChildNodes!="function")},Vv=function(K){return typeof l=="function"&&K instanceof l};function js(Ee,K,he){Xc(Ee,Se=>{Se.call(t,K,he,Ie)})}const Xv=function(K){let he=null;if(js(O.beforeSanitizeElements,K,null),km(K))return Zn(K),!0;const Se=Pe(K.nodeName);if(js(O.uponSanitizeElement,K,{tagName:Se,allowedTags:M}),G&&K.hasChildNodes()&&!Vv(K.firstElementChild)&&kr(/<[/\w!]/g,K.innerHTML)&&kr(/<[/\w!]/g,K.textContent)||K.nodeType===ul.progressingInstruction||G&&K.nodeType===ul.comment&&kr(/<[/\w]/g,K.data))return Zn(K),!0;if(!(U.tagCheck instanceof Function&&U.tagCheck(Se))&&(!M[Se]||J[Se])){if(!J[Se]&&Zv(Se)&&(Y.tagNameCheck instanceof RegExp&&kr(Y.tagNameCheck,Se)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Se)))return!1;if(ft&&!Ze[Se]){const gt=N(K)||K.parentNode,xr=b(K)||K.childNodes;if(xr&&gt){const zt=xr.length;for(let Fr=zt-1;Fr>=0;--Fr){const ws=g(xr[Fr],!0);ws.__removalCount=(K.__removalCount||0)+1,gt.insertBefore(ws,y(K))}}}return Zn(K),!0}return K instanceof c&&!Qn(K)||(Se==="noscript"||Se==="noembed"||Se==="noframes")&&kr(/<\/no(script|embed|frames)/i,K.innerHTML)?(Zn(K),!0):(oe&&K.nodeType===ul.text&&(he=K.textContent,Xc([E,D,I],gt=>{he=ll(he,gt," ")}),K.textContent!==he&&(ol(t.removed,{element:K.cloneNode()}),K.textContent=he)),js(O.afterSanitizeElements,K,null),!1)},Qv=function(K,he,Se){if(qe&&(he==="id"||he==="name")&&(Se in r||Se in wt))return!1;if(!(ne&&!A[he]&&kr(V,he))){if(!($&&kr(Q,he))){if(!(U.attributeCheck instanceof Function&&U.attributeCheck(he,K))){if(!H[he]||A[he]){if(!(Zv(K)&&(Y.tagNameCheck instanceof RegExp&&kr(Y.tagNameCheck,K)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(K))&&(Y.attributeNameCheck instanceof RegExp&&kr(Y.attributeNameCheck,he)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(he,K))||he==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&kr(Y.tagNameCheck,Se)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(Se))))return!1}else if(!wr[he]){if(!kr(T,ll(Se,re,""))){if(!((he==="src"||he==="xlink:href"||he==="href")&&K!=="script"&&d$(Se,"data:")===0&&Lr[K])){if(!(B&&!kr(q,ll(Se,re,"")))){if(Se)return!1}}}}}}}return!0},Zv=function(K){return K!=="annotation-xml"&&Um(K,se)},Jv=function(K){js(O.beforeSanitizeAttributes,K,null);const{attributes:he}=K;if(!he||km(K))return;const Se={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0};let gt=he.length;for(;gt--;){const xr=he[gt],{name:zt,namespaceURI:Fr,value:ws}=xr,$i=Pe(zt),Sm=ws;let cr=zt==="value"?Sm:u$(Sm);if(Se.attrName=$i,Se.attrValue=cr,Se.keepAttr=!0,Se.forceKeepAttr=void 0,js(O.uponSanitizeAttribute,K,Se),cr=Se.attrValue,We&&($i==="id"||$i==="name")&&(Wa(zt,K),cr=Ge+cr),G&&kr(/((--!?|])>)|<\/(style|title|textarea)/i,cr)){Wa(zt,K);continue}if($i==="attributename"&&Um(cr,"href")){Wa(zt,K);continue}if(Se.forceKeepAttr)continue;if(!Se.keepAttr){Wa(zt,K);continue}if(!X&&kr(/\/>/i,cr)){Wa(zt,K);continue}oe&&Xc([E,D,I],ty=>{cr=ll(cr,ty," ")});const ey=Pe(K.nodeName);if(!Qv(ey,$i,cr)){Wa(zt,K);continue}if(j&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!Fr)switch(p.getAttributeType(ey,$i)){case"TrustedHTML":{cr=j.createHTML(cr);break}case"TrustedScriptURL":{cr=j.createScriptURL(cr);break}}if(cr!==Sm)try{Fr?K.setAttributeNS(Fr,zt,cr):K.setAttribute(zt,cr),km(K)?Zn(K):Ly(t.removed)}catch{Wa(zt,K)}}js(O.afterSanitizeAttributes,K,null)},oE=function Ee(K){let he=null;const Se=Gv(K);for(js(O.beforeSanitizeShadowDOM,K,null);he=Se.nextNode();)js(O.uponSanitizeShadowNode,he,null),Xv(he),Jv(he),he.content instanceof i&&Ee(he.content);js(O.afterSanitizeShadowDOM,K,null)};return t.sanitize=function(Ee){let K=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},he=null,Se=null,gt=null,xr=null;if(Xn=!Ee,Xn&&(Ee="<!-->"),typeof Ee!="string"&&!Vv(Ee))if(typeof Ee.toString=="function"){if(Ee=Ee.toString(),typeof Ee!="string")throw cl("dirty is not a string, aborting")}else throw cl("toString is not a function");if(!t.isSupported)return Ee;if(de||st(K),t.removed=[],typeof Ee=="string"&&(et=!1),et){if(Ee.nodeName){const ws=Pe(Ee.nodeName);if(!M[ws]||J[ws])throw cl("root node is forbidden and cannot be sanitized in-place")}}else if(Ee instanceof l)he=Yv("<!---->"),Se=he.ownerDocument.importNode(Ee,!0),Se.nodeType===ul.element&&Se.nodeName==="BODY"||Se.nodeName==="HTML"?he=Se:he.appendChild(Se);else{if(!Z&&!oe&&!te&&Ee.indexOf("<")===-1)return j&&be?j.createHTML(Ee):Ee;if(he=Yv(Ee),!he)return Z?null:be?k:""}he&&me&&Zn(he.firstChild);const zt=Gv(et?Ee:he);for(;gt=zt.nextNode();)Xv(gt),Jv(gt),gt.content instanceof i&&oE(gt.content);if(et)return Ee;if(Z){if(xe)for(xr=_.call(he.ownerDocument);he.firstChild;)xr.appendChild(he.firstChild);else xr=he;return(H.shadowroot||H.shadowrootmode)&&(xr=P.call(n,xr,!0)),xr}let Fr=te?he.outerHTML:he.innerHTML;return te&&M["!doctype"]&&he.ownerDocument&&he.ownerDocument.doctype&&he.ownerDocument.doctype.name&&kr(Lk,he.ownerDocument.doctype.name)&&(Fr="<!DOCTYPE "+he.ownerDocument.doctype.name+`>
588
+ `+Fr),oe&&Xc([E,D,I],ws=>{Fr=ll(Fr,ws," ")}),j&&be?j.createHTML(Fr):Fr},t.setConfig=function(){let Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};st(Ee),de=!0},t.clearConfig=function(){Ie=null,de=!1},t.isValidAttribute=function(Ee,K,he){Ie||st({});const Se=Pe(Ee),gt=Pe(K);return Qv(Se,gt,he)},t.addHook=function(Ee,K){typeof K=="function"&&ol(O[Ee],K)},t.removeHook=function(Ee,K){if(K!==void 0){const he=l$(O[Ee],K);return he===-1?void 0:c$(O[Ee],he,1)[0]}return Ly(O[Ee])},t.removeHooks=function(Ee){O[Ee]=[]},t.removeAllHooks=function(){O=Hy()},t}var C$=Fk();function _$(e){var t;const{char:r,allowSpaces:n,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:l}=e,c=n&&!a,d=mA(r),u=new RegExp(`\\s${d}$`),f=o?"^":"",m=a?"":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),b=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(y);if(i!==null&&!b)return null;const N=g+v.index;let j=N+v[0].length;return c&&u.test(x.slice(j-1,j+1))&&(v[0]+=" ",j+=1),N<l.pos&&j>=l.pos?{range:{from:N,to:j},query:v[0].slice(r.length),text:v[0]}:null}var P$=new E1("suggestion");function M$({pluginKey:e=P$,editor:t,char:r="@",allowSpaces:n=!1,allowToIncludeChar:a=!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=_$,shouldShow:v}){let y;const b=p==null?void 0:p(),N=()=>{const S=t.state.selection.$anchor.pos,_=t.view.coordsAtPos(S),{top:C,right:P,bottom:O,left:E}=_;try{return new DOMRect(E,C,P-E,O-C)}catch{return null}},j=(S,_)=>_?()=>{const C=e.getState(t.state),P=C==null?void 0:C.decorationId,O=S.dom.querySelector(`[data-decoration-id="${P}"]`);return(O==null?void 0:O.getBoundingClientRect())||null}:N;function k(S,_){var C;try{const O=e.getState(S.state),E=O!=null&&O.decorationId?S.dom.querySelector(`[data-decoration-id="${O.decorationId}"]`):null,D={editor:t,range:(O==null?void 0:O.range)||{from:0,to:0},query:(O==null?void 0:O.query)||null,text:(O==null?void 0:O.text)||null,items:[],command:I=>f({editor:t,range:(O==null?void 0:O.range)||{from:0,to:0},props:I}),decorationNode:E,clientRect:j(S,E)};(C=b==null?void 0:b.onExit)==null||C.call(b,D)}catch{}const P=S.state.tr.setMeta(_,{exit:!0});S.dispatch(P)}const w=new dA({key:e,view(){return{update:async(S,_)=>{var C,P,O,E,D,I,V;const Q=(C=this.key)==null?void 0:C.getState(_),q=(P=this.key)==null?void 0:P.getState(S.state),re=Q.active&&q.active&&Q.range.from!==q.range.from,se=!Q.active&&q.active,T=Q.active&&!q.active,M=!se&&!T&&Q.query!==q.query,L=se||re&&M,H=M||re,R=T||re&&M;if(!L&&!H&&!R)return;const Y=R&&!L?Q:q,J=S.dom.querySelector(`[data-decoration-id="${Y.decorationId}"]`);y={editor:t,range:Y.range,query:Y.query,text:Y.text,items:[],command:A=>f({editor:t,range:Y.range,props:A}),decorationNode:J,clientRect:j(S,J)},L&&((O=b==null?void 0:b.onBeforeStart)==null||O.call(b,y)),H&&((E=b==null?void 0:b.onBeforeUpdate)==null||E.call(b,y)),(H||L)&&(y.items=await m({editor:t,query:Y.query})),R&&((D=b==null?void 0:b.onExit)==null||D.call(b,y)),H&&((I=b==null?void 0:b.onUpdate)==null||I.call(b,y)),L&&((V=b==null?void 0:b.onStart)==null||V.call(b,y))},destroy:()=>{var S;y&&((S=b==null?void 0:b.onExit)==null||S.call(b,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,_,C,P){const{isEditable:O}=t,{composing:E}=t.view,{selection:D}=S,{empty:I,from:V}=D,Q={..._},q=S.getMeta(e);if(q&&q.exit)return Q.active=!1,Q.decorationId=null,Q.range={from:0,to:0},Q.query=null,Q.text=null,Q;if(Q.composing=E,O&&(I||t.view.composing)){(V<_.range.from||V>_.range.to)&&!E&&!_.composing&&(Q.active=!1);const re=g({char:r,allowSpaces:n,allowToIncludeChar:a,allowedPrefixes:i,startOfLine:o,$position:D.$from}),se=`id_${Math.floor(Math.random()*4294967295)}`;re&&x({editor:t,state:P,range:re.range,isActive:_.active})&&(!v||v({editor:t,range:re.range,query:re.query,text:re.text,transaction:S}))?(Q.active=!0,Q.decorationId=_.decorationId?_.decorationId:se,Q.range=re.range,Q.query=re.query,Q.text=re.text):Q.active=!1}else Q.active=!1;return Q.active||(Q.decorationId=null,Q.range={from:0,to:0},Q.query=null,Q.text=null),Q}},props:{handleKeyDown(S,_){var C,P,O,E;const{active:D,range:I}=w.getState(S.state);if(!D)return!1;if(_.key==="Escape"||_.key==="Esc"){const Q=w.getState(S.state),q=(C=y==null?void 0:y.decorationNode)!=null?C:null,re=q??(Q!=null&&Q.decorationId?S.dom.querySelector(`[data-decoration-id="${Q.decorationId}"]`):null);if(((P=b==null?void 0:b.onKeyDown)==null?void 0:P.call(b,{view:S,event:_,range:Q.range}))||!1)return!0;const T={editor:t,range:Q.range,query:Q.query,text:Q.text,items:[],command:M=>f({editor:t,range:Q.range,props:M}),decorationNode:re,clientRect:re?()=>re.getBoundingClientRect()||null:null};return(O=b==null?void 0:b.onExit)==null||O.call(b,T),k(S,e),!0}return((E=b==null?void 0:b.onKeyDown)==null?void 0:E.call(b,{view:S,event:_,range:I}))||!1},decorations(S){const{active:_,range:C,decorationId:P,query:O}=w.getState(S);if(!_)return null;const E=!(O!=null&&O.length),D=[c];return E&&D.push(u),uA.create(S.doc,[fA.inline(C.from,C.to,{nodeName:l,class:D.join(" "),"data-decoration-id":P,"data-decoration-content":d})])}}});return w}function O$({editor:e,overrideSuggestionOptions:t,extensionName:r,char:n="@"}){const a=new E1;return{editor:e,char:n,pluginKey:a,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=>O$({editor:e.editor,overrideSuggestionOptions:t,extensionName:e.name,char:t.char}))}function Ky(e,t){const r=Bk(e),n=r.find(a=>a.char===t);return n||(r.length?r[0]:null)}var E$=hA.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,a;return["span",qc(this.HTMLAttributes,e.HTMLAttributes),`${(n=r==null?void 0:r.char)!=null?n:"@"}${(a=t.attrs.label)!=null?a: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=Ky(this,e.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",qc({"data-type":this.name},this.options.HTMLAttributes,t),this.options.renderLabel({options:this.options,node:e,suggestion:r})];const n={...this.options};n.HTMLAttributes=qc({"data-type":this.name},this.options.HTMLAttributes,t);const a=this.options.renderHTML({options:n,node:e,suggestion:r});return typeof a=="string"?["span",qc({"data-type":this.name},this.options.HTMLAttributes,t),a]:a},...xA({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[,a,i,o]=n,l=i??o;t[a==="char"?"mentionSuggestionChar":a]=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:Ky(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:a,anchor:i}=n;if(!a)return!1;let o=new pA,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(M$)}}),qk=E$;const Ux={byIssue:e=>["attachments",e]};function Wk(e){return Te({queryKey:Ux.byIssue(e),queryFn:()=>ie.get(`/admin/issues/${e}/attachments`),select:t=>t.attachments,enabled:!!e})}function Uk(e){const t=ye();return ge({mutationFn:({file:r,commentId:n})=>{const a=new FormData;return a.append("file",r),n&&a.append("comment_id",n),ie.upload(`/admin/issues/${e}/attachments`,a)},onSuccess:()=>{t.invalidateQueries({queryKey:Ux.byIssue(e)})}})}function A$(e){const t=ye();return ge({mutationFn:r=>ie.delete(`/admin/issues/${e}/attachments/${r}`),onSuccess:()=>{t.invalidateQueries({queryKey:Ux.byIssue(e)})}})}function Rl(e){return e.startsWith("image/")}function pf(e){return e.startsWith("video/")}function xf(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function qd(e){if(e.startsWith("/"))return!0;try{const{protocol:t}=new URL(e);return t==="http:"||t==="https:"}catch{return!1}}function Hx(e,t){if(!qd(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 Kx({mimeType:e,className:t}){return Rl(e)?s.jsx(tD,{className:t}):pf(e)?s.jsx(Al,{className:t}):e.startsWith("text/")||e.includes("json")?s.jsx(eD,{className:t}):e.includes("zip")||e.includes("tar")||e.includes("gz")?s.jsx(J5,{className:t}):e.includes("pdf")||e.includes("word")||e.includes("document")?s.jsx(rD,{className:t}):s.jsx(nD,{className:t})}function Hk({attachment:e,onClose:t}){return e?s.jsx(Oi,{open:!0,onOpenChange:r=>!r&&t(),children:s.jsxs(Ei,{className:"max-w-2xl w-full p-0 overflow-hidden",children:[s.jsxs(Do,{className:"flex-row items-center justify-between px-4 py-3 border-b border-border shrink-0 pr-10",children:[s.jsx(Io,{className:"text-sm font-medium truncate",children:e.original_name}),s.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs gap-1.5 shrink-0",onClick:()=>Hx(e.url,e.original_name),children:[s.jsx(mx,{className:"h-3.5 w-3.5"}),"Download"]})]}),s.jsxs(To,{className:"flex items-center justify-center bg-black/5 dark:bg-black/30 min-h-[320px] max-h-[75vh] overflow-auto p-0",children:[Rl(e.mime_type)&&qd(e.url)&&s.jsx("img",{src:e.url,alt:e.original_name,className:"max-w-full max-h-[75vh] object-contain"}),pf(e.mime_type)&&qd(e.url)&&s.jsx("video",{src:e.url,controls:!0,className:"max-w-full max-h-[75vh]"})]}),s.jsxs("div",{className:"px-4 py-2 border-t border-border text-[11px] text-muted-foreground flex items-center gap-3 shrink-0",children:[s.jsx("span",{children:xf(e.size)}),s.jsx("span",{children:"·"}),s.jsx("span",{children:e.mime_type}),s.jsx("span",{children:"·"}),s.jsxs("span",{children:["Uploaded ",fe(new Date(e.created_at),"MMM d, yyyy")]})]})]})}):null}function D$({attachment:e}){const[t,r]=h.useState(null),n=Rl(e.mime_type)||pf(e.mime_type),a=()=>{n?r(e):Hx(e.url,e.original_name)};return s.jsxs(s.Fragment,{children:[Rl(e.mime_type)?s.jsx("button",{type:"button",onClick:a,className:"block rounded-md overflow-hidden border border-border hover:opacity-90 transition-opacity",title:e.original_name,children:s.jsx("img",{src:qd(e.url)?e.url:"",alt:e.original_name,className:"max-h-48 max-w-xs object-cover"})}):s.jsxs("button",{type:"button",onClick:a,className:"flex items-center gap-2 px-2.5 py-1.5 rounded-lg border border-border bg-muted/40 hover:bg-muted transition-colors text-left max-w-xs",title:n?"View":"Download",children:[s.jsx(Kx,{mimeType:e.mime_type,className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-foreground truncate",children:e.original_name}),s.jsx("span",{className:"text-[10px] text-muted-foreground shrink-0",children:xf(e.size)}),!n&&s.jsx(mx,{className:"h-3 w-3 shrink-0 text-muted-foreground"})]}),t&&s.jsx(Hk,{attachment:t,onClose:()=>r(null)})]})}function T$({attachment:e,onOpen:t,onDelete:r,isDeleting:n}){const a=Rl(e.mime_type)||pf(e.mime_type),i=()=>{a?t(e):Hx(e.url,e.original_name)};return s.jsxs("div",{className:"flex items-center gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[s.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:a?"View":"Download",children:s.jsx(Kx,{mimeType:e.mime_type,className:"h-4 w-4"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.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}),s.jsxs("p",{className:"text-[11px] text-muted-foreground mt-0.5 flex items-center gap-1.5",children:[s.jsx("span",{children:xf(e.size)}),s.jsx("span",{children:"·"}),s.jsx("span",{children:fe(new Date(e.created_at),"MMM d, yyyy")}),e.comment_id&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsx("span",{className:"italic",children:"from comment"})]}),!a&&s.jsxs(s.Fragment,{children:[s.jsx("span",{children:"·"}),s.jsxs("span",{className:"flex items-center gap-0.5",children:[s.jsx(mx,{className:"h-2.5 w-2.5"}),"Click to download"]})]})]})]}),s.jsx(ee,{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:s.jsx(jr,{className:"h-3.5 w-3.5"})})]})}function I$({onFiles:e,isUploading:t}){const[r,n]=h.useState(!1),a=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 s.jsxs("div",{onDragOver:o=>{o.preventDefault(),n(!0)},onDragLeave:()=>n(!1),onDrop:i,onClick:()=>{var o;return!t&&((o=a.current)==null?void 0:o.click())},className:z("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:[s.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-muted",children:s.jsx(kD,{className:"h-4 w-4 text-muted-foreground"})}),s.jsx("p",{className:"text-xs font-medium text-foreground",children:t?"Uploading…":"Drop files or click to browse"}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to 50 MB per file"}),s.jsx("input",{ref:a,type:"file",multiple:!0,className:"hidden",onChange:o=>{const l=Array.from(o.target.files??[]);l.length>0&&e(l),o.target.value=""}})]})}function R$({issueId:e,className:t}){const[r,n]=h.useState(null),{data:a,isLoading:i}=Wk(e),o=Uk(e),l=A$(e),c=u=>{u.forEach(f=>{o.mutate({file:f},{onSuccess:()=>F.success(`${f.name} uploaded`),onError:()=>F.error(`Failed to upload ${f.name}`)})})},d=u=>{l.mutate(u,{onSuccess:()=>F.success("Attachment removed"),onError:()=>F.error("Failed to remove attachment")})};return s.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[s.jsx(I$,{onFiles:c,isUploading:o.isPending}),i?s.jsx("div",{className:"space-y-2",children:[1,2].map(u=>s.jsxs("div",{className:"flex items-center gap-3 px-3",children:[s.jsx(le,{className:"h-8 w-8 rounded-md shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(le,{className:"h-3 w-2/3"}),s.jsx(le,{className:"h-2.5 w-1/3"})]})]},u))}):a&&a.length>0?s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[s.jsx(gx,{className:"h-3 w-3 text-muted-foreground"}),s.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[a.length," ",a.length===1?"file":"files"]})]}),s.jsx("div",{children:a.map(u=>s.jsx(T$,{attachment:u,onOpen:n,onDelete:d,isDeleting:l.isPending},u.id))})]}):s.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No attachments yet."}),s.jsx(Hk,{attachment:r,onClose:()=>n(null)})]})}function $$(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 s.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 a=()=>{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 a.scopeName=e,[n,z$(a,...t)]}function z$(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.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 L$=Symbol("radix.slottable");function F$(e){const t=({children:r})=>s.jsx(s.Fragment,{children:r});return t.displayName=`${e}.Slottable`,t.__radixId=L$,t}var Kk="AlertDialog",[B$]=$$(Kk,[N1]),ra=N1(),Yk=e=>{const{__scopeAlertDialog:t,...r}=e,n=ra(t);return s.jsx(rc,{...n,...r,modal:!0})};Yk.displayName=Kk;var q$="AlertDialogTrigger",W$=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ra(r);return s.jsx($E,{...a,...n,ref:t})});W$.displayName=q$;var U$="AlertDialogPortal",Gk=e=>{const{__scopeAlertDialog:t,...r}=e,n=ra(t);return s.jsx(tc,{...n,...r})};Gk.displayName=U$;var H$="AlertDialogOverlay",Vk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ra(r);return s.jsx(Si,{...a,...n,ref:t})});Vk.displayName=H$;var Ji="AlertDialogContent",[K$,Y$]=B$(Ji),G$=F$("AlertDialogContent"),Xk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,children:n,...a}=e,i=ra(r),o=h.useRef(null),l=So(t,o),c=h.useRef(null);return s.jsx(RE,{contentName:Ji,titleName:Qk,docsSlug:"alert-dialog",children:s.jsx(K$,{scope:r,cancelRef:c,children:s.jsxs(Ci,{role:"alertdialog",...i,...a,ref:l,onOpenAutoFocus:Cs(a.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[s.jsx(G$,{children:n}),s.jsx(X$,{contentRef:o})]})})})});Xk.displayName=Ji;var Qk="AlertDialogTitle",Zk=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ra(r);return s.jsx(No,{...a,...n,ref:t})});Zk.displayName=Qk;var Jk="AlertDialogDescription",eS=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ra(r);return s.jsx(ko,{...a,...n,ref:t})});eS.displayName=Jk;var V$="AlertDialogAction",tS=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,a=ra(r);return s.jsx(Uu,{...a,...n,ref:t})});tS.displayName=V$;var rS="AlertDialogCancel",nS=h.forwardRef((e,t)=>{const{__scopeAlertDialog:r,...n}=e,{cancelRef:a}=Y$(rS,r),i=ra(r),o=So(t,a);return s.jsx(Uu,{...i,...n,ref:o})});nS.displayName=rS;var X$=({contentRef:e})=>{const t=`\`${Ji}\` requires a description for the component to be accessible for screen reader users.
589
+
590
+ You can add a description to the \`${Ji}\` by passing a \`${Jk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
591
+
592
+ Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${Ji}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
593
+
594
+ For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return h.useEffect(()=>{var n;document.getElementById((n=e.current)==null?void 0:n.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},Q$=Yk,Z$=Gk,sS=Vk,aS=Xk,iS=tS,oS=nS,lS=Zk,cS=eS;const li=Q$,J$=Z$,dS=h.forwardRef(({className:e,...t},r)=>s.jsx(sS,{className:z("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}));dS.displayName=sS.displayName;const wa=h.forwardRef(({className:e,...t},r)=>s.jsxs(J$,{children:[s.jsx(dS,{}),s.jsx(aS,{ref:r,className:z("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 bg-background border border-border p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 rounded-lg",e),...t})]}));wa.displayName=aS.displayName;const Na=({className:e,...t})=>s.jsx("div",{className:z("flex flex-col space-y-2 text-center sm:text-left",e),...t});Na.displayName="AlertDialogHeader";const ka=({className:e,...t})=>s.jsx("div",{className:z("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ka.displayName="AlertDialogFooter";const Sa=h.forwardRef(({className:e,...t},r)=>s.jsx(lS,{ref:r,className:z("text-base font-semibold",e),...t}));Sa.displayName=lS.displayName;const Ca=h.forwardRef(({className:e,...t},r)=>s.jsx(cS,{ref:r,className:z("text-sm text-muted-foreground",e),...t}));Ca.displayName=cS.displayName;const _a=h.forwardRef(({className:e,...t},r)=>s.jsx(iS,{ref:r,className:z(Zi(),e),...t}));_a.displayName=iS.displayName;const Pa=h.forwardRef(({className:e,...t},r)=>s.jsx(oS,{ref:r,className:z(Zi({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));Pa.displayName=oS.displayName;function uo({open:e,onClose:t,onConfirm:r,title:n,description:a,confirmLabel:i="Confirm",variant:o="default",loading:l=!1}){return s.jsx(li,{open:e,onOpenChange:c=>!c&&t(),children:s.jsxs(wa,{children:[s.jsxs(Na,{children:[s.jsx(Sa,{children:n}),s.jsx(Ca,{children:a})]}),s.jsxs(ka,{children:[s.jsx(Pa,{onClick:t,disabled:l,children:"Cancel"}),s.jsx(_a,{onClick:r,disabled:l,className:z(o==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus:ring-destructive"),children:l?"Please wait…":i})]})]})})}function e6({startedAt:e}){const[t,r]=h.useState(()=>zd(e));return h.useEffect(()=>{const n=setInterval(()=>r(zd(e)),1e3);return()=>clearInterval(n)},[e]),s.jsx("span",{className:"font-mono tabular-nums text-sm font-semibold text-foreground",children:t})}function t6({onSubmit:e,isPending:t,onCancel:r}){const[n,a]=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){F.error("Please enter a duration greater than 0.");return}e({duration_minutes:g,description:l.trim()||void 0,logged_date:d||void 0})};return s.jsxs("form",{onSubmit:f,className:"rounded-xl border border-border bg-card p-4 space-y-3",children:[s.jsx("p",{className:"text-xs font-medium text-foreground",children:"Log time manually"}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Hours"}),s.jsx(_e,{type:"number",min:"0",max:"999",placeholder:"0",value:n,onChange:m=>a(m.target.value),className:"h-8 text-sm"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Minutes"}),s.jsx(_e,{type:"number",min:"0",max:"59",placeholder:"0",value:i,onChange:m=>o(m.target.value),className:"h-8 text-sm"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:"Date"}),s.jsx(_e,{type:"date",value:d,onChange:m=>u(m.target.value),className:"h-8 text-sm"})]})]}),s.jsxs("div",{children:[s.jsxs("label",{className:"text-[11px] text-muted-foreground mb-1 block",children:["Description ",s.jsx("span",{className:"text-muted-foreground/60",children:"(optional)"})]}),s.jsx(_e,{placeholder:"What did you work on?",value:l,onChange:m=>c(m.target.value),className:"h-8 text-sm"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:r,className:"h-7 text-xs",children:"Cancel"}),s.jsx(ee,{type:"submit",size:"sm",disabled:t,className:"h-7 text-xs",children:t?"Saving…":"Log time"})]})]})}function r6({entry:e,onSave:t,onCancel:r,isPending:n}){const a=e.duration_minutes??0,[i,o]=h.useState(String(Math.floor(a/60))),[l,c]=h.useState(String(a%60)),[d,u]=h.useState(e.description??""),[f,m]=h.useState(e.logged_date?new Date(e.logged_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0]),p=x=>{x.preventDefault();const g=parseInt(i||"0",10),v=parseInt(l||"0",10),y=g*60+v;if(y<=0){F.error("Please enter a duration greater than 0.");return}t({duration_minutes:y,description:d.trim()||void 0,logged_date:f||void 0})};return s.jsxs("form",{onSubmit:p,className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2",children:[s.jsxs("div",{className:"flex gap-2",children:[s.jsxs("div",{className:"w-16",children:[s.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Hours"}),s.jsx(_e,{type:"number",min:"0",max:"999",value:i,onChange:x=>o(x.target.value),className:"h-7 text-xs"})]}),s.jsxs("div",{className:"w-16",children:[s.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Min"}),s.jsx(_e,{type:"number",min:"0",max:"59",value:l,onChange:x=>c(x.target.value),className:"h-7 text-xs"})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Date"}),s.jsx(_e,{type:"date",value:f,onChange:x=>m(x.target.value),className:"h-7 text-xs"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"text-[10px] text-muted-foreground mb-0.5 block",children:"Description"}),s.jsx(_e,{placeholder:"What did you work on?",value:d,onChange:x=>u(x.target.value),className:"h-7 text-xs"})]}),s.jsxs("div",{className:"flex justify-end gap-1.5 pt-0.5",children:[s.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:r,disabled:n,children:s.jsx(Be,{className:"h-3 w-3"})}),s.jsx(ee,{type:"submit",size:"icon",className:"h-6 w-6",disabled:n,children:s.jsx(Ct,{className:"h-3 w-3"})})]})]})}function n6({entry:e,userName:t,isOwnEntry:r,onDelete:n,isDeleting:a,onEdit:i,isEditing:o,editForm:l}){const c=e.started_at!=null&&e.stopped_at==null;return o?s.jsx("div",{className:"py-1.5 px-3",children:l}):s.jsxs("div",{className:"flex items-start gap-3 py-2.5 px-3 rounded-lg hover:bg-muted/50 group transition-colors",children:[s.jsx("div",{className:z("flex h-7 w-7 shrink-0 items-center justify-center rounded-full mt-0.5",c?"bg-emerald-50 dark:bg-emerald-950/40":e.source==="timer"?"bg-sky-50 dark:bg-sky-950/40":"bg-violet-50 dark:bg-violet-950/40"),children:c?s.jsx(mN,{className:"h-3.5 w-3.5 text-emerald-600"}):e.source==="timer"?s.jsx(Ar,{className:"h-3.5 w-3.5 text-sky-600 dark:text-sky-400"}):s.jsx(Q5,{className:"h-3.5 w-3.5 text-violet-600 dark:text-violet-400"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap",children:[c?s.jsx(e6,{startedAt:e.started_at}):s.jsx("span",{className:"text-sm font-semibold text-foreground tabular-nums",children:$d(e.duration_minutes??0)}),s.jsx(Pn,{variant:"muted",className:z("text-[10px] px-1.5 py-0",c?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-400":e.source==="timer"?"bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-400":"bg-violet-100 text-violet-700 dark:bg-violet-950 dark:text-violet-400"),children:c?"Running":e.source==="timer"?"Timer":"Manual"}),t&&s.jsx("span",{className:"text-[11px] text-foreground",children:t})]}),e.description&&s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:e.description}),e.logged_date&&!c&&s.jsx("p",{className:"text-[11px] text-muted-foreground/60 mt-0.5",children:fe(new Date(e.logged_date),"MMM d, yyyy")})]}),!c&&r&&s.jsxs("div",{className:"flex items-center gap-0.5 shrink-0 opacity-0 group-hover:opacity-100 transition-all mt-0.5",children:[s.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>i(e.id),children:s.jsx(Fs,{className:"h-3.5 w-3.5"})}),s.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive",onClick:()=>n(e.id),disabled:a,children:s.jsx(jr,{className:"h-3.5 w-3.5"})})]})]})}function s6({issueId:e,className:t}){const[r,n]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState(null),{data:c,isLoading:d}=PT(e),{data:u}=MT(e),{data:f}=La(),{user:m}=De(),p=OT(e),x=ET(e),g=AT(e),v=DT(e),y=TT(e),b=(c==null?void 0:c.time_logs)??[],N=(c==null?void 0:c.total_minutes)??0,j=u!=null,k=P=>{p.mutate(P,{onSuccess:()=>{n(!1),F.success("Time logged")},onError:()=>F.error("Failed to log time")})},w=()=>{x.mutate(void 0,{onSuccess:P=>{P.stopped_timer?F.success("Previous timer stopped, new timer started"):F.success("Timer started")},onError:P=>F.error(P.message??"Failed to start timer")})},S=()=>{g.mutate(void 0,{onSuccess:P=>{const O=P.time_log.duration_minutes??0;F.success(`Timer stopped — ${$d(O)} logged`)},onError:()=>F.error("Failed to stop timer")})},_=()=>{o&&v.mutate(o,{onSuccess:()=>{l(null),F.success("Time entry removed")},onError:()=>F.error("Failed to remove entry")})},C=(P,O)=>{y.mutate({logId:P,data:O},{onSuccess:()=>{i(null),F.success("Time entry updated")},onError:()=>F.error("Failed to update entry")})};return s.jsxs("div",{className:z("px-6 py-4 space-y-4",t),children:[s.jsxs("div",{className:"flex items-center justify-between gap-3",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium mb-0.5",children:"Total logged"}),s.jsx("p",{className:"text-xl font-bold text-foreground tabular-nums",children:N>0?$d(N):"—"})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[!r&&s.jsxs(ee,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>n(!0),children:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Log time"]}),j?s.jsxs(ee,{size:"sm",variant:"destructive",className:"h-8 text-xs gap-1.5",onClick:S,disabled:g.isPending,children:[s.jsx(uN,{className:"h-3.5 w-3.5 fill-current"}),"Stop"]}):s.jsxs(ee,{size:"sm",className:"h-8 text-xs gap-1.5 bg-emerald-600 hover:bg-emerald-700 text-white",onClick:w,disabled:x.isPending,children:[s.jsx(Al,{className:"h-3.5 w-3.5 fill-current"}),"Start"]})]})]}),r&&s.jsx(t6,{onSubmit:k,isPending:p.isPending,onCancel:()=>n(!1)}),d?s.jsx("div",{className:"space-y-2",children:[1,2].map(P=>s.jsxs("div",{className:"flex items-center gap-3 px-3",children:[s.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(le,{className:"h-3 w-1/3"}),s.jsx(le,{className:"h-2.5 w-1/4"})]})]},P))}):b.length>0?s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-1",children:[s.jsx(Ar,{className:"h-3 w-3 text-muted-foreground"}),s.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wider",children:[b.length," ",b.length===1?"entry":"entries"]})]}),s.jsx("div",{children:b.map(P=>{var O;return s.jsx(n6,{entry:P,userName:(O=f==null?void 0:f.get(P.user_id))==null?void 0:O.name,isOwnEntry:P.user_id===(m==null?void 0:m.id),onDelete:l,isDeleting:v.isPending,onEdit:i,isEditing:a===P.id,editForm:s.jsx(r6,{entry:P,onSave:E=>C(P.id,E),onCancel:()=>i(null),isPending:y.isPending})},P.id)})})]}):s.jsx("p",{className:"text-sm text-muted-foreground/50 text-center py-1",children:"No time logged yet."}),s.jsx(uo,{open:o!==null,onClose:()=>l(null),onConfirm:_,title:"Delete time entry",description:"This time entry will be permanently removed. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive",loading:v.isPending})]})}function Ka({onClick:e,active:t,title:r,children:n}){return s.jsx("button",{type:"button",title:r,onMouseDown:a=>{a.preventDefault(),e()},className:z("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 Yy(){return s.jsx("span",{className:"mx-0.5 h-3.5 w-px shrink-0 bg-border"})}const Zc={active:!1,items:[],selectedIndex:0,rect:null,command:null};function uS({issueId:e,projectId:t,compact:r,className:n,onSuccess:a}){const[i,o]=h.useState(!0),[l,c]=h.useState([]),[d,u]=h.useState(!1),[f,m]=h.useState(Zc),p=h.useRef(null),x=h.useRef(async()=>{}),g=h.useRef(null),{user:v}=De(),y=K5(e),b=Uk(e),{data:N}=Yn(t??""),j=h.useMemo(()=>N!=null&&N.members?N.members.filter(J=>J.user).map(J=>{const A=J.user,U=`${A.first_name??""} ${A.last_name??""}`.trim()||A.email;return{id:A.id,label:U,email:A.email}}):[],[N]),k=h.useRef([]);k.current=j;const w=h.useRef(m);w.current=m;const S=h.useRef([]),_=h.useRef(null),C=h.useRef(0),P=(v==null?void 0:v.first_name)??"",O=(v==null?void 0:v.last_name)??"",E=`${P} ${O}`.trim()||(v==null?void 0:v.email)||"?",D=v&&`${P[0]??""}${O[0]??""}`.toUpperCase()||"?",I=Yx(E),V=h.useMemo(()=>gA.create({name:"submitShortcut",addKeyboardShortcuts(){return{"Mod-Enter":()=>(x.current(),!0)}}}),[]),Q=h.useMemo(()=>qk.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:J})=>{const A=k.current;if(!A.length)return[];const U=J.toLowerCase();return A.filter($=>!U||$.label.toLowerCase().includes(U)||$.email.toLowerCase().includes(U)).slice(0,8)},render:()=>({onStart:J=>{var A;S.current=J.items,_.current=J.command,C.current=0,w.current({active:!0,items:J.items,selectedIndex:0,rect:((A=J.clientRect)==null?void 0:A.call(J))??null,command:J.command})},onUpdate:J=>{var A;S.current=J.items,_.current=J.command,C.current=0,w.current({active:!0,items:J.items,selectedIndex:0,rect:((A=J.clientRect)==null?void 0:A.call(J))??null,command:J.command})},onKeyDown:({event:J})=>{var U;const A=S.current;if(!A.length)return!1;if(J.key==="Escape")return w.current(Zc),!0;if(J.key==="ArrowDown"){const $=(C.current+1)%A.length;return C.current=$,w.current(ne=>({...ne,selectedIndex:$})),!0}if(J.key==="ArrowUp"){const $=(C.current-1+A.length)%A.length;return C.current=$,w.current(ne=>({...ne,selectedIndex:$})),!0}if(J.key==="Enter"){const $=A[C.current];return $&&((U=_.current)==null||U.call(_,$)),!0}return!1},onExit:()=>{w.current(Zc),_.current=null}})}}),[]),q=A1({extensions:[D1,T1,I1.configure({placeholder:"Leave a comment… (type @ to mention)"}),V,Q],editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:J}){o(J.isEmpty)}}),re=!i||l.length>0,se=25*1024*1024,T=J=>{const A=J.filter($=>$.size>se);A.length>0&&F.error(`Files must be under 25 MB: ${A.map($=>$.name).join(", ")}`);const U=J.filter($=>$.size<=se);c($=>{const ne=new Set($.map(B=>`${B.name}-${B.size}`));return[...$,...U.filter(B=>!ne.has(`${B.name}-${B.size}`))]})},M=J=>{c(A=>A.filter((U,$)=>$!==J))},L=h.useCallback(J=>{var A;(A=_.current)==null||A.call(_,J),m(Zc)},[]),H=async()=>{if(!(!re||d)){u(!0);try{const J=q!=null&&q.isEmpty?"":(q==null?void 0:q.getHTML())??"",A=[];J&&new DOMParser().parseFromString(J,"text/html").querySelectorAll("[data-type='mention']").forEach(oe=>{const G=oe.getAttribute("data-id");G&&!A.includes(G)&&A.push(G)});const U=A.length>0?{mentioned_user_ids:A}:void 0,ne=(await y.mutateAsync({body:J||" ",metadata:U})).comment.id;for(const B of l)await b.mutateAsync({file:B,commentId:ne});q==null||q.commands.clearContent(),o(!0),c([]),F.success("Comment added"),a==null||a()}catch{F.error("Failed to add comment")}finally{u(!1)}}};x.current=H;const R="h-3 w-3",Y=h.useMemo(()=>{if(!f.rect||!g.current)return{bottom:"105%",left:0};const J=g.current.getBoundingClientRect(),A=Math.max(0,f.rect.left-J.left);return{top:f.rect.bottom-J.top+4,left:A}},[f.rect]);return s.jsxs("div",{className:z("flex gap-3 items-start",n),children:[s.jsx(Pt,{className:"h-7 w-7 shrink-0 mt-1",children:s.jsx(Mt,{className:z("text-[11px] font-semibold",I.bg,I.text),children:D})}),s.jsxs("div",{className:"flex-1 min-w-0 relative",ref:g,children:[s.jsxs("div",{className:z("rounded-md border border-input overflow-hidden transition-shadow","focus-within:ring-1 focus-within:ring-ring",d&&"opacity-60 pointer-events-none"),children:[q&&s.jsxs("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border/70 bg-muted/30",children:[s.jsx(Ka,{title:"Bold (⌘B)",active:q.isActive("bold"),onClick:()=>q.chain().focus().toggleBold().run(),children:s.jsx(J1,{className:R})}),s.jsx(Ka,{title:"Italic (⌘I)",active:q.isActive("italic"),onClick:()=>q.chain().focus().toggleItalic().run(),children:s.jsx(iN,{className:R})}),s.jsx(Ka,{title:"Strikethrough",active:q.isActive("strike"),onClick:()=>q.chain().focus().toggleStrike().run(),children:s.jsx(fN,{className:R})}),s.jsx(Ka,{title:"Inline code",active:q.isActive("code"),onClick:()=>q.chain().focus().toggleCode().run(),children:s.jsx(sN,{className:R})}),s.jsx(Yy,{}),s.jsx(Ka,{title:"Bullet list",active:q.isActive("bulletList"),onClick:()=>q.chain().focus().toggleBulletList().run(),children:s.jsx(xx,{className:R})}),s.jsx(Ka,{title:"Ordered list",active:q.isActive("orderedList"),onClick:()=>q.chain().focus().toggleOrderedList().run(),children:s.jsx(lN,{className:R})}),s.jsx(Yy,{}),s.jsx(Ka,{title:"Code block",active:q.isActive("codeBlock"),onClick:()=>q.chain().focus().toggleCodeBlock().run(),children:s.jsx(nN,{className:R})})]}),s.jsx(R1,{editor:q,className:z("px-3 py-2.5 text-sm overflow-y-auto",r?"min-h-[68px] max-h-[160px]":"min-h-[80px] max-h-[200px]")})]}),l.length>0&&s.jsx("div",{className:"flex flex-wrap gap-1.5 mt-2",children:l.map((J,A)=>s.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:[s.jsx(Kx,{mimeType:J.type,className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:J.name}),s.jsxs("span",{className:"text-muted-foreground shrink-0",children:["(",xf(J.size),")"]}),s.jsx("button",{type:"button",onClick:()=>M(A),className:"ml-0.5 rounded hover:text-destructive transition-colors shrink-0",children:s.jsx(Be,{className:"h-3 w-3"})})]},A))}),s.jsxs("div",{className:"flex items-center justify-between mt-2",children:[s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>{var J;return(J=p.current)==null?void 0:J.click()},disabled:d,title:"Attach files",children:s.jsx(gx,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"text-[11px] text-muted-foreground/50 hidden sm:block",children:[s.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})]}),s.jsx(ee,{size:"icon",className:"h-8 w-8",onClick:H,disabled:!re||d,children:s.jsx(pD,{className:"h-3.5 w-3.5"})})]}),s.jsx("input",{ref:p,type:"file",multiple:!0,className:"hidden",onChange:J=>{const A=Array.from(J.target.files??[]);A.length>0&&T(A),J.target.value=""}}),f.active&&f.items.length>0&&s.jsx("div",{className:"absolute z-[9999]",style:Y,children:s.jsx(mS,{items:f.items,selectedIndex:f.selectedIndex,onSelect:L})})]})]})}const Gy=[{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 Yx(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)&65535;return Gy[t%Gy.length]}function a6({body:e}){const t=e.trim();return t?/^<[a-z][\s\S]*>/i.test(t)?s.jsx(Gx,{html:t,className:"text-xs"}):s.jsx("p",{className:"text-xs text-foreground leading-relaxed whitespace-pre-wrap",children:t}):null}const Vy={created:{icon:ot,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40"},status_changed:{icon:cx,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40"},assigned:{icon:Nn,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40"},unassigned:{icon:pN,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800"},updated:{icon:Fs,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40"}};function i6(e,t){var a,i,o,l;const{action:r,changes:n}=e;if(r==="created")return"created this issue";if(r==="status_changed"){const c=(a=n==null?void 0:n.status)==null?void 0:a.from,d=(i=n==null?void 0:n.status)==null?void 0:i.to;return s.jsxs(s.Fragment,{children:["changed status",c&&s.jsxs(s.Fragment,{children:[" from ",s.jsx("strong",{className:"font-medium text-foreground",children:gi[c]??c})]}),d&&s.jsxs(s.Fragment,{children:[" to ",s.jsx("strong",{className:"font-medium text-foreground",children:gi[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?s.jsx(s.Fragment,{children:"updated assignees"}):u.length>0?s.jsxs(s.Fragment,{children:["assigned ",s.jsx("strong",{className:"font-medium text-foreground",children:u.map(m).join(", ")})]}):f.length>0?s.jsxs(s.Fragment,{children:["unassigned ",s.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(s.jsxs("span",{children:["updated ",s.jsx("strong",{className:"font-medium text-foreground",children:d})]},d)):d==="priority"?c.push(s.jsxs("span",{children:["changed ",s.jsx("strong",{className:"font-medium text-foreground",children:"priority"}),f!=null&&s.jsxs(s.Fragment,{children:[" from ",s.jsx("strong",{className:"font-medium text-foreground",children:dn[f]??String(f)})]}),m!=null&&s.jsxs(s.Fragment,{children:[" to ",s.jsx("strong",{className:"font-medium text-foreground",children:dn[m]??String(m)})]})]},d)):d==="type"?c.push(s.jsxs("span",{children:["changed ",s.jsx("strong",{className:"font-medium text-foreground",children:"type"}),f!=null&&s.jsxs(s.Fragment,{children:[" from ",s.jsx("strong",{className:"font-medium text-foreground",children:Bs[f]??String(f)})]}),m!=null&&s.jsxs(s.Fragment,{children:[" to ",s.jsx("strong",{className:"font-medium text-foreground",children:Bs[m]??String(m)})]})]},d)):c.push(s.jsxs("span",{children:["updated ",s.jsx("strong",{className:"font-medium text-foreground",children:d.replace(/_/g," ")})]},d))}return c.length===0?"made changes":s.jsx(s.Fragment,{children:c.reduce((d,u,f)=>f===0?[u]:[...d,s.jsx("span",{children:" and "},`sep-${f}`),u],[])})}return r.replace(/_/g," ")}function fS({issueId:e,projectId:t,className:r,compact:n,onViewMore:a,onTabChange:i,hideCommentInput:o,scrollMarginTop:l=0}){const[c,d]=h.useState("comments"),u=k=>{d(k),i==null||i(k)},f=h.useRef(null),m=h.useRef(null),{user:p}=De(),{data:x}=La(),{data:g,isLoading:v}=U5(e),{data:y,isLoading:b}=H5(e),{data:N}=Wk(e);h.useEffect(()=>{var w;const k=g==null?void 0:g.length;k!==void 0&&(m.current!==null&&k>m.current&&((w=f.current)==null||w.scrollIntoView({behavior:"smooth",block:"start"})),m.current=k)},[g==null?void 0:g.length]);const j=k=>{var w;if(p&&k===p.id){const S=p.first_name??"",_=p.last_name??"",C=`${S} ${_}`.trim()||p.email,P=(S[0]??_[0]??((w=p.email)==null?void 0:w[0])??"U").toUpperCase();return{name:C,initials:P}}return(x==null?void 0:x.get(k))??{name:"Unknown",initials:"?"}};return s.jsxs("div",{className:r,children:[s.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(k=>{const w=k==="comments"?(g==null?void 0:g.length)??0:k==="activity"?(y==null?void 0:y.length)??0:k==="attachments"?(N==null?void 0:N.length)??0:void 0,S=k==="comments"?"Comments":k==="activity"?"Activity":k==="attachments"?"Attachments":"Time",_=c===k;return s.jsxs("button",{onClick:()=>u(k),className:z("pb-2.5 mr-5 text-xs font-medium transition-colors border-b-2 -mb-px",_?"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:[S,w!=null&&w>0&&s.jsx("span",{className:z("ml-1.5 text-[10px] tabular-nums font-normal",_?"text-indigo-700 dark:text-indigo-500":"text-zinc-400"),children:w})]},k)})}),c==="comments"&&s.jsxs("div",{className:"px-6 pb-5 pt-4",children:[s.jsx("div",{ref:f,style:{scrollMarginTop:l},className:"space-y-5 mb-5",children:v?s.jsxs("div",{className:"flex gap-3",children:[s.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),s.jsx(le,{className:"h-16 flex-1"})]}):g&&g.length>0?(n?g.slice(0,5):g).map(k=>{const w=j(k.author_id),S=Yx(w.name),_=(N??[]).filter(C=>C.comment_id===k.id);return s.jsxs("div",{className:"flex gap-3",children:[s.jsx(Pt,{className:"h-7 w-7 mt-0.5 shrink-0",children:s.jsx(Mt,{className:z("text-[11px] font-semibold",S.bg,S.text),children:w.initials})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-baseline gap-2 mb-1.5",children:[s.jsx("span",{className:"text-xs font-semibold text-zinc-900 dark:text-zinc-100",children:w.name}),s.jsx("span",{className:"text-[11px] text-zinc-400 dark:text-zinc-500",children:fe(new Date(k.created_at),"MMM d, h:mm a")})]}),s.jsxs("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:[s.jsx(a6,{body:k.body}),_.length>0&&s.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:_.map(C=>s.jsx(D$,{attachment:C},C.id))})]})]})]},k.id)}):s.jsxs("div",{className:"flex flex-col items-center py-6 gap-2",children:[s.jsx("div",{className:"h-9 w-9 rounded-full bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:s.jsx(cN,{className:"h-4 w-4 text-zinc-400 dark:text-zinc-500"})}),s.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500",children:"No comments yet"})]})}),n&&g&&g.length>5&&a&&s.jsxs("button",{onClick:a,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 ",g.length," comments →"]}),!o&&s.jsx(uS,{issueId:e,projectId:t})]}),c==="activity"&&s.jsx("div",{className:"px-6 pb-6 pt-4",children:b?s.jsx("div",{className:"space-y-4",children:[1,2,3].map(k=>s.jsxs("div",{className:"flex gap-3",children:[s.jsx(le,{className:"h-6 w-6 rounded-full shrink-0 mt-0.5"}),s.jsx(le,{className:"h-4 flex-1 mt-1"})]},k))}):y&&y.length>0?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative",children:[s.jsx("div",{className:"absolute left-[11px] top-2 bottom-2 w-px bg-zinc-100 dark:bg-zinc-800"}),s.jsx("div",{className:"space-y-0",children:(n?y.slice(-5):y).map((k,w,S)=>{var E;const _=Vy[k.action]??Vy.updated,C=_.icon,P=((E=x==null?void 0:x.get(k.actor_id))==null?void 0:E.name)??"System",O=w===S.length-1;return s.jsxs("div",{className:z("relative flex gap-3",O?"pb-0":"pb-4"),children:[s.jsx("div",{className:z("relative z-10 flex h-6 w-6 shrink-0 items-center justify-center rounded-full mt-0.5",_.bg),children:s.jsx(C,{className:z("h-3 w-3",_.color)})}),s.jsxs("div",{className:"flex-1 min-w-0 pt-0.5",children:[s.jsxs("p",{className:"text-xs text-foreground leading-relaxed",children:[s.jsx("span",{className:"font-semibold text-zinc-900 dark:text-zinc-100",children:P})," ",s.jsx("span",{className:"text-zinc-500 dark:text-zinc-400",children:i6(k,x)})]}),s.jsx("p",{className:"text-[11px] text-zinc-400 dark:text-zinc-500 mt-0.5",children:fe(new Date(k.created_at),"MMM d, yyyy · h:mm a")})]})]},k.id)})})]}),n&&y.length>5&&a&&s.jsxs("button",{onClick:a,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 ",y.length," events →"]})]}):s.jsx("p",{className:"text-xs text-zinc-400 dark:text-zinc-500 py-4",children:"No activity yet."})}),c==="attachments"&&s.jsx(R$,{issueId:e}),c==="time"&&s.jsx(s6,{issueId:e})]})}function mS({items:e,selectedIndex:t,onSelect:r}){const n=h.useRef(null);return h.useEffect(()=>{var i;const a=(i=n.current)==null?void 0:i.querySelector(`[data-index="${t}"]`);a==null||a.scrollIntoView({block:"nearest"})},[t]),e.length===0?null:s.jsx("div",{className:z("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:s.jsx("div",{ref:n,className:"max-h-[200px] overflow-y-auto p-1",role:"listbox",children:e.map((a,i)=>{const o=a.label.split(" ").map(c=>c[0]).join("").toUpperCase().slice(0,2)||"?",l=Yx(a.label);return s.jsxs("button",{"data-index":i,role:"option","aria-selected":i===t,onMouseDown:c=>{c.preventDefault(),r(a)},className:z("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:[s.jsx(Pt,{className:"h-5 w-5 shrink-0",children:s.jsx(Mt,{className:z("text-[9px] font-semibold",l.bg,l.text),children:o})}),s.jsxs("div",{className:"flex flex-col items-start min-w-0",children:[s.jsx("span",{className:"font-medium text-foreground truncate leading-tight",children:a.label}),s.jsx("span",{className:"text-[10px] text-muted-foreground truncate leading-tight",children:a.email})]})]},a.id)})})})}const Jc={active:!1,items:[],selectedIndex:0,rect:null,command:null};function o6({onClick:e,active:t,disabled:r,title:n,children:a}){return s.jsx("button",{type:"button",title:n,disabled:r,onMouseDown:i=>{i.preventDefault(),e()},className:z("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:a})}function ed(){return s.jsx("span",{className:"mx-0.5 h-4 w-px shrink-0 bg-border"})}function gf({content:e="",onChange:t,placeholder:r="Add a description…",className:n,toolbarClassName:a,editorClassName:i,users:o}){const[l,c]=h.useState(Jc),d=h.useRef(c);d.current=c;const u=h.useRef([]);o&&(u.current=o);const f=h.useRef([]),m=h.useRef(null),p=h.useRef(0),x=h.useMemo(()=>o!==void 0?qk.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:k})=>{const w=u.current;if(!w.length)return[];const S=k.toLowerCase();return w.filter(_=>!S||_.label.toLowerCase().includes(S)||_.email.toLowerCase().includes(S)).slice(0,8)},render:()=>({onStart:k=>{var w;f.current=k.items,m.current=k.command,p.current=0,d.current({active:!0,items:k.items,selectedIndex:0,rect:((w=k.clientRect)==null?void 0:w.call(k))??null,command:k.command})},onUpdate:k=>{var w;f.current=k.items,m.current=k.command,p.current=0,d.current({active:!0,items:k.items,selectedIndex:0,rect:((w=k.clientRect)==null?void 0:w.call(k))??null,command:k.command})},onKeyDown:({event:k})=>{var S;const w=f.current;if(!w.length)return!1;if(k.key==="Escape")return d.current(Jc),!0;if(k.key==="ArrowDown"){const _=(p.current+1)%w.length;return p.current=_,d.current(C=>({...C,selectedIndex:_})),!0}if(k.key==="ArrowUp"){const _=(p.current-1+w.length)%w.length;return p.current=_,d.current(C=>({...C,selectedIndex:_})),!0}if(k.key==="Enter"){const _=w[p.current];return _&&((S=m.current)==null||S.call(m,_)),!0}return!1},onExit:()=>{d.current(Jc),m.current=null}})}}):null,[o!==void 0]),g=h.useCallback(k=>{var w;(w=m.current)==null||w.call(m,k),c(Jc)},[]),v=h.useRef(null),y=h.useMemo(()=>{if(!l.rect||!v.current)return{top:0,left:0};const k=v.current.getBoundingClientRect();return{top:l.rect.bottom-k.top+4,left:Math.max(0,l.rect.left-k.left)}},[l.rect]),b=A1({extensions:[D1.configure({heading:{levels:[1,2,3]}}),T1,vA,yA.configure({nested:!0}),I1.configure({placeholder:r}),...x?[x]:[]],content:e||"",editorProps:{attributes:{class:"meridian-editor"}},onUpdate({editor:k}){t&&t(k.isEmpty?"":k.getHTML())}});if(!b)return null;const N=(k,w,S,_,C)=>s.jsx(o6,{title:k,onClick:S,active:_,disabled:C,children:w},k),j="h-3.5 w-3.5";return s.jsxs("div",{ref:v,className:"relative",children:[s.jsxs("div",{className:z("flex flex-col overflow-hidden",n),children:[s.jsxs("div",{className:z("flex flex-wrap items-center gap-0.5 px-3 py-1.5 border-b border-border bg-muted/30",a),children:[N("Undo",s.jsx(ND,{className:j}),()=>b.chain().focus().undo().run(),!1,!b.can().undo()),N("Redo",s.jsx(hD,{className:j}),()=>b.chain().focus().redo().run(),!1,!b.can().redo()),s.jsx(ed,{}),N("Bold (⌘B)",s.jsx(J1,{className:j}),()=>b.chain().focus().toggleBold().run(),b.isActive("bold")),N("Italic (⌘I)",s.jsx(iN,{className:j}),()=>b.chain().focus().toggleItalic().run(),b.isActive("italic")),N("Underline (⌘U)",s.jsx(wD,{className:j}),()=>b.chain().focus().toggleUnderline().run(),b.isActive("underline")),N("Strikethrough",s.jsx(fN,{className:j}),()=>b.chain().focus().toggleStrike().run(),b.isActive("strike")),N("Inline code",s.jsx(sN,{className:j}),()=>b.chain().focus().toggleCode().run(),b.isActive("code")),s.jsx(ed,{}),N("Heading 1",s.jsx(sD,{className:j}),()=>b.chain().focus().toggleHeading({level:1}).run(),b.isActive("heading",{level:1})),N("Heading 2",s.jsx(aD,{className:j}),()=>b.chain().focus().toggleHeading({level:2}).run(),b.isActive("heading",{level:2})),N("Heading 3",s.jsx(iD,{className:j}),()=>b.chain().focus().toggleHeading({level:3}).run(),b.isActive("heading",{level:3})),s.jsx(ed,{}),N("Bullet list",s.jsx(xx,{className:j}),()=>b.chain().focus().toggleBulletList().run(),b.isActive("bulletList")),N("Ordered list",s.jsx(lN,{className:j}),()=>b.chain().focus().toggleOrderedList().run(),b.isActive("orderedList")),N("Task list",s.jsx(cD,{className:j}),()=>b.chain().focus().toggleTaskList().run(),b.isActive("taskList")),s.jsx(ed,{}),N("Blockquote",s.jsx(mD,{className:j}),()=>b.chain().focus().toggleBlockquote().run(),b.isActive("blockquote")),N("Code block",s.jsx(nN,{className:j}),()=>b.chain().focus().toggleCodeBlock().run(),b.isActive("codeBlock")),N("Divider line",s.jsx(Js,{className:j}),()=>b.chain().focus().setHorizontalRule().run())]}),s.jsx(R1,{editor:b,className:z("flex-1 px-5 py-4",i)})]}),l.active&&l.items.length>0&&s.jsx("div",{className:"absolute z-[9999]",style:y,children:s.jsx(mS,{items:l.items,selectedIndex:l.selectedIndex,onSelect:g})})]})}function Gx({html:e,className:t}){return e?s.jsx("div",{className:z("meridian-editor",t),dangerouslySetInnerHTML:{__html:C$.sanitize(e,{ADD_ATTR:["data-type","data-id","data-label"]})}}):null}function l6(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 Vm={},wl={};function ni(e,t){try{const n=(Vm[e]||(Vm[e]=new Intl.DateTimeFormat("en-US",{timeZone:e,timeZoneName:"longOffset"}).format))(t).split("GMT")[1];return n in wl?wl[n]:Xy(n,n.split(":"))}catch{if(e in wl)return wl[e];const r=e==null?void 0:e.match(c6);return r?Xy(e,r.slice(1)):NaN}}const c6=/([+-]\d\d):?(\d\d)?/;function Xy(e,t){const r=+(t[0]||0),n=+(t[1]||0),a=+(t[2]||0)/60;return wl[e]=r*60+n>0?r*60+n+a:r*60-n-a}class as extends Date{constructor(...t){super(),t.length>1&&typeof t[t.length-1]=="string"&&(this.timeZone=t.pop()),this.internal=new Date,isNaN(ni(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)),hS(this),Kh(this)):this.setTime(Date.now())}static tz(t,...r){return r.length?new as(...r,t):new as(Date.now(),t)}withTimeZone(t){return new as(+this,t)}getTimezoneOffset(){const t=-ni(this.timeZone,this);return t>0?Math.floor(t):Math.ceil(t)}setTime(t){return Date.prototype.setTime.apply(this,arguments),Kh(this),+this}[Symbol.for("constructDateFrom")](t){return new as(+new Date(t),this.timeZone)}}const Qy=/^(get|set)(?!UTC)/;Object.getOwnPropertyNames(Date.prototype).forEach(e=>{if(!Qy.test(e))return;const t=e.replace(Qy,"$1UTC");as.prototype[t]&&(e.startsWith("get")?as.prototype[e]=function(){return this.internal[t]()}:(as.prototype[e]=function(){return Date.prototype[t].apply(this.internal,arguments),d6(this),+this},as.prototype[t]=function(){return Date.prototype[t].apply(this,arguments),Kh(this),+this}))});function Kh(e){e.internal.setTime(+e),e.internal.setUTCSeconds(e.internal.getUTCSeconds()-Math.round(-ni(e.timeZone,e)*60))}function d6(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()),hS(e)}function hS(e){const t=ni(e.timeZone,e),r=t>0?Math.floor(t):Math.ceil(t),n=new Date(+e);n.setUTCHours(n.getUTCHours()-1);const a=-new Date(+e).getTimezoneOffset(),i=-new Date(+n).getTimezoneOffset(),o=a-i,l=Date.prototype.getHours.apply(e)!==e.internal.getUTCHours();o&&l&&e.internal.setUTCMinutes(e.internal.getUTCMinutes()+o);const c=a-r;c&&Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+c);const d=new Date(+e);d.setUTCSeconds(0);const u=a>0?d.getSeconds():(d.getSeconds()-60)%60,f=Math.round(-(ni(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=ni(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 b=ni(e.timeZone,e),N=b>0?Math.floor(b):Math.ceil(b),j=p-N;j&&(e.internal.setUTCMinutes(e.internal.getUTCMinutes()+j),Date.prototype.setUTCMinutes.call(e,Date.prototype.getUTCMinutes.call(e)+j))}}class vr extends as{static tz(t,...r){return r.length?new vr(...r,t):new vr(Date.now(),t)}toISOString(){const[t,r,n]=this.tzComponents(),a=`${t}${r}:${n}`;return this.internal.toISOString().slice(0,-1)+a}toString(){return`${this.toDateString()} ${this.toTimeString()}`}toDateString(){const[t,r,n,a]=this.internal.toUTCString().split(" ");return`${t==null?void 0:t.slice(0,-1)} ${n} ${r} ${a}`}toTimeString(){const t=this.internal.toUTCString().split(" ")[4],[r,n,a]=this.tzComponents();return`${t} GMT${r}${n}${a} (${l6(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"),a=String(Math.abs(t)%60).padStart(2,"0");return[r,n,a]}withTimeZone(t){return new vr(+this,t)}[Symbol.for("constructDateFrom")](t){return new vr(+new Date(t),this.timeZone)}}const Zy=5,u6=4;function f6(e,t){const r=t.startOfMonth(e),n=r.getDay()>0?r.getDay():7,a=t.addDays(e,-n+1),i=t.addDays(a,Zy*7-1);return t.getMonth(e)===t.getMonth(i)?Zy:u6}function pS(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 m6(e,t){const r=pS(e,t),n=f6(e,t);return t.addDays(r,n*7-1)}const xS={...ei,labels:{labelDayButton:(e,t,r,n)=>{let a;n&&typeof n.format=="function"?a=n.format.bind(n):a=(o,l)=>fe(o,l,{locale:ei,...r});let i=a(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=(a,i)=>fe(a,i,{locale:ei,...t}),n(e,"LLLL yyyy")},labelGridcell:(e,t,r,n)=>{let a;n&&typeof n.format=="function"?a=n.format.bind(n):a=(o,l)=>fe(o,l,{locale:ei,...r});let i=a(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=(a,i)=>fe(a,i,{locale:ei,...t}),n(e,"cccc")}}};class un{constructor(t,r){this.Date=Date,this.today=()=>{var n;return(n=this.overrides)!=null&&n.today?this.overrides.today():this.options.timeZone?vr.tz(this.options.timeZone):new this.Date},this.newDate=(n,a,i)=>{var o;return(o=this.overrides)!=null&&o.newDate?this.overrides.newDate(n,a,i):this.options.timeZone?new vr(n,a,i,this.options.timeZone):new Date(n,a,i)},this.addDays=(n,a)=>{var i;return(i=this.overrides)!=null&&i.addDays?this.overrides.addDays(n,a):Yr(n,a)},this.addMonths=(n,a)=>{var i;return(i=this.overrides)!=null&&i.addMonths?this.overrides.addMonths(n,a):Ix(n,a)},this.addWeeks=(n,a)=>{var i;return(i=this.overrides)!=null&&i.addWeeks?this.overrides.addWeeks(n,a):t4(n,a)},this.addYears=(n,a)=>{var i;return(i=this.overrides)!=null&&i.addYears?this.overrides.addYears(n,a):r4(n,a)},this.differenceInCalendarDays=(n,a)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarDays?this.overrides.differenceInCalendarDays(n,a):ff(n,a)},this.differenceInCalendarMonths=(n,a)=>{var i;return(i=this.overrides)!=null&&i.differenceInCalendarMonths?this.overrides.differenceInCalendarMonths(n,a):$x(n,a)},this.eachMonthOfInterval=n=>{var a;return(a=this.overrides)!=null&&a.eachMonthOfInterval?this.overrides.eachMonthOfInterval(n):d4(n)},this.eachYearOfInterval=n=>{var l;const a=(l=this.overrides)!=null&&l.eachYearOfInterval?this.overrides.eachYearOfInterval(n):f4(n),i=new Set(a.map(c=>this.getYear(c)));if(i.size===a.length)return a;const o=[];return i.forEach(c=>{o.push(new Date(c,0,1))}),o},this.endOfBroadcastWeek=n=>{var a;return(a=this.overrides)!=null&&a.endOfBroadcastWeek?this.overrides.endOfBroadcastWeek(n):m6(n,this)},this.endOfISOWeek=n=>{var a;return(a=this.overrides)!=null&&a.endOfISOWeek?this.overrides.endOfISOWeek(n):m4(n)},this.endOfMonth=n=>{var a;return(a=this.overrides)!=null&&a.endOfMonth?this.overrides.endOfMonth(n):zx(n)},this.endOfWeek=(n,a)=>{var i;return(i=this.overrides)!=null&&i.endOfWeek?this.overrides.endOfWeek(n,a):Pk(n,this.options)},this.endOfYear=n=>{var a;return(a=this.overrides)!=null&&a.endOfYear?this.overrides.endOfYear(n):u4(n)},this.format=(n,a,i)=>{var l;const o=(l=this.overrides)!=null&&l.format?this.overrides.format(n,a,this.options):fe(n,a,this.options);return this.options.numerals&&this.options.numerals!=="latn"?this.replaceDigits(o):o},this.getISOWeek=n=>{var a;return(a=this.overrides)!=null&&a.getISOWeek?this.overrides.getISOWeek(n):Lx(n)},this.getMonth=(n,a)=>{var i;return(i=this.overrides)!=null&&i.getMonth?this.overrides.getMonth(n,this.options):kd(n,this.options)},this.getYear=(n,a)=>{var i;return(i=this.overrides)!=null&&i.getYear?this.overrides.getYear(n,this.options):uR(n,this.options)},this.getWeek=(n,a)=>{var i;return(i=this.overrides)!=null&&i.getWeek?this.overrides.getWeek(n,this.options):Fx(n,this.options)},this.isAfter=(n,a)=>{var i;return(i=this.overrides)!=null&&i.isAfter?this.overrides.isAfter(n,a):fR(n,a)},this.isBefore=(n,a)=>{var i;return(i=this.overrides)!=null&&i.isBefore?this.overrides.isBefore(n,a):mR(n,a)},this.isDate=n=>{var a;return(a=this.overrides)!=null&&a.isDate?this.overrides.isDate(n):bk(n)},this.isSameDay=(n,a)=>{var i;return(i=this.overrides)!=null&&i.isSameDay?this.overrides.isSameDay(n,a):oo(n,a)},this.isSameMonth=(n,a)=>{var i;return(i=this.overrides)!=null&&i.isSameMonth?this.overrides.isSameMonth(n,a):hR(n,a)},this.isSameYear=(n,a)=>{var i;return(i=this.overrides)!=null&&i.isSameYear?this.overrides.isSameYear(n,a):pR(n,a)},this.max=n=>{var a;return(a=this.overrides)!=null&&a.max?this.overrides.max(n):n4(n)},this.min=n=>{var a;return(a=this.overrides)!=null&&a.min?this.overrides.min(n):s4(n)},this.setMonth=(n,a)=>{var i;return(i=this.overrides)!=null&&i.setMonth?this.overrides.setMonth(n,a):vR(n,a)},this.setYear=(n,a)=>{var i;return(i=this.overrides)!=null&&i.setYear?this.overrides.setYear(n,a):yR(n,a)},this.startOfBroadcastWeek=(n,a)=>{var i;return(i=this.overrides)!=null&&i.startOfBroadcastWeek?this.overrides.startOfBroadcastWeek(n,this):pS(n,this)},this.startOfDay=n=>{var a;return(a=this.overrides)!=null&&a.startOfDay?this.overrides.startOfDay(n):io(n)},this.startOfISOWeek=n=>{var a;return(a=this.overrides)!=null&&a.startOfISOWeek?this.overrides.startOfISOWeek(n):Il(n)},this.startOfMonth=n=>{var a;return(a=this.overrides)!=null&&a.startOfMonth?this.overrides.startOfMonth(n):Ck(n)},this.startOfWeek=(n,a)=>{var i;return(i=this.overrides)!=null&&i.startOfWeek?this.overrides.startOfWeek(n,this.options):ao(n,this.options)},this.startOfYear=n=>{var a;return(a=this.overrides)!=null&&a.startOfYear?this.overrides.startOfYear(n):_k(n)},this.options={locale:xS,...t},this.overrides=r}getDigitMap(){const{numerals:t="latn"}=this.options,r=new Intl.NumberFormat("en-US",{numberingSystem:t}),n={};for(let a=0;a<10;a++)n[a.toString()]=r.format(a);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&&un.yearFirstLocales.has(t)?"year-first":"month-first"}formatMonthYear(t){const{locale:r,timeZone:n,numerals:a}=this.options,i=r==null?void 0:r.code;if(i&&un.yearFirstLocales.has(i))try{return new Intl.DateTimeFormat(i,{month:"long",year:"numeric",timeZone:n,numberingSystem:a}).format(t)}catch{}const o=this.getMonthYearOrder()==="year-first"?"y LLLL":"LLLL y";return this.format(t,o)}}un.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 ys=new un;class gS{constructor(t,r,n=ys){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 h6{constructor(t,r){this.date=t,this.weeks=r}}class p6{constructor(t,r){this.days=r,this.weekNumber=t}}function x6(e){return W.createElement("button",{...e})}function g6(e){return W.createElement("span",{...e})}function v6(e){const{size:t=24,orientation:r="left",className:n}=e;return W.createElement("svg",{className:n,width:t,height:t,viewBox:"0 0 24 24"},r==="up"&&W.createElement("polygon",{points:"6.77 17 12.5 11.43 18.24 17 20 15.28 12.5 8 5 15.28"}),r==="down"&&W.createElement("polygon",{points:"6.77 8 12.5 13.57 18.24 8 20 9.72 12.5 17 5 9.72"}),r==="left"&&W.createElement("polygon",{points:"16 18.112 9.81111111 12 16 5.87733333 14.0888889 4 6 12 14.0888889 20"}),r==="right"&&W.createElement("polygon",{points:"8 18.112 14.18888889 12 8 5.87733333 9.91111111 4 18 12 9.91111111 20"}))}function y6(e){const{day:t,modifiers:r,...n}=e;return W.createElement("td",{...n})}function b6(e){const{day:t,modifiers:r,...n}=e,a=W.useRef(null);return W.useEffect(()=>{var i;r.focused&&((i=a.current)==null||i.focus())},[r.focused]),W.createElement("button",{ref:a,...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 St;(function(e){e.disabled="disabled",e.hidden="hidden",e.outside="outside",e.focused="focused",e.today="today"})(St||(St={}));var Bn;(function(e){e.range_end="range_end",e.range_middle="range_middle",e.range_start="range_start",e.selected="selected"})(Bn||(Bn={}));var nn;(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"})(nn||(nn={}));function j6(e){const{options:t,className:r,components:n,classNames:a,...i}=e,o=[a[Me.Dropdown],r].join(" "),l=t==null?void 0:t.find(({value:c})=>c===i.value);return W.createElement("span",{"data-disabled":i.disabled,className:a[Me.DropdownRoot]},W.createElement(n.Select,{className:o,...i},t==null?void 0:t.map(({value:c,label:d,disabled:u})=>W.createElement(n.Option,{key:c,value:c,disabled:u},d))),W.createElement("span",{className:a[Me.CaptionLabel],"aria-hidden":!0},l==null?void 0:l.label,W.createElement(n.Chevron,{orientation:"down",size:18,className:a[Me.Chevron]})))}function w6(e){return W.createElement("div",{...e})}function N6(e){return W.createElement("div",{...e})}function k6(e){const{calendarMonth:t,displayIndex:r,...n}=e;return W.createElement("div",{...n},e.children)}function S6(e){const{calendarMonth:t,displayIndex:r,...n}=e;return W.createElement("div",{...n})}function C6(e){return W.createElement("table",{...e})}function _6(e){return W.createElement("div",{...e})}const vS=h.createContext(void 0);function bc(){const e=h.useContext(vS);if(e===void 0)throw new Error("useDayPicker() must be used within a custom component.");return e}function P6(e){const{components:t}=bc();return W.createElement(t.Dropdown,{...e})}function M6(e){const{onPreviousClick:t,onNextClick:r,previousMonth:n,nextMonth:a,...i}=e,{components:o,classNames:l,labels:{labelPrevious:c,labelNext:d}}=bc(),u=h.useCallback(m=>{a&&(r==null||r(m))},[a,r]),f=h.useCallback(m=>{n&&(t==null||t(m))},[n,t]);return W.createElement("nav",{...i},W.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},W.createElement(o.Chevron,{disabled:n?void 0:!0,className:l[Me.Chevron],orientation:"left"})),W.createElement(o.NextMonthButton,{type:"button",className:l[Me.NextMonthButton],tabIndex:a?void 0:-1,"aria-disabled":a?void 0:!0,"aria-label":d(a),onClick:u},W.createElement(o.Chevron,{disabled:a?void 0:!0,orientation:"right",className:l[Me.Chevron]})))}function O6(e){const{components:t}=bc();return W.createElement(t.Button,{...e})}function E6(e){return W.createElement("option",{...e})}function A6(e){const{components:t}=bc();return W.createElement(t.Button,{...e})}function D6(e){const{rootRef:t,...r}=e;return W.createElement("div",{...r,ref:t})}function T6(e){return W.createElement("select",{...e})}function I6(e){const{week:t,...r}=e;return W.createElement("tr",{...r})}function R6(e){return W.createElement("th",{...e})}function $6(e){return W.createElement("thead",{"aria-hidden":!0},W.createElement("tr",{...e}))}function z6(e){const{week:t,...r}=e;return W.createElement("th",{...r})}function L6(e){return W.createElement("th",{...e})}function F6(e){return W.createElement("tbody",{...e})}function B6(e){const{components:t}=bc();return W.createElement(t.Dropdown,{...e})}const q6=Object.freeze(Object.defineProperty({__proto__:null,Button:x6,CaptionLabel:g6,Chevron:v6,Day:y6,DayButton:b6,Dropdown:j6,DropdownNav:w6,Footer:N6,Month:k6,MonthCaption:S6,MonthGrid:C6,Months:_6,MonthsDropdown:P6,Nav:M6,NextMonthButton:O6,Option:E6,PreviousMonthButton:A6,Root:D6,Select:T6,Week:I6,WeekNumber:z6,WeekNumberHeader:L6,Weekday:R6,Weekdays:$6,Weeks:F6,YearsDropdown:B6},Symbol.toStringTag,{value:"Module"}));function Ms(e,t,r=!1,n=ys){let{from:a,to:i}=e;const{differenceInCalendarDays:o,isSameDay:l}=n;return a&&i?(o(i,a)<0&&([a,i]=[i,a]),o(t,a)>=(r?1:0)&&o(i,t)>=(r?1:0)):!r&&i?l(i,t):!r&&a?l(a,t):!1}function Vx(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function vf(e){return!!(e&&typeof e=="object"&&"from"in e)}function Xx(e){return!!(e&&typeof e=="object"&&"after"in e)}function Qx(e){return!!(e&&typeof e=="object"&&"before"in e)}function yS(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function bS(e,t){return Array.isArray(e)&&e.every(t.isDate)}function Os(e,t,r=ys){const n=Array.isArray(t)?t:[t],{isSameDay:a,differenceInCalendarDays:i,isAfter:o}=r;return n.some(l=>{if(typeof l=="boolean")return l;if(r.isDate(l))return a(e,l);if(bS(l,r))return l.some(c=>a(e,c));if(vf(l))return Ms(l,e,!1,r);if(yS(l))return Array.isArray(l.dayOfWeek)?l.dayOfWeek.includes(e.getDay()):l.dayOfWeek===e.getDay();if(Vx(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 Xx(l)?i(e,l.after)>0:Qx(l)?i(l.before,e)>0:typeof l=="function"?l(e):!1})}function W6(e,t,r,n,a){const{disabled:i,hidden:o,modifiers:l,showOutsideDays:c,broadcastCalendar:d,today:u=a.today()}=t,{isSameDay:f,isSameMonth:m,startOfMonth:p,isBefore:x,endOfMonth:g,isAfter:v}=a,y=r&&p(r),b=n&&g(n),N={[St.focused]:[],[St.outside]:[],[St.disabled]:[],[St.hidden]:[],[St.today]:[]},j={};for(const k of e){const{date:w,displayMonth:S}=k,_=!!(S&&!m(w,S)),C=!!(y&&x(w,y)),P=!!(b&&v(w,b)),O=!!(i&&Os(w,i,a)),E=!!(o&&Os(w,o,a))||C||P||!d&&!c&&_||d&&c===!1&&_,D=f(w,u);_&&N.outside.push(k),O&&N.disabled.push(k),E&&N.hidden.push(k),D&&N.today.push(k),l&&Object.keys(l).forEach(I=>{const V=l==null?void 0:l[I];V&&Os(w,V,a)&&(j[I]?j[I].push(k):j[I]=[k])})}return k=>{const w={[St.focused]:!1,[St.disabled]:!1,[St.hidden]:!1,[St.outside]:!1,[St.today]:!1},S={};for(const _ in N){const C=N[_];w[_]=C.some(P=>P===k)}for(const _ in j)S[_]=j[_].some(C=>C===k);return{...w,...S}}}function U6(e,t,r={}){return Object.entries(e).filter(([,a])=>a===!0).reduce((a,[i])=>(r[i]?a.push(r[i]):t[St[i]]?a.push(t[St[i]]):t[Bn[i]]&&a.push(t[Bn[i]]),a),[t[Me.Day]])}function H6(e){return{...q6,...e}}function K6(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 Y6(){const e={};for(const t in Me)e[Me[t]]=`rdp-${Me[t]}`;for(const t in St)e[St[t]]=`rdp-${St[t]}`;for(const t in Bn)e[Bn[t]]=`rdp-${Bn[t]}`;for(const t in nn)e[nn[t]]=`rdp-${nn[t]}`;return e}function jS(e,t,r){return(r??new un(t)).formatMonthYear(e)}const G6=jS;function V6(e,t,r){return(r??new un(t)).format(e,"d")}function X6(e,t=ys){return t.format(e,"LLLL")}function Q6(e,t,r){return(r??new un(t)).format(e,"cccccc")}function Z6(e,t=ys){return e<10?t.formatNumber(`0${e.toLocaleString()}`):t.formatNumber(`${e.toLocaleString()}`)}function J6(){return""}function wS(e,t=ys){return t.format(e,"yyyy")}const ez=wS,tz=Object.freeze(Object.defineProperty({__proto__:null,formatCaption:jS,formatDay:V6,formatMonthCaption:G6,formatMonthDropdown:X6,formatWeekNumber:Z6,formatWeekNumberHeader:J6,formatWeekdayName:Q6,formatYearCaption:ez,formatYearDropdown:wS},Symbol.toStringTag,{value:"Module"}));function rz(e){return e!=null&&e.formatMonthCaption&&!e.formatCaption&&(e.formatCaption=e.formatMonthCaption),e!=null&&e.formatYearCaption&&!e.formatYearDropdown&&(e.formatYearDropdown=e.formatYearCaption),{...tz,...e}}function Zx(e,t,r,n){let a=(n??new un(r)).format(e,"PPPP");return t.today&&(a=`Today, ${a}`),t.selected&&(a=`${a}, selected`),a}const nz=Zx;function Jx(e,t,r){return(r??new un(t)).formatMonthYear(e)}const sz=Jx;function NS(e,t,r,n){let a=(n??new un(r)).format(e,"PPPP");return t!=null&&t.today&&(a=`Today, ${a}`),a}function kS(e){return"Choose the Month"}function SS(){return""}const az="Go to the Next Month";function CS(e,t){return az}function _S(e){return"Go to the Previous Month"}function PS(e,t,r){return(r??new un(t)).format(e,"cccc")}function MS(e,t){return`Week ${e}`}function OS(e){return"Week Number"}function ES(e){return"Choose the Year"}const iz=Object.freeze(Object.defineProperty({__proto__:null,labelCaption:sz,labelDay:nz,labelDayButton:Zx,labelGrid:Jx,labelGridcell:NS,labelMonthDropdown:kS,labelNav:SS,labelNext:CS,labelPrevious:_S,labelWeekNumber:MS,labelWeekNumberHeader:OS,labelWeekday:PS,labelYearDropdown:ES},Symbol.toStringTag,{value:"Module"})),In=(e,t,r)=>t||(r?typeof r=="function"?r:(...n)=>r:e);function oz(e,t){var n;const r=((n=t.locale)==null?void 0:n.labels)??{};return{...iz,...e??{},labelDayButton:In(Zx,e==null?void 0:e.labelDayButton,r.labelDayButton),labelMonthDropdown:In(kS,e==null?void 0:e.labelMonthDropdown,r.labelMonthDropdown),labelNext:In(CS,e==null?void 0:e.labelNext,r.labelNext),labelPrevious:In(_S,e==null?void 0:e.labelPrevious,r.labelPrevious),labelWeekNumber:In(MS,e==null?void 0:e.labelWeekNumber,r.labelWeekNumber),labelYearDropdown:In(ES,e==null?void 0:e.labelYearDropdown,r.labelYearDropdown),labelGrid:In(Jx,e==null?void 0:e.labelGrid,r.labelGrid),labelGridcell:In(NS,e==null?void 0:e.labelGridcell,r.labelGridcell),labelNav:In(SS,e==null?void 0:e.labelNav,r.labelNav),labelWeekNumberHeader:In(OS,e==null?void 0:e.labelWeekNumberHeader,r.labelWeekNumberHeader),labelWeekday:In(PS,e==null?void 0:e.labelWeekday,r.labelWeekday)}}function lz(e,t,r,n,a){const{startOfMonth:i,startOfYear:o,endOfYear:l,eachMonthOfInterval:c,getMonth:d}=a;return c({start:o(e),end:l(e)}).map(m=>{const p=n.formatMonthDropdown(m,a),x=d(m),g=t&&m<i(t)||r&&m>i(r)||!1;return{value:x,label:p,disabled:g}})}function cz(e,t={},r={}){let n={...t==null?void 0:t[Me.Day]};return Object.entries(e).filter(([,a])=>a===!0).forEach(([a])=>{n={...n,...r==null?void 0:r[a]}}),n}function dz(e,t,r,n){const a=n??e.today(),i=r?e.startOfBroadcastWeek(a,e):t?e.startOfISOWeek(a):e.startOfWeek(a),o=[];for(let l=0;l<7;l++){const c=e.addDays(i,l);o.push(c)}return o}function uz(e,t,r,n,a=!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 a&&f.reverse(),f.map(m=>{const p=r.formatYearDropdown(m,n);return{value:c(m),label:p,disabled:!1}})}function fz(e,t={}){var l;const{weekStartsOn:r,locale:n}=t,a=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 vr(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(vr.tz(e)),newDate:(c,d,u)=>new vr(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)??a,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)??a)+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 vr(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 vr(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 vr(d.getFullYear(),0,1,12,0,0,e);for(;m.getFullYear()<=u.getFullYear();)f.push(new vr(m,e)),m.setFullYear(m.getFullYear()+1,0,1);return f},getWeek:(c,d)=>{var f;const u=o(c);return Fx(u,{weekStartsOn:(d==null?void 0:d.weekStartsOn)??a,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 Lx(d)},differenceInCalendarDays:(c,d)=>{const u=o(c),f=o(d);return ff(u,f)},differenceInCalendarMonths:(c,d)=>{const u=o(c),f=o(d);return $x(u,f)}}}const jc=e=>e instanceof HTMLElement?e:null,Xm=e=>[...e.querySelectorAll("[data-animated-month]")??[]],mz=e=>jc(e.querySelector("[data-animated-month]")),Qm=e=>jc(e.querySelector("[data-animated-caption]")),Zm=e=>jc(e.querySelector("[data-animated-weeks]")),hz=e=>jc(e.querySelector("[data-animated-nav]")),pz=e=>jc(e.querySelector("[data-animated-weekdays]"));function xz(e,t,{classNames:r,months:n,focused:a,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[nn.caption_after_enter]:r[nn.caption_before_enter],p=f?r[nn.weeks_after_enter]:r[nn.weeks_before_enter],x=o.current,g=e.current.cloneNode(!0);if(g instanceof HTMLElement?(Xm(g).forEach(N=>{if(!(N instanceof HTMLElement))return;const j=mz(N);j&&N.contains(j)&&N.removeChild(j);const k=Qm(N);k&&k.classList.remove(m);const w=Zm(N);w&&w.classList.remove(p)}),o.current=g):o.current=null,c.current||u||a)return;const v=x instanceof HTMLElement?Xm(x):[],y=Xm(e.current);if(y!=null&&y.every(b=>b instanceof HTMLElement)&&v&&v.every(b=>b instanceof HTMLElement)){c.current=!0,e.current.style.isolation="isolate";const b=hz(e.current);b&&(b.style.zIndex="1"),y.forEach((N,j)=>{const k=v[j];if(!k)return;N.style.position="relative",N.style.overflow="hidden";const w=Qm(N);w&&w.classList.add(m);const S=Zm(N);S&&S.classList.add(p);const _=()=>{c.current=!1,e.current&&(e.current.style.isolation=""),b&&(b.style.zIndex=""),w&&w.classList.remove(m),S&&S.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 C=pz(k);C&&(C.style.opacity="0");const P=Qm(k);P&&(P.classList.add(f?r[nn.caption_before_exit]:r[nn.caption_after_exit]),P.addEventListener("animationend",_));const O=Zm(k);O&&O.classList.add(f?r[nn.weeks_before_exit]:r[nn.weeks_after_exit]),N.insertBefore(k,N.firstChild)})}})}function gz(e,t,r,n){const a=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:b,startOfWeek:N}=n,j=c?y(a,n):o?b(a):N(a),k=c?m(i):o?p(x(i)):g(x(i)),w=t&&(c?m(t):o?p(t):g(t)),S=w&&v(k,w)?w:k,_=u(S,j),C=f(i,a)+1,P=[];for(let D=0;D<=_;D++){const I=d(j,D);P.push(I)}const E=(c?35:42)*C;if(l&&P.length<E){const D=E-P.length;for(let I=0;I<D;I++){const V=d(P[P.length-1],1);P.push(V)}}return P}function vz(e){const t=[];return e.reduce((r,n)=>{const a=n.weeks.reduce((i,o)=>i.concat(o.days.slice()),t.slice());return r.concat(a.slice())},t.slice())}function yz(e,t,r,n){const{numberOfMonths:a=1}=r,i=[];for(let o=0;o<a;o++){const l=n.addMonths(e,o);if(t&&l>t)break;i.push(l)}return i}function Jy(e,t,r,n){const{month:a,defaultMonth:i,today:o=n.today(),numberOfMonths:l=1}=e;let c=a||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 bz(e,t,r,n){const{addDays:a,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),b=r.broadcastCalendar?i(v):r.ISOWeek?o(l(v)):c(l(v)),N=t.filter(S=>S>=y&&S<=b),j=r.broadcastCalendar?35:42;if(r.fixedWeeks&&N.length<j){const S=t.filter(_=>{const C=j-N.length;return _>b&&_<=a(b,C)});N.push(...S)}const k=N.reduce((S,_)=>{const C=r.ISOWeek?d(_):u(_),P=S.find(E=>E.weekNumber===C),O=new gS(_,v,n);return P?P.days.push(O):S.push(new p6(C,[O])),S},[]),w=new h6(v,k);return g.push(w),g},[]);return r.reverseMonths?x.reverse():x}function jz(e,t){let{startMonth:r,endMonth:n}=e;const{startOfYear:a,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=a(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 wz(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i=1}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=a?i:1,u=o(e);if(!t)return l(u,d);if(!(c(t,e)<i))return l(u,d)}function Nz(e,t,r,n){if(r.disableNavigation)return;const{pagedNavigation:a,numberOfMonths:i}=r,{startOfMonth:o,addMonths:l,differenceInCalendarMonths:c}=n,d=a?i??1:1,u=o(e);if(!t)return l(u,-d);if(!(c(u,t)<=0))return l(u,-d)}function kz(e){const t=[];return e.reduce((r,n)=>r.concat(n.weeks.slice()),t.slice())}function yf(e,t){const[r,n]=h.useState(e);return[t===void 0?r:t,n]}function Sz(e,t){var j;const[r,n]=jz(e,t),{startOfMonth:a,endOfMonth:i}=t,o=Jy(e,r,n,t),[l,c]=yf(o,e.month?o:void 0);h.useEffect(()=>{const k=Jy(e,r,n,t);c(k)},[e.timeZone]);const{months:d,weeks:u,days:f,previousMonth:m,nextMonth:p}=h.useMemo(()=>{const k=yz(l,n,{numberOfMonths:e.numberOfMonths},t),w=gz(k,e.endMonth?i(e.endMonth):void 0,{ISOWeek:e.ISOWeek,fixedWeeks:e.fixedWeeks,broadcastCalendar:e.broadcastCalendar},t),S=bz(k,w,{broadcastCalendar:e.broadcastCalendar,fixedWeeks:e.fixedWeeks,ISOWeek:e.ISOWeek,reverseMonths:e.reverseMonths},t),_=kz(S),C=vz(S),P=Nz(l,r,e,t),O=wz(l,n,e,t);return{months:S,weeks:_,days:C,previousMonth:P,nextMonth:O}},[t,l.getTime(),n==null?void 0:n.getTime(),r==null?void 0:r.getTime(),e.disableNavigation,e.broadcastCalendar,(j=e.endMonth)==null?void 0:j.getTime(),e.fixedWeeks,e.ISOWeek,e.numberOfMonths,e.pagedNavigation,e.reverseMonths]),{disableNavigation:x,onMonthChange:g}=e,v=k=>u.some(w=>w.days.some(S=>S.isEqualTo(k))),y=k=>{if(x)return;let w=a(k);r&&w<a(r)&&(w=a(r)),n&&w>a(n)&&(w=a(n)),c(w),g==null||g(w)};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 ns;(function(e){e[e.Today=0]="Today",e[e.Selected=1]="Selected",e[e.LastFocused=2]="LastFocused",e[e.FocusedModifier=3]="FocusedModifier"})(ns||(ns={}));function e0(e){return!e[St.disabled]&&!e[St.hidden]&&!e[St.outside]}function Cz(e,t,r,n){let a,i=-1;for(const o of e){const l=t(o);e0(l)&&(l[St.focused]&&i<ns.FocusedModifier?(a=o,i=ns.FocusedModifier):n!=null&&n.isEqualTo(o)&&i<ns.LastFocused?(a=o,i=ns.LastFocused):r(o.date)&&i<ns.Selected?(a=o,i=ns.Selected):l[St.today]&&i<ns.Today&&(a=o,i=ns.Today))}return a||(a=e.find(o=>e0(t(o)))),a}function _z(e,t,r,n,a,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:b,startOfISOWeek:N,startOfWeek:j}=o;let w={day:d,week:f,month:u,year:m,startOfWeek:S=>c?b(S,o):l?N(S):j(S),endOfWeek:S=>c?p(S):l?x(S):g(S)}[e](r,t==="after"?1:-1);return t==="before"&&n?w=v([n,w]):t==="after"&&a&&(w=y([a,w])),w}function AS(e,t,r,n,a,i,o,l=0){if(l>365)return;const c=_z(e,t,r.date,n,a,i,o),d=!!(i.disabled&&Os(c,i.disabled,o)),u=!!(i.hidden&&Os(c,i.hidden,o)),f=c,m=new gS(c,f,o);return!d&&!u?m:AS(e,t,m,n,a,i,o,l+1)}function Pz(e,t,r,n,a){const{autoFocus:i}=e,[o,l]=h.useState(),c=Cz(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=AS(g,v,d,t.navStart,t.navEnd,e,a);y&&(e.disableNavigation&&!t.days.some(N=>N.isEqualTo(y))||(t.goToDay(y),u(y)))}}}function Mz(e,t){const{selected:r,required:n,onSelect:a}=e,[i,o]=yf(r,a?r:void 0),l=a?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 a||o(v),a==null||a(v,p,x,g),v},isSelected:d}}function Oz(e,t,r=0,n=0,a=!1,i=ys){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}:a?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))a?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 Ez(e,t,r=ys){const n=Array.isArray(t)?t:[t];let a=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(a.getDay()))return!0;a=r.addDays(a,1)}return!1}function t0(e,t,r=ys){return Ms(e,t.from,!1,r)||Ms(e,t.to,!1,r)||Ms(t,e.from,!1,r)||Ms(t,e.to,!1,r)}function Az(e,t,r=ys){const n=Array.isArray(t)?t:[t];if(n.filter(l=>typeof l!="function").some(l=>typeof l=="boolean"?l:r.isDate(l)?Ms(e,l,!1,r):bS(l,r)?l.some(c=>Ms(e,c,!1,r)):vf(l)?l.from&&l.to?t0(e,{from:l.from,to:l.to},r):!1:yS(l)?Ez(e,l.dayOfWeek,r):Vx(l)?r.isAfter(l.before,l.after)?t0(e,{from:r.addDays(l.after,1),to:r.addDays(l.before,-1)},r):Os(e.from,l,r)||Os(e.to,l,r):Xx(l)||Qx(l)?Os(e.from,l,r)||Os(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 Dz(e,t){const{disabled:r,excludeDisabled:n,selected:a,required:i,onSelect:o}=e,[l,c]=yf(a,o?a:void 0),d=o?a:l;return{selected:d,select:(m,p,x)=>{const{min:g,max:v}=e,y=m?Oz(m,d,g,v,i,t):void 0;return n&&r&&(y!=null&&y.from)&&y.to&&Az({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&&Ms(d,m,!1,t)}}function Tz(e,t){const{selected:r,required:n,onSelect:a}=e,[i,o]=yf(r,a?r:void 0),l=a?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),a||o(x),a==null||a(x,f,m,p),x},isSelected:f=>l?c(l,f):!1}}function Iz(e,t){const r=Tz(e,t),n=Mz(e,t),a=Dz(e,t);switch(e.mode){case"single":return r;case"multiple":return n;case"range":return a;default:return}}function jn(e,t){return e instanceof vr&&e.timeZone===t?e:new vr(e,t)}function Li(e,t,r){return jn(e,t)}function r0(e,t,r){return typeof e=="boolean"||typeof e=="function"?e:e instanceof Date?Li(e,t):Array.isArray(e)?e.map(n=>n instanceof Date?Li(n,t):n):vf(e)?{...e,from:e.from?jn(e.from,t):e.from,to:e.to?jn(e.to,t):e.to}:Vx(e)?{before:Li(e.before,t),after:Li(e.after,t)}:Xx(e)?{after:Li(e.after,t)}:Qx(e)?{before:Li(e.before,t)}:e}function Jm(e,t,r){return e&&(Array.isArray(e)?e.map(n=>r0(n,t)):r0(e,t))}function Rz(e){var Oe;let t=e;const r=t.timeZone;if(r&&(t={...e,timeZone:r},t.today&&(t.today=jn(t.today,r)),t.month&&(t.month=jn(t.month,r)),t.defaultMonth&&(t.defaultMonth=jn(t.defaultMonth,r)),t.startMonth&&(t.startMonth=jn(t.startMonth,r)),t.endMonth&&(t.endMonth=jn(t.endMonth,r)),t.mode==="single"&&t.selected?t.selected=jn(t.selected,r):t.mode==="multiple"&&t.selected?t.selected=(Oe=t.selected)==null?void 0:Oe.map(ve=>jn(ve,r)):t.mode==="range"&&t.selected&&(t.selected={from:t.selected.from?jn(t.selected.from,r):t.selected.from,to:t.selected.to?jn(t.selected.to,r):t.selected.to}),t.disabled!==void 0&&(t.disabled=Jm(t.disabled,r)),t.hidden!==void 0&&(t.hidden=Jm(t.hidden,r)),t.modifiers)){const ve={};Object.keys(t.modifiers).forEach(Ne=>{var pe;ve[Ne]=Jm((pe=t.modifiers)==null?void 0:pe[Ne],r)}),t.modifiers=ve}const{components:n,formatters:a,labels:i,dateLib:o,locale:l,classNames:c}=h.useMemo(()=>{const ve={...xS,...t.locale},Ne=t.broadcastCalendar?1:t.weekStartsOn,pe=t.noonSafe&&t.timeZone?fz(t.timeZone,{weekStartsOn:Ne,locale:ve}):void 0,je=t.dateLib&&pe?{...pe,...t.dateLib}:t.dateLib??pe,Xe=new un({locale:ve,weekStartsOn:Ne,firstWeekContainsDate:t.firstWeekContainsDate,useAdditionalWeekYearTokens:t.useAdditionalWeekYearTokens,useAdditionalDayOfYearTokens:t.useAdditionalDayOfYearTokens,timeZone:t.timeZone,numerals:t.numerals},je);return{dateLib:Xe,components:H6(t.components),formatters:rz(t.formatters),labels:oz(t.labels,Xe.options),locale:ve,classNames:{...Y6(),...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:b,onNextClick:N,onPrevClick:j,showWeekNumber:k,styles:w}=t,{formatCaption:S,formatDay:_,formatMonthDropdown:C,formatWeekNumber:P,formatWeekNumberHeader:O,formatWeekdayName:E,formatYearDropdown:D}=a,I=Sz(t,o),{days:V,months:Q,navStart:q,navEnd:re,previousMonth:se,nextMonth:T,goToMonth:M}=I,L=W6(V,t,q,re,o),{isSelected:H,select:R,selected:Y}=Iz(t,o)??{},{blur:J,focused:A,isFocusTarget:U,moveFocus:$,setFocused:ne}=Pz(t,I,L,H??(()=>!1),o),{labelDayButton:B,labelGridcell:X,labelGrid:oe,labelMonthDropdown:G,labelNav:te,labelPrevious:de,labelNext:me,labelWeekday:Z,labelWeekNumber:xe,labelWeekNumberHeader:be,labelYearDropdown:qe}=i,We=h.useMemo(()=>dz(o,t.ISOWeek,t.broadcastCalendar,t.today),[o,t.ISOWeek,t.broadcastCalendar,t.today]),Ge=u!==void 0||x!==void 0,ft=h.useCallback(()=>{se&&(M(se),j==null||j(se))},[se,M,j]),et=h.useCallback(()=>{T&&(M(T),N==null||N(T))},[M,T,N]),Ke=h.useCallback((ve,Ne)=>pe=>{pe.preventDefault(),pe.stopPropagation(),ne(ve),!Ne.disabled&&(R==null||R(ve.date,Ne,pe),x==null||x(ve.date,Ne,pe))},[R,x,ne]),Ze=h.useCallback((ve,Ne)=>pe=>{ne(ve),g==null||g(ve.date,Ne,pe)},[g,ne]),sr=h.useCallback((ve,Ne)=>pe=>{J(),p==null||p(ve.date,Ne,pe)},[J,p]),Lr=h.useCallback((ve,Ne)=>pe=>{const je={ArrowLeft:[pe.shiftKey?"month":"day",t.dir==="rtl"?"after":"before"],ArrowRight:[pe.shiftKey?"month":"day",t.dir==="rtl"?"before":"after"],ArrowDown:[pe.shiftKey?"year":"week","after"],ArrowUp:[pe.shiftKey?"year":"week","before"],PageUp:[pe.shiftKey?"year":"month","before"],PageDown:[pe.shiftKey?"year":"month","after"],Home:["startOfWeek","before"],End:["endOfWeek","after"]};if(je[pe.key]){pe.preventDefault(),pe.stopPropagation();const[Xe,ue]=je[pe.key];$(Xe,ue)}v==null||v(ve.date,Ne,pe)},[$,v,t.dir]),ar=h.useCallback((ve,Ne)=>pe=>{y==null||y(ve.date,Ne,pe)},[y]),wr=h.useCallback((ve,Ne)=>pe=>{b==null||b(ve.date,Ne,pe)},[b]),ir=h.useCallback(ve=>Ne=>{const pe=Number(Ne.target.value),je=o.setMonth(o.startOfMonth(ve),pe);M(je)},[o,M]),jt=h.useCallback(ve=>Ne=>{const pe=Number(Ne.target.value),je=o.setYear(o.startOfMonth(ve),pe);M(je)},[o,M]),{className:qt,style:Vt}=h.useMemo(()=>({className:[c[Me.Root],t.className].filter(Boolean).join(" "),style:{...w==null?void 0:w[Me.Root],...t.style}}),[c,t.className,t.style,w]),or=K6(t),Xn=h.useRef(null);xz(Xn,!!t.animate,{classNames:c,months:Q,focused:A,dateLib:o});const bs={dayPickerProps:t,selected:Y,select:R,isSelected:H,months:Q,nextMonth:T,previousMonth:se,goToMonth:M,getModifiers:L,components:n,classNames:c,styles:w,labels:i,formatters:a};return W.createElement(vS.Provider,{value:bs},W.createElement(n.Root,{rootRef:t.animate?Xn:void 0,className:qt,style:Vt,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"],...or},W.createElement(n.Months,{className:c[Me.Months],style:w==null?void 0:w[Me.Months]},!t.hideNavigation&&!f&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:w==null?void 0:w[Me.Nav],"aria-label":te(),onPreviousClick:ft,onNextClick:et,previousMonth:se,nextMonth:T}),Q.map((ve,Ne)=>W.createElement(n.Month,{"data-animated-month":t.animate?"true":void 0,className:c[Me.Month],style:w==null?void 0:w[Me.Month],key:Ne,displayIndex:Ne,calendarMonth:ve},f==="around"&&!t.hideNavigation&&Ne===0&&W.createElement(n.PreviousMonthButton,{type:"button",className:c[Me.PreviousMonthButton],tabIndex:se?void 0:-1,"aria-disabled":se?void 0:!0,"aria-label":de(se),onClick:ft,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:se?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"right":"left"})),W.createElement(n.MonthCaption,{"data-animated-caption":t.animate?"true":void 0,className:c[Me.MonthCaption],style:w==null?void 0:w[Me.MonthCaption],calendarMonth:ve,displayIndex:Ne},d!=null&&d.startsWith("dropdown")?W.createElement(n.DropdownNav,{className:c[Me.Dropdowns],style:w==null?void 0:w[Me.Dropdowns]},(()=>{const pe=d==="dropdown"||d==="dropdown-months"?W.createElement(n.MonthsDropdown,{key:"month",className:c[Me.MonthsDropdown],"aria-label":G(),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:ir(ve.date),options:lz(ve.date,q,re,a,o),style:w==null?void 0:w[Me.Dropdown],value:o.getMonth(ve.date)}):W.createElement("span",{key:"month"},C(ve.date,o)),je=d==="dropdown"||d==="dropdown-years"?W.createElement(n.YearsDropdown,{key:"year",className:c[Me.YearsDropdown],"aria-label":qe(o.options),classNames:c,components:n,disabled:!!t.disableNavigation,onChange:jt(ve.date),options:uz(q,re,a,o,!!t.reverseYears),style:w==null?void 0:w[Me.Dropdown],value:o.getYear(ve.date)}):W.createElement("span",{key:"year"},D(ve.date,o));return o.getMonthYearOrder()==="year-first"?[je,pe]:[pe,je]})(),W.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"}},S(ve.date,o.options,o))):W.createElement(n.CaptionLabel,{className:c[Me.CaptionLabel],role:"status","aria-live":"polite"},S(ve.date,o.options,o))),f==="around"&&!t.hideNavigation&&Ne===m-1&&W.createElement(n.NextMonthButton,{type:"button",className:c[Me.NextMonthButton],tabIndex:T?void 0:-1,"aria-disabled":T?void 0:!0,"aria-label":me(T),onClick:et,"data-animated-button":t.animate?"true":void 0},W.createElement(n.Chevron,{disabled:T?void 0:!0,className:c[Me.Chevron],orientation:t.dir==="rtl"?"left":"right"})),Ne===m-1&&f==="after"&&!t.hideNavigation&&W.createElement(n.Nav,{"data-animated-nav":t.animate?"true":void 0,className:c[Me.Nav],style:w==null?void 0:w[Me.Nav],"aria-label":te(),onPreviousClick:ft,onNextClick:et,previousMonth:se,nextMonth:T}),W.createElement(n.MonthGrid,{role:"grid","aria-multiselectable":u==="multiple"||u==="range","aria-label":oe(ve.date,o.options,o)||void 0,className:c[Me.MonthGrid],style:w==null?void 0:w[Me.MonthGrid]},!t.hideWeekdays&&W.createElement(n.Weekdays,{"data-animated-weekdays":t.animate?"true":void 0,className:c[Me.Weekdays],style:w==null?void 0:w[Me.Weekdays]},k&&W.createElement(n.WeekNumberHeader,{"aria-label":be(o.options),className:c[Me.WeekNumberHeader],style:w==null?void 0:w[Me.WeekNumberHeader],scope:"col"},O()),We.map(pe=>W.createElement(n.Weekday,{"aria-label":Z(pe,o.options,o),className:c[Me.Weekday],key:String(pe),style:w==null?void 0:w[Me.Weekday],scope:"col"},E(pe,o.options,o)))),W.createElement(n.Weeks,{"data-animated-weeks":t.animate?"true":void 0,className:c[Me.Weeks],style:w==null?void 0:w[Me.Weeks]},ve.weeks.map(pe=>W.createElement(n.Week,{className:c[Me.Week],key:pe.weekNumber,style:w==null?void 0:w[Me.Week],week:pe},k&&W.createElement(n.WeekNumber,{week:pe,style:w==null?void 0:w[Me.WeekNumber],"aria-label":xe(pe.weekNumber,{locale:l}),className:c[Me.WeekNumber],scope:"row",role:"rowheader"},P(pe.weekNumber,o)),pe.days.map(je=>{const{date:Xe}=je,ue=L(je);if(ue[St.focused]=!ue.hidden&&!!(A!=null&&A.isEqualTo(je)),ue[Bn.selected]=(H==null?void 0:H(Xe))||ue.selected,vf(Y)){const{from:nt,to:st}=Y;ue[Bn.range_start]=!!(nt&&st&&o.isSameDay(Xe,nt)),ue[Bn.range_end]=!!(nt&&st&&o.isSameDay(Xe,st)),ue[Bn.range_middle]=Ms(Y,Xe,!0,o)}const Pe=cz(ue,w,t.modifiersStyles),Ie=U6(ue,c,t.modifiersClassNames),wt=!Ge&&!ue.hidden?X(Xe,ue,o.options,o):void 0;return W.createElement(n.Day,{key:`${je.isoDate}_${je.displayMonthId}`,day:je,modifiers:ue,className:Ie.join(" "),style:Pe,role:"gridcell","aria-selected":ue.selected||void 0,"aria-label":wt,"data-day":je.isoDate,"data-month":je.outside?je.dateMonthId:void 0,"data-selected":ue.selected||void 0,"data-disabled":ue.disabled||void 0,"data-hidden":ue.hidden||void 0,"data-outside":je.outside||void 0,"data-focused":ue.focused||void 0,"data-today":ue.today||void 0},!ue.hidden&&Ge?W.createElement(n.DayButton,{className:c[Me.DayButton],style:w==null?void 0:w[Me.DayButton],type:"button",day:je,modifiers:ue,disabled:!ue.focused&&ue.disabled||void 0,"aria-disabled":ue.focused&&ue.disabled||void 0,tabIndex:U(je)?0:-1,"aria-label":B(Xe,ue,o.options,o),onClick:Ke(je,ue),onBlur:sr(je,ue),onFocus:Ze(je,ue),onKeyDown:Lr(je,ue),onMouseEnter:ar(je,ue),onMouseLeave:wr(je,ue)},_(Xe,o.options,o)):!ue.hidden&&_(je.date,o.options,o))})))))))),t.footer&&W.createElement(n.Footer,{className:c[Me.Footer],style:w==null?void 0:w[Me.Footer],role:"status","aria-live":"polite"},t.footer)))}function br({className:e,classNames:t,showOutsideDays:r=!0,...n}){return s.jsx(Rz,{showOutsideDays:r,className:z("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:z(Zi({variant:"outline"}),"absolute left-1 top-0 h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100 z-10"),button_next:z(Zi({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:z(Zi({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:a})=>a==="left"?s.jsx(fs,{className:"h-4 w-4"}):s.jsx(pr,{className:"h-4 w-4"})},...n})}br.displayName="Calendar";function $z(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 s.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 a=()=>{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 a.scopeName=e,[n,zz(a,...t)]}function zz(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.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 Lz(e){const t=Fz(e),r=h.forwardRef((n,a)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(qz);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 s.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return s.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function Fz(e){const t=h.forwardRef((r,n)=>{const{children:a,...i}=r;if(h.isValidElement(a)){const o=Uz(a),l=Wz(i,a.props);return a.type!==h.Fragment&&(l.ref=n?tx(n,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bz=Symbol("radix.slottable");function qz(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bz}function Wz(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function Uz(e){var n,a;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=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var Hz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],DS=Hz.reduce((e,t)=>{const r=Lz(`Primitive.${t}`),n=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),bf="Switch",[Kz]=$z(bf),[Yz,Gz]=Kz(bf),TS=h.forwardRef((e,t)=>{const{__scopeSwitch:r,name:n,checked:a,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...f}=e,[m,p]=h.useState(null),x=So(t,N=>p(N)),g=h.useRef(!1),v=m?u||!!m.closest("form"):!0,[y,b]=b1({prop:a,defaultProp:i??!1,onChange:d,caller:bf});return s.jsxs(Yz,{scope:r,checked:y,disabled:l,children:[s.jsx(DS.button,{type:"button",role:"switch","aria-checked":y,"aria-required":o,"data-state":zS(y),"data-disabled":l?"":void 0,disabled:l,value:c,...f,ref:x,onClick:Cs(e.onClick,N=>{b(j=>!j),v&&(g.current=N.isPropagationStopped(),g.current||N.stopPropagation())})}),v&&s.jsx($S,{control:m,bubbles:!g.current,name:n,value:c,checked:y,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});TS.displayName=bf;var IS="SwitchThumb",RS=h.forwardRef((e,t)=>{const{__scopeSwitch:r,...n}=e,a=Gz(IS,r);return s.jsx(DS.span,{"data-state":zS(a.checked),"data-disabled":a.disabled?"":void 0,...n,ref:t})});RS.displayName=IS;var Vz="SwitchBubbleInput",$S=h.forwardRef(({__scopeSwitch:e,control:t,checked:r,bubbles:n=!0,...a},i)=>{const o=h.useRef(null),l=So(o,i),c=j1(r),d=w1(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]),s.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:r,...a,tabIndex:-1,ref:l,style:{...a.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$S.displayName=Vz;function zS(e){return e?"checked":"unchecked"}var LS=TS,Xz=RS;const Lo=h.forwardRef(({className:e,...t},r)=>s.jsx(LS,{className:z("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:s.jsx(Xz,{className:z("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")})}));Lo.displayName=LS.displayName;function Qz(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?fe(new Date(e.start_date),"MMM d"):"—",r=e.end_date?fe(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function jf({open:e,onClose:t,projectId:r,defaultStatus:n="backlog",defaultTaskListId:a,defaultParentId:i}){const o=ct(),{workspace:l,projectKey:c}=Et(),{workspace:d}=De(),[u,f]=h.useState(""),[m,p]=h.useState(""),[x,g]=h.useState(n),[v,y]=h.useState("medium"),[b,N]=h.useState("task"),[j,k]=h.useState([]),[w,S]=h.useState(""),[_,C]=h.useState(a??""),[P,O]=h.useState(void 0),[E,D]=h.useState(void 0),[I,V]=h.useState(!1),[Q,q]=h.useState("weekly"),[re,se]=h.useState(void 0),[T,M]=h.useState([]),[L,H]=h.useState([]),R=Q1(),{data:Y}=Yn(r),J=h.useMemo(()=>Y?Y.members.filter(te=>te.user).map(te=>te.user):void 0,[Y]),A=h.useMemo(()=>J==null?void 0:J.map(te=>({id:te.id,label:`${te.first_name??""} ${te.last_name??""}`.trim()||te.email,email:te.email})),[J]),{data:U}=$o(r),{data:$}=zo(r||void 0);h.useEffect(()=>{U&&U.length>0&&(U.map(de=>de.key).includes(x)||g(U[0].key))},[U]);const{data:ne}=vc(r||void 0),B=($??[]).filter(te=>te.status!=="completed"),X=U&&U.length>0?Object.fromEntries(U.map(te=>[te.key,te.name])):gi,oe=()=>{f(""),p(""),g(n),y("medium"),N("task"),k([]),S(""),C(a??""),O(void 0),D(void 0),V(!1),q("weekly"),se(void 0),M([]),H([]),t()},G=te=>{if(te.preventDefault(),!u.trim())return;const de=[];m&&new DOMParser().parseFromString(m,"text/html").querySelectorAll("[data-type='mention']").forEach(xe=>{const be=xe.getAttribute("data-id");be&&!de.includes(be)&&de.push(be)}),R.mutate({title:u.trim(),description:m.trim()||void 0,status:x,priority:v,type:b,project_id:r,workspace_id:d.id,assignee_ids:j.length>0?j:void 0,sprint_id:w||null,task_list_id:_||null,parent_id:i||null,start_date:P?fe(P,"yyyy-MM-dd"):null,due_date:E?fe(E,"yyyy-MM-dd"):null,recurrence_frequency:I?Q:void 0,recurrence_end_date:I&&re?fe(re,"yyyy-MM-dd"):void 0,mentioned_user_ids:de.length>0?de:void 0,depends_on_ids:T.length>0?T:null,related_to_ids:L.length>0?L:null},{onSuccess:()=>{F.success("Issue created"),oe()},onError:me=>F.error(me.message??"Failed to create issue")})};return s.jsx(Oi,{open:e,onOpenChange:te=>!te&&oe(),dismissible:!1,children:s.jsxs(Ei,{className:"max-w-xl",children:[s.jsx(Do,{children:s.jsx(Io,{children:"New issue"})}),s.jsxs("form",{onSubmit:G,className:"flex flex-col flex-1 overflow-hidden",children:[s.jsxs(To,{className:"space-y-4",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{htmlFor:"issue-title",children:"Title"}),s.jsx(_e,{id:"issue-title",placeholder:"Issue title",value:u,onChange:te=>f(te.target.value),autoFocus:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Description ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsx(gf,{content:m,onChange:p,placeholder:"Add more context… (type @ to mention)",className:"min-h-[120px] rounded-md border border-input",users:A})]}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{children:"Status"}),s.jsxs(Ue,{value:x,onValueChange:g,children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:Object.entries(X).map(([te,de])=>s.jsx(ke,{value:te,className:"text-xs",children:de},te))})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{children:"Priority"}),s.jsxs(Ue,{value:v,onValueChange:y,children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:Object.entries(dn).map(([te,de])=>s.jsx(ke,{value:te,className:"text-xs",children:de},te))})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{children:"Type"}),s.jsxs(Ue,{value:b,onValueChange:N,children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:Object.entries(Bs).map(([te,de])=>s.jsx(ke,{value:te,className:"text-xs",children:de},te))})]})]})]}),i&&s.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"}),(ne??[]).length>0&&!i&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["List ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsxs(Ue,{value:_||"none",onValueChange:te=>C(te==="none"?"":te),children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{placeholder:"No list"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs",children:s.jsx("span",{className:"text-muted-foreground",children:"No list"})}),(ne??[]).map(te=>s.jsx(ke,{value:te.id,className:"text-xs",children:te.name},te.id))]})]})]}),B.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Sprint ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsxs(Ue,{value:w||"none",onValueChange:te=>S(te==="none"?"":te),children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{placeholder:"No sprint"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs",children:s.jsx("span",{className:"text-muted-foreground",children:"No sprint"})}),B.map(te=>{const de=Qz(te);return s.jsx(ke,{value:te.id,className:"text-xs",children:s.jsxs("div",{children:[s.jsx("span",{children:te.name}),de&&s.jsx("span",{className:"block text-[10px] text-muted-foreground leading-tight",children:de})]})},te.id)})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Assignees ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsx(yc,{value:j,onChange:k,users:J})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Start Date ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:P?"text-foreground":"text-muted-foreground",children:P?fe(P,"MMM d, yyyy"):"No start date"}),P&&s.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),O(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:P,onSelect:O,initialFocus:!0})})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Due Date ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:E?"text-foreground":"text-muted-foreground",children:E?fe(E,"MMM d, yyyy"):"No due date"}),E&&s.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),D(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:E,onSelect:D,initialFocus:!0})})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Depends on ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsx(co,{value:T,onChange:M,projectId:r,emptyLabel:"No dependencies"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Related to ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsx(co,{value:L,onChange:H,projectId:r,emptyLabel:"No relations"})]})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Lo,{id:"recurring",checked:I,onCheckedChange:V}),s.jsxs(at,{htmlFor:"recurring",className:"cursor-pointer font-normal flex items-center gap-1.5",children:[s.jsx(no,{className:"h-3.5 w-3.5 text-muted-foreground"}),"Recurring"]})]}),I&&s.jsx("div",{className:"space-y-3 pl-4 border-l-2 border-indigo-200 dark:border-indigo-800",children:s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{children:"Frequency"}),s.jsxs(Ue,{value:Q,onValueChange:te=>q(te),children:[s.jsx(Le,{className:"h-8 text-xs",children:s.jsx(Ve,{})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"weekly",className:"text-xs",children:"Weekly"}),s.jsx(ke,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{children:["Until ",s.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"Optional"})]}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground"}),s.jsx("span",{className:re?"text-foreground":"text-muted-foreground",children:re?fe(re,"MMM d, yyyy"):"No end date"}),re&&s.jsx("button",{type:"button",onClick:te=>{te.stopPropagation(),se(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:re,onSelect:se,initialFocus:!0})})]})]})]})})]})]}),s.jsxs(hc,{className:"flex-col-reverse sm:flex-row sm:items-center sm:justify-between gap-2",children:[s.jsxs(ee,{type:"button",variant:"ghost",size:"sm",className:"text-muted-foreground gap-1.5 justify-start sm:justify-center",onClick:()=>{oe(),o(`/${l}/projects/${c}/issues/new`)},children:[s.jsx(hx,{className:"h-3.5 w-3.5"}),"Open full form"]}),s.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[s.jsx(ee,{type:"button",variant:"ghost",onClick:oe,children:"Cancel"}),s.jsx(ee,{type:"submit",disabled:!u.trim()||R.isPending,children:R.isPending?"Creating...":"Create issue"})]})]})]})]})})}const FS=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(k1,{ref:n,className:z("relative overflow-hidden",e),...r,children:[s.jsx(zE,{className:"h-full w-full rounded-[inherit]",children:t}),s.jsx(BS,{}),s.jsx(LE,{})]}));FS.displayName=k1.displayName;const BS=h.forwardRef(({className:e,orientation:t="vertical",...r},n)=>s.jsx(S1,{ref:n,orientation:t,className:z("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:s.jsx(FE,{className:"relative flex-1 rounded-full bg-border"})}));BS.displayName=S1.displayName;function Zz(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?fe(new Date(e.start_date),"MMM d"):"—",r=e.end_date?fe(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}const Jz={urgent:"bg-red-500",high:"bg-orange-500",medium:"bg-amber-500",low:"bg-sky-500",no_priority:"bg-zinc-400"};function eL(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 gn=({children:e})=>s.jsx("p",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100 mb-1.5",children:e}),Fi=()=>s.jsx("div",{className:"border-t border-zinc-100 dark:border-zinc-800"});function qS({issue:e,projectId:t,open:r,onClose:n}){const a=ct(),{workspace:i,projectKey:o}=Et(),{data:l}=V1((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,b]=h.useState(!1),N=Gu((c==null?void 0:c.id)??"",t),{data:j}=Yn(t),k=h.useMemo(()=>j?j.members.filter(Z=>Z.user).map(Z=>Z.user):void 0,[j]),w=h.useMemo(()=>k==null?void 0:k.map(Z=>({id:Z.id,label:`${Z.first_name??""} ${Z.last_name??""}`.trim()||Z.email,email:Z.email})),[k]),{data:S}=$o(t),{data:_}=zo(t||void 0),{data:C}=vc(t||void 0),{data:P}=X1((c==null?void 0:c.id)??""),{data:O}=qx(),{data:E=[]}=Wx(new Date().getFullYear()),D=(_??[]).filter(Z=>Z.status!=="completed"),{data:I}=Rk(),V=(I==null?void 0:I.maxChildIssueDepth)??1,q=((P==null?void 0:P.depth)??0)<V,re=(P==null?void 0:P.parent)??null,se=(P==null?void 0:P.children)??[],T=c!=null&&c.task_list_id?C==null?void 0:C.find(Z=>Z.id===c.task_list_id):null,M=S&&S.length>0?Object.fromEntries(S.map(Z=>[Z.key,Z.name])):gi;if(h.useEffect(()=>{c&&(m(c.title),x(c.description??"")),u(!1)},[c==null?void 0:c.id]),!c)return null;const L=()=>{if(!f.trim())return;const Z=[];new DOMParser().parseFromString(p,"text/html").querySelectorAll("[data-type='mention']").forEach(qe=>{const We=qe.getAttribute("data-id");We&&!Z.includes(We)&&Z.push(We)}),N.mutate({title:f.trim(),description:p.trim()||void 0,mentioned_user_ids:Z.length>0?Z:void 0},{onSuccess:()=>{u(!1),F.success("Issue updated")},onError:()=>F.error("Failed to update issue")})},H=()=>{m(c.title),x(c.description??""),u(!1)},R=Z=>{N.mutate({status:Z},{onSuccess:()=>F.success("Status updated"),onError:()=>F.error("Failed to update status")})},Y=Z=>{N.mutate({priority:Z},{onSuccess:()=>F.success("Priority updated"),onError:()=>F.error("Failed to update priority")})},J=Z=>{N.mutate({type:Z},{onSuccess:()=>F.success("Type updated"),onError:()=>F.error("Failed to update type")})},A=Z=>{N.mutate({assignee_ids:Z},{onSuccess:()=>F.success("Assignees updated"),onError:()=>F.error("Failed to update assignees")})},U=Z=>{N.mutate({sprint_id:Z},{onSuccess:()=>F.success(Z?"Sprint assigned":"Removed from sprint"),onError:()=>F.error("Failed to update sprint")})},$=Z=>{N.mutate({task_list_id:Z},{onSuccess:()=>F.success(Z?"Moved to list":"Removed from list"),onError:()=>F.error("Failed to update list")})},ne=Z=>{N.mutate({start_date:Z?fe(Z,"yyyy-MM-dd"):null},{onSuccess:()=>F.success(Z?"Start date set":"Start date cleared"),onError:()=>F.error("Failed to update start date")})},B=Z=>{N.mutate({due_date:Z?fe(Z,"yyyy-MM-dd"):null},{onSuccess:()=>F.success(Z?"Due date set":"Due date cleared"),onError:()=>F.error("Failed to update due date")})},X=Z=>{if(Z){const xe=c.start_date?new Date(c.start_date):new Date,be=new Date(xe);be.setDate(be.getDate()+7),N.mutate({recurrence_frequency:"weekly",next_occurrence_date:fe(be,"yyyy-MM-dd"),recurrence_end_date:null},{onSuccess:()=>F.success("Recurrence enabled"),onError:()=>F.error("Failed to enable recurrence")})}else N.mutate({recurrence_frequency:null,next_occurrence_date:null,recurrence_end_date:null},{onSuccess:()=>F.success("Recurrence stopped"),onError:()=>F.error("Failed to stop recurrence")})},oe=Z=>{const xe=c.start_date?new Date(c.start_date):new Date,be=new Date(xe);Z==="weekly"?be.setDate(be.getDate()+7):be.setMonth(be.getMonth()+1),N.mutate({recurrence_frequency:Z,next_occurrence_date:fe(be,"yyyy-MM-dd")},{onSuccess:()=>F.success("Frequency updated"),onError:()=>F.error("Failed to update frequency")})},G=Z=>{N.mutate({recurrence_end_date:Z?fe(Z,"yyyy-MM-dd"):null},{onSuccess:()=>F.success(Z?"End date set":"End date cleared"),onError:()=>F.error("Failed to update end date")})},te=S==null?void 0:S.find(Z=>Z.category==="completed"),de=!!te&&c.status===te.key,me=(Z,xe,be)=>{const qe=Z;return s.jsx("button",{title:xe,onClick:be,className:"h-8 w-8 flex items-center justify-center rounded-md text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:s.jsx(qe,{className:"h-4 w-4"})},xe)};return s.jsxs(s.Fragment,{children:[s.jsx(Oi,{open:r,onOpenChange:Z=>!Z&&n(),dismissible:!1,children:s.jsxs(Ei,{className:"flex flex-col p-0 w-full max-w-2xl overflow-hidden bg-white dark:bg-zinc-950",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border shrink-0",children:[s.jsxs("button",{onClick:()=>{var Z;te&&R(de?((Z=S==null?void 0:S.find(xe=>xe.category==="unstarted"||xe.category==="backlog"))==null?void 0:Z.key)??c.status:te.key)},className:z("flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium transition-colors",de?"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:[s.jsx(Ct,{className:"h-3.5 w-3.5"}),de?"Completed":"Mark complete"]}),s.jsxs("div",{className:"flex items-center",children:[me(bD,"Upvote"),me(gx,"Attachments"),q&&me(ds,"Add sub-issue",()=>b(!0)),me(Ea,"Copy link",()=>{navigator.clipboard.writeText(`${window.location.origin}/${i}/projects/${o}/issues/${c.id}`),F.success("Link copied")}),me(dD,"Open full page",()=>{n(),a(`/${i}/projects/${o}/issues/${c.id}`)}),d?s.jsxs("div",{className:"flex items-center gap-1 ml-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:H,children:"Cancel"}),s.jsxs(ee,{size:"sm",className:"h-7 text-xs",onClick:L,disabled:!f.trim()||N.isPending,children:[s.jsx(Ct,{className:"h-3.5 w-3.5 mr-1"}),"Save"]})]}):s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:me(Ls,"More options")}),s.jsx(Dr,{align:"end",className:"w-40",children:s.jsxs(Je,{onClick:()=>u(!0),children:[s.jsx(Fs,{className:"h-3.5 w-3.5 mr-2"}),"Edit"]})})]}),me(Be,"Close",n)]})]}),s.jsx("div",{className:"px-6 pt-5 pb-4 shrink-0",children:d?s.jsx(_e,{value:f,onChange:Z=>m(Z.target.value),className:"text-sm font-medium h-8",autoFocus:!0}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2.5",children:[s.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}),s.jsx("span",{className:"text-[10px] font-semibold tracking-widest uppercase text-violet-500 dark:text-violet-400",children:Bs[c.type]??c.type}),c.recurrence_frequency&&s.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:[s.jsx(no,{className:"h-2.5 w-2.5"}),"Repeats ",c.recurrence_frequency==="weekly"?"Weekly":"Monthly"]}),c.recurrence_source_id&&s.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:[s.jsx(no,{className:"h-2.5 w-2.5"}),"Recurring instance"]})]}),s.jsx("h2",{className:"text-[17px] font-semibold leading-snug text-zinc-900 dark:text-zinc-50",children:c.title})]})}),s.jsxs(FS,{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"px-6 pb-4 space-y-5 min-w-0",children:[s.jsx(Or,{zone:"issue.details.before",props:{issue:c}}),s.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx(gn,{children:"Status"}),s.jsxs(Ue,{value:c.status,onValueChange:R,children:[s.jsx(Le,{className:"h-8 text-xs min-w-0",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:Object.entries(M).map(([Z,xe])=>{const be=S==null?void 0:S.find(qe=>qe.key===Z);return s.jsx(ke,{value:Z,className:"text-xs",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:z("h-2 w-2 rounded-full shrink-0 flex-none",eL(be==null?void 0:be.category,Z))}),s.jsx("span",{children:xe})]})},Z)})})]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx(gn,{children:"Priority"}),s.jsxs(Ue,{value:c.priority,onValueChange:Y,children:[s.jsx(Le,{className:"h-8 text-xs min-w-0",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:Object.entries(dn).map(([Z,xe])=>s.jsx(ke,{value:Z,className:"text-xs",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:z("h-2 w-2 rounded-full shrink-0 flex-none",Jz[Z]??"bg-zinc-400")}),s.jsx("span",{children:xe})]})},Z))})]})]}),s.jsxs("div",{className:"min-w-0",children:[s.jsx(gn,{children:"Type"}),s.jsxs(Ue,{value:c.type,onValueChange:J,children:[s.jsx(Le,{className:"h-8 text-xs min-w-0",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:Object.entries(Bs).map(([Z,xe])=>s.jsx(ke,{value:Z,className:"text-xs",children:xe},Z))})]})]})]}),s.jsx(Fi,{}),s.jsxs("div",{children:[s.jsx(gn,{children:"Assignees"}),s.jsx(yc,{value:c.assignee_ids??[],onChange:A,disabled:N.isPending,users:k})]}),s.jsx(Fi,{}),s.jsxs("div",{className:"flex gap-3 items-start min-w-0",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx(gn,{children:"Sprint"}),s.jsxs(Ue,{value:c.sprint_id??"none",onValueChange:Z=>U(Z==="none"?null:Z),children:[s.jsx(Le,{className:"h-8 text-xs min-w-0",children:s.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[s.jsx(Gr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx(Ve,{placeholder:"No sprint"})]})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),D.map(Z=>{const xe=Zz(Z);return s.jsx(ke,{value:Z.id,className:"text-xs",children:s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{children:Z.name}),xe&&s.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:xe})]})},Z.id)})]})]})]}),(C??[]).length>0&&s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx(gn,{children:"List"}),s.jsxs(Ue,{value:c.task_list_id??"none",onValueChange:Z=>$(Z==="none"?null:Z),children:[s.jsx(Le,{className:"h-8 text-xs min-w-0",children:s.jsxs("div",{className:"flex items-center gap-1 min-w-0 overflow-hidden",children:[s.jsx(px,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx(Ve,{placeholder:"No list",children:T?T.name:"No list"})]})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(C??[]).map(Z=>s.jsx(ke,{value:Z.id,className:"text-xs",children:Z.name},Z.id))]})]})]}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx(gn,{children:"Start Date"}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:`truncate ${c.start_date?"text-foreground":"text-muted-foreground"}`,children:c.start_date?fe(new Date(c.start_date),"MMM d, yyyy"):"No date"})]})}),s.jsxs(_t,{className:"w-auto p-0",align:"start",children:[s.jsx(br,{mode:"single",selected:c.start_date?new Date(c.start_date):void 0,onSelect:ne,initialFocus:!0}),c.start_date&&s.jsx("div",{className:"border-t px-3 py-2",children:s.jsxs("button",{onClick:()=>ne(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[s.jsx(Be,{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 Z=qh(new Date(c.start_date),new Date(c.due_date),O.working_days,E);return s.jsxs("div",{className:"shrink-0 self-end pb-1 text-[11px] text-muted-foreground whitespace-nowrap",children:[Z," biz day",Z!==1?"s":""]})})(),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx(gn,{children:"Due Date"}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:`truncate ${c.due_date?"text-foreground":"text-muted-foreground"}`,children:c.due_date?fe(new Date(c.due_date),"MMM d, yyyy"):"No date"})]})}),s.jsxs(_t,{className:"w-auto p-0",align:"start",children:[s.jsx(br,{mode:"single",selected:c.due_date?new Date(c.due_date):void 0,onSelect:B,initialFocus:!0}),c.due_date&&s.jsx("div",{className:"border-t px-3 py-2",children:s.jsxs("button",{onClick:()=>B(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[s.jsx(Be,{className:"h-3 w-3"}),"Clear date"]})})]})]})]})]}),s.jsx(Fi,{}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx(gn,{children:"Depends on"}),s.jsx(co,{value:c.depends_on_ids??[],onChange:Z=>N.mutate({depends_on_ids:Z},{onSuccess:()=>F.success("Dependencies updated")}),projectId:c.project_id,excludeId:c.id,disabled:N.isPending})]}),s.jsxs("div",{children:[s.jsx(gn,{children:"Related to"}),s.jsx(co,{value:c.related_to_ids??[],onChange:Z=>N.mutate({related_to_ids:Z},{onSuccess:()=>F.success("Relations updated")}),projectId:c.project_id,excludeId:c.id,disabled:N.isPending})]})]}),s.jsx(Fi,{}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx(gn,{children:"Recurring"}),s.jsx(Lo,{checked:!!c.recurrence_frequency,onCheckedChange:X,disabled:N.isPending})]}),c.recurrence_frequency&&s.jsxs("div",{className:"space-y-2 pl-3 border-l-2 border-indigo-200 dark:border-indigo-800",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:"Frequency"}),s.jsxs(Ue,{value:c.recurrence_frequency,onValueChange:Z=>oe(Z),children:[s.jsx(Le,{className:"h-7 text-xs",children:s.jsx(Ve,{})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"weekly",className:"text-xs",children:"Weekly"}),s.jsx(ke,{value:"monthly",className:"text-xs",children:"Monthly"})]})]})]}),s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] font-medium text-muted-foreground mb-1",children:["Until ",s.jsx("span",{className:"font-normal",children:"(optional)"})]}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:c.recurrence_end_date?"text-foreground":"text-muted-foreground",children:c.recurrence_end_date?fe(new Date(c.recurrence_end_date),"MMM d, yyyy"):"No end date"})]})}),s.jsxs(_t,{className:"w-auto p-0",align:"start",children:[s.jsx(br,{mode:"single",selected:c.recurrence_end_date?new Date(c.recurrence_end_date):void 0,onSelect:G,initialFocus:!0}),c.recurrence_end_date&&s.jsx("div",{className:"border-t px-3 py-2",children:s.jsxs("button",{onClick:()=>G(void 0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[s.jsx(Be,{className:"h-3 w-3"}),"Clear end date"]})})]})]})]})]})]}),s.jsx(Fi,{}),q&&s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-[10px] font-semibold tracking-[0.08em] uppercase text-zinc-900 dark:text-zinc-100",children:"Child Issues"}),s.jsxs("button",{onClick:()=>b(!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:[s.jsx(ot,{className:"h-3 w-3"}),"Add"]})]}),re&&s.jsxs("button",{onClick:()=>a(`/${i}/projects/${o}/issues/${re.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:[s.jsx(dx,{className:"h-3.5 w-3.5 text-zinc-400 shrink-0"}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider text-zinc-400 shrink-0",children:"Parent:"}),s.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:re.identifier}),s.jsx("span",{className:"text-xs text-zinc-600 dark:text-zinc-300 truncate",children:re.title})]}),se.length===0?s.jsxs("button",{onClick:()=>b(!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:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Create child issue"]}):s.jsx("div",{className:"space-y-1",children:se.map(Z=>s.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:[s.jsx(Ds,{className:"h-3.5 w-3.5 text-indigo-400 dark:text-indigo-500 shrink-0"}),s.jsxs("button",{onClick:()=>{n(),a(`/${i}/projects/${o}/issues/${Z.id}`)},className:"flex items-center gap-2.5 flex-1 min-w-0 text-left",children:[s.jsx("span",{className:"font-mono text-[11px] font-medium text-indigo-700 dark:text-indigo-300 shrink-0",children:Z.identifier}),s.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:Z.title})]})]},Z.id))})]}),s.jsx(Fi,{}),s.jsxs("div",{children:[s.jsx(gn,{children:"Description"}),d?s.jsx(gf,{content:p,onChange:x,placeholder:"Add a description…",className:"min-h-[160px] rounded-md border border-input",users:w},`${c.id}-edit`):c.description?s.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:s.jsx(Gx,{html:c.description,className:"text-sm"})}):s.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:[s.jsx(Fs,{className:"h-3.5 w-3.5"}),"Add description"]})]})]}),s.jsx("div",{className:"px-6 py-4",children:s.jsx(Or,{zone:"issue.details.after",props:{issue:c}})}),s.jsx(fS,{issueId:c.id,projectId:t,className:"border-t border-border",compact:!0,hideCommentInput:!0,onTabChange:v,onViewMore:()=>{n(),a(`/${i}/projects/${o}/issues/${c.id}`)}})]}),g==="comments"&&s.jsx("div",{className:"border-t border-border px-6 py-3 shrink-0",children:s.jsx(uS,{issueId:c.id,projectId:t,compact:!0})})]})}),s.jsx(jf,{open:y,onClose:()=>b(!1),projectId:t,defaultParentId:c.id,defaultTaskListId:c.task_list_id})]})}function tL(){const{projectKey:e,workspace:t}=Et(),r=IN(),[n,a]=h.useState(null),[i,o]=h.useState(!1),[l,c]=h.useState({}),{data:d}=ea(e??""),u=(d==null?void 0:d.id)??"",{data:f,isLoading:m}=Yu(u||void 0,l),{data:p,isLoading:x}=$o(u||void 0),{data:g}=Yn(u),{data:v}=La(),y=kR(u),b=h.useMemo(()=>!(g!=null&&g.members)||!v?[]:g.members.map(k=>{const w=v.get(k.user_id);return w?{userId:k.user_id,name:w.name,initials:w.initials}:null}).filter(k=>k!==null),[g,v]);if(r&&e&&t)return s.jsx(qn,{to:`/${t}/projects/${e}/issues`,replace:!0});if(!e)return null;const N=m||x||!d,j=k=>{y.mutate(k)};return s.jsxs("div",{className:"flex flex-col h-full gap-0",children:[s.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border shrink-0",children:[s.jsx(UR,{statuses:p??[],members:b,filters:l,onChange:c}),s.jsxs(ee,{size:"sm",onClick:()=>o(!0),children:[s.jsx(ot,{className:"h-4 w-4"}),"Create"]})]}),s.jsx(Or,{zone:"project.board.before",props:{projectId:u}}),s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:N?s.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4].map(k=>s.jsxs("div",{className:"min-w-[260px]",children:[s.jsx(le,{className:"h-5 w-24 mb-3 rounded"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(le,{className:"h-[82px] w-full rounded-lg"}),s.jsx(le,{className:"h-[82px] w-full rounded-lg"})]})]},k))}):s.jsx(Ik,{issues:f??[],projectId:u,statuses:p??[],onIssueClick:a,onColumnsReorder:j,filters:l})})]}),s.jsx(Or,{zone:"project.board.after",props:{projectId:u}}),s.jsx(qS,{issue:n,projectId:u,open:!!n,onClose:()=>a(null)}),s.jsx(jf,{open:i,onClose:()=>o(!1),projectId:u})]})}const Yh=({priority:e,className:t})=>{const r=z("h-3.5 w-3.5 shrink-0",gc[e],t);switch(e){case"urgent":return s.jsx(gs,{className:r});case"high":return s.jsx(Pi,{className:r});case"medium":return s.jsx(Js,{className:r});case"low":return s.jsx(_i,{className:r});default:return s.jsx(Er,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}},Gh="grid-cols-[110px_250px_150px_120px_130px_140px_130px_32px]";function WS({issue:e,projectId:t,statuses:r,statusLabels:n,statusColorMap:a,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:d=!1,depth:u=0,children:f=[],childrenMap:m,onAddChild:p}){const x=ct(),[g,v]=h.useState(null),[y,b]=h.useState(!1),N=Gu(e.id,t),{data:j}=Yn(t),k=h.useMemo(()=>j?j.members.filter(P=>P.user).map(P=>P.user):void 0,[j]);function w(P){N.mutate(P),v(null)}const S=(a==null?void 0:a[e.status])??"#94a3b8",_=i.find(P=>P.id===e.sprint_id),C=f.length>0;return s.jsxs(s.Fragment,{children:[s.jsxs("div",{onClick:()=>c(e),className:z(`group grid ${Gh} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",d&&"bg-zinc-50/80 dark:bg-zinc-800/30",N.isPending&&"opacity-70"),children:[s.jsx("span",{className:z("text-xs font-mono text-muted-foreground truncate","sticky left-0 z-10 transition-colors",d?"bg-zinc-50/80 dark:bg-zinc-800/30 group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30":"bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30"),style:{paddingLeft:`${1.5+u*1.25}rem`},children:e.identifier}),s.jsxs("div",{className:z("flex items-center gap-1 min-w-0 pr-3","sticky left-[110px] z-10 transition-colors",d?"bg-zinc-50/80 dark:bg-zinc-800/30 group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30":"bg-white dark:bg-card group-hover:bg-[#f9fafb] dark:group-hover:bg-muted/30"),children:[C?s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:P=>{P.stopPropagation(),b(!y)},className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:y?s.jsx(Zs,{className:"h-3.5 w-3.5"}):s.jsx(pr,{className:"h-3.5 w-3.5"})})}),s.jsx(Wn,{side:"top",children:y?"Collapse":"Expand"})]}):d?s.jsx(Ds,{className:"h-3 w-3 text-muted-foreground shrink-0"}):s.jsx("span",{className:"w-4 shrink-0"}),s.jsx("span",{className:z("text-sm text-foreground truncate",d&&"text-primary"),children:e.title}),C&&s.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:[s.jsx(Ds,{className:"h-2.5 w-2.5"}),f.length]})]}),s.jsx("div",{onClick:P=>P.stopPropagation(),children:s.jsxs(Tt,{open:g==="status",onOpenChange:P=>v(P?"status":null),children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:S}}),s.jsx("span",{className:"text-xs text-primary truncate",children:n[e.status]??e.status})]})}),s.jsx(_t,{className:"w-52 p-1",align:"start",onClick:P=>P.stopPropagation(),children:s.jsx(ya,{children:s.jsx(ba,{children:s.jsx(Ts,{children:r.map(P=>s.jsxs(an,{value:P.name,onSelect:()=>w({status:P.key}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:P.color}}),s.jsx("span",{className:"text-xs flex-1",children:P.name}),e.status===P.key&&s.jsx(Ct,{className:"h-3.5 w-3.5 text-indigo-500"})]},P.key))})})})})]})}),s.jsx("div",{onClick:P=>P.stopPropagation(),children:s.jsxs(Tt,{open:g==="priority",onOpenChange:P=>v(P?"priority":null),children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Yh,{priority:e.priority}),s.jsx("span",{className:"text-xs text-primary",children:dn[e.priority]??e.priority})]})}),s.jsx(_t,{className:"w-44 p-1",align:"start",onClick:P=>P.stopPropagation(),children:s.jsx(ya,{children:s.jsx(ba,{children:s.jsx(Ts,{children:Object.entries(dn).map(([P,O])=>s.jsxs(an,{value:O,onSelect:()=>w({priority:P}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[s.jsx(Yh,{priority:P}),s.jsx("span",{className:"text-xs flex-1",children:O}),e.priority===P&&s.jsx(Ct,{className:"h-3.5 w-3.5 text-indigo-500"})]},P))})})})})]})}),s.jsx("div",{onClick:P=>P.stopPropagation(),children:s.jsxs(Tt,{open:g==="sprint",onOpenChange:P=>v(P?"sprint":null),children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Gr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:z("text-xs truncate",_?"text-foreground":"text-muted-foreground"),children:(_==null?void 0:_.name)??"No sprint"})]})}),s.jsx(_t,{className:"w-56 p-1",align:"start",onClick:P=>P.stopPropagation(),children:s.jsx(ya,{children:s.jsx(ba,{children:s.jsxs(Ts,{children:[s.jsxs(an,{value:"no-sprint",onSelect:()=>w({sprint_id:null}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[s.jsx(Be,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs flex-1 text-muted-foreground",children:"No sprint"}),!e.sprint_id&&s.jsx(Ct,{className:"h-3.5 w-3.5 text-indigo-500"})]}),i.filter(P=>P.status!=="completed").map(P=>s.jsxs(an,{value:P.name,onSelect:()=>w({sprint_id:P.id}),className:"flex items-center gap-2 py-1.5 px-2 cursor-pointer",children:[s.jsx(Gr,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-xs truncate",children:P.name}),(P.start_date||P.end_date)&&s.jsxs("p",{className:"text-[10px] text-muted-foreground",children:[P.start_date?fe(new Date(P.start_date),"MMM d"):"—"," → ",P.end_date?fe(new Date(P.end_date),"MMM d"):"—"]})]}),e.sprint_id===P.id&&s.jsx(Ct,{className:"h-3.5 w-3.5 text-indigo-500 shrink-0"})]},P.id))]})})})})]})}),s.jsx("div",{onClick:P=>P.stopPropagation(),children:s.jsxs(Tt,{open:g==="due",onOpenChange:P=>v(P?"due":null),children:[s.jsx(It,{asChild:!0,children:s.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:[s.jsx(Ht,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"No due date"})]})}),s.jsxs(_t,{className:"w-auto p-0",align:"start",onClick:P=>P.stopPropagation(),children:[s.jsx(br,{mode:"single",selected:e.due_date?new Date(e.due_date):void 0,onSelect:P=>w({due_date:P?fe(P,"yyyy-MM-dd"):null}),initialFocus:!0}),e.due_date&&s.jsx("div",{className:"border-t px-3 py-2",children:s.jsxs("button",{onClick:()=>w({due_date:null}),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[s.jsx(Be,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),s.jsx("div",{onClick:P=>P.stopPropagation(),children:s.jsx(yc,{value:e.assignee_ids??[],onChange:P=>N.mutate({assignee_ids:P}),users:k})}),s.jsxs("div",{className:"flex items-center gap-1 pr-6",onClick:P=>P.stopPropagation(),children:[!d&&p&&s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:()=>p(e.id),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:s.jsx(Ds,{className:"h-3.5 w-3.5"})})}),s.jsx(Wn,{side:"top",children:"Add child issue"})]}),s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:()=>x(`/${o}/projects/${l}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground",children:s.jsx(hx,{className:"h-3.5 w-3.5"})})}),s.jsx(Wn,{side:"top",children:"Open full page"})]})]})]}),y&&f.map(P=>s.jsx(WS,{issue:P,projectId:t,statuses:r,statusLabels:n,statusColorMap:a,sprints:i,workspace:o,projectKey:l,onOpen:c,isChild:!0,depth:u+1,children:(m==null?void 0:m[P.id])??[],childrenMap:m,onAddChild:p},P.id))]})}function n0({taskList:e,issues:t,childrenMap:r,projectId:n,statuses:a,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,b]=h.useState(!1),[N,j]=h.useState((e==null?void 0:e.name)??""),k=t.reduce((_,C)=>{var P;return _+(((P=r[C.id])==null?void 0:P.length)??0)},0),w=t.length+k,S=()=>{e&&N.trim()&&p&&p(e.id,N.trim()),b(!1)};return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border group/header",children:[s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:()=>v(!g),className:"text-muted-foreground hover:text-foreground transition-colors",children:g?s.jsx(pr,{className:"h-3.5 w-3.5"}):s.jsx(Zs,{className:"h-3.5 w-3.5"})})}),s.jsx(Wn,{side:"right",children:g?"Expand":"Collapse"})]}),e?y?s.jsx("input",{autoFocus:!0,value:N,onChange:_=>j(_.target.value),onBlur:S,onKeyDown:_=>{_.key==="Enter"&&S(),_.key==="Escape"&&(b(!1),j(e.name))},className:"text-xs font-semibold text-foreground bg-transparent border-b border-indigo-400 outline-none px-0.5"}):s.jsx("span",{className:"text-xs font-semibold text-foreground",children:e.name}):s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"No List"}),s.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:w}),s.jsxs("div",{className:"flex items-center gap-1 ml-auto",children:[s.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:[s.jsx(ot,{className:"h-3 w-3"}),"Add issue"]}),e&&s.jsxs(Vr,{children:[s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx(Xr,{asChild:!0,children:s.jsx("button",{className:"p-1 rounded hover:bg-muted text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Ls,{className:"h-3.5 w-3.5"})})})}),s.jsx(Wn,{side:"top",children:"More options"})]}),s.jsxs(Dr,{align:"end",className:"w-36",children:[s.jsxs(Je,{className:"text-xs gap-2 cursor-pointer",onClick:()=>{b(!0),j(e.name)},children:[s.jsx(Fs,{className:"h-3.5 w-3.5"}),"Rename"]}),s.jsxs(Je,{className:"text-xs gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>x==null?void 0:x(e.id),children:[s.jsx(jr,{className:"h-3.5 w-3.5"}),"Delete list"]})]})]})]})]}),!g&&s.jsx("div",{className:"divide-y divide-border/60",children:t.length===0?s.jsx("div",{className:"px-14 py-3 text-xs text-muted-foreground/50 italic",children:"No issues in this list"}):t.map(_=>s.jsx(WS,{issue:_,projectId:n,statuses:a,statusLabels:i,statusColorMap:o,sprints:l,workspace:c,projectKey:d,onOpen:u,children:r[_.id]??[],childrenMap:r,onAddChild:m},_.id))})]})}function rL(){var $,ne;const e=ct(),{workspace:t,projectKey:r}=Et(),[n,a]=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,b]=h.useState("all"),{data:N}=ea(r??""),j=(N==null?void 0:N.id)??"",{data:k,isLoading:w}=Yu(j||void 0),{data:S}=$o(j||void 0),{data:_}=zo(j||void 0),{data:C}=vc(j||void 0),P=t$(j),O=r$(j),E=n$(j),D=S&&S.length>0?S:Object.entries(gi).map(([B,X],oe)=>({id:B,project_id:j,key:B,name:X,color:{backlog:"#94a3b8",todo:"#64748b",in_progress:"#6366f1",in_review:"#f59e0b",done:"#10b981",cancelled:"#9ca3af"}[B]??"#94a3b8",category:{backlog:"backlog",todo:"unstarted",in_progress:"started",in_review:"started",done:"completed",cancelled:"cancelled"}[B]??"backlog",position:oe})),I=Object.fromEntries(D.map(B=>[B.key,B.name])),V=Object.fromEntries(D.map(B=>[B.key,B.color])),Q=_??[];if(!r||!t)return null;const q=(k??[]).filter(B=>{const X=!f||B.title.toLowerCase().includes(f.toLowerCase())||B.identifier.toLowerCase().includes(f.toLowerCase()),oe=p==="all"||B.status===p,G=g==="all"||B.priority===g,te=y==="all"||(y==="none"?!B.sprint_id:B.sprint_id===y);return X&&oe&&G&&te}).sort((B,X)=>{const oe=parseInt(B.identifier.split("-")[1]??"0",10),G=parseInt(X.identifier.split("-")[1]??"0",10);return oe-G}),re=new Map((k??[]).map(B=>[B.id,B])),se=new Set(q.map(B=>B.id)),T=new Set(se);for(const B of q){let X=B.parent_id;for(;X&&!T.has(X);)T.add(X),X=(($=re.get(X))==null?void 0:$.parent_id)??null}const M={};for(const B of T){const X=re.get(B);X.parent_id&&T.has(X.parent_id)&&(M[X.parent_id]||(M[X.parent_id]=[]),M[X.parent_id].push(X))}for(const B of Object.values(M))B.sort((X,oe)=>{const G=parseInt(X.identifier.split("-")[1]??"0",10),te=parseInt(oe.identifier.split("-")[1]??"0",10);return G-te});const L=Array.from(T).map(B=>re.get(B)).filter(B=>!B.parent_id||!T.has(B.parent_id)).sort((B,X)=>{const oe=parseInt(B.identifier.split("-")[1]??"0",10),G=parseInt(X.identifier.split("-")[1]??"0",10);return oe-G}),H=q.length,R=new Set((C??[]).map(B=>B.id)),Y={__none__:[]};for(const B of C??[])Y[B.id]=[];for(const B of L){const X=B.task_list_id&&R.has(B.task_list_id)?B.task_list_id:"__none__";Y[X].push(B)}function J(){l.trim()&&P.mutate({name:l.trim()},{onSuccess:()=>{c(""),u(!1),F.success("List created")},onError:()=>F.error("Failed to create list")})}function A(B,X){O.mutate({id:B,name:X},{onError:()=>F.error("Failed to rename list")})}function U(B){const X=C==null?void 0:C.find(oe=>oe.id===B);confirm(`Delete list "${X==null?void 0:X.name}"? Issues in this list will be moved to No List.`)&&E.mutate(B,{onSuccess:()=>F.success("List deleted"),onError:()=>F.error("Failed to delete list")})}return s.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[s.jsx(Or,{zone:"project.issues.before",props:{projectId:j}}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:s.jsxs("div",{className:"flex items-center gap-2",children:[d?s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(_e,{autoFocus:!0,placeholder:"List name...",value:l,onChange:B=>c(B.target.value),onKeyDown:B=>{B.key==="Enter"&&J(),B.key==="Escape"&&(u(!1),c(""))},className:"h-8 text-xs w-36"}),s.jsx(ee,{size:"sm",variant:"outline",className:"h-8 text-xs",onClick:J,disabled:!l.trim()||P.isPending,children:"Add"}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-8 text-xs",onClick:()=>{u(!1),c("")},children:"Cancel"})]}):s.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>u(!0),children:[s.jsx(ot,{className:"h-4 w-4"}),"New List"]}),s.jsxs(ee,{size:"sm",onClick:()=>o({open:!0}),children:[s.jsx(ot,{className:"h-4 w-4"}),"Create"]})]})}),s.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:[s.jsxs("div",{className:"flex items-center gap-2 md:overflow-x-auto md:scrollbar-none",children:[s.jsxs(Ue,{value:y,onValueChange:b,children:[s.jsx(Le,{className:"h-8 text-xs flex-1 md:flex-none md:w-[140px] md:shrink-0 bg-transparent",children:s.jsx(Ve,{placeholder:"Sprint"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All sprints"}),s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),Q.map(B=>s.jsx(ke,{value:B.id,className:"text-xs",children:B.name},B.id))]})]}),s.jsxs(Ue,{value:p,onValueChange:x,children:[s.jsx(Le,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:s.jsx(Ve,{placeholder:"Status"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All statuses"}),D.map(({key:B,name:X})=>s.jsx(ke,{value:B,className:"text-xs",children:X},B))]})]}),s.jsxs(Ue,{value:g,onValueChange:v,children:[s.jsx(Le,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:s.jsx(Ve,{placeholder:"Priority"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(dn).map(([B,X])=>s.jsx(ke,{value:B,className:"text-xs",children:X},B))]})]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(za,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),s.jsx(_e,{placeholder:"Search...",value:f,onChange:B=>m(B.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]}),s.jsx("div",{className:"hidden md:block overflow-x-auto",children:s.jsxs("div",{className:"min-w-[1025px]",children:[s.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Gh),children:[s.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[110px] z-10 bg-white dark:bg-card",children:"Title"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"}),s.jsx("span",{className:"pr-6"})]}),w?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(B=>s.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Gh),children:[s.jsx(le,{className:"h-4 w-14"}),s.jsx(le,{className:"h-4 w-56"}),s.jsx(le,{className:"h-5 w-20"}),s.jsx(le,{className:"h-4 w-16"}),s.jsx(le,{className:"h-4 w-20"}),s.jsx(le,{className:"h-4 w-24"}),s.jsx(le,{className:"h-6 w-16"}),s.jsx("span",{})]},B))}):H===0&&(k??[]).length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create your first issue to start tracking work."}),s.jsxs(ee,{size:"sm",onClick:()=>o({open:!0}),children:[s.jsx(ot,{className:"h-4 w-4"}),"Create issue"]})]}):L.length===0&&(k??[]).length>0?s.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No issues match your filters."})}):s.jsx(Ku,{delayDuration:200,children:s.jsxs("div",{className:"divide-y divide-border",children:[(C??[]).map(B=>s.jsx(n0,{taskList:B,issues:Y[B.id]??[],childrenMap:M,projectId:j,statuses:D,statusLabels:I,statusColorMap:V,sprints:Q,workspace:t,projectKey:r,onOpen:a,onAddIssue:X=>o({open:!0,defaultTaskListId:X}),onAddChild:X=>o({open:!0,defaultParentId:X}),onRenameList:A,onDeleteList:U},B.id)),(((ne=Y.__none__)==null?void 0:ne.length)>0||(C??[]).length===0)&&s.jsx(n0,{taskList:null,issues:Y.__none__??[],childrenMap:M,projectId:j,statuses:D,statusLabels:I,statusColorMap:V,sprints:Q,workspace:t,projectKey:r,onOpen:a,onAddIssue:B=>o({open:!0,defaultTaskListId:B}),onAddChild:B=>o({open:!0,defaultParentId:B})})]})})]})}),s.jsx("div",{className:"md:hidden divide-y divide-border/60",children:w?[1,2,3,4].map(B=>s.jsx("div",{className:"flex items-start gap-3 px-4 py-3",children:s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"h-3 w-10 bg-muted rounded animate-pulse"}),s.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"})]}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded animate-pulse"})]})},B)):L.length===0?null:L.map(B=>{const X=(V==null?void 0:V[B.status])??"#94a3b8",oe=Q.find(G=>G.id===B.sprint_id);return s.jsx("div",{onClick:()=>e(`/${t}/projects/${r}/issues/${B.id}`),className:"flex items-start gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",children:s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:B.identifier}),s.jsx("span",{className:"text-sm text-foreground truncate font-medium",children:B.title})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(Yh,{priority:B.priority}),s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:X}}),I[B.status]??B.status]}),oe&&s.jsx("span",{className:"text-[11px] text-muted-foreground truncate max-w-[120px]",children:oe.name}),B.due_date&&s.jsx("span",{className:"text-[11px] text-muted-foreground",children:fe(new Date(B.due_date),"MMM d")})]})]})},B.id)})}),!w&&H>0&&s.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:s.jsxs("span",{className:"text-xs text-muted-foreground",children:[H," issue",H!==1?"s":""]})})]}),s.jsx(Or,{zone:"project.issues.after",props:{projectId:j}}),s.jsx(qS,{issue:n,projectId:j,open:!!n,onClose:()=>a(null)}),s.jsx(jf,{open:i.open,onClose:()=>o({open:!1}),projectId:j,defaultTaskListId:i.defaultTaskListId,defaultParentId:i.defaultParentId})]})}const Br=20;function nL({member:e,onRequestRemove:t}){var l;const r=e.user,n=(r==null?void 0:r.first_name)??"",a=(r==null?void 0:r.last_name)??"",i=`${n} ${a}`.trim()||(r==null?void 0:r.email)||"Unknown",o=(n[0]??a[0]??((l=r==null?void 0:r.email)==null?void 0:l[0])??"U").toUpperCase();return s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[s.jsx(Pt,{className:"h-8 w-8 shrink-0",children:s.jsx(Mt,{className:"text-xs font-medium",children:o})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:i}),(r==null?void 0:r.email)&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:r.email})]}),s.jsx(Pn,{className:z("shrink-0 text-[11px] border-0 min-w-20 justify-center",e.app_role_name==="Workspace Admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-400":e.app_role_name==="Viewer"?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400"),children:e.app_role_name??e.role}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",onClick:()=>t(e.user_id,i),children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})}function sL({teamEntry:e,onRemove:t}){const r=e.team;return s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[s.jsx("div",{className:"h-8 w-8 rounded-lg bg-muted flex items-center justify-center shrink-0",children:s.jsx(Aa,{className:"h-4 w-4 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:(r==null?void 0:r.name)??"Unknown team"}),r&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[r.member_count," ",r.member_count===1?"member":"members"]})]}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive opacity-100 md:opacity-0 md:group-hover:opacity-100 transition-opacity",onClick:()=>t(e.team_id),children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})}function aL(){const{projectKey:e}=Et(),{workspace:t}=De(),r=(t==null?void 0:t.id)??"",{data:n}=ea(e??""),a=(n==null?void 0:n.id)??"",{data:i,isLoading:o}=Yn(a),{data:l}=Po(r),{data:c}=Qu(r),{data:d}=Sx(a),u=TN(a),f=((d==null?void 0:d.requests)??[]).filter(q=>q.status==="pending"),m=ON(a),p=EN(a),x=AN(a),g=DN(a),[v,y]=h.useState([]),[b,N]=h.useState([]),[j,k]=h.useState(0),[w,S]=h.useState(0),[_,C]=h.useState(null),P=new Set((i==null?void 0:i.members.map(q=>q.user_id))??[]),O=new Set((i==null?void 0:i.teams.map(q=>q.team_id))??[]),E=(l??[]).filter(q=>!P.has(q.user_id)),D=(c??[]).filter(q=>!O.has(q.id)),I=(i==null?void 0:i.members.length)??0,V=(i==null?void 0:i.teams.length)??0;function Q(){_&&p.mutate(_.userId,{onSuccess:()=>{F.success("Access removed"),C(null)},onError:()=>F.error("Failed to remove")})}return s.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold",children:"Access"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Manage who has access to this project."})]}),!o&&s.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[I," member",I!==1?"s":""," • ",V," team",V!==1?"s":""]})]}),o?s.jsxs("div",{children:[s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"People"})}),s.jsx("div",{className:"divide-y divide-border",children:[1,2].map(q=>s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[s.jsx(le,{className:"h-8 w-8 rounded-full"}),s.jsx(le,{className:"h-4 w-44"}),s.jsx("div",{className:"flex-1"}),s.jsx(le,{className:"h-5 w-20"})]},q))}),s.jsx("div",{className:"px-6 py-2 border-y border-border bg-muted/20",children:s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Teams"})}),s.jsx("div",{className:"divide-y divide-border",children:[1].map(q=>s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[s.jsx(le,{className:"h-8 w-8 rounded-lg"}),s.jsx(le,{className:"h-4 w-32"}),s.jsx("div",{className:"flex-1"}),s.jsx(le,{className:"h-4 w-20"})]},q))})]}):s.jsxs("div",{children:[f.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"px-6 py-2 border-b border-border bg-amber-50 dark:bg-amber-950/20",children:s.jsxs("span",{className:"text-xs font-semibold text-amber-700 dark:text-amber-400 uppercase tracking-wide flex items-center gap-2",children:["Requests",s.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-amber-500 px-1 text-[10px] font-medium text-white",children:f.length})]})}),s.jsx("div",{className:"divide-y divide-border",children:f.map(q=>{var L,H,R,Y,J,A;const re=((L=q.user)==null?void 0:L.first_name)??"",se=((H=q.user)==null?void 0:H.last_name)??"",T=`${re} ${se}`.trim()||((R=q.user)==null?void 0:R.email)||"Unknown",M=(re[0]??se[0]??((J=(Y=q.user)==null?void 0:Y.email)==null?void 0:J[0])??"U").toUpperCase();return s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors",children:[s.jsx(Pt,{className:"h-8 w-8 shrink-0",children:s.jsx(Mt,{className:"text-xs font-medium",children:M})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:T}),((A=q.user)==null?void 0:A.email)&&s.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:q.user.email}),q.message&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-1 italic",children:['"',q.message,'"']})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 px-2 text-xs text-destructive border-destructive/30 hover:bg-destructive/10",disabled:u.isPending,onClick:()=>u.mutate({requestId:q.id,action:"deny"},{onError:()=>F.error("Failed to deny request")}),children:[s.jsx(Be,{className:"h-3 w-3 mr-1"}),"Deny"]}),s.jsxs(ee,{size:"sm",className:"h-7 px-2 text-xs",disabled:u.isPending,onClick:()=>u.mutate({requestId:q.id,action:"approve"},{onSuccess:()=>F.success(`${T} granted access`),onError:()=>F.error("Failed to approve request")}),children:[s.jsx(Ct,{className:"h-3 w-3 mr-1"}),"Approve"]})]})]},q.id)})})]}),s.jsxs("div",{children:[s.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["People",I>0&&s.jsx(Pn,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full",children:I})]}),E.length>0&&s.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[s.jsx(Is,{options:E.map(q=>{const re=q.user,se=(re==null?void 0:re.first_name)??"",T=(re==null?void 0:re.last_name)??"";return{value:q.user_id,label:`${se} ${T}`.trim()||(re==null?void 0:re.email)||"Unknown"}}),selected:v,onSelectionChange:y,placeholder:"Add people…",className:"w-full sm:w-56"}),s.jsxs(ee,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:v.length===0||m.isPending,onClick:()=>m.mutate({userIds:v},{onSuccess:q=>{F.success(`${q.added} member${q.added===1?"":"s"} added`),y([])},onError:()=>F.error("Failed to grant access")}),children:[s.jsx(Nn,{className:"h-3.5 w-3.5"}),v.length<=1?"Add":`Add ${v.length}`]})]})]}),I===0?s.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No individual members."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"divide-y divide-border",children:((i==null?void 0:i.members)??[]).slice(j*Br,(j+1)*Br).map(q=>s.jsx(nL,{member:q,onRequestRemove:(re,se)=>C({userId:re,displayName:se})},q.id))}),I>Br&&s.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[j*Br+1,"–",Math.min((j+1)*Br,I)," of ",I]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>k(q=>q-1),disabled:j===0,children:s.jsx(fs,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[j+1," / ",Math.ceil(I/Br)]}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>k(q=>q+1),disabled:(j+1)*Br>=I,children:s.jsx(pr,{className:"h-3.5 w-3.5"})})]})]})]})]}),s.jsxs("div",{className:"border-t border-border",children:[s.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["Teams",V>0&&s.jsx(Pn,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full",children:V})]}),D.length>0&&s.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto",children:[s.jsx(Is,{options:D.map(q=>({value:q.id,label:q.name})),selected:b,onSelectionChange:N,placeholder:"Add teams…",className:"w-full sm:w-56"}),s.jsxs(ee,{size:"sm",className:"h-8 px-3 text-xs shrink-0",disabled:b.length===0||x.isPending,onClick:()=>x.mutate(b,{onSuccess:q=>{F.success(`${q.added} team${q.added===1?"":"s"} added`),N([])},onError:()=>F.error("Failed to add teams")}),children:[s.jsx(Aa,{className:"h-3.5 w-3.5"}),b.length<=1?"Add":`Add ${b.length}`]})]})]}),V===0?s.jsx("p",{className:"text-sm text-muted-foreground px-6 py-4",children:"No teams have access."}):s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"divide-y divide-border",children:((i==null?void 0:i.teams)??[]).slice(w*Br,(w+1)*Br).map(q=>s.jsx(sL,{teamEntry:q,onRemove:re=>g.mutate(re,{onSuccess:()=>F.success("Team access removed"),onError:()=>F.error("Failed to remove team")})},q.id))}),V>Br&&s.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[w*Br+1,"–",Math.min((w+1)*Br,V)," of ",V]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>S(q=>q-1),disabled:w===0,children:s.jsx(fs,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[w+1," / ",Math.ceil(V/Br)]}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>S(q=>q+1),disabled:(w+1)*Br>=V,children:s.jsx(pr,{className:"h-3.5 w-3.5"})})]})]})]})]}),I===0&&V===0&&E.length===0&&D.length===0&&s.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center border-t border-border",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(Aa,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No access entries yet"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"Add workspace people or teams first to grant project access."})]})]})]}),s.jsx(li,{open:!!_,onOpenChange:q=>{q||C(null)},children:s.jsxs(wa,{className:"sm:max-w-md",children:[s.jsxs(Na,{children:[s.jsx(Sa,{children:"Remove member access?"}),s.jsx(Ca,{children:_?`${_.displayName} will lose access to this project.`:"This member will lose access to this project."})]}),s.jsxs(ka,{children:[s.jsx(Pa,{disabled:p.isPending,children:"Cancel"}),s.jsx(_a,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:q=>{q.preventDefault(),Q()},disabled:p.isPending,children:p.isPending?"Removing...":"Remove"})]})]})})]})}function s0(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?fe(new Date(e.start_date),"MMM d"):"—",r=e.end_date?fe(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function Rn({label:e,children:t}){return s.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[s.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),s.jsx("div",{className:"flex-1 min-w-0",children:t})]})}const iL={backlog:s.jsx(Er,{className:"h-3 w-3 text-zinc-400"}),todo:s.jsx(Er,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:s.jsx(Ar,{className:"h-3 w-3 text-indigo-500"}),in_review:s.jsx(Mi,{className:"h-3 w-3 text-amber-500"}),done:s.jsx(kn,{className:"h-3 w-3 text-emerald-500"}),cancelled:s.jsx(ux,{className:"h-3 w-3 text-zinc-400"})},oL={urgent:s.jsx(gs,{className:"h-3 w-3 text-red-500"}),high:s.jsx(Pi,{className:"h-3 w-3 text-orange-500"}),medium:s.jsx(Js,{className:"h-3 w-3 text-yellow-500"}),low:s.jsx(_i,{className:"h-3 w-3 text-blue-400"})},lL={bug:s.jsx(eN,{className:"h-3 w-3 text-red-500"}),feature:s.jsx(dN,{className:"h-3 w-3 text-purple-500"}),task:s.jsx(Xu,{className:"h-3 w-3 text-blue-500"}),chore:s.jsx(cx,{className:"h-3 w-3 text-zinc-500"})};function eh({value:e,onValueChange:t,options:r,icons:n,placeholder:a}){return s.jsxs(Ue,{value:e,onValueChange:t,children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[n[e]??s.jsx(rN,{className:"h-3 w-3 text-muted-foreground"}),s.jsx("span",{children:r[e]??a??""})]})}),s.jsx(Fe,{children:Object.entries(r).map(([i,o])=>s.jsx(ke,{value:i,className:"text-xs",children:s.jsxs("div",{className:"flex items-center gap-2",children:[n[i],o]})},i))})]})}function cL(){const{workspace:e,projectKey:t,issueId:r}=Et(),n=ct(),[a,i]=h.useState(!1),[o,l]=h.useState(""),[c,d]=h.useState(""),[u,f]=h.useState(!1),{data:m}=ea(t??""),p=(m==null?void 0:m.id)??"",{data:x,isLoading:g}=V1(r??""),v=Gu(r??"",p),{data:y}=Yn(p),b=h.useMemo(()=>y?y.members.filter(M=>M.user).map(M=>M.user):void 0,[y]),N=h.useMemo(()=>b==null?void 0:b.map(M=>({id:M.id,label:`${M.first_name??""} ${M.last_name??""}`.trim()||M.email,email:M.email})),[b]),{data:j}=$o(p||void 0),{data:k}=zo(p||void 0),{data:w}=vc(p||void 0),{data:S}=X1(r??""),_=(k??[]).filter(M=>M.status!=="completed"),{data:C}=Rk(),P=(C==null?void 0:C.maxChildIssueDepth)??1,E=((S==null?void 0:S.depth)??0)<P,D=(S==null?void 0:S.parent)??null,I=(S==null?void 0:S.children)??[],V=x!=null&&x.task_list_id?w==null?void 0:w.find(M=>M.id===x.task_list_id):null,Q=j&&j.length>0?Object.fromEntries(j.map(M=>[M.key,M.name])):gi,q=j&&j.length>0?Object.fromEntries(j.map(M=>[M.key,M.category==="completed"?s.jsx(kn,{className:"h-3 w-3",style:{color:M.color}}):M.category==="started"?s.jsx(Ar,{className:"h-3 w-3",style:{color:M.color}}):s.jsx(Er,{className:"h-3 w-3",style:{color:M.color}})])):iL;if(h.useEffect(()=>{x&&(l(x.title),d(x.description??"")),i(!1)},[x==null?void 0:x.id]),!t||!r)return null;const re=()=>{if(!o.trim())return;const M=[];new DOMParser().parseFromString(c,"text/html").querySelectorAll("[data-type='mention']").forEach(R=>{const Y=R.getAttribute("data-id");Y&&!M.includes(Y)&&M.push(Y)}),v.mutate({title:o.trim(),description:c.trim()||void 0,mentioned_user_ids:M.length>0?M:void 0},{onSuccess:()=>{i(!1),F.success("Issue updated")},onError:()=>F.error("Failed to update issue")})},se=()=>{x&&(l(x.title),d(x.description??"")),i(!1)},T=(M,L)=>{v.mutate(M,{onSuccess:()=>F.success(`${L} updated`),onError:()=>F.error(`Failed to update ${L.toLowerCase()}`)})};return g||!x?s.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[s.jsx("div",{className:"sticky top-0 z-10 h-[57px] bg-white dark:bg-card border-b border-border"}),s.jsx("div",{className:"px-2 py-2 pb-24 md:pb-2",children:s.jsxs("div",{className:"flex flex-col gap-4 md:grid md:grid-cols-[1fr_256px] md:gap-5 md:items-start",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 space-y-4 shadow-sm",children:[s.jsx(le,{className:"h-7 w-3/4"}),s.jsx(le,{className:"h-32 w-full"})]}),s.jsx(le,{className:"h-24 w-full rounded-xl"}),s.jsx(le,{className:"h-48 w-full rounded-xl"})]}),s.jsx(le,{className:"h-[280px] w-full rounded-xl"})]})})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[s.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 h-[57px] bg-white dark:bg-card border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>n(`/${e}/projects/${t}/issues`),children:[s.jsx(fs,{className:"h-3.5 w-3.5"}),(m==null?void 0:m.name)??"Issues"]}),s.jsx("span",{className:"text-border",children:"/"}),s.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:x.identifier}),s.jsx(Pn,{variant:"muted",className:"text-[10px] ml-1",children:Bs[x.type]??x.type})]}),s.jsx("div",{className:"flex items-center gap-2",children:a?s.jsxs(s.Fragment,{children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:se,children:"Discard"}),s.jsx(ee,{size:"sm",onClick:re,disabled:!o.trim()||v.isPending,className:"px-4",children:v.isPending?"Saving…":"Save changes"})]}):s.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 gap-1.5 text-muted-foreground hover:text-foreground",onClick:()=>i(!0),children:[s.jsx(Fs,{className:"h-3.5 w-3.5"}),"Edit"]})})]}),s.jsx("div",{className:"px-2 py-2 pb-24 md:pb-2",children:s.jsxs("div",{className:"flex flex-col gap-4 md:grid md:grid-cols-[1fr_256px] md:gap-5 md:items-start",children:[s.jsxs("div",{className:"space-y-4",children:[s.jsx(Or,{zone:"issue.details.before",props:{issue:x}}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"px-6 pt-6 pb-3",children:a?s.jsx("input",{autoFocus:!0,value:o,onChange:M=>l(M.target.value),onKeyDown:M=>{M.key==="Enter"&&M.preventDefault()},className:z("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")}):s.jsx("h1",{className:"text-xl font-semibold text-foreground leading-snug",children:x.title})}),s.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:s.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),a?s.jsx(gf,{content:c,onChange:d,placeholder:"Add a description…",className:"border-t border-border/50 min-h-[280px]",users:N}):x.description?s.jsx("div",{className:"border-t border-border/50",children:s.jsx(Gx,{html:x.description,className:"px-5 py-4"})}):s.jsx("div",{className:"border-t border-border/50 px-6 py-4",children:s.jsx("p",{className:"text-sm text-muted-foreground/50 italic",children:"No description"})})]}),E&&s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[s.jsxs("div",{className:"px-5 py-3 border-b border-border/60 flex items-center justify-between",children:[s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Child Issues"}),s.jsxs("button",{onClick:()=>f(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Add child issue"]})]}),I.length===0?s.jsx("div",{className:"px-5 py-4 text-xs text-muted-foreground/50 italic",children:"No child issues yet"}):s.jsx("div",{className:"px-5 py-2 divide-y divide-border/40",children:I.map(M=>s.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs",children:[s.jsx(Ds,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx("button",{onClick:()=>n(`/${e}/projects/${t}/issues/${M.id}`),className:"font-mono text-muted-foreground hover:text-foreground transition-colors shrink-0",children:M.identifier}),s.jsx("button",{onClick:()=>n(`/${e}/projects/${t}/issues/${M.id}`),className:"text-foreground hover:text-foreground/70 truncate text-left transition-colors",children:M.title})]},M.id))})]}),s.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:s.jsx(fS,{issueId:r,projectId:p,scrollMarginTop:57})}),s.jsx(Or,{zone:"issue.details.after",props:{issue:x}})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsx(Or,{zone:"issue.details.sidebar",props:{issue:x}}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),s.jsxs("div",{className:"px-4 py-1",children:[s.jsx(Rn,{label:"Status",children:s.jsx(eh,{value:x.status,onValueChange:M=>T({status:M},"Status"),options:Q,icons:q})}),s.jsx(Rn,{label:"Priority",children:s.jsx(eh,{value:x.priority,onValueChange:M=>T({priority:M},"Priority"),options:dn,icons:oL})}),s.jsx(Rn,{label:"Type",children:s.jsx(eh,{value:x.type,onValueChange:M=>T({type:M},"Type"),options:Bs,icons:lL})}),s.jsx(Rn,{label:"Assignees",children:s.jsx(yc,{value:x.assignee_ids??[],onChange:M=>T({assignee_ids:M},"Assignees"),disabled:v.isPending,users:b})}),s.jsx(Rn,{label:"Sprint",children:s.jsxs(Ue,{value:x.sprint_id??"none",onValueChange:M=>T({sprint_id:M==="none"?null:M},"Sprint"),children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Gr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),x.sprint_id?(()=>{const M=_.find(H=>H.id===x.sprint_id)??(k==null?void 0:k.find(H=>H.id===x.sprint_id));if(!M)return s.jsxs("span",{className:"truncate",children:[x.sprint_id.slice(0,8),"…"]});const L=s0(M);return s.jsxs("span",{className:"truncate",children:[M.name,L&&s.jsxs("span",{className:"text-muted-foreground ml-1",children:["· ",L]})]})})():s.jsx("span",{className:"text-muted-foreground",children:"No sprint"})]})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),_.map(M=>{const L=s0(M);return s.jsx(ke,{value:M.id,className:"text-xs",children:s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{children:M.name}),L&&s.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:L})]})},M.id)})]})]})}),(w??[]).length>0&&s.jsx(Rn,{label:"List",children:s.jsxs(Ue,{value:x.task_list_id??"none",onValueChange:M=>T({task_list_id:M==="none"?null:M},"List"),children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(px,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:V?"truncate":"text-muted-foreground",children:(V==null?void 0:V.name)??"No list"})]})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(w??[]).map(M=>s.jsx(ke,{value:M.id,className:"text-xs",children:M.name},M.id))]})]})}),s.jsx(Rn,{label:"Start Date",children:s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.jsxs("button",{className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:x.start_date?"text-foreground":"text-muted-foreground",children:x.start_date?fe(new Date(x.start_date),"MMM d, yyyy"):"No start date"})]})}),s.jsxs(_t,{className:"w-auto p-0",align:"start",children:[s.jsx(br,{mode:"single",selected:x.start_date?new Date(x.start_date):void 0,onSelect:M=>T({start_date:M?fe(M,"yyyy-MM-dd"):null},"Start date"),initialFocus:!0}),x.start_date&&s.jsx("div",{className:"border-t px-3 py-2",children:s.jsxs("button",{onClick:()=>T({start_date:null},"Start date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[s.jsx(Be,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),s.jsx(Rn,{label:"Due Date",children:s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.jsxs("button",{className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:x.due_date?"text-foreground":"text-muted-foreground",children:x.due_date?fe(new Date(x.due_date),"MMM d, yyyy"):"No due date"})]})}),s.jsxs(_t,{className:"w-auto p-0",align:"start",children:[s.jsx(br,{mode:"single",selected:x.due_date?new Date(x.due_date):void 0,onSelect:M=>T({due_date:M?fe(M,"yyyy-MM-dd"):null},"Due date"),initialFocus:!0}),x.due_date&&s.jsx("div",{className:"border-t px-3 py-2",children:s.jsxs("button",{onClick:()=>T({due_date:null},"Due date"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",children:[s.jsx(Be,{className:"h-3 w-3"}),"Clear date"]})})]})]})}),s.jsx(Rn,{label:"Depends on",children:s.jsx(co,{value:x.depends_on_ids??[],onChange:M=>T({depends_on_ids:M},"Dependencies"),projectId:x.project_id,excludeId:x.id,disabled:v.isPending})}),s.jsx(Rn,{label:"Related to",children:s.jsx(co,{value:x.related_to_ids??[],onChange:M=>T({related_to_ids:M},"Relations"),projectId:x.project_id,excludeId:x.id,disabled:v.isPending})}),D&&s.jsx(Rn,{label:"Parent",children:s.jsxs("button",{onClick:()=>n(`/${e}/projects/${t}/issues/${D.id}`),className:"flex items-center gap-1.5 text-xs hover:text-foreground transition-colors text-left w-full min-w-0",children:[s.jsx(dx,{className:"h-3 w-3 text-muted-foreground shrink-0"}),s.jsx("span",{className:"font-mono text-muted-foreground shrink-0",children:D.identifier}),s.jsx("span",{className:"text-foreground truncate",children:D.title})]})})]})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Details"})}),s.jsxs("div",{className:"px-4 pt-3 pb-4 space-y-2.5",children:[s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:"Created"}),s.jsx("span",{className:"text-foreground",children:fe(new Date(x.created_at),"MMM d, yyyy")})]}),s.jsxs("div",{className:"flex items-center justify-between text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:"Updated"}),s.jsx("span",{className:"text-foreground",children:fe(new Date(x.updated_at),"MMM d, yyyy")})]})]})]})]})]})})]}),s.jsx(jf,{open:u,onClose:()=>f(!1),projectId:p,defaultParentId:r,defaultTaskListId:x.task_list_id})]})}function ks({label:e,children:t}){return s.jsxs("div",{className:"flex items-center justify-between gap-3 py-2.5 border-b border-border/60 last:border-0",children:[s.jsx("span",{className:"text-xs text-muted-foreground shrink-0 w-20",children:e}),s.jsx("div",{className:"flex-1 min-w-0",children:t})]})}const dL={backlog:s.jsx(Er,{className:"h-3 w-3 text-zinc-400"}),todo:s.jsx(Er,{className:"h-3 w-3 text-zinc-500",strokeWidth:2.5}),in_progress:s.jsx(Ar,{className:"h-3 w-3 text-indigo-500"}),in_review:s.jsx(Mi,{className:"h-3 w-3 text-amber-500"}),done:s.jsx(kn,{className:"h-3 w-3 text-emerald-500"}),cancelled:s.jsx(ux,{className:"h-3 w-3 text-zinc-400"})},uL={urgent:s.jsx(gs,{className:"h-3 w-3 text-red-500"}),high:s.jsx(Pi,{className:"h-3 w-3 text-orange-500"}),medium:s.jsx(Js,{className:"h-3 w-3 text-yellow-500"}),low:s.jsx(_i,{className:"h-3 w-3 text-blue-400"})},fL={bug:s.jsx(eN,{className:"h-3 w-3 text-red-500"}),feature:s.jsx(dN,{className:"h-3 w-3 text-purple-500"}),task:s.jsx(Xu,{className:"h-3 w-3 text-blue-500"}),chore:s.jsx(cx,{className:"h-3 w-3 text-zinc-500"})};function th({value:e,onValueChange:t,options:r,icons:n,placeholder:a}){return s.jsxs(Ue,{value:e,onValueChange:t,children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[n[e]??s.jsx(rN,{className:"h-3 w-3 text-muted-foreground"}),s.jsx("span",{children:r[e]??a??""})]})}),s.jsx(Fe,{children:Object.entries(r).map(([i,o])=>s.jsx(ke,{value:i,className:"text-xs",children:s.jsxs("div",{className:"flex items-center gap-2",children:[n[i],o]})},i))})]})}function mL(e){if(!e.start_date&&!e.end_date)return null;const t=e.start_date?fe(new Date(e.start_date),"MMM d"):"—",r=e.end_date?fe(new Date(e.end_date),"MMM d"):"—";return`${t} – ${r}`}function hL(){const{workspace:e,projectKey:t}=Et(),r=ct(),{workspace:n}=De(),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState("backlog"),[u,f]=h.useState("medium"),[m,p]=h.useState("task"),[x,g]=h.useState([]),[v,y]=h.useState(""),[b,N]=h.useState(""),[j,k]=h.useState(void 0),[w,S]=h.useState(void 0),[_,C]=h.useState(!1),[P,O]=h.useState("weekly"),[E,D]=h.useState(void 0),{data:I}=ea(t??""),V=(I==null?void 0:I.id)??"",Q=Q1(),{data:q}=Yn(V),re=h.useMemo(()=>q?q.members.filter(A=>A.user).map(A=>A.user):void 0,[q]),se=h.useMemo(()=>re==null?void 0:re.map(A=>({id:A.id,label:`${A.first_name??""} ${A.last_name??""}`.trim()||A.email,email:A.email})),[re]),{data:T}=$o(V||void 0),{data:M}=zo(V||void 0);h.useEffect(()=>{T&&T.length>0&&(T.map(U=>U.key).includes(c)||d(T[0].key))},[T]);const{data:L}=vc(V||void 0),H=(M??[]).filter(A=>A.status!=="completed"),R=T&&T.length>0?Object.fromEntries(T.map(A=>[A.key,A.name])):gi,Y=T&&T.length>0?Object.fromEntries(T.map(A=>[A.key,A.category==="completed"?s.jsx(kn,{className:"h-3 w-3",style:{color:A.color}}):A.category==="started"?s.jsx(Ar,{className:"h-3 w-3",style:{color:A.color}}):s.jsx(Er,{className:"h-3 w-3",style:{color:A.color}})])):dL;if(!t||!V)return null;const J=()=>{if(!a.trim()){F.error("Title is required");return}const A=[];o&&new DOMParser().parseFromString(o,"text/html").querySelectorAll("[data-type='mention']").forEach(ne=>{const B=ne.getAttribute("data-id");B&&!A.includes(B)&&A.push(B)}),Q.mutate({title:a.trim(),description:o||void 0,status:c,priority:u,type:m,project_id:V,workspace_id:n.id,assignee_ids:x.length>0?x:void 0,sprint_id:v||null,task_list_id:b||null,start_date:j?fe(j,"yyyy-MM-dd"):null,due_date:w?fe(w,"yyyy-MM-dd"):null,recurrence_frequency:_?P:void 0,recurrence_end_date:_&&E?fe(E,"yyyy-MM-dd"):void 0,mentioned_user_ids:A.length>0?A:void 0},{onSuccess:U=>{F.success("Issue created"),r(`/${e}/projects/${t}/issues/${U.issue.id}`,{replace:!0})},onError:U=>F.error(U.message??"Failed to create issue")})};return s.jsxs("div",{className:"min-h-full bg-[hsl(60_5%_96%)] dark:bg-background",children:[s.jsxs("div",{className:"sticky top-0 z-10 flex items-center justify-between px-6 h-[57px] bg-white dark:bg-card border-b border-border",children:[s.jsxs(ee,{variant:"ghost",size:"sm",className:"h-7 gap-1 text-muted-foreground hover:text-foreground px-2",onClick:()=>r(`/${e}/projects/${t}/issues`),children:[s.jsx(fs,{className:"h-3.5 w-3.5"}),(I==null?void 0:I.name)??"Issues"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>r(`/${e}/projects/${t}/issues`),children:"Discard"}),s.jsx(ee,{size:"sm",onClick:J,disabled:!a.trim()||Q.isPending,className:"px-4",children:Q.isPending?"Creating…":"Create issue"})]})]}),s.jsx("div",{className:"px-2 py-2 pb-24 md:pb-2",children:s.jsxs("div",{className:"flex flex-col gap-4 md:grid md:grid-cols-[1fr_256px] md:gap-5 md:items-start",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden shadow-sm",children:[s.jsx("div",{className:"px-6 pt-6 pb-3",children:s.jsx("input",{autoFocus:!0,value:a,onChange:A=>i(A.target.value),onKeyDown:A=>{A.key==="Enter"&&A.preventDefault()},placeholder:"Issue title…",className:z("w-full text-xl font-semibold leading-snug text-foreground","bg-transparent border-0 outline-none resize-none","placeholder:text-muted-foreground/40")})}),s.jsx("div",{className:"flex items-center gap-2 px-6 pb-2",children:s.jsx("span",{className:"text-[11px] font-medium text-muted-foreground/60 uppercase tracking-widest",children:"Description"})}),s.jsx(gf,{content:"",onChange:l,placeholder:"Add steps to reproduce, acceptance criteria, or context…",className:"border-t border-border/50 min-h-[320px]",users:se})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl shadow-sm overflow-hidden",children:[s.jsx("div",{className:"px-4 py-3 border-b border-border/60",children:s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-widest",children:"Properties"})}),s.jsxs("div",{className:"px-4 py-1",children:[s.jsx(ks,{label:"Status",children:s.jsx(th,{value:c,onValueChange:d,options:R,icons:Y})}),s.jsx(ks,{label:"Priority",children:s.jsx(th,{value:u,onValueChange:f,options:dn,icons:uL})}),s.jsx(ks,{label:"Type",children:s.jsx(th,{value:m,onValueChange:p,options:Bs,icons:fL})}),s.jsx(ks,{label:"Assignees",children:s.jsx(yc,{value:x,onChange:g,users:re})}),H.length>0&&s.jsx(ks,{label:"Sprint",children:s.jsxs(Ue,{value:v||"none",onValueChange:A=>y(A==="none"?"":A),children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(Gr,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx(Ve,{placeholder:"No sprint"})]})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),H.map(A=>{const U=mL(A);return s.jsx(ke,{value:A.id,className:"text-xs",children:s.jsxs("div",{className:"flex items-baseline gap-1.5",children:[s.jsx("span",{children:A.name}),U&&s.jsx("span",{className:"text-[10px] text-muted-foreground font-normal",children:U})]})},A.id)})]})]})}),(L??[]).length>0&&s.jsx(ks,{label:"List",children:s.jsxs(Ue,{value:b||"none",onValueChange:A=>N(A==="none"?"":A),children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.jsx(px,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx(Ve,{placeholder:"No list"})]})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No list"}),(L??[]).map(A=>s.jsx(ke,{value:A.id,className:"text-xs",children:A.name},A.id))]})]})}),s.jsx(ks,{label:"Start Date",children:s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:j?"text-foreground":"text-muted-foreground",children:j?fe(j,"MMM d, yyyy"):"No start date"}),j&&s.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),k(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Be,{className:"h-3 w-3"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:j,onSelect:k,initialFocus:!0})})]})}),s.jsx(ks,{label:"Due Date",children:s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:w?"text-foreground":"text-muted-foreground",children:w?fe(w,"MMM d, yyyy"):"No due date"}),w&&s.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),S(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Be,{className:"h-3 w-3"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:w,onSelect:S,initialFocus:!0})})]})}),s.jsx(ks,{label:"Recurring",children:s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2 pl-1",children:[s.jsx(Lo,{id:"new-recurring",checked:_,onCheckedChange:C}),s.jsxs(at,{htmlFor:"new-recurring",className:"cursor-pointer font-normal text-xs flex items-center gap-1.5",children:[s.jsx(no,{className:"h-3 w-3 text-muted-foreground"}),_?P.charAt(0).toUpperCase()+P.slice(1):"Off"]})]}),_&&s.jsxs("div",{className:"space-y-2 pl-1 border-l-2 border-indigo-200 dark:border-indigo-800",children:[s.jsxs(Ue,{value:P,onValueChange:A=>O(A),children:[s.jsx(Le,{className:"h-7 text-xs border-0 bg-transparent px-0 gap-1.5 focus:ring-0 hover:bg-accent rounded-md pl-1",children:s.jsx(Ve,{})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"weekly",className:"text-xs",children:"Weekly"}),s.jsx(ke,{value:"monthly",className:"text-xs",children:"Monthly"})]})]}),s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.jsxs("button",{type:"button",className:"flex items-center gap-1.5 h-7 px-1 rounded text-xs bg-transparent hover:bg-accent transition-colors focus:outline-none w-full text-left",children:[s.jsx(Ht,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:E?"text-foreground":"text-muted-foreground",children:E?fe(E,"MMM d, yyyy"):"No end date"}),E&&s.jsx("button",{type:"button",onClick:A=>{A.stopPropagation(),D(void 0)},className:"ml-auto text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(Be,{className:"h-3 w-3"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:E,onSelect:D,initialFocus:!0})})]})]})]})})]}),s.jsx("div",{className:"px-4 pt-2 pb-3 mt-1 border-t border-border/60",children:s.jsxs("p",{className:"text-[11px] text-muted-foreground/50 leading-relaxed",children:["Press ",s.jsx("kbd",{className:"px-1 py-0.5 rounded border border-border bg-muted font-mono text-[10px]",children:"⌘ Enter"})," to submit"]})})]})]})})]})}const US={all:["my-tasks"],filtered:e=>[...US.all,e??{}]};function pL(e){return Te({queryKey:US.filtered(e),queryFn:()=>{var r,n,a,i;const t=new URLSearchParams;return t.set("limit","200"),(r=e==null?void 0:e.workspace_id)!=null&&r.length&&t.set("workspace_id",e.workspace_id.join(",")),(n=e==null?void 0:e.priority)!=null&&n.length&&t.set("priority",e.priority.join(",")),(a=e==null?void 0:e.type)!=null&&a.length&&t.set("type",e.type.join(",")),(i=e==null?void 0:e.category)!=null&&i.length&&t.set("category",e.category.join(",")),ie.get(`/admin/my/tasks?${t}`)},select:t=>t.issues})}const xL=({priority:e})=>{const t=z("h-3 w-3 shrink-0",gc[e]);switch(e){case"urgent":return s.jsx(gs,{className:t});case"high":return s.jsx(Pi,{className:t});case"medium":return s.jsx(Js,{className:t});case"low":return s.jsx(_i,{className:t});default:return s.jsx(Er,{className:"h-3 w-3 shrink-0 text-zinc-300"})}};function gL({issue:e,onClick:t}){var n,a;const{data:r}=La();return s.jsxs("div",{onClick:t,className:z("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"),children:[s.jsx("p",{className:"text-[13px] text-foreground leading-snug line-clamp-2 mb-2",children:e.title}),s.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground mb-2",children:[s.jsx(Ht,{className:"h-2.5 w-2.5 shrink-0"}),s.jsx("span",{children:e.start_date?fe(new Date(e.start_date),"MMM d"):"?"}),s.jsx("span",{children:"→"}),s.jsx("span",{children:e.due_date?fe(new Date(e.due_date),"MMM d"):"?"})]}),s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[s.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._project&&s.jsx("span",{className:"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 shrink-0",children:e._project.identifier}),s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e._status.color}}),s.jsx("span",{className:"text-[11px] text-muted-foreground truncate",children:e._status.name})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[(e.assignee_ids??[]).length>0&&s.jsxs("div",{className:"flex -space-x-1",children:[(e.assignee_ids??[]).slice(0,2).map(i=>{const o=r==null?void 0:r.get(i);return s.jsx(Pt,{className:"h-4 w-4 border border-background",children:s.jsx(Mt,{className:"text-[8px] bg-indigo-100 text-indigo-700 dark:bg-indigo-900/50 dark:text-indigo-300",children:(o==null?void 0:o.initials)??"?"})},i)}),(((n=e.assignee_ids)==null?void 0:n.length)??0)>2&&s.jsxs("span",{className:"text-[9px] text-muted-foreground ml-1.5 self-center",children:["+",(((a=e.assignee_ids)==null?void 0:a.length)??0)-2]})]}),s.jsx(xL,{priority:e.priority})]})]})]})}const a0=[{key:"backlog",label:"Backlog",color:"#94a3b8"},{key:"unstarted",label:"Unstarted",color:"#64748b"},{key:"started",label:"Started",color:"#6366f1"},{key:"completed",label:"Completed",color:"#10b981"},{key:"cancelled",label:"Cancelled",color:"#9ca3af"}];function i0(e,t){const r=e.replace("#",""),n=parseInt(r.substring(0,2),16),a=parseInt(r.substring(2,4),16),i=parseInt(r.substring(4,6),16);return isNaN(n)||isNaN(a)||isNaN(i)?`rgba(148,163,184,${t})`:`rgba(${n},${a},${i},${t})`}const vL=({category:e,color:t})=>{const r="h-3.5 w-3.5 shrink-0",n={color:t};switch(e){case"completed":return s.jsx(kn,{className:r,style:n});case"started":return s.jsx(Ar,{className:r,style:n});default:return s.jsx(Er,{className:r,style:n})}};function yL({issues:e,onIssueClick:t}){const r=h.useMemo(()=>{const n={};for(const a of a0)n[a.key]=[];for(const a of e){const i=a._status.category;n[i]?n[i].push(a):n.backlog.push(a)}return n},[e]);return s.jsx("div",{className:"flex gap-4 min-h-full overflow-x-auto px-6 py-4 pb-6",children:a0.map(n=>{const a=r[n.key],i=i0(n.color,.08);return s.jsxs("div",{className:"flex flex-col min-w-[260px] max-w-[280px] w-full",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-2 px-1",children:[s.jsx(vL,{category:n.key,color:n.color}),s.jsx("span",{className:"text-xs font-medium text-foreground",children:n.label}),s.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:i0(n.color,.12),color:n.color},children:a.length})]}),s.jsxs("div",{className:"flex-1 flex flex-col gap-2 min-h-[200px] p-2 rounded-xl transition-colors",style:{backgroundColor:i},children:[a.map(o=>s.jsx(gL,{issue:o,onClick:()=>t==null?void 0:t(o)},o.id)),a.length===0&&s.jsx("div",{className:"flex-1 flex items-center justify-center min-h-[120px]",children:s.jsx("p",{className:"text-xs text-muted-foreground/40",children:"No tasks"})})]})]},n.key)})})}const HS=({priority:e,className:t})=>{const r=z("h-3.5 w-3.5 shrink-0",gc[e],t);switch(e){case"urgent":return s.jsx(gs,{className:r});case"high":return s.jsx(Pi,{className:r});case"medium":return s.jsx(Js,{className:r});case"low":return s.jsx(_i,{className:r});default:return s.jsx(Er,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}},bL={backlog:"Backlog",unstarted:"Unstarted",started:"Started",completed:"Completed",cancelled:"Cancelled"},Vh="grid-cols-[70px_1fr_100px_140px_100px_110px_32px]";function jL({issue:e,workspace:t,onNavigate:r}){var i,o;const n=ct(),a=((i=e._project)==null?void 0:i.identifier)??"";return s.jsxs("div",{onClick:()=>r(e),className:z(`group grid ${Vh} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors"),children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate pl-6",children:e.identifier}),s.jsx("span",{className:"text-sm text-foreground truncate pr-3",children:e.title}),s.jsx("span",{className:"text-[11px] font-medium text-zinc-500 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded truncate w-fit",children:((o=e._project)==null?void 0:o.identifier)??"—"}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:e._status.color}}),s.jsx("span",{className:"text-xs text-primary truncate",children:e._status.name})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(HS,{priority:e.priority}),s.jsx("span",{className:"text-xs text-primary",children:dn[e.priority]??e.priority})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx(Ht,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"—"})]}),s.jsx("div",{className:"pr-6",onClick:l=>l.stopPropagation(),children:s.jsx("button",{onClick:()=>n(`/${t}/projects/${a}/issues/${e.id}`),className:"p-1 rounded hover:bg-border text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:s.jsx(hx,{className:"h-3.5 w-3.5"})})})]})}function wL(){const e=ct(),{workspace:t}=Et(),r=t??"",{workspace:n}=De(),{data:a}=Cn(),[i,o]=h.useState(()=>localStorage.getItem("meridian_my_tasks_view")??"list"),[l,c]=h.useState(""),[d,u]=h.useState([]),[f,m]=h.useState("all"),[p,x]=h.useState("all"),[g,v]=h.useState("all");h.useEffect(()=>{n!=null&&n.id&&d.length===0&&u([n.id])},[n==null?void 0:n.id]);const y=h.useMemo(()=>(a??[]).map(C=>({value:C.id,label:C.name})),[a]),b=h.useMemo(()=>{const C={};return d.length>0&&(C.workspace_id=d),f!=="all"&&(C.priority=[f]),p!=="all"&&(C.type=[p]),g!=="all"&&(C.category=[g]),C},[d,f,p,g]),{data:N,isLoading:j}=pL(b),k=C=>{o(C),localStorage.setItem("meridian_my_tasks_view",C)},w=h.useMemo(()=>{if(!N)return[];if(!l)return N;const C=l.toLowerCase();return N.filter(P=>{var O,E;return P.title.toLowerCase().includes(C)||P.identifier.toLowerCase().includes(C)||(((O=P._project)==null?void 0:O.identifier)??"").toLowerCase().includes(C)||(((E=P._project)==null?void 0:E.name)??"").toLowerCase().includes(C)})},[N,l]),S=C=>{var O;const P=(O=C._project)==null?void 0:O.identifier;P&&e(`/${r}/projects/${P}/issues/${C.id}`)},_=s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"My Tasks"}),s.jsxs("div",{className:"flex items-center gap-1 bg-muted rounded-lg p-0.5",children:[s.jsxs("button",{onClick:()=>k("list"),className:z("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium transition-colors",i==="list"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[s.jsx(xx,{className:"h-3.5 w-3.5"}),"List"]}),s.jsxs("button",{onClick:()=>k("board"),className:z("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-xs font-medium transition-colors",i==="board"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[s.jsx(oN,{className:"h-3.5 w-3.5"}),"Board"]})]})]}),s.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 shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2 md:overflow-x-auto md:scrollbar-none",children:[s.jsx(Is,{options:y,selected:d,onSelectionChange:u,placeholder:"All workspaces",className:"md:w-[160px]"}),s.jsxs(Ue,{value:f,onValueChange:m,children:[s.jsx(Le,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:s.jsx(Ve,{placeholder:"Priority"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(dn).map(([C,P])=>s.jsx(ke,{value:C,className:"text-xs",children:P},C))]})]}),s.jsxs(Ue,{value:p,onValueChange:x,children:[s.jsx(Le,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:s.jsx(Ve,{placeholder:"Type"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All types"}),Object.entries(Bs).map(([C,P])=>s.jsx(ke,{value:C,className:"text-xs",children:P},C))]})]}),s.jsxs(Ue,{value:g,onValueChange:v,children:[s.jsx(Le,{className:"h-8 text-xs flex-1 md:flex-none md:w-[130px] md:shrink-0 bg-transparent",children:s.jsx(Ve,{placeholder:"Category"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All categories"}),Object.entries(bL).map(([C,P])=>s.jsx(ke,{value:C,className:"text-xs",children:P},C))]})]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(za,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),s.jsx(_e,{placeholder:"Search tasks...",value:l,onChange:C=>c(C.target.value),className:"pl-8 h-8 w-full md:w-[200px] text-xs bg-transparent"})]})]})]});return i==="board"?s.jsx("div",{className:"flex flex-col h-full gap-0",children:s.jsxs("div",{className:"flex flex-col flex-1 min-h-0 bg-white dark:bg-card",children:[_,s.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto",children:j?s.jsx("div",{className:"flex gap-4 px-6 py-6",children:[1,2,3,4,5].map(C=>s.jsxs("div",{className:"min-w-[260px]",children:[s.jsx(le,{className:"h-5 w-24 mb-3 rounded"}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(le,{className:"h-[82px] w-full rounded-lg"}),s.jsx(le,{className:"h-[82px] w-full rounded-lg"})]})]},C))}):s.jsx(yL,{issues:w,onIssueClick:S})})]})}):s.jsx("div",{className:"p-2 pb-24 md:pb-2",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[_,s.jsx("div",{className:"hidden md:block overflow-x-auto",children:s.jsxs("div",{className:"min-w-[800px]",children:[s.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Vh),children:[s.jsx("span",{className:"text-xs font-medium text-[#6b7280] pl-6",children:"ID"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Title"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Project"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),s.jsx("span",{className:"pr-6"})]}),j?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(C=>s.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Vh),children:[s.jsx(le,{className:"h-4 w-14"}),s.jsx(le,{className:"h-4 w-56"}),s.jsx(le,{className:"h-5 w-16"}),s.jsx(le,{className:"h-5 w-20"}),s.jsx(le,{className:"h-4 w-16"}),s.jsx(le,{className:"h-4 w-24"}),s.jsx("span",{})]},C))}):w.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("p",{className:"text-sm font-medium mb-1",children:(N??[]).length===0?"No tasks assigned to you":"No tasks match your filters"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:(N??[]).length===0?"Issues assigned to you across all projects will appear here.":"Try adjusting your search or filters."})]}):s.jsx("div",{className:"divide-y divide-border/60",children:w.map(C=>s.jsx(jL,{issue:C,workspace:r,onNavigate:S},C.id))})]})}),s.jsx("div",{className:"md:hidden divide-y divide-border/60",children:j?[1,2,3,4].map(C=>s.jsx("div",{className:"flex items-start gap-3 px-4 py-3",children:s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx("div",{className:"h-4 w-48 bg-muted rounded animate-pulse"}),s.jsx("div",{className:"h-3 w-32 bg-muted rounded animate-pulse"})]})},C)):w.length===0?s.jsx("div",{className:"flex flex-col items-center justify-center py-12 text-center px-4",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"No tasks found"})}):w.map(C=>s.jsx("div",{onClick:()=>S(C),className:"flex items-start gap-3 px-4 py-3 hover:bg-[#f9fafb] dark:hover:bg-muted/30 cursor-pointer transition-colors",children:s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[s.jsx("span",{className:"text-[10px] font-mono text-muted-foreground shrink-0",children:C.identifier}),s.jsx("span",{className:"text-sm text-foreground truncate font-medium",children:C.title})]}),s.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.jsx(HS,{priority:C.priority}),s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full shrink-0",style:{backgroundColor:C._status.color}}),C._status.name]}),C._project&&s.jsx("span",{className:"text-[10px] font-medium text-zinc-500 bg-zinc-100 dark:bg-zinc-800 px-1 py-0.5 rounded",children:C._project.identifier}),C.due_date&&s.jsx("span",{className:"text-[11px] text-muted-foreground",children:fe(new Date(C.due_date),"MMM d")})]})]})},C.id))}),!j&&w.length>0&&s.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:s.jsxs("span",{className:"text-xs text-muted-foreground",children:[w.length," task",w.length!==1?"s":""]})})]})})}const NL={issue:{icon:ds,label:"Issue"},project:{icon:Gr,label:"Project"},comment:{icon:cN,label:"Comment"},sprint:{icon:gs,label:"Sprint"},workspace_access_request:{icon:Nn,label:"Access Request"},project_access_request:{icon:Nn,label:"Access Request"},project_access_resolved:{icon:Nn,label:"Access Request"}};function o0(e){const t=new Date(e);return xR(t)?cR(t,{addSuffix:!0}):gR(t)?`Yesterday ${fe(t,"h:mm a")}`:fe(t,"MMM d, yyyy")}function l0(e){return typeof e=="string"&&e.length>0?e:null}function kL(){const{workspace:e}=Et(),t=ct(),{data:r,isLoading:n}=LT(),a=FT(),i=BT(),o=(r==null?void 0:r.filter(c=>!c.read).length)??0;function l(c){const d=c.metadata??{},u=l0(d.workspace_slug)??e??null,f=l0(d.project_identifier);return c.entity_type==="issue"&&u&&f?`/${u}/projects/${f}/issues/${c.entity_id}`:c.entity_type==="project"&&u&&f?`/${u}/projects/${f}/board`:c.entity_type==="workspace_access_request"&&u?`/${u}/settings?tab=access-requests`:(c.entity_type==="project_access_request"||c.entity_type==="project_access_resolved")&&u&&f?`/${u}/projects/${f}/access`:null}return s.jsx("div",{className:"p-2 pb-24 md:pb-2",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border",children:[s.jsx("h1",{className:"text-base font-semibold",children:"Notifications"}),o>0&&s.jsxs(ee,{variant:"outline",size:"sm",className:"h-8 text-xs gap-1.5",onClick:()=>i.mutate(void 0,{onSuccess:()=>F.success("All marked as read"),onError:()=>F.error("Failed")}),disabled:i.isPending,children:[s.jsx(fy,{className:"h-3.5 w-3.5"}),"Mark all read"]})]}),s.jsxs("div",{className:"hidden md:grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-2.5 border-b border-border",children:[s.jsx("span",{}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Type"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Message"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Time"}),s.jsx("span",{})]}),n?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(c=>s.jsxs("div",{children:[s.jsxs("div",{className:"hidden md:grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-3",children:[s.jsx("div",{}),s.jsx(le,{className:"h-5 w-20 rounded-full"}),s.jsx(le,{className:"h-4 w-3/4"}),s.jsx(le,{className:"h-4 w-20"}),s.jsx("div",{})]}),s.jsxs("div",{className:"md:hidden flex items-start gap-3 px-4 py-3",children:[s.jsx(le,{className:"h-4 w-4 rounded-full mt-1 shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-2",children:[s.jsx(le,{className:"h-4 w-24 rounded-full"}),s.jsx(le,{className:"h-4 w-full"})]})]})]},c))}):r!=null&&r.length?s.jsx("div",{className:"divide-y divide-border",children:r.map(c=>{const d=NL[c.entity_type]??{icon:mi,label:c.entity_type},u=d.icon,f=l(c),m=()=>{f&&(c.read||a.mutate(c.id),t(f))};return s.jsxs("div",{children:[s.jsxs("div",{className:z("hidden md:grid grid-cols-[20px_130px_1fr_130px_88px] items-center px-6 py-3 transition-colors",!c.read&&"bg-[#eff6ff] dark:bg-indigo-950/20","hover:bg-[#f9fafb] dark:hover:bg-muted/30",f&&"cursor-pointer"),onClick:m,children:[s.jsx("div",{className:"flex items-center justify-center",children:!c.read&&s.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-indigo-500 shrink-0"})}),s.jsx("div",{children:s.jsxs("span",{className:"inline-flex items-center gap-1.5 text-[11px] text-muted-foreground bg-muted px-2 py-0.5 rounded-full",children:[s.jsx(u,{className:"h-3 w-3"}),d.label]})}),s.jsx("p",{className:z("text-sm truncate",c.read?"text-muted-foreground":"font-medium text-foreground"),children:c.message}),s.jsx("span",{className:"text-xs text-muted-foreground",children:o0(c.created_at)}),s.jsx("div",{className:"flex justify-end",onClick:p=>p.stopPropagation(),children:!c.read&&s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs text-muted-foreground px-2",onClick:()=>a.mutate(c.id,{onError:()=>F.error("Failed")}),children:"Mark read"})})]}),s.jsxs("div",{className:z("md:hidden flex items-start gap-3 px-4 py-3 transition-colors",!c.read&&"bg-[#eff6ff] dark:bg-indigo-950/20","hover:bg-[#f9fafb] dark:hover:bg-muted/30",f&&"cursor-pointer"),onClick:m,children:[s.jsx("div",{className:"mt-1 shrink-0",children:c.read?s.jsx("div",{className:"h-1.5 w-1.5"}):s.jsx("div",{className:"h-1.5 w-1.5 rounded-full bg-indigo-500"})}),s.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("span",{className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground bg-muted px-2 py-0.5 rounded-full shrink-0",children:[s.jsx(u,{className:"h-3 w-3"}),d.label]}),s.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:o0(c.created_at)})]}),s.jsx("p",{className:z("text-sm",c.read?"text-muted-foreground":"font-medium text-foreground"),children:c.message})]}),!c.read&&s.jsx("div",{onClick:p=>p.stopPropagation(),className:"shrink-0",children:s.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground",onClick:()=>a.mutate(c.id,{onError:()=>F.error("Failed")}),children:s.jsx(fy,{className:"h-3.5 w-3.5"})})})]})]},c.id)})}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(mi,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No notifications"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"You're all caught up."})]}),!n&&!!(r!=null&&r.length)&&s.jsx("div",{className:"px-6 py-3 border-t border-border",children:s.jsxs("span",{className:"text-xs text-muted-foreground",children:[r.length," notification",r.length!==1?"s":"",o>0?` · ${o} unread`:""]})})]})})}function SL({open:e,onClose:t,projectId:r}){const[n,a]=h.useState(""),[i,o]=h.useState(""),[l,c]=h.useState(),[d,u]=h.useState(),[f,m]=h.useState(!1),[p,x]=h.useState(!1),g=ZR(r);function v(){a(""),o(""),c(void 0),u(void 0),t()}async function y(b){b.preventDefault(),n.trim()&&g.mutate({name:n.trim(),goal:i.trim()||void 0,start_date:l?fe(l,"yyyy-MM-dd"):null,end_date:d?fe(d,"yyyy-MM-dd"):null},{onSuccess:()=>{F.success("Sprint created"),v()},onError:()=>F.error("Failed to create sprint")})}return s.jsx(Oi,{open:e,onOpenChange:b=>!b&&v(),children:s.jsxs(Ei,{className:"sm:max-w-md",children:[s.jsx(Do,{children:s.jsx(Io,{children:"New Sprint"})}),s.jsxs("form",{onSubmit:y,className:"flex flex-col flex-1 overflow-hidden",children:[s.jsxs(To,{className:"space-y-4 py-1",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{htmlFor:"sprint-name",children:["Name ",s.jsx("span",{className:"text-destructive",children:"*"})]}),s.jsx(_e,{id:"sprint-name",placeholder:"e.g. Sprint 1",value:n,onChange:b=>a(b.target.value),autoFocus:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs(at,{htmlFor:"sprint-goal",children:["Goal ",s.jsx("span",{className:"text-muted-foreground text-xs",children:"(optional)"})]}),s.jsx(pc,{id:"sprint-goal",placeholder:"What do you want to achieve in this sprint?",value:i,onChange:b=>o(b.target.value),className:"resize-none text-sm",rows:2})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{children:"Start Date"}),s.jsxs(Tt,{open:f,onOpenChange:m,children:[s.jsx(It,{asChild:!0,children:s.jsxs(ee,{variant:"outline",className:z("w-full justify-start text-left font-normal text-sm h-9",!l&&"text-muted-foreground"),children:[s.jsx(Ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),l?fe(l,"MMM d, yyyy"):"Pick date"]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:l,onSelect:b=>{c(b),m(!1)},disabled:b=>d?b>d:!1,initialFocus:!0})})]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx(at,{children:"End Date"}),s.jsxs(Tt,{open:p,onOpenChange:x,children:[s.jsx(It,{asChild:!0,children:s.jsxs(ee,{variant:"outline",className:z("w-full justify-start text-left font-normal text-sm h-9",!d&&"text-muted-foreground"),children:[s.jsx(Ht,{className:"mr-2 h-3.5 w-3.5 shrink-0"}),d?fe(d,"MMM d, yyyy"):"Pick date"]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:d,onSelect:b=>{u(b),x(!1)},disabled:b=>l?b<l:!1,initialFocus:!0})})]})]})]})]}),s.jsxs(hc,{children:[s.jsx(ee,{type:"button",variant:"ghost",onClick:v,children:"Cancel"}),s.jsx(ee,{type:"submit",disabled:!n.trim()||g.isPending,children:g.isPending?"Creating…":"Create Sprint"})]})]})]})})}const CL={active:{label:"Active",icon:Al,badge:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400",section:"Active Sprint"},planned:{label:"Planned",icon:Ar,badge:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-400",section:"Planned"},completed:{label:"Completed",icon:kn,badge:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",section:"Completed"}};function _L({sprint:e,projectId:t,issueCount:r,workingDays:n,holidays:a=[]}){const i=JR(e.id,t),o=e$(t),l=CL[e.status],c=l.icon;function d(){i.mutate({status:"active"},{onSuccess:()=>F.success(`"${e.name}" started`),onError:()=>F.error("Failed to start sprint")})}function u(){i.mutate({status:"completed"},{onSuccess:()=>F.success(`"${e.name}" completed`),onError:g=>F.error((g==null?void 0:g.message)??"Failed to complete sprint")})}function f(){confirm(`Delete sprint "${e.name}"? This cannot be undone.`)&&o.mutate(e.id,{onSuccess:()=>F.success("Sprint deleted"),onError:()=>F.error("Failed to delete sprint")})}const m=!!e.start_date,p=!!e.end_date,x=s.jsx(s.Fragment,{children:m||p?s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(hi,{className:"h-3.5 w-3.5 shrink-0"}),m?fe(new Date(e.start_date),"MMM d"):"—"," → ",p?fe(new Date(e.end_date),"MMM d, yyyy"):"—",m&&p&&n&&(()=>{const g=qh(new Date(e.start_date),new Date(e.end_date),n,a);return s.jsxs("span",{className:"ml-1 text-[11px] text-muted-foreground/70",children:["(",g,"d)"]})})()]}):s.jsx("span",{className:"italic text-muted-foreground/60",children:"No dates"})});return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden md:flex items-center gap-4 px-6 py-4 hover:bg-muted/30 transition-colors group",children:[s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx("div",{className:z("flex h-7 w-7 items-center justify-center rounded-full shrink-0",e.status==="active"?"bg-emerald-100 dark:bg-emerald-900/30":e.status==="completed"?"bg-blue-100 dark:bg-blue-900/30":"bg-zinc-100 dark:bg-zinc-800"),children:s.jsx(c,{className:z("h-3.5 w-3.5",e.status==="active"?"text-emerald-600 dark:text-emerald-400":e.status==="completed"?"text-blue-600 dark:text-blue-400":"text-zinc-500")})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:e.name}),e.goal&&s.jsxs("p",{className:"text-xs text-muted-foreground truncate mt-0.5 flex items-center gap-1",children:[s.jsx(my,{className:"h-3 w-3 shrink-0"}),e.goal]})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0 w-64",children:[s.jsx(hi,{className:"h-3.5 w-3.5 shrink-0"}),m||p?s.jsxs("span",{children:[m?fe(new Date(e.start_date),"MMM d"):"—"," → ",p?fe(new Date(e.end_date),"MMM d, yyyy"):"—",m&&p&&n&&(()=>{const g=qh(new Date(e.start_date),new Date(e.end_date),n,a);return s.jsxs("span",{className:"ml-1.5 text-[11px] text-muted-foreground/70",children:["(",g," biz day",g!==1?"s":"",")"]})})()]}):s.jsx("span",{className:"italic",children:"No dates set"})]}),s.jsxs("div",{className:"text-xs text-muted-foreground shrink-0 w-20 text-right",children:[r," issue",r!==1?"s":""]}),s.jsx(Pn,{className:z("shrink-0 text-[11px] border-0 w-20 justify-center",l.badge),children:l.label}),s.jsxs("div",{className:"flex items-center gap-1.5 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[e.status==="planned"&&s.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:d,disabled:i.isPending,children:[s.jsx(Al,{className:"h-3 w-3"}),"Start"]}),e.status==="active"&&s.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:u,disabled:i.isPending,children:[s.jsx(kn,{className:"h-3 w-3"}),"Complete"]}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:f,disabled:o.isPending,children:s.jsx(jr,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{className:"md:hidden px-4 py-3 hover:bg-muted/30 transition-colors",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[s.jsx("div",{className:z("flex h-7 w-7 items-center justify-center rounded-full shrink-0",e.status==="active"?"bg-emerald-100 dark:bg-emerald-900/30":e.status==="completed"?"bg-blue-100 dark:bg-blue-900/30":"bg-zinc-100 dark:bg-zinc-800"),children:s.jsx(c,{className:z("h-3.5 w-3.5",e.status==="active"?"text-emerald-600 dark:text-emerald-400":e.status==="completed"?"text-blue-600 dark:text-blue-400":"text-zinc-500")})}),s.jsx("p",{className:"text-sm font-medium truncate flex-1 min-w-0",children:e.name}),s.jsx(Pn,{className:z("shrink-0 text-[11px] border-0",l.badge),children:l.label})]}),e.goal&&s.jsxs("p",{className:"text-xs text-muted-foreground line-clamp-2 mb-2 ml-10 flex items-center gap-1",children:[s.jsx(my,{className:"h-3 w-3 shrink-0"}),e.goal]}),s.jsxs("div",{className:"flex items-center gap-2 ml-10",children:[s.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground flex-1 min-w-0 flex-wrap",children:[x,s.jsx("span",{children:"·"}),s.jsxs("span",{className:"shrink-0",children:[r," issue",r!==1?"s":""]})]}),s.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[e.status==="planned"&&s.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:d,disabled:i.isPending,children:[s.jsx(Al,{className:"h-3 w-3"}),"Start"]}),e.status==="active"&&s.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1",onClick:u,disabled:i.isPending,children:[s.jsx(kn,{className:"h-3 w-3"}),"Complete"]}),s.jsx(ee,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive",onClick:f,disabled:o.isPending,children:s.jsx(jr,{className:"h-3.5 w-3.5"})})]})]})]})]})}function PL(){const{projectKey:e}=Et(),[t,r]=h.useState(!1),{data:n}=ea(e??""),a=(n==null?void 0:n.id)??"",{data:i,isLoading:o}=zo(a||void 0),{data:l}=Yu(a||void 0),{data:c}=qx(),{data:d=[]}=Wx(new Date().getFullYear()),u=(l??[]).reduce((p,x)=>(x.sprint_id&&(p[x.sprint_id]=(p[x.sprint_id]??0)+1),p),{}),f={active:(i??[]).filter(p=>p.status==="active"),planned:(i??[]).filter(p=>p.status==="planned"),completed:(i??[]).filter(p=>p.status==="completed")},m=[{key:"active",label:"Active Sprint",items:f.active},{key:"planned",label:"Planned",items:f.planned},{key:"completed",label:"Completed",items:f.completed}];return s.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[s.jsx(Or,{zone:"project.sprints.before",props:{projectId:a}}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsx("div",{className:"flex items-center justify-end px-6 py-3 border-b border-border",children:s.jsxs(ee,{size:"sm",onClick:()=>r(!0),children:[s.jsx(ot,{className:"h-4 w-4"}),"New Sprint"]})}),o?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(p=>s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[s.jsx(le,{className:"h-7 w-7 rounded-full"}),s.jsx(le,{className:"h-4 w-40"}),s.jsx("div",{className:"flex-1"}),s.jsx(le,{className:"h-4 w-32"}),s.jsx(le,{className:"h-5 w-20"})]},p))}):(i??[]).length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(hi,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No sprints yet"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Create a sprint to start planning your work in time-boxed iterations."}),s.jsxs(ee,{size:"sm",onClick:()=>r(!0),children:[s.jsx(ot,{className:"h-4 w-4"}),"New Sprint"]})]}):s.jsx("div",{children:m.map(({key:p,label:x,items:g})=>g.length===0?null:s.jsxs("div",{children:[s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:x})}),s.jsx("div",{className:"divide-y divide-border",children:g.map(v=>s.jsx(_L,{sprint:v,projectId:a,issueCount:u[v.id]??0,workingDays:c==null?void 0:c.working_days,holidays:d},v.id))})]},p))})]}),s.jsx(Or,{zone:"project.sprints.after",props:{projectId:a}}),s.jsx(SL,{open:t,onClose:()=>r(!1),projectId:a})]})}const fo={all:["roles"],list:()=>[...fo.all,"list"],detail:e=>[...fo.all,e]};function wf(){return Te({queryKey:fo.list(),queryFn:()=>ie.get("/admin/roles"),select:e=>e.roles,staleTime:1e3*60*2})}function ML(){const e=ye();return ge({mutationFn:t=>ie.post("/admin/roles",t),onSuccess:()=>{e.invalidateQueries({queryKey:fo.list()})}})}function OL(e){const t=ye();return ge({mutationFn:r=>ie.put(`/admin/roles/${e}`,r),onSuccess:()=>{t.invalidateQueries({queryKey:fo.list()})}})}function EL(){const e=ye();return ge({mutationFn:t=>ie.delete(`/admin/roles/${t}`),onSuccess:()=>{e.invalidateQueries({queryKey:fo.list()})}})}function KS(){const e=ye();return ge({mutationFn:({userId:t,appRoleId:r})=>ie.patch(`/admin/users/${t}/role`,{app_role_id:r}),onSuccess:()=>{e.invalidateQueries({queryKey:["workspaces"]}),e.invalidateQueries({queryKey:["users"]})}})}const Wd=[{group:"Workspace Admin",permissions:[{key:"workspace:admin",label:"Workspace admin (full access to workspace settings, reports, and member management)"}]},{group:"Members & Invitations",permissions:[{key:"member:invite",label:"Invite members"},{key:"member:remove",label:"Remove members"},{key:"member:update_role",label:"Change member roles"}]},{group:"Workspaces",permissions:[{key:"workspace:create",label:"Create workspaces"},{key:"workspace:update",label:"Update workspace settings"},{key:"workspace:delete",label:"Delete workspaces"}]},{group:"Projects",permissions:[{key:"project:create",label:"Create projects"},{key:"project:update",label:"Update project settings"},{key:"project:delete",label:"Delete projects"},{key:"project:archive",label:"Archive projects"},{key:"project:manage_access",label:"Manage project access"}]},{group:"Issues",permissions:[{key:"issue:create",label:"Create issues"},{key:"issue:update",label:"Update issues"},{key:"issue:delete",label:"Delete issues"},{key:"issue:assign",label:"Assign issues"},{key:"issue:update_status",label:"Update issue status"}]},{group:"Sprints",permissions:[{key:"sprint:create",label:"Create sprints"},{key:"sprint:start",label:"Start sprints"},{key:"sprint:complete",label:"Complete sprints"},{key:"sprint:delete",label:"Delete sprints"}]},{group:"Teams",permissions:[{key:"team:create",label:"Create teams"},{key:"team:update",label:"Update teams"},{key:"team:delete",label:"Delete teams"},{key:"team:manage_members",label:"Manage team members"}]},{group:"Roles",permissions:[{key:"role:create",label:"Create roles"},{key:"role:update",label:"Update roles"},{key:"role:delete",label:"Delete roles"},{key:"role:assign",label:"Assign roles to users"}]}];function Ud({value:e,className:t}){const[r,n]=h.useState(!1),a=()=>{navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),1500)};return s.jsx("button",{onClick:a,className:z("text-muted-foreground hover:text-foreground transition-colors",t),title:"Copy",children:r?s.jsx(Ct,{className:"h-3.5 w-3.5 text-emerald-500"}):s.jsx(fx,{className:"h-3.5 w-3.5"})})}function c0({value:e,onChange:t,appRoles:r}){return!r||r.length===0?null:s.jsxs(Ue,{value:e||"none",onValueChange:n=>t(n==="none"?"":n),children:[s.jsx(Le,{className:"h-9",children:s.jsx(Ve,{placeholder:"No custom role"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",children:s.jsx("span",{className:"text-muted-foreground",children:"No custom role"})}),r.map(n=>s.jsx(ke,{value:n.id,children:s.jsxs("div",{className:"flex flex-col",children:[s.jsx("span",{children:n.name}),n.description&&s.jsx("span",{className:"text-xs text-muted-foreground",children:n.description})]})},n.id))]})]})}function AL({open:e,onClose:t,workspaceId:r}){const[n,a]=h.useState("existing"),[i,o]=h.useState(""),[l,c]=h.useState([]),[d,u]=h.useState(""),[f,m]=h.useState(""),[p,x]=h.useState(""),[g,v]=h.useState(null),y=Ox(i,300),{data:b,isFetching:N}=Ak({q:y}),j=(b==null?void 0:b.users)??[],{data:k=[]}=Po(r),w=zD(r),S=ID(r),{data:_}=wf(),C=h.useMemo(()=>new Set(k.map(D=>D.user_id)),[k]),P=h.useMemo(()=>j.filter(D=>!C.has(D.id)),[j,C]);h.useEffect(()=>{e&&(o(""),c([]),u(""),m(""),x(""),v(null),a("existing"))},[e]);const O=()=>{l.length!==0&&w.mutate({user_ids:l,role:"member",app_role_id:d||null},{onSuccess:D=>{F.success(`${D.added} member${D.added===1?"":"s"} added`),t()},onError:D=>F.error(D.message||"Failed to add members")})},E=D=>{D.preventDefault(),S.mutate({email:f.trim()||void 0,role:"member",app_role_id:p||null},{onSuccess:I=>{v(I.invitation),F.success("Invitation created")},onError:I=>F.error(I.message||"Failed to create invitation")})};return s.jsx(mn,{open:e,onOpenChange:D=>!D&&t(),children:s.jsxs(Zr,{className:"sm:max-w-[520px] bg-white dark:bg-card",children:[s.jsx(hn,{children:s.jsx(pn,{children:"Add member"})}),!g&&s.jsxs("div",{className:"flex rounded-lg border border-border p-0.5 bg-muted/40 gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>a("existing"),className:z("flex-1 text-sm py-1.5 rounded-md font-medium transition-colors",n==="existing"?"bg-white dark:bg-card shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:"Existing user"}),s.jsx("button",{type:"button",onClick:()=>a("invite"),className:z("flex-1 text-sm py-1.5 rounded-md font-medium transition-colors",n==="invite"?"bg-white dark:bg-card shadow-sm text-foreground":"text-muted-foreground hover:text-foreground"),children:"Send invite"})]}),n==="existing"&&!g&&s.jsxs("div",{className:"space-y-3 pt-1",children:[s.jsx(_e,{placeholder:"Search by name or email…",value:i,onChange:D=>o(D.target.value),className:"h-9",autoFocus:!0}),s.jsx("div",{className:"rounded-lg border border-border overflow-hidden",children:N&&i!==y?s.jsx("div",{className:"py-6 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Searching…"})}):P.length===0&&i.trim()?s.jsx("div",{className:"py-6 text-center",children:s.jsxs("p",{className:"text-sm text-muted-foreground",children:['No users match "',i,'"']})}):P.length===0?s.jsxs("div",{className:"py-8 text-center px-4",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"All users are already members."}),s.jsx("button",{className:"mt-2 text-xs text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",onClick:()=>a("invite"),children:"Send an invite instead"})]}):s.jsx("div",{className:"max-h-52 overflow-y-auto divide-y divide-border",children:P.map(D=>{const I=D.first_name??"",V=D.last_name??"",Q=`${I} ${V}`.trim()||D.email,q=(I[0]??V[0]??D.email[0]??"U").toUpperCase(),re=l.includes(D.id);return s.jsxs("button",{type:"button",onClick:()=>c(se=>re?se.filter(T=>T!==D.id):[...se,D.id]),className:z("w-full flex items-center gap-3 px-3 py-2.5 text-left transition-colors",re?"bg-indigo/5 dark:bg-indigo/10":"hover:bg-muted/40"),children:[s.jsx(Pt,{className:"h-7 w-7 shrink-0",children:s.jsx(Mt,{className:"text-[11px] font-medium",children:q})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:Q}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:D.email})]}),re&&s.jsx(Ct,{className:"h-4 w-4 text-indigo shrink-0"})]},D.id)})})}),P.length>0&&s.jsxs(s.Fragment,{children:[_&&_.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Role ",s.jsx("span",{className:"font-normal",children:"(optional)"})]}),s.jsx(c0,{value:d,onChange:u,appRoles:_})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),s.jsx(ee,{type:"button",size:"sm",disabled:l.length===0||w.isPending,onClick:O,children:w.isPending?"Adding…":l.length<=1?"Add to workspace":`Add ${l.length} members`})]})]})]}),n==="invite"&&!g&&s.jsxs("form",{onSubmit:E,className:"space-y-4 pt-1",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Email ",s.jsx("span",{className:"font-normal",children:"(optional)"})]}),s.jsx(_e,{type:"email",placeholder:"colleague@example.com",value:f,onChange:D=>m(D.target.value),className:"h-9",autoFocus:!0}),s.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Leave blank to generate a shareable link."})]}),_&&_.length>0&&s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Role ",s.jsx("span",{className:"font-normal",children:"(optional)"})]}),s.jsx(c0,{value:p,onChange:x,appRoles:_})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),s.jsx(ee,{type:"submit",size:"sm",disabled:S.isPending,children:S.isPending?"Creating…":"Create invitation"})]})]}),g&&s.jsxs("div",{className:"space-y-4 pt-1",children:[s.jsxs("p",{className:"text-sm text-muted-foreground",children:["Share this link with"," ",g.email?s.jsx("span",{className:"font-medium text-foreground",children:g.email}):"anyone you want to invite","."]}),s.jsxs("div",{className:"flex items-start gap-2 p-3 bg-muted/50 rounded-lg border border-border",children:[s.jsx(Ea,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0 mt-0.5"}),s.jsx("span",{className:"text-xs font-mono text-foreground flex-1 min-w-0 break-all",children:`${window.location.origin}/invite/${g.token}`}),s.jsx(Ud,{value:`${window.location.origin}/invite/${g.token}`,className:"shrink-0"})]}),s.jsxs("div",{className:"flex items-center justify-between pt-1",children:[s.jsx("button",{className:"text-xs text-muted-foreground hover:text-foreground transition-colors",onClick:()=>v(null),children:"Create another"}),s.jsx(ee,{size:"sm",onClick:t,children:"Done"})]})]})]})})}function DL({invitation:e,workspaceId:t}){const r=RD(t),n=$D(t),[a,i]=h.useState(!1),o=`${window.location.origin}/invite/${e.token}`;return s.jsxs("div",{className:"px-6 py-3.5 hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors group",children:[s.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(Ea,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:e.email??"Shareable link"}),s.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",e.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":e.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:e.role==="super-admin"?"Super Admin":e.role==="admin"?"Admin":"Member"})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[280px]",children:o}),s.jsx(Ud,{value:o})]})]}),s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[s.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date(e.created_at),"MMM d")}),e.email&&s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:()=>i(!0),disabled:n.isPending,className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground disabled:opacity-50",children:s.jsx(Td,{className:z("h-3.5 w-3.5",n.isPending&&"animate-spin")})})}),s.jsx(Wn,{children:"Resend invite"})]}),s.jsx("button",{onClick:()=>r.mutate(e.id,{onSuccess:()=>F.success("Invitation revoked"),onError:()=>F.error("Failed to revoke")}),disabled:r.isPending,className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive disabled:opacity-50",title:"Revoke invitation",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{className:"md:hidden space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(Ea,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:e.email??"Shareable link"}),s.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",e.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":e.role==="admin"?"bg-indigo/10 text-indigo":"bg-muted text-muted-foreground"),children:e.role==="super-admin"?"Super Admin":e.role==="admin"?"Admin":"Member"})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.email&&s.jsx("button",{onClick:()=>i(!0),disabled:n.isPending,className:"text-muted-foreground hover:text-foreground disabled:opacity-50",children:s.jsx(Td,{className:z("h-3.5 w-3.5",n.isPending&&"animate-spin")})}),s.jsx("button",{onClick:()=>r.mutate(e.id,{onSuccess:()=>F.success("Invitation revoked"),onError:()=>F.error("Failed to revoke")}),disabled:r.isPending,className:"text-muted-foreground hover:text-destructive disabled:opacity-50",title:"Revoke invitation",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pl-10",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate flex-1 min-w-0",children:o}),s.jsx(Ud,{value:o}),s.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:fe(new Date(e.created_at),"MMM d")})]})]}),s.jsx(uo,{open:a,onClose:()=>i(!1),onConfirm:()=>n.mutate(e.id,{onSuccess:()=>{F.success("Invitation resent"),i(!1)},onError:()=>F.error("Failed to resend invitation")}),title:"Resend invitation?",description:`A new invitation email will be sent to ${e.email}.`,confirmLabel:"Resend",loading:n.isPending})]})}function TL({workspaceId:e}){var v;const{workspace:t,setWorkspace:r}=De(),{data:n,isLoading:a}=Cn(),i=n==null?void 0:n.find(y=>y.id===(t==null?void 0:t.id)),o=ED(e),l=AD(e),c=DD(e),d=h.useRef(null),[u,f]=h.useState("");h.useEffect(()=>{i&&f(i.name)},[i==null?void 0:i.name]);const m=i?u.trim()!==i.name:!1,p=()=>{!u.trim()||!i||o.mutate({name:u.trim()},{onSuccess:y=>{r({id:y.workspace.id,name:y.workspace.name,slug:y.workspace.slug,logo_url:y.workspace.logo_url}),F.success("Workspace updated")},onError:()=>F.error("Failed to update workspace")})},x=y=>{var N;const b=(N=y.target.files)==null?void 0:N[0];b&&(l.mutate(b,{onSuccess:j=>{r({id:j.workspace.id,name:j.workspace.name,slug:j.workspace.slug,logo_url:j.workspace.logo_url}),F.success("Logo updated")},onError:()=>F.error("Failed to upload logo")}),d.current&&(d.current.value=""))},g=()=>{c.mutate(void 0,{onSuccess:y=>{r({id:y.workspace.id,name:y.workspace.name,slug:y.workspace.slug,logo_url:null}),F.success("Logo removed")},onError:()=>F.error("Failed to remove logo")})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Workspace details"})}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Logo"}),a?s.jsx("div",{className:"flex items-center gap-3",children:s.jsx("div",{className:"size-12 rounded-lg bg-muted animate-pulse"})}):s.jsxs("div",{className:"flex items-center gap-3",children:[i!=null&&i.logo_url?s.jsx("img",{src:i.logo_url,alt:"Workspace logo",className:"size-12 rounded-lg object-cover shrink-0 border border-border"}):s.jsx("div",{className:"flex size-12 items-center justify-center rounded-lg bg-foreground text-background shrink-0",children:s.jsx("span",{className:"text-lg font-bold",children:(((v=i==null?void 0:i.name)==null?void 0:v[0])??"M").toUpperCase()})}),s.jsx("input",{ref:d,type:"file",accept:"image/png,image/jpeg,image/gif,image/webp",className:"hidden",onChange:x}),s.jsx(ee,{size:"sm",variant:"outline",className:"h-8",onClick:()=>{var y;return(y=d.current)==null?void 0:y.click()},disabled:l.isPending,children:l.isPending?"Uploading…":"Upload logo"}),(i==null?void 0:i.logo_url)&&s.jsx(ee,{size:"sm",variant:"ghost",className:"h-8 text-muted-foreground",onClick:g,disabled:c.isPending,children:c.isPending?"Removing…":"Remove"})]})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Name"}),a?s.jsx(le,{className:"h-8 w-64"}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(_e,{value:u,onChange:y=>f(y.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Workspace name"}),m&&s.jsx(ee,{size:"sm",className:"h-8",onClick:p,disabled:!u.trim()||o.isPending,children:o.isPending?"Saving…":"Save"})]})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"URL slug"}),a?s.jsx(le,{className:"h-4 w-40"}):s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx("span",{className:"font-mono text-foreground",children:i==null?void 0:i.slug}),s.jsx(Ud,{value:(i==null?void 0:i.slug)??""})]})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Plan"}),a?s.jsx(le,{className:"h-4 w-16"}):s.jsx("span",{className:"text-sm capitalize",children:(i==null?void 0:i.plan)??"free"})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Visibility"}),a?s.jsx(le,{className:"h-4 w-28"}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:(i==null?void 0:i.is_private)??!1,onChange:y=>{o.mutate({is_private:y.target.checked},{onSuccess:()=>F.success(y.target.checked?"Workspace is now public":"Workspace is now private"),onError:()=>F.error("Failed to update visibility")})},className:"size-4 rounded border-border accent-indigo-600"}),s.jsx(Sn,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-sm",children:"Private"})]}),s.jsx("span",{className:"text-xs text-muted-foreground",children:i!=null&&i.is_private?"Only members can see this workspace":"Admins can see this workspace without being a member"})]})]}),s.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",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Created"}),a?s.jsx(le,{className:"h-4 w-28"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:i!=null&&i.created_at?fe(new Date(i.created_at),"MMMM d, yyyy"):"—"})]})]})}const Ya=20;function IL({workspaceId:e,onInvite:t}){var g;const{data:r,isLoading:n}=Po(e),{data:a,isLoading:i}=TD(e),o=LD(e),l=KS(),{data:c}=wf(),{user:d}=De(),[u,f]=h.useState(null),[m,p]=h.useState(0),x=(a==null?void 0:a.filter(v=>v.status==="pending"))??[];return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["Members",!n&&r&&s.jsx(Pn,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full",children:r.length})]})}),n?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(v=>s.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[s.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(le,{className:"h-3.5 w-32"}),s.jsx(le,{className:"h-3 w-48"})]})]},v))}):r!=null&&r.length?s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"divide-y divide-border",children:(r??[]).slice(m*Ya,(m+1)*Ya).map(v=>{var S;const y=v.user,b=(y==null?void 0:y.first_name)??"",N=(y==null?void 0:y.last_name)??"",j=`${b} ${N}`.trim()||(y==null?void 0:y.email)||"Unknown",k=(b[0]??N[0]??((S=y==null?void 0:y.email)==null?void 0:S[0])??"U").toUpperCase(),w=(y==null?void 0:y.id)===(d==null?void 0:d.id);return s.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5 hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors group",children:[s.jsx(Pt,{className:"h-7 w-7 shrink-0",children:s.jsx(Mt,{className:"text-[11px] font-medium",children:k})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:j}),w&&s.jsx("span",{className:"text-[11px] text-muted-foreground",children:"(you)"})]}),(y==null?void 0:y.email)&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.email})]}),c&&c.length>0&&s.jsxs(Ue,{value:v.app_role_id??"none",onValueChange:_=>l.mutate({userId:v.user_id,appRoleId:_==="none"?null:_},{onSuccess:()=>F.success("Custom role updated"),onError:()=>F.error("Failed to update custom role")}),children:[s.jsx(Le,{className:"h-7 text-[11px] w-32 shrink-0",children:s.jsx(Ve,{placeholder:"Custom role"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",children:s.jsx("span",{className:"text-muted-foreground",children:"No custom role"})}),c.map(_=>s.jsx(ke,{value:_.id,children:_.name},_.id))]})]}),!w&&s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:s.jsx(Ls,{className:"h-4 w-4"})})}),s.jsxs(Dr,{align:"end",className:"w-44",children:[s.jsx(Je,{onClick:()=>{fetch(`/admin/users/${v.user_id}/sessions`,{method:"DELETE",headers:{Authorization:`Bearer ${localStorage.getItem("meridian_token")}`}}).then(()=>F.success("Sessions revoked — user will be signed out")).catch(()=>F.error("Failed to revoke sessions"))},children:"Revoke sessions"}),s.jsx(_n,{}),s.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>f(v),children:[s.jsx(jr,{className:"h-3.5 w-3.5 mr-2"}),"Remove"]})]})]})]},v.id)})}),((r==null?void 0:r.length)??0)>Ya&&s.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[m*Ya+1,"–",Math.min((m+1)*Ya,r.length)," of ",r.length]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>p(v=>v-1),disabled:m===0,children:s.jsx(fs,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[m+1," / ",Math.ceil(r.length/Ya)]}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>p(v=>v+1),disabled:(m+1)*Ya>=r.length,children:s.jsx(pr,{className:"h-3.5 w-3.5"})})]})]})]}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(Ps,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No members yet"}),s.jsx("button",{onClick:t,className:"text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}),s.jsxs("div",{className:"px-6 py-2 border-t border-b border-border bg-muted/20 flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["Pending invitations",!i&&x.length>0&&s.jsx(Pn,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:x.length})]}),s.jsxs("button",{onClick:t,className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(ot,{className:"h-3 w-3"}),"Invite"]})]}),i?s.jsx("div",{className:"divide-y divide-border",children:[1,2].map(v=>s.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[s.jsx(le,{className:"h-7 w-7 rounded-full shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(le,{className:"h-3.5 w-48"}),s.jsx(le,{className:"h-3 w-64"})]})]},v))}):x.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"No pending invitations."}),s.jsx("button",{onClick:t,className:"mt-2 text-sm text-muted-foreground hover:text-foreground underline underline-offset-2 transition-colors",children:"Invite someone"})]}):s.jsx("div",{className:"divide-y divide-border",children:x.map(v=>s.jsx(DL,{invitation:v,workspaceId:e},v.id))}),s.jsx(uo,{open:!!u,onClose:()=>f(null),onConfirm:()=>{u&&o.mutate(u.user_id,{onSuccess:()=>{F.success("Member removed"),f(null)},onError:()=>{F.error("Failed to remove member"),f(null)}})},title:"Remove member",description:`Remove ${((g=u==null?void 0:u.user)==null?void 0:g.email)??"this member"} from the workspace? They will lose access to all projects.`,confirmLabel:"Remove",variant:"destructive",loading:o.isPending})]})}function RL({workspaceId:e,teamId:t,allMembers:r}){var y,b;const{data:n,isLoading:a}=qD(e,t),i=WD(e,t),o=UD(e,t),[l,c]=h.useState(""),[d,u]=h.useState(null),[f,m]=h.useState(null),p=new Set((n==null?void 0:n.map(N=>N.user_id))??[]),x=r.filter(N=>!p.has(N.user_id)),g=n==null?void 0:n.find(N=>N.user_id===d),v=r.find(N=>N.user_id===f);return s.jsxs("div",{className:"bg-muted/10 border-t border-border",children:[a?s.jsx("div",{className:"px-8 py-3",children:s.jsx(le,{className:"h-3 w-40"})}):(n==null?void 0:n.length)===0?s.jsx("p",{className:"px-8 py-3 text-xs text-muted-foreground",children:"No members in this team yet."}):s.jsx("div",{className:"divide-y divide-border/50",children:n==null?void 0:n.map(N=>{var C;const j=N.user,k=(j==null?void 0:j.first_name)??"",w=(j==null?void 0:j.last_name)??"",S=`${k} ${w}`.trim()||(j==null?void 0:j.email)||"Unknown",_=(k[0]??w[0]??((C=j==null?void 0:j.email)==null?void 0:C[0])??"U").toUpperCase();return s.jsxs("div",{className:"flex items-center gap-3 px-8 py-2.5 group hover:bg-muted/20 transition-colors",children:[s.jsx(Pt,{className:"h-6 w-6 shrink-0",children:s.jsx(Mt,{className:"text-[10px] font-medium",children:_})}),s.jsx("span",{className:"flex-1 text-sm truncate",children:S}),s.jsx("button",{onClick:()=>u(N.user_id),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Remove from team",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]},N.id)})}),x.length>0&&s.jsxs("div",{className:"px-8 py-2.5 flex items-center gap-2 border-t border-border/50",children:[s.jsx(Nn,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsxs(Ue,{value:l,onValueChange:c,children:[s.jsx(Le,{className:"h-7 text-xs flex-1 max-w-[200px]",children:s.jsx(Ve,{placeholder:"Add member…"})}),s.jsx(Fe,{children:x.map(N=>{const j=N.user,k=(j==null?void 0:j.first_name)??"",w=(j==null?void 0:j.last_name)??"",S=`${k} ${w}`.trim()||(j==null?void 0:j.email)||"Unknown";return s.jsx(ke,{value:N.user_id,children:S},N.user_id)})})]}),l&&s.jsx(ee,{size:"sm",className:"h-7 text-xs px-2",disabled:i.isPending,onClick:()=>m(l),children:"Add"})]}),s.jsx(uo,{open:!!d,onClose:()=>u(null),onConfirm:()=>{d&&o.mutate(d,{onSuccess:()=>{F.success("Removed from team"),u(null)},onError:()=>{F.error("Failed to remove"),u(null)}})},title:"Remove from team",description:`Remove ${((y=g==null?void 0:g.user)==null?void 0:y.email)??"this member"} from the team?`,confirmLabel:"Remove",variant:"destructive",loading:o.isPending}),s.jsx(uo,{open:!!f,onClose:()=>{m(null),c("")},onConfirm:()=>{f&&i.mutate(f,{onSuccess:()=>{F.success("Added to team"),m(null),c("")},onError:()=>{F.error("Failed to add"),m(null)}})},title:"Add to team",description:`Add ${((b=v==null?void 0:v.user)==null?void 0:b.email)??"this member"} to the team?`,confirmLabel:"Add",loading:i.isPending})]})}function $L({workspaceId:e}){const{data:t,isLoading:r}=Qu(e),{data:n}=Po(e),a=FD(e),i=BD(e),[o,l]=h.useState(new Set),[c,d]=h.useState(!1),[u,f]=h.useState(""),[m,p]=h.useState(null),x=t==null?void 0:t.find(y=>y.id===m),g=y=>{l(b=>{const N=new Set(b);return N.has(y)?N.delete(y):N.add(y),N})},v=y=>{y.preventDefault(),u.trim()&&a.mutate({name:u.trim()},{onSuccess:()=>{F.success("Team created"),f(""),d(!1)},onError:()=>F.error("Failed to create team")})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/20 flex items-center justify-between",children:[s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:["Teams",!r&&t&&s.jsxs("span",{className:"ml-2 font-normal normal-case tracking-normal",children:["· ",t.length]})]}),s.jsxs("button",{onClick:()=>d(!0),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx(ot,{className:"h-3 w-3"}),"New team"]})]}),c&&s.jsx("div",{className:"px-6 py-3 border-b border-border bg-muted/5",children:s.jsxs("form",{onSubmit:v,className:"flex items-center gap-2",children:[s.jsx(_e,{autoFocus:!0,placeholder:"Team name",value:u,onChange:y=>f(y.target.value),className:"h-8 text-sm flex-1 max-w-[240px]"}),s.jsx(ee,{type:"submit",size:"sm",className:"h-8",disabled:!u.trim()||a.isPending,children:a.isPending?"Creating…":"Create"}),s.jsx(ee,{type:"button",variant:"ghost",size:"sm",className:"h-8",onClick:()=>{d(!1),f("")},children:"Cancel"})]})}),r?s.jsx("div",{className:"divide-y divide-border",children:[1,2].map(y=>s.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5",children:[s.jsx(le,{className:"h-7 w-7 rounded-lg shrink-0"}),s.jsx(le,{className:"h-3.5 w-32"})]},y))}):t!=null&&t.length?s.jsx("div",{className:"divide-y divide-border",children:t.map(y=>{const b=o.has(y.id);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-3 px-6 py-3.5 hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors group",children:[s.jsx("button",{onClick:()=>g(y.id),className:"text-muted-foreground hover:text-foreground shrink-0 transition-colors",children:b?s.jsx(Zs,{className:"h-4 w-4"}):s.jsx(pr,{className:"h-4 w-4"})}),s.jsx("div",{className:"h-7 w-7 rounded-lg bg-muted flex items-center justify-center shrink-0",children:s.jsx(Aa,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:y.name}),y.description&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:y.description})]}),s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[y.member_count," ",y.member_count===1?"member":"members"]}),s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsx("button",{className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground",children:s.jsx(Ls,{className:"h-4 w-4"})})}),s.jsx(Dr,{align:"end",className:"w-36",children:s.jsxs(Je,{className:"text-destructive focus:text-destructive",onClick:()=>p(y.id),children:[s.jsx(jr,{className:"h-3.5 w-3.5 mr-2"}),"Delete team"]})})]})]}),b&&s.jsx(RL,{workspaceId:e,teamId:y.id,allMembers:n??[]})]},y.id)})}):s.jsxs("div",{className:"flex flex-col items-center justify-center py-10 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(Aa,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No teams yet"}),s.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Teams make it easy to grant project access to groups of people."}),s.jsx(ee,{variant:"outline",size:"sm",onClick:()=>d(!0),children:"Create a team"})]}),s.jsx(uo,{open:!!m,onClose:()=>p(null),onConfirm:()=>{m&&i.mutate(m,{onSuccess:()=>{F.success("Team deleted"),p(null)},onError:()=>{F.error("Failed to delete team"),p(null)}})},title:"Delete team",description:`Delete "${(x==null?void 0:x.name)??"this team"}"? All members will be removed from the team. Projects will not be affected.`,confirmLabel:"Delete team",variant:"destructive",loading:i.isPending})]})}function zL({workspaceId:e}){const{data:t=[],isLoading:r}=wx(e),n=HD(e),a=(i,o)=>{n.mutate({requestId:i,action:o},{onSuccess:()=>F.success(o==="approve"?"Access approved":"Request denied"),onError:l=>F.error(l.message??"Failed to update request")})};return r?s.jsx("div",{className:"p-6 space-y-3",children:[1,2].map(i=>s.jsx(le,{className:"h-12 w-full"},i))}):t.length===0?s.jsx("div",{className:"p-10 text-center text-sm text-muted-foreground",children:"No pending access requests."}):s.jsx("div",{className:"divide-y divide-border",children:t.map(i=>{var l;const o=i.user?[i.user.first_name,i.user.last_name].filter(Boolean).join(" ")||i.user.email:i.user_id;return s.jsxs("div",{className:"flex items-center justify-between gap-4 px-6 py-3",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:o}),((l=i.user)==null?void 0:l.email)&&s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.user.email}),i.message&&s.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5 italic truncate",children:['"',i.message,'"']})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx(ee,{size:"sm",variant:"outline",className:"h-7 text-xs",disabled:n.isPending,onClick:()=>a(i.id,"deny"),children:"Deny"}),s.jsx(ee,{size:"sm",className:"h-7 text-xs",disabled:n.isPending,onClick:()=>a(i.id,"approve"),children:"Approve"})]})]},i.id)})})}const LL=["general","members","teams","access-requests"];function FL(){const{workspace:e,user:t}=De(),r=(e==null?void 0:e.id)??"",[n,a]=ec(),i=n.get("tab"),[o,l]=h.useState(LL.includes(i)?i:"general"),c=(t==null?void 0:t.roles)??[],d=c.includes("super-admin")||c.includes("admin"),{data:u=[]}=Po(r),f=u.find(j=>j.user_id===(t==null?void 0:t.id)),m=d||(f==null?void 0:f.role)==="admin",p=j=>{l(j),a({tab:j},{replace:!0})},[x,g]=h.useState(!1),v=m?["general","members","teams","access-requests"]:["general","members","teams"],{data:y=[]}=wx(r),b=m?y.length:0,N={general:"General",members:"Members",teams:"Teams","access-requests":s.jsxs("span",{className:"flex items-center gap-1.5",children:["Access Requests",b>0&&s.jsx("span",{className:"flex h-4 min-w-4 items-center justify-center rounded-full bg-red-500 px-1 text-[10px] font-medium text-white",children:b>9?"9+":b})]})};return s.jsxs("div",{className:"p-2 pb-24 md:pb-2",children:[s.jsx(Or,{zone:"workspace.settings.before",props:{workspaceId:r}}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between border-b border-border px-2",children:[s.jsx("div",{className:"flex overflow-x-auto scrollbar-none",children:v.map(j=>s.jsx("button",{onClick:()=>p(j),className:z("h-12 px-4 text-sm font-medium border-b-2 transition-colors whitespace-nowrap shrink-0",o===j?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:N[j]},j))}),o==="members"&&s.jsxs(ee,{size:"sm",onClick:()=>g(!0),className:"shrink-0 ml-2",children:[s.jsx(ot,{className:"h-4 w-4"}),s.jsx("span",{className:"hidden sm:inline",children:"Add member"})]})]}),o==="general"&&s.jsx(TL,{workspaceId:r}),o==="members"&&s.jsx(IL,{workspaceId:r,onInvite:()=>g(!0)}),o==="teams"&&s.jsx($L,{workspaceId:r}),o==="access-requests"&&m&&s.jsx(zL,{workspaceId:r})]}),s.jsx(Or,{zone:"workspace.settings.after",props:{workspaceId:r}}),s.jsx(AL,{open:x,onClose:()=>g(!1),workspaceId:r})]})}function BL({open:e,onClose:t}){const[r,n]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(new Set),c=ML();h.useEffect(()=>{e&&(n(""),i(""),l(new Set))},[e]);const d=Wd.flatMap(g=>g.permissions.map(v=>v.key)),u=d.every(g=>o.has(g)),f=!u&&d.some(g=>o.has(g)),m=()=>{l(u?new Set:new Set(d))},p=g=>{l(v=>{const y=new Set(v);return y.has(g)?y.delete(g):y.add(g),y})},x=g=>{g.preventDefault(),r.trim()&&c.mutate({name:r.trim(),description:a.trim()||void 0,permissions:Array.from(o)},{onSuccess:()=>{F.success("Role created"),t()},onError:v=>F.error(v.message||"Failed to create role")})};return s.jsx(mn,{open:e,onOpenChange:g=>!g&&t(),children:s.jsxs(Zr,{className:"sm:max-w-[580px] max-h-[85vh] overflow-y-auto",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:"Create role"}),s.jsx(Eo,{children:"Define a new custom role with a specific permission set."})]}),s.jsxs("form",{onSubmit:x,className:"space-y-5 pt-2",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),s.jsx(_e,{value:r,onChange:g=>n(g.target.value),placeholder:"e.g. Developer, PM, Viewer",className:"h-9",autoFocus:!0,required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsxs("label",{className:"text-xs font-medium text-muted-foreground",children:["Description ",s.jsx("span",{className:"font-normal",children:"(optional)"})]}),s.jsx(_e,{value:a,onChange:g=>i(g.target.value),placeholder:"What is this role for?",className:"h-9"})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),s.jsx("button",{type:"button",onClick:m,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:u?"Deselect all":"Select all"})]}),Wd.map(g=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-1.5",children:g.group}),s.jsx("div",{className:"space-y-1.5",children:g.permissions.map(v=>s.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[s.jsx("input",{type:"checkbox",checked:o.has(v.key),onChange:()=>p(v.key),className:"h-3.5 w-3.5 rounded border-border accent-foreground cursor-pointer"}),s.jsx("span",{className:"text-sm group-hover:text-foreground text-muted-foreground transition-colors",children:v.label})]},v.key))})]},g.group))]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),s.jsx(ee,{type:"submit",size:"sm",disabled:!r.trim()||c.isPending,children:c.isPending?"Creating…":"Create role"})]})]})]})})}function qL({role:e,onDeleted:t}){const[r,n]=h.useState(e.name),[a,i]=h.useState(e.description??""),[o,l]=h.useState(new Set(e.permissions)),[c,d]=h.useState(!1),u=OL(e.id),f=EL();h.useEffect(()=>{n(e.name),i(e.description??""),l(new Set(e.permissions))},[e.id,e.name,e.description,e.permissions]);const m=r!==e.name||a!==(e.description??"")||o.size!==e.permissions.length||Array.from(o).some(j=>!e.permissions.includes(j)),p=Wd.flatMap(j=>j.permissions.map(k=>k.key)),x=p.every(j=>o.has(j)),g=!x&&p.some(j=>o.has(j)),v=()=>{l(x?new Set:new Set(p))},y=j=>{l(k=>{const w=new Set(k);return w.has(j)?w.delete(j):w.add(j),w})},b=()=>{u.mutate({name:r.trim(),description:a.trim()||void 0,permissions:Array.from(o)},{onSuccess:()=>F.success("Role saved"),onError:j=>F.error(j.message||"Failed to save role")})},N=()=>{f.mutate(e.id,{onSuccess:()=>{F.success("Role deleted"),t(),d(!1)},onError:j=>F.error(j.message||"Failed to delete role")})};return s.jsxs("div",{className:"flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("h2",{className:"text-sm font-semibold",children:e.name}),e.is_system&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:[s.jsx(Sn,{className:"h-3 w-3"}),"System"]})]}),!e.is_system&&s.jsx("button",{onClick:()=>d(!0),className:"text-muted-foreground hover:text-destructive transition-colors",title:"Delete role",children:s.jsx(jr,{className:"h-4 w-4"})})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-5",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),s.jsx(_e,{value:r,onChange:j=>n(j.target.value),className:"h-8 text-sm"})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),s.jsx(_e,{value:a,onChange:j=>i(j.target.value),placeholder:"What is this role for?",className:"h-8 text-sm"})]}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Permissions"}),s.jsx("button",{type:"button",onClick:v,className:"text-xs text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:x?"Deselect all":"Select all"})]}),Wd.map(j=>s.jsxs("div",{children:[s.jsx("p",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide mb-2",children:j.group}),s.jsx("div",{className:"space-y-2",children:j.permissions.map(k=>s.jsxs("label",{className:"flex items-center gap-2.5 cursor-pointer group",children:[s.jsx("input",{type:"checkbox",checked:o.has(k.key),onChange:()=>y(k.key),className:"h-3.5 w-3.5 rounded border-border accent-foreground cursor-pointer"}),s.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:k.label})]},k.key))})]},j.group))]}),s.jsx("div",{className:"shrink-0 px-6 py-4 border-t border-border flex justify-end",children:s.jsx(ee,{size:"sm",onClick:b,disabled:!m||!r.trim()||u.isPending,children:u.isPending?"Saving…":"Save changes"})}),s.jsx(li,{open:c,onOpenChange:d,children:s.jsxs(wa,{children:[s.jsxs(Na,{children:[s.jsxs(Sa,{children:['Delete "',e.name,'"?']}),s.jsx(Ca,{children:"This role will be removed from all users assigned to it. This action cannot be undone."})]}),s.jsxs(ka,{children:[s.jsx(Pa,{children:"Cancel"}),s.jsx(_a,{onClick:N,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function WL(){const{data:e,isLoading:t}=wf(),[r,n]=h.useState(null),[a,i]=h.useState(!1),o=(e==null?void 0:e.filter(d=>d.is_system))??[],l=(e==null?void 0:e.filter(d=>!d.is_system))??[];h.useEffect(()=>{e&&e.length>0&&!r&&n(e[0].id)},[e]);const c=(e==null?void 0:e.find(d=>d.id===r))??null;return s.jsx("div",{className:"p-2 pb-24 md:pb-2 h-full",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Ih,{className:"h-5 w-5 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-base font-semibold",children:"Roles & Permissions"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Define what users with each custom role can do across the application."})]})]}),s.jsxs(ee,{size:"sm",onClick:()=>i(!0),children:[s.jsx(ot,{className:"h-4 w-4 mr-1.5"}),"Create role"]})]}),s.jsxs("div",{className:"flex flex-col md:flex-row flex-1 min-h-0",children:[s.jsx("div",{className:"w-full md:w-56 shrink-0 md:border-r border-b md:border-b-0 border-border flex flex-col overflow-y-auto md:overflow-y-auto max-h-48 md:max-h-none",children:t?s.jsx("div",{className:"p-4 space-y-2",children:[1,2,3].map(d=>s.jsx(le,{className:"h-8 w-full"},d))}):s.jsxs(s.Fragment,{children:[o.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"px-3 pt-3 pb-1",children:s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"System Roles"})}),o.map(d=>s.jsxs("button",{onClick:()=>n(d.id),className:z("w-full flex items-center gap-2 px-3 py-2 text-left text-sm transition-colors",r===d.id?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx(Sn,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),s.jsx("span",{className:"truncate",children:d.name})]},d.id))]}),l.length>0&&s.jsxs("div",{children:[s.jsx("div",{className:"px-3 pt-3 pb-1",children:s.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom Roles"})}),l.map(d=>s.jsxs("button",{onClick:()=>n(d.id),className:z("w-full flex items-center gap-2 px-3 py-2 text-left text-sm transition-colors",r===d.id?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:[s.jsx("div",{className:"h-3 w-3 shrink-0"}),s.jsx("span",{className:"truncate",children:d.name})]},d.id))]}),!t&&(!e||e.length===0)&&s.jsx("div",{className:"flex flex-col items-center justify-center py-10 px-3 text-center",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"No roles yet."})})]})}),s.jsx("div",{className:"flex-1 min-w-0",children:c?s.jsx(qL,{role:c,onDeleted:()=>{var u;const d=(e==null?void 0:e.filter(f=>f.id!==c.id))??[];n(((u=d[0])==null?void 0:u.id)??null)}},c.id):s.jsx("div",{className:"flex items-center justify-center h-full text-center p-8",children:s.jsxs("div",{children:[s.jsx(Ih,{className:"h-10 w-10 text-muted-foreground mx-auto mb-3"}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"Select a role to edit"}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["Or"," ",s.jsx("button",{onClick:()=>i(!0),className:"underline underline-offset-2 hover:text-foreground transition-colors",children:"create a new role"})]})]})})})]}),s.jsx(BL,{open:a,onClose:()=>i(!1)})]})})}function UL(e){return Te({queryKey:["invite",e],queryFn:()=>ie.get(`/auth/invite/${e}`),retry:!1,enabled:!!e})}function HL(){const{token:e}=Et(),{isAuthenticated:t}=De(),r=ct(),{data:n,isLoading:a,error:i}=UL(e??""),{data:o}=ef(),l=QD(e??""),[c,d]=h.useState(""),[u,f]=h.useState(""),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(!1);if(t&&n)return r(n.workspace?`/${n.workspace.slug}/projects`:"/",{replace:!0}),null;const b=(n==null?void 0:n.invitation.email)??null,N=j=>{j.preventDefault();const k=b??m.trim();if(!k){F.error("Email is required");return}l.mutate({email:k,password:x,first_name:c,last_name:u},{onSuccess:()=>{r(n.workspace?`/${n.workspace.slug}/projects`:"/",{replace:!0})},onError:w=>F.error(w.message??"Registration failed")})};return s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[380px]",children:[s.jsx("div",{className:"flex justify-center mb-8",children:s.jsx(Ao,{})}),a?s.jsxs("div",{className:"space-y-3",children:[s.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-48 mx-auto"}),s.jsx("div",{className:"h-2 bg-muted rounded animate-pulse w-32 mx-auto"})]}):i?s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-3",children:[s.jsx("p",{className:"text-sm font-medium",children:"Invalid or expired invitation"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This invite link is no longer valid. Ask for a new one."}),s.jsx(Rt,{to:"/login",children:s.jsx(ee,{variant:"outline",size:"sm",className:"mt-2",children:"Go to login"})})]}):n?s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"px-5 py-4 border-b border-border",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[s.jsx(El,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"You've been invited to"})]}),s.jsx("p",{className:"text-base font-semibold",children:n.workspace?n.workspace.name:"Meridian"})]}),s.jsxs("div",{className:"px-5 py-3 flex items-center gap-2.5",children:[n.invitation.role==="admin"?s.jsx(gD,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}):s.jsx(CD,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),s.jsxs("span",{className:"text-xs text-muted-foreground",children:["Joining as"," ",s.jsx("span",{className:"font-medium text-foreground capitalize",children:n.invitation.role}),n.invitation.role==="admin"?" — full access":" — can view and edit"]})]})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-5",children:[s.jsx("p",{className:"text-sm font-medium mb-4",children:"Create your account"}),s.jsxs("form",{onSubmit:N,className:"space-y-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(_e,{placeholder:"First name",value:c,onChange:j=>d(j.target.value),required:!0,className:"h-9 bg-transparent",autoFocus:!0}),s.jsx(_e,{placeholder:"Last name",value:u,onChange:j=>f(j.target.value),required:!0,className:"h-9 bg-transparent"})]}),b?s.jsxs("div",{className:"relative",children:[s.jsx(_e,{type:"email",value:b,readOnly:!0,className:"h-9 bg-muted/50 text-muted-foreground cursor-not-allowed"}),s.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground bg-muted px-1.5 py-0.5 rounded",children:"locked"})]}):s.jsx(_e,{type:"email",placeholder:"Email",value:m,onChange:j=>p(j.target.value),required:!0,className:"h-9 bg-transparent",autoComplete:"email"}),s.jsxs("div",{className:"relative",children:[s.jsx(_e,{type:v?"text":"password",placeholder:"Password (min. 8 characters)",value:x,onChange:j=>g(j.target.value),required:!0,minLength:8,className:"h-9 bg-transparent pr-10",autoComplete:"new-password"}),s.jsx("button",{type:"button",onClick:()=>y(!v),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors",tabIndex:-1,children:v?s.jsx(ac,{className:"h-4 w-4"}):s.jsx(Mi,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"pt-1",children:s.jsx(ee,{type:"submit",className:"w-full h-9 font-medium",disabled:l.isPending,children:l.isPending?"Creating account…":"Accept invitation"})})]})]}),(o==null?void 0:o.googleOAuthEnabled)&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-px flex-1 bg-border"}),s.jsx("span",{className:"text-xs text-muted-foreground",children:"or"}),s.jsx("div",{className:"h-px flex-1 bg-border"})]}),s.jsx(Px,{flow:"invite",inviteToken:e,label:"Accept with Google"})]}),s.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Already have an account?"," ",s.jsx(Rt,{to:"/login",className:"text-indigo hover:opacity-80 transition-opacity",children:"Sign in"})]})]}):null]})})}const YS={all:["reporting"],timeLogs:e=>[...YS.all,"time-logs",e]};function GS(e,t){return Te({queryKey:YS.timeLogs(e),queryFn:()=>{const r=new URLSearchParams;return Object.entries(e).forEach(([n,a])=>{a&&((n==="workspace_ids"||n==="user_ids"||n==="project_ids")&&Array.isArray(a)?a.length>0&&r.set(n,a.join(",")):typeof a=="boolean"?a&&r.set(n,"true"):typeof a=="string"?r.set(n,a):typeof a=="number"&&r.set(n,String(a)))}),ie.get(`/admin/reporting/time-logs?${r}`)},enabled:(t==null?void 0:t.enabled)!==!1})}function KL(e,t,r){const n=(r==null?void 0:r.orgScope)??!1;return Te({queryKey:["reporting","members",e.join(","),t.join(","),n],queryFn:()=>{const a=new URLSearchParams;return e.length&&a.set("workspace_ids",e.join(",")),t.length&&a.set("project_ids",t.join(",")),n&&a.set("org_scope","true"),ie.get(`/admin/reporting/members?${a}`)},select:a=>a.members})}function Hd({value:e,onChange:t,placeholder:r="Pick a date",className:n}){return s.jsxs(Tt,{children:[s.jsx(It,{asChild:!0,children:s.jsxs(ee,{variant:"outline",className:z("h-8 w-36 justify-start text-left font-normal text-xs gap-1.5",!e&&"text-muted-foreground",n),children:[s.jsx(Ht,{className:"h-3.5 w-3.5 shrink-0"}),e?fe(e,"MMM d, yyyy"):s.jsx("span",{children:r}),e&&s.jsx("span",{role:"button",className:"ml-auto hover:text-foreground",onClick:a=>{a.stopPropagation(),t(void 0)},children:s.jsx(Be,{className:"h-3 w-3"})})]})}),s.jsx(_t,{className:"w-auto p-0",align:"start",children:s.jsx(br,{mode:"single",selected:e,onSelect:t,initialFocus:!0})})]})}var YL=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"];function eg(e){if(typeof e!="string")return!1;var t=YL;return t.includes(e)}var GL=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],VL=new Set(GL);function VS(e){return typeof e!="string"?!1:VL.has(e)}function XS(e){return typeof e=="string"&&e.startsWith("data-")}function qs(e){if(typeof e!="object"||e===null)return{};var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(VS(r)||XS(r))&&(t[r]=e[r]);return t}function tg(e){if(e==null)return null;if(h.isValidElement(e)&&typeof e.props=="object"&&e.props!==null){var t=e.props;return qs(t)}return typeof e=="object"&&!Array.isArray(e)?qs(e):null}function Qr(e){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(VS(r)||XS(r)||eg(r))&&(t[r]=e[r]);return t}function Zre(e){return e==null?null:h.isValidElement(e)?Qr(e.props):typeof e=="object"&&!Array.isArray(e)?Qr(e):null}var XL=["children","width","height","viewBox","className","style","title","desc"];function Xh(){return Xh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xh.apply(null,arguments)}function QL(e,t){if(e==null)return{};var r,n,a=ZL(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function ZL(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var QS=h.forwardRef((e,t)=>{var{children:r,width:n,height:a,viewBox:i,className:o,style:l,title:c,desc:d}=e,u=QL(e,XL),f=i||{width:n,height:a,x:0,y:0},m=lt("recharts-surface",o);return h.createElement("svg",Xh({},Qr(u),{className:m,width:n,height:a,style:l,viewBox:"".concat(f.x," ").concat(f.y," ").concat(f.width," ").concat(f.height),ref:t}),h.createElement("title",null,c),h.createElement("desc",null,d),r)}),JL=["children","className"];function Qh(){return Qh=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Qh.apply(null,arguments)}function eF(e,t){if(e==null)return{};var r,n,a=tF(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function tF(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Ws=h.forwardRef((e,t)=>{var{children:r,className:n}=e,a=eF(e,JL),i=lt("recharts-layer",n);return h.createElement("g",Qh({className:i},Qr(a),{ref:t}),r)}),rF=h.createContext(null);function mt(e){return function(){return e}}const ZS=Math.cos,Kd=Math.sin,Gn=Math.sqrt,Yd=Math.PI,Nf=2*Yd,Zh=Math.PI,Jh=2*Zh,Xa=1e-6,nF=Jh-Xa;function JS(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function sF(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return JS;const r=10**t;return function(n){this._+=n[0];for(let a=1,i=n.length;a<i;++a)this._+=Math.round(arguments[a]*r)/r+n[a]}}class aF{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?JS:sF(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,a){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+a}`}bezierCurveTo(t,r,n,a,i,o){this._append`C${+t},${+r},${+n},${+a},${this._x1=+i},${this._y1=+o}`}arcTo(t,r,n,a,i){if(t=+t,r=+r,n=+n,a=+a,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=n-t,d=a-r,u=o-t,f=l-r,m=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(m>Xa)if(!(Math.abs(f*c-d*u)>Xa)||!i)this._append`L${this._x1=t},${this._y1=r}`;else{let p=n-o,x=a-l,g=c*c+d*d,v=p*p+x*x,y=Math.sqrt(g),b=Math.sqrt(m),N=i*Math.tan((Zh-Math.acos((g+m-v)/(2*y*b)))/2),j=N/b,k=N/y;Math.abs(j-1)>Xa&&this._append`L${t+j*u},${r+j*f}`,this._append`A${i},${i},0,0,${+(f*p>u*x)},${this._x1=t+k*c},${this._y1=r+k*d}`}}arc(t,r,n,a,i,o){if(t=+t,r=+r,n=+n,o=!!o,n<0)throw new Error(`negative radius: ${n}`);let l=n*Math.cos(a),c=n*Math.sin(a),d=t+l,u=r+c,f=1^o,m=o?a-i:i-a;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>Xa||Math.abs(this._y1-u)>Xa)&&this._append`L${d},${u}`,n&&(m<0&&(m=m%Jh+Jh),m>nF?this._append`A${n},${n},0,1,${f},${t-l},${r-c}A${n},${n},0,1,${f},${this._x1=d},${this._y1=u}`:m>Xa&&this._append`A${n},${n},0,${+(m>=Zh)},${f},${this._x1=t+n*Math.cos(i)},${this._y1=r+n*Math.sin(i)}`)}rect(t,r,n,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+a}h${-n}Z`}toString(){return this._}}function rg(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{const n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new aF(t)}function ng(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function e2(e){this._context=e}e2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function kf(e){return new e2(e)}function t2(e){return e[0]}function r2(e){return e[1]}function n2(e,t){var r=mt(!0),n=null,a=kf,i=null,o=rg(l);e=typeof e=="function"?e:e===void 0?t2:mt(e),t=typeof t=="function"?t:t===void 0?r2:mt(t);function l(c){var d,u=(c=ng(c)).length,f,m=!1,p;for(n==null&&(i=a(p=o())),d=0;d<=u;++d)!(d<u&&r(f=c[d],d,c))===m&&((m=!m)?i.lineStart():i.lineEnd()),m&&i.point(+e(f,d,c),+t(f,d,c));if(p)return i=null,p+""||null}return l.x=function(c){return arguments.length?(e=typeof c=="function"?c:mt(+c),l):e},l.y=function(c){return arguments.length?(t=typeof c=="function"?c:mt(+c),l):t},l.defined=function(c){return arguments.length?(r=typeof c=="function"?c:mt(!!c),l):r},l.curve=function(c){return arguments.length?(a=c,n!=null&&(i=a(n)),l):a},l.context=function(c){return arguments.length?(c==null?n=i=null:i=a(n=c),l):n},l}function td(e,t,r){var n=null,a=mt(!0),i=null,o=kf,l=null,c=rg(d);e=typeof e=="function"?e:e===void 0?t2:mt(+e),t=typeof t=="function"?t:mt(t===void 0?0:+t),r=typeof r=="function"?r:r===void 0?r2:mt(+r);function d(f){var m,p,x,g=(f=ng(f)).length,v,y=!1,b,N=new Array(g),j=new Array(g);for(i==null&&(l=o(b=c())),m=0;m<=g;++m){if(!(m<g&&a(v=f[m],m,f))===y)if(y=!y)p=m,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),x=m-1;x>=p;--x)l.point(N[x],j[x]);l.lineEnd(),l.areaEnd()}y&&(N[m]=+e(v,m,f),j[m]=+t(v,m,f),l.point(n?+n(v,m,f):N[m],r?+r(v,m,f):j[m]))}if(b)return l=null,b+""||null}function u(){return n2().defined(a).curve(o).context(i)}return d.x=function(f){return arguments.length?(e=typeof f=="function"?f:mt(+f),n=null,d):e},d.x0=function(f){return arguments.length?(e=typeof f=="function"?f:mt(+f),d):e},d.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:mt(+f),d):n},d.y=function(f){return arguments.length?(t=typeof f=="function"?f:mt(+f),r=null,d):t},d.y0=function(f){return arguments.length?(t=typeof f=="function"?f:mt(+f),d):t},d.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:mt(+f),d):r},d.lineX0=d.lineY0=function(){return u().x(e).y(t)},d.lineY1=function(){return u().x(e).y(r)},d.lineX1=function(){return u().x(n).y(t)},d.defined=function(f){return arguments.length?(a=typeof f=="function"?f:mt(!!f),d):a},d.curve=function(f){return arguments.length?(o=f,i!=null&&(l=o(i)),d):o},d.context=function(f){return arguments.length?(f==null?i=l=null:l=o(i=f),d):i},d}class s2{constructor(t,r){this._context=t,this._x=r}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}}function iF(e){return new s2(e,!0)}function oF(e){return new s2(e,!1)}const sg={draw(e,t){const r=Gn(t/Yd);e.moveTo(r,0),e.arc(0,0,r,0,Nf)}},lF={draw(e,t){const r=Gn(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}},a2=Gn(1/3),cF=a2*2,dF={draw(e,t){const r=Gn(t/cF),n=r*a2;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}},uF={draw(e,t){const r=Gn(t),n=-r/2;e.rect(n,n,r,r)}},fF=.8908130915292852,i2=Kd(Yd/10)/Kd(7*Yd/10),mF=Kd(Nf/10)*i2,hF=-ZS(Nf/10)*i2,pF={draw(e,t){const r=Gn(t*fF),n=mF*r,a=hF*r;e.moveTo(0,-r),e.lineTo(n,a);for(let i=1;i<5;++i){const o=Nf*i/5,l=ZS(o),c=Kd(o);e.lineTo(c*r,-l*r),e.lineTo(l*n-c*a,c*n+l*a)}e.closePath()}},rh=Gn(3),xF={draw(e,t){const r=-Gn(t/(rh*3));e.moveTo(0,r*2),e.lineTo(-rh*r,-r),e.lineTo(rh*r,-r),e.closePath()}},vn=-.5,yn=Gn(3)/2,ep=1/Gn(12),gF=(ep/2+1)*3,vF={draw(e,t){const r=Gn(t/gF),n=r/2,a=r*ep,i=n,o=r*ep+r,l=-i,c=o;e.moveTo(n,a),e.lineTo(i,o),e.lineTo(l,c),e.lineTo(vn*n-yn*a,yn*n+vn*a),e.lineTo(vn*i-yn*o,yn*i+vn*o),e.lineTo(vn*l-yn*c,yn*l+vn*c),e.lineTo(vn*n+yn*a,vn*a-yn*n),e.lineTo(vn*i+yn*o,vn*o-yn*i),e.lineTo(vn*l+yn*c,vn*c-yn*l),e.closePath()}};function yF(e,t){let r=null,n=rg(a);e=typeof e=="function"?e:mt(e||sg),t=typeof t=="function"?t:mt(t===void 0?64:+t);function a(){let i;if(r||(r=i=n()),e.apply(this,arguments).draw(r,+t.apply(this,arguments)),i)return r=null,i+""||null}return a.type=function(i){return arguments.length?(e=typeof i=="function"?i:mt(i),a):e},a.size=function(i){return arguments.length?(t=typeof i=="function"?i:mt(+i),a):t},a.context=function(i){return arguments.length?(r=i??null,a):r},a}function Gd(){}function Vd(e,t,r){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+r)/6)}function o2(e){this._context=e}o2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Vd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Vd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bF(e){return new o2(e)}function l2(e){this._context=e}l2.prototype={areaStart:Gd,areaEnd:Gd,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Vd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function jF(e){return new l2(e)}function c2(e){this._context=e}c2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:Vd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function wF(e){return new c2(e)}function d2(e){this._context=e}d2.prototype={areaStart:Gd,areaEnd:Gd,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function NF(e){return new d2(e)}function d0(e){return e<0?-1:1}function u0(e,t,r){var n=e._x1-e._x0,a=t-e._x1,i=(e._y1-e._y0)/(n||a<0&&-0),o=(r-e._y1)/(a||n<0&&-0),l=(i*a+o*n)/(n+a);return(d0(i)+d0(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function f0(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function nh(e,t,r){var n=e._x0,a=e._y0,i=e._x1,o=e._y1,l=(i-n)/3;e._context.bezierCurveTo(n+l,a+l*t,i-l,o-l*r,i,o)}function Xd(e){this._context=e}Xd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:nh(this,this._t0,f0(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var r=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,nh(this,f0(this,r=u0(this,e,t)),r);break;default:nh(this,this._t0,r=u0(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function u2(e){this._context=new f2(e)}(u2.prototype=Object.create(Xd.prototype)).point=function(e,t){Xd.prototype.point.call(this,t,e)};function f2(e){this._context=e}f2.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,r,n,a,i){this._context.bezierCurveTo(t,e,n,r,i,a)}};function kF(e){return new Xd(e)}function SF(e){return new u2(e)}function m2(e){this._context=e}m2.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=m0(e),a=m0(t),i=0,o=1;o<r;++i,++o)this._context.bezierCurveTo(n[0][i],a[0][i],n[1][i],a[1][i],e[o],t[o]);(this._line||this._line!==0&&r===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function m0(e){var t,r=e.length-1,n,a=new Array(r),i=new Array(r),o=new Array(r);for(a[0]=0,i[0]=2,o[0]=e[0]+2*e[1],t=1;t<r-1;++t)a[t]=1,i[t]=4,o[t]=4*e[t]+2*e[t+1];for(a[r-1]=2,i[r-1]=7,o[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=a[t]/i[t-1],i[t]-=n,o[t]-=n*o[t-1];for(a[r-1]=o[r-1]/i[r-1],t=r-2;t>=0;--t)a[t]=(o[t]-a[t+1])/i[t];for(i[r-1]=(e[r]+a[r-1])/2,t=0;t<r-1;++t)i[t]=2*e[t+1]-a[t+1];return[a,i]}function CF(e){return new m2(e)}function Sf(e,t){this._context=e,this._t=t}Sf.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function _F(e){return new Sf(e,.5)}function PF(e){return new Sf(e,0)}function MF(e){return new Sf(e,1)}function vi(e,t){if((o=e.length)>1)for(var r=1,n,a,i=e[t[0]],o,l=i.length;r<o;++r)for(a=i,i=e[t[r]],n=0;n<l;++n)i[n][1]+=i[n][0]=isNaN(a[n][1])?a[n][0]:a[n][1]}function tp(e){for(var t=e.length,r=new Array(t);--t>=0;)r[t]=t;return r}function OF(e,t){return e[t]}function EF(e){const t=[];return t.key=e,t}function AF(){var e=mt([]),t=tp,r=vi,n=OF;function a(i){var o=Array.from(e.apply(this,arguments),EF),l,c=o.length,d=-1,u;for(const f of i)for(l=0,++d;l<c;++l)(o[l][d]=[0,+n(f,o[l].key,d,i)]).data=f;for(l=0,u=ng(t(o));l<c;++l)o[u[l]].index=l;return r(o,u),o}return a.keys=function(i){return arguments.length?(e=typeof i=="function"?i:mt(Array.from(i)),a):e},a.value=function(i){return arguments.length?(n=typeof i=="function"?i:mt(+i),a):n},a.order=function(i){return arguments.length?(t=i==null?tp:typeof i=="function"?i:mt(Array.from(i)),a):t},a.offset=function(i){return arguments.length?(r=i??vi,a):r},a}function DF(e,t){if((n=e.length)>0){for(var r,n,a=0,i=e[0].length,o;a<i;++a){for(o=r=0;r<n;++r)o+=e[r][a][1]||0;if(o)for(r=0;r<n;++r)e[r][a][1]/=o}vi(e,t)}}function TF(e,t){if((a=e.length)>0){for(var r=0,n=e[t[0]],a,i=n.length;r<i;++r){for(var o=0,l=0;o<a;++o)l+=e[o][r][1]||0;n[r][1]+=n[r][0]=-l/2}vi(e,t)}}function IF(e,t){if(!(!((o=e.length)>0)||!((i=(a=e[t[0]]).length)>0))){for(var r=0,n=1,a,i,o;n<i;++n){for(var l=0,c=0,d=0;l<o;++l){for(var u=e[t[l]],f=u[n][1]||0,m=u[n-1][1]||0,p=(f-m)/2,x=0;x<l;++x){var g=e[t[x]],v=g[n][1]||0,y=g[n-1][1]||0;p+=v-y}c+=f,d+=p*f}a[n-1][1]+=a[n-1][0]=r,c&&(r-=d/c)}a[n-1][1]+=a[n-1][0]=r,vi(e,t)}}var Cf={},h2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==="__proto__"}e.isUnsafeProperty=t})(h2);var ag={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){switch(typeof r){case"number":case"symbol":return!1;case"string":return r.includes(".")||r.includes("[")||r.includes("]")}}e.isDeepKey=t})(ag);var _f={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var n;return typeof r=="string"||typeof r=="symbol"?r:Object.is((n=r==null?void 0:r.valueOf)==null?void 0:n.call(r),-0)?"-0":String(r)}e.toKey=t})(_f);var Pf={},p2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){if(r==null)return"";if(typeof r=="string")return r;if(Array.isArray(r))return r.map(t).join(",");const n=String(r);return n==="0"&&Object.is(Number(r),-0)?"-0":n}e.toString=t})(p2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=p2,r=_f;function n(a){if(Array.isArray(a))return a.map(r.toKey);if(typeof a=="symbol")return[a];a=t.toString(a);const i=[],o=a.length;if(o===0)return i;let l=0,c="",d="",u=!1;for(a.charCodeAt(0)===46&&(i.push(""),l++);l<o;){const f=a[l];d?f==="\\"&&l+1<o?(l++,c+=a[l]):f===d?d="":c+=f:u?f==='"'||f==="'"?d=f:f==="]"?(u=!1,i.push(c),c=""):c+=f:f==="["?(u=!0,c&&(i.push(c),c="")):f==="."?c&&(i.push(c),c=""):c+=f,l++}return c&&i.push(c),i}e.toPath=n})(Pf);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=h2,r=ag,n=_f,a=Pf;function i(l,c,d){if(l==null)return d;switch(typeof c){case"string":{if(t.isUnsafeProperty(c))return d;const u=l[c];return u===void 0?r.isDeepKey(c)?i(l,a.toPath(c),d):d:u}case"number":case"symbol":{typeof c=="number"&&(c=n.toKey(c));const u=l[c];return u===void 0?d:u}default:{if(Array.isArray(c))return o(l,c,d);if(Object.is(c==null?void 0:c.valueOf(),-0)?c="-0":c=String(c),t.isUnsafeProperty(c))return d;const u=l[c];return u===void 0?d:u}}}function o(l,c,d){if(c.length===0)return d;let u=l;for(let f=0;f<c.length;f++){if(u==null||t.isUnsafeProperty(c[f]))return d;u=u[c[f]]}return u===void 0?d:u}e.get=i})(Cf);var RF=Cf.get;const mo=Qs(RF);var $F=4;function va(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$F,r=10**t,n=Math.round(e*r)/r;return Object.is(n,-0)?0:n}function Dt(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return e.reduce((a,i,o)=>{var l=r[o-1];return typeof l=="string"?a+l+i:l!==void 0?a+va(l)+i:a+i},"")}var Ur=e=>e===0?0:e>0?1:-1,ms=e=>typeof e=="number"&&e!=+e,yi=e=>typeof e=="string"&&e.indexOf("%")===e.length-1,Ce=e=>(typeof e=="number"||e instanceof Number)&&!ms(e),hs=e=>Ce(e)||typeof e=="string",zF=0,$l=e=>{var t=++zF;return"".concat(e||"").concat(t)},Hn=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Ce(t)&&typeof t!="string")return n;var i;if(yi(t)){if(r==null)return n;var o=t.indexOf("%");i=r*parseFloat(t.slice(0,o))/100}else i=+t;return ms(i)&&(i=n),a&&r!=null&&i>r&&(i=r),i},x2=e=>{if(!Array.isArray(e))return!1;for(var t=e.length,r={},n=0;n<t;n++)if(!r[String(e[n])])r[String(e[n])]=!0;else return!0;return!1};function fr(e,t,r){return Ce(e)&&Ce(t)?va(e+r*(t-e)):t}function g2(e,t,r){if(!(!e||!e.length))return e.find(n=>n&&(typeof t=="function"?t(n):mo(n,t))===r)}var Bt=e=>e===null||typeof e>"u",wc=e=>Bt(e)?e:"".concat(e.charAt(0).toUpperCase()).concat(e.slice(1));function Hr(e){return e!=null}function Fo(){}var LF=["type","size","sizeType"];function rp(){return rp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},rp.apply(null,arguments)}function h0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function p0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?h0(Object(r),!0).forEach(function(n){FF(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FF(e,t,r){return(t=BF(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BF(e){var t=qF(e,"string");return typeof t=="symbol"?t:t+""}function qF(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function WF(e,t){if(e==null)return{};var r,n,a=UF(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function UF(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var v2={symbolCircle:sg,symbolCross:lF,symbolDiamond:dF,symbolSquare:uF,symbolStar:pF,symbolTriangle:xF,symbolWye:vF},HF=Math.PI/180,KF=e=>{var t="symbol".concat(wc(e));return v2[t]||sg},YF=(e,t,r)=>{if(t==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var n=18*HF;return 1.25*e*e*(Math.tan(n)-Math.tan(n*2)*Math.tan(n)**2)}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},GF=(e,t)=>{v2["symbol".concat(wc(e))]=t},y2=e=>{var{type:t="circle",size:r=64,sizeType:n="area"}=e,a=WF(e,LF),i=p0(p0({},a),{},{type:t,size:r,sizeType:n}),o="circle";typeof t=="string"&&(o=t);var l=()=>{var m=KF(o),p=yF().type(m).size(YF(r,n,o)),x=p();if(x!==null)return x},{className:c,cx:d,cy:u}=i,f=Qr(i);return Ce(d)&&Ce(u)&&Ce(r)?h.createElement("path",rp({},f,{className:lt("recharts-symbols",c),transform:"translate(".concat(d,", ").concat(u,")"),d:l()})):null};y2.registerSymbol=GF;var b2=e=>"radius"in e&&"startAngle"in e&&"endAngle"in e,VF=(e,t)=>{if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(h.isValidElement(e)&&(r=e.props),typeof r!="object"&&typeof r!="function")return null;var n={};return Object.keys(r).forEach(a=>{eg(a)&&(n[a]=i=>r[a](r,i))}),n},XF=(e,t,r)=>n=>(e(t,r,n),null),ig=(e,t,r)=>{if(e===null||typeof e!="object"&&typeof e!="function")return null;var n=null;return Object.keys(e).forEach(a=>{var i=e[a];eg(a)&&typeof i=="function"&&(n||(n={}),n[a]=XF(i,t,r))}),n};function x0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function QF(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?x0(Object(r),!0).forEach(function(n){ZF(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function ZF(e,t,r){return(t=JF(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function JF(e){var t=e8(e,"string");return typeof t=="symbol"?t:t+""}function e8(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xn(e,t){var r=QF({},e),n=t,a=Object.keys(t),i=a.reduce((o,l)=>(o[l]===void 0&&n[l]!==void 0&&(o[l]=n[l]),o),r);return i}var j2={},w2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){const a=new Map;for(let i=0;i<r.length;i++){const o=r[i],l=n(o,i,r);a.has(l)||a.set(l,o)}return Array.from(a.values())}e.uniqBy=t})(w2);var N2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return function(...a){return r.apply(this,a.slice(0,n))}}e.ary=t})(N2);var og={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r}e.identity=t})(og);var k2={},Mf={},S2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Number.isSafeInteger(r)&&r>=0}e.isLength=t})(S2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=S2;function r(n){return n!=null&&typeof n!="function"&&t.isLength(n.length)}e.isArrayLike=r})(Mf);var C2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="object"&&r!==null}e.isObjectLike=t})(C2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Mf,r=C2;function n(a){return r.isObjectLike(a)&&t.isArrayLike(a)}e.isArrayLikeObject=n})(k2);var _2={},P2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Cf;function r(n){return function(a){return t.get(a,n)}}e.property=r})(P2);var M2={},lg={},O2={},cg={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r!==null&&(typeof r=="object"||typeof r=="function")}e.isObject=t})(cg);var dg={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null||typeof r!="object"&&typeof r!="function"}e.isPrimitive=t})(dg);var ug={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n){return r===n||Number.isNaN(r)&&Number.isNaN(n)}e.isEqualsSameValueZero=t})(ug);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=cg,r=dg,n=ug;function a(u,f,m){return typeof m!="function"?a(u,f,()=>{}):i(u,f,function p(x,g,v,y,b,N){const j=m(x,g,v,y,b,N);return j!==void 0?!!j:i(x,g,p,N)},new Map)}function i(u,f,m,p){if(f===u)return!0;switch(typeof f){case"object":return o(u,f,m,p);case"function":return Object.keys(f).length>0?i(u,{...f},m,p):n.isEqualsSameValueZero(u,f);default:return t.isObject(u)?typeof f=="string"?f==="":!0:n.isEqualsSameValueZero(u,f)}}function o(u,f,m,p){if(f==null)return!0;if(Array.isArray(f))return c(u,f,m,p);if(f instanceof Map)return l(u,f,m,p);if(f instanceof Set)return d(u,f,m,p);const x=Object.keys(f);if(u==null||r.isPrimitive(u))return x.length===0;if(x.length===0)return!0;if(p!=null&&p.has(f))return p.get(f)===u;p==null||p.set(f,u);try{for(let g=0;g<x.length;g++){const v=x[g];if(!r.isPrimitive(u)&&!(v in u)||f[v]===void 0&&u[v]!==void 0||f[v]===null&&u[v]!==null||!m(u[v],f[v],v,u,f,p))return!1}return!0}finally{p==null||p.delete(f)}}function l(u,f,m,p){if(f.size===0)return!0;if(!(u instanceof Map))return!1;for(const[x,g]of f.entries()){const v=u.get(x);if(m(v,g,x,u,f,p)===!1)return!1}return!0}function c(u,f,m,p){if(f.length===0)return!0;if(!Array.isArray(u))return!1;const x=new Set;for(let g=0;g<f.length;g++){const v=f[g];let y=!1;for(let b=0;b<u.length;b++){if(x.has(b))continue;const N=u[b];let j=!1;if(m(N,v,g,u,f,p)&&(j=!0),j){x.add(b),y=!0;break}}if(!y)return!1}return!0}function d(u,f,m,p){return f.size===0?!0:u instanceof Set?c([...u],[...f],m,p):!1}e.isMatchWith=a,e.isSetMatch=d})(O2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=O2;function r(n,a){return t.isMatchWith(n,a,()=>{})}e.isMatch=r})(lg);var E2={},fg={},A2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Object.getOwnPropertySymbols(r).filter(n=>Object.prototype.propertyIsEnumerable.call(r,n))}e.getSymbols=t})(A2);var Of={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}e.getTag=t})(Of);var mg={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t="[object RegExp]",r="[object String]",n="[object Number]",a="[object Boolean]",i="[object Arguments]",o="[object Symbol]",l="[object Date]",c="[object Map]",d="[object Set]",u="[object Array]",f="[object Function]",m="[object ArrayBuffer]",p="[object Object]",x="[object Error]",g="[object DataView]",v="[object Uint8Array]",y="[object Uint8ClampedArray]",b="[object Uint16Array]",N="[object Uint32Array]",j="[object BigUint64Array]",k="[object Int8Array]",w="[object Int16Array]",S="[object Int32Array]",_="[object BigInt64Array]",C="[object Float32Array]",P="[object Float64Array]";e.argumentsTag=i,e.arrayBufferTag=m,e.arrayTag=u,e.bigInt64ArrayTag=_,e.bigUint64ArrayTag=j,e.booleanTag=a,e.dataViewTag=g,e.dateTag=l,e.errorTag=x,e.float32ArrayTag=C,e.float64ArrayTag=P,e.functionTag=f,e.int16ArrayTag=w,e.int32ArrayTag=S,e.int8ArrayTag=k,e.mapTag=c,e.numberTag=n,e.objectTag=p,e.regexpTag=t,e.setTag=d,e.stringTag=r,e.symbolTag=o,e.uint16ArrayTag=b,e.uint32ArrayTag=N,e.uint8ArrayTag=v,e.uint8ClampedArrayTag=y})(mg);var D2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return ArrayBuffer.isView(r)&&!(r instanceof DataView)}e.isTypedArray=t})(D2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=A2,r=Of,n=mg,a=dg,i=D2;function o(u,f){return l(u,void 0,u,new Map,f)}function l(u,f,m,p=new Map,x=void 0){const g=x==null?void 0:x(u,f,m,p);if(g!==void 0)return g;if(a.isPrimitive(u))return u;if(p.has(u))return p.get(u);if(Array.isArray(u)){const v=new Array(u.length);p.set(u,v);for(let y=0;y<u.length;y++)v[y]=l(u[y],y,m,p,x);return Object.hasOwn(u,"index")&&(v.index=u.index),Object.hasOwn(u,"input")&&(v.input=u.input),v}if(u instanceof Date)return new Date(u.getTime());if(u instanceof RegExp){const v=new RegExp(u.source,u.flags);return v.lastIndex=u.lastIndex,v}if(u instanceof Map){const v=new Map;p.set(u,v);for(const[y,b]of u)v.set(y,l(b,y,m,p,x));return v}if(u instanceof Set){const v=new Set;p.set(u,v);for(const y of u)v.add(l(y,void 0,m,p,x));return v}if(typeof Buffer<"u"&&Buffer.isBuffer(u))return u.subarray();if(i.isTypedArray(u)){const v=new(Object.getPrototypeOf(u)).constructor(u.length);p.set(u,v);for(let y=0;y<u.length;y++)v[y]=l(u[y],y,m,p,x);return v}if(u instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&u instanceof SharedArrayBuffer)return u.slice(0);if(u instanceof DataView){const v=new DataView(u.buffer.slice(0),u.byteOffset,u.byteLength);return p.set(u,v),c(v,u,m,p,x),v}if(typeof File<"u"&&u instanceof File){const v=new File([u],u.name,{type:u.type});return p.set(u,v),c(v,u,m,p,x),v}if(typeof Blob<"u"&&u instanceof Blob){const v=new Blob([u],{type:u.type});return p.set(u,v),c(v,u,m,p,x),v}if(u instanceof Error){const v=new u.constructor;return p.set(u,v),v.message=u.message,v.name=u.name,v.stack=u.stack,v.cause=u.cause,c(v,u,m,p,x),v}if(u instanceof Boolean){const v=new Boolean(u.valueOf());return p.set(u,v),c(v,u,m,p,x),v}if(u instanceof Number){const v=new Number(u.valueOf());return p.set(u,v),c(v,u,m,p,x),v}if(u instanceof String){const v=new String(u.valueOf());return p.set(u,v),c(v,u,m,p,x),v}if(typeof u=="object"&&d(u)){const v=Object.create(Object.getPrototypeOf(u));return p.set(u,v),c(v,u,m,p,x),v}return u}function c(u,f,m=u,p,x){const g=[...Object.keys(f),...t.getSymbols(f)];for(let v=0;v<g.length;v++){const y=g[v],b=Object.getOwnPropertyDescriptor(u,y);(b==null||b.writable)&&(u[y]=l(f[y],y,m,p,x))}}function d(u){switch(r.getTag(u)){case n.argumentsTag:case n.arrayTag:case n.arrayBufferTag:case n.dataViewTag:case n.booleanTag:case n.dateTag:case n.float32ArrayTag:case n.float64ArrayTag:case n.int8ArrayTag:case n.int16ArrayTag:case n.int32ArrayTag:case n.mapTag:case n.numberTag:case n.objectTag:case n.regexpTag:case n.setTag:case n.stringTag:case n.symbolTag:case n.uint8ArrayTag:case n.uint8ClampedArrayTag:case n.uint16ArrayTag:case n.uint32ArrayTag:return!0;default:return!1}}e.cloneDeepWith=o,e.cloneDeepWithImpl=l,e.copyProperties=c})(fg);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fg;function r(n){return t.cloneDeepWithImpl(n,void 0,n,new Map,void 0)}e.cloneDeep=r})(E2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lg,r=E2;function n(a){return a=r.cloneDeep(a),i=>t.isMatch(i,a)}e.matches=n})(M2);var T2={},I2={},R2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=fg,r=Of,n=mg;function a(i,o){return t.cloneDeepWith(i,(l,c,d,u)=>{const f=o==null?void 0:o(l,c,d,u);if(f!==void 0)return f;if(typeof i=="object"){if(r.getTag(i)===n.objectTag&&typeof i.constructor!="function"){const m={};return u.set(i,m),t.copyProperties(m,i,d,u),m}switch(Object.prototype.toString.call(i)){case n.numberTag:case n.stringTag:case n.booleanTag:{const m=new i.constructor(i==null?void 0:i.valueOf());return t.copyProperties(m,i),m}case n.argumentsTag:{const m={};return t.copyProperties(m,i),m.length=i.length,m[Symbol.iterator]=i[Symbol.iterator],m}default:return}}})}e.cloneDeepWith=a})(R2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=R2;function r(n){return t.cloneDeepWith(n)}e.cloneDeep=r})(I2);var $2={},hg={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=/^(?:0|[1-9]\d*)$/;function r(n,a=Number.MAX_SAFE_INTEGER){switch(typeof n){case"number":return Number.isInteger(n)&&n>=0&&n<a;case"symbol":return!1;case"string":return t.test(n)}}e.isIndex=r})(hg);var z2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=Of;function r(n){return n!==null&&typeof n=="object"&&t.getTag(n)==="[object Arguments]"}e.isArguments=r})(z2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=ag,r=hg,n=z2,a=Pf;function i(o,l){let c;if(Array.isArray(l)?c=l:typeof l=="string"&&t.isDeepKey(l)&&(o==null?void 0:o[l])==null?c=a.toPath(l):c=[l],c.length===0)return!1;let d=o;for(let u=0;u<c.length;u++){const f=c[u];if((d==null||!Object.hasOwn(d,f))&&!((Array.isArray(d)||n.isArguments(d))&&r.isIndex(f)&&f<d.length))return!1;d=d[f]}return!0}e.has=i})($2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=lg,r=_f,n=I2,a=Cf,i=$2;function o(l,c){switch(typeof l){case"object":{Object.is(l==null?void 0:l.valueOf(),-0)&&(l="-0");break}case"number":{l=r.toKey(l);break}}return c=n.cloneDeep(c),function(d){const u=a.get(d,l);return u===void 0?i.has(d,l):c===void 0?u===void 0:t.isMatch(u,c)}}e.matchesProperty=o})(T2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=og,r=P2,n=M2,a=T2;function i(o){if(o==null)return t.identity;switch(typeof o){case"function":return o;case"object":return Array.isArray(o)&&o.length===2?a.matchesProperty(o[0],o[1]):n.matches(o);case"string":case"symbol":case"number":return r.property(o)}}e.iteratee=i})(_2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=w2,r=N2,n=og,a=k2,i=_2;function o(l,c=n.identity){return a.isArrayLikeObject(l)?t.uniqBy(Array.from(l),r.ary(i.iteratee(c),1)):[]}e.uniqBy=o})(j2);var t8=j2.uniqBy;const g0=Qs(t8);function r8(e,t,r){return t===!0?g0(e,r):typeof t=="function"?g0(e,t):e}var pg=h.createContext(null),n8=e=>e,$t=()=>{var e=h.useContext(pg);return e?e.store.dispatch:n8},Cd=()=>{},s8=()=>Cd,a8=(e,t)=>e===t;function Ae(e){var t=h.useContext(pg),r=h.useMemo(()=>t?n=>{if(n!=null)return e(n)}:Cd,[t,e]);return bA.useSyncExternalStoreWithSelector(t?t.subscription.addNestedSub:s8,t?t.store.getState:Cd,t?t.store.getState:Cd,r,a8)}function i8(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function o8(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function l8(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(n=>typeof n=="function"?`function ${n.name||"unnamed"}()`:typeof n).join(", ");throw new TypeError(`${t}[${r}]`)}}var v0=e=>Array.isArray(e)?e:[e];function c8(e){const t=Array.isArray(e[0])?e[0]:e;return l8(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function d8(e,t){const r=[],{length:n}=e;for(let a=0;a<n;a++)r.push(e[a].apply(null,t));return r}var u8=class{constructor(e){this.value=e}deref(){return this.value}},f8=typeof WeakRef<"u"?WeakRef:u8,m8=0,y0=1;function rd(){return{s:m8,v:void 0,o:null,p:null}}function L2(e,t={}){let r=rd();const{resultEqualityCheck:n}=t;let a,i=0;function o(){var f;let l=r;const{length:c}=arguments;for(let m=0,p=c;m<p;m++){const x=arguments[m];if(typeof x=="function"||typeof x=="object"&&x!==null){let g=l.o;g===null&&(l.o=g=new WeakMap);const v=g.get(x);v===void 0?(l=rd(),g.set(x,l)):l=v}else{let g=l.p;g===null&&(l.p=g=new Map);const v=g.get(x);v===void 0?(l=rd(),g.set(x,l)):l=v}}const d=l;let u;if(l.s===y0)u=l.v;else if(u=e.apply(null,arguments),i++,n){const m=((f=a==null?void 0:a.deref)==null?void 0:f.call(a))??a;m!=null&&n(m,u)&&(u=m,i!==0&&i--),a=typeof u=="object"&&u!==null||typeof u=="function"?new f8(u):u}return d.s=y0,d.v=u,u}return o.clearCache=()=>{r=rd(),o.resetResultsCount()},o.resultsCount=()=>i,o.resetResultsCount=()=>{i=0},o}function h8(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,n=(...a)=>{let i=0,o=0,l,c={},d=a.pop();typeof d=="object"&&(c=d,d=a.pop()),i8(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const u={...r,...c},{memoize:f,memoizeOptions:m=[],argsMemoize:p=L2,argsMemoizeOptions:x=[]}=u,g=v0(m),v=v0(x),y=c8(a),b=f(function(){return i++,d.apply(null,arguments)},...g),N=p(function(){o++;const k=d8(y,arguments);return l=b.apply(null,k),l},...v);return Object.assign(N,{resultFunc:d,memoizedResultFunc:b,dependencies:y,dependencyRecomputations:()=>o,resetDependencyRecomputations:()=>{o=0},lastResult:()=>l,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:f,argsMemoize:p})};return Object.assign(n,{withTypes:()=>n}),n}var ae=h8(L2),p8=Object.assign((e,t=ae)=>{o8(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),n=r.map(i=>e[i]);return t(n,(...i)=>i.reduce((o,l,c)=>(o[r[c]]=l,o),{}))},{withTypes:()=>p8}),F2={},B2={},q2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(n){return typeof n=="symbol"?1:n===null?2:n===void 0?3:n!==n?4:0}const r=(n,a,i)=>{if(n!==a){const o=t(n),l=t(a);if(o===l&&o===0){if(n<a)return i==="desc"?1:-1;if(n>a)return i==="desc"?-1:1}return i==="desc"?l-o:o-l}return 0};e.compareValues=r})(q2);var W2={},xg={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return typeof r=="symbol"||r instanceof Symbol}e.isSymbol=t})(xg);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xg,r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function a(i,o){return Array.isArray(i)?!1:typeof i=="number"||typeof i=="boolean"||i==null||t.isSymbol(i)?!0:typeof i=="string"&&(n.test(i)||!r.test(i))||o!=null&&Object.hasOwn(o,i)}e.isKey=a})(W2);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=q2,r=W2,n=Pf;function a(i,o,l,c){if(i==null)return[];l=c?void 0:l,Array.isArray(i)||(i=Object.values(i)),Array.isArray(o)||(o=o==null?[null]:[o]),o.length===0&&(o=[null]),Array.isArray(l)||(l=l==null?[]:[l]),l=l.map(p=>String(p));const d=(p,x)=>{let g=p;for(let v=0;v<x.length&&g!=null;++v)g=g[x[v]];return g},u=(p,x)=>x==null||p==null?x:typeof p=="object"&&"key"in p?Object.hasOwn(x,p.key)?x[p.key]:d(x,p.path):typeof p=="function"?p(x):Array.isArray(p)?d(x,p):typeof x=="object"?x[p]:x,f=o.map(p=>(Array.isArray(p)&&p.length===1&&(p=p[0]),p==null||typeof p=="function"||Array.isArray(p)||r.isKey(p)?p:{key:p,path:n.toPath(p)}));return i.map(p=>({original:p,criteria:f.map(x=>u(x,p))})).slice().sort((p,x)=>{for(let g=0;g<f.length;g++){const v=t.compareValues(p.criteria[g],x.criteria[g],l[g]);if(v!==0)return v}return 0}).map(p=>p.original)}e.orderBy=a})(B2);var U2={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n=1){const a=[],i=Math.floor(n),o=(l,c)=>{for(let d=0;d<l.length;d++){const u=l[d];Array.isArray(u)&&c<i?o(u,c+1):a.push(u)}};return o(r,0),a}e.flatten=t})(U2);var gg={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=hg,r=Mf,n=cg,a=ug;function i(o,l,c){return n.isObject(c)&&(typeof l=="number"&&r.isArrayLike(c)&&t.isIndex(l)&&l<c.length||typeof l=="string"&&l in c)?a.isEqualsSameValueZero(c[l],o):!1}e.isIterateeCall=i})(gg);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=B2,r=U2,n=gg;function a(i,...o){const l=o.length;return l>1&&n.isIterateeCall(i,o[0],o[1])?o=[]:l>2&&n.isIterateeCall(o[0],o[1],o[2])&&(o=[o[0]]),t.orderBy(i,r.flatten(o),["asc"])}e.sortBy=a})(F2);var x8=F2.sortBy;const Ef=Qs(x8);var H2=e=>e.legend.settings,g8=e=>e.legend.size,v8=e=>e.legend.payload;ae([v8,H2],(e,t)=>{var{itemSorter:r}=t,n=e.flat(1);return r?Ef(n,r):n});var nd=1;function y8(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],[t,r]=h.useState({height:0,left:0,top:0,width:0}),n=h.useCallback(a=>{if(a!=null){var i=a.getBoundingClientRect(),o={height:i.height,left:i.left,top:i.top,width:i.width};(Math.abs(o.height-t.height)>nd||Math.abs(o.left-t.left)>nd||Math.abs(o.top-t.top)>nd||Math.abs(o.width-t.width)>nd)&&r({height:o.height,left:o.left,top:o.top,width:o.width})}},[t.width,t.height,t.top,t.left,...e]);return[t,n]}function dr(e){return`Minified Redux error #${e}; visit https://redux.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var b8=typeof Symbol=="function"&&Symbol.observable||"@@observable",b0=b8,sh=()=>Math.random().toString(36).substring(7).split("").join("."),j8={INIT:`@@redux/INIT${sh()}`,REPLACE:`@@redux/REPLACE${sh()}`,PROBE_UNKNOWN_ACTION:()=>`@@redux/PROBE_UNKNOWN_ACTION${sh()}`},Qd=j8;function vg(e){if(typeof e!="object"||e===null)return!1;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t||Object.getPrototypeOf(e)===null}function K2(e,t,r){if(typeof e!="function")throw new Error(dr(2));if(typeof t=="function"&&typeof r=="function"||typeof r=="function"&&typeof arguments[3]=="function")throw new Error(dr(0));if(typeof t=="function"&&typeof r>"u"&&(r=t,t=void 0),typeof r<"u"){if(typeof r!="function")throw new Error(dr(1));return r(K2)(e,t)}let n=e,a=t,i=new Map,o=i,l=0,c=!1;function d(){o===i&&(o=new Map,i.forEach((v,y)=>{o.set(y,v)}))}function u(){if(c)throw new Error(dr(3));return a}function f(v){if(typeof v!="function")throw new Error(dr(4));if(c)throw new Error(dr(5));let y=!0;d();const b=l++;return o.set(b,v),function(){if(y){if(c)throw new Error(dr(6));y=!1,d(),o.delete(b),i=null}}}function m(v){if(!vg(v))throw new Error(dr(7));if(typeof v.type>"u")throw new Error(dr(8));if(typeof v.type!="string")throw new Error(dr(17));if(c)throw new Error(dr(9));try{c=!0,a=n(a,v)}finally{c=!1}return(i=o).forEach(b=>{b()}),v}function p(v){if(typeof v!="function")throw new Error(dr(10));n=v,m({type:Qd.REPLACE})}function x(){const v=f;return{subscribe(y){if(typeof y!="object"||y===null)throw new Error(dr(11));function b(){const j=y;j.next&&j.next(u())}return b(),{unsubscribe:v(b)}},[b0](){return this}}}return m({type:Qd.INIT}),{dispatch:m,subscribe:f,getState:u,replaceReducer:p,[b0]:x}}function w8(e){Object.keys(e).forEach(t=>{const r=e[t];if(typeof r(void 0,{type:Qd.INIT})>"u")throw new Error(dr(12));if(typeof r(void 0,{type:Qd.PROBE_UNKNOWN_ACTION()})>"u")throw new Error(dr(13))})}function Y2(e){const t=Object.keys(e),r={};for(let i=0;i<t.length;i++){const o=t[i];typeof e[o]=="function"&&(r[o]=e[o])}const n=Object.keys(r);let a;try{w8(r)}catch(i){a=i}return function(o={},l){if(a)throw a;let c=!1;const d={};for(let u=0;u<n.length;u++){const f=n[u],m=r[f],p=o[f],x=m(p,l);if(typeof x>"u")throw l&&l.type,new Error(dr(14));d[f]=x,c=c||x!==p}return c=c||n.length!==Object.keys(o).length,c?d:o}}function Zd(...e){return e.length===0?t=>t:e.length===1?e[0]:e.reduce((t,r)=>(...n)=>t(r(...n)))}function N8(...e){return t=>(r,n)=>{const a=t(r,n);let i=()=>{throw new Error(dr(15))};const o={getState:a.getState,dispatch:(c,...d)=>i(c,...d)},l=e.map(c=>c(o));return i=Zd(...l)(a.dispatch),{...a,dispatch:i}}}function G2(e){return vg(e)&&"type"in e&&typeof e.type=="string"}var V2=Symbol.for("immer-nothing"),j0=Symbol.for("immer-draftable"),Rr=Symbol.for("immer-state");function zn(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var ln=Object,ho=ln.getPrototypeOf,Jd="constructor",Af="prototype",np="configurable",eu="enumerable",_d="writable",zl="value",Us=e=>!!e&&!!e[Rr];function Kn(e){var t;return e?X2(e)||Tf(e)||!!e[j0]||!!((t=e[Jd])!=null&&t[j0])||If(e)||Rf(e):!1}var k8=ln[Af][Jd].toString(),w0=new WeakMap;function X2(e){if(!e||!yg(e))return!1;const t=ho(e);if(t===null||t===ln[Af])return!0;const r=ln.hasOwnProperty.call(t,Jd)&&t[Jd];if(r===Object)return!0;if(!Yi(r))return!1;let n=w0.get(r);return n===void 0&&(n=Function.toString.call(r),w0.set(r,n)),n===k8}function Df(e,t,r=!0){Nc(e)===0?(r?Reflect.ownKeys(e):ln.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function Nc(e){const t=e[Rr];return t?t.type_:Tf(e)?1:If(e)?2:Rf(e)?3:0}var N0=(e,t,r=Nc(e))=>r===2?e.has(t):ln[Af].hasOwnProperty.call(e,t),sp=(e,t,r=Nc(e))=>r===2?e.get(t):e[t],tu=(e,t,r,n=Nc(e))=>{n===2?e.set(t,r):n===3?e.add(r):e[t]=r};function S8(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Tf=Array.isArray,If=e=>e instanceof Map,Rf=e=>e instanceof Set,yg=e=>typeof e=="object",Yi=e=>typeof e=="function",ah=e=>typeof e=="boolean";function C8(e){const t=+e;return Number.isInteger(t)&&String(t)===e}var Ss=e=>e.copy_||e.base_,bg=e=>e.modified_?e.copy_:e.base_;function ap(e,t){if(If(e))return new Map(e);if(Rf(e))return new Set(e);if(Tf(e))return Array[Af].slice.call(e);const r=X2(e);if(t===!0||t==="class_only"&&!r){const n=ln.getOwnPropertyDescriptors(e);delete n[Rr];let a=Reflect.ownKeys(n);for(let i=0;i<a.length;i++){const o=a[i],l=n[o];l[_d]===!1&&(l[_d]=!0,l[np]=!0),(l.get||l.set)&&(n[o]={[np]:!0,[_d]:!0,[eu]:l[eu],[zl]:e[o]})}return ln.create(ho(e),n)}else{const n=ho(e);if(n!==null&&r)return{...e};const a=ln.create(n);return ln.assign(a,e)}}function jg(e,t=!1){return $f(e)||Us(e)||!Kn(e)||(Nc(e)>1&&ln.defineProperties(e,{set:sd,add:sd,clear:sd,delete:sd}),ln.freeze(e),t&&Df(e,(r,n)=>{jg(n,!0)},!1)),e}function _8(){zn(2)}var sd={[zl]:_8};function $f(e){return e===null||!yg(e)?!0:ln.isFrozen(e)}var ru="MapSet",ip="Patches",k0="ArrayMethods",Q2={};function bi(e){const t=Q2[e];return t||zn(0,e),t}var S0=e=>!!Q2[e],Ll,Z2=()=>Ll,P8=(e,t)=>({drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0,handledSet_:new Set,processedForPatches_:new Set,mapSetPlugin_:S0(ru)?bi(ru):void 0,arrayMethodsPlugin_:S0(k0)?bi(k0):void 0});function C0(e,t){t&&(e.patchPlugin_=bi(ip),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function op(e){lp(e),e.drafts_.forEach(M8),e.drafts_=null}function lp(e){e===Ll&&(Ll=e.parent_)}var _0=e=>Ll=P8(Ll,e);function M8(e){const t=e[Rr];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function P0(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];if(e!==void 0&&e!==r){r[Rr].modified_&&(op(t),zn(4)),Kn(e)&&(e=M0(t,e));const{patchPlugin_:a}=t;a&&a.generateReplacementPatches_(r[Rr].base_,e,t)}else e=M0(t,r);return O8(t,e,!0),op(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==V2?e:void 0}function M0(e,t){if($f(t))return t;const r=t[Rr];if(!r)return nu(t,e.handledSet_,e);if(!zf(r,e))return t;if(!r.modified_)return r.base_;if(!r.finalized_){const{callbacks_:n}=r;if(n)for(;n.length>0;)n.pop()(e);tC(r,e)}return r.copy_}function O8(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&jg(t,r)}function J2(e){e.finalized_=!0,e.scope_.unfinalizedDrafts_--}var zf=(e,t)=>e.scope_===t,E8=[];function eC(e,t,r,n){const a=Ss(e),i=e.type_;if(n!==void 0&&sp(a,n,i)===t){tu(a,n,r,i);return}if(!e.draftLocations_){const l=e.draftLocations_=new Map;Df(a,(c,d)=>{if(Us(d)){const u=l.get(d)||[];u.push(c),l.set(d,u)}})}const o=e.draftLocations_.get(t)??E8;for(const l of o)tu(a,l,r,i)}function A8(e,t,r){e.callbacks_.push(function(a){var l;const i=t;if(!i||!zf(i,a))return;(l=a.mapSetPlugin_)==null||l.fixSetContents(i);const o=bg(i);eC(e,i.draft_??i,o,r),tC(i,a)})}function tC(e,t){var n;if(e.modified_&&!e.finalized_&&(e.type_===3||e.type_===1&&e.allIndicesReassigned_||(((n=e.assigned_)==null?void 0:n.size)??0)>0)){const{patchPlugin_:a}=t;if(a){const i=a.getPath(e);i&&a.generatePatches_(e,i,t)}J2(e)}}function D8(e,t,r){const{scope_:n}=e;if(Us(r)){const a=r[Rr];zf(a,n)&&a.callbacks_.push(function(){Pd(e);const o=bg(a);eC(e,r,o,t)})}else Kn(r)&&e.callbacks_.push(function(){const i=Ss(e);e.type_===3?i.has(r)&&nu(r,n.handledSet_,n):sp(i,t,e.type_)===r&&n.drafts_.length>1&&(e.assigned_.get(t)??!1)===!0&&e.copy_&&nu(sp(e.copy_,t,e.type_),n.handledSet_,n)})}function nu(e,t,r){return!r.immer_.autoFreeze_&&r.unfinalizedDrafts_<1||Us(e)||t.has(e)||!Kn(e)||$f(e)||(t.add(e),Df(e,(n,a)=>{if(Us(a)){const i=a[Rr];if(zf(i,r)){const o=bg(i);tu(e,n,o,e.type_),J2(i)}}else Kn(a)&&nu(a,t,r)})),e}function T8(e,t){const r=Tf(e),n={type_:r?1:0,scope_:t?t.scope_:Z2(),modified_:!1,finalized_:!1,assigned_:void 0,parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1,callbacks_:void 0};let a=n,i=su;r&&(a=[n],i=Fl);const{revoke:o,proxy:l}=Proxy.revocable(a,i);return n.draft_=l,n.revoke_=o,[l,n]}var su={get(e,t){if(t===Rr)return e;let r=e.scope_.arrayMethodsPlugin_;const n=e.type_===1&&typeof t=="string";if(n&&r!=null&&r.isArrayOperationMethod(t))return r.createMethodInterceptor(e,t);const a=Ss(e);if(!N0(a,t,e.type_))return I8(e,a,t);const i=a[t];if(e.finalized_||!Kn(i)||n&&e.operationMethod&&(r!=null&&r.isMutatingArrayMethod(e.operationMethod))&&C8(t))return i;if(i===ih(e.base_,t)){Pd(e);const o=e.type_===1?+t:t,l=dp(e.scope_,i,e,o);return e.copy_[o]=l}return i},has(e,t){return t in Ss(e)},ownKeys(e){return Reflect.ownKeys(Ss(e))},set(e,t,r){const n=rC(Ss(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=ih(Ss(e),t),i=a==null?void 0:a[Rr];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_.set(t,!1),!0;if(S8(r,a)&&(r!==void 0||N0(e.base_,t,e.type_)))return!0;Pd(e),cp(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_.set(t,!0),D8(e,t,r)),!0},deleteProperty(e,t){return Pd(e),ih(e.base_,t)!==void 0||t in e.base_?(e.assigned_.set(t,!1),cp(e)):e.assigned_.delete(t),e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Ss(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{[_d]:!0,[np]:e.type_!==1||t!=="length",[eu]:n[eu],[zl]:r[t]}},defineProperty(){zn(11)},getPrototypeOf(e){return ho(e.base_)},setPrototypeOf(){zn(12)}},Fl={};for(let e in su){let t=su[e];Fl[e]=function(){const r=arguments;return r[0]=r[0][0],t.apply(this,r)}}Fl.deleteProperty=function(e,t){return Fl.set.call(this,e,t,void 0)};Fl.set=function(e,t,r){return su.set.call(this,e[0],t,r,e[0])};function ih(e,t){const r=e[Rr];return(r?Ss(r):e)[t]}function I8(e,t,r){var a;const n=rC(t,r);return n?zl in n?n[zl]:(a=n.get)==null?void 0:a.call(e.draft_):void 0}function rC(e,t){if(!(t in e))return;let r=ho(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=ho(r)}}function cp(e){e.modified_||(e.modified_=!0,e.parent_&&cp(e.parent_))}function Pd(e){e.copy_||(e.assigned_=new Map,e.copy_=ap(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var R8=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!1,this.produce=(r,n,a)=>{if(Yi(r)&&!Yi(n)){const o=n;n=r;const l=this;return function(d=o,...u){return l.produce(d,f=>n.call(this,f,...u))}}Yi(n)||zn(6),a!==void 0&&!Yi(a)&&zn(7);let i;if(Kn(r)){const o=_0(this),l=dp(o,r,void 0);let c=!0;try{i=n(l),c=!1}finally{c?op(o):lp(o)}return C0(o,a),P0(i,o)}else if(!r||!yg(r)){if(i=n(r),i===void 0&&(i=r),i===V2&&(i=void 0),this.autoFreeze_&&jg(i,!0),a){const o=[],l=[];bi(ip).generateReplacementPatches_(r,i,{patches_:o,inversePatches_:l}),a(o,l)}return i}else zn(1,r)},this.produceWithPatches=(r,n)=>{if(Yi(r))return(l,...c)=>this.produceWithPatches(l,d=>r(d,...c));let a,i;return[this.produce(r,n,(l,c)=>{a=l,i=c}),a,i]},ah(t==null?void 0:t.autoFreeze)&&this.setAutoFreeze(t.autoFreeze),ah(t==null?void 0:t.useStrictShallowCopy)&&this.setUseStrictShallowCopy(t.useStrictShallowCopy),ah(t==null?void 0:t.useStrictIteration)&&this.setUseStrictIteration(t.useStrictIteration)}createDraft(t){Kn(t)||zn(8),Us(t)&&(t=Un(t));const r=_0(this),n=dp(r,t,void 0);return n[Rr].isManual_=!0,lp(r),n}finishDraft(t,r){const n=t&&t[Rr];(!n||!n.isManual_)&&zn(9);const{scope_:a}=n;return C0(a,r),P0(void 0,a)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}setUseStrictIteration(t){this.useStrictIteration_=t}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(t,r){let n;for(n=r.length-1;n>=0;n--){const i=r[n];if(i.path.length===0&&i.op==="replace"){t=i.value;break}}n>-1&&(r=r.slice(n+1));const a=bi(ip).applyPatches_;return Us(t)?a(t,r):this.produce(t,i=>a(i,r))}};function dp(e,t,r,n){const[a,i]=If(t)?bi(ru).proxyMap_(t,r):Rf(t)?bi(ru).proxySet_(t,r):T8(t,r);return((r==null?void 0:r.scope_)??Z2()).drafts_.push(a),i.callbacks_=(r==null?void 0:r.callbacks_)??[],i.key_=n,r&&n!==void 0?A8(r,i,n):i.callbacks_.push(function(c){var u;(u=c.mapSetPlugin_)==null||u.fixSetContents(i);const{patchPlugin_:d}=c;i.modified_&&d&&d.generatePatches_(i,[],c)}),a}function Un(e){return Us(e)||zn(10,e),nC(e)}function nC(e){if(!Kn(e)||$f(e))return e;const t=e[Rr];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=ap(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=ap(e,!0);return Df(r,(a,i)=>{tu(r,a,nC(i))},n),t&&(t.finalized_=!1),r}var $8=new R8,sC=$8.produce;function aC(e){return({dispatch:r,getState:n})=>a=>i=>typeof i=="function"?i(r,n,e):a(i)}var z8=aC(),L8=aC,F8=typeof window<"u"&&window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__?window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__:function(){if(arguments.length!==0)return typeof arguments[0]=="object"?Zd:Zd.apply(null,arguments)};function On(e,t){function r(...n){if(t){let a=t(...n);if(!a)throw new Error(cn(0));return{type:e,payload:a.payload,..."meta"in a&&{meta:a.meta},..."error"in a&&{error:a.error}}}return{type:e,payload:n[0]}}return r.toString=()=>`${e}`,r.type=e,r.match=n=>G2(n)&&n.type===e,r}var iC=class Nl extends Array{constructor(...t){super(...t),Object.setPrototypeOf(this,Nl.prototype)}static get[Symbol.species](){return Nl}concat(...t){return super.concat.apply(this,t)}prepend(...t){return t.length===1&&Array.isArray(t[0])?new Nl(...t[0].concat(this)):new Nl(...t.concat(this))}};function O0(e){return Kn(e)?sC(e,()=>{}):e}function ad(e,t,r){return e.has(t)?e.get(t):e.set(t,r(t)).get(t)}function B8(e){return typeof e=="boolean"}var q8=()=>function(t){const{thunk:r=!0,immutableCheck:n=!0,serializableCheck:a=!0,actionCreatorCheck:i=!0}=t??{};let o=new iC;return r&&(B8(r)?o.push(z8):o.push(L8(r.extraArgument))),o},oC="RTK_autoBatch",yt=()=>e=>({payload:e,meta:{[oC]:!0}}),E0=e=>t=>{setTimeout(t,e)},lC=(e={type:"raf"})=>t=>(...r)=>{const n=t(...r);let a=!0,i=!1,o=!1;const l=new Set,c=e.type==="tick"?queueMicrotask:e.type==="raf"?typeof window<"u"&&window.requestAnimationFrame?window.requestAnimationFrame:E0(10):e.type==="callback"?e.queueNotification:E0(e.timeout),d=()=>{o=!1,i&&(i=!1,l.forEach(u=>u()))};return Object.assign({},n,{subscribe(u){const f=()=>a&&u(),m=n.subscribe(f);return l.add(u),()=>{m(),l.delete(u)}},dispatch(u){var f;try{return a=!((f=u==null?void 0:u.meta)!=null&&f[oC]),i=!a,i&&(o||(o=!0,c(d))),n.dispatch(u)}finally{a=!0}}})},W8=e=>function(r){const{autoBatch:n=!0}=r??{};let a=new iC(e);return n&&a.push(lC(typeof n=="object"?n:void 0)),a};function U8(e){const t=q8(),{reducer:r=void 0,middleware:n,devTools:a=!0,preloadedState:i=void 0,enhancers:o=void 0}=e||{};let l;if(typeof r=="function")l=r;else if(vg(r))l=Y2(r);else throw new Error(cn(1));let c;typeof n=="function"?c=n(t):c=t();let d=Zd;a&&(d=F8({trace:!1,...typeof a=="object"&&a}));const u=N8(...c),f=W8(u);let m=typeof o=="function"?o(f):f();const p=d(...m);return K2(l,i,p)}function cC(e){const t={},r=[];let n;const a={addCase(i,o){const l=typeof i=="string"?i:i.type;if(!l)throw new Error(cn(28));if(l in t)throw new Error(cn(29));return t[l]=o,a},addAsyncThunk(i,o){return o.pending&&(t[i.pending.type]=o.pending),o.rejected&&(t[i.rejected.type]=o.rejected),o.fulfilled&&(t[i.fulfilled.type]=o.fulfilled),o.settled&&r.push({matcher:i.settled,reducer:o.settled}),a},addMatcher(i,o){return r.push({matcher:i,reducer:o}),a},addDefaultCase(i){return n=i,a}};return e(a),[t,r,n]}function H8(e){return typeof e=="function"}function K8(e,t){let[r,n,a]=cC(t),i;if(H8(e))i=()=>O0(e());else{const l=O0(e);i=()=>l}function o(l=i(),c){let d=[r[c.type],...n.filter(({matcher:u})=>u(c)).map(({reducer:u})=>u)];return d.filter(u=>!!u).length===0&&(d=[a]),d.reduce((u,f)=>{if(f)if(Us(u)){const p=f(u,c);return p===void 0?u:p}else{if(Kn(u))return sC(u,m=>f(m,c));{const m=f(u,c);if(m===void 0){if(u===null)return u;throw Error("A case reducer on a non-draftable value must not return undefined")}return m}}return u},l)}return o.getInitialState=i,o}var Y8="ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW",G8=(e=21)=>{let t="",r=e;for(;r--;)t+=Y8[Math.random()*64|0];return t},V8=Symbol.for("rtk-slice-createasyncthunk");function X8(e,t){return`${e}/${t}`}function Q8({creators:e}={}){var r;const t=(r=e==null?void 0:e.asyncThunk)==null?void 0:r[V8];return function(a){const{name:i,reducerPath:o=i}=a;if(!i)throw new Error(cn(11));const l=(typeof a.reducers=="function"?a.reducers(J8()):a.reducers)||{},c=Object.keys(l),d={sliceCaseReducersByName:{},sliceCaseReducersByType:{},actionCreators:{},sliceMatchers:[]},u={addCase(j,k){const w=typeof j=="string"?j:j.type;if(!w)throw new Error(cn(12));if(w in d.sliceCaseReducersByType)throw new Error(cn(13));return d.sliceCaseReducersByType[w]=k,u},addMatcher(j,k){return d.sliceMatchers.push({matcher:j,reducer:k}),u},exposeAction(j,k){return d.actionCreators[j]=k,u},exposeCaseReducer(j,k){return d.sliceCaseReducersByName[j]=k,u}};c.forEach(j=>{const k=l[j],w={reducerName:j,type:X8(i,j),createNotation:typeof a.reducers=="function"};tB(k)?nB(w,k,u,t):eB(w,k,u)});function f(){const[j={},k=[],w=void 0]=typeof a.extraReducers=="function"?cC(a.extraReducers):[a.extraReducers],S={...j,...d.sliceCaseReducersByType};return K8(a.initialState,_=>{for(let C in S)_.addCase(C,S[C]);for(let C of d.sliceMatchers)_.addMatcher(C.matcher,C.reducer);for(let C of k)_.addMatcher(C.matcher,C.reducer);w&&_.addDefaultCase(w)})}const m=j=>j,p=new Map,x=new WeakMap;let g;function v(j,k){return g||(g=f()),g(j,k)}function y(){return g||(g=f()),g.getInitialState()}function b(j,k=!1){function w(_){let C=_[j];return typeof C>"u"&&k&&(C=ad(x,w,y)),C}function S(_=m){const C=ad(p,k,()=>new WeakMap);return ad(C,_,()=>{const P={};for(const[O,E]of Object.entries(a.selectors??{}))P[O]=Z8(E,_,()=>ad(x,_,y),k);return P})}return{reducerPath:j,getSelectors:S,get selectors(){return S(w)},selectSlice:w}}const N={name:i,reducer:v,actions:d.actionCreators,caseReducers:d.sliceCaseReducersByName,getInitialState:y,...b(o),injectInto(j,{reducerPath:k,...w}={}){const S=k??o;return j.inject({reducerPath:S,reducer:v},w),{...N,...b(S,!0)}}};return N}}function Z8(e,t,r,n){function a(i,...o){let l=t(i);return typeof l>"u"&&n&&(l=r()),e(l,...o)}return a.unwrapped=e,a}var en=Q8();function J8(){function e(t,r){return{_reducerDefinitionType:"asyncThunk",payloadCreator:t,...r}}return e.withTypes=()=>e,{reducer(t){return Object.assign({[t.name](...r){return t(...r)}}[t.name],{_reducerDefinitionType:"reducer"})},preparedReducer(t,r){return{_reducerDefinitionType:"reducerWithPrepare",prepare:t,reducer:r}},asyncThunk:e}}function eB({type:e,reducerName:t,createNotation:r},n,a){let i,o;if("reducer"in n){if(r&&!rB(n))throw new Error(cn(17));i=n.reducer,o=n.prepare}else i=n;a.addCase(e,i).exposeCaseReducer(t,i).exposeAction(t,o?On(e,o):On(e))}function tB(e){return e._reducerDefinitionType==="asyncThunk"}function rB(e){return e._reducerDefinitionType==="reducerWithPrepare"}function nB({type:e,reducerName:t},r,n,a){if(!a)throw new Error(cn(18));const{payloadCreator:i,fulfilled:o,pending:l,rejected:c,settled:d,options:u}=r,f=a(e,i,u);n.exposeAction(t,f),o&&n.addCase(f.fulfilled,o),l&&n.addCase(f.pending,l),c&&n.addCase(f.rejected,c),d&&n.addMatcher(f.settled,d),n.exposeCaseReducer(t,{fulfilled:o||id,pending:l||id,rejected:c||id,settled:d||id})}function id(){}var sB="task",dC="listener",uC="completed",wg="cancelled",aB=`task-${wg}`,iB=`task-${uC}`,up=`${dC}-${wg}`,oB=`${dC}-${uC}`,Lf=class{constructor(e){Cm(this,"name","TaskAbortError");Cm(this,"message");this.code=e,this.message=`${sB} ${wg} (reason: ${e})`}},Ng=(e,t)=>{if(typeof e!="function")throw new TypeError(cn(32))},au=()=>{},fC=(e,t=au)=>(e.catch(t),e),mC=(e,t)=>(e.addEventListener("abort",t,{once:!0}),()=>e.removeEventListener("abort",t)),ci=e=>{if(e.aborted)throw new Lf(e.reason)};function hC(e,t){let r=au;return new Promise((n,a)=>{const i=()=>a(new Lf(e.reason));if(e.aborted){i();return}r=mC(e,i),t.finally(()=>r()).then(n,a)}).finally(()=>{r=au})}var lB=async(e,t)=>{try{return await Promise.resolve(),{status:"ok",value:await e()}}catch(r){return{status:r instanceof Lf?"cancelled":"rejected",error:r}}finally{t==null||t()}},iu=e=>t=>fC(hC(e,t).then(r=>(ci(e),r))),pC=e=>{const t=iu(e);return r=>t(new Promise(n=>setTimeout(n,r)))},{assign:eo}=Object,A0={},Ff="listenerMiddleware",cB=(e,t)=>{const r=n=>mC(e,()=>n.abort(e.reason));return(n,a)=>{Ng(n);const i=new AbortController;r(i);const o=lB(async()=>{ci(e),ci(i.signal);const l=await n({pause:iu(i.signal),delay:pC(i.signal),signal:i.signal});return ci(i.signal),l},()=>i.abort(iB));return a!=null&&a.autoJoin&&t.push(o.catch(au)),{result:iu(e)(o),cancel(){i.abort(aB)}}}},dB=(e,t)=>{const r=async(n,a)=>{ci(t);let i=()=>{};const l=[new Promise((c,d)=>{let u=e({predicate:n,effect:(f,m)=>{m.unsubscribe(),c([f,m.getState(),m.getOriginalState()])}});i=()=>{u(),d()}})];a!=null&&l.push(new Promise(c=>setTimeout(c,a,null)));try{const c=await hC(t,Promise.race(l));return ci(t),c}finally{i()}};return(n,a)=>fC(r(n,a))},xC=e=>{let{type:t,actionCreator:r,matcher:n,predicate:a,effect:i}=e;if(t)a=On(t).match;else if(r)t=r.type,a=r.match;else if(n)a=n;else if(!a)throw new Error(cn(21));return Ng(i),{predicate:a,type:t,effect:i}},gC=eo(e=>{const{type:t,predicate:r,effect:n}=xC(e);return{id:G8(),effect:n,type:t,predicate:r,pending:new Set,unsubscribe:()=>{throw new Error(cn(22))}}},{withTypes:()=>gC}),D0=(e,t)=>{const{type:r,effect:n,predicate:a}=xC(t);return Array.from(e.values()).find(i=>(typeof r=="string"?i.type===r:i.predicate===a)&&i.effect===n)},fp=e=>{e.pending.forEach(t=>{t.abort(up)})},uB=(e,t)=>()=>{for(const r of t.keys())fp(r);e.clear()},T0=(e,t,r)=>{try{e(t,r)}catch(n){setTimeout(()=>{throw n},0)}},vC=eo(On(`${Ff}/add`),{withTypes:()=>vC}),fB=On(`${Ff}/removeAll`),yC=eo(On(`${Ff}/remove`),{withTypes:()=>yC}),mB=(...e)=>{console.error(`${Ff}/error`,...e)},kc=(e={})=>{const t=new Map,r=new Map,n=p=>{const x=r.get(p)??0;r.set(p,x+1)},a=p=>{const x=r.get(p)??1;x===1?r.delete(p):r.set(p,x-1)},{extra:i,onError:o=mB}=e;Ng(o);const l=p=>(p.unsubscribe=()=>t.delete(p.id),t.set(p.id,p),x=>{p.unsubscribe(),x!=null&&x.cancelActive&&fp(p)}),c=p=>{const x=D0(t,p)??gC(p);return l(x)};eo(c,{withTypes:()=>c});const d=p=>{const x=D0(t,p);return x&&(x.unsubscribe(),p.cancelActive&&fp(x)),!!x};eo(d,{withTypes:()=>d});const u=async(p,x,g,v)=>{const y=new AbortController,b=dB(c,y.signal),N=[];try{p.pending.add(y),n(p),await Promise.resolve(p.effect(x,eo({},g,{getOriginalState:v,condition:(j,k)=>b(j,k).then(Boolean),take:b,delay:pC(y.signal),pause:iu(y.signal),extra:i,signal:y.signal,fork:cB(y.signal,N),unsubscribe:p.unsubscribe,subscribe:()=>{t.set(p.id,p)},cancelActiveListeners:()=>{p.pending.forEach((j,k,w)=>{j!==y&&(j.abort(up),w.delete(j))})},cancel:()=>{y.abort(up),p.pending.delete(y)},throwIfCancelled:()=>{ci(y.signal)}})))}catch(j){j instanceof Lf||T0(o,j,{raisedBy:"effect"})}finally{await Promise.all(N),y.abort(oB),a(p),p.pending.delete(y)}},f=uB(t,r);return{middleware:p=>x=>g=>{if(!G2(g))return x(g);if(vC.match(g))return c(g.payload);if(fB.match(g)){f();return}if(yC.match(g))return d(g.payload);let v=p.getState();const y=()=>{if(v===A0)throw new Error(cn(23));return v};let b;try{if(b=x(g),t.size>0){const N=p.getState(),j=Array.from(t.values());for(const k of j){let w=!1;try{w=k.predicate(g,N,v)}catch(S){w=!1,T0(o,S,{raisedBy:"predicate"})}w&&u(k,g,p,y)}}}finally{v=A0}return b},startListening:c,stopListening:d,clearListeners:f}};function cn(e){return`Minified Redux Toolkit error #${e}; visit https://redux-toolkit.js.org/Errors?code=${e} for the full message or use the non-minified dev environment for full errors. `}var hB={layoutType:"horizontal",width:0,height:0,margin:{top:5,right:5,bottom:5,left:5},scale:1},bC=en({name:"chartLayout",initialState:hB,reducers:{setLayout(e,t){e.layoutType=t.payload},setChartSize(e,t){e.width=t.payload.width,e.height=t.payload.height},setMargin(e,t){var r,n,a,i;e.margin.top=(r=t.payload.top)!==null&&r!==void 0?r:0,e.margin.right=(n=t.payload.right)!==null&&n!==void 0?n:0,e.margin.bottom=(a=t.payload.bottom)!==null&&a!==void 0?a:0,e.margin.left=(i=t.payload.left)!==null&&i!==void 0?i:0},setScale(e,t){e.scale=t.payload}}}),{setMargin:pB,setLayout:xB,setChartSize:gB,setScale:vB}=bC.actions,yB=bC.reducer;function jC(e,t,r){return Array.isArray(e)&&e&&t+r!==0?e.slice(t,r+1):e}function Ye(e){return Number.isFinite(e)}function ps(e){return typeof e=="number"&&e>0&&Number.isFinite(e)}function I0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Gi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?I0(Object(r),!0).forEach(function(n){bB(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function bB(e,t,r){return(t=jB(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function jB(e){var t=wB(e,"string");return typeof t=="symbol"?t:t+""}function wB(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Jt(e,t,r){return Bt(e)||Bt(t)?r:hs(t)?mo(e,t,r):typeof t=="function"?t(e):r}var NB=(e,t,r)=>{if(t&&r){var{width:n,height:a}=r,{align:i,verticalAlign:o,layout:l}=t;if((l==="vertical"||l==="horizontal"&&o==="middle")&&i!=="center"&&Ce(e[i]))return Gi(Gi({},e),{},{[i]:e[i]+(n||0)});if((l==="horizontal"||l==="vertical"&&i==="center")&&o!=="middle"&&Ce(e[o]))return Gi(Gi({},e),{},{[o]:e[o]+(a||0)})}return e},Fa=(e,t)=>e==="horizontal"&&t==="xAxis"||e==="vertical"&&t==="yAxis"||e==="centric"&&t==="angleAxis"||e==="radial"&&t==="radiusAxis",wC=(e,t,r,n)=>{if(n)return e.map(l=>l.coordinate);var a,i,o=e.map(l=>(l.coordinate===t&&(a=!0),l.coordinate===r&&(i=!0),l.coordinate));return a||o.push(t),i||o.push(r),o},NC=(e,t,r)=>{if(!e)return null;var{duplicateDomain:n,type:a,range:i,scale:o,realScaleType:l,isCategorical:c,categoricalDomain:d,tickCount:u,ticks:f,niceTicks:m,axisType:p}=e;if(!o)return null;var x=l==="scaleBand"&&o.bandwidth?o.bandwidth()/2:2,g=a==="category"&&o.bandwidth?o.bandwidth()/x:0;if(g=p==="angleAxis"&&i&&i.length>=2?Ur(i[0]-i[1])*2*g:g,f||m){var v=(f||m||[]).map((y,b)=>{var N=n?n.indexOf(y):y,j=o.map(N);return Ye(j)?{coordinate:j+g,value:y,offset:g,index:b}:null}).filter(Hr);return v}return c&&d?d.map((y,b)=>{var N=o.map(y);return Ye(N)?{coordinate:N+g,value:y,index:b,offset:g}:null}).filter(Hr):o.ticks&&u!=null?o.ticks(u).map((y,b)=>{var N=o.map(y);return Ye(N)?{coordinate:N+g,value:y,index:b,offset:g}:null}).filter(Hr):o.domain().map((y,b)=>{var N=o.map(y);return Ye(N)?{coordinate:N+g,value:n?n[y]:y,index:b,offset:g}:null}).filter(Hr)},kB=(e,t)=>{if(!t||t.length!==2||!Ce(t[0])||!Ce(t[1]))return e;var r=Math.min(t[0],t[1]),n=Math.max(t[0],t[1]),a=[e[0],e[1]];return(!Ce(e[0])||e[0]<r)&&(a[0]=r),(!Ce(e[1])||e[1]>n)&&(a[1]=n),a[0]>n&&(a[0]=n),a[1]<r&&(a[1]=r),a},SB=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var a=0;a<n;++a)for(var i=0,o=0,l=0;l<r;++l){var c=e[l],d=c==null?void 0:c[a];if(d!=null){var u=d[1],f=d[0],m=ms(u)?f:u;m>=0?(d[0]=i,i+=m,d[1]=i):(d[0]=o,o+=m,d[1]=o)}}}},CB=e=>{var t,r=e.length;if(!(r<=0)){var n=(t=e[0])===null||t===void 0?void 0:t.length;if(!(n==null||n<=0))for(var a=0;a<n;++a)for(var i=0,o=0;o<r;++o){var l=e[o],c=l==null?void 0:l[a];if(c!=null){var d=ms(c[1])?c[0]:c[1];d>=0?(c[0]=i,i+=d,c[1]=i):(c[0]=0,c[1]=0)}}}},_B={sign:SB,expand:DF,none:vi,silhouette:TF,wiggle:IF,positive:CB},PB=(e,t,r)=>{var n,a=(n=_B[r])!==null&&n!==void 0?n:vi,i=AF().keys(t).value((l,c)=>Number(Jt(l,c,0))).order(tp).offset(a),o=i(e);return o.forEach((l,c)=>{l.forEach((d,u)=>{var f=Jt(e[u],t[c],0);Array.isArray(f)&&f.length===2&&Ce(f[0])&&Ce(f[1])&&(d[0]=f[0],d[1]=f[1])})}),o};function MB(e){return e==null?void 0:String(e)}function ene(e){var{axis:t,ticks:r,bandSize:n,entry:a,index:i,dataKey:o}=e;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Bt(a[t.dataKey])){var l=g2(r,"value",a[t.dataKey]);if(l)return l.coordinate+n/2}return r!=null&&r[i]?r[i].coordinate+n/2:null}var c=Jt(a,Bt(o)?t.dataKey:o),d=t.scale.map(c);return Ce(d)?d:null}var R0=e=>{var{axis:t,ticks:r,offset:n,bandSize:a,entry:i,index:o}=e;if(t.type==="category")return r[o]?r[o].coordinate+n:null;var l=Jt(i,t.dataKey,t.scale.domain()[o]);if(Bt(l))return null;var c=t.scale.map(l);return Ce(c)?c-a/2+n:null},OB=e=>{var{numericAxis:t}=e,r=t.scale.domain();if(t.type==="number"){var n=Math.min(r[0],r[1]),a=Math.max(r[0],r[1]);return n<=0&&a>=0?0:a<0?a:n}return r[0]},EB=e=>{var t=e.flat(2).filter(Ce);return[Math.min(...t),Math.max(...t)]},AB=e=>[e[0]===1/0?0:e[0],e[1]===-1/0?0:e[1]],DB=(e,t,r)=>{if(e!=null)return AB(Object.keys(e).reduce((n,a)=>{var i=e[a];if(!i)return n;var{stackedData:o}=i,l=o.reduce((c,d)=>{var u=jC(d,t,r),f=EB(u);return!Ye(f[0])||!Ye(f[1])?c:[Math.min(c[0],f[0]),Math.max(c[1],f[1])]},[1/0,-1/0]);return[Math.min(l[0],n[0]),Math.max(l[1],n[1])]},[1/0,-1/0]))},$0=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,z0=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ou=(e,t,r)=>{if(e&&e.scale&&e.scale.bandwidth){var n=e.scale.bandwidth();if(!r||n>0)return n}if(e&&t&&t.length>=2){for(var a=Ef(t,u=>u.coordinate),i=1/0,o=1,l=a.length;o<l;o++){var c=a[o],d=a[o-1];i=Math.min(((c==null?void 0:c.coordinate)||0)-((d==null?void 0:d.coordinate)||0),i)}return i===1/0?0:i}return r?void 0:0};function L0(e){var{tooltipEntrySettings:t,dataKey:r,payload:n,value:a,name:i}=e;return Gi(Gi({},t),{},{dataKey:r,payload:n,value:a,name:i})}function kC(e,t){if(e)return String(e);if(typeof t=="string")return t}var TB=(e,t)=>{if(t==="horizontal")return e.chartX;if(t==="vertical")return e.chartY},IB=(e,t)=>t==="centric"?e.angle:e.radius,na=e=>e.layout.width,sa=e=>e.layout.height,RB=e=>e.layout.scale,SC=e=>e.layout.margin,Bf=ae(e=>e.cartesianAxis.xAxis,e=>Object.values(e)),qf=ae(e=>e.cartesianAxis.yAxis,e=>Object.values(e)),$B="data-recharts-item-index",zB="data-recharts-item-id",Sc=60;function F0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function od(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?F0(Object(r),!0).forEach(function(n){LB(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):F0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LB(e,t,r){return(t=FB(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function FB(e){var t=BB(e,"string");return typeof t=="symbol"?t:t+""}function BB(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qB=e=>e.brush.height;function WB(e){var t=qf(e);return t.reduce((r,n)=>{if(n.orientation==="left"&&!n.mirror&&!n.hide){var a=typeof n.width=="number"?n.width:Sc;return r+a}return r},0)}function UB(e){var t=qf(e);return t.reduce((r,n)=>{if(n.orientation==="right"&&!n.mirror&&!n.hide){var a=typeof n.width=="number"?n.width:Sc;return r+a}return r},0)}function HB(e){var t=Bf(e);return t.reduce((r,n)=>n.orientation==="top"&&!n.mirror&&!n.hide?r+n.height:r,0)}function KB(e){var t=Bf(e);return t.reduce((r,n)=>n.orientation==="bottom"&&!n.mirror&&!n.hide?r+n.height:r,0)}var er=ae([na,sa,SC,qB,WB,UB,HB,KB,H2,g8],(e,t,r,n,a,i,o,l,c,d)=>{var u={left:(r.left||0)+a,right:(r.right||0)+i},f={top:(r.top||0)+o,bottom:(r.bottom||0)+l},m=od(od({},f),u),p=m.bottom;m.bottom+=n,m=NB(m,c,d);var x=e-m.left-m.right,g=t-m.top-m.bottom;return od(od({brushBottom:p},m),{},{width:Math.max(x,0),height:Math.max(g,0)})}),YB=ae(er,e=>({x:e.left,y:e.top,width:e.width,height:e.height})),kg=ae(na,sa,(e,t)=>({x:0,y:0,width:e,height:t})),GB=h.createContext(null),tn=()=>h.useContext(GB)!=null,Wf=e=>e.brush,Uf=ae([Wf,er,SC],(e,t,r)=>({height:e.height,x:Ce(e.x)?e.x:t.left,y:Ce(e.y)?e.y:t.top+t.height+t.brushBottom-((r==null?void 0:r.bottom)||0),width:Ce(e.width)?e.width:t.width})),CC={},_C={},PC={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r,n,{signal:a,edges:i}={}){let o,l=null;const c=i!=null&&i.includes("leading"),d=i==null||i.includes("trailing"),u=()=>{l!==null&&(r.apply(o,l),o=void 0,l=null)},f=()=>{d&&u(),g()};let m=null;const p=()=>{m!=null&&clearTimeout(m),m=setTimeout(()=>{m=null,f()},n)},x=()=>{m!==null&&(clearTimeout(m),m=null)},g=()=>{x(),o=void 0,l=null},v=()=>{u()},y=function(...b){if(a!=null&&a.aborted)return;o=this,l=b;const N=m==null;p(),c&&N&&u()};return y.schedule=p,y.cancel=g,y.flush=v,a==null||a.addEventListener("abort",g,{once:!0}),y}e.debounce=t})(PC);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=PC;function r(n,a=0,i={}){typeof i!="object"&&(i={});const{leading:o=!1,trailing:l=!0,maxWait:c}=i,d=Array(2);o&&(d[0]="leading"),l&&(d[1]="trailing");let u,f=null;const m=t.debounce(function(...g){u=n.apply(this,g),f=null},a,{edges:d}),p=function(...g){return c!=null&&(f===null&&(f=Date.now()),Date.now()-f>=c)?(u=n.apply(this,g),f=Date.now(),m.cancel(),m.schedule(),u):(m.apply(this,g),u)},x=()=>(m.flush(),u);return p.cancel=m.cancel,p.flush=x,p}e.debounce=r})(_C);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=_C;function r(n,a=0,i={}){const{leading:o=!0,trailing:l=!0}=i;return t.debounce(n,a,{leading:o,maxWait:a,trailing:l})}e.throttle=r})(CC);var VB=CC.throttle;const XB=Qs(VB);var lu=function(t,r){for(var n=arguments.length,a=new Array(n>2?n-2:0),i=2;i<n;i++)a[i-2]=arguments[i];if(typeof console<"u"&&console.warn&&(r===void 0&&console.warn("LogUtils requires an error message argument"),!t))if(r===void 0)console.warn("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var o=0;console.warn(r.replace(/%s/g,()=>a[o++]))}},is={width:"100%",height:"100%",debounce:0,minWidth:0,initialDimension:{width:-1,height:-1}},MC=(e,t,r)=>{var{width:n=is.width,height:a=is.height,aspect:i,maxHeight:o}=r,l=yi(n)?e:Number(n),c=yi(a)?t:Number(a);return i&&i>0&&(l?c=l/i:c&&(l=c*i),o&&c!=null&&c>o&&(c=o)),{calculatedWidth:l,calculatedHeight:c}},QB={width:0,height:0,overflow:"visible"},ZB={width:0,overflowX:"visible"},JB={height:0,overflowY:"visible"},e7={},t7=e=>{var{width:t,height:r}=e,n=yi(t),a=yi(r);return n&&a?QB:n?ZB:a?JB:e7};function r7(e){var{width:t,height:r,aspect:n}=e,a=t,i=r;return a===void 0&&i===void 0?(a=is.width,i=is.height):a===void 0?a=n&&n>0?void 0:is.width:i===void 0&&(i=n&&n>0?void 0:is.height),{width:a,height:i}}function mp(){return mp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},mp.apply(null,arguments)}function B0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function q0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?B0(Object(r),!0).forEach(function(n){n7(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):B0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function n7(e,t,r){return(t=s7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function s7(e){var t=a7(e,"string");return typeof t=="symbol"?t:t+""}function a7(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var OC=h.createContext(is.initialDimension);function i7(e){return ps(e.width)&&ps(e.height)}function EC(e){var{children:t,width:r,height:n}=e,a=h.useMemo(()=>({width:r,height:n}),[r,n]);return i7(a)?h.createElement(OC.Provider,{value:a},t):null}var Sg=()=>h.useContext(OC),o7=h.forwardRef((e,t)=>{var{aspect:r,initialDimension:n=is.initialDimension,width:a,height:i,minWidth:o=is.minWidth,minHeight:l,maxHeight:c,children:d,debounce:u=is.debounce,id:f,className:m,onResize:p,style:x={}}=e,g=h.useRef(null),v=h.useRef();v.current=p,h.useImperativeHandle(t,()=>g.current);var[y,b]=h.useState({containerWidth:n.width,containerHeight:n.height}),N=h.useCallback((_,C)=>{b(P=>{var O=Math.round(_),E=Math.round(C);return P.containerWidth===O&&P.containerHeight===E?P:{containerWidth:O,containerHeight:E}})},[]);h.useEffect(()=>{if(g.current==null||typeof ResizeObserver>"u")return Fo;var _=E=>{var D,I=E[0];if(I!=null){var{width:V,height:Q}=I.contentRect;N(V,Q),(D=v.current)===null||D===void 0||D.call(v,V,Q)}};u>0&&(_=XB(_,u,{trailing:!0,leading:!1}));var C=new ResizeObserver(_),{width:P,height:O}=g.current.getBoundingClientRect();return N(P,O),C.observe(g.current),()=>{C.disconnect()}},[N,u]);var{containerWidth:j,containerHeight:k}=y;lu(!r||r>0,"The aspect(%s) must be greater than zero.",r);var{calculatedWidth:w,calculatedHeight:S}=MC(j,k,{width:a,height:i,aspect:r,maxHeight:c});return lu(w!=null&&w>0||S!=null&&S>0,`The width(%s) and height(%s) of chart should be greater than 0,
595
+ please check the style of container, or the props width(%s) and height(%s),
596
+ or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the
597
+ height and width.`,w,S,a,i,o,l,r),h.createElement("div",{id:f?"".concat(f):void 0,className:lt("recharts-responsive-container",m),style:q0(q0({},x),{},{width:a,height:i,minWidth:o,minHeight:l,maxHeight:c}),ref:g},h.createElement("div",{style:t7({width:a,height:i})},h.createElement(EC,{width:w,height:S},d)))}),l7=h.forwardRef((e,t)=>{var r=Sg();if(ps(r.width)&&ps(r.height))return e.children;var{width:n,height:a}=r7({width:e.width,height:e.height,aspect:e.aspect}),{calculatedWidth:i,calculatedHeight:o}=MC(void 0,void 0,{width:n,height:a,aspect:e.aspect,maxHeight:e.maxHeight});return Ce(i)&&Ce(o)?h.createElement(EC,{width:i,height:o},e.children):h.createElement(o7,mp({},e,{width:n,height:a,ref:t}))});function Cg(e){if(e)return{x:e.x,y:e.y,upperWidth:"upperWidth"in e?e.upperWidth:e.width,lowerWidth:"lowerWidth"in e?e.lowerWidth:e.width,width:e.width,height:e.height}}var Hf=()=>{var e,t=tn(),r=Ae(YB),n=Ae(Uf),a=(e=Ae(Wf))===null||e===void 0?void 0:e.padding;return!t||!n||!a?r:{width:n.width-a.left-a.right,height:n.height-a.top-a.bottom,x:a.left,y:a.top}},c7={top:0,bottom:0,left:0,right:0,width:0,height:0,brushBottom:0},AC=()=>{var e;return(e=Ae(er))!==null&&e!==void 0?e:c7},DC=()=>Ae(na),TC=()=>Ae(sa),dt=e=>e.layout.layoutType,Bo=()=>Ae(dt),IC=()=>{var e=Bo();if(e==="horizontal"||e==="vertical")return e},RC=e=>{var t=e.layout.layoutType;if(t==="centric"||t==="radial")return t},d7=()=>{var e=Bo();return e!==void 0},Cc=e=>{var t=$t(),r=tn(),{width:n,height:a}=e,i=Sg(),o=n,l=a;return i&&(o=i.width>0?i.width:n,l=i.height>0?i.height:a),h.useEffect(()=>{!r&&ps(o)&&ps(l)&&t(gB({width:o,height:l}))},[t,r,o,l]),null},$C=Symbol.for("immer-nothing"),W0=Symbol.for("immer-draftable"),fn=Symbol.for("immer-state");function Ln(e,...t){throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var Bl=Object.getPrototypeOf;function po(e){return!!e&&!!e[fn]}function ji(e){var t;return e?zC(e)||Array.isArray(e)||!!e[W0]||!!((t=e.constructor)!=null&&t[W0])||_c(e)||Yf(e):!1}var u7=Object.prototype.constructor.toString(),U0=new WeakMap;function zC(e){if(!e||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);if(t===null||t===Object.prototype)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;if(r===Object)return!0;if(typeof r!="function")return!1;let n=U0.get(r);return n===void 0&&(n=Function.toString.call(r),U0.set(r,n)),n===u7}function cu(e,t,r=!0){Kf(e)===0?(r?Reflect.ownKeys(e):Object.keys(e)).forEach(a=>{t(a,e[a],e)}):e.forEach((n,a)=>t(a,n,e))}function Kf(e){const t=e[fn];return t?t.type_:Array.isArray(e)?1:_c(e)?2:Yf(e)?3:0}function hp(e,t){return Kf(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function LC(e,t,r){const n=Kf(e);n===2?e.set(t,r):n===3?e.add(r):e[t]=r}function f7(e,t){return e===t?e!==0||1/e===1/t:e!==e&&t!==t}function _c(e){return e instanceof Map}function Yf(e){return e instanceof Set}function Qa(e){return e.copy_||e.base_}function pp(e,t){if(_c(e))return new Map(e);if(Yf(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=zC(e);if(t===!0||t==="class_only"&&!r){const n=Object.getOwnPropertyDescriptors(e);delete n[fn];let a=Reflect.ownKeys(n);for(let i=0;i<a.length;i++){const o=a[i],l=n[o];l.writable===!1&&(l.writable=!0,l.configurable=!0),(l.get||l.set)&&(n[o]={configurable:!0,writable:!0,enumerable:l.enumerable,value:e[o]})}return Object.create(Bl(e),n)}else{const n=Bl(e);if(n!==null&&r)return{...e};const a=Object.create(n);return Object.assign(a,e)}}function _g(e,t=!1){return Gf(e)||po(e)||!ji(e)||(Kf(e)>1&&Object.defineProperties(e,{set:ld,add:ld,clear:ld,delete:ld}),Object.freeze(e),t&&Object.values(e).forEach(r=>_g(r,!0))),e}function m7(){Ln(2)}var ld={value:m7};function Gf(e){return e===null||typeof e!="object"?!0:Object.isFrozen(e)}var h7={};function wi(e){const t=h7[e];return t||Ln(0,e),t}var ql;function FC(){return ql}function p7(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function H0(e,t){t&&(wi("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function xp(e){gp(e),e.drafts_.forEach(x7),e.drafts_=null}function gp(e){e===ql&&(ql=e.parent_)}function K0(e){return ql=p7(ql,e)}function x7(e){const t=e[fn];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Y0(e,t){t.unfinalizedDrafts_=t.drafts_.length;const r=t.drafts_[0];return e!==void 0&&e!==r?(r[fn].modified_&&(xp(t),Ln(4)),ji(e)&&(e=du(t,e),t.parent_||uu(t,e)),t.patches_&&wi("Patches").generateReplacementPatches_(r[fn].base_,e,t.patches_,t.inversePatches_)):e=du(t,r,[]),xp(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e!==$C?e:void 0}function du(e,t,r){if(Gf(t))return t;const n=e.immer_.shouldUseStrictIteration(),a=t[fn];if(!a)return cu(t,(i,o)=>G0(e,a,t,i,o,r),n),t;if(a.scope_!==e)return t;if(!a.modified_)return uu(e,a.base_,!0),a.base_;if(!a.finalized_){a.finalized_=!0,a.scope_.unfinalizedDrafts_--;const i=a.copy_;let o=i,l=!1;a.type_===3&&(o=new Set(i),i.clear(),l=!0),cu(o,(c,d)=>G0(e,a,i,c,d,r,l),n),uu(e,i,!1),r&&e.patches_&&wi("Patches").generatePatches_(a,r,e.patches_,e.inversePatches_)}return a.copy_}function G0(e,t,r,n,a,i,o){if(a==null||typeof a!="object"&&!o)return;const l=Gf(a);if(!(l&&!o)){if(po(a)){const c=i&&t&&t.type_!==3&&!hp(t.assigned_,n)?i.concat(n):void 0,d=du(e,a,c);if(LC(r,n,d),po(d))e.canAutoFreeze_=!1;else return}else o&&r.add(a);if(ji(a)&&!l){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1||t&&t.base_&&t.base_[n]===a&&l)return;du(e,a),(!t||!t.scope_.parent_)&&typeof n!="symbol"&&(_c(r)?r.has(n):Object.prototype.propertyIsEnumerable.call(r,n))&&uu(e,a)}}}function uu(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&_g(t,r)}function g7(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:FC(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let a=n,i=Pg;r&&(a=[n],i=Wl);const{revoke:o,proxy:l}=Proxy.revocable(a,i);return n.draft_=l,n.revoke_=o,l}var Pg={get(e,t){if(t===fn)return e;const r=Qa(e);if(!hp(r,t))return v7(e,r,t);const n=r[t];return e.finalized_||!ji(n)?n:n===oh(e.base_,t)?(lh(e),e.copy_[t]=yp(n,e)):n},has(e,t){return t in Qa(e)},ownKeys(e){return Reflect.ownKeys(Qa(e))},set(e,t,r){const n=BC(Qa(e),t);if(n!=null&&n.set)return n.set.call(e.draft_,r),!0;if(!e.modified_){const a=oh(Qa(e),t),i=a==null?void 0:a[fn];if(i&&i.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(f7(r,a)&&(r!==void 0||hp(e.base_,t)))return!0;lh(e),vp(e)}return e.copy_[t]===r&&(r!==void 0||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty(e,t){return oh(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,lh(e),vp(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){const r=Qa(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:e.type_!==1||t!=="length",enumerable:n.enumerable,value:r[t]}},defineProperty(){Ln(11)},getPrototypeOf(e){return Bl(e.base_)},setPrototypeOf(){Ln(12)}},Wl={};cu(Pg,(e,t)=>{Wl[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}});Wl.deleteProperty=function(e,t){return Wl.set.call(this,e,t,void 0)};Wl.set=function(e,t,r){return Pg.set.call(this,e[0],t,r,e[0])};function oh(e,t){const r=e[fn];return(r?Qa(r):e)[t]}function v7(e,t,r){var a;const n=BC(t,r);return n?"value"in n?n.value:(a=n.get)==null?void 0:a.call(e.draft_):void 0}function BC(e,t){if(!(t in e))return;let r=Bl(e);for(;r;){const n=Object.getOwnPropertyDescriptor(r,t);if(n)return n;r=Bl(r)}}function vp(e){e.modified_||(e.modified_=!0,e.parent_&&vp(e.parent_))}function lh(e){e.copy_||(e.copy_=pp(e.base_,e.scope_.immer_.useStrictShallowCopy_))}var y7=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.useStrictIteration_=!0,this.produce=(t,r,n)=>{if(typeof t=="function"&&typeof r!="function"){const i=r;r=t;const o=this;return function(c=i,...d){return o.produce(c,u=>r.call(this,u,...d))}}typeof r!="function"&&Ln(6),n!==void 0&&typeof n!="function"&&Ln(7);let a;if(ji(t)){const i=K0(this),o=yp(t,void 0);let l=!0;try{a=r(o),l=!1}finally{l?xp(i):gp(i)}return H0(i,n),Y0(a,i)}else if(!t||typeof t!="object"){if(a=r(t),a===void 0&&(a=t),a===$C&&(a=void 0),this.autoFreeze_&&_g(a,!0),n){const i=[],o=[];wi("Patches").generateReplacementPatches_(t,a,i,o),n(i,o)}return a}else Ln(1,t)},this.produceWithPatches=(t,r)=>{if(typeof t=="function")return(o,...l)=>this.produceWithPatches(o,c=>t(c,...l));let n,a;return[this.produce(t,r,(o,l)=>{n=o,a=l}),n,a]},typeof(e==null?void 0:e.autoFreeze)=="boolean"&&this.setAutoFreeze(e.autoFreeze),typeof(e==null?void 0:e.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(e.useStrictShallowCopy),typeof(e==null?void 0:e.useStrictIteration)=="boolean"&&this.setUseStrictIteration(e.useStrictIteration)}createDraft(e){ji(e)||Ln(8),po(e)&&(e=b7(e));const t=K0(this),r=yp(e,void 0);return r[fn].isManual_=!0,gp(t),r}finishDraft(e,t){const r=e&&e[fn];(!r||!r.isManual_)&&Ln(9);const{scope_:n}=r;return H0(n,t),Y0(void 0,n)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}setUseStrictIteration(e){this.useStrictIteration_=e}shouldUseStrictIteration(){return this.useStrictIteration_}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const a=t[r];if(a.path.length===0&&a.op==="replace"){e=a.value;break}}r>-1&&(t=t.slice(r+1));const n=wi("Patches").applyPatches_;return po(e)?n(e,t):this.produce(e,a=>n(a,t))}};function yp(e,t){const r=_c(e)?wi("MapSet").proxyMap_(e,t):Yf(e)?wi("MapSet").proxySet_(e,t):g7(e,t);return(t?t.scope_:FC()).drafts_.push(r),r}function b7(e){return po(e)||Ln(10,e),qC(e)}function qC(e){if(!ji(e)||Gf(e))return e;const t=e[fn];let r,n=!0;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=pp(e,t.scope_.immer_.useStrictShallowCopy_),n=t.scope_.immer_.shouldUseStrictIteration()}else r=pp(e,!0);return cu(r,(a,i)=>{LC(r,a,qC(i))},n),t&&(t.finalized_=!1),r}var j7=new y7;j7.produce;var w7={settings:{layout:"horizontal",align:"center",verticalAlign:"middle",itemSorter:"value"},size:{width:0,height:0},payload:[]},WC=en({name:"legend",initialState:w7,reducers:{setLegendSize(e,t){e.size.width=t.payload.width,e.size.height=t.payload.height},setLegendSettings(e,t){e.settings.align=t.payload.align,e.settings.layout=t.payload.layout,e.settings.verticalAlign=t.payload.verticalAlign,e.settings.itemSorter=t.payload.itemSorter},addLegendPayload:{reducer(e,t){e.payload.push(t.payload)},prepare:yt()},replaceLegendPayload:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Un(e).payload.indexOf(r);a>-1&&(e.payload[a]=n)},prepare:yt()},removeLegendPayload:{reducer(e,t){var r=Un(e).payload.indexOf(t.payload);r>-1&&e.payload.splice(r,1)},prepare:yt()}}}),{setLegendSize:tne,setLegendSettings:rne,addLegendPayload:N7,replaceLegendPayload:k7,removeLegendPayload:S7}=WC.actions,C7=WC.reducer;function bp(){return bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},bp.apply(null,arguments)}function V0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function fl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?V0(Object(r),!0).forEach(function(n){_7(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function _7(e,t,r){return(t=P7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P7(e){var t=M7(e,"string");return typeof t=="symbol"?t:t+""}function M7(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function O7(e){return Array.isArray(e)&&hs(e[0])&&hs(e[1])?e.join(" ~ "):e}var Bi={separator:" : ",contentStyle:{margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},itemStyle:{display:"block",paddingTop:4,paddingBottom:4,color:"#000"},labelStyle:{},accessibilityLayer:!1},E7=e=>{var{separator:t=Bi.separator,contentStyle:r,itemStyle:n,labelStyle:a=Bi.labelStyle,payload:i,formatter:o,itemSorter:l,wrapperClassName:c,labelClassName:d,label:u,labelFormatter:f,accessibilityLayer:m=Bi.accessibilityLayer}=e,p=()=>{if(i&&i.length){var k={padding:0,margin:0},w=(l?Ef(i,l):i).map((S,_)=>{if(S.type==="none")return null;var C=S.formatter||o||O7,{value:P,name:O}=S,E=P,D=O;if(C){var I=C(P,O,S,_,i);if(Array.isArray(I))[E,D]=I;else if(I!=null)E=I;else return null}var V=fl(fl({},Bi.itemStyle),{},{color:S.color||Bi.itemStyle.color},n);return h.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(_),style:V},hs(D)?h.createElement("span",{className:"recharts-tooltip-item-name"},D):null,hs(D)?h.createElement("span",{className:"recharts-tooltip-item-separator"},t):null,h.createElement("span",{className:"recharts-tooltip-item-value"},E),h.createElement("span",{className:"recharts-tooltip-item-unit"},S.unit||""))});return h.createElement("ul",{className:"recharts-tooltip-item-list",style:k},w)}return null},x=fl(fl({},Bi.contentStyle),r),g=fl({margin:0},a),v=!Bt(u),y=v?u:"",b=lt("recharts-default-tooltip",c),N=lt("recharts-tooltip-label",d);v&&f&&i!==void 0&&i!==null&&(y=f(u,i));var j=m?{role:"status","aria-live":"assertive"}:{};return h.createElement("div",bp({className:b,style:x},j),h.createElement("p",{className:N,style:g},h.isValidElement(y)?y:"".concat(y)),p())},ml="recharts-tooltip-wrapper",A7={visibility:"hidden"};function D7(e){var{coordinate:t,translateX:r,translateY:n}=e;return lt(ml,{["".concat(ml,"-right")]:Ce(r)&&t&&Ce(t.x)&&r>=t.x,["".concat(ml,"-left")]:Ce(r)&&t&&Ce(t.x)&&r<t.x,["".concat(ml,"-bottom")]:Ce(n)&&t&&Ce(t.y)&&n>=t.y,["".concat(ml,"-top")]:Ce(n)&&t&&Ce(t.y)&&n<t.y})}function X0(e){var{allowEscapeViewBox:t,coordinate:r,key:n,offset:a,position:i,reverseDirection:o,tooltipDimension:l,viewBox:c,viewBoxDimension:d}=e;if(i&&Ce(i[n]))return i[n];var u=r[n]-l-(a>0?a:0),f=r[n]+a;if(t[n])return o[n]?u:f;var m=c[n];if(m==null)return 0;if(o[n]){var p=u,x=m;return p<x?Math.max(f,m):Math.max(u,m)}if(d==null)return 0;var g=f+l,v=m+d;return g>v?Math.max(u,m):Math.max(f,m)}function T7(e){var{translateX:t,translateY:r,useTranslate3d:n}=e;return{transform:n?"translate3d(".concat(t,"px, ").concat(r,"px, 0)"):"translate(".concat(t,"px, ").concat(r,"px)")}}function I7(e){var{allowEscapeViewBox:t,coordinate:r,offsetTop:n,offsetLeft:a,position:i,reverseDirection:o,tooltipBox:l,useTranslate3d:c,viewBox:d}=e,u,f,m;return l.height>0&&l.width>0&&r?(f=X0({allowEscapeViewBox:t,coordinate:r,key:"x",offset:a,position:i,reverseDirection:o,tooltipDimension:l.width,viewBox:d,viewBoxDimension:d.width}),m=X0({allowEscapeViewBox:t,coordinate:r,key:"y",offset:n,position:i,reverseDirection:o,tooltipDimension:l.height,viewBox:d,viewBoxDimension:d.height}),u=T7({translateX:f,translateY:m,useTranslate3d:c})):u=A7,{cssProperties:u,cssClasses:D7({translateX:f,translateY:m,coordinate:r})}}function Q0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function cd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Q0(Object(r),!0).forEach(function(n){jp(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function jp(e,t,r){return(t=R7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function R7(e){var t=$7(e,"string");return typeof t=="symbol"?t:t+""}function $7(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class z7 extends h.PureComponent{constructor(){super(...arguments),jp(this,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0}}),jp(this,"handleKeyDown",t=>{if(t.key==="Escape"){var r,n,a,i;this.setState({dismissed:!0,dismissedAtCoordinate:{x:(r=(n=this.props.coordinate)===null||n===void 0?void 0:n.x)!==null&&r!==void 0?r:0,y:(a=(i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==null&&a!==void 0?a:0}})}})}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}componentDidUpdate(){var t,r;this.state.dismissed&&(((t=this.props.coordinate)===null||t===void 0?void 0:t.x)!==this.state.dismissedAtCoordinate.x||((r=this.props.coordinate)===null||r===void 0?void 0:r.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}render(){var{active:t,allowEscapeViewBox:r,animationDuration:n,animationEasing:a,children:i,coordinate:o,hasPayload:l,isAnimationActive:c,offset:d,position:u,reverseDirection:f,useTranslate3d:m,viewBox:p,wrapperStyle:x,lastBoundingBox:g,innerRef:v,hasPortalFromProps:y}=this.props,b=typeof d=="number"?d:d.x,N=typeof d=="number"?d:d.y,{cssClasses:j,cssProperties:k}=I7({allowEscapeViewBox:r,coordinate:o,offsetLeft:b,offsetTop:N,position:u,reverseDirection:f,tooltipBox:{height:g.height,width:g.width},useTranslate3d:m,viewBox:p}),w=y?{}:cd(cd({transition:c&&t?"transform ".concat(n,"ms ").concat(a):void 0},k),{},{pointerEvents:"none",visibility:!this.state.dismissed&&t&&l?"visible":"hidden",position:"absolute",top:0,left:0}),S=cd(cd({},w),{},{visibility:!this.state.dismissed&&t&&l?"visible":"hidden"},x);return h.createElement("div",{xmlns:"http://www.w3.org/1999/xhtml",tabIndex:-1,className:j,style:S,ref:v},i)}}var UC=()=>{var e;return(e=Ae(t=>t.rootProps.accessibilityLayer))!==null&&e!==void 0?e:!0};function wp(){return wp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},wp.apply(null,arguments)}function Z0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function J0(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Z0(Object(r),!0).forEach(function(n){L7(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Z0(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function L7(e,t,r){return(t=F7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function F7(e){var t=B7(e,"string");return typeof t=="symbol"?t:t+""}function B7(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var eb={curveBasisClosed:jF,curveBasisOpen:wF,curveBasis:bF,curveBumpX:iF,curveBumpY:oF,curveLinearClosed:NF,curveLinear:kf,curveMonotoneX:kF,curveMonotoneY:SF,curveNatural:CF,curveStep:_F,curveStepAfter:MF,curveStepBefore:PF},fu=e=>Ye(e.x)&&Ye(e.y),tb=e=>e.base!=null&&fu(e.base)&&fu(e),hl=e=>e.x,pl=e=>e.y,q7=(e,t)=>{if(typeof e=="function")return e;var r="curve".concat(wc(e));if((r==="curveMonotone"||r==="curveBump")&&t){var n=eb["".concat(r).concat(t==="vertical"?"Y":"X")];if(n)return n}return eb[r]||kf},rb={connectNulls:!1,type:"linear"},W7=e=>{var{type:t=rb.type,points:r=[],baseLine:n,layout:a,connectNulls:i=rb.connectNulls}=e,o=q7(t,a),l=i?r.filter(fu):r;if(Array.isArray(n)){var c,d=r.map((x,g)=>J0(J0({},x),{},{base:n[g]}));a==="vertical"?c=td().y(pl).x1(hl).x0(x=>x.base.x):c=td().x(hl).y1(pl).y0(x=>x.base.y);var u=c.defined(tb).curve(o),f=i?d.filter(tb):d;return u(f)}var m;a==="vertical"&&Ce(n)?m=td().y(pl).x1(hl).x0(n):Ce(n)?m=td().x(hl).y1(pl).y0(n):m=n2().x(hl).y(pl);var p=m.defined(fu).curve(o);return p(l)},HC=e=>{var{className:t,points:r,path:n,pathRef:a}=e,i=Bo();if((!r||!r.length)&&!n)return null;var o={type:e.type,points:e.points,baseLine:e.baseLine,layout:e.layout||i,connectNulls:e.connectNulls},l=r&&r.length?W7(o):n;return h.createElement("path",wp({},qs(e),VF(e),{className:lt("recharts-curve",t),d:l===null?void 0:l,ref:a}))},U7=["x","y","top","left","width","height","className"];function Np(){return Np=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Np.apply(null,arguments)}function nb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function H7(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?nb(Object(r),!0).forEach(function(n){K7(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function K7(e,t,r){return(t=Y7(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Y7(e){var t=G7(e,"string");return typeof t=="symbol"?t:t+""}function G7(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function V7(e,t){if(e==null)return{};var r,n,a=X7(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function X7(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var Q7=(e,t,r,n,a,i)=>"M".concat(e,",").concat(a,"v").concat(n,"M").concat(i,",").concat(t,"h").concat(r),Z7=e=>{var{x:t=0,y:r=0,top:n=0,left:a=0,width:i=0,height:o=0,className:l}=e,c=V7(e,U7),d=H7({x:t,y:r,top:n,left:a,width:i,height:o},c);return!Ce(t)||!Ce(r)||!Ce(i)||!Ce(o)||!Ce(n)||!Ce(a)?null:h.createElement("path",Np({},Qr(d),{className:lt("recharts-cross",l),d:Q7(t,r,i,o,n,a)}))};function J7(e,t,r,n){var a=n/2;return{stroke:"none",fill:"#ccc",x:e==="horizontal"?t.x-a:r.left+.5,y:e==="horizontal"?r.top+.5:t.y-a,width:e==="horizontal"?n:r.width-1,height:e==="horizontal"?r.height-1:n}}function sb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ab(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?sb(Object(r),!0).forEach(function(n){eq(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function eq(e,t,r){return(t=tq(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function tq(e){var t=rq(e,"string");return typeof t=="symbol"?t:t+""}function rq(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var nq=e=>e.replace(/([A-Z])/g,t=>"-".concat(t.toLowerCase())),KC=(e,t,r)=>e.map(n=>"".concat(nq(n)," ").concat(t,"ms ").concat(r)).join(","),sq=(e,t)=>[Object.keys(e),Object.keys(t)].reduce((r,n)=>r.filter(a=>n.includes(a))),Ul=(e,t)=>Object.keys(t).reduce((r,n)=>ab(ab({},r),{},{[n]:e(n,t[n])}),{});function ib(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ut(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ib(Object(r),!0).forEach(function(n){aq(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ib(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function aq(e,t,r){return(t=iq(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iq(e){var t=oq(e,"string");return typeof t=="symbol"?t:t+""}function oq(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var mu=(e,t,r)=>e+(t-e)*r,kp=e=>{var{from:t,to:r}=e;return t!==r},YC=(e,t,r)=>{var n=Ul((a,i)=>{if(kp(i)){var[o,l]=e(i.from,i.to,i.velocity);return Ut(Ut({},i),{},{from:o,velocity:l})}return i},t);return r<1?Ul((a,i)=>kp(i)&&n[a]!=null?Ut(Ut({},i),{},{velocity:mu(i.velocity,n[a].velocity,r),from:mu(i.from,n[a].from,r)}):i,t):YC(e,n,r-1)};function lq(e,t,r,n,a,i){var o,l=n.reduce((m,p)=>Ut(Ut({},m),{},{[p]:{from:e[p],velocity:0,to:t[p]}}),{}),c=()=>Ul((m,p)=>p.from,l),d=()=>!Object.values(l).filter(kp).length,u=null,f=m=>{o||(o=m);var p=m-o,x=p/r.dt;l=YC(r,l,x),a(Ut(Ut(Ut({},e),t),c())),o=m,d()||(u=i.setTimeout(f))};return()=>(u=i.setTimeout(f),()=>{var m;(m=u)===null||m===void 0||m()})}function cq(e,t,r,n,a,i,o){var l=null,c=a.reduce((f,m)=>{var p=e[m],x=t[m];return p==null||x==null?f:Ut(Ut({},f),{},{[m]:[p,x]})},{}),d,u=f=>{d||(d=f);var m=(f-d)/n,p=Ul((g,v)=>mu(...v,r(m)),c);if(i(Ut(Ut(Ut({},e),t),p)),m<1)l=o.setTimeout(u);else{var x=Ul((g,v)=>mu(...v,r(1)),c);i(Ut(Ut(Ut({},e),t),x))}};return()=>(l=o.setTimeout(u),()=>{var f;(f=l)===null||f===void 0||f()})}const dq=(e,t,r,n,a,i)=>{var o=sq(e,t);return r==null?()=>(a(Ut(Ut({},e),t)),()=>{}):r.isStepper===!0?lq(e,t,r,o,a,i):cq(e,t,r,n,o,a,i)};var hu=1e-4,GC=(e,t)=>[0,3*e,3*t-6*e,3*e-3*t+1],VC=(e,t)=>e.map((r,n)=>r*t**n).reduce((r,n)=>r+n),ob=(e,t)=>r=>{var n=GC(e,t);return VC(n,r)},uq=(e,t)=>r=>{var n=GC(e,t),a=[...n.map((i,o)=>i*o).slice(1),0];return VC(a,r)},fq=e=>{var t,r=e.split("(");if(r.length!==2||r[0]!=="cubic-bezier")return null;var n=(t=r[1])===null||t===void 0||(t=t.split(")")[0])===null||t===void 0?void 0:t.split(",");if(n==null||n.length!==4)return null;var a=n.map(i=>parseFloat(i));return[a[0],a[1],a[2],a[3]]},mq=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(r.length===1)switch(r[0]){case"linear":return[0,0,1,1];case"ease":return[.25,.1,.25,1];case"ease-in":return[.42,0,1,1];case"ease-out":return[.42,0,.58,1];case"ease-in-out":return[0,0,.58,1];default:{var a=fq(r[0]);if(a)return a}}return r.length===4?r:[0,0,1,1]},hq=(e,t,r,n)=>{var a=ob(e,r),i=ob(t,n),o=uq(e,r),l=d=>d>1?1:d<0?0:d,c=d=>{for(var u=d>1?1:d,f=u,m=0;m<8;++m){var p=a(f)-u,x=o(f);if(Math.abs(p-u)<hu||x<hu)return i(f);f=l(f-p/x)}return i(f)};return c.isStepper=!1,c},lb=function(){return hq(...mq(...arguments))},pq=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},{stiff:r=100,damping:n=8,dt:a=17}=t,i=(o,l,c)=>{var d=-(o-l)*r,u=c*n,f=c+(d-u)*a/1e3,m=c*a/1e3+o;return Math.abs(m-l)<hu&&Math.abs(f)<hu?[l,0]:[m,f]};return i.isStepper=!0,i.dt=a,i},xq=e=>{if(typeof e=="string")switch(e){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return lb(e);case"spring":return pq();default:if(e.split("(")[0]==="cubic-bezier")return lb(e)}return typeof e=="function"?e:null};function gq(e){var t,r=()=>null,n=!1,a=null,i=o=>{if(!n){if(Array.isArray(o)){if(!o.length)return;var l=o,[c,...d]=l;if(typeof c=="number"){a=e.setTimeout(i.bind(null,d),c);return}i(c),a=e.setTimeout(i.bind(null,d));return}typeof o=="string"&&(t=o,r(t)),typeof o=="object"&&(t=o,r(t)),typeof o=="function"&&o()}};return{stop:()=>{n=!0},start:o=>{n=!1,a&&(a(),a=null),i(o)},subscribe:o=>(r=o,()=>{r=()=>null}),getTimeoutController:()=>e}}class vq{setTimeout(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=performance.now(),a=null,i=o=>{o-n>=r?t(o):typeof requestAnimationFrame=="function"&&(a=requestAnimationFrame(i))};return a=requestAnimationFrame(i),()=>{a!=null&&cancelAnimationFrame(a)}}}function yq(){return gq(new vq)}var bq=h.createContext(yq);function jq(e,t){var r=h.useContext(bq);return h.useMemo(()=>t??r(e),[e,t,r])}var wq=()=>!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout),Vf={isSsr:wq()},Nq={begin:0,duration:1e3,easing:"ease",isActive:!0,canBegin:!0,onAnimationEnd:()=>{},onAnimationStart:()=>{}},cb={t:0},ch={t:1};function Mg(e){var t=xn(e,Nq),{isActive:r,canBegin:n,duration:a,easing:i,begin:o,onAnimationEnd:l,onAnimationStart:c,children:d}=t,u=r==="auto"?!Vf.isSsr:r,f=jq(t.animationId,t.animationManager),[m,p]=h.useState(u?cb:ch),x=h.useRef(null);return h.useEffect(()=>{u||p(ch)},[u]),h.useEffect(()=>{if(!u||!n)return Fo;var g=dq(cb,ch,xq(i),a,p,f.getTimeoutController()),v=()=>{x.current=g()};return f.start([c,o,v,a,l]),()=>{f.stop(),x.current&&x.current(),l()}},[u,n,a,i,o,c,l,f]),d(m.t)}function Og(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"animation-",r=h.useRef($l(t)),n=h.useRef(e);return n.current!==e&&(r.current=$l(t),n.current=e),r.current}var kq=["radius"],Sq=["radius"],db,ub,fb,mb,hb,pb,xb,gb,vb,yb;function bb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function jb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bb(Object(r),!0).forEach(function(n){Cq(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Cq(e,t,r){return(t=_q(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _q(e){var t=Pq(e,"string");return typeof t=="symbol"?t:t+""}function Pq(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function pu(){return pu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},pu.apply(null,arguments)}function wb(e,t){if(e==null)return{};var r,n,a=Mq(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function Mq(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Jn(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Nb=(e,t,r,n,a)=>{var i=va(r),o=va(n),l=Math.min(Math.abs(i)/2,Math.abs(o)/2),c=o>=0?1:-1,d=i>=0?1:-1,u=o>=0&&i>=0||o<0&&i<0?1:0,f;if(l>0&&Array.isArray(a)){for(var m=[0,0,0,0],p=0,x=4;p<x;p++){var g,v=(g=a[p])!==null&&g!==void 0?g:0;m[p]=v>l?l:v}f=Dt(db||(db=Jn(["M",",",""])),e,t+c*m[0]),m[0]>0&&(f+=Dt(ub||(ub=Jn(["A ",",",",0,0,",",",",",""])),m[0],m[0],u,e+d*m[0],t)),f+=Dt(fb||(fb=Jn(["L ",",",""])),e+r-d*m[1],t),m[1]>0&&(f+=Dt(mb||(mb=Jn(["A ",",",",0,0,",`,
598
+ `,",",""])),m[1],m[1],u,e+r,t+c*m[1])),f+=Dt(hb||(hb=Jn(["L ",",",""])),e+r,t+n-c*m[2]),m[2]>0&&(f+=Dt(pb||(pb=Jn(["A ",",",",0,0,",`,
599
+ `,",",""])),m[2],m[2],u,e+r-d*m[2],t+n)),f+=Dt(xb||(xb=Jn(["L ",",",""])),e+d*m[3],t+n),m[3]>0&&(f+=Dt(gb||(gb=Jn(["A ",",",",0,0,",`,
600
+ `,",",""])),m[3],m[3],u,e,t+n-c*m[3])),f+="Z"}else if(l>0&&a===+a&&a>0){var y=Math.min(l,a);f=Dt(vb||(vb=Jn(["M ",",",`
601
+ A `,",",",0,0,",",",",",`
602
+ L `,",",`
603
+ A `,",",",0,0,",",",",",`
604
+ L `,",",`
605
+ A `,",",",0,0,",",",",",`
606
+ L `,",",`
607
+ A `,",",",0,0,",",",","," Z"])),e,t+c*y,y,y,u,e+d*y,t,e+r-d*y,t,y,y,u,e+r,t+c*y,e+r,t+n-c*y,y,y,u,e+r-d*y,t+n,e+d*y,t+n,y,y,u,e,t+n-c*y)}else f=Dt(yb||(yb=Jn(["M ",","," h "," v "," h "," Z"])),e,t,r,n,-r);return f},kb={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},XC=e=>{var t=xn(e,kb),r=h.useRef(null),[n,a]=h.useState(-1);h.useEffect(()=>{if(r.current&&r.current.getTotalLength)try{var q=r.current.getTotalLength();q&&a(q)}catch{}},[]);var{x:i,y:o,width:l,height:c,radius:d,className:u}=t,{animationEasing:f,animationDuration:m,animationBegin:p,isAnimationActive:x,isUpdateAnimationActive:g}=t,v=h.useRef(l),y=h.useRef(c),b=h.useRef(i),N=h.useRef(o),j=h.useMemo(()=>({x:i,y:o,width:l,height:c,radius:d}),[i,o,l,c,d]),k=Og(j,"rectangle-");if(i!==+i||o!==+o||l!==+l||c!==+c||l===0||c===0)return null;var w=lt("recharts-rectangle",u);if(!g){var S=Qr(t),{radius:_}=S,C=wb(S,kq);return h.createElement("path",pu({},C,{x:va(i),y:va(o),width:va(l),height:va(c),radius:typeof d=="number"?d:void 0,className:w,d:Nb(i,o,l,c,d)}))}var P=v.current,O=y.current,E=b.current,D=N.current,I="0px ".concat(n===-1?1:n,"px"),V="".concat(n,"px 0px"),Q=KC(["strokeDasharray"],m,typeof f=="string"?f:kb.animationEasing);return h.createElement(Mg,{animationId:k,key:k,canBegin:n>0,duration:m,easing:f,isActive:g,begin:p},q=>{var re=fr(P,l,q),se=fr(O,c,q),T=fr(E,i,q),M=fr(D,o,q);r.current&&(v.current=re,y.current=se,b.current=T,N.current=M);var L;x?q>0?L={transition:Q,strokeDasharray:V}:L={strokeDasharray:I}:L={strokeDasharray:V};var H=Qr(t),{radius:R}=H,Y=wb(H,Sq);return h.createElement("path",pu({},Y,{radius:typeof d=="number"?d:void 0,className:w,d:Nb(T,M,re,se,d),ref:r,style:jb(jb({},L),t.style)}))})};function Sb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Cb(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sb(Object(r),!0).forEach(function(n){Oq(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sb(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Oq(e,t,r){return(t=Eq(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Eq(e){var t=Aq(e,"string");return typeof t=="symbol"?t:t+""}function Aq(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var xu=Math.PI/180,Dq=e=>e*180/Math.PI,hr=(e,t,r,n)=>({x:e+Math.cos(-xu*n)*r,y:t+Math.sin(-xu*n)*r}),Tq=function(t,r){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(n.left||0)-(n.right||0)),Math.abs(r-(n.top||0)-(n.bottom||0)))/2},Iq=(e,t)=>{var{x:r,y:n}=e,{x:a,y:i}=t;return Math.sqrt((r-a)**2+(n-i)**2)},Rq=(e,t)=>{var{x:r,y:n}=e,{cx:a,cy:i}=t,o=Iq({x:r,y:n},{x:a,y:i});if(o<=0)return{radius:o,angle:0};var l=(r-a)/o,c=Math.acos(l);return n>i&&(c=2*Math.PI-c),{radius:o,angle:Dq(c),angleInRadian:c}},$q=e=>{var{startAngle:t,endAngle:r}=e,n=Math.floor(t/360),a=Math.floor(r/360),i=Math.min(n,a);return{startAngle:t-i*360,endAngle:r-i*360}},zq=(e,t)=>{var{startAngle:r,endAngle:n}=t,a=Math.floor(r/360),i=Math.floor(n/360),o=Math.min(a,i);return e+o*360},Lq=(e,t)=>{var{chartX:r,chartY:n}=e,{radius:a,angle:i}=Rq({x:r,y:n},t),{innerRadius:o,outerRadius:l}=t;if(a<o||a>l||a===0)return null;var{startAngle:c,endAngle:d}=$q(t),u=i,f;if(c<=d){for(;u>d;)u-=360;for(;u<c;)u+=360;f=u>=c&&u<=d}else{for(;u>c;)u-=360;for(;u<d;)u+=360;f=u>=d&&u<=c}return f?Cb(Cb({},t),{},{radius:a,angle:zq(u,t)}):null};function QC(e){var{cx:t,cy:r,radius:n,startAngle:a,endAngle:i}=e,o=hr(t,r,n,a),l=hr(t,r,n,i);return{points:[o,l],cx:t,cy:r,radius:n,startAngle:a,endAngle:i}}var _b,Pb,Mb,Ob,Eb,Ab,Db;function Sp(){return Sp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Sp.apply(null,arguments)}function si(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var Fq=(e,t)=>{var r=Ur(t-e),n=Math.min(Math.abs(t-e),359.999);return r*n},dd=e=>{var{cx:t,cy:r,radius:n,angle:a,sign:i,isExternal:o,cornerRadius:l,cornerIsExternal:c}=e,d=l*(o?1:-1)+n,u=Math.asin(l/d)/xu,f=c?a:a+i*u,m=hr(t,r,d,f),p=hr(t,r,n,f),x=c?a-i*u:a,g=hr(t,r,d*Math.cos(u*xu),x);return{center:m,circleTangency:p,lineTangency:g,theta:u}},ZC=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:i,endAngle:o}=e,l=Fq(i,o),c=i+l,d=hr(t,r,a,i),u=hr(t,r,a,c),f=Dt(_b||(_b=si(["M ",",",`
608
+ A `,",",`,0,
609
+ `,",",`,
610
+ `,",",`
611
+ `])),d.x,d.y,a,a,+(Math.abs(l)>180),+(i>c),u.x,u.y);if(n>0){var m=hr(t,r,n,i),p=hr(t,r,n,c);f+=Dt(Pb||(Pb=si(["L ",",",`
612
+ A `,",",`,0,
613
+ `,",",`,
614
+ `,","," Z"])),p.x,p.y,n,n,+(Math.abs(l)>180),+(i<=c),m.x,m.y)}else f+=Dt(Mb||(Mb=si(["L ",","," Z"])),t,r);return f},Bq=e=>{var{cx:t,cy:r,innerRadius:n,outerRadius:a,cornerRadius:i,forceCornerRadius:o,cornerIsExternal:l,startAngle:c,endAngle:d}=e,u=Ur(d-c),{circleTangency:f,lineTangency:m,theta:p}=dd({cx:t,cy:r,radius:a,angle:c,sign:u,cornerRadius:i,cornerIsExternal:l}),{circleTangency:x,lineTangency:g,theta:v}=dd({cx:t,cy:r,radius:a,angle:d,sign:-u,cornerRadius:i,cornerIsExternal:l}),y=l?Math.abs(c-d):Math.abs(c-d)-p-v;if(y<0)return o?Dt(Ob||(Ob=si(["M ",",",`
615
+ a`,",",",0,0,1,",`,0
616
+ a`,",",",0,0,1,",`,0
617
+ `])),m.x,m.y,i,i,i*2,i,i,-i*2):ZC({cx:t,cy:r,innerRadius:n,outerRadius:a,startAngle:c,endAngle:d});var b=Dt(Eb||(Eb=si(["M ",",",`
618
+ A`,",",",0,0,",",",",",`
619
+ A`,",",",0,",",",",",",",`
620
+ A`,",",",0,0,",",",",",`
621
+ `])),m.x,m.y,i,i,+(u<0),f.x,f.y,a,a,+(y>180),+(u<0),x.x,x.y,i,i,+(u<0),g.x,g.y);if(n>0){var{circleTangency:N,lineTangency:j,theta:k}=dd({cx:t,cy:r,radius:n,angle:c,sign:u,isExternal:!0,cornerRadius:i,cornerIsExternal:l}),{circleTangency:w,lineTangency:S,theta:_}=dd({cx:t,cy:r,radius:n,angle:d,sign:-u,isExternal:!0,cornerRadius:i,cornerIsExternal:l}),C=l?Math.abs(c-d):Math.abs(c-d)-k-_;if(C<0&&i===0)return"".concat(b,"L").concat(t,",").concat(r,"Z");b+=Dt(Ab||(Ab=si(["L",",",`
622
+ A`,",",",0,0,",",",",",`
623
+ A`,",",",0,",",",",",",",`
624
+ A`,",",",0,0,",",",",","Z"])),S.x,S.y,i,i,+(u<0),w.x,w.y,n,n,+(C>180),+(u>0),N.x,N.y,i,i,+(u<0),j.x,j.y)}else b+=Dt(Db||(Db=si(["L",",","Z"])),t,r);return b},qq={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},JC=e=>{var t=xn(e,qq),{cx:r,cy:n,innerRadius:a,outerRadius:i,cornerRadius:o,forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u,className:f}=t;if(i<a||d===u)return null;var m=lt("recharts-sector",f),p=i-a,x=Hn(o,p,0,!0),g;return x>0&&Math.abs(d-u)<360?g=Bq({cx:r,cy:n,innerRadius:a,outerRadius:i,cornerRadius:Math.min(x,p/2),forceCornerRadius:l,cornerIsExternal:c,startAngle:d,endAngle:u}):g=ZC({cx:r,cy:n,innerRadius:a,outerRadius:i,startAngle:d,endAngle:u}),h.createElement("path",Sp({},Qr(t),{className:m,d:g}))};function Wq(e,t,r){if(e==="horizontal")return[{x:t.x,y:r.top},{x:t.x,y:r.top+r.height}];if(e==="vertical")return[{x:r.left,y:t.y},{x:r.left+r.width,y:t.y}];if(b2(t)){if(e==="centric"){var{cx:n,cy:a,innerRadius:i,outerRadius:o,angle:l}=t,c=hr(n,a,i,l),d=hr(n,a,o,l);return[{x:c.x,y:c.y},{x:d.x,y:d.y}]}return QC(t)}}var e_={},t_={},r_={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=xg;function r(n){return t.isSymbol(n)?NaN:Number(n)}e.toNumber=r})(r_);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=r_;function r(n){return n?(n=t.toNumber(n),n===1/0||n===-1/0?(n<0?-1:1)*Number.MAX_VALUE:n===n?n:0):n===0?n:0}e.toFinite=r})(t_);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=gg,r=t_;function n(a,i,o){o&&typeof o!="number"&&t.isIterateeCall(a,i,o)&&(i=o=void 0),a=r.toFinite(a),i===void 0?(i=a,a=0):i=r.toFinite(i),o=o===void 0?a<i?1:-1:r.toFinite(o);const l=Math.max(Math.ceil((i-a)/(o||1)),0),c=new Array(l);for(let d=0;d<l;d++)c[d]=a,a+=o;return c}e.range=n})(e_);var Uq=e_.range;const n_=Qs(Uq);function Ma(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hq(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Eg(e){let t,r,n;e.length!==2?(t=Ma,r=(l,c)=>Ma(e(l),c),n=(l,c)=>e(l)-c):(t=e===Ma||e===Hq?e:Kq,r=e,n=e);function a(l,c,d=0,u=l.length){if(d<u){if(t(c,c)!==0)return u;do{const f=d+u>>>1;r(l[f],c)<0?d=f+1:u=f}while(d<u)}return d}function i(l,c,d=0,u=l.length){if(d<u){if(t(c,c)!==0)return u;do{const f=d+u>>>1;r(l[f],c)<=0?d=f+1:u=f}while(d<u)}return d}function o(l,c,d=0,u=l.length){const f=a(l,c,d,u-1);return f>d&&n(l[f-1],c)>-n(l[f],c)?f-1:f}return{left:a,center:o,right:i}}function Kq(){return 0}function s_(e){return e===null?NaN:+e}function*Yq(e,t){for(let r of e)r!=null&&(r=+r)>=r&&(yield r)}const Gq=Eg(Ma),Pc=Gq.right;Eg(s_).center;class Tb extends Map{constructor(t,r=Qq){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(const[n,a]of t)this.set(n,a)}get(t){return super.get(Ib(this,t))}has(t){return super.has(Ib(this,t))}set(t,r){return super.set(Vq(this,t),r)}delete(t){return super.delete(Xq(this,t))}}function Ib({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):r}function Vq({_intern:e,_key:t},r){const n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function Xq({_intern:e,_key:t},r){const n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Qq(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Zq(e=Ma){if(e===Ma)return a_;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{const n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function a_(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}const Jq=Math.sqrt(50),e9=Math.sqrt(10),t9=Math.sqrt(2);function gu(e,t,r){const n=(t-e)/Math.max(0,r),a=Math.floor(Math.log10(n)),i=n/Math.pow(10,a),o=i>=Jq?10:i>=e9?5:i>=t9?2:1;let l,c,d;return a<0?(d=Math.pow(10,-a)/o,l=Math.round(e*d),c=Math.round(t*d),l/d<e&&++l,c/d>t&&--c,d=-d):(d=Math.pow(10,a)*o,l=Math.round(e/d),c=Math.round(t/d),l*d<e&&++l,c*d>t&&--c),c<l&&.5<=r&&r<2?gu(e,t,r*2):[l,c,d]}function Cp(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];const n=t<e,[a,i,o]=n?gu(t,e,r):gu(e,t,r);if(!(i>=a))return[];const l=i-a+1,c=new Array(l);if(n)if(o<0)for(let d=0;d<l;++d)c[d]=(i-d)/-o;else for(let d=0;d<l;++d)c[d]=(i-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(a+d)/-o;else for(let d=0;d<l;++d)c[d]=(a+d)*o;return c}function _p(e,t,r){return t=+t,e=+e,r=+r,gu(e,t,r)[2]}function Pp(e,t,r){t=+t,e=+e,r=+r;const n=t<e,a=n?_p(t,e,r):_p(e,t,r);return(n?-1:1)*(a<0?1/-a:a)}function Rb(e,t){let r;for(const n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);return r}function $b(e,t){let r;for(const n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);return r}function i_(e,t,r=0,n=1/0,a){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(a=a===void 0?a_:Zq(a);n>r;){if(n-r>600){const c=n-r+1,d=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),m=.5*Math.sqrt(u*f*(c-f)/c)*(d-c/2<0?-1:1),p=Math.max(r,Math.floor(t-d*f/c+m)),x=Math.min(n,Math.floor(t+(c-d)*f/c+m));i_(e,t,p,x,a)}const i=e[t];let o=r,l=n;for(xl(e,r,t),a(e[n],i)>0&&xl(e,r,n);o<l;){for(xl(e,o,l),++o,--l;a(e[o],i)<0;)++o;for(;a(e[l],i)>0;)--l}a(e[r],i)===0?xl(e,r,l):(++l,xl(e,l,n)),l<=t&&(r=l+1),t<=l&&(n=l-1)}return e}function xl(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function r9(e,t,r){if(e=Float64Array.from(Yq(e)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return $b(e);if(t>=1)return Rb(e);var n,a=(n-1)*t,i=Math.floor(a),o=Rb(i_(e,i).subarray(0,i+1)),l=$b(e.subarray(i+1));return o+(l-o)*(a-i)}}function n9(e,t,r=s_){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,a=(n-1)*t,i=Math.floor(a),o=+r(e[i],i,e),l=+r(e[i+1],i+1,e);return o+(l-o)*(a-i)}}function s9(e,t,r){e=+e,t=+t,r=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+r;for(var n=-1,a=Math.max(0,Math.ceil((t-e)/r))|0,i=new Array(a);++n<a;)i[n]=e+n*r;return i}function An(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function aa(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}const Mp=Symbol("implicit");function Ag(){var e=new Tb,t=[],r=[],n=Mp;function a(i){let o=e.get(i);if(o===void 0){if(n!==Mp)return n;e.set(i,o=t.push(i)-1)}return r[o%r.length]}return a.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new Tb;for(const o of i)e.has(o)||e.set(o,t.push(o)-1);return a},a.range=function(i){return arguments.length?(r=Array.from(i),a):r.slice()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return Ag(t,r).unknown(n)},An.apply(a,arguments),a}function Dg(){var e=Ag().unknown(void 0),t=e.domain,r=e.range,n=0,a=1,i,o,l=!1,c=0,d=0,u=.5;delete e.unknown;function f(){var m=t().length,p=a<n,x=p?a:n,g=p?n:a;i=(g-x)/Math.max(1,m-c+d*2),l&&(i=Math.floor(i)),x+=(g-x-i*(m-c))*u,o=i*(1-c),l&&(x=Math.round(x),o=Math.round(o));var v=s9(m).map(function(y){return x+i*y});return r(p?v.reverse():v)}return e.domain=function(m){return arguments.length?(t(m),f()):t()},e.range=function(m){return arguments.length?([n,a]=m,n=+n,a=+a,f()):[n,a]},e.rangeRound=function(m){return[n,a]=m,n=+n,a=+a,l=!0,f()},e.bandwidth=function(){return o},e.step=function(){return i},e.round=function(m){return arguments.length?(l=!!m,f()):l},e.padding=function(m){return arguments.length?(c=Math.min(1,d=+m),f()):c},e.paddingInner=function(m){return arguments.length?(c=Math.min(1,m),f()):c},e.paddingOuter=function(m){return arguments.length?(d=+m,f()):d},e.align=function(m){return arguments.length?(u=Math.max(0,Math.min(1,m)),f()):u},e.copy=function(){return Dg(t(),[n,a]).round(l).paddingInner(c).paddingOuter(d).align(u)},An.apply(f(),arguments)}function o_(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return o_(t())},e}function a9(){return o_(Dg.apply(null,arguments).paddingInner(1))}function Tg(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function l_(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Mc(){}var Hl=.7,vu=1/Hl,to="\\s*([+-]?\\d+)\\s*",Kl="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",us="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",i9=/^#([0-9a-f]{3,8})$/,o9=new RegExp(`^rgb\\(${to},${to},${to}\\)$`),l9=new RegExp(`^rgb\\(${us},${us},${us}\\)$`),c9=new RegExp(`^rgba\\(${to},${to},${to},${Kl}\\)$`),d9=new RegExp(`^rgba\\(${us},${us},${us},${Kl}\\)$`),u9=new RegExp(`^hsl\\(${Kl},${us},${us}\\)$`),f9=new RegExp(`^hsla\\(${Kl},${us},${us},${Kl}\\)$`),zb={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Tg(Mc,Yl,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Lb,formatHex:Lb,formatHex8:m9,formatHsl:h9,formatRgb:Fb,toString:Fb});function Lb(){return this.rgb().formatHex()}function m9(){return this.rgb().formatHex8()}function h9(){return c_(this).formatHsl()}function Fb(){return this.rgb().formatRgb()}function Yl(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=i9.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?Bb(t):r===3?new Kr(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?ud(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?ud(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=o9.exec(e))?new Kr(t[1],t[2],t[3],1):(t=l9.exec(e))?new Kr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=c9.exec(e))?ud(t[1],t[2],t[3],t[4]):(t=d9.exec(e))?ud(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=u9.exec(e))?Ub(t[1],t[2]/100,t[3]/100,1):(t=f9.exec(e))?Ub(t[1],t[2]/100,t[3]/100,t[4]):zb.hasOwnProperty(e)?Bb(zb[e]):e==="transparent"?new Kr(NaN,NaN,NaN,0):null}function Bb(e){return new Kr(e>>16&255,e>>8&255,e&255,1)}function ud(e,t,r,n){return n<=0&&(e=t=r=NaN),new Kr(e,t,r,n)}function p9(e){return e instanceof Mc||(e=Yl(e)),e?(e=e.rgb(),new Kr(e.r,e.g,e.b,e.opacity)):new Kr}function Op(e,t,r,n){return arguments.length===1?p9(e):new Kr(e,t,r,n??1)}function Kr(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Tg(Kr,Op,l_(Mc,{brighter(e){return e=e==null?vu:Math.pow(vu,e),new Kr(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Hl:Math.pow(Hl,e),new Kr(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Kr(di(this.r),di(this.g),di(this.b),yu(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:qb,formatHex:qb,formatHex8:x9,formatRgb:Wb,toString:Wb}));function qb(){return`#${ai(this.r)}${ai(this.g)}${ai(this.b)}`}function x9(){return`#${ai(this.r)}${ai(this.g)}${ai(this.b)}${ai((isNaN(this.opacity)?1:this.opacity)*255)}`}function Wb(){const e=yu(this.opacity);return`${e===1?"rgb(":"rgba("}${di(this.r)}, ${di(this.g)}, ${di(this.b)}${e===1?")":`, ${e})`}`}function yu(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function di(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ai(e){return e=di(e),(e<16?"0":"")+e.toString(16)}function Ub(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Fn(e,t,r,n)}function c_(e){if(e instanceof Fn)return new Fn(e.h,e.s,e.l,e.opacity);if(e instanceof Mc||(e=Yl(e)),!e)return new Fn;if(e instanceof Fn)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,a=Math.min(t,r,n),i=Math.max(t,r,n),o=NaN,l=i-a,c=(i+a)/2;return l?(t===i?o=(r-n)/l+(r<n)*6:r===i?o=(n-t)/l+2:o=(t-r)/l+4,l/=c<.5?i+a:2-i-a,o*=60):l=c>0&&c<1?0:o,new Fn(o,l,c,e.opacity)}function g9(e,t,r,n){return arguments.length===1?c_(e):new Fn(e,t,r,n??1)}function Fn(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Tg(Fn,g9,l_(Mc,{brighter(e){return e=e==null?vu:Math.pow(vu,e),new Fn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Hl:Math.pow(Hl,e),new Fn(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new Kr(dh(e>=240?e-240:e+120,a,n),dh(e,a,n),dh(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new Fn(Hb(this.h),fd(this.s),fd(this.l),yu(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=yu(this.opacity);return`${e===1?"hsl(":"hsla("}${Hb(this.h)}, ${fd(this.s)*100}%, ${fd(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Hb(e){return e=(e||0)%360,e<0?e+360:e}function fd(e){return Math.max(0,Math.min(1,e||0))}function dh(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const Ig=e=>()=>e;function v9(e,t){return function(r){return e+r*t}}function y9(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function b9(e){return(e=+e)==1?d_:function(t,r){return r-t?y9(t,r,e):Ig(isNaN(t)?r:t)}}function d_(e,t){var r=t-e;return r?v9(e,r):Ig(isNaN(e)?t:e)}const Kb=function e(t){var r=b9(t);function n(a,i){var o=r((a=Op(a)).r,(i=Op(i)).r),l=r(a.g,i.g),c=r(a.b,i.b),d=d_(a.opacity,i.opacity);return function(u){return a.r=o(u),a.g=l(u),a.b=c(u),a.opacity=d(u),a+""}}return n.gamma=e,n}(1);function j9(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),a;return function(i){for(a=0;a<r;++a)n[a]=e[a]*(1-i)+t[a]*i;return n}}function w9(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function N9(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,a=new Array(n),i=new Array(r),o;for(o=0;o<n;++o)a[o]=qo(e[o],t[o]);for(;o<r;++o)i[o]=t[o];return function(l){for(o=0;o<n;++o)i[o]=a[o](l);return i}}function k9(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function bu(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function S9(e,t){var r={},n={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=qo(e[a],t[a]):n[a]=t[a];return function(i){for(a in r)n[a]=r[a](i);return n}}var Ep=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,uh=new RegExp(Ep.source,"g");function C9(e){return function(){return e}}function _9(e){return function(t){return e(t)+""}}function P9(e,t){var r=Ep.lastIndex=uh.lastIndex=0,n,a,i,o=-1,l=[],c=[];for(e=e+"",t=t+"";(n=Ep.exec(e))&&(a=uh.exec(t));)(i=a.index)>r&&(i=t.slice(r,i),l[o]?l[o]+=i:l[++o]=i),(n=n[0])===(a=a[0])?l[o]?l[o]+=a:l[++o]=a:(l[++o]=null,c.push({i:o,x:bu(n,a)})),r=uh.lastIndex;return r<t.length&&(i=t.slice(r),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?_9(c[0].x):C9(t):(t=c.length,function(d){for(var u=0,f;u<t;++u)l[(f=c[u]).i]=f.x(d);return l.join("")})}function qo(e,t){var r=typeof t,n;return t==null||r==="boolean"?Ig(t):(r==="number"?bu:r==="string"?(n=Yl(t))?(t=n,Kb):P9:t instanceof Yl?Kb:t instanceof Date?k9:w9(t)?j9:Array.isArray(t)?N9:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?S9:bu)(e,t)}function Rg(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function M9(e,t){t===void 0&&(t=e,e=qo);for(var r=0,n=t.length-1,a=t[0],i=new Array(n<0?0:n);r<n;)i[r]=e(a,a=t[++r]);return function(o){var l=Math.max(0,Math.min(n-1,Math.floor(o*=n)));return i[l](o-l)}}function O9(e){return function(){return e}}function ju(e){return+e}var Yb=[0,1];function Pr(e){return e}function Ap(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:O9(isNaN(t)?NaN:.5)}function E9(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function A9(e,t,r){var n=e[0],a=e[1],i=t[0],o=t[1];return a<n?(n=Ap(a,n),i=r(o,i)):(n=Ap(n,a),i=r(i,o)),function(l){return i(n(l))}}function D9(e,t,r){var n=Math.min(e.length,t.length)-1,a=new Array(n),i=new Array(n),o=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<n;)a[o]=Ap(e[o],e[o+1]),i[o]=r(t[o],t[o+1]);return function(l){var c=Pc(e,l,1,n)-1;return i[c](a[c](l))}}function Oc(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Xf(){var e=Yb,t=Yb,r=qo,n,a,i,o=Pr,l,c,d;function u(){var m=Math.min(e.length,t.length);return o!==Pr&&(o=E9(e[0],e[m-1])),l=m>2?D9:A9,c=d=null,f}function f(m){return m==null||isNaN(m=+m)?i:(c||(c=l(e.map(n),t,r)))(n(o(m)))}return f.invert=function(m){return o(a((d||(d=l(t,e.map(n),bu)))(m)))},f.domain=function(m){return arguments.length?(e=Array.from(m,ju),u()):e.slice()},f.range=function(m){return arguments.length?(t=Array.from(m),u()):t.slice()},f.rangeRound=function(m){return t=Array.from(m),r=Rg,u()},f.clamp=function(m){return arguments.length?(o=m?!0:Pr,u()):o!==Pr},f.interpolate=function(m){return arguments.length?(r=m,u()):r},f.unknown=function(m){return arguments.length?(i=m,f):i},function(m,p){return n=m,a=p,u()}}function $g(){return Xf()(Pr,Pr)}function T9(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function wu(e,t){if(!isFinite(e)||e===0)return null;var r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function xo(e){return e=wu(Math.abs(e)),e?e[1]:NaN}function I9(e,t){return function(r,n){for(var a=r.length,i=[],o=0,l=e[0],c=0;a>0&&l>0&&(c+l+1>n&&(l=Math.max(1,n-c)),i.push(r.substring(a-=l,a+l)),!((c+=l+1)>n));)l=e[o=(o+1)%e.length];return i.reverse().join(t)}}function R9(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var $9=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Gl(e){if(!(t=$9.exec(e)))throw new Error("invalid format: "+e);var t;return new zg({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Gl.prototype=zg.prototype;function zg(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}zg.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function z9(e){e:for(var t=e.length,r=1,n=-1,a;r<t;++r)switch(e[r]){case".":n=a=r;break;case"0":n===0&&(n=r),a=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(a+1):e}var Nu;function L9(e,t){var r=wu(e,t);if(!r)return Nu=void 0,e.toPrecision(t);var n=r[0],a=r[1],i=a-(Nu=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,o=n.length;return i===o?n:i>o?n+new Array(i-o+1).join("0"):i>0?n.slice(0,i)+"."+n.slice(i):"0."+new Array(1-i).join("0")+wu(e,Math.max(0,t+i-1))[0]}function Gb(e,t){var r=wu(e,t);if(!r)return e+"";var n=r[0],a=r[1];return a<0?"0."+new Array(-a).join("0")+n:n.length>a+1?n.slice(0,a+1)+"."+n.slice(a+1):n+new Array(a-n.length+2).join("0")}const Vb={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:T9,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Gb(e*100,t),r:Gb,s:L9,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Xb(e){return e}var Qb=Array.prototype.map,Zb=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function F9(e){var t=e.grouping===void 0||e.thousands===void 0?Xb:I9(Qb.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",i=e.numerals===void 0?Xb:R9(Qb.call(e.numerals,String)),o=e.percent===void 0?"%":e.percent+"",l=e.minus===void 0?"−":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function d(f,m){f=Gl(f);var p=f.fill,x=f.align,g=f.sign,v=f.symbol,y=f.zero,b=f.width,N=f.comma,j=f.precision,k=f.trim,w=f.type;w==="n"?(N=!0,w="g"):Vb[w]||(j===void 0&&(j=12),k=!0,w="g"),(y||p==="0"&&x==="=")&&(y=!0,p="0",x="=");var S=(m&&m.prefix!==void 0?m.prefix:"")+(v==="$"?r:v==="#"&&/[boxX]/.test(w)?"0"+w.toLowerCase():""),_=(v==="$"?n:/[%p]/.test(w)?o:"")+(m&&m.suffix!==void 0?m.suffix:""),C=Vb[w],P=/[defgprs%]/.test(w);j=j===void 0?6:/[gprs]/.test(w)?Math.max(1,Math.min(21,j)):Math.max(0,Math.min(20,j));function O(E){var D=S,I=_,V,Q,q;if(w==="c")I=C(E)+I,E="";else{E=+E;var re=E<0||1/E<0;if(E=isNaN(E)?c:C(Math.abs(E),j),k&&(E=z9(E)),re&&+E==0&&g!=="+"&&(re=!1),D=(re?g==="("?g:l:g==="-"||g==="("?"":g)+D,I=(w==="s"&&!isNaN(E)&&Nu!==void 0?Zb[8+Nu/3]:"")+I+(re&&g==="("?")":""),P){for(V=-1,Q=E.length;++V<Q;)if(q=E.charCodeAt(V),48>q||q>57){I=(q===46?a+E.slice(V+1):E.slice(V))+I,E=E.slice(0,V);break}}}N&&!y&&(E=t(E,1/0));var se=D.length+E.length+I.length,T=se<b?new Array(b-se+1).join(p):"";switch(N&&y&&(E=t(T+E,T.length?b-I.length:1/0),T=""),x){case"<":E=D+E+I+T;break;case"=":E=D+T+E+I;break;case"^":E=T.slice(0,se=T.length>>1)+D+E+I+T.slice(se);break;default:E=T+D+E+I;break}return i(E)}return O.toString=function(){return f+""},O}function u(f,m){var p=Math.max(-8,Math.min(8,Math.floor(xo(m)/3)))*3,x=Math.pow(10,-p),g=d((f=Gl(f),f.type="f",f),{suffix:Zb[8+p/3]});return function(v){return g(x*v)}}return{format:d,formatPrefix:u}}var md,Lg,u_;B9({thousands:",",grouping:[3],currency:["$",""]});function B9(e){return md=F9(e),Lg=md.format,u_=md.formatPrefix,md}function q9(e){return Math.max(0,-xo(Math.abs(e)))}function W9(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(xo(t)/3)))*3-xo(Math.abs(e)))}function U9(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,xo(t)-xo(e))+1}function f_(e,t,r,n){var a=Pp(e,t,r),i;switch(n=Gl(n??",f"),n.type){case"s":{var o=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(i=W9(a,o))&&(n.precision=i),u_(n,o)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(i=U9(a,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=i-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(i=q9(a))&&(n.precision=i-(n.type==="%")*2);break}}return Lg(n)}function Ba(e){var t=e.domain;return e.ticks=function(r){var n=t();return Cp(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var a=t();return f_(a[0],a[a.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),a=0,i=n.length-1,o=n[a],l=n[i],c,d,u=10;for(l<o&&(d=o,o=l,l=d,d=a,a=i,i=d);u-- >0;){if(d=_p(o,l,r),d===c)return n[a]=o,n[i]=l,t(n);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return e},e}function m_(){var e=$g();return e.copy=function(){return Oc(e,m_())},An.apply(e,arguments),Ba(e)}function h_(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,ju),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return h_(e).unknown(t)},e=arguments.length?Array.from(e,ju):[0,1],Ba(r)}function p_(e,t){e=e.slice();var r=0,n=e.length-1,a=e[r],i=e[n],o;return i<a&&(o=r,r=n,n=o,o=a,a=i,i=o),e[r]=t.floor(a),e[n]=t.ceil(i),e}function Jb(e){return Math.log(e)}function ej(e){return Math.exp(e)}function H9(e){return-Math.log(-e)}function K9(e){return-Math.exp(-e)}function Y9(e){return isFinite(e)?+("1e"+e):e<0?0:e}function G9(e){return e===10?Y9:e===Math.E?Math.exp:t=>Math.pow(e,t)}function V9(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function tj(e){return(t,r)=>-e(-t,r)}function Fg(e){const t=e(Jb,ej),r=t.domain;let n=10,a,i;function o(){return a=V9(n),i=G9(n),r()[0]<0?(a=tj(a),i=tj(i),e(H9,K9)):e(Jb,ej),t}return t.base=function(l){return arguments.length?(n=+l,o()):n},t.domain=function(l){return arguments.length?(r(l),o()):r()},t.ticks=l=>{const c=r();let d=c[0],u=c[c.length-1];const f=u<d;f&&([d,u]=[u,d]);let m=a(d),p=a(u),x,g;const v=l==null?10:+l;let y=[];if(!(n%1)&&p-m<v){if(m=Math.floor(m),p=Math.ceil(p),d>0){for(;m<=p;++m)for(x=1;x<n;++x)if(g=m<0?x/i(-m):x*i(m),!(g<d)){if(g>u)break;y.push(g)}}else for(;m<=p;++m)for(x=n-1;x>=1;--x)if(g=m>0?x/i(-m):x*i(m),!(g<d)){if(g>u)break;y.push(g)}y.length*2<v&&(y=Cp(d,u,v))}else y=Cp(m,p,Math.min(p-m,v)).map(i);return f?y.reverse():y},t.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=Gl(c)).precision==null&&(c.trim=!0),c=Lg(c)),l===1/0)return c;const d=Math.max(1,n*l/t.ticks().length);return u=>{let f=u/i(Math.round(a(u)));return f*n<n-.5&&(f*=n),f<=d?c(u):""}},t.nice=()=>r(p_(r(),{floor:l=>i(Math.floor(a(l))),ceil:l=>i(Math.ceil(a(l)))})),t}function x_(){const e=Fg(Xf()).domain([1,10]);return e.copy=()=>Oc(e,x_()).base(e.base()),An.apply(e,arguments),e}function rj(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function nj(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function Bg(e){var t=1,r=e(rj(t),nj(t));return r.constant=function(n){return arguments.length?e(rj(t=+n),nj(t)):t},Ba(r)}function g_(){var e=Bg(Xf());return e.copy=function(){return Oc(e,g_()).constant(e.constant())},An.apply(e,arguments)}function sj(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function X9(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Q9(e){return e<0?-e*e:e*e}function qg(e){var t=e(Pr,Pr),r=1;function n(){return r===1?e(Pr,Pr):r===.5?e(X9,Q9):e(sj(r),sj(1/r))}return t.exponent=function(a){return arguments.length?(r=+a,n()):r},Ba(t)}function Wg(){var e=qg(Xf());return e.copy=function(){return Oc(e,Wg()).exponent(e.exponent())},An.apply(e,arguments),e}function Z9(){return Wg.apply(null,arguments).exponent(.5)}function aj(e){return Math.sign(e)*e*e}function J9(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function v_(){var e=$g(),t=[0,1],r=!1,n;function a(i){var o=J9(e(i));return isNaN(o)?n:r?Math.round(o):o}return a.invert=function(i){return e.invert(aj(i))},a.domain=function(i){return arguments.length?(e.domain(i),a):e.domain()},a.range=function(i){return arguments.length?(e.range((t=Array.from(i,ju)).map(aj)),a):t.slice()},a.rangeRound=function(i){return a.range(i).round(!0)},a.round=function(i){return arguments.length?(r=!!i,a):r},a.clamp=function(i){return arguments.length?(e.clamp(i),a):e.clamp()},a.unknown=function(i){return arguments.length?(n=i,a):n},a.copy=function(){return v_(e.domain(),t).round(r).clamp(e.clamp()).unknown(n)},An.apply(a,arguments),Ba(a)}function y_(){var e=[],t=[],r=[],n;function a(){var o=0,l=Math.max(1,t.length);for(r=new Array(l-1);++o<l;)r[o-1]=n9(e,o/l);return i}function i(o){return o==null||isNaN(o=+o)?n:t[Pc(r,o)]}return i.invertExtent=function(o){var l=t.indexOf(o);return l<0?[NaN,NaN]:[l>0?r[l-1]:e[0],l<r.length?r[l]:e[e.length-1]]},i.domain=function(o){if(!arguments.length)return e.slice();e=[];for(let l of o)l!=null&&!isNaN(l=+l)&&e.push(l);return e.sort(Ma),a()},i.range=function(o){return arguments.length?(t=Array.from(o),a()):t.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.quantiles=function(){return r.slice()},i.copy=function(){return y_().domain(e).range(t).unknown(n)},An.apply(i,arguments)}function b_(){var e=0,t=1,r=1,n=[.5],a=[0,1],i;function o(c){return c!=null&&c<=c?a[Pc(n,c,0,r)]:i}function l(){var c=-1;for(n=new Array(r);++c<r;)n[c]=((c+1)*t-(c-r)*e)/(r+1);return o}return o.domain=function(c){return arguments.length?([e,t]=c,e=+e,t=+t,l()):[e,t]},o.range=function(c){return arguments.length?(r=(a=Array.from(c)).length-1,l()):a.slice()},o.invertExtent=function(c){var d=a.indexOf(c);return d<0?[NaN,NaN]:d<1?[e,n[0]]:d>=r?[n[r-1],t]:[n[d-1],n[d]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return n.slice()},o.copy=function(){return b_().domain([e,t]).range(a).unknown(i)},An.apply(Ba(o),arguments)}function j_(){var e=[.5],t=[0,1],r,n=1;function a(i){return i!=null&&i<=i?t[Pc(e,i,0,n)]:r}return a.domain=function(i){return arguments.length?(e=Array.from(i),n=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(i){return arguments.length?(t=Array.from(i),n=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(i){var o=t.indexOf(i);return[e[o-1],e[o]]},a.unknown=function(i){return arguments.length?(r=i,a):r},a.copy=function(){return j_().domain(e).range(t).unknown(r)},An.apply(a,arguments)}const fh=new Date,mh=new Date;function Yt(e,t,r,n){function a(i){return e(i=arguments.length===0?new Date:new Date(+i)),i}return a.floor=i=>(e(i=new Date(+i)),i),a.ceil=i=>(e(i=new Date(i-1)),t(i,1),e(i),i),a.round=i=>{const o=a(i),l=a.ceil(i);return i-o<l-i?o:l},a.offset=(i,o)=>(t(i=new Date(+i),o==null?1:Math.floor(o)),i),a.range=(i,o,l)=>{const c=[];if(i=a.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let d;do c.push(d=new Date(+i)),t(i,l),e(i);while(d<i&&i<o);return c},a.filter=i=>Yt(o=>{if(o>=o)for(;e(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;t(o,-1),!i(o););else for(;--l>=0;)for(;t(o,1),!i(o););}),r&&(a.count=(i,o)=>(fh.setTime(+i),mh.setTime(+o),e(fh),e(mh),Math.floor(r(fh,mh))),a.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?a.filter(n?o=>n(o)%i===0:o=>a.count(0,o)%i===0):a)),a}const ku=Yt(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);ku.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Yt(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):ku);ku.range;const Es=1e3,wn=Es*60,As=wn*60,Hs=As*24,Ug=Hs*7,ij=Hs*30,hh=Hs*365,ii=Yt(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Es)},(e,t)=>(t-e)/Es,e=>e.getUTCSeconds());ii.range;const Hg=Yt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Es)},(e,t)=>{e.setTime(+e+t*wn)},(e,t)=>(t-e)/wn,e=>e.getMinutes());Hg.range;const Kg=Yt(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*wn)},(e,t)=>(t-e)/wn,e=>e.getUTCMinutes());Kg.range;const Yg=Yt(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Es-e.getMinutes()*wn)},(e,t)=>{e.setTime(+e+t*As)},(e,t)=>(t-e)/As,e=>e.getHours());Yg.range;const Gg=Yt(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*As)},(e,t)=>(t-e)/As,e=>e.getUTCHours());Gg.range;const Ec=Yt(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*wn)/Hs,e=>e.getDate()-1);Ec.range;const Qf=Yt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Hs,e=>e.getUTCDate()-1);Qf.range;const w_=Yt(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Hs,e=>Math.floor(e/Hs));w_.range;function Di(e){return Yt(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*wn)/Ug)}const Zf=Di(0),Su=Di(1),eW=Di(2),tW=Di(3),go=Di(4),rW=Di(5),nW=Di(6);Zf.range;Su.range;eW.range;tW.range;go.range;rW.range;nW.range;function Ti(e){return Yt(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/Ug)}const Jf=Ti(0),Cu=Ti(1),sW=Ti(2),aW=Ti(3),vo=Ti(4),iW=Ti(5),oW=Ti(6);Jf.range;Cu.range;sW.range;aW.range;vo.range;iW.range;oW.range;const Vg=Yt(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());Vg.range;const Xg=Yt(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Xg.range;const Ks=Yt(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Ks.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Yt(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});Ks.range;const Ys=Yt(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ys.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Yt(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});Ys.range;function N_(e,t,r,n,a,i){const o=[[ii,1,Es],[ii,5,5*Es],[ii,15,15*Es],[ii,30,30*Es],[i,1,wn],[i,5,5*wn],[i,15,15*wn],[i,30,30*wn],[a,1,As],[a,3,3*As],[a,6,6*As],[a,12,12*As],[n,1,Hs],[n,2,2*Hs],[r,1,Ug],[t,1,ij],[t,3,3*ij],[e,1,hh]];function l(d,u,f){const m=u<d;m&&([d,u]=[u,d]);const p=f&&typeof f.range=="function"?f:c(d,u,f),x=p?p.range(d,+u+1):[];return m?x.reverse():x}function c(d,u,f){const m=Math.abs(u-d)/f,p=Eg(([,,v])=>v).right(o,m);if(p===o.length)return e.every(Pp(d/hh,u/hh,f));if(p===0)return ku.every(Math.max(Pp(d,u,f),1));const[x,g]=o[m/o[p-1][2]<o[p][2]/m?p-1:p];return x.every(g)}return[l,c]}const[lW,cW]=N_(Ys,Xg,Jf,w_,Gg,Kg),[dW,uW]=N_(Ks,Vg,Zf,Ec,Yg,Hg);function ph(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function xh(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function gl(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function fW(e){var t=e.dateTime,r=e.date,n=e.time,a=e.periods,i=e.days,o=e.shortDays,l=e.months,c=e.shortMonths,d=vl(a),u=yl(a),f=vl(i),m=yl(i),p=vl(o),x=yl(o),g=vl(l),v=yl(l),y=vl(c),b=yl(c),N={a:q,A:re,b:se,B:T,c:null,d:fj,e:fj,f:IW,g:HW,G:YW,H:AW,I:DW,j:TW,L:k_,m:RW,M:$W,p:M,q:L,Q:pj,s:xj,S:zW,u:LW,U:FW,V:BW,w:qW,W:WW,x:null,X:null,y:UW,Y:KW,Z:GW,"%":hj},j={a:H,A:R,b:Y,B:J,c:null,d:mj,e:mj,f:ZW,g:lU,G:dU,H:VW,I:XW,j:QW,L:C_,m:JW,M:eU,p:A,q:U,Q:pj,s:xj,S:tU,u:rU,U:nU,V:sU,w:aU,W:iU,x:null,X:null,y:oU,Y:cU,Z:uU,"%":hj},k={a:P,A:O,b:E,B:D,c:I,d:dj,e:dj,f:PW,g:cj,G:lj,H:uj,I:uj,j:kW,L:_W,m:NW,M:SW,p:C,q:wW,Q:OW,s:EW,S:CW,u:gW,U:vW,V:yW,w:xW,W:bW,x:V,X:Q,y:cj,Y:lj,Z:jW,"%":MW};N.x=w(r,N),N.X=w(n,N),N.c=w(t,N),j.x=w(r,j),j.X=w(n,j),j.c=w(t,j);function w($,ne){return function(B){var X=[],oe=-1,G=0,te=$.length,de,me,Z;for(B instanceof Date||(B=new Date(+B));++oe<te;)$.charCodeAt(oe)===37&&(X.push($.slice(G,oe)),(me=oj[de=$.charAt(++oe)])!=null?de=$.charAt(++oe):me=de==="e"?" ":"0",(Z=ne[de])&&(de=Z(B,me)),X.push(de),G=oe+1);return X.push($.slice(G,oe)),X.join("")}}function S($,ne){return function(B){var X=gl(1900,void 0,1),oe=_(X,$,B+="",0),G,te;if(oe!=B.length)return null;if("Q"in X)return new Date(X.Q);if("s"in X)return new Date(X.s*1e3+("L"in X?X.L:0));if(ne&&!("Z"in X)&&(X.Z=0),"p"in X&&(X.H=X.H%12+X.p*12),X.m===void 0&&(X.m="q"in X?X.q:0),"V"in X){if(X.V<1||X.V>53)return null;"w"in X||(X.w=1),"Z"in X?(G=xh(gl(X.y,0,1)),te=G.getUTCDay(),G=te>4||te===0?Cu.ceil(G):Cu(G),G=Qf.offset(G,(X.V-1)*7),X.y=G.getUTCFullYear(),X.m=G.getUTCMonth(),X.d=G.getUTCDate()+(X.w+6)%7):(G=ph(gl(X.y,0,1)),te=G.getDay(),G=te>4||te===0?Su.ceil(G):Su(G),G=Ec.offset(G,(X.V-1)*7),X.y=G.getFullYear(),X.m=G.getMonth(),X.d=G.getDate()+(X.w+6)%7)}else("W"in X||"U"in X)&&("w"in X||(X.w="u"in X?X.u%7:"W"in X?1:0),te="Z"in X?xh(gl(X.y,0,1)).getUTCDay():ph(gl(X.y,0,1)).getDay(),X.m=0,X.d="W"in X?(X.w+6)%7+X.W*7-(te+5)%7:X.w+X.U*7-(te+6)%7);return"Z"in X?(X.H+=X.Z/100|0,X.M+=X.Z%100,xh(X)):ph(X)}}function _($,ne,B,X){for(var oe=0,G=ne.length,te=B.length,de,me;oe<G;){if(X>=te)return-1;if(de=ne.charCodeAt(oe++),de===37){if(de=ne.charAt(oe++),me=k[de in oj?ne.charAt(oe++):de],!me||(X=me($,B,X))<0)return-1}else if(de!=B.charCodeAt(X++))return-1}return X}function C($,ne,B){var X=d.exec(ne.slice(B));return X?($.p=u.get(X[0].toLowerCase()),B+X[0].length):-1}function P($,ne,B){var X=p.exec(ne.slice(B));return X?($.w=x.get(X[0].toLowerCase()),B+X[0].length):-1}function O($,ne,B){var X=f.exec(ne.slice(B));return X?($.w=m.get(X[0].toLowerCase()),B+X[0].length):-1}function E($,ne,B){var X=y.exec(ne.slice(B));return X?($.m=b.get(X[0].toLowerCase()),B+X[0].length):-1}function D($,ne,B){var X=g.exec(ne.slice(B));return X?($.m=v.get(X[0].toLowerCase()),B+X[0].length):-1}function I($,ne,B){return _($,t,ne,B)}function V($,ne,B){return _($,r,ne,B)}function Q($,ne,B){return _($,n,ne,B)}function q($){return o[$.getDay()]}function re($){return i[$.getDay()]}function se($){return c[$.getMonth()]}function T($){return l[$.getMonth()]}function M($){return a[+($.getHours()>=12)]}function L($){return 1+~~($.getMonth()/3)}function H($){return o[$.getUTCDay()]}function R($){return i[$.getUTCDay()]}function Y($){return c[$.getUTCMonth()]}function J($){return l[$.getUTCMonth()]}function A($){return a[+($.getUTCHours()>=12)]}function U($){return 1+~~($.getUTCMonth()/3)}return{format:function($){var ne=w($+="",N);return ne.toString=function(){return $},ne},parse:function($){var ne=S($+="",!1);return ne.toString=function(){return $},ne},utcFormat:function($){var ne=w($+="",j);return ne.toString=function(){return $},ne},utcParse:function($){var ne=S($+="",!0);return ne.toString=function(){return $},ne}}}var oj={"-":"",_:" ",0:"0"},tr=/^\s*\d+/,mW=/^%/,hW=/[\\^$*+?|[\]().{}]/g;function Qe(e,t,r){var n=e<0?"-":"",a=(n?-e:e)+"",i=a.length;return n+(i<r?new Array(r-i+1).join(t)+a:a)}function pW(e){return e.replace(hW,"\\$&")}function vl(e){return new RegExp("^(?:"+e.map(pW).join("|")+")","i")}function yl(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function xW(e,t,r){var n=tr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function gW(e,t,r){var n=tr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function vW(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function yW(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function bW(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function lj(e,t,r){var n=tr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function cj(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function jW(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function wW(e,t,r){var n=tr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function NW(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function dj(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function kW(e,t,r){var n=tr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function uj(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function SW(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function CW(e,t,r){var n=tr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function _W(e,t,r){var n=tr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function PW(e,t,r){var n=tr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function MW(e,t,r){var n=mW.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function OW(e,t,r){var n=tr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function EW(e,t,r){var n=tr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function fj(e,t){return Qe(e.getDate(),t,2)}function AW(e,t){return Qe(e.getHours(),t,2)}function DW(e,t){return Qe(e.getHours()%12||12,t,2)}function TW(e,t){return Qe(1+Ec.count(Ks(e),e),t,3)}function k_(e,t){return Qe(e.getMilliseconds(),t,3)}function IW(e,t){return k_(e,t)+"000"}function RW(e,t){return Qe(e.getMonth()+1,t,2)}function $W(e,t){return Qe(e.getMinutes(),t,2)}function zW(e,t){return Qe(e.getSeconds(),t,2)}function LW(e){var t=e.getDay();return t===0?7:t}function FW(e,t){return Qe(Zf.count(Ks(e)-1,e),t,2)}function S_(e){var t=e.getDay();return t>=4||t===0?go(e):go.ceil(e)}function BW(e,t){return e=S_(e),Qe(go.count(Ks(e),e)+(Ks(e).getDay()===4),t,2)}function qW(e){return e.getDay()}function WW(e,t){return Qe(Su.count(Ks(e)-1,e),t,2)}function UW(e,t){return Qe(e.getFullYear()%100,t,2)}function HW(e,t){return e=S_(e),Qe(e.getFullYear()%100,t,2)}function KW(e,t){return Qe(e.getFullYear()%1e4,t,4)}function YW(e,t){var r=e.getDay();return e=r>=4||r===0?go(e):go.ceil(e),Qe(e.getFullYear()%1e4,t,4)}function GW(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Qe(t/60|0,"0",2)+Qe(t%60,"0",2)}function mj(e,t){return Qe(e.getUTCDate(),t,2)}function VW(e,t){return Qe(e.getUTCHours(),t,2)}function XW(e,t){return Qe(e.getUTCHours()%12||12,t,2)}function QW(e,t){return Qe(1+Qf.count(Ys(e),e),t,3)}function C_(e,t){return Qe(e.getUTCMilliseconds(),t,3)}function ZW(e,t){return C_(e,t)+"000"}function JW(e,t){return Qe(e.getUTCMonth()+1,t,2)}function eU(e,t){return Qe(e.getUTCMinutes(),t,2)}function tU(e,t){return Qe(e.getUTCSeconds(),t,2)}function rU(e){var t=e.getUTCDay();return t===0?7:t}function nU(e,t){return Qe(Jf.count(Ys(e)-1,e),t,2)}function __(e){var t=e.getUTCDay();return t>=4||t===0?vo(e):vo.ceil(e)}function sU(e,t){return e=__(e),Qe(vo.count(Ys(e),e)+(Ys(e).getUTCDay()===4),t,2)}function aU(e){return e.getUTCDay()}function iU(e,t){return Qe(Cu.count(Ys(e)-1,e),t,2)}function oU(e,t){return Qe(e.getUTCFullYear()%100,t,2)}function lU(e,t){return e=__(e),Qe(e.getUTCFullYear()%100,t,2)}function cU(e,t){return Qe(e.getUTCFullYear()%1e4,t,4)}function dU(e,t){var r=e.getUTCDay();return e=r>=4||r===0?vo(e):vo.ceil(e),Qe(e.getUTCFullYear()%1e4,t,4)}function uU(){return"+0000"}function hj(){return"%"}function pj(e){return+e}function xj(e){return Math.floor(+e/1e3)}var qi,P_,M_;fU({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function fU(e){return qi=fW(e),P_=qi.format,qi.parse,M_=qi.utcFormat,qi.utcParse,qi}function mU(e){return new Date(e)}function hU(e){return e instanceof Date?+e:+new Date(+e)}function Qg(e,t,r,n,a,i,o,l,c,d){var u=$g(),f=u.invert,m=u.domain,p=d(".%L"),x=d(":%S"),g=d("%I:%M"),v=d("%I %p"),y=d("%a %d"),b=d("%b %d"),N=d("%B"),j=d("%Y");function k(w){return(c(w)<w?p:l(w)<w?x:o(w)<w?g:i(w)<w?v:n(w)<w?a(w)<w?y:b:r(w)<w?N:j)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?m(Array.from(w,hU)):m().map(mU)},u.ticks=function(w){var S=m();return e(S[0],S[S.length-1],w??10)},u.tickFormat=function(w,S){return S==null?k:d(S)},u.nice=function(w){var S=m();return(!w||typeof w.range!="function")&&(w=t(S[0],S[S.length-1],w??10)),w?m(p_(S,w)):u},u.copy=function(){return Oc(u,Qg(e,t,r,n,a,i,o,l,c,d))},u}function pU(){return An.apply(Qg(dW,uW,Ks,Vg,Zf,Ec,Yg,Hg,ii,P_).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function xU(){return An.apply(Qg(lW,cW,Ys,Xg,Jf,Qf,Gg,Kg,ii,M_).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function em(){var e=0,t=1,r,n,a,i,o=Pr,l=!1,c;function d(f){return f==null||isNaN(f=+f)?c:o(a===0?.5:(f=(i(f)-r)*a,l?Math.max(0,Math.min(1,f)):f))}d.domain=function(f){return arguments.length?([e,t]=f,r=i(e=+e),n=i(t=+t),a=r===n?0:1/(n-r),d):[e,t]},d.clamp=function(f){return arguments.length?(l=!!f,d):l},d.interpolator=function(f){return arguments.length?(o=f,d):o};function u(f){return function(m){var p,x;return arguments.length?([p,x]=m,o=f(p,x),d):[o(0),o(1)]}}return d.range=u(qo),d.rangeRound=u(Rg),d.unknown=function(f){return arguments.length?(c=f,d):c},function(f){return i=f,r=f(e),n=f(t),a=r===n?0:1/(n-r),d}}function qa(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function O_(){var e=Ba(em()(Pr));return e.copy=function(){return qa(e,O_())},aa.apply(e,arguments)}function E_(){var e=Fg(em()).domain([1,10]);return e.copy=function(){return qa(e,E_()).base(e.base())},aa.apply(e,arguments)}function A_(){var e=Bg(em());return e.copy=function(){return qa(e,A_()).constant(e.constant())},aa.apply(e,arguments)}function Zg(){var e=qg(em());return e.copy=function(){return qa(e,Zg()).exponent(e.exponent())},aa.apply(e,arguments)}function gU(){return Zg.apply(null,arguments).exponent(.5)}function D_(){var e=[],t=Pr;function r(n){if(n!=null&&!isNaN(n=+n))return t((Pc(e,n,1)-1)/(e.length-1))}return r.domain=function(n){if(!arguments.length)return e.slice();e=[];for(let a of n)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Ma),r},r.interpolator=function(n){return arguments.length?(t=n,r):t},r.range=function(){return e.map((n,a)=>t(a/(e.length-1)))},r.quantiles=function(n){return Array.from({length:n+1},(a,i)=>r9(e,i/n))},r.copy=function(){return D_(t).domain(e)},aa.apply(r,arguments)}function tm(){var e=0,t=.5,r=1,n=1,a,i,o,l,c,d=Pr,u,f=!1,m;function p(g){return isNaN(g=+g)?m:(g=.5+((g=+u(g))-i)*(n*g<n*i?l:c),d(f?Math.max(0,Math.min(1,g)):g))}p.domain=function(g){return arguments.length?([e,t,r]=g,a=u(e=+e),i=u(t=+t),o=u(r=+r),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),n=i<a?-1:1,p):[e,t,r]},p.clamp=function(g){return arguments.length?(f=!!g,p):f},p.interpolator=function(g){return arguments.length?(d=g,p):d};function x(g){return function(v){var y,b,N;return arguments.length?([y,b,N]=v,d=M9(g,[y,b,N]),p):[d(0),d(.5),d(1)]}}return p.range=x(qo),p.rangeRound=x(Rg),p.unknown=function(g){return arguments.length?(m=g,p):m},function(g){return u=g,a=g(e),i=g(t),o=g(r),l=a===i?0:.5/(i-a),c=i===o?0:.5/(o-i),n=i<a?-1:1,p}}function T_(){var e=Ba(tm()(Pr));return e.copy=function(){return qa(e,T_())},aa.apply(e,arguments)}function I_(){var e=Fg(tm()).domain([.1,1,10]);return e.copy=function(){return qa(e,I_()).base(e.base())},aa.apply(e,arguments)}function R_(){var e=Bg(tm());return e.copy=function(){return qa(e,R_()).constant(e.constant())},aa.apply(e,arguments)}function Jg(){var e=qg(tm());return e.copy=function(){return qa(e,Jg()).exponent(e.exponent())},aa.apply(e,arguments)}function vU(){return Jg.apply(null,arguments).exponent(.5)}const kl=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:Dg,scaleDiverging:T_,scaleDivergingLog:I_,scaleDivergingPow:Jg,scaleDivergingSqrt:vU,scaleDivergingSymlog:R_,scaleIdentity:h_,scaleImplicit:Mp,scaleLinear:m_,scaleLog:x_,scaleOrdinal:Ag,scalePoint:a9,scalePow:Wg,scaleQuantile:y_,scaleQuantize:b_,scaleRadial:v_,scaleSequential:O_,scaleSequentialLog:E_,scaleSequentialPow:Zg,scaleSequentialQuantile:D_,scaleSequentialSqrt:gU,scaleSequentialSymlog:A_,scaleSqrt:Z9,scaleSymlog:g_,scaleThreshold:j_,scaleTime:pU,scaleUtc:xU,tickFormat:f_},Symbol.toStringTag,{value:"Module"}));var ia=e=>e.chartData,$_=ae([ia],e=>{var t=e.chartData!=null?e.chartData.length-1:0;return{chartData:e.chartData,computedData:e.computedData,dataEndIndex:t,dataStartIndex:0}}),z_=(e,t,r,n)=>n?$_(e):ia(e),yU=(e,t,r)=>r?$_(e):ia(e);function Gs(e){if(Array.isArray(e)&&e.length===2){var[t,r]=e;if(Ye(t)&&Ye(r))return!0}return!1}function gj(e,t,r){return r?e:[Math.min(e[0],t[0]),Math.max(e[1],t[1])]}function L_(e,t){if(t&&typeof e!="function"&&Array.isArray(e)&&e.length===2){var[r,n]=e,a,i;if(Ye(r))a=r;else if(typeof r=="function")return;if(Ye(n))i=n;else if(typeof n=="function")return;var o=[a,i];if(Gs(o))return o}}function bU(e,t,r){if(!(!r&&t==null)){if(typeof e=="function"&&t!=null)try{var n=e(t,r);if(Gs(n))return gj(n,t,r)}catch{}if(Array.isArray(e)&&e.length===2){var[a,i]=e,o,l;if(a==="auto")t!=null&&(o=Math.min(...t));else if(Ce(a))o=a;else if(typeof a=="function")try{t!=null&&(o=a(t==null?void 0:t[0]))}catch{}else if(typeof a=="string"&&$0.test(a)){var c=$0.exec(a);if(c==null||c[1]==null||t==null)o=void 0;else{var d=+c[1];o=t[0]-d}}else o=t==null?void 0:t[0];if(i==="auto")t!=null&&(l=Math.max(...t));else if(Ce(i))l=i;else if(typeof i=="function")try{t!=null&&(l=i(t==null?void 0:t[1]))}catch{}else if(typeof i=="string"&&z0.test(i)){var u=z0.exec(i);if(u==null||u[1]==null||t==null)l=void 0;else{var f=+u[1];l=t[1]+f}}else l=t==null?void 0:t[1];var m=[o,l];if(Gs(m))return t==null?m:gj(m,t,r)}}}var Wo=1e9,jU={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},tv,bt=!0,En="[DecimalError] ",ui=En+"Invalid argument: ",ev=En+"Exponent out of range: ",Uo=Math.floor,Za=Math.pow,wU=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,on,Zt=1e7,pt=7,F_=9007199254740991,_u=Uo(F_/pt),we={};we.absoluteValue=we.abs=function(){var e=new this.constructor(this);return e.s&&(e.s=1),e};we.comparedTo=we.cmp=function(e){var t,r,n,a,i=this;if(e=new i.constructor(e),i.s!==e.s)return i.s||-e.s;if(i.e!==e.e)return i.e>e.e^i.s<0?1:-1;for(n=i.d.length,a=e.d.length,t=0,r=n<a?n:a;t<r;++t)if(i.d[t]!==e.d[t])return i.d[t]>e.d[t]^i.s<0?1:-1;return n===a?0:n>a^i.s<0?1:-1};we.decimalPlaces=we.dp=function(){var e=this,t=e.d.length-1,r=(t-e.e)*pt;if(t=e.d[t],t)for(;t%10==0;t/=10)r--;return r<0?0:r};we.dividedBy=we.div=function(e){return Rs(this,new this.constructor(e))};we.dividedToIntegerBy=we.idiv=function(e){var t=this,r=t.constructor;return it(Rs(t,new r(e),0,1),r.precision)};we.equals=we.eq=function(e){return!this.cmp(e)};we.exponent=function(){return Ft(this)};we.greaterThan=we.gt=function(e){return this.cmp(e)>0};we.greaterThanOrEqualTo=we.gte=function(e){return this.cmp(e)>=0};we.isInteger=we.isint=function(){return this.e>this.d.length-2};we.isNegative=we.isneg=function(){return this.s<0};we.isPositive=we.ispos=function(){return this.s>0};we.isZero=function(){return this.s===0};we.lessThan=we.lt=function(e){return this.cmp(e)<0};we.lessThanOrEqualTo=we.lte=function(e){return this.cmp(e)<1};we.logarithm=we.log=function(e){var t,r=this,n=r.constructor,a=n.precision,i=a+5;if(e===void 0)e=new n(10);else if(e=new n(e),e.s<1||e.eq(on))throw Error(En+"NaN");if(r.s<1)throw Error(En+(r.s?"NaN":"-Infinity"));return r.eq(on)?new n(0):(bt=!1,t=Rs(Vl(r,i),Vl(e,i),i),bt=!0,it(t,a))};we.minus=we.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?W_(t,e):B_(t,(e.s=-e.s,e))};we.modulo=we.mod=function(e){var t,r=this,n=r.constructor,a=n.precision;if(e=new n(e),!e.s)throw Error(En+"NaN");return r.s?(bt=!1,t=Rs(r,e,0,1).times(e),bt=!0,r.minus(t)):it(new n(r),a)};we.naturalExponential=we.exp=function(){return q_(this)};we.naturalLogarithm=we.ln=function(){return Vl(this)};we.negated=we.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};we.plus=we.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?B_(t,e):W_(t,(e.s=-e.s,e))};we.precision=we.sd=function(e){var t,r,n,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(ui+e);if(t=Ft(a)+1,n=a.d.length-1,r=n*pt+1,n=a.d[n],n){for(;n%10==0;n/=10)r--;for(n=a.d[0];n>=10;n/=10)r++}return e&&t>r?t:r};we.squareRoot=we.sqrt=function(){var e,t,r,n,a,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(En+"NaN")}for(e=Ft(l),bt=!1,a=Math.sqrt(+l),a==0||a==1/0?(t=os(l.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=Uo((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),n=new c(t)):n=new c(a.toString()),r=c.precision,a=o=r+3;;)if(i=n,n=i.plus(Rs(l,i,o+2)).times(.5),os(i.d).slice(0,o)===(t=os(n.d)).slice(0,o)){if(t=t.slice(o-3,o+1),a==o&&t=="4999"){if(it(i,r+1,0),i.times(i).eq(l)){n=i;break}}else if(t!="9999")break;o+=4}return bt=!0,it(n,r)};we.times=we.mul=function(e){var t,r,n,a,i,o,l,c,d,u=this,f=u.constructor,m=u.d,p=(e=new f(e)).d;if(!u.s||!e.s)return new f(0);for(e.s*=u.s,r=u.e+e.e,c=m.length,d=p.length,c<d&&(i=m,m=p,p=i,o=c,c=d,d=o),i=[],o=c+d,n=o;n--;)i.push(0);for(n=d;--n>=0;){for(t=0,a=c+n;a>n;)l=i[a]+p[n]*m[a-n-1]+t,i[a--]=l%Zt|0,t=l/Zt|0;i[a]=(i[a]+t)%Zt|0}for(;!i[--o];)i.pop();return t?++r:i.shift(),e.d=i,e.e=r,bt?it(e,f.precision):e};we.toDecimalPlaces=we.todp=function(e,t){var r=this,n=r.constructor;return r=new n(r),e===void 0?r:(xs(e,0,Wo),t===void 0?t=n.rounding:xs(t,0,8),it(r,e+Ft(r)+1,t))};we.toExponential=function(e,t){var r,n=this,a=n.constructor;return e===void 0?r=Ni(n,!0):(xs(e,0,Wo),t===void 0?t=a.rounding:xs(t,0,8),n=it(new a(n),e+1,t),r=Ni(n,!0,e+1)),r};we.toFixed=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?Ni(a):(xs(e,0,Wo),t===void 0?t=i.rounding:xs(t,0,8),n=it(new i(a),e+Ft(a)+1,t),r=Ni(n.abs(),!1,e+Ft(n)+1),a.isneg()&&!a.isZero()?"-"+r:r)};we.toInteger=we.toint=function(){var e=this,t=e.constructor;return it(new t(e),Ft(e)+1,t.rounding)};we.toNumber=function(){return+this};we.toPower=we.pow=function(e){var t,r,n,a,i,o,l=this,c=l.constructor,d=12,u=+(e=new c(e));if(!e.s)return new c(on);if(l=new c(l),!l.s){if(e.s<1)throw Error(En+"Infinity");return l}if(l.eq(on))return l;if(n=c.precision,e.eq(on))return it(l,n);if(t=e.e,r=e.d.length-1,o=t>=r,i=l.s,o){if((r=u<0?-u:u)<=F_){for(a=new c(on),t=Math.ceil(n/pt+4),bt=!1;r%2&&(a=a.times(l),yj(a.d,t)),r=Uo(r/2),r!==0;)l=l.times(l),yj(l.d,t);return bt=!0,e.s<0?new c(on).div(a):it(a,n)}}else if(i<0)throw Error(En+"NaN");return i=i<0&&e.d[Math.max(t,r)]&1?-1:1,l.s=1,bt=!1,a=e.times(Vl(l,n+d)),bt=!0,a=q_(a),a.s=i,a};we.toPrecision=function(e,t){var r,n,a=this,i=a.constructor;return e===void 0?(r=Ft(a),n=Ni(a,r<=i.toExpNeg||r>=i.toExpPos)):(xs(e,1,Wo),t===void 0?t=i.rounding:xs(t,0,8),a=it(new i(a),e,t),r=Ft(a),n=Ni(a,e<=r||r<=i.toExpNeg,e)),n};we.toSignificantDigits=we.tosd=function(e,t){var r=this,n=r.constructor;return e===void 0?(e=n.precision,t=n.rounding):(xs(e,1,Wo),t===void 0?t=n.rounding:xs(t,0,8)),it(new n(r),e,t)};we.toString=we.valueOf=we.val=we.toJSON=we[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Ft(e),r=e.constructor;return Ni(e,t<=r.toExpNeg||t>=r.toExpPos)};function B_(e,t){var r,n,a,i,o,l,c,d,u=e.constructor,f=u.precision;if(!e.s||!t.s)return t.s||(t=new u(e)),bt?it(t,f):t;if(c=e.d,d=t.d,o=e.e,a=t.e,c=c.slice(),i=o-a,i){for(i<0?(n=c,i=-i,l=d.length):(n=d,a=o,l=c.length),o=Math.ceil(f/pt),l=o>l?o+1:l+1,i>l&&(i=l,n.length=1),n.reverse();i--;)n.push(0);n.reverse()}for(l=c.length,i=d.length,l-i<0&&(i=l,n=d,d=c,c=n),r=0;i;)r=(c[--i]=c[i]+d[i]+r)/Zt|0,c[i]%=Zt;for(r&&(c.unshift(r),++a),l=c.length;c[--l]==0;)c.pop();return t.d=c,t.e=a,bt?it(t,f):t}function xs(e,t,r){if(e!==~~e||e<t||e>r)throw Error(ui+e)}function os(e){var t,r,n,a=e.length-1,i="",o=e[0];if(a>0){for(i+=o,t=1;t<a;t++)n=e[t]+"",r=pt-n.length,r&&(i+=pa(r)),i+=n;o=e[t],n=o+"",r=pt-n.length,r&&(i+=pa(r))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Rs=function(){function e(n,a){var i,o=0,l=n.length;for(n=n.slice();l--;)i=n[l]*a+o,n[l]=i%Zt|0,o=i/Zt|0;return o&&n.unshift(o),n}function t(n,a,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(n[l]!=a[l]){c=n[l]>a[l]?1:-1;break}return c}function r(n,a,i){for(var o=0;i--;)n[i]-=o,o=n[i]<a[i]?1:0,n[i]=o*Zt+n[i]-a[i];for(;!n[0]&&n.length>1;)n.shift()}return function(n,a,i,o){var l,c,d,u,f,m,p,x,g,v,y,b,N,j,k,w,S,_,C=n.constructor,P=n.s==a.s?1:-1,O=n.d,E=a.d;if(!n.s)return new C(n);if(!a.s)throw Error(En+"Division by zero");for(c=n.e-a.e,S=E.length,k=O.length,p=new C(P),x=p.d=[],d=0;E[d]==(O[d]||0);)++d;if(E[d]>(O[d]||0)&&--c,i==null?b=i=C.precision:o?b=i+(Ft(n)-Ft(a))+1:b=i,b<0)return new C(0);if(b=b/pt+2|0,d=0,S==1)for(u=0,E=E[0],b++;(d<k||u)&&b--;d++)N=u*Zt+(O[d]||0),x[d]=N/E|0,u=N%E|0;else{for(u=Zt/(E[0]+1)|0,u>1&&(E=e(E,u),O=e(O,u),S=E.length,k=O.length),j=S,g=O.slice(0,S),v=g.length;v<S;)g[v++]=0;_=E.slice(),_.unshift(0),w=E[0],E[1]>=Zt/2&&++w;do u=0,l=t(E,g,S,v),l<0?(y=g[0],S!=v&&(y=y*Zt+(g[1]||0)),u=y/w|0,u>1?(u>=Zt&&(u=Zt-1),f=e(E,u),m=f.length,v=g.length,l=t(f,g,m,v),l==1&&(u--,r(f,S<m?_:E,m))):(u==0&&(l=u=1),f=E.slice()),m=f.length,m<v&&f.unshift(0),r(g,f,v),l==-1&&(v=g.length,l=t(E,g,S,v),l<1&&(u++,r(g,S<v?_:E,v))),v=g.length):l===0&&(u++,g=[0]),x[d++]=u,l&&g[0]?g[v++]=O[j]||0:(g=[O[j]],v=1);while((j++<k||g[0]!==void 0)&&b--)}return x[0]||x.shift(),p.e=c,it(p,o?i+Ft(p)+1:i)}}();function q_(e,t){var r,n,a,i,o,l,c=0,d=0,u=e.constructor,f=u.precision;if(Ft(e)>16)throw Error(ev+Ft(e));if(!e.s)return new u(on);for(bt=!1,l=f,o=new u(.03125);e.abs().gte(.1);)e=e.times(o),d+=5;for(n=Math.log(Za(2,d))/Math.LN10*2+5|0,l+=n,r=a=i=new u(on),u.precision=l;;){if(a=it(a.times(e),l),r=r.times(++c),o=i.plus(Rs(a,r,l)),os(o.d).slice(0,l)===os(i.d).slice(0,l)){for(;d--;)i=it(i.times(i),l);return u.precision=f,t==null?(bt=!0,it(i,f)):i}i=o}}function Ft(e){for(var t=e.e*pt,r=e.d[0];r>=10;r/=10)t++;return t}function gh(e,t,r){if(t>e.LN10.sd())throw bt=!0,r&&(e.precision=r),Error(En+"LN10 precision limit exceeded");return it(new e(e.LN10),t)}function pa(e){for(var t="";e--;)t+="0";return t}function Vl(e,t){var r,n,a,i,o,l,c,d,u,f=1,m=10,p=e,x=p.d,g=p.constructor,v=g.precision;if(p.s<1)throw Error(En+(p.s?"NaN":"-Infinity"));if(p.eq(on))return new g(0);if(t==null?(bt=!1,d=v):d=t,p.eq(10))return t==null&&(bt=!0),gh(g,d);if(d+=m,g.precision=d,r=os(x),n=r.charAt(0),i=Ft(p),Math.abs(i)<15e14){for(;n<7&&n!=1||n==1&&r.charAt(1)>3;)p=p.times(e),r=os(p.d),n=r.charAt(0),f++;i=Ft(p),n>1?(p=new g("0."+r),i++):p=new g(n+"."+r.slice(1))}else return c=gh(g,d+2,v).times(i+""),p=Vl(new g(n+"."+r.slice(1)),d-m).plus(c),g.precision=v,t==null?(bt=!0,it(p,v)):p;for(l=o=p=Rs(p.minus(on),p.plus(on),d),u=it(p.times(p),d),a=3;;){if(o=it(o.times(u),d),c=l.plus(Rs(o,new g(a),d)),os(c.d).slice(0,d)===os(l.d).slice(0,d))return l=l.times(2),i!==0&&(l=l.plus(gh(g,d+2,v).times(i+""))),l=Rs(l,new g(f),d),g.precision=v,t==null?(bt=!0,it(l,v)):l;l=c,a+=2}}function vj(e,t){var r,n,a;for((r=t.indexOf("."))>-1&&(t=t.replace(".","")),(n=t.search(/e/i))>0?(r<0&&(r=n),r+=+t.slice(n+1),t=t.substring(0,n)):r<0&&(r=t.length),n=0;t.charCodeAt(n)===48;)++n;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(n,a),t){if(a-=n,r=r-n-1,e.e=Uo(r/pt),e.d=[],n=(r+1)%pt,r<0&&(n+=pt),n<a){for(n&&e.d.push(+t.slice(0,n)),a-=pt;n<a;)e.d.push(+t.slice(n,n+=pt));t=t.slice(n),n=pt-t.length}else n-=a;for(;n--;)t+="0";if(e.d.push(+t),bt&&(e.e>_u||e.e<-_u))throw Error(ev+r)}else e.s=0,e.e=0,e.d=[0];return e}function it(e,t,r){var n,a,i,o,l,c,d,u,f=e.d;for(o=1,i=f[0];i>=10;i/=10)o++;if(n=t-o,n<0)n+=pt,a=t,d=f[u=0];else{if(u=Math.ceil((n+1)/pt),i=f.length,u>=i)return e;for(d=i=f[u],o=1;i>=10;i/=10)o++;n%=pt,a=n-pt+o}if(r!==void 0&&(i=Za(10,o-a-1),l=d/i%10|0,c=t<0||f[u+1]!==void 0||d%i,c=r<4?(l||c)&&(r==0||r==(e.s<0?3:2)):l>5||l==5&&(r==4||c||r==6&&(n>0?a>0?d/Za(10,o-a):0:f[u-1])%10&1||r==(e.s<0?8:7))),t<1||!f[0])return c?(i=Ft(e),f.length=1,t=t-i-1,f[0]=Za(10,(pt-t%pt)%pt),e.e=Uo(-t/pt)||0):(f.length=1,f[0]=e.e=e.s=0),e;if(n==0?(f.length=u,i=1,u--):(f.length=u+1,i=Za(10,pt-n),f[u]=a>0?(d/Za(10,o-a)%Za(10,a)|0)*i:0),c)for(;;)if(u==0){(f[0]+=i)==Zt&&(f[0]=1,++e.e);break}else{if(f[u]+=i,f[u]!=Zt)break;f[u--]=0,i=1}for(n=f.length;f[--n]===0;)f.pop();if(bt&&(e.e>_u||e.e<-_u))throw Error(ev+Ft(e));return e}function W_(e,t){var r,n,a,i,o,l,c,d,u,f,m=e.constructor,p=m.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new m(e),bt?it(t,p):t;if(c=e.d,f=t.d,n=t.e,d=e.e,c=c.slice(),o=d-n,o){for(u=o<0,u?(r=c,o=-o,l=f.length):(r=f,n=d,l=c.length),a=Math.max(Math.ceil(p/pt),l)+2,o>a&&(o=a,r.length=1),r.reverse(),a=o;a--;)r.push(0);r.reverse()}else{for(a=c.length,l=f.length,u=a<l,u&&(l=a),a=0;a<l;a++)if(c[a]!=f[a]){u=c[a]<f[a];break}o=0}for(u&&(r=c,c=f,f=r,t.s=-t.s),l=c.length,a=f.length-l;a>0;--a)c[l++]=0;for(a=f.length;a>o;){if(c[--a]<f[a]){for(i=a;i&&c[--i]===0;)c[i]=Zt-1;--c[i],c[a]+=Zt}c[a]-=f[a]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--n;return c[0]?(t.d=c,t.e=n,bt?it(t,p):t):new m(0)}function Ni(e,t,r){var n,a=Ft(e),i=os(e.d),o=i.length;return t?(r&&(n=r-o)>0?i=i.charAt(0)+"."+i.slice(1)+pa(n):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(a<0?"e":"e+")+a):a<0?(i="0."+pa(-a-1)+i,r&&(n=r-o)>0&&(i+=pa(n))):a>=o?(i+=pa(a+1-o),r&&(n=r-a-1)>0&&(i=i+"."+pa(n))):((n=a+1)<o&&(i=i.slice(0,n)+"."+i.slice(n)),r&&(n=r-o)>0&&(a+1===o&&(i+="."),i+=pa(n))),e.s<0?"-"+i:i}function yj(e,t){if(e.length>t)return e.length=t,!0}function U_(e){var t,r,n;function a(i){var o=this;if(!(o instanceof a))return new a(i);if(o.constructor=a,i instanceof a){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(ui+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return vj(o,i.toString())}else if(typeof i!="string")throw Error(ui+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,wU.test(i))vj(o,i);else throw Error(ui+i)}if(a.prototype=we,a.ROUND_UP=0,a.ROUND_DOWN=1,a.ROUND_CEIL=2,a.ROUND_FLOOR=3,a.ROUND_HALF_UP=4,a.ROUND_HALF_DOWN=5,a.ROUND_HALF_EVEN=6,a.ROUND_HALF_CEIL=7,a.ROUND_HALF_FLOOR=8,a.clone=U_,a.config=a.set=NU,e===void 0&&(e={}),e)for(n=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t<n.length;)e.hasOwnProperty(r=n[t++])||(e[r]=this[r]);return a.config(e),a}function NU(e){if(!e||typeof e!="object")throw Error(En+"Object expected");var t,r,n,a=["precision",1,Wo,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(t=0;t<a.length;t+=3)if((n=e[r=a[t]])!==void 0)if(Uo(n)===n&&n>=a[t+1]&&n<=a[t+2])this[r]=n;else throw Error(ui+r+": "+n);if((n=e[r="LN10"])!==void 0)if(n==Math.LN10)this[r]=new this(n);else throw Error(ui+r+": "+n);return this}var tv=U_(jU);on=new tv(1);const rt=tv;function H_(e){var t;return e===0?t=1:t=Math.floor(new rt(e).abs().log(10).toNumber())+1,t}function K_(e,t,r){for(var n=new rt(e),a=0,i=[];n.lt(t)&&a<1e5;)i.push(n.toNumber()),n=n.add(r),a++;return i}var Y_=e=>{var[t,r]=e,[n,a]=[t,r];return t>r&&([n,a]=[r,t]),[n,a]},G_=(e,t,r)=>{if(e.lte(0))return new rt(0);var n=H_(e.toNumber()),a=new rt(10).pow(n),i=e.div(a),o=n!==1?.05:.1,l=new rt(Math.ceil(i.div(o).toNumber())).add(r).mul(o),c=l.mul(a);return t?new rt(c.toNumber()):new rt(Math.ceil(c.toNumber()))},kU=(e,t,r)=>{var n=new rt(1),a=new rt(e);if(!a.isint()&&r){var i=Math.abs(e);i<1?(n=new rt(10).pow(H_(e)-1),a=new rt(Math.floor(a.div(n).toNumber())).mul(n)):i>1&&(a=new rt(Math.floor(e)))}else e===0?a=new rt(Math.floor((t-1)/2)):r||(a=new rt(Math.floor(e)));for(var o=Math.floor((t-1)/2),l=[],c=0;c<t;c++)l.push(a.add(new rt(c-o).mul(n)).toNumber());return l},V_=function(t,r,n,a){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((r-t)/(n-1)))return{step:new rt(0),tickMin:new rt(0),tickMax:new rt(0)};var o=G_(new rt(r).sub(t).div(n-1),a,i),l;t<=0&&r>=0?l=new rt(0):(l=new rt(t).add(r).div(2),l=l.sub(new rt(l).mod(o)));var c=Math.ceil(l.sub(t).div(o).toNumber()),d=Math.ceil(new rt(r).sub(l).div(o).toNumber()),u=c+d+1;return u>n?V_(t,r,n,a,i+1):(u<n&&(d=r>0?d+(n-u):d,c=r>0?c:c+(n-u)),{step:o,tickMin:l.sub(new rt(c).mul(o)),tickMax:l.add(new rt(d).mul(o))})},SU=function(t){var[r,n]=t,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(a,2),[l,c]=Y_([r,n]);if(l===-1/0||c===1/0){var d=c===1/0?[l,...Array(a-1).fill(1/0)]:[...Array(a-1).fill(-1/0),c];return r>n?d.reverse():d}if(l===c)return kU(l,a,i);var{step:u,tickMin:f,tickMax:m}=V_(l,c,o,i,0),p=K_(f,m.add(new rt(.1).mul(u)),u);return r>n?p.reverse():p},CU=function(t,r){var[n,a]=t,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,[o,l]=Y_([n,a]);if(o===-1/0||l===1/0)return[n,a];if(o===l)return[o];var c=Math.max(r,2),d=G_(new rt(l).sub(o).div(c-1),i,0),u=[...K_(new rt(o),new rt(l),d),l];return i===!1&&(u=u.map(f=>Math.round(f))),n>a?u.reverse():u},X_=e=>e.rootProps.maxBarSize,_U=e=>e.rootProps.barGap,Q_=e=>e.rootProps.barCategoryGap,PU=e=>e.rootProps.barSize,rm=e=>e.rootProps.stackOffset,Z_=e=>e.rootProps.reverseStackOrder,rv=e=>e.options.chartName,nv=e=>e.rootProps.syncId,J_=e=>e.rootProps.syncMethod,sv=e=>e.options.eventEmitter,nne=e=>e.rootProps.baseValue,Mr={grid:-100,barBackground:-50,area:100,cursorRectangle:200,bar:300,line:400,axis:500,scatter:600,activeBar:1e3,cursorLine:1100,activeDot:1200,label:2e3},Ga={allowDecimals:!1,allowDataOverflow:!1,angleAxisId:0,reversed:!1,scale:"auto",tick:!0,type:"auto"},es={allowDataOverflow:!1,allowDecimals:!1,allowDuplicatedCategory:!0,includeHidden:!1,radiusAxisId:0,reversed:!1,scale:"auto",tick:!0,tickCount:5,type:"auto"},nm=(e,t)=>{if(!(!e||!t))return e!=null&&e.reversed?[t[1],t[0]]:t};function sm(e,t,r){if(r!=="auto")return r;if(e!=null)return Fa(e,t)?"category":"number"}function bj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Pu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?bj(Object(r),!0).forEach(function(n){MU(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function MU(e,t,r){return(t=OU(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function OU(e){var t=EU(e,"string");return typeof t=="symbol"?t:t+""}function EU(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var jj={allowDataOverflow:Ga.allowDataOverflow,allowDecimals:Ga.allowDecimals,allowDuplicatedCategory:!1,dataKey:void 0,domain:void 0,id:Ga.angleAxisId,includeHidden:!1,name:void 0,reversed:Ga.reversed,scale:Ga.scale,tick:Ga.tick,tickCount:void 0,ticks:void 0,type:Ga.type,unit:void 0},wj={allowDataOverflow:es.allowDataOverflow,allowDecimals:es.allowDecimals,allowDuplicatedCategory:es.allowDuplicatedCategory,dataKey:void 0,domain:void 0,id:es.radiusAxisId,includeHidden:es.includeHidden,name:void 0,reversed:es.reversed,scale:es.scale,tick:es.tick,tickCount:es.tickCount,ticks:void 0,type:es.type,unit:void 0},AU=(e,t)=>{if(t!=null)return e.polarAxis.angleAxis[t]},av=ae([AU,RC],(e,t)=>{var r;if(e!=null)return e;var n=(r=sm(t,"angleAxis",jj.type))!==null&&r!==void 0?r:"category";return Pu(Pu({},jj),{},{type:n})}),DU=(e,t)=>e.polarAxis.radiusAxis[t],iv=ae([DU,RC],(e,t)=>{var r;if(e!=null)return e;var n=(r=sm(t,"radiusAxis",wj.type))!==null&&r!==void 0?r:"category";return Pu(Pu({},wj),{},{type:n})}),am=e=>e.polarOptions,ov=ae([na,sa,er],Tq),eP=ae([am,ov],(e,t)=>{if(e!=null)return Hn(e.innerRadius,t,0)}),tP=ae([am,ov],(e,t)=>{if(e!=null)return Hn(e.outerRadius,t,t*.8)}),TU=e=>{if(e==null)return[0,0];var{startAngle:t,endAngle:r}=e;return[t,r]},rP=ae([am],TU);ae([av,rP],nm);var nP=ae([ov,eP,tP],(e,t,r)=>{if(!(e==null||t==null||r==null))return[t,r]});ae([iv,nP],nm);var sP=ae([dt,am,eP,tP,na,sa],(e,t,r,n,a,i)=>{if(!(e!=="centric"&&e!=="radial"||t==null||r==null||n==null)){var{cx:o,cy:l,startAngle:c,endAngle:d}=t;return{cx:Hn(o,a,a/2),cy:Hn(l,i,i/2),innerRadius:r,outerRadius:n,startAngle:c,endAngle:d,clockWise:!1}}}),rr=(e,t)=>t,im=(e,t,r)=>r;function lv(e){return e==null?void 0:e.id}function aP(e,t,r){var{chartData:n=[]}=t,{allowDuplicatedCategory:a,dataKey:i}=r,o=new Map;return e.forEach(l=>{var c,d=(c=l.data)!==null&&c!==void 0?c:n;if(!(d==null||d.length===0)){var u=lv(l);d.forEach((f,m)=>{var p=i==null||a?m:String(Jt(f,i,null)),x=Jt(f,l.dataKey,0),g;o.has(p)?g=o.get(p):g={},Object.assign(g,{[u]:x}),o.set(p,g)})}}),Array.from(o.values())}function om(e){return"stackId"in e&&e.stackId!=null&&e.dataKey!=null}var lm=(e,t)=>e===t?!0:e==null||t==null?!1:e[0]===t[0]&&e[1]===t[1];function cm(e,t){return Array.isArray(e)&&Array.isArray(t)&&e.length===0&&t.length===0?!0:e===t}function IU(e,t){if(e.length===t.length){for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return!1}var nr=e=>{var t=dt(e);return t==="horizontal"?"xAxis":t==="vertical"?"yAxis":t==="centric"?"angleAxis":"radiusAxis"},Ho=e=>e.tooltip.settings.axisId;function RU(e){if(e in kl)return kl[e]();var t="scale".concat(wc(e));if(t in kl)return kl[t]()}function Nj(e){var t=e.ticks,r=e.bandwidth,n=e.range(),a=[Math.min(...n),Math.max(...n)];return{domain:()=>e.domain(),range:function(i){function o(){return i.apply(this,arguments)}return o.toString=function(){return i.toString()},o}(()=>a),rangeMin:()=>a[0],rangeMax:()=>a[1],isInRange(i){var o=a[0],l=a[1];return o<=l?i>=o&&i<=l:i>=l&&i<=o},bandwidth:r?()=>r.call(e):void 0,ticks:t?i=>t.call(e,i):void 0,map:(i,o)=>{var l=e(i);if(l!=null){if(e.bandwidth&&o!==null&&o!==void 0&&o.position){var c=e.bandwidth();switch(o.position){case"middle":l+=c/2;break;case"end":l+=c;break}}return l}}}}function kj(e,t,r){if(typeof e=="function")return Nj(e.copy().domain(t).range(r));if(e!=null){var n=RU(e);if(n!=null)return n.domain(t).range(r),Nj(n)}}var $U=(e,t)=>{if(t!=null)switch(e){case"linear":{if(!Gs(t)){for(var r,n,a=0;a<t.length;a++){var i=t[a];Ye(i)&&((r===void 0||i<r)&&(r=i),(n===void 0||i>n)&&(n=i))}return r!==void 0&&n!==void 0?[r,n]:void 0}return t}default:return t}};function Sj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Mu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Sj(Object(r),!0).forEach(function(n){zU(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Sj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function zU(e,t,r){return(t=LU(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function LU(e){var t=FU(e,"string");return typeof t=="symbol"?t:t+""}function FU(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Dp=[0,"auto"],Xt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:void 0,height:30,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"bottom",padding:{left:0,right:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"category",unit:void 0},iP=(e,t)=>e.cartesianAxis.xAxis[t],oa=(e,t)=>{var r=iP(e,t);return r??Xt},Qt={allowDataOverflow:!1,allowDecimals:!0,allowDuplicatedCategory:!0,angle:0,dataKey:void 0,domain:Dp,hide:!0,id:0,includeHidden:!1,interval:"preserveEnd",minTickGap:5,mirror:!1,name:void 0,orientation:"left",padding:{top:0,bottom:0},reversed:!1,scale:"auto",tick:!0,tickCount:5,tickFormatter:void 0,ticks:void 0,type:"number",unit:void 0,width:Sc},oP=(e,t)=>e.cartesianAxis.yAxis[t],la=(e,t)=>{var r=oP(e,t);return r??Qt},BU={domain:[0,"auto"],includeHidden:!1,reversed:!1,allowDataOverflow:!1,allowDuplicatedCategory:!1,dataKey:void 0,id:0,name:"",range:[64,64],scale:"auto",type:"number",unit:""},cv=(e,t)=>{var r=e.cartesianAxis.zAxis[t];return r??BU},$r=(e,t,r)=>{switch(t){case"xAxis":return oa(e,r);case"yAxis":return la(e,r);case"zAxis":return cv(e,r);case"angleAxis":return av(e,r);case"radiusAxis":return iv(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},qU=(e,t,r)=>{switch(t){case"xAxis":return oa(e,r);case"yAxis":return la(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},Ac=(e,t,r)=>{switch(t){case"xAxis":return oa(e,r);case"yAxis":return la(e,r);case"angleAxis":return av(e,r);case"radiusAxis":return iv(e,r);default:throw new Error("Unexpected axis type: ".concat(t))}},lP=e=>e.graphicalItems.cartesianItems.some(t=>t.type==="bar")||e.graphicalItems.polarItems.some(t=>t.type==="radialBar");function cP(e,t){return r=>{switch(e){case"xAxis":return"xAxisId"in r&&r.xAxisId===t;case"yAxis":return"yAxisId"in r&&r.yAxisId===t;case"zAxis":return"zAxisId"in r&&r.zAxisId===t;case"angleAxis":return"angleAxisId"in r&&r.angleAxisId===t;case"radiusAxis":return"radiusAxisId"in r&&r.radiusAxisId===t;default:return!1}}}var dv=e=>e.graphicalItems.cartesianItems,WU=ae([rr,im],cP),dP=(e,t,r)=>e.filter(r).filter(n=>(t==null?void 0:t.includeHidden)===!0?!0:!n.hide),Dc=ae([dv,$r,WU],dP,{memoizeOptions:{resultEqualityCheck:cm}}),uP=ae([Dc],e=>e.filter(t=>t.type==="area"||t.type==="bar").filter(om)),fP=e=>e.filter(t=>!("stackId"in t)||t.stackId===void 0),UU=ae([Dc],fP),mP=e=>e.map(t=>t.data).filter(Boolean).flat(1),HU=ae([Dc],mP,{memoizeOptions:{resultEqualityCheck:cm}}),hP=(e,t)=>{var{chartData:r=[],dataStartIndex:n,dataEndIndex:a}=t;return e.length>0?e:r.slice(n,a+1)},uv=ae([HU,z_],hP),pP=(e,t,r)=>(t==null?void 0:t.dataKey)!=null?e.map(n=>({value:Jt(n,t.dataKey)})):r.length>0?r.map(n=>n.dataKey).flatMap(n=>e.map(a=>({value:Jt(a,n)}))):e.map(n=>({value:n})),dm=ae([uv,$r,Dc],pP);function xP(e,t){switch(e){case"xAxis":return t.direction==="x";case"yAxis":return t.direction==="y";default:return!1}}function Md(e){if(hs(e)||e instanceof Date){var t=Number(e);if(Ye(t))return t}}function Cj(e){if(Array.isArray(e)){var t=[Md(e[0]),Md(e[1])];return Gs(t)?t:void 0}var r=Md(e);if(r!=null)return[r,r]}function Vs(e){return e.map(Md).filter(Hr)}function KU(e,t,r){return!r||typeof t!="number"||ms(t)?[]:r.length?Vs(r.flatMap(n=>{var a=Jt(e,n.dataKey),i,o;if(Array.isArray(a)?[i,o]=a:i=o=a,!(!Ye(i)||!Ye(o)))return[t-i,t+o]})):[]}var Gt=e=>{var t=nr(e),r=Ho(e);return Ac(e,t,r)},Tc=ae([Gt],e=>e==null?void 0:e.dataKey),YU=ae([uP,z_,Gt],aP),gP=(e,t,r,n)=>{var a={},i=t.reduce((o,l)=>{if(l.stackId==null)return o;var c=o[l.stackId];return c==null&&(c=[]),c.push(l),o[l.stackId]=c,o},a);return Object.fromEntries(Object.entries(i).map(o=>{var[l,c]=o,d=n?[...c].reverse():c,u=d.map(lv);return[l,{stackedData:PB(e,u,r),graphicalItems:d}]}))},Tp=ae([YU,uP,rm,Z_],gP),vP=(e,t,r,n)=>{var{dataStartIndex:a,dataEndIndex:i}=t;if(n==null&&r!=="zAxis"){var o=DB(e,a,i);if(!(o!=null&&o[0]===0&&o[1]===0))return o}},GU=ae([$r],e=>e.allowDataOverflow),fv=e=>{var t;if(e==null||!("domain"in e))return Dp;if(e.domain!=null)return e.domain;if("ticks"in e&&e.ticks!=null){if(e.type==="number"){var r=Vs(e.ticks);return[Math.min(...r),Math.max(...r)]}if(e.type==="category")return e.ticks.map(String)}return(t=e==null?void 0:e.domain)!==null&&t!==void 0?t:Dp},yP=ae([$r],fv),bP=ae([yP,GU],L_),VU=ae([Tp,ia,rr,bP],vP,{memoizeOptions:{resultEqualityCheck:lm}}),mv=e=>e.errorBars,XU=(e,t,r)=>e.flatMap(n=>t[n.id]).filter(Boolean).filter(n=>xP(r,n)),Ou=function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];var a=r.filter(Boolean);if(a.length!==0){var i=a.flat(),o=Math.min(...i),l=Math.max(...i);return[o,l]}},jP=(e,t,r,n,a)=>{var i,o;if(r.length>0&&e.forEach(l=>{r.forEach(c=>{var d,u,f=(d=n[c.id])===null||d===void 0?void 0:d.filter(y=>xP(a,y)),m=Jt(l,(u=t.dataKey)!==null&&u!==void 0?u:c.dataKey),p=KU(l,m,f);if(p.length>=2){var x=Math.min(...p),g=Math.max(...p);(i==null||x<i)&&(i=x),(o==null||g>o)&&(o=g)}var v=Cj(m);v!=null&&(i=i==null?v[0]:Math.min(i,v[0]),o=o==null?v[1]:Math.max(o,v[1]))})}),(t==null?void 0:t.dataKey)!=null&&e.forEach(l=>{var c=Cj(Jt(l,t.dataKey));c!=null&&(i=i==null?c[0]:Math.min(i,c[0]),o=o==null?c[1]:Math.max(o,c[1]))}),Ye(i)&&Ye(o))return[i,o]},QU=ae([uv,$r,UU,mv,rr],jP,{memoizeOptions:{resultEqualityCheck:lm}});function ZU(e){var{value:t}=e;if(hs(t)||t instanceof Date)return t}var JU=(e,t,r)=>{var n=e.map(ZU).filter(a=>a!=null);return r&&(t.dataKey==null||t.allowDuplicatedCategory&&x2(n))?n_(0,e.length):t.allowDuplicatedCategory?n:Array.from(new Set(n))},wP=e=>e.referenceElements.dots,Ko=(e,t,r)=>e.filter(n=>n.ifOverflow==="extendDomain").filter(n=>t==="xAxis"?n.xAxisId===r:n.yAxisId===r),eH=ae([wP,rr,im],Ko),NP=e=>e.referenceElements.areas,tH=ae([NP,rr,im],Ko),kP=e=>e.referenceElements.lines,rH=ae([kP,rr,im],Ko),SP=(e,t)=>{if(e!=null){var r=Vs(e.map(n=>t==="xAxis"?n.x:n.y));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},nH=ae(eH,rr,SP),CP=(e,t)=>{if(e!=null){var r=Vs(e.flatMap(n=>[t==="xAxis"?n.x1:n.y1,t==="xAxis"?n.x2:n.y2]));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},sH=ae([tH,rr],CP);function aH(e){var t;if(e.x!=null)return Vs([e.x]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.x);return r==null||r.length===0?[]:Vs(r)}function iH(e){var t;if(e.y!=null)return Vs([e.y]);var r=(t=e.segment)===null||t===void 0?void 0:t.map(n=>n.y);return r==null||r.length===0?[]:Vs(r)}var _P=(e,t)=>{if(e!=null){var r=e.flatMap(n=>t==="xAxis"?aH(n):iH(n));if(r.length!==0)return[Math.min(...r),Math.max(...r)]}},oH=ae([rH,rr],_P),lH=ae(nH,oH,sH,(e,t,r)=>Ou(e,r,t)),PP=(e,t,r,n,a,i,o,l)=>{if(r!=null)return r;var c=o==="vertical"&&l==="xAxis"||o==="horizontal"&&l==="yAxis",d=c?Ou(n,i,a):Ou(i,a);return bU(t,d,e.allowDataOverflow)},cH=ae([$r,yP,bP,VU,QU,lH,dt,rr],PP,{memoizeOptions:{resultEqualityCheck:lm}}),dH=[0,1],MP=(e,t,r,n,a,i,o)=>{if(!((e==null||r==null||r.length===0)&&o===void 0)){var{dataKey:l,type:c}=e,d=Fa(t,i);if(d&&l==null){var u;return n_(0,(u=r==null?void 0:r.length)!==null&&u!==void 0?u:0)}return c==="category"?JU(n,e,d):a==="expand"?dH:o}},hv=ae([$r,dt,uv,dm,rm,rr,cH],MP);function uH(e){return e in kl}var OP=(e,t,r)=>{if(e!=null){var{scale:n,type:a}=e;if(n==="auto")return a==="category"&&r&&(r.indexOf("LineChart")>=0||r.indexOf("AreaChart")>=0||r.indexOf("ComposedChart")>=0&&!t)?"point":a==="category"?"band":"linear";if(typeof n=="string"){var i="scale".concat(wc(n));return uH(i)?i:"point"}}},Yo=ae([$r,lP,rv],OP);function pv(e,t,r,n){if(!(r==null||n==null))return typeof e.scale=="function"?kj(e.scale,r,n):kj(t,r,n)}var EP=(e,t,r)=>{var n=fv(t);if(!(r!=="auto"&&r!=="linear")){if(t!=null&&t.tickCount&&Array.isArray(n)&&(n[0]==="auto"||n[1]==="auto")&&Gs(e))return SU(e,t.tickCount,t.allowDecimals);if(t!=null&&t.tickCount&&t.type==="number"&&Gs(e))return CU(e,t.tickCount,t.allowDecimals)}},xv=ae([hv,Ac,Yo],EP),AP=(e,t,r,n)=>{if(n!=="angleAxis"&&(e==null?void 0:e.type)==="number"&&Gs(t)&&Array.isArray(r)&&r.length>0){var a,i,o=t[0],l=(a=r[0])!==null&&a!==void 0?a:0,c=t[1],d=(i=r[r.length-1])!==null&&i!==void 0?i:0;return[Math.min(o,l),Math.max(c,d)]}return t},fH=ae([$r,hv,xv,rr],AP),mH=ae(dm,$r,(e,t)=>{if(!(!t||t.type!=="number")){var r=1/0,n=Array.from(Vs(e.map(f=>f.value))).sort((f,m)=>f-m),a=n[0],i=n[n.length-1];if(a==null||i==null)return 1/0;var o=i-a;if(o===0)return 1/0;for(var l=0;l<n.length-1;l++){var c=n[l],d=n[l+1];if(!(c==null||d==null)){var u=d-c;r=Math.min(r,u)}}return r/o}}),DP=ae(mH,dt,Q_,er,(e,t,r,n,a)=>a,(e,t,r,n,a)=>{if(!Ye(e))return 0;var i=t==="vertical"?n.height:n.width;if(a==="gap")return e*i/2;if(a==="no-gap"){var o=Hn(r,e*i),l=e*i/2;return l-o-(l-o)/i*o}return 0}),hH=(e,t,r)=>{var n=oa(e,t);return n==null||typeof n.padding!="string"?0:DP(e,"xAxis",t,r,n.padding)},pH=(e,t,r)=>{var n=la(e,t);return n==null||typeof n.padding!="string"?0:DP(e,"yAxis",t,r,n.padding)},xH=ae(oa,hH,(e,t)=>{var r,n;if(e==null)return{left:0,right:0};var{padding:a}=e;return typeof a=="string"?{left:t,right:t}:{left:((r=a.left)!==null&&r!==void 0?r:0)+t,right:((n=a.right)!==null&&n!==void 0?n:0)+t}}),gH=ae(la,pH,(e,t)=>{var r,n;if(e==null)return{top:0,bottom:0};var{padding:a}=e;return typeof a=="string"?{top:t,bottom:t}:{top:((r=a.top)!==null&&r!==void 0?r:0)+t,bottom:((n=a.bottom)!==null&&n!==void 0?n:0)+t}}),vH=ae([er,xH,Uf,Wf,(e,t,r)=>r],(e,t,r,n,a)=>{var{padding:i}=n;return a?[i.left,r.width-i.right]:[e.left+t.left,e.left+e.width-t.right]}),yH=ae([er,dt,gH,Uf,Wf,(e,t,r)=>r],(e,t,r,n,a,i)=>{var{padding:o}=a;return i?[n.height-o.bottom,o.top]:t==="horizontal"?[e.top+e.height-r.bottom,e.top+r.top]:[e.top+r.top,e.top+e.height-r.bottom]}),Ic=(e,t,r,n)=>{var a;switch(t){case"xAxis":return vH(e,r,n);case"yAxis":return yH(e,r,n);case"zAxis":return(a=cv(e,r))===null||a===void 0?void 0:a.range;case"angleAxis":return rP(e);case"radiusAxis":return nP(e,r);default:return}},TP=ae([$r,Ic],nm),bH=ae([Yo,fH],$U),um=ae([$r,Yo,bH,TP],pv);ae([Dc,mv,rr],XU);function IP(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var fm=(e,t)=>t,mm=(e,t,r)=>r,jH=ae(Bf,fm,mm,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(IP)),wH=ae(qf,fm,mm,(e,t,r)=>e.filter(n=>n.orientation===t).filter(n=>n.mirror===r).sort(IP)),RP=(e,t)=>({width:e.width,height:t.height}),NH=(e,t)=>{var r=typeof t.width=="number"?t.width:Sc;return{width:r,height:e.height}},$P=ae(er,oa,RP),kH=(e,t,r)=>{switch(t){case"top":return e.top;case"bottom":return r-e.bottom;default:return 0}},SH=(e,t,r)=>{switch(t){case"left":return e.left;case"right":return r-e.right;default:return 0}},CH=ae(sa,er,jH,fm,mm,(e,t,r,n,a)=>{var i={},o;return r.forEach(l=>{var c=RP(t,l);o==null&&(o=kH(t,n,e));var d=n==="top"&&!a||n==="bottom"&&a;i[l.id]=o-Number(d)*c.height,o+=(d?-1:1)*c.height}),i}),_H=ae(na,er,wH,fm,mm,(e,t,r,n,a)=>{var i={},o;return r.forEach(l=>{var c=NH(t,l);o==null&&(o=SH(t,n,e));var d=n==="left"&&!a||n==="right"&&a;i[l.id]=o-Number(d)*c.width,o+=(d?-1:1)*c.width}),i}),PH=(e,t)=>{var r=oa(e,t);if(r!=null)return CH(e,r.orientation,r.mirror)},MH=ae([er,oa,PH,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var a=r==null?void 0:r[n];return a==null?{x:e.left,y:0}:{x:e.left,y:a}}}),OH=(e,t)=>{var r=la(e,t);if(r!=null)return _H(e,r.orientation,r.mirror)},EH=ae([er,la,OH,(e,t)=>t],(e,t,r,n)=>{if(t!=null){var a=r==null?void 0:r[n];return a==null?{x:0,y:e.top}:{x:a,y:e.top}}}),zP=ae(er,la,(e,t)=>{var r=typeof t.width=="number"?t.width:Sc;return{width:r,height:e.height}}),_j=(e,t,r)=>{switch(t){case"xAxis":return $P(e,r).width;case"yAxis":return zP(e,r).height;default:return}},LP=(e,t,r,n)=>{if(r!=null){var{allowDuplicatedCategory:a,type:i,dataKey:o}=r,l=Fa(e,n),c=t.map(d=>d.value);if(o&&l&&i==="category"&&a&&x2(c))return c}},gv=ae([dt,dm,$r,rr],LP),FP=(e,t,r,n)=>{if(!(r==null||r.dataKey==null)){var{type:a,scale:i}=r,o=Fa(e,n);if(o&&(a==="number"||i!=="auto"))return t.map(l=>l.value)}},vv=ae([dt,dm,Ac,rr],FP),Pj=ae([dt,qU,Yo,um,gv,vv,Ic,xv,rr],(e,t,r,n,a,i,o,l,c)=>{if(t!=null){var d=Fa(e,c);return{angle:t.angle,interval:t.interval,minTickGap:t.minTickGap,orientation:t.orientation,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit,axisType:c,categoricalDomain:i,duplicateDomain:a,isCategorical:d,niceTicks:l,range:o,realScaleType:r,scale:n}}}),AH=(e,t,r,n,a,i,o,l,c)=>{if(!(t==null||n==null)){var d=Fa(e,c),{type:u,ticks:f,tickCount:m}=t,p=r==="scaleBand"&&typeof n.bandwidth=="function"?n.bandwidth()/2:2,x=u==="category"&&n.bandwidth?n.bandwidth()/p:0;x=c==="angleAxis"&&i!=null&&i.length>=2?Ur(i[0]-i[1])*2*x:x;var g=f||a;return g?g.map((v,y)=>{var b=o?o.indexOf(v):v,N=n.map(b);return Ye(N)?{index:y,coordinate:N+x,value:v,offset:x}:null}).filter(Hr):d&&l?l.map((v,y)=>{var b=n.map(v);return Ye(b)?{coordinate:b+x,value:v,index:y,offset:x}:null}).filter(Hr):n.ticks?n.ticks(m).map((v,y)=>{var b=n.map(v);return Ye(b)?{coordinate:b+x,value:v,index:y,offset:x}:null}).filter(Hr):n.domain().map((v,y)=>{var b=n.map(v);return Ye(b)?{coordinate:b+x,value:o?o[v]:v,index:y,offset:x}:null}).filter(Hr)}},BP=ae([dt,Ac,Yo,um,xv,Ic,gv,vv,rr],AH),DH=(e,t,r,n,a,i,o)=>{if(!(t==null||r==null||n==null||n[0]===n[1])){var l=Fa(e,o),{tickCount:c}=t,d=0;return d=o==="angleAxis"&&(n==null?void 0:n.length)>=2?Ur(n[0]-n[1])*2*d:d,l&&i?i.map((u,f)=>{var m=r.map(u);return Ye(m)?{coordinate:m+d,value:u,index:f,offset:d}:null}).filter(Hr):r.ticks?r.ticks(c).map((u,f)=>{var m=r.map(u);return Ye(m)?{coordinate:m+d,value:u,index:f,offset:d}:null}).filter(Hr):r.domain().map((u,f)=>{var m=r.map(u);return Ye(m)?{coordinate:m+d,value:a?a[u]:u,index:f,offset:d}:null}).filter(Hr)}},yo=ae([dt,Ac,um,Ic,gv,vv,rr],DH),bo=ae($r,um,(e,t)=>{if(!(e==null||t==null))return Mu(Mu({},e),{},{scale:t})}),TH=ae([$r,Yo,hv,TP],pv);ae((e,t,r)=>cv(e,r),TH,(e,t)=>{if(!(e==null||t==null))return Mu(Mu({},e),{},{scale:t})});var IH=ae([dt,Bf,qf],(e,t,r)=>{switch(e){case"horizontal":return t.some(n=>n.reversed)?"right-to-left":"left-to-right";case"vertical":return r.some(n=>n.reversed)?"bottom-to-top":"top-to-bottom";case"centric":case"radial":return"left-to-right";default:return}}),qP=e=>e.options.defaultTooltipEventType,WP=e=>e.options.validateTooltipEventTypes;function UP(e,t,r){if(e==null)return t;var n=e?"axis":"item";return r==null?t:r.includes(n)?n:t}function yv(e,t){var r=qP(e),n=WP(e);return UP(t,r,n)}function RH(e){return Ae(t=>yv(t,e))}var HP=(e,t)=>{var r,n=Number(t);if(!(ms(n)||t==null))return n>=0?e==null||(r=e[n])===null||r===void 0?void 0:r.value:void 0},$H=e=>e.tooltip.settings,ga={active:!1,index:null,dataKey:void 0,graphicalItemId:void 0,coordinate:void 0},zH={itemInteraction:{click:ga,hover:ga},axisInteraction:{click:ga,hover:ga},keyboardInteraction:ga,syncInteraction:{active:!1,index:null,dataKey:void 0,label:void 0,coordinate:void 0,sourceViewBox:void 0,graphicalItemId:void 0},tooltipItemPayloads:[],settings:{shared:void 0,trigger:"hover",axisId:0,active:!1,defaultIndex:void 0}},KP=en({name:"tooltip",initialState:zH,reducers:{addTooltipEntrySettings:{reducer(e,t){e.tooltipItemPayloads.push(t.payload)},prepare:yt()},replaceTooltipEntrySettings:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Un(e).tooltipItemPayloads.indexOf(r);a>-1&&(e.tooltipItemPayloads[a]=n)},prepare:yt()},removeTooltipEntrySettings:{reducer(e,t){var r=Un(e).tooltipItemPayloads.indexOf(t.payload);r>-1&&e.tooltipItemPayloads.splice(r,1)},prepare:yt()},setTooltipSettingsState(e,t){e.settings=t.payload},setActiveMouseOverItemIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.itemInteraction.hover.active=!0,e.itemInteraction.hover.index=t.payload.activeIndex,e.itemInteraction.hover.dataKey=t.payload.activeDataKey,e.itemInteraction.hover.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.hover.coordinate=t.payload.activeCoordinate},mouseLeaveChart(e){e.itemInteraction.hover.active=!1,e.axisInteraction.hover.active=!1},mouseLeaveItem(e){e.itemInteraction.hover.active=!1},setActiveClickItemIndex(e,t){e.syncInteraction.active=!1,e.itemInteraction.click.active=!0,e.keyboardInteraction.active=!1,e.itemInteraction.click.index=t.payload.activeIndex,e.itemInteraction.click.dataKey=t.payload.activeDataKey,e.itemInteraction.click.graphicalItemId=t.payload.activeGraphicalItemId,e.itemInteraction.click.coordinate=t.payload.activeCoordinate},setMouseOverAxisIndex(e,t){e.syncInteraction.active=!1,e.axisInteraction.hover.active=!0,e.keyboardInteraction.active=!1,e.axisInteraction.hover.index=t.payload.activeIndex,e.axisInteraction.hover.dataKey=t.payload.activeDataKey,e.axisInteraction.hover.coordinate=t.payload.activeCoordinate},setMouseClickAxisIndex(e,t){e.syncInteraction.active=!1,e.keyboardInteraction.active=!1,e.axisInteraction.click.active=!0,e.axisInteraction.click.index=t.payload.activeIndex,e.axisInteraction.click.dataKey=t.payload.activeDataKey,e.axisInteraction.click.coordinate=t.payload.activeCoordinate},setSyncInteraction(e,t){e.syncInteraction=t.payload},setKeyboardInteraction(e,t){e.keyboardInteraction.active=t.payload.active,e.keyboardInteraction.index=t.payload.activeIndex,e.keyboardInteraction.coordinate=t.payload.activeCoordinate}}}),{addTooltipEntrySettings:LH,replaceTooltipEntrySettings:FH,removeTooltipEntrySettings:BH,setTooltipSettingsState:qH,setActiveMouseOverItemIndex:YP,mouseLeaveItem:WH,mouseLeaveChart:GP,setActiveClickItemIndex:UH,setMouseOverAxisIndex:VP,setMouseClickAxisIndex:HH,setSyncInteraction:Ip,setKeyboardInteraction:Rp}=KP.actions,KH=KP.reducer;function Mj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function hd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mj(Object(r),!0).forEach(function(n){YH(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function YH(e,t,r){return(t=GH(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function GH(e){var t=VH(e,"string");return typeof t=="symbol"?t:t+""}function VH(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function XH(e,t,r){return t==="axis"?r==="click"?e.axisInteraction.click:e.axisInteraction.hover:r==="click"?e.itemInteraction.click:e.itemInteraction.hover}function QH(e){return e.index!=null}var XP=(e,t,r,n)=>{if(t==null)return ga;var a=XH(e,t,r);if(a==null)return ga;if(a.active)return a;if(e.keyboardInteraction.active)return e.keyboardInteraction;if(e.syncInteraction.active&&e.syncInteraction.index!=null)return e.syncInteraction;var i=e.settings.active===!0;if(QH(a)){if(i)return hd(hd({},a),{},{active:!0})}else if(n!=null)return{active:!0,coordinate:void 0,dataKey:void 0,index:n,graphicalItemId:void 0};return hd(hd({},ga),{},{coordinate:a.coordinate})};function ZH(e){if(typeof e=="number")return Number.isFinite(e)?e:void 0;if(e instanceof Date){var t=e.valueOf();return Number.isFinite(t)?t:void 0}var r=Number(e);return Number.isFinite(r)?r:void 0}function JH(e,t){var r=ZH(e),n=t[0],a=t[1];if(r===void 0)return!1;var i=Math.min(n,a),o=Math.max(n,a);return r>=i&&r<=o}function eK(e,t,r){if(r==null||t==null)return!0;var n=Jt(e,t);return n==null||!Gs(r)?!0:JH(n,r)}var bv=(e,t,r,n)=>{var a=e==null?void 0:e.index;if(a==null)return null;var i=Number(a);if(!Ye(i))return a;var o=0,l=1/0;t.length>0&&(l=t.length-1);var c=Math.max(o,Math.min(i,l)),d=t[c];return d==null||eK(d,r,n)?String(c):null},QP=(e,t,r,n,a,i,o)=>{if(i!=null){var l=o[0],c=l==null?void 0:l.getPosition(i);if(c!=null)return c;var d=a==null?void 0:a[Number(i)];if(d)switch(r){case"horizontal":return{x:d.coordinate,y:(n.top+t)/2};default:return{x:(n.left+e)/2,y:d.coordinate}}}},ZP=(e,t,r,n)=>{if(t==="axis")return e.tooltipItemPayloads;if(e.tooltipItemPayloads.length===0)return[];var a;if(r==="hover"?a=e.itemInteraction.hover.graphicalItemId:a=e.itemInteraction.click.graphicalItemId,a==null&&n!=null){var i=e.tooltipItemPayloads[0];return i!=null?[i]:[]}return e.tooltipItemPayloads.filter(o=>{var l;return((l=o.settings)===null||l===void 0?void 0:l.graphicalItemId)===a})},JP=e=>e.options.tooltipPayloadSearcher,Go=e=>e.tooltip;function Oj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ej(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Oj(Object(r),!0).forEach(function(n){tK(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tK(e,t,r){return(t=rK(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rK(e){var t=nK(e,"string");return typeof t=="symbol"?t:t+""}function nK(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sK(e,t){return e??t}var eM=(e,t,r,n,a,i,o)=>{if(!(t==null||i==null)){var{chartData:l,computedData:c,dataStartIndex:d,dataEndIndex:u}=r,f=[];return e.reduce((m,p)=>{var x,{dataDefinedOnItem:g,settings:v}=p,y=sK(g,l),b=Array.isArray(y)?jC(y,d,u):y,N=(x=v==null?void 0:v.dataKey)!==null&&x!==void 0?x:n,j=v==null?void 0:v.nameKey,k;if(n&&Array.isArray(b)&&!Array.isArray(b[0])&&o==="axis"?k=g2(b,n,a):k=i(b,t,c,j),Array.isArray(k))k.forEach(S=>{var _=Ej(Ej({},v),{},{name:S.name,unit:S.unit,color:void 0,fill:void 0});m.push(L0({tooltipEntrySettings:_,dataKey:S.dataKey,payload:S.payload,value:Jt(S.payload,S.dataKey),name:S.name}))});else{var w;m.push(L0({tooltipEntrySettings:v,dataKey:N,payload:k,value:Jt(k,N),name:(w=Jt(k,j))!==null&&w!==void 0?w:v==null?void 0:v.name}))}return m},f)}},jv=ae([Gt,lP,rv],OP),aK=ae([e=>e.graphicalItems.cartesianItems,e=>e.graphicalItems.polarItems],(e,t)=>[...e,...t]),iK=ae([nr,Ho],cP),Vo=ae([aK,Gt,iK],dP,{memoizeOptions:{resultEqualityCheck:cm}}),oK=ae([Vo],e=>e.filter(om)),lK=ae([Vo],mP,{memoizeOptions:{resultEqualityCheck:cm}}),Xo=ae([lK,ia],hP),cK=ae([oK,ia,Gt],aP),wv=ae([Xo,Gt,Vo],pP),tM=ae([Gt],fv),dK=ae([Gt],e=>e.allowDataOverflow),rM=ae([tM,dK],L_),uK=ae([Vo],e=>e.filter(om)),fK=ae([cK,uK,rm,Z_],gP),mK=ae([fK,ia,nr,rM],vP),hK=ae([Vo],fP),pK=ae([Xo,Gt,hK,mv,nr],jP,{memoizeOptions:{resultEqualityCheck:lm}}),xK=ae([wP,nr,Ho],Ko),gK=ae([xK,nr],SP),vK=ae([NP,nr,Ho],Ko),yK=ae([vK,nr],CP),bK=ae([kP,nr,Ho],Ko),jK=ae([bK,nr],_P),wK=ae([gK,jK,yK],Ou),NK=ae([Gt,tM,rM,mK,pK,wK,dt,nr],PP),Rc=ae([Gt,dt,Xo,wv,rm,nr,NK],MP),kK=ae([Rc,Gt,jv],EP),SK=ae([Gt,Rc,kK,nr],AP),nM=e=>{var t=nr(e),r=Ho(e),n=!1;return Ic(e,t,r,n)},sM=ae([Gt,nM],nm),aM=ae([Gt,jv,SK,sM],pv),CK=ae([dt,wv,Gt,nr],LP),_K=ae([dt,wv,Gt,nr],FP),PK=(e,t,r,n,a,i,o,l)=>{if(t){var{type:c}=t,d=Fa(e,l);if(n){var u=r==="scaleBand"&&n.bandwidth?n.bandwidth()/2:2,f=c==="category"&&n.bandwidth?n.bandwidth()/u:0;return f=l==="angleAxis"&&a!=null&&(a==null?void 0:a.length)>=2?Ur(a[0]-a[1])*2*f:f,d&&o?o.map((m,p)=>{var x=n.map(m);return Ye(x)?{coordinate:x+f,value:m,index:p,offset:f}:null}).filter(Hr):n.domain().map((m,p)=>{var x=n.map(m);return Ye(x)?{coordinate:x+f,value:i?i[m]:m,index:p,offset:f}:null}).filter(Hr)}}},ca=ae([dt,Gt,jv,aM,nM,CK,_K,nr],PK),Nv=ae([qP,WP,$H],(e,t,r)=>UP(r.shared,e,t)),iM=e=>e.tooltip.settings.trigger,kv=e=>e.tooltip.settings.defaultIndex,$c=ae([Go,Nv,iM,kv],XP),jo=ae([$c,Xo,Tc,Rc],bv),oM=ae([ca,jo],HP),lM=ae([$c],e=>{if(e)return e.dataKey});ae([$c],e=>{if(e)return e.graphicalItemId});var cM=ae([Go,Nv,iM,kv],ZP),MK=ae([na,sa,dt,er,ca,kv,cM],QP),OK=ae([$c,MK],(e,t)=>e!=null&&e.coordinate?e.coordinate:t),EK=ae([$c],e=>{var t;return(t=e==null?void 0:e.active)!==null&&t!==void 0?t:!1}),AK=ae([cM,jo,ia,Tc,oM,JP,Nv],eM),DK=ae([AK],e=>{if(e!=null){var t=e.map(r=>r.payload).filter(r=>r!=null);return Array.from(new Set(t))}});function Aj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Dj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Aj(Object(r),!0).forEach(function(n){TK(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Aj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function TK(e,t,r){return(t=IK(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function IK(e){var t=RK(e,"string");return typeof t=="symbol"?t:t+""}function RK(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $K=()=>Ae(Gt),zK=()=>{var e=$K(),t=Ae(ca),r=Ae(aM);return ou(!e||!r?void 0:Dj(Dj({},e),{},{scale:r}),t)};function Tj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Wi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Tj(Object(r),!0).forEach(function(n){LK(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function LK(e,t,r){return(t=FK(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function FK(e){var t=BK(e,"string");return typeof t=="symbol"?t:t+""}function BK(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var qK=(e,t,r,n)=>{var a=t.find(i=>i&&i.index===r);if(a){if(e==="horizontal")return{x:a.coordinate,y:n.chartY};if(e==="vertical")return{x:n.chartX,y:a.coordinate}}return{x:0,y:0}},WK=(e,t,r,n)=>{var a=t.find(d=>d&&d.index===r);if(a){if(e==="centric"){var i=a.coordinate,{radius:o}=n;return Wi(Wi(Wi({},n),hr(n.cx,n.cy,o,i)),{},{angle:i,radius:o})}var l=a.coordinate,{angle:c}=n;return Wi(Wi(Wi({},n),hr(n.cx,n.cy,l,c)),{},{angle:c,radius:l})}return{angle:0,clockWise:!1,cx:0,cy:0,endAngle:0,innerRadius:0,outerRadius:0,radius:0,startAngle:0,x:0,y:0}};function UK(e,t){var{chartX:r,chartY:n}=e;return r>=t.left&&r<=t.left+t.width&&n>=t.top&&n<=t.top+t.height}var dM=(e,t,r,n,a)=>{var i,o=(i=t==null?void 0:t.length)!==null&&i!==void 0?i:0;if(o<=1||e==null)return 0;if(n==="angleAxis"&&a!=null&&Math.abs(Math.abs(a[1]-a[0])-360)<=1e-6)for(var l=0;l<o;l++){var c,d,u,f,m,p=l>0?(c=r[l-1])===null||c===void 0?void 0:c.coordinate:(d=r[o-1])===null||d===void 0?void 0:d.coordinate,x=(u=r[l])===null||u===void 0?void 0:u.coordinate,g=l>=o-1?(f=r[0])===null||f===void 0?void 0:f.coordinate:(m=r[l+1])===null||m===void 0?void 0:m.coordinate,v=void 0;if(!(p==null||x==null||g==null))if(Ur(x-p)!==Ur(g-x)){var y=[];if(Ur(g-x)===Ur(a[1]-a[0])){v=g;var b=x+a[1]-a[0];y[0]=Math.min(b,(b+p)/2),y[1]=Math.max(b,(b+p)/2)}else{v=p;var N=g+a[1]-a[0];y[0]=Math.min(x,(N+x)/2),y[1]=Math.max(x,(N+x)/2)}var j=[Math.min(x,(v+x)/2),Math.max(x,(v+x)/2)];if(e>j[0]&&e<=j[1]||e>=y[0]&&e<=y[1]){var k;return(k=r[l])===null||k===void 0?void 0:k.index}}else{var w=Math.min(p,g),S=Math.max(p,g);if(e>(w+x)/2&&e<=(S+x)/2){var _;return(_=r[l])===null||_===void 0?void 0:_.index}}}else if(t)for(var C=0;C<o;C++){var P=t[C];if(P!=null){var O=t[C+1],E=t[C-1];if(C===0&&O!=null&&e<=(P.coordinate+O.coordinate)/2||C===o-1&&E!=null&&e>(P.coordinate+E.coordinate)/2||C>0&&C<o-1&&E!=null&&O!=null&&e>(P.coordinate+E.coordinate)/2&&e<=(P.coordinate+O.coordinate)/2)return P.index}}return-1},HK=()=>Ae(rv),Sv=(e,t)=>t,uM=(e,t,r)=>r,Cv=(e,t,r,n)=>n,KK=ae(ca,e=>Ef(e,t=>t.coordinate)),_v=ae([Go,Sv,uM,Cv],XP),Pv=ae([_v,Xo,Tc,Rc],bv),YK=(e,t,r)=>{if(t!=null){var n=Go(e);return t==="axis"?r==="hover"?n.axisInteraction.hover.dataKey:n.axisInteraction.click.dataKey:r==="hover"?n.itemInteraction.hover.dataKey:n.itemInteraction.click.dataKey}},fM=ae([Go,Sv,uM,Cv],ZP),Eu=ae([na,sa,dt,er,ca,Cv,fM],QP),GK=ae([_v,Eu],(e,t)=>{var r;return(r=e.coordinate)!==null&&r!==void 0?r:t}),mM=ae([ca,Pv],HP),VK=ae([fM,Pv,ia,Tc,mM,JP,Sv],eM),XK=ae([_v,Pv],(e,t)=>({isActive:e.active&&t!=null,activeIndex:t})),QK=(e,t,r,n,a,i,o)=>{if(!(!e||!r||!n||!a)&&UK(e,o)){var l=TB(e,t),c=dM(l,i,a,r,n),d=qK(t,a,c,e);return{activeIndex:String(c),activeCoordinate:d}}},ZK=(e,t,r,n,a,i,o)=>{if(!(!e||!n||!a||!i||!r)){var l=Lq(e,r);if(l){var c=IB(l,t),d=dM(c,o,i,n,a),u=WK(t,i,d,l);return{activeIndex:String(d),activeCoordinate:u}}}},JK=(e,t,r,n,a,i,o,l)=>{if(!(!e||!t||!n||!a||!i))return t==="horizontal"||t==="vertical"?QK(e,t,n,a,i,o,l):ZK(e,t,r,n,a,i,o)},eY=ae(e=>e.zIndex.zIndexMap,(e,t)=>t,(e,t,r)=>r,(e,t,r)=>{if(t!=null){var n=e[t];if(n!=null)return r?n.panoramaElement:n.element}}),tY=ae(e=>e.zIndex.zIndexMap,e=>{var t=Object.keys(e).map(n=>parseInt(n,10)).concat(Object.values(Mr)),r=Array.from(new Set(t));return r.sort((n,a)=>n-a)},{memoizeOptions:{resultEqualityCheck:IU}});function Ij(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Rj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ij(Object(r),!0).forEach(function(n){rY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ij(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function rY(e,t,r){return(t=nY(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function nY(e){var t=sY(e,"string");return typeof t=="symbol"?t:t+""}function sY(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var aY={},iY={zIndexMap:Object.values(Mr).reduce((e,t)=>Rj(Rj({},e),{},{[t]:{element:void 0,panoramaElement:void 0,consumers:0}}),aY)},oY=new Set(Object.values(Mr));function lY(e){return oY.has(e)}var hM=en({name:"zIndex",initialState:iY,reducers:{registerZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]?e.zIndexMap[r].consumers+=1:e.zIndexMap[r]={consumers:1,element:void 0,panoramaElement:void 0}},prepare:yt()},unregisterZIndexPortal:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(e.zIndexMap[r].consumers-=1,e.zIndexMap[r].consumers<=0&&!lY(r)&&delete e.zIndexMap[r])},prepare:yt()},registerZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r,element:n,isPanorama:a}=t.payload;e.zIndexMap[r]?a?e.zIndexMap[r].panoramaElement=n:e.zIndexMap[r].element=n:e.zIndexMap[r]={consumers:0,element:a?void 0:n,panoramaElement:a?n:void 0}},prepare:yt()},unregisterZIndexPortalElement:{reducer:(e,t)=>{var{zIndex:r}=t.payload;e.zIndexMap[r]&&(t.payload.isPanorama?e.zIndexMap[r].panoramaElement=void 0:e.zIndexMap[r].element=void 0)},prepare:yt()}}}),{registerZIndexPortal:cY,unregisterZIndexPortal:dY,registerZIndexPortalElement:uY,unregisterZIndexPortalElement:fY}=hM.actions,mY=hM.reducer;function da(e){var{zIndex:t,children:r}=e,n=d7(),a=n&&t!==void 0&&t!==0,i=tn(),o=$t();h.useLayoutEffect(()=>a?(o(cY({zIndex:t})),()=>{o(dY({zIndex:t}))}):Fo,[o,t,a]);var l=Ae(c=>eY(c,t,i));return a?l?Jp.createPortal(r,l):null:r}function $p(){return $p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},$p.apply(null,arguments)}function $j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function pd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$j(Object(r),!0).forEach(function(n){hY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$j(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function hY(e,t,r){return(t=pY(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function pY(e){var t=xY(e,"string");return typeof t=="symbol"?t:t+""}function xY(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function gY(e){var{cursor:t,cursorComp:r,cursorProps:n}=e;return h.isValidElement(t)?h.cloneElement(t,n):h.createElement(r,n)}function vY(e){var t,{coordinate:r,payload:n,index:a,offset:i,tooltipAxisBandSize:o,layout:l,cursor:c,tooltipEventType:d,chartName:u}=e,f=r,m=n,p=a;if(!c||!f||u!=="ScatterChart"&&d!=="axis")return null;var x,g,v;if(u==="ScatterChart")x=f,g=Z7,v=Mr.cursorLine;else if(u==="BarChart")x=J7(l,f,i,o),g=XC,v=Mr.cursorRectangle;else if(l==="radial"&&b2(f)){var{cx:y,cy:b,radius:N,startAngle:j,endAngle:k}=QC(f);x={cx:y,cy:b,startAngle:j,endAngle:k,innerRadius:N,outerRadius:N},g=JC,v=Mr.cursorLine}else x={points:Wq(l,f,i)},g=HC,v=Mr.cursorLine;var w=typeof c=="object"&&"className"in c?c.className:void 0,S=pd(pd(pd(pd({stroke:"#ccc",pointerEvents:"none"},i),x),tg(c)),{},{payload:m,payloadIndex:p,className:lt("recharts-tooltip-cursor",w)});return h.createElement(da,{zIndex:(t=e.zIndex)!==null&&t!==void 0?t:v},h.createElement(gY,{cursor:c,cursorComp:g,cursorProps:S}))}function yY(e){var t=zK(),r=AC(),n=Bo(),a=HK();return t==null||r==null||n==null||a==null?null:h.createElement(vY,$p({},e,{offset:r,layout:n,tooltipAxisBandSize:t,chartName:a}))}var pM=h.createContext(null),bY=()=>h.useContext(pM),xM={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function a(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,f,m){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new a(u,f||c,m),x=r?r+d:d;return c._events[x]?c._events[x].fn?c._events[x]=[c._events[x],p]:c._events[x].push(p):(c._events[x]=p,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new n:delete c._events[d]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,f;if(this._eventsCount===0)return d;for(f in u=this._events)t.call(u,f)&&d.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=r?r+d:d,f=this._events[u];if(!f)return[];if(f.fn)return[f.fn];for(var m=0,p=f.length,x=new Array(p);m<p;m++)x[m]=f[m].fn;return x},l.prototype.listenerCount=function(d){var u=r?r+d:d,f=this._events[u];return f?f.fn?1:f.length:0},l.prototype.emit=function(d,u,f,m,p,x){var g=r?r+d:d;if(!this._events[g])return!1;var v=this._events[g],y=arguments.length,b,N;if(v.fn){switch(v.once&&this.removeListener(d,v.fn,void 0,!0),y){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,u),!0;case 3:return v.fn.call(v.context,u,f),!0;case 4:return v.fn.call(v.context,u,f,m),!0;case 5:return v.fn.call(v.context,u,f,m,p),!0;case 6:return v.fn.call(v.context,u,f,m,p,x),!0}for(N=1,b=new Array(y-1);N<y;N++)b[N-1]=arguments[N];v.fn.apply(v.context,b)}else{var j=v.length,k;for(N=0;N<j;N++)switch(v[N].once&&this.removeListener(d,v[N].fn,void 0,!0),y){case 1:v[N].fn.call(v[N].context);break;case 2:v[N].fn.call(v[N].context,u);break;case 3:v[N].fn.call(v[N].context,u,f);break;case 4:v[N].fn.call(v[N].context,u,f,m);break;default:if(!b)for(k=1,b=new Array(y-1);k<y;k++)b[k-1]=arguments[k];v[N].fn.apply(v[N].context,b)}}return!0},l.prototype.on=function(d,u,f){return i(this,d,u,f,!1)},l.prototype.once=function(d,u,f){return i(this,d,u,f,!0)},l.prototype.removeListener=function(d,u,f,m){var p=r?r+d:d;if(!this._events[p])return this;if(!u)return o(this,p),this;var x=this._events[p];if(x.fn)x.fn===u&&(!m||x.once)&&(!f||x.context===f)&&o(this,p);else{for(var g=0,v=[],y=x.length;g<y;g++)(x[g].fn!==u||m&&!x[g].once||f&&x[g].context!==f)&&v.push(x[g]);v.length?this._events[p]=v.length===1?v[0]:v:o(this,p)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=r?r+d:d,this._events[u]&&o(this,u)):(this._events=new n,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=r,l.EventEmitter=l,e.exports=l})(xM);var jY=xM.exports;const wY=Qs(jY);var Xl=new wY,zp="recharts.syncEvent.tooltip",zj="recharts.syncEvent.brush",NY=(e,t)=>{if(t&&Array.isArray(e)){var r=Number.parseInt(t,10);if(!ms(r))return e[r]}},kY={chartName:"",tooltipPayloadSearcher:()=>{},eventEmitter:void 0,defaultTooltipEventType:"axis"},gM=en({name:"options",initialState:kY,reducers:{createEventEmitter:e=>{e.eventEmitter==null&&(e.eventEmitter=Symbol("rechartsEventEmitter"))}}}),SY=gM.reducer,{createEventEmitter:CY}=gM.actions;function _Y(e){return e.tooltip.syncInteraction}var PY={chartData:void 0,computedData:void 0,dataStartIndex:0,dataEndIndex:0},vM=en({name:"chartData",initialState:PY,reducers:{setChartData(e,t){if(e.chartData=t.payload,t.payload==null){e.dataStartIndex=0,e.dataEndIndex=0;return}t.payload.length>0&&e.dataEndIndex!==t.payload.length-1&&(e.dataEndIndex=t.payload.length-1)},setComputedData(e,t){e.computedData=t.payload},setDataStartEndIndexes(e,t){var{startIndex:r,endIndex:n}=t.payload;r!=null&&(e.dataStartIndex=r),n!=null&&(e.dataEndIndex=n)}}}),{setChartData:Lj,setDataStartEndIndexes:MY,setComputedData:sne}=vM.actions,OY=vM.reducer,EY=["x","y"];function Fj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ui(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Fj(Object(r),!0).forEach(function(n){AY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Fj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function AY(e,t,r){return(t=DY(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DY(e){var t=TY(e,"string");return typeof t=="symbol"?t:t+""}function TY(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function IY(e,t){if(e==null)return{};var r,n,a=RY(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function RY(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function $Y(){var e=Ae(nv),t=Ae(sv),r=$t(),n=Ae(J_),a=Ae(ca),i=Bo(),o=Hf(),l=Ae(c=>c.rootProps.className);h.useEffect(()=>{if(e==null)return Fo;var c=(d,u,f)=>{if(t!==f&&e===d){if(n==="index"){var m;if(o&&u!==null&&u!==void 0&&(m=u.payload)!==null&&m!==void 0&&m.coordinate&&u.payload.sourceViewBox){var p=u.payload.coordinate,{x,y:g}=p,v=IY(p,EY),{x:y,y:b,width:N,height:j}=u.payload.sourceViewBox,k=Ui(Ui({},v),{},{x:o.x+(N?(x-y)/N:0)*o.width,y:o.y+(j?(g-b)/j:0)*o.height});r(Ui(Ui({},u),{},{payload:Ui(Ui({},u.payload),{},{coordinate:k})}))}else r(u);return}if(a!=null){var w;if(typeof n=="function"){var S={activeTooltipIndex:u.payload.index==null?void 0:Number(u.payload.index),isTooltipActive:u.payload.active,activeIndex:u.payload.index==null?void 0:Number(u.payload.index),activeLabel:u.payload.label,activeDataKey:u.payload.dataKey,activeCoordinate:u.payload.coordinate},_=n(a,S);w=a[_]}else n==="value"&&(w=a.find(Q=>String(Q.value)===u.payload.label));var{coordinate:C}=u.payload;if(w==null||u.payload.active===!1||C==null||o==null){r(Ip({active:!1,coordinate:void 0,dataKey:void 0,index:null,label:void 0,sourceViewBox:void 0,graphicalItemId:void 0}));return}var{x:P,y:O}=C,E=Math.min(P,o.x+o.width),D=Math.min(O,o.y+o.height),I={x:i==="horizontal"?w.coordinate:E,y:i==="horizontal"?D:w.coordinate},V=Ip({active:u.payload.active,coordinate:I,dataKey:u.payload.dataKey,index:String(w.index),label:u.payload.label,sourceViewBox:u.payload.sourceViewBox,graphicalItemId:u.payload.graphicalItemId});r(V)}}};return Xl.on(zp,c),()=>{Xl.off(zp,c)}},[l,r,t,e,n,a,i,o])}function zY(){var e=Ae(nv),t=Ae(sv),r=$t();h.useEffect(()=>{if(e==null)return Fo;var n=(a,i,o)=>{t!==o&&e===a&&r(MY(i))};return Xl.on(zj,n),()=>{Xl.off(zj,n)}},[r,t,e])}function LY(){var e=$t();h.useEffect(()=>{e(CY())},[e]),$Y(),zY()}function FY(e,t,r,n,a,i){var o=Ae(p=>YK(p,e,t)),l=Ae(sv),c=Ae(nv),d=Ae(J_),u=Ae(_Y),f=u==null?void 0:u.active,m=Hf();h.useEffect(()=>{if(!f&&c!=null&&l!=null){var p=Ip({active:i,coordinate:r,dataKey:o,index:a,label:typeof n=="number"?String(n):n,sourceViewBox:m,graphicalItemId:void 0});Xl.emit(zp,c,p,l)}},[f,r,o,a,n,l,c,d,i,m])}function Bj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function qj(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Bj(Object(r),!0).forEach(function(n){BY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function BY(e,t,r){return(t=qY(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function qY(e){var t=WY(e,"string");return typeof t=="symbol"?t:t+""}function WY(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function UY(e){return e.dataKey}function HY(e,t){return h.isValidElement(e)?h.cloneElement(e,t):typeof e=="function"?h.createElement(e,t):h.createElement(E7,t)}var Wj=[],KY={allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",axisId:0,contentStyle:{},cursor:!0,filterNull:!0,includeHidden:!1,isAnimationActive:"auto",itemSorter:"name",itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,wrapperStyle:{}};function YY(e){var t,r,n=xn(e,KY),{active:a,allowEscapeViewBox:i,animationDuration:o,animationEasing:l,content:c,filterNull:d,isAnimationActive:u,offset:f,payloadUniqBy:m,position:p,reverseDirection:x,useTranslate3d:g,wrapperStyle:v,cursor:y,shared:b,trigger:N,defaultIndex:j,portal:k,axisId:w}=n,S=$t(),_=typeof j=="number"?String(j):j;h.useEffect(()=>{S(qH({shared:b,trigger:N,axisId:w,active:a,defaultIndex:_}))},[S,b,N,w,a,_]);var C=Hf(),P=UC(),O=RH(b),{activeIndex:E,isActive:D}=(t=Ae(A=>XK(A,O,N,_)))!==null&&t!==void 0?t:{},I=Ae(A=>VK(A,O,N,_)),V=Ae(A=>mM(A,O,N,_)),Q=Ae(A=>GK(A,O,N,_)),q=I,re=bY(),se=(r=a??D)!==null&&r!==void 0?r:!1,[T,M]=y8([q,se]),L=O==="axis"?V:void 0;FY(O,N,Q,L,E,se);var H=k??re;if(H==null||C==null||O==null)return null;var R=q??Wj;se||(R=Wj),d&&R.length&&(R=r8(R.filter(A=>A.value!=null&&(A.hide!==!0||n.includeHidden)),m,UY));var Y=R.length>0,J=h.createElement(z7,{allowEscapeViewBox:i,animationDuration:o,animationEasing:l,isAnimationActive:u,active:se,coordinate:Q,hasPayload:Y,offset:f,position:p,reverseDirection:x,useTranslate3d:g,viewBox:C,wrapperStyle:v,lastBoundingBox:T,innerRef:M,hasPortalFromProps:!!k},HY(c,qj(qj({},n),{},{payload:R,label:L,active:se,activeIndex:E,coordinate:Q,accessibilityLayer:P})));return h.createElement(h.Fragment,null,Jp.createPortal(J,H),se&&h.createElement(yY,{cursor:y,tooltipEventType:O,coordinate:Q,payload:R,index:E}))}var yM=e=>null;yM.displayName="Cell";function GY(e,t,r){return(t=VY(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VY(e){var t=XY(e,"string");return typeof t=="symbol"?t:t+""}function XY(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}class QY{constructor(t){GY(this,"cache",new Map),this.maxSize=t}get(t){var r=this.cache.get(t);return r!==void 0&&(this.cache.delete(t),this.cache.set(t,r)),r}set(t,r){if(this.cache.has(t))this.cache.delete(t);else if(this.cache.size>=this.maxSize){var n=this.cache.keys().next().value;n!=null&&this.cache.delete(n)}this.cache.set(t,r)}clear(){this.cache.clear()}size(){return this.cache.size}}function Uj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ZY(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Uj(Object(r),!0).forEach(function(n){JY(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Uj(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function JY(e,t,r){return(t=eG(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function eG(e){var t=tG(e,"string");return typeof t=="symbol"?t:t+""}function tG(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var rG={cacheSize:2e3,enableCache:!0},bM=ZY({},rG),Hj=new QY(bM.cacheSize),nG={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},Kj="recharts_measurement_span";function sG(e,t){var r=t.fontSize||"",n=t.fontFamily||"",a=t.fontWeight||"",i=t.fontStyle||"",o=t.letterSpacing||"",l=t.textTransform||"";return"".concat(e,"|").concat(r,"|").concat(n,"|").concat(a,"|").concat(i,"|").concat(o,"|").concat(l)}var Yj=(e,t)=>{try{var r=document.getElementById(Kj);r||(r=document.createElement("span"),r.setAttribute("id",Kj),r.setAttribute("aria-hidden","true"),document.body.appendChild(r)),Object.assign(r.style,nG,t),r.textContent="".concat(e);var n=r.getBoundingClientRect();return{width:n.width,height:n.height}}catch{return{width:0,height:0}}},Ml=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||Vf.isSsr)return{width:0,height:0};if(!bM.enableCache)return Yj(t,r);var n=sG(t,r),a=Hj.get(n);if(a)return a;var i=Yj(t,r);return Hj.set(n,i),i},jM;function aG(e,t,r){return(t=iG(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function iG(e){var t=oG(e,"string");return typeof t=="symbol"?t:t+""}function oG(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var Gj=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,Vj=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,lG=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,cG=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,dG={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},uG=["cm","mm","pt","pc","in","Q","px"];function fG(e){return uG.includes(e)}var Vi="NaN";function mG(e,t){return e*dG[t]}class ur{static parse(t){var r,[,n,a]=(r=cG.exec(t))!==null&&r!==void 0?r:[];return n==null?ur.NaN:new ur(parseFloat(n),a??"")}constructor(t,r){this.num=t,this.unit=r,this.num=t,this.unit=r,ms(t)&&(this.unit=""),r!==""&&!lG.test(r)&&(this.num=NaN,this.unit=""),fG(r)&&(this.num=mG(t,r),this.unit="px")}add(t){return this.unit!==t.unit?new ur(NaN,""):new ur(this.num+t.num,this.unit)}subtract(t){return this.unit!==t.unit?new ur(NaN,""):new ur(this.num-t.num,this.unit)}multiply(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new ur(NaN,""):new ur(this.num*t.num,this.unit||t.unit)}divide(t){return this.unit!==""&&t.unit!==""&&this.unit!==t.unit?new ur(NaN,""):new ur(this.num/t.num,this.unit||t.unit)}toString(){return"".concat(this.num).concat(this.unit)}isNaN(){return ms(this.num)}}jM=ur;aG(ur,"NaN",new jM(NaN,""));function wM(e){if(e==null||e.includes(Vi))return Vi;for(var t=e;t.includes("*")||t.includes("/");){var r,[,n,a,i]=(r=Gj.exec(t))!==null&&r!==void 0?r:[],o=ur.parse(n??""),l=ur.parse(i??""),c=a==="*"?o.multiply(l):o.divide(l);if(c.isNaN())return Vi;t=t.replace(Gj,c.toString())}for(;t.includes("+")||/.-\d+(?:\.\d+)?/.test(t);){var d,[,u,f,m]=(d=Vj.exec(t))!==null&&d!==void 0?d:[],p=ur.parse(u??""),x=ur.parse(m??""),g=f==="+"?p.add(x):p.subtract(x);if(g.isNaN())return Vi;t=t.replace(Vj,g.toString())}return t}var Xj=/\(([^()]*)\)/;function hG(e){for(var t=e,r;(r=Xj.exec(t))!=null;){var[,n]=r;t=t.replace(Xj,wM(n))}return t}function pG(e){var t=e.replace(/\s+/g,"");return t=hG(t),t=wM(t),t}function xG(e){try{return pG(e)}catch{return Vi}}function vh(e){var t=xG(e.slice(5,-1));return t===Vi?"":t}var gG=["x","y","lineHeight","capHeight","fill","scaleToFit","textAnchor","verticalAnchor"],vG=["dx","dy","angle","className","breakAll"];function Lp(){return Lp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Lp.apply(null,arguments)}function Qj(e,t){if(e==null)return{};var r,n,a=yG(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function yG(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var NM=/[ \f\n\r\t\v\u2028\u2029]+/,kM=e=>{var{children:t,breakAll:r,style:n}=e;try{var a=[];Bt(t)||(r?a=t.toString().split(""):a=t.toString().split(NM));var i=a.map(l=>({word:l,width:Ml(l,n).width})),o=r?0:Ml(" ",n).width;return{wordsWithComputedWidth:i,spaceWidth:o}}catch{return null}};function bG(e){return e==="start"||e==="middle"||e==="end"||e==="inherit"}var SM=(e,t,r,n)=>e.reduce((a,i)=>{var{word:o,width:l}=i,c=a[a.length-1];if(c&&l!=null&&(t==null||n||c.width+l+r<Number(t)))c.words.push(o),c.width+=l+r;else{var d={words:[o],width:l};a.push(d)}return a},[]),CM=e=>e.reduce((t,r)=>t.width>r.width?t:r),jG="…",Zj=(e,t,r,n,a,i,o,l)=>{var c=e.slice(0,t),d=kM({breakAll:r,style:n,children:c+jG});if(!d)return[!1,[]];var u=SM(d.wordsWithComputedWidth,i,o,l),f=u.length>a||CM(u).width>Number(i);return[f,u]},wG=(e,t,r,n,a)=>{var{maxLines:i,children:o,style:l,breakAll:c}=e,d=Ce(i),u=String(o),f=SM(t,n,r,a);if(!d||a)return f;var m=f.length>i||CM(f).width>Number(n);if(!m)return f;for(var p=0,x=u.length-1,g=0,v;p<=x&&g<=u.length-1;){var y=Math.floor((p+x)/2),b=y-1,[N,j]=Zj(u,b,c,l,i,n,r,a),[k]=Zj(u,y,c,l,i,n,r,a);if(!N&&!k&&(p=y+1),N&&k&&(x=y-1),!N&&k){v=j;break}g++}return v||f},Jj=e=>{var t=Bt(e)?[]:e.toString().split(NM);return[{words:t,width:void 0}]},NG=e=>{var{width:t,scaleToFit:r,children:n,style:a,breakAll:i,maxLines:o}=e;if((t||r)&&!Vf.isSsr){var l,c,d=kM({breakAll:i,children:n,style:a});if(d){var{wordsWithComputedWidth:u,spaceWidth:f}=d;l=u,c=f}else return Jj(n);return wG({breakAll:i,children:n,maxLines:o,style:a},l,c,t,!!r)}return Jj(n)},_M="#808080",kG={angle:0,breakAll:!1,capHeight:"0.71em",fill:_M,lineHeight:"1em",scaleToFit:!1,textAnchor:"start",verticalAnchor:"end",x:0,y:0},Mv=h.forwardRef((e,t)=>{var r=xn(e,kG),{x:n,y:a,lineHeight:i,capHeight:o,fill:l,scaleToFit:c,textAnchor:d,verticalAnchor:u}=r,f=Qj(r,gG),m=h.useMemo(()=>NG({breakAll:f.breakAll,children:f.children,maxLines:f.maxLines,scaleToFit:c,style:f.style,width:f.width}),[f.breakAll,f.children,f.maxLines,c,f.style,f.width]),{dx:p,dy:x,angle:g,className:v,breakAll:y}=f,b=Qj(f,vG);if(!hs(n)||!hs(a)||m.length===0)return null;var N=Number(n)+(Ce(p)?p:0),j=Number(a)+(Ce(x)?x:0);if(!Ye(N)||!Ye(j))return null;var k;switch(u){case"start":k=vh("calc(".concat(o,")"));break;case"middle":k=vh("calc(".concat((m.length-1)/2," * -").concat(i," + (").concat(o," / 2))"));break;default:k=vh("calc(".concat(m.length-1," * -").concat(i,")"));break}var w=[],S=m[0];if(c&&S!=null){var _=S.width,{width:C}=f;w.push("scale(".concat(Ce(C)&&Ce(_)?C/_:1,")"))}return g&&w.push("rotate(".concat(g,", ").concat(N,", ").concat(j,")")),w.length&&(b.transform=w.join(" ")),h.createElement("text",Lp({},Qr(b),{ref:t,x:N,y:j,className:lt("recharts-text",v),textAnchor:d,fill:l.includes("url")?_M:l}),m.map((P,O)=>{var E=P.words.join(y?"":" ");return h.createElement("tspan",{x:N,dy:O===0?k:i,key:"".concat(E,"-").concat(O)},E)}))});Mv.displayName="Text";function ew(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function ts(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ew(Object(r),!0).forEach(function(n){SG(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ew(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function SG(e,t,r){return(t=CG(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CG(e){var t=_G(e,"string");return typeof t=="symbol"?t:t+""}function _G(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var PG=e=>{var{viewBox:t,position:r,offset:n=0,parentViewBox:a}=e,{x:i,y:o,height:l,upperWidth:c,lowerWidth:d}=Cg(t),u=i,f=i+(c-d)/2,m=(u+f)/2,p=(c+d)/2,x=u+c/2,g=l>=0?1:-1,v=g*n,y=g>0?"end":"start",b=g>0?"start":"end",N=c>=0?1:-1,j=N*n,k=N>0?"end":"start",w=N>0?"start":"end",S=a;if(r==="top"){var _={x:u+c/2,y:o-v,horizontalAnchor:"middle",verticalAnchor:y};return S&&(_.height=Math.max(o-S.y,0),_.width=c),_}if(r==="bottom"){var C={x:f+d/2,y:o+l+v,horizontalAnchor:"middle",verticalAnchor:b};return S&&(C.height=Math.max(S.y+S.height-(o+l),0),C.width=d),C}if(r==="left"){var P={x:m-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"};return S&&(P.width=Math.max(P.x-S.x,0),P.height=l),P}if(r==="right"){var O={x:m+p+j,y:o+l/2,horizontalAnchor:w,verticalAnchor:"middle"};return S&&(O.width=Math.max(S.x+S.width-O.x,0),O.height=l),O}var E=S?{width:p,height:l}:{};return r==="insideLeft"?ts({x:m+j,y:o+l/2,horizontalAnchor:w,verticalAnchor:"middle"},E):r==="insideRight"?ts({x:m+p-j,y:o+l/2,horizontalAnchor:k,verticalAnchor:"middle"},E):r==="insideTop"?ts({x:u+c/2,y:o+v,horizontalAnchor:"middle",verticalAnchor:b},E):r==="insideBottom"?ts({x:f+d/2,y:o+l-v,horizontalAnchor:"middle",verticalAnchor:y},E):r==="insideTopLeft"?ts({x:u+j,y:o+v,horizontalAnchor:w,verticalAnchor:b},E):r==="insideTopRight"?ts({x:u+c-j,y:o+v,horizontalAnchor:k,verticalAnchor:b},E):r==="insideBottomLeft"?ts({x:f+j,y:o+l-v,horizontalAnchor:w,verticalAnchor:y},E):r==="insideBottomRight"?ts({x:f+d-j,y:o+l-v,horizontalAnchor:k,verticalAnchor:y},E):r&&typeof r=="object"&&(Ce(r.x)||yi(r.x))&&(Ce(r.y)||yi(r.y))?ts({x:i+Hn(r.x,p),y:o+Hn(r.y,l),horizontalAnchor:"end",verticalAnchor:"end"},E):ts({x,y:o+l/2,horizontalAnchor:"middle",verticalAnchor:"middle"},E)},MG=["labelRef"],OG=["content"];function tw(e,t){if(e==null)return{};var r,n,a=EG(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function EG(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function rw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sl(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?rw(Object(r),!0).forEach(function(n){AG(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function AG(e,t,r){return(t=DG(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function DG(e){var t=TG(e,"string");return typeof t=="symbol"?t:t+""}function TG(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function _s(){return _s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},_s.apply(null,arguments)}var PM=h.createContext(null),IG=e=>{var{x:t,y:r,upperWidth:n,lowerWidth:a,width:i,height:o,children:l}=e,c=h.useMemo(()=>({x:t,y:r,upperWidth:n,lowerWidth:a,width:i,height:o}),[t,r,n,a,i,o]);return h.createElement(PM.Provider,{value:c},l)},MM=()=>{var e=h.useContext(PM),t=Hf();return e||(t?Cg(t):void 0)},RG=h.createContext(null),$G=()=>{var e=h.useContext(RG),t=Ae(sP);return e||t},zG=e=>{var{value:t,formatter:r}=e,n=Bt(e.children)?t:e.children;return typeof r=="function"?r(n):n},Ov=e=>e!=null&&typeof e=="function",LG=(e,t)=>{var r=Ur(t-e),n=Math.min(Math.abs(t-e),360);return r*n},FG=(e,t,r,n,a)=>{var{offset:i,className:o}=e,{cx:l,cy:c,innerRadius:d,outerRadius:u,startAngle:f,endAngle:m,clockWise:p}=a,x=(d+u)/2,g=LG(f,m),v=g>=0?1:-1,y,b;switch(t){case"insideStart":y=f+v*i,b=p;break;case"insideEnd":y=m-v*i,b=!p;break;case"end":y=m+v*i,b=p;break;default:throw new Error("Unsupported position ".concat(t))}b=g<=0?b:!b;var N=hr(l,c,x,y),j=hr(l,c,x,y+(b?1:-1)*359),k="M".concat(N.x,",").concat(N.y,`
625
+ A`).concat(x,",").concat(x,",0,1,").concat(b?0:1,`,
626
+ `).concat(j.x,",").concat(j.y),w=Bt(e.id)?$l("recharts-radial-line-"):e.id;return h.createElement("text",_s({},n,{dominantBaseline:"central",className:lt("recharts-radial-bar-label",o)}),h.createElement("defs",null,h.createElement("path",{id:w,d:k})),h.createElement("textPath",{xlinkHref:"#".concat(w)},r))},BG=(e,t,r)=>{var{cx:n,cy:a,innerRadius:i,outerRadius:o,startAngle:l,endAngle:c}=e,d=(l+c)/2;if(r==="outside"){var{x:u,y:f}=hr(n,a,o+t,d);return{x:u,y:f,textAnchor:u>=n?"start":"end",verticalAnchor:"middle"}}if(r==="center")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"middle"};if(r==="centerTop")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"start"};if(r==="centerBottom")return{x:n,y:a,textAnchor:"middle",verticalAnchor:"end"};var m=(i+o)/2,{x:p,y:x}=hr(n,a,m,d);return{x:p,y:x,textAnchor:"middle",verticalAnchor:"middle"}},Od=e=>e!=null&&"cx"in e&&Ce(e.cx),qG={angle:0,offset:5,zIndex:Mr.label,position:"middle",textBreakAll:!1};function WG(e){if(!Od(e))return e;var{cx:t,cy:r,outerRadius:n}=e,a=n*2;return{x:t-n,y:r-n,width:a,upperWidth:a,lowerWidth:a,height:a}}function xa(e){var t=xn(e,qG),{viewBox:r,parentViewBox:n,position:a,value:i,children:o,content:l,className:c="",textBreakAll:d,labelRef:u}=t,f=$G(),m=MM(),p=a==="center"?m:f??m,x,g,v;r==null?x=p:Od(r)?x=r:x=Cg(r);var y=WG(x);if(!x||Bt(i)&&Bt(o)&&!h.isValidElement(l)&&typeof l!="function")return null;var b=Sl(Sl({},t),{},{viewBox:x});if(h.isValidElement(l)){var{labelRef:N}=b,j=tw(b,MG);return h.cloneElement(l,j)}if(typeof l=="function"){var{content:k}=b,w=tw(b,OG);if(g=h.createElement(l,w),h.isValidElement(g))return g}else g=zG(t);var S=Qr(t);if(Od(x)){if(a==="insideStart"||a==="insideEnd"||a==="end")return FG(t,a,g,S,x);v=BG(x,t.offset,t.position)}else{if(!y)return null;var _=PG({viewBox:y,position:a,offset:t.offset,parentViewBox:Od(n)?void 0:n});v=Sl(Sl({x:_.x,y:_.y,textAnchor:_.horizontalAnchor,verticalAnchor:_.verticalAnchor},_.width!==void 0?{width:_.width}:{}),_.height!==void 0?{height:_.height}:{})}return h.createElement(da,{zIndex:t.zIndex},h.createElement(Mv,_s({ref:u,className:lt("recharts-label",c)},S,v,{textAnchor:bG(S.textAnchor)?S.textAnchor:v.textAnchor,breakAll:d}),g))}xa.displayName="Label";var UG=(e,t,r)=>{if(!e)return null;var n={viewBox:t,labelRef:r};return e===!0?h.createElement(xa,_s({key:"label-implicit"},n)):hs(e)?h.createElement(xa,_s({key:"label-implicit",value:e},n)):h.isValidElement(e)?e.type===xa?h.cloneElement(e,Sl({key:"label-implicit"},n)):h.createElement(xa,_s({key:"label-implicit",content:e},n)):Ov(e)?h.createElement(xa,_s({key:"label-implicit",content:e},n)):e&&typeof e=="object"?h.createElement(xa,_s({},e,{key:"label-implicit"},n)):null};function HG(e){var{label:t,labelRef:r}=e,n=MM();return UG(t,n,r)||null}var OM={},EM={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return r[r.length-1]}e.last=t})(EM);var AM={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){return Array.isArray(r)?r:Array.from(r)}e.toArray=t})(AM);(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});const t=EM,r=AM,n=Mf;function a(i){if(n.isArrayLike(i))return t.last(r.toArray(i))}e.last=a})(OM);var KG=OM.last;const YG=Qs(KG);var GG=["valueAccessor"],VG=["dataKey","clockWise","id","textBreakAll","zIndex"];function Au(){return Au=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Au.apply(null,arguments)}function nw(e,t){if(e==null)return{};var r,n,a=XG(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function XG(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var QG=e=>Array.isArray(e.value)?YG(e.value):e.value,DM=h.createContext(void 0),ZG=DM.Provider,TM=h.createContext(void 0);TM.Provider;function JG(){return h.useContext(DM)}function eV(){return h.useContext(TM)}function Ed(e){var{valueAccessor:t=QG}=e,r=nw(e,GG),{dataKey:n,clockWise:a,id:i,textBreakAll:o,zIndex:l}=r,c=nw(r,VG),d=JG(),u=eV(),f=d||u;return!f||!f.length?null:h.createElement(da,{zIndex:l??Mr.label},h.createElement(Ws,{className:"recharts-label-list"},f.map((m,p)=>{var x,g=Bt(n)?t(m,p):Jt(m.payload,n),v=Bt(i)?{}:{id:"".concat(i,"-").concat(p)};return h.createElement(xa,Au({key:"label-".concat(p)},Qr(m),c,v,{fill:(x=r.fill)!==null&&x!==void 0?x:m.fill,parentViewBox:m.parentViewBox,value:g,textBreakAll:o,viewBox:m.viewBox,index:p,zIndex:0}))})))}Ed.displayName="LabelList";function tV(e){var{label:t}=e;return t?t===!0?h.createElement(Ed,{key:"labelList-implicit"}):h.isValidElement(t)||Ov(t)?h.createElement(Ed,{key:"labelList-implicit",content:t}):typeof t=="object"?h.createElement(Ed,Au({key:"labelList-implicit"},t,{type:String(t.type)})):null:null}var rV={radiusAxis:{},angleAxis:{}},IM=en({name:"polarAxis",initialState:rV,reducers:{addRadiusAxis(e,t){e.radiusAxis[t.payload.id]=t.payload},removeRadiusAxis(e,t){delete e.radiusAxis[t.payload.id]},addAngleAxis(e,t){e.angleAxis[t.payload.id]=t.payload},removeAngleAxis(e,t){delete e.angleAxis[t.payload.id]}}}),{addRadiusAxis:ane,removeRadiusAxis:ine,addAngleAxis:one,removeAngleAxis:lne}=IM.actions,nV=IM.reducer;function sV(e){return e&&typeof e=="object"&&"className"in e&&typeof e.className=="string"?e.className:""}var RM={exports:{}},ut={};/**
627
+ * @license React
628
+ * react-is.production.js
629
+ *
630
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
631
+ *
632
+ * This source code is licensed under the MIT license found in the
633
+ * LICENSE file in the root directory of this source tree.
634
+ */var Ev=Symbol.for("react.transitional.element"),Av=Symbol.for("react.portal"),hm=Symbol.for("react.fragment"),pm=Symbol.for("react.strict_mode"),xm=Symbol.for("react.profiler"),gm=Symbol.for("react.consumer"),vm=Symbol.for("react.context"),ym=Symbol.for("react.forward_ref"),bm=Symbol.for("react.suspense"),jm=Symbol.for("react.suspense_list"),wm=Symbol.for("react.memo"),Nm=Symbol.for("react.lazy"),aV=Symbol.for("react.view_transition"),iV=Symbol.for("react.client.reference");function Dn(e){if(typeof e=="object"&&e!==null){var t=e.$$typeof;switch(t){case Ev:switch(e=e.type,e){case hm:case xm:case pm:case bm:case jm:case aV:return e;default:switch(e=e&&e.$$typeof,e){case vm:case ym:case Nm:case wm:return e;case gm:return e;default:return t}}case Av:return t}}}ut.ContextConsumer=gm;ut.ContextProvider=vm;ut.Element=Ev;ut.ForwardRef=ym;ut.Fragment=hm;ut.Lazy=Nm;ut.Memo=wm;ut.Portal=Av;ut.Profiler=xm;ut.StrictMode=pm;ut.Suspense=bm;ut.SuspenseList=jm;ut.isContextConsumer=function(e){return Dn(e)===gm};ut.isContextProvider=function(e){return Dn(e)===vm};ut.isElement=function(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ev};ut.isForwardRef=function(e){return Dn(e)===ym};ut.isFragment=function(e){return Dn(e)===hm};ut.isLazy=function(e){return Dn(e)===Nm};ut.isMemo=function(e){return Dn(e)===wm};ut.isPortal=function(e){return Dn(e)===Av};ut.isProfiler=function(e){return Dn(e)===xm};ut.isStrictMode=function(e){return Dn(e)===pm};ut.isSuspense=function(e){return Dn(e)===bm};ut.isSuspenseList=function(e){return Dn(e)===jm};ut.isValidElementType=function(e){return typeof e=="string"||typeof e=="function"||e===hm||e===xm||e===pm||e===bm||e===jm||typeof e=="object"&&e!==null&&(e.$$typeof===Nm||e.$$typeof===wm||e.$$typeof===vm||e.$$typeof===gm||e.$$typeof===ym||e.$$typeof===iV||e.getModuleId!==void 0)};ut.typeOf=Dn;RM.exports=ut;var oV=RM.exports,sw=e=>typeof e=="string"?e:e?e.displayName||e.name||"Component":"",aw=null,yh=null,$M=e=>{if(e===aw&&Array.isArray(yh))return yh;var t=[];return h.Children.forEach(e,r=>{Bt(r)||(oV.isFragment(r)?t=t.concat($M(r.props.children)):t.push(r))}),yh=t,aw=e,t};function lV(e,t){var r=[],n=[];return Array.isArray(t)?n=t.map(a=>sw(a)):n=[sw(t)],$M(e).forEach(a=>{var i=mo(a,"type.displayName")||mo(a,"type.name");i&&n.indexOf(i)!==-1&&r.push(a)}),r}var cne=e=>e&&typeof e=="object"&&"clipDot"in e?!!e.clipDot:!0,zM={};(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});function t(r){var a;if(typeof r!="object"||r==null)return!1;if(Object.getPrototypeOf(r)===null)return!0;if(Object.prototype.toString.call(r)!=="[object Object]"){const i=r[Symbol.toStringTag];return i==null||!((a=Object.getOwnPropertyDescriptor(r,Symbol.toStringTag))!=null&&a.writable)?!1:r.toString()===`[object ${i}]`}let n=r;for(;Object.getPrototypeOf(n)!==null;)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(r)===n}e.isPlainObject=t})(zM);var cV=zM.isPlainObject;const dV=Qs(cV);var iw,ow,lw,cw,dw;function uw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function fw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?uw(Object(r),!0).forEach(function(n){uV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function uV(e,t,r){return(t=fV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function fV(e){var t=mV(e,"string");return typeof t=="symbol"?t:t+""}function mV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Du(){return Du=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Du.apply(null,arguments)}function bl(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var mw=(e,t,r,n,a)=>{var i=r-n,o;return o=Dt(iw||(iw=bl(["M ",",",""])),e,t),o+=Dt(ow||(ow=bl(["L ",",",""])),e+r,t),o+=Dt(lw||(lw=bl(["L ",",",""])),e+r-i/2,t+a),o+=Dt(cw||(cw=bl(["L ",",",""])),e+r-i/2-n,t+a),o+=Dt(dw||(dw=bl(["L ",","," Z"])),e,t),o},hV={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},pV=e=>{var t=xn(e,hV),{x:r,y:n,upperWidth:a,lowerWidth:i,height:o,className:l}=t,{animationEasing:c,animationDuration:d,animationBegin:u,isUpdateAnimationActive:f}=t,m=h.useRef(null),[p,x]=h.useState(-1),g=h.useRef(a),v=h.useRef(i),y=h.useRef(o),b=h.useRef(r),N=h.useRef(n),j=Og(e,"trapezoid-");if(h.useEffect(()=>{if(m.current&&m.current.getTotalLength)try{var I=m.current.getTotalLength();I&&x(I)}catch{}},[]),r!==+r||n!==+n||a!==+a||i!==+i||o!==+o||a===0&&i===0||o===0)return null;var k=lt("recharts-trapezoid",l);if(!f)return h.createElement("g",null,h.createElement("path",Du({},Qr(t),{className:k,d:mw(r,n,a,i,o)})));var w=g.current,S=v.current,_=y.current,C=b.current,P=N.current,O="0px ".concat(p===-1?1:p,"px"),E="".concat(p,"px 0px"),D=KC(["strokeDasharray"],d,c);return h.createElement(Mg,{animationId:j,key:j,canBegin:p>0,duration:d,easing:c,isActive:f,begin:u},I=>{var V=fr(w,a,I),Q=fr(S,i,I),q=fr(_,o,I),re=fr(C,r,I),se=fr(P,n,I);m.current&&(g.current=V,v.current=Q,y.current=q,b.current=re,N.current=se);var T=I>0?{transition:D,strokeDasharray:E}:{strokeDasharray:O};return h.createElement("path",Du({},Qr(t),{className:k,d:mw(re,se,V,Q,q),ref:m,style:fw(fw({},T),t.style)}))})},xV=["option","shapeType","activeClassName"];function gV(e,t){if(e==null)return{};var r,n,a=vV(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function vV(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function hw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Tu(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?hw(Object(r),!0).forEach(function(n){yV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function yV(e,t,r){return(t=bV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function bV(e){var t=jV(e,"string");return typeof t=="symbol"?t:t+""}function jV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function wV(e,t){return Tu(Tu({},t),e)}function NV(e,t){return e==="symbols"}function pw(e){var{shapeType:t,elementProps:r}=e;switch(t){case"rectangle":return h.createElement(XC,r);case"trapezoid":return h.createElement(pV,r);case"sector":return h.createElement(JC,r);case"symbols":if(NV(t))return h.createElement(y2,r);break;case"curve":return h.createElement(HC,r);default:return null}}function kV(e){return h.isValidElement(e)?e.props:e}function SV(e){var{option:t,shapeType:r,activeClassName:n="recharts-active-shape"}=e,a=gV(e,xV),i;if(h.isValidElement(t))i=h.cloneElement(t,Tu(Tu({},a),kV(t)));else if(typeof t=="function")i=t(a,a.index);else if(dV(t)&&typeof t!="boolean"){var o=wV(t,a);i=h.createElement(pw,{shapeType:r,elementProps:o})}else{var l=a;i=h.createElement(pw,{shapeType:r,elementProps:l})}return a.isActive?h.createElement(Ws,{className:n},i):i}var LM=(e,t,r)=>{var n=$t();return(a,i)=>o=>{e==null||e(a,i,o),n(YP({activeIndex:String(i),activeDataKey:t,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:r}))}},FM=e=>{var t=$t();return(r,n)=>a=>{e==null||e(r,n,a),t(WH())}},BM=(e,t,r)=>{var n=$t();return(a,i)=>o=>{e==null||e(a,i,o),n(UH({activeIndex:String(i),activeDataKey:t,activeCoordinate:a.tooltipPosition,activeGraphicalItemId:r}))}};function CV(e){var{tooltipEntrySettings:t}=e,r=$t(),n=tn(),a=h.useRef(null);return h.useLayoutEffect(()=>{n||(a.current===null?r(LH(t)):a.current!==t&&r(FH({prev:a.current,next:t})),a.current=t)},[t,r,n]),h.useLayoutEffect(()=>()=>{a.current&&(r(BH(a.current)),a.current=null)},[r]),null}function _V(e){var{legendPayload:t}=e,r=$t(),n=tn(),a=h.useRef(null);return h.useLayoutEffect(()=>{n||(a.current===null?r(N7(t)):a.current!==t&&r(k7({prev:a.current,next:t})),a.current=t)},[r,n,t]),h.useLayoutEffect(()=>()=>{a.current&&(r(S7(a.current)),a.current=null)},[r]),null}var bh,PV=()=>{var[e]=h.useState(()=>$l("uid-"));return e},MV=(bh=hE.useId)!==null&&bh!==void 0?bh:PV;function OV(e,t){var r=MV();return t||(e?"".concat(e,"-").concat(r):r)}var EV=h.createContext(void 0),AV=e=>{var{id:t,type:r,children:n}=e,a=OV("recharts-".concat(r),t);return h.createElement(EV.Provider,{value:a},n(a))},DV={cartesianItems:[],polarItems:[]},qM=en({name:"graphicalItems",initialState:DV,reducers:{addCartesianGraphicalItem:{reducer(e,t){e.cartesianItems.push(t.payload)},prepare:yt()},replaceCartesianGraphicalItem:{reducer(e,t){var{prev:r,next:n}=t.payload,a=Un(e).cartesianItems.indexOf(r);a>-1&&(e.cartesianItems[a]=n)},prepare:yt()},removeCartesianGraphicalItem:{reducer(e,t){var r=Un(e).cartesianItems.indexOf(t.payload);r>-1&&e.cartesianItems.splice(r,1)},prepare:yt()},addPolarGraphicalItem:{reducer(e,t){e.polarItems.push(t.payload)},prepare:yt()},removePolarGraphicalItem:{reducer(e,t){var r=Un(e).polarItems.indexOf(t.payload);r>-1&&e.polarItems.splice(r,1)},prepare:yt()}}}),{addCartesianGraphicalItem:TV,replaceCartesianGraphicalItem:IV,removeCartesianGraphicalItem:RV,addPolarGraphicalItem:dne,removePolarGraphicalItem:une}=qM.actions,$V=qM.reducer,zV=e=>{var t=$t(),r=h.useRef(null);return h.useLayoutEffect(()=>{r.current===null?t(TV(e)):r.current!==e&&t(IV({prev:r.current,next:e})),r.current=e},[t,e]),h.useLayoutEffect(()=>()=>{r.current&&(t(RV(r.current)),r.current=null)},[t]),null},LV=h.memo(zV);function xw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function gw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?xw(Object(r),!0).forEach(function(n){FV(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function FV(e,t,r){return(t=BV(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function BV(e){var t=qV(e,"string");return typeof t=="symbol"?t:t+""}function qV(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var WM=0,WV={xAxis:{},yAxis:{},zAxis:{}},UM=en({name:"cartesianAxis",initialState:WV,reducers:{addXAxis:{reducer(e,t){e.xAxis[t.payload.id]=t.payload},prepare:yt()},replaceXAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.xAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.xAxis[r.id],e.xAxis[n.id]=n)},prepare:yt()},removeXAxis:{reducer(e,t){delete e.xAxis[t.payload.id]},prepare:yt()},addYAxis:{reducer(e,t){e.yAxis[t.payload.id]=t.payload},prepare:yt()},replaceYAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.yAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.yAxis[r.id],e.yAxis[n.id]=n)},prepare:yt()},removeYAxis:{reducer(e,t){delete e.yAxis[t.payload.id]},prepare:yt()},addZAxis:{reducer(e,t){e.zAxis[t.payload.id]=t.payload},prepare:yt()},replaceZAxis:{reducer(e,t){var{prev:r,next:n}=t.payload;e.zAxis[r.id]!==void 0&&(r.id!==n.id&&delete e.zAxis[r.id],e.zAxis[n.id]=n)},prepare:yt()},removeZAxis:{reducer(e,t){delete e.zAxis[t.payload.id]},prepare:yt()},updateYAxisWidth(e,t){var{id:r,width:n}=t.payload,a=e.yAxis[r];if(a){var i,o=a.widthHistory||[];if(o.length===3&&o[0]===o[2]&&n===o[1]&&n!==a.width&&Math.abs(n-((i=o[0])!==null&&i!==void 0?i:0))<=1)return;var l=[...o,n].slice(-3);e.yAxis[r]=gw(gw({},a),{},{width:n,widthHistory:l})}}}}),{addXAxis:UV,replaceXAxis:HV,removeXAxis:KV,addYAxis:YV,replaceYAxis:GV,removeYAxis:VV,addZAxis:fne,replaceZAxis:mne,removeZAxis:hne,updateYAxisWidth:XV}=UM.actions,QV=UM.reducer,ZV=ae([er],e=>({top:e.top,bottom:e.bottom,left:e.left,right:e.right})),JV=ae([ZV,na,sa],(e,t,r)=>{if(!(!e||t==null||r==null))return{x:e.left,y:e.top,width:Math.max(0,t-e.left-e.right),height:Math.max(0,r-e.top-e.bottom)}}),HM=()=>Ae(JV),pne=()=>Ae(DK),vw=(e,t,r)=>{var n=r??e;if(!Bt(n))return Hn(n,t,0)},eX=(e,t,r)=>{var n={},a=e.filter(om),i=e.filter(d=>d.stackId==null),o=a.reduce((d,u)=>{var f=d[u.stackId];return f==null&&(f=[]),f.push(u),d[u.stackId]=f,d},n),l=Object.entries(o).map(d=>{var u,[f,m]=d,p=m.map(g=>g.dataKey),x=vw(t,r,(u=m[0])===null||u===void 0?void 0:u.barSize);return{stackId:f,dataKeys:p,barSize:x}}),c=i.map(d=>{var u=[d.dataKey].filter(m=>m!=null),f=vw(t,r,d.barSize);return{stackId:void 0,dataKeys:u,barSize:f}});return[...l,...c]};function yw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function xd(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?yw(Object(r),!0).forEach(function(n){tX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function tX(e,t,r){return(t=rX(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rX(e){var t=nX(e,"string");return typeof t=="symbol"?t:t+""}function nX(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function sX(e,t,r,n,a){var i,o=n.length;if(!(o<1)){var l=Hn(e,r,0,!0),c,d=[];if(Ye((i=n[0])===null||i===void 0?void 0:i.barSize)){var u=!1,f=r/o,m=n.reduce((b,N)=>b+(N.barSize||0),0);m+=(o-1)*l,m>=r&&(m-=(o-1)*l,l=0),m>=r&&f>0&&(u=!0,f*=.9,m=o*f);var p=(r-m)/2>>0,x={offset:p-l,size:0};c=n.reduce((b,N)=>{var j,k={stackId:N.stackId,dataKeys:N.dataKeys,position:{offset:x.offset+x.size+l,size:u?f:(j=N.barSize)!==null&&j!==void 0?j:0}},w=[...b,k];return x=k.position,w},d)}else{var g=Hn(t,r,0,!0);r-2*g-(o-1)*l<=0&&(l=0);var v=(r-2*g-(o-1)*l)/o;v>1&&(v>>=0);var y=Ye(a)?Math.min(v,a):v;c=n.reduce((b,N,j)=>[...b,{stackId:N.stackId,dataKeys:N.dataKeys,position:{offset:g+(v+l)*j+(v-y)/2,size:y}}],d)}return c}}var aX=(e,t,r,n,a,i,o)=>{var l=Bt(o)?t:o,c=sX(r,n,a!==i?a:i,e,l);return a!==i&&c!=null&&(c=c.map(d=>xd(xd({},d),{},{position:xd(xd({},d.position),{},{offset:d.position.offset-a/2})}))),c},iX=(e,t)=>{var r=lv(t);if(!(!e||r==null||t==null)){var{stackId:n}=t;if(n!=null){var a=e[n];if(a){var{stackedData:i}=a;if(i)return i.find(o=>o.key===r)}}}},oX=(e,t)=>{if(!(e==null||t==null)){var r=e.find(n=>n.stackId===t.stackId&&t.dataKey!=null&&n.dataKeys.includes(t.dataKey));if(r!=null)return r.position}};function lX(e,t){return e&&typeof e=="object"&&"zIndex"in e&&typeof e.zIndex=="number"&&Ye(e.zIndex)?e.zIndex:t}var cX=e=>{var{chartData:t}=e,r=$t(),n=tn();return h.useEffect(()=>n?()=>{}:(r(Lj(t)),()=>{r(Lj(void 0))}),[t,r,n]),null},bw={x:0,y:0,width:0,height:0,padding:{top:0,right:0,bottom:0,left:0}},KM=en({name:"brush",initialState:bw,reducers:{setBrushSettings(e,t){return t.payload==null?bw:t.payload}}}),{setBrushSettings:xne}=KM.actions,dX=KM.reducer;function uX(e){return(e%180+180)%180}var fX=function(t){var{width:r,height:n}=t,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=uX(a),o=i*Math.PI/180,l=Math.atan(n/r),c=o>l&&o<Math.PI-l?n/Math.sin(o):r/Math.cos(o);return Math.abs(c)},mX={dots:[],areas:[],lines:[]},YM=en({name:"referenceElements",initialState:mX,reducers:{addDot:(e,t)=>{e.dots.push(t.payload)},removeDot:(e,t)=>{var r=Un(e).dots.findIndex(n=>n===t.payload);r!==-1&&e.dots.splice(r,1)},addArea:(e,t)=>{e.areas.push(t.payload)},removeArea:(e,t)=>{var r=Un(e).areas.findIndex(n=>n===t.payload);r!==-1&&e.areas.splice(r,1)},addLine:(e,t)=>{e.lines.push(t.payload)},removeLine:(e,t)=>{var r=Un(e).lines.findIndex(n=>n===t.payload);r!==-1&&e.lines.splice(r,1)}}}),{addDot:gne,removeDot:vne,addArea:yne,removeArea:bne,addLine:jne,removeLine:wne}=YM.actions,hX=YM.reducer,pX=h.createContext(void 0),xX=e=>{var{children:t}=e,[r]=h.useState("".concat($l("recharts"),"-clip")),n=HM();if(n==null)return null;var{x:a,y:i,width:o,height:l}=n;return h.createElement(pX.Provider,{value:r},h.createElement("defs",null,h.createElement("clipPath",{id:r},h.createElement("rect",{x:a,y:i,height:l,width:o}))),t)};function GM(e,t){if(t<1)return[];if(t===1)return e;for(var r=[],n=0;n<e.length;n+=t){var a=e[n];a!==void 0&&r.push(a)}return r}function gX(e,t,r){var n={width:e.width+t.width,height:e.height+t.height};return fX(n,r)}function vX(e,t,r){var n=r==="width",{x:a,y:i,width:o,height:l}=e;return t===1?{start:n?a:i,end:n?a+o:i+l}:{start:n?a+o:i+l,end:n?a:i}}function Ql(e,t,r,n,a){if(e*t<e*n||e*t>e*a)return!1;var i=r();return e*(t-e*i/2-n)>=0&&e*(t+e*i/2-a)<=0}function yX(e,t){return GM(e,t+1)}function bX(e,t,r,n,a){for(var i=(n||[]).slice(),{start:o,end:l}=t,c=0,d=1,u=o,f=function(){var x=n==null?void 0:n[c];if(x===void 0)return{v:GM(n,d)};var g=c,v,y=()=>(v===void 0&&(v=r(x,g)),v),b=x.coordinate,N=c===0||Ql(e,b,y,u,l);N||(c=0,u=o,d+=1),N&&(u=b+e*(y()/2+a),c+=d)},m;d<=i.length;)if(m=f(),m)return m.v;return[]}function jX(e,t,r,n,a){var i=(n||[]).slice(),o=i.length;if(o===0)return[];for(var{start:l,end:c}=t,d=1;d<=o;d++){for(var u=(o-1)%d,f=l,m=!0,p=function(){var j=n[g];if(j==null)return 0;var k=g,w,S=()=>(w===void 0&&(w=r(j,k)),w),_=j.coordinate,C=g===u||Ql(e,_,S,f,c);if(!C)return m=!1,1;C&&(f=_+e*(S()/2+a))},x,g=u;g<o&&(x=p(),!(x!==0&&x===1));g+=d);if(m){for(var v=[],y=u;y<o;y+=d){var b=n[y];b!=null&&v.push(b)}return v}}return[]}function jw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function gr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?jw(Object(r),!0).forEach(function(n){wX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function wX(e,t,r){return(t=NX(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function NX(e){var t=kX(e,"string");return typeof t=="symbol"?t:t+""}function kX(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function SX(e,t,r,n,a){for(var i=(n||[]).slice(),o=i.length,{start:l}=t,{end:c}=t,d=function(m){var p=i[m];if(p==null)return 1;var x=p,g,v=()=>(g===void 0&&(g=r(p,m)),g);if(m===o-1){var y=e*(x.coordinate+e*v()/2-c);i[m]=x=gr(gr({},x),{},{tickCoord:y>0?x.coordinate-y*e:x.coordinate})}else i[m]=x=gr(gr({},x),{},{tickCoord:x.coordinate});if(x.tickCoord!=null){var b=Ql(e,x.tickCoord,v,l,c);b&&(c=x.tickCoord-e*(v()/2+a),i[m]=gr(gr({},x),{},{isShow:!0}))}},u=o-1;u>=0;u--)d(u);return i}function CX(e,t,r,n,a,i){var o=(n||[]).slice(),l=o.length,{start:c,end:d}=t;if(i){var u=n[l-1];if(u!=null){var f=r(u,l-1),m=e*(u.coordinate+e*f/2-d);if(o[l-1]=u=gr(gr({},u),{},{tickCoord:m>0?u.coordinate-m*e:u.coordinate}),u.tickCoord!=null){var p=Ql(e,u.tickCoord,()=>f,c,d);p&&(d=u.tickCoord-e*(f/2+a),o[l-1]=gr(gr({},u),{},{isShow:!0}))}}}for(var x=i?l-1:l,g=function(b){var N=o[b];if(N==null)return 1;var j=N,k,w=()=>(k===void 0&&(k=r(N,b)),k);if(b===0){var S=e*(j.coordinate-e*w()/2-c);o[b]=j=gr(gr({},j),{},{tickCoord:S<0?j.coordinate-S*e:j.coordinate})}else o[b]=j=gr(gr({},j),{},{tickCoord:j.coordinate});if(j.tickCoord!=null){var _=Ql(e,j.tickCoord,w,c,d);_&&(c=j.tickCoord+e*(w()/2+a),o[b]=gr(gr({},j),{},{isShow:!0}))}},v=0;v<x;v++)g(v);return o}function Dv(e,t,r){var{tick:n,ticks:a,viewBox:i,minTickGap:o,orientation:l,interval:c,tickFormatter:d,unit:u,angle:f}=e;if(!a||!a.length||!n)return[];if(Ce(c)||Vf.isSsr){var m;return(m=yX(a,Ce(c)?c:0))!==null&&m!==void 0?m:[]}var p=[],x=l==="top"||l==="bottom"?"width":"height",g=u&&x==="width"?Ml(u,{fontSize:t,letterSpacing:r}):{width:0,height:0},v=(k,w)=>{var S=typeof d=="function"?d(k.value,w):k.value;return x==="width"?gX(Ml(S,{fontSize:t,letterSpacing:r}),g,f):Ml(S,{fontSize:t,letterSpacing:r})[x]},y=a[0],b=a[1],N=a.length>=2&&y!=null&&b!=null?Ur(b.coordinate-y.coordinate):1,j=vX(i,N,x);return c==="equidistantPreserveStart"?bX(N,j,v,a,o):c==="equidistantPreserveEnd"?jX(N,j,v,a,o):(c==="preserveStart"||c==="preserveStartEnd"?p=CX(N,j,v,a,o,c==="preserveStartEnd"):p=SX(N,j,v,a,o),p.filter(k=>k.isShow))}var _X=e=>{var{ticks:t,label:r,labelGapWithTick:n=5,tickSize:a=0,tickMargin:i=0}=e,o=0;if(t){Array.from(t).forEach(u=>{if(u){var f=u.getBoundingClientRect();f.width>o&&(o=f.width)}});var l=r?r.getBoundingClientRect().width:0,c=a+i,d=o+c+l+(r?n:0);return Math.round(d)}return 0},PX=["axisLine","width","height","className","hide","ticks","axisType"];function MX(e,t){if(e==null)return{};var r,n,a=OX(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function OX(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function ki(){return ki=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},ki.apply(null,arguments)}function ww(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function At(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ww(Object(r),!0).forEach(function(n){EX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ww(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function EX(e,t,r){return(t=AX(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function AX(e){var t=DX(e,"string");return typeof t=="symbol"?t:t+""}function DX(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}var $s={x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd",zIndex:Mr.axis};function TX(e){var{x:t,y:r,width:n,height:a,orientation:i,mirror:o,axisLine:l,otherSvgProps:c}=e;if(!l)return null;var d=At(At(At({},c),qs(l)),{},{fill:"none"});if(i==="top"||i==="bottom"){var u=+(i==="top"&&!o||i==="bottom"&&o);d=At(At({},d),{},{x1:t,y1:r+u*a,x2:t+n,y2:r+u*a})}else{var f=+(i==="left"&&!o||i==="right"&&o);d=At(At({},d),{},{x1:t+f*n,y1:r,x2:t+f*n,y2:r+a})}return h.createElement("line",ki({},d,{className:lt("recharts-cartesian-axis-line",mo(l,"className"))}))}function IX(e,t,r,n,a,i,o,l,c){var d,u,f,m,p,x,g=l?-1:1,v=e.tickSize||o,y=Ce(e.tickCoord)?e.tickCoord:e.coordinate;switch(i){case"top":d=u=e.coordinate,m=r+ +!l*a,f=m-g*v,x=f-g*c,p=y;break;case"left":f=m=e.coordinate,u=t+ +!l*n,d=u-g*v,p=d-g*c,x=y;break;case"right":f=m=e.coordinate,u=t+ +l*n,d=u+g*v,p=d+g*c,x=y;break;default:d=u=e.coordinate,m=r+ +l*a,f=m+g*v,x=f+g*c,p=y;break}return{line:{x1:d,y1:f,x2:u,y2:m},tick:{x:p,y:x}}}function RX(e,t){switch(e){case"left":return t?"start":"end";case"right":return t?"end":"start";default:return"middle"}}function $X(e,t){switch(e){case"left":case"right":return"middle";case"top":return t?"start":"end";default:return t?"end":"start"}}function zX(e){var{option:t,tickProps:r,value:n}=e,a,i=lt(r.className,"recharts-cartesian-axis-tick-value");if(h.isValidElement(t))a=h.cloneElement(t,At(At({},r),{},{className:i}));else if(typeof t=="function")a=t(At(At({},r),{},{className:i}));else{var o="recharts-cartesian-axis-tick-value";typeof t!="boolean"&&(o=lt(o,sV(t))),a=h.createElement(Mv,ki({},r,{className:o}),n)}return a}var LX=h.forwardRef((e,t)=>{var{ticks:r=[],tick:n,tickLine:a,stroke:i,tickFormatter:o,unit:l,padding:c,tickTextProps:d,orientation:u,mirror:f,x:m,y:p,width:x,height:g,tickSize:v,tickMargin:y,fontSize:b,letterSpacing:N,getTicksConfig:j,events:k,axisType:w}=e,S=Dv(At(At({},j),{},{ticks:r}),b,N),_=RX(u,f),C=$X(u,f),P=qs(j),O=tg(n),E={};typeof a=="object"&&(E=a);var D=At(At({},P),{},{fill:"none"},E),I=S.map(q=>At({entry:q},IX(q,m,p,x,g,u,v,f,y))),V=I.map(q=>{var{entry:re,line:se}=q;return h.createElement(Ws,{className:"recharts-cartesian-axis-tick",key:"tick-".concat(re.value,"-").concat(re.coordinate,"-").concat(re.tickCoord)},a&&h.createElement("line",ki({},D,se,{className:lt("recharts-cartesian-axis-tick-line",mo(a,"className"))})))}),Q=I.map((q,re)=>{var se,T,{entry:M,tick:L}=q,H=At(At(At(At({verticalAnchor:C},P),{},{textAnchor:_,stroke:"none",fill:i},L),{},{index:re,payload:M,visibleTicksCount:S.length,tickFormatter:o,padding:c},d),{},{angle:(se=(T=d==null?void 0:d.angle)!==null&&T!==void 0?T:P.angle)!==null&&se!==void 0?se:0}),R=At(At({},H),O);return h.createElement(Ws,ki({className:"recharts-cartesian-axis-tick-label",key:"tick-label-".concat(M.value,"-").concat(M.coordinate,"-").concat(M.tickCoord)},ig(k,M,re)),n&&h.createElement(zX,{option:n,tickProps:R,value:"".concat(typeof o=="function"?o(M.value,re):M.value).concat(l||"")}))});return h.createElement("g",{className:"recharts-cartesian-axis-ticks recharts-".concat(w,"-ticks")},Q.length>0&&h.createElement(da,{zIndex:Mr.label},h.createElement("g",{className:"recharts-cartesian-axis-tick-labels recharts-".concat(w,"-tick-labels"),ref:t},Q)),V.length>0&&h.createElement("g",{className:"recharts-cartesian-axis-tick-lines recharts-".concat(w,"-tick-lines")},V))}),FX=h.forwardRef((e,t)=>{var{axisLine:r,width:n,height:a,className:i,hide:o,ticks:l,axisType:c}=e,d=MX(e,PX),[u,f]=h.useState(""),[m,p]=h.useState(""),x=h.useRef(null);h.useImperativeHandle(t,()=>({getCalculatedWidth:()=>{var v;return _X({ticks:x.current,label:(v=e.labelRef)===null||v===void 0?void 0:v.current,labelGapWithTick:5,tickSize:e.tickSize,tickMargin:e.tickMargin})}}));var g=h.useCallback(v=>{if(v){var y=v.getElementsByClassName("recharts-cartesian-axis-tick-value");x.current=y;var b=y[0];if(b){var N=window.getComputedStyle(b),j=N.fontSize,k=N.letterSpacing;(j!==u||k!==m)&&(f(j),p(k))}}},[u,m]);return o||n!=null&&n<=0||a!=null&&a<=0?null:h.createElement(da,{zIndex:e.zIndex},h.createElement(Ws,{className:lt("recharts-cartesian-axis",i)},h.createElement(TX,{x:e.x,y:e.y,width:n,height:a,orientation:e.orientation,mirror:e.mirror,axisLine:r,otherSvgProps:qs(e)}),h.createElement(LX,{ref:g,axisType:c,events:d,fontSize:u,getTicksConfig:e,height:e.height,letterSpacing:m,mirror:e.mirror,orientation:e.orientation,padding:e.padding,stroke:e.stroke,tick:e.tick,tickFormatter:e.tickFormatter,tickLine:e.tickLine,tickMargin:e.tickMargin,tickSize:e.tickSize,tickTextProps:e.tickTextProps,ticks:l,unit:e.unit,width:e.width,x:e.x,y:e.y}),h.createElement(IG,{x:e.x,y:e.y,width:e.width,height:e.height,lowerWidth:e.width,upperWidth:e.width},h.createElement(HG,{label:e.label,labelRef:e.labelRef}),e.children)))}),Tv=h.forwardRef((e,t)=>{var r=xn(e,$s);return h.createElement(FX,ki({},r,{ref:t}))});Tv.displayName="CartesianAxis";var BX=["x1","y1","x2","y2","key"],qX=["offset"],WX=["xAxisId","yAxisId"],UX=["xAxisId","yAxisId"];function Nw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function yr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Nw(Object(r),!0).forEach(function(n){HX(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Nw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function HX(e,t,r){return(t=KX(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function KX(e){var t=YX(e,"string");return typeof t=="symbol"?t:t+""}function YX(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function oi(){return oi=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},oi.apply(null,arguments)}function Iu(e,t){if(e==null)return{};var r,n,a=GX(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function GX(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var VX=e=>{var{fill:t}=e;if(!t||t==="none")return null;var{fillOpacity:r,x:n,y:a,width:i,height:o,ry:l}=e;return h.createElement("rect",{x:n,y:a,ry:l,width:i,height:o,stroke:"none",fill:t,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function VM(e){var{option:t,lineItemProps:r}=e,n;if(h.isValidElement(t))n=h.cloneElement(t,r);else if(typeof t=="function")n=t(r);else{var a,{x1:i,y1:o,x2:l,y2:c,key:d}=r,u=Iu(r,BX),f=(a=qs(u))!==null&&a!==void 0?a:{},{offset:m}=f,p=Iu(f,qX);n=h.createElement("line",oi({},p,{x1:i,y1:o,x2:l,y2:c,fill:"none",key:d}))}return n}function XX(e){var{x:t,width:r,horizontal:n=!0,horizontalPoints:a}=e;if(!n||!a||!a.length)return null;var{xAxisId:i,yAxisId:o}=e,l=Iu(e,WX),c=a.map((d,u)=>{var f=yr(yr({},l),{},{x1:t,y1:d,x2:t+r,y2:d,key:"line-".concat(u),index:u});return h.createElement(VM,{key:"line-".concat(u),option:n,lineItemProps:f})});return h.createElement("g",{className:"recharts-cartesian-grid-horizontal"},c)}function QX(e){var{y:t,height:r,vertical:n=!0,verticalPoints:a}=e;if(!n||!a||!a.length)return null;var{xAxisId:i,yAxisId:o}=e,l=Iu(e,UX),c=a.map((d,u)=>{var f=yr(yr({},l),{},{x1:d,y1:t,x2:d,y2:t+r,key:"line-".concat(u),index:u});return h.createElement(VM,{option:n,lineItemProps:f,key:"line-".concat(u)})});return h.createElement("g",{className:"recharts-cartesian-grid-vertical"},c)}function ZX(e){var{horizontalFill:t,fillOpacity:r,x:n,y:a,width:i,height:o,horizontalPoints:l,horizontal:c=!0}=e;if(!c||!t||!t.length||l==null)return null;var d=l.map(f=>Math.round(f+a-a)).sort((f,m)=>f-m);a!==d[0]&&d.unshift(0);var u=d.map((f,m)=>{var p=d[m+1],x=p==null,g=x?a+o-f:p-f;if(g<=0)return null;var v=m%t.length;return h.createElement("rect",{key:"react-".concat(m),y:f,x:n,height:g,width:i,stroke:"none",fill:t[v],fillOpacity:r,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},u)}function JX(e){var{vertical:t=!0,verticalFill:r,fillOpacity:n,x:a,y:i,width:o,height:l,verticalPoints:c}=e;if(!t||!r||!r.length)return null;var d=c.map(f=>Math.round(f+a-a)).sort((f,m)=>f-m);a!==d[0]&&d.unshift(0);var u=d.map((f,m)=>{var p=d[m+1],x=p==null,g=x?a+o-f:p-f;if(g<=0)return null;var v=m%r.length;return h.createElement("rect",{key:"react-".concat(m),x:f,y:i,width:g,height:l,stroke:"none",fill:r[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return h.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},u)}var eQ=(e,t)=>{var{xAxis:r,width:n,height:a,offset:i}=e;return wC(Dv(yr(yr(yr({},$s),r),{},{ticks:NC(r),viewBox:{x:0,y:0,width:n,height:a}})),i.left,i.left+i.width,t)},tQ=(e,t)=>{var{yAxis:r,width:n,height:a,offset:i}=e;return wC(Dv(yr(yr(yr({},$s),r),{},{ticks:NC(r),viewBox:{x:0,y:0,width:n,height:a}})),i.top,i.top+i.height,t)},rQ={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[],xAxisId:0,yAxisId:0,syncWithTicks:!1,zIndex:Mr.grid};function XM(e){var t=DC(),r=TC(),n=AC(),a=yr(yr({},xn(e,rQ)),{},{x:Ce(e.x)?e.x:n.left,y:Ce(e.y)?e.y:n.top,width:Ce(e.width)?e.width:n.width,height:Ce(e.height)?e.height:n.height}),{xAxisId:i,yAxisId:o,x:l,y:c,width:d,height:u,syncWithTicks:f,horizontalValues:m,verticalValues:p}=a,x=tn(),g=Ae(C=>Pj(C,"xAxis",i,x)),v=Ae(C=>Pj(C,"yAxis",o,x));if(!ps(d)||!ps(u)||!Ce(l)||!Ce(c))return null;var y=a.verticalCoordinatesGenerator||eQ,b=a.horizontalCoordinatesGenerator||tQ,{horizontalPoints:N,verticalPoints:j}=a;if((!N||!N.length)&&typeof b=="function"){var k=m&&m.length,w=b({yAxis:v?yr(yr({},v),{},{ticks:k?m:v.ticks}):void 0,width:t??d,height:r??u,offset:n},k?!0:f);lu(Array.isArray(w),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(typeof w,"]")),Array.isArray(w)&&(N=w)}if((!j||!j.length)&&typeof y=="function"){var S=p&&p.length,_=y({xAxis:g?yr(yr({},g),{},{ticks:S?p:g.ticks}):void 0,width:t??d,height:r??u,offset:n},S?!0:f);lu(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(typeof _,"]")),Array.isArray(_)&&(j=_)}return h.createElement(da,{zIndex:a.zIndex},h.createElement("g",{className:"recharts-cartesian-grid"},h.createElement(VX,{fill:a.fill,fillOpacity:a.fillOpacity,x:a.x,y:a.y,width:a.width,height:a.height,ry:a.ry}),h.createElement(ZX,oi({},a,{horizontalPoints:N})),h.createElement(JX,oi({},a,{verticalPoints:j})),h.createElement(XX,oi({},a,{offset:n,horizontalPoints:N,xAxis:g,yAxis:v})),h.createElement(QX,oi({},a,{offset:n,verticalPoints:j,xAxis:g,yAxis:v}))))}XM.displayName="CartesianGrid";var nQ={},QM=en({name:"errorBars",initialState:nQ,reducers:{addErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]||(e[r]=[]),e[r].push(n)},replaceErrorBar:(e,t)=>{var{itemId:r,prev:n,next:a}=t.payload;e[r]&&(e[r]=e[r].map(i=>i.dataKey===n.dataKey&&i.direction===n.direction?a:i))},removeErrorBar:(e,t)=>{var{itemId:r,errorBar:n}=t.payload;e[r]&&(e[r]=e[r].filter(a=>a.dataKey!==n.dataKey||a.direction!==n.direction))}}}),{addErrorBar:Nne,replaceErrorBar:kne,removeErrorBar:Sne}=QM.actions,sQ=QM.reducer,aQ=["children"];function iQ(e,t){if(e==null)return{};var r,n,a=oQ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function oQ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var lQ={data:[],xAxisId:"xAxis-0",yAxisId:"yAxis-0",dataPointFormatter:()=>({x:0,y:0,value:0}),errorBarOffset:0},cQ=h.createContext(lQ);function dQ(e){var{children:t}=e,r=iQ(e,aQ);return h.createElement(cQ.Provider,{value:r},t)}function ZM(e,t){var r,n,a=Ae(d=>oa(d,e)),i=Ae(d=>la(d,t)),o=(r=a==null?void 0:a.allowDataOverflow)!==null&&r!==void 0?r:Xt.allowDataOverflow,l=(n=i==null?void 0:i.allowDataOverflow)!==null&&n!==void 0?n:Qt.allowDataOverflow,c=o||l;return{needClip:c,needClipX:o,needClipY:l}}function uQ(e){var{xAxisId:t,yAxisId:r,clipPathId:n}=e,a=HM(),{needClipX:i,needClipY:o,needClip:l}=ZM(t,r);if(!l||!a)return null;var{x:c,y:d,width:u,height:f}=a;return h.createElement("clipPath",{id:"clipPath-".concat(n)},h.createElement("rect",{x:i?c:c-u/2,y:o?d:d-f/2,width:i?u:u*2,height:o?f:f*2}))}var fQ={};/**
635
+ * @license React
636
+ * use-sync-external-store-with-selector.production.js
637
+ *
638
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
639
+ *
640
+ * This source code is licensed under the MIT license found in the
641
+ * LICENSE file in the root directory of this source tree.
642
+ */var zc=h;function mQ(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var hQ=typeof Object.is=="function"?Object.is:mQ,pQ=zc.useSyncExternalStore,xQ=zc.useRef,gQ=zc.useEffect,vQ=zc.useMemo,yQ=zc.useDebugValue;fQ.useSyncExternalStoreWithSelector=function(e,t,r,n,a){var i=xQ(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=vQ(function(){function c(p){if(!d){if(d=!0,u=p,p=n(p),a!==void 0&&o.hasValue){var x=o.value;if(a(x,p))return f=x}return f=p}if(x=f,hQ(u,p))return x;var g=n(p);return a!==void 0&&a(x,g)?(u=p,x):(u=p,f=g)}var d=!1,u,f,m=r===void 0?null:r;return[function(){return c(t())},m===null?void 0:function(){return c(m())}]},[t,r,n,a]);var l=pQ(e,i[0],i[1]);return gQ(function(){o.hasValue=!0,o.value=l},[l]),yQ(l),l};function bQ(e){e()}function jQ(){let e=null,t=null;return{clear(){e=null,t=null},notify(){bQ(()=>{let r=e;for(;r;)r.callback(),r=r.next})},get(){const r=[];let n=e;for(;n;)r.push(n),n=n.next;return r},subscribe(r){let n=!0;const a=t={callback:r,next:null,prev:t};return a.prev?a.prev.next=a:e=a,function(){!n||e===null||(n=!1,a.next?a.next.prev=a.prev:t=a.prev,a.prev?a.prev.next=a.next:e=a.next)}}}}var kw={notify(){},get:()=>[]};function wQ(e,t){let r,n=kw,a=0,i=!1;function o(g){u();const v=n.subscribe(g);let y=!1;return()=>{y||(y=!0,v(),f())}}function l(){n.notify()}function c(){x.onStateChange&&x.onStateChange()}function d(){return i}function u(){a++,r||(r=e.subscribe(c),n=jQ())}function f(){a--,r&&a===0&&(r(),r=void 0,n.clear(),n=kw)}function m(){i||(i=!0,u())}function p(){i&&(i=!1,f())}const x={addNestedSub:o,notifyNestedSubs:l,handleChangeWrapper:c,isSubscribed:d,trySubscribe:m,tryUnsubscribe:p,getListeners:()=>n};return x}var NQ=()=>typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",kQ=NQ(),SQ=()=>typeof navigator<"u"&&navigator.product==="ReactNative",CQ=SQ(),_Q=()=>kQ||CQ?h.useLayoutEffect:h.useEffect,PQ=_Q();function Sw(e,t){return e===t?e!==0||t!==0||1/e===1/t:e!==e&&t!==t}function MQ(e,t){if(Sw(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;const r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let a=0;a<r.length;a++)if(!Object.prototype.hasOwnProperty.call(t,r[a])||!Sw(e[r[a]],t[r[a]]))return!1;return!0}var jh=Symbol.for("react-redux-context"),wh=typeof globalThis<"u"?globalThis:{};function OQ(){if(!h.createContext)return{};const e=wh[jh]??(wh[jh]=new Map);let t=e.get(h.createContext);return t||(t=h.createContext(null),e.set(h.createContext,t)),t}var EQ=OQ();function AQ(e){const{children:t,context:r,serverState:n,store:a}=e,i=h.useMemo(()=>{const c=wQ(a);return{store:a,subscription:c,getServerState:n?()=>n:void 0}},[a,n]),o=h.useMemo(()=>a.getState(),[a]);PQ(()=>{const{subscription:c}=i;return c.onStateChange=c.notifyNestedSubs,c.trySubscribe(),o!==a.getState()&&c.notifyNestedSubs(),()=>{c.tryUnsubscribe(),c.onStateChange=void 0}},[i,o]);const l=r||EQ;return h.createElement(l.Provider,{value:i},t)}var DQ=AQ,TQ=new Set(["axisLine","tickLine","activeBar","activeDot","activeLabel","activeShape","allowEscapeViewBox","background","cursor","dot","label","line","margin","padding","position","shape","style","tick","wrapperStyle","radius"]);function IQ(e,t){return e==null&&t==null?!0:typeof e=="number"&&typeof t=="number"?e===t||e!==e&&t!==t:e===t}function Iv(e,t){var r=new Set([...Object.keys(e),...Object.keys(t)]);for(var n of r)if(TQ.has(n)){if(e[n]==null&&t[n]==null)continue;if(!MQ(e[n],t[n]))return!1}else if(!IQ(e[n],t[n]))return!1;return!0}function Ii(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(a=>a.id===t))===null||n===void 0?void 0:n.xAxisId)!==null&&r!==void 0?r:WM}function Ri(e,t){var r,n;return(r=(n=e.graphicalItems.cartesianItems.find(a=>a.id===t))===null||n===void 0?void 0:n.yAxisId)!==null&&r!==void 0?r:WM}var RQ="Invariant failed";function $Q(e,t){throw new Error(RQ)}function Fp(){return Fp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Fp.apply(null,arguments)}function Ru(e){return h.createElement(SV,Fp({shapeType:"rectangle",activeClassName:"recharts-active-bar"},e))}var zQ=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return(n,a)=>{if(Ce(t))return t;var i=Ce(n)||Bt(n);return i?t(n,a):(i||$Q(),r)}},LQ=(e,t,r)=>r,FQ=(e,t)=>t,Lc=ae([dv,FQ],(e,t)=>e.filter(r=>r.type==="bar").find(r=>r.id===t)),BQ=ae([Lc],e=>e==null?void 0:e.maxBarSize),qQ=(e,t,r,n)=>n,WQ=ae([dt,dv,Ii,Ri,LQ],(e,t,r,n,a)=>t.filter(i=>e==="horizontal"?i.xAxisId===r:i.yAxisId===n).filter(i=>i.isPanorama===a).filter(i=>i.hide===!1).filter(i=>i.type==="bar")),UQ=(e,t,r)=>{var n=dt(e),a=Ii(e,t),i=Ri(e,t);if(!(a==null||i==null))return n==="horizontal"?Tp(e,"yAxis",i,r):Tp(e,"xAxis",a,r)},HQ=(e,t)=>{var r=dt(e),n=Ii(e,t),a=Ri(e,t);if(!(n==null||a==null))return r==="horizontal"?_j(e,"xAxis",n):_j(e,"yAxis",a)},KQ=ae([WQ,PU,HQ],eX),YQ=(e,t,r)=>{var n,a,i=Lc(e,t);if(i==null)return 0;var o=Ii(e,t),l=Ri(e,t);if(o==null||l==null)return 0;var c=dt(e),d=X_(e),{maxBarSize:u}=i,f=Bt(u)?d:u,m,p;return c==="horizontal"?(m=bo(e,"xAxis",o,r),p=yo(e,"xAxis",o,r)):(m=bo(e,"yAxis",l,r),p=yo(e,"yAxis",l,r)),(n=(a=ou(m,p,!0))!==null&&a!==void 0?a:f)!==null&&n!==void 0?n:0},JM=(e,t,r)=>{var n=dt(e),a=Ii(e,t),i=Ri(e,t);if(!(a==null||i==null)){var o,l;return n==="horizontal"?(o=bo(e,"xAxis",a,r),l=yo(e,"xAxis",a,r)):(o=bo(e,"yAxis",i,r),l=yo(e,"yAxis",i,r)),ou(o,l)}},GQ=ae([KQ,X_,_U,Q_,YQ,JM,BQ],aX),VQ=(e,t,r)=>{var n=Ii(e,t);if(n!=null)return bo(e,"xAxis",n,r)},XQ=(e,t,r)=>{var n=Ri(e,t);if(n!=null)return bo(e,"yAxis",n,r)},QQ=(e,t,r)=>{var n=Ii(e,t);if(n!=null)return yo(e,"xAxis",n,r)},ZQ=(e,t,r)=>{var n=Ri(e,t);if(n!=null)return yo(e,"yAxis",n,r)},JQ=ae([GQ,Lc],oX),eZ=ae([UQ,Lc],iX),tZ=ae([er,kg,VQ,XQ,QQ,ZQ,JQ,dt,yU,JM,eZ,Lc,qQ],(e,t,r,n,a,i,o,l,c,d,u,f,m)=>{var{chartData:p,dataStartIndex:x,dataEndIndex:g}=c;if(!(f==null||o==null||t==null||l!=="horizontal"&&l!=="vertical"||r==null||n==null||a==null||i==null||d==null)){var{data:v}=f,y;if(v!=null&&v.length>0?y=v:y=p==null?void 0:p.slice(x,g+1),y!=null)return MZ({layout:l,barSettings:f,pos:o,parentViewBox:t,bandSize:d,xAxis:r,yAxis:n,xAxisTicks:a,yAxisTicks:i,stackedData:u,displayedData:y,offset:e,cells:m,dataStartIndex:x})}}),rZ=["index"];function Bp(){return Bp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Bp.apply(null,arguments)}function nZ(e,t){if(e==null)return{};var r,n,a=sZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function sZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var eO=h.createContext(void 0),aZ=e=>{var t=h.useContext(eO);if(t!=null)return t.stackId;if(e!=null)return MB(e)},iZ=(e,t)=>"recharts-bar-stack-clip-path-".concat(e,"-").concat(t),oZ=e=>{var t=h.useContext(eO);if(t!=null){var{stackId:r}=t;return"url(#".concat(iZ(r,e),")")}},tO=e=>{var{index:t}=e,r=nZ(e,rZ),n=oZ(t);return h.createElement(Ws,Bp({className:"recharts-bar-stack-layer",clipPath:n},r))},lZ=["onMouseEnter","onMouseLeave","onClick"],cZ=["value","background","tooltipPosition"],dZ=["id"],uZ=["onMouseEnter","onClick","onMouseLeave"];function Xs(){return Xs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Xs.apply(null,arguments)}function Cw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Sr(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Cw(Object(r),!0).forEach(function(n){fZ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Cw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function fZ(e,t,r){return(t=mZ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mZ(e){var t=hZ(e,"string");return typeof t=="symbol"?t:t+""}function hZ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $u(e,t){if(e==null)return{};var r,n,a=pZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function pZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var xZ=e=>{var{dataKey:t,name:r,fill:n,legendType:a,hide:i}=e;return[{inactive:i,dataKey:t,type:a,color:n,value:kC(r,t),payload:e}]},gZ=h.memo(e=>{var{dataKey:t,stroke:r,strokeWidth:n,fill:a,name:i,hide:o,unit:l,tooltipType:c,id:d}=e,u={dataDefinedOnItem:void 0,getPosition:Fo,settings:{stroke:r,strokeWidth:n,fill:a,dataKey:t,nameKey:void 0,name:kC(i,t),hide:o,type:c,color:a,unit:l,graphicalItemId:d}};return h.createElement(CV,{tooltipEntrySettings:u})});function vZ(e){var t=Ae(jo),{data:r,dataKey:n,background:a,allOtherBarProps:i}=e,{onMouseEnter:o,onMouseLeave:l,onClick:c}=i,d=$u(i,lZ),u=LM(o,n,i.id),f=FM(l),m=BM(c,n,i.id);if(!a||r==null)return null;var p=tg(a);return h.createElement(da,{zIndex:lX(a,Mr.barBackground)},r.map((x,g)=>{var{value:v,background:y,tooltipPosition:b}=x,N=$u(x,cZ);if(!y)return null;var j=u(x,g),k=f(x,g),w=m(x,g),S=Sr(Sr(Sr(Sr(Sr({option:a,isActive:String(g)===t},N),{},{fill:"#eee"},y),p),ig(d,x,g)),{},{onMouseEnter:j,onMouseLeave:k,onClick:w,dataKey:n,index:g,className:"recharts-bar-background-rectangle"});return h.createElement(Ru,Xs({key:"background-bar-".concat(g)},S))}))}function yZ(e){var{showLabels:t,children:r,rects:n}=e,a=n==null?void 0:n.map(i=>{var o={x:i.x,y:i.y,width:i.width,lowerWidth:i.width,upperWidth:i.width,height:i.height};return Sr(Sr({},o),{},{value:i.value,payload:i.payload,parentViewBox:i.parentViewBox,viewBox:o,fill:i.fill})});return h.createElement(ZG,{value:t?a:void 0},r)}function bZ(e){var{shape:t,activeBar:r,baseProps:n,entry:a,index:i,dataKey:o}=e,l=Ae(jo),c=Ae(lM),d=r&&String(i)===l&&(c==null||o===c),u=d?r:t;return d?h.createElement(da,{zIndex:Mr.activeBar},h.createElement(tO,{index:i},h.createElement(Ru,Xs({},n,{name:String(n.name)},a,{isActive:d,option:u,index:i,dataKey:o})))):h.createElement(Ru,Xs({},n,{name:String(n.name)},a,{isActive:d,option:u,index:i,dataKey:o}))}function jZ(e){var{shape:t,baseProps:r,entry:n,index:a,dataKey:i}=e;return h.createElement(Ru,Xs({},r,{name:String(r.name)},n,{isActive:!1,option:t,index:a,dataKey:i}))}function wZ(e){var t,{data:r,props:n}=e,a=(t=qs(n))!==null&&t!==void 0?t:{},{id:i}=a,o=$u(a,dZ),{shape:l,dataKey:c,activeBar:d}=n,{onMouseEnter:u,onClick:f,onMouseLeave:m}=n,p=$u(n,uZ),x=LM(u,c,i),g=FM(m),v=BM(f,c,i);return r?h.createElement(h.Fragment,null,r.map((y,b)=>h.createElement(tO,Xs({index:b,key:"rectangle-".concat(y==null?void 0:y.x,"-").concat(y==null?void 0:y.y,"-").concat(y==null?void 0:y.value,"-").concat(b),className:"recharts-bar-rectangle"},ig(p,y,b),{onMouseEnter:x(y,b),onMouseLeave:g(y,b),onClick:v(y,b)}),d?h.createElement(bZ,{shape:l,activeBar:d,baseProps:o,entry:y,index:b,dataKey:c}):h.createElement(jZ,{shape:l,baseProps:o,entry:y,index:b,dataKey:c})))):null}function NZ(e){var{props:t,previousRectanglesRef:r}=e,{data:n,layout:a,isAnimationActive:i,animationBegin:o,animationDuration:l,animationEasing:c,onAnimationEnd:d,onAnimationStart:u}=t,f=r.current,m=Og(t,"recharts-bar-"),[p,x]=h.useState(!1),g=!p,v=h.useCallback(()=>{typeof d=="function"&&d(),x(!1)},[d]),y=h.useCallback(()=>{typeof u=="function"&&u(),x(!0)},[u]);return h.createElement(yZ,{showLabels:g,rects:n},h.createElement(Mg,{animationId:m,begin:o,duration:l,isActive:i,easing:c,onAnimationEnd:v,onAnimationStart:y,key:m},b=>{var N=b===1?n:n==null?void 0:n.map((j,k)=>{var w=f&&f[k];if(w)return Sr(Sr({},j),{},{x:fr(w.x,j.x,b),y:fr(w.y,j.y,b),width:fr(w.width,j.width,b),height:fr(w.height,j.height,b)});if(a==="horizontal"){var S=fr(0,j.height,b),_=fr(j.stackedBarStart,j.y,b);return Sr(Sr({},j),{},{y:_,height:S})}var C=fr(0,j.width,b),P=fr(j.stackedBarStart,j.x,b);return Sr(Sr({},j),{},{width:C,x:P})});return b>0&&(r.current=N??null),N==null?null:h.createElement(Ws,null,h.createElement(wZ,{props:t,data:N}))}),h.createElement(tV,{label:t.label}),t.children)}function kZ(e){var t=h.useRef(null);return h.createElement(NZ,{previousRectanglesRef:t,props:e})}var rO=0,SZ=(e,t)=>{var r=Array.isArray(e.value)?e.value[1]:e.value;return{x:e.x,y:e.y,value:r,errorVal:Jt(e,t)}};class CZ extends h.PureComponent{render(){var{hide:t,data:r,dataKey:n,className:a,xAxisId:i,yAxisId:o,needClip:l,background:c,id:d}=this.props;if(t||r==null)return null;var u=lt("recharts-bar",a),f=d;return h.createElement(Ws,{className:u,id:d},l&&h.createElement("defs",null,h.createElement(uQ,{clipPathId:f,xAxisId:i,yAxisId:o})),h.createElement(Ws,{className:"recharts-bar-rectangles",clipPath:l?"url(#clipPath-".concat(f,")"):void 0},h.createElement(vZ,{data:r,dataKey:n,background:c,allOtherBarProps:this.props}),h.createElement(kZ,this.props)))}}var _Z={activeBar:!1,animationBegin:0,animationDuration:400,animationEasing:"ease",background:!1,hide:!1,isAnimationActive:"auto",label:!1,legendType:"rect",minPointSize:rO,xAxisId:0,yAxisId:0,zIndex:Mr.bar};function PZ(e){var{xAxisId:t,yAxisId:r,hide:n,legendType:a,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u}=e,{needClip:f}=ZM(t,r),m=Bo(),p=tn(),x=lV(e.children,yM),g=Ae(b=>tZ(b,e.id,p,x));if(m!=="vertical"&&m!=="horizontal")return null;var v,y=g==null?void 0:g[0];return y==null||y.height==null||y.width==null?v=0:v=m==="vertical"?y.height/2:y.width/2,h.createElement(dQ,{xAxisId:t,yAxisId:r,data:g,dataPointFormatter:SZ,errorBarOffset:v},h.createElement(CZ,Xs({},e,{layout:m,needClip:f,data:g,xAxisId:t,yAxisId:r,hide:n,legendType:a,minPointSize:i,activeBar:o,animationBegin:l,animationDuration:c,animationEasing:d,isAnimationActive:u})))}function MZ(e){var{layout:t,barSettings:{dataKey:r,minPointSize:n},pos:a,bandSize:i,xAxis:o,yAxis:l,xAxisTicks:c,yAxisTicks:d,stackedData:u,displayedData:f,offset:m,cells:p,parentViewBox:x,dataStartIndex:g}=e,v=t==="horizontal"?l:o,y=u?v.scale.domain():null,b=OB({numericAxis:v}),N=v.scale.map(b);return f.map((j,k)=>{var w,S,_,C,P,O;if(u){var E=u[k+g];if(E==null)return null;w=kB(E,y)}else w=Jt(j,r),Array.isArray(w)||(w=[b,w]);var D=zQ(n,rO)(w[1],k);if(t==="horizontal"){var I,V=l.scale.map(w[0]),Q=l.scale.map(w[1]);if(V==null||Q==null)return null;S=R0({axis:o,ticks:c,bandSize:i,offset:a.offset,entry:j,index:k}),_=(I=Q??V)!==null&&I!==void 0?I:void 0,C=a.size;var q=V-Q;if(P=ms(q)?0:q,O={x:S,y:m.top,width:C,height:m.height},Math.abs(D)>0&&Math.abs(P)<Math.abs(D)){var re=Ur(P||D)*(Math.abs(D)-Math.abs(P));_-=re,P+=re}}else{var se=o.scale.map(w[0]),T=o.scale.map(w[1]);if(se==null||T==null)return null;if(S=se,_=R0({axis:l,ticks:d,bandSize:i,offset:a.offset,entry:j,index:k}),C=T-se,P=a.size,O={x:m.left,y:_,width:m.width,height:P},Math.abs(D)>0&&Math.abs(C)<Math.abs(D)){var M=Ur(C||D)*(Math.abs(D)-Math.abs(C));C+=M}}if(S==null||_==null||C==null||P==null)return null;var L=Sr(Sr({},j),{},{stackedBarStart:N,x:S,y:_,width:C,height:P,value:u?w:w[1],payload:j,background:O,tooltipPosition:{x:S+C/2,y:_+P/2},parentViewBox:x},p&&p[k]&&p[k].props);return L}).filter(Boolean)}function OZ(e){var t=xn(e,_Z),r=aZ(t.stackId),n=tn();return h.createElement(AV,{id:t.id,type:"bar"},a=>h.createElement(h.Fragment,null,h.createElement(_V,{legendPayload:xZ(t)}),h.createElement(gZ,{dataKey:t.dataKey,stroke:t.stroke,strokeWidth:t.strokeWidth,fill:t.fill,name:t.name,hide:t.hide,unit:t.unit,tooltipType:t.tooltipType,id:a}),h.createElement(LV,{type:"bar",id:a,data:void 0,xAxisId:t.xAxisId,yAxisId:t.yAxisId,zAxisId:0,dataKey:t.dataKey,stackId:r,hide:t.hide,barSize:t.barSize,minPointSize:t.minPointSize,maxBarSize:t.maxBarSize,isPanorama:n}),h.createElement(da,{zIndex:t.zIndex},h.createElement(PZ,Xs({},t,{id:a})))))}var nO=h.memo(OZ,Iv);nO.displayName="Bar";var EZ=["domain","range"],AZ=["domain","range"];function _w(e,t){if(e==null)return{};var r,n,a=DZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function DZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function Pw(e,t){return e===t?!0:Array.isArray(e)&&e.length===2&&Array.isArray(t)&&t.length===2?e[0]===t[0]&&e[1]===t[1]:!1}function sO(e,t){if(e===t)return!0;var{domain:r,range:n}=e,a=_w(e,EZ),{domain:i,range:o}=t,l=_w(t,AZ);return!Pw(r,i)||!Pw(n,o)?!1:Iv(a,l)}var TZ=["type"],IZ=["dangerouslySetInnerHTML","ticks","scale"],RZ=["id","scale"];function qp(){return qp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},qp.apply(null,arguments)}function Mw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Ow(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Mw(Object(r),!0).forEach(function(n){$Z(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mw(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function $Z(e,t,r){return(t=zZ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zZ(e){var t=LZ(e,"string");return typeof t=="symbol"?t:t+""}function LZ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Wp(e,t){if(e==null)return{};var r,n,a=FZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function FZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function BZ(e){var t=$t(),r=h.useRef(null),n=IC(),{type:a}=e,i=Wp(e,TZ),o=sm(n,"xAxis",a),l=h.useMemo(()=>{if(o!=null)return Ow(Ow({},i),{},{type:o})},[i,o]);return h.useLayoutEffect(()=>{l!=null&&(r.current===null?t(UV(l)):r.current!==l&&t(HV({prev:r.current,next:l})),r.current=l)},[l,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(KV(r.current)),r.current=null)},[t]),null}var qZ=e=>{var{xAxisId:t,className:r}=e,n=Ae(kg),a=tn(),i="xAxis",o=Ae(y=>BP(y,i,t,a)),l=Ae(y=>$P(y,t)),c=Ae(y=>MH(y,t)),d=Ae(y=>iP(y,t));if(l==null||c==null||d==null)return null;var{dangerouslySetInnerHTML:u,ticks:f,scale:m}=e,p=Wp(e,IZ),{id:x,scale:g}=d,v=Wp(d,RZ);return h.createElement(Tv,qp({},p,v,{x:c.x,y:c.y,width:l.width,height:l.height,className:lt("recharts-".concat(i," ").concat(i),r),viewBox:n,ticks:o,axisType:i}))},WZ={allowDataOverflow:Xt.allowDataOverflow,allowDecimals:Xt.allowDecimals,allowDuplicatedCategory:Xt.allowDuplicatedCategory,angle:Xt.angle,axisLine:$s.axisLine,height:Xt.height,hide:!1,includeHidden:Xt.includeHidden,interval:Xt.interval,label:!1,minTickGap:Xt.minTickGap,mirror:Xt.mirror,orientation:Xt.orientation,padding:Xt.padding,reversed:Xt.reversed,scale:Xt.scale,tick:Xt.tick,tickCount:Xt.tickCount,tickLine:$s.tickLine,tickSize:$s.tickSize,type:Xt.type,xAxisId:0},UZ=e=>{var t=xn(e,WZ);return h.createElement(h.Fragment,null,h.createElement(BZ,{allowDataOverflow:t.allowDataOverflow,allowDecimals:t.allowDecimals,allowDuplicatedCategory:t.allowDuplicatedCategory,angle:t.angle,dataKey:t.dataKey,domain:t.domain,height:t.height,hide:t.hide,id:t.xAxisId,includeHidden:t.includeHidden,interval:t.interval,minTickGap:t.minTickGap,mirror:t.mirror,name:t.name,orientation:t.orientation,padding:t.padding,reversed:t.reversed,scale:t.scale,tick:t.tick,tickCount:t.tickCount,tickFormatter:t.tickFormatter,ticks:t.ticks,type:t.type,unit:t.unit}),h.createElement(qZ,t))},aO=h.memo(UZ,sO);aO.displayName="XAxis";var HZ=["type"],KZ=["dangerouslySetInnerHTML","ticks","scale"],YZ=["id","scale"];function Up(){return Up=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Up.apply(null,arguments)}function Ew(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function Aw(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?Ew(Object(r),!0).forEach(function(n){GZ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ew(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function GZ(e,t,r){return(t=VZ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function VZ(e){var t=XZ(e,"string");return typeof t=="symbol"?t:t+""}function XZ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Hp(e,t){if(e==null)return{};var r,n,a=QZ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function QZ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function ZZ(e){var t=$t(),r=h.useRef(null),n=IC(),{type:a}=e,i=Hp(e,HZ),o=sm(n,"yAxis",a),l=h.useMemo(()=>{if(o!=null)return Aw(Aw({},i),{},{type:o})},[o,i]);return h.useLayoutEffect(()=>{l!=null&&(r.current===null?t(YV(l)):r.current!==l&&t(GV({prev:r.current,next:l})),r.current=l)},[l,t]),h.useLayoutEffect(()=>()=>{r.current&&(t(VV(r.current)),r.current=null)},[t]),null}function JZ(e){var{yAxisId:t,className:r,width:n,label:a}=e,i=h.useRef(null),o=h.useRef(null),l=Ae(kg),c=tn(),d=$t(),u="yAxis",f=Ae(w=>zP(w,t)),m=Ae(w=>EH(w,t)),p=Ae(w=>BP(w,u,t,c)),x=Ae(w=>oP(w,t));if(h.useLayoutEffect(()=>{if(!(n!=="auto"||!f||Ov(a)||h.isValidElement(a)||x==null)){var w=i.current;if(w){var S=w.getCalculatedWidth();Math.round(f.width)!==Math.round(S)&&d(XV({id:t,width:S}))}}},[p,f,d,a,t,n,x]),f==null||m==null||x==null)return null;var{dangerouslySetInnerHTML:g,ticks:v,scale:y}=e,b=Hp(e,KZ),{id:N,scale:j}=x,k=Hp(x,YZ);return h.createElement(Tv,Up({},b,k,{ref:i,labelRef:o,x:m.x,y:m.y,tickTextProps:n==="auto"?{width:void 0}:{width:n},width:f.width,height:f.height,className:lt("recharts-".concat(u," ").concat(u),r),viewBox:l,ticks:p,axisType:u}))}var eJ={allowDataOverflow:Qt.allowDataOverflow,allowDecimals:Qt.allowDecimals,allowDuplicatedCategory:Qt.allowDuplicatedCategory,angle:Qt.angle,axisLine:$s.axisLine,hide:!1,includeHidden:Qt.includeHidden,interval:Qt.interval,label:!1,minTickGap:Qt.minTickGap,mirror:Qt.mirror,orientation:Qt.orientation,padding:Qt.padding,reversed:Qt.reversed,scale:Qt.scale,tick:Qt.tick,tickCount:Qt.tickCount,tickLine:$s.tickLine,tickSize:$s.tickSize,type:Qt.type,width:Qt.width,yAxisId:0},tJ=e=>{var t=xn(e,eJ);return h.createElement(h.Fragment,null,h.createElement(ZZ,{interval:t.interval,id:t.yAxisId,scale:t.scale,type:t.type,domain:t.domain,allowDataOverflow:t.allowDataOverflow,dataKey:t.dataKey,allowDuplicatedCategory:t.allowDuplicatedCategory,allowDecimals:t.allowDecimals,tickCount:t.tickCount,padding:t.padding,includeHidden:t.includeHidden,reversed:t.reversed,ticks:t.ticks,width:t.width,orientation:t.orientation,mirror:t.mirror,hide:t.hide,unit:t.unit,name:t.name,angle:t.angle,minTickGap:t.minTickGap,tick:t.tick,tickFormatter:t.tickFormatter}),h.createElement(JZ,t))},iO=h.memo(tJ,sO);iO.displayName="YAxis";var rJ=(e,t)=>t,Rv=ae([rJ,dt,sP,nr,sM,ca,KK,er],JK),$v=e=>{var t=e.currentTarget.getBoundingClientRect(),r=t.width/e.currentTarget.offsetWidth,n=t.height/e.currentTarget.offsetHeight;return{chartX:Math.round((e.clientX-t.left)/r),chartY:Math.round((e.clientY-t.top)/n)}},oO=On("mouseClick"),lO=kc();lO.startListening({actionCreator:oO,effect:(e,t)=>{var r=e.payload,n=Rv(t.getState(),$v(r));(n==null?void 0:n.activeIndex)!=null&&t.dispatch(HH({activeIndex:n.activeIndex,activeDataKey:void 0,activeCoordinate:n.activeCoordinate}))}});var Kp=On("mouseMove"),cO=kc(),gd=null;cO.startListening({actionCreator:Kp,effect:(e,t)=>{var r=e.payload;gd!==null&&cancelAnimationFrame(gd);var n=$v(r);gd=requestAnimationFrame(()=>{var a=t.getState(),i=yv(a,a.tooltip.settings.shared);if(i==="axis"){var o=Rv(a,n);(o==null?void 0:o.activeIndex)!=null?t.dispatch(VP({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate})):t.dispatch(GP())}gd=null})}});function nJ(e,t){return t instanceof HTMLElement?"HTMLElement <".concat(t.tagName,' class="').concat(t.className,'">'):t===window?"global.window":e==="children"&&typeof t=="object"&&t!==null?"<<CHILDREN>>":t}var Dw={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,barSize:void 0,className:void 0,maxBarSize:void 0,stackOffset:"none",syncId:void 0,syncMethod:"index",baseValue:void 0,reverseStackOrder:!1},dO=en({name:"rootProps",initialState:Dw,reducers:{updateOptions:(e,t)=>{var r;e.accessibilityLayer=t.payload.accessibilityLayer,e.barCategoryGap=t.payload.barCategoryGap,e.barGap=(r=t.payload.barGap)!==null&&r!==void 0?r:Dw.barGap,e.barSize=t.payload.barSize,e.maxBarSize=t.payload.maxBarSize,e.stackOffset=t.payload.stackOffset,e.syncId=t.payload.syncId,e.syncMethod=t.payload.syncMethod,e.className=t.payload.className,e.baseValue=t.payload.baseValue,e.reverseStackOrder=t.payload.reverseStackOrder}}}),sJ=dO.reducer,{updateOptions:aJ}=dO.actions,iJ=null,oJ={updatePolarOptions:(e,t)=>t.payload},uO=en({name:"polarOptions",initialState:iJ,reducers:oJ}),{updatePolarOptions:Cne}=uO.actions,lJ=uO.reducer,fO=On("keyDown"),mO=On("focus"),zv=kc();zv.startListening({actionCreator:fO,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:a}=r.tooltip,i=e.payload;if(!(i!=="ArrowRight"&&i!=="ArrowLeft"&&i!=="Enter")){var o=bv(a,Xo(r),Tc(r),Rc(r)),l=o==null?-1:Number(o);if(!(!Number.isFinite(l)||l<0)){var c=ca(r);if(i==="Enter"){var d=Eu(r,"axis","hover",String(a.index));t.dispatch(Rp({active:!a.active,activeIndex:a.index,activeCoordinate:d}));return}var u=IH(r),f=u==="left-to-right"?1:-1,m=i==="ArrowRight"?1:-1,p=l+m*f;if(!(c==null||p>=c.length||p<0)){var x=Eu(r,"axis","hover",String(p));t.dispatch(Rp({active:!0,activeIndex:p.toString(),activeCoordinate:x}))}}}}}});zv.startListening({actionCreator:mO,effect:(e,t)=>{var r=t.getState(),n=r.rootProps.accessibilityLayer!==!1;if(n){var{keyboardInteraction:a}=r.tooltip;if(!a.active&&a.index==null){var i="0",o=Eu(r,"axis","hover",String(i));t.dispatch(Rp({active:!0,activeIndex:i,activeCoordinate:o}))}}}});var bn=On("externalEvent"),hO=kc(),Nh=new Map;hO.startListening({actionCreator:bn,effect:(e,t)=>{var{handler:r,reactEvent:n}=e.payload;if(r!=null){n.persist();var a=n.type,i=Nh.get(a);i!==void 0&&cancelAnimationFrame(i);var o=requestAnimationFrame(()=>{try{var l=t.getState(),c={activeCoordinate:OK(l),activeDataKey:lM(l),activeIndex:jo(l),activeLabel:oM(l),activeTooltipIndex:jo(l),isTooltipActive:EK(l)};r(c,n)}finally{Nh.delete(a)}});Nh.set(a,o)}}});var cJ=ae([Go],e=>e.tooltipItemPayloads),dJ=ae([cJ,(e,t)=>t,(e,t,r)=>r],(e,t,r)=>{if(t!=null){var n=e.find(i=>i.settings.graphicalItemId===r);if(n!=null){var{getPosition:a}=n;if(a!=null)return a(t)}}}),pO=On("touchMove"),xO=kc();xO.startListening({actionCreator:pO,effect:(e,t)=>{var r=e.payload;if(!(r.touches==null||r.touches.length===0)){var n=t.getState(),a=yv(n,n.tooltip.settings.shared);if(a==="axis"){var i=r.touches[0];if(i==null)return;var o=Rv(n,$v({clientX:i.clientX,clientY:i.clientY,currentTarget:r.currentTarget}));(o==null?void 0:o.activeIndex)!=null&&t.dispatch(VP({activeIndex:o.activeIndex,activeDataKey:void 0,activeCoordinate:o.activeCoordinate}))}else if(a==="item"){var l,c=r.touches[0];if(document.elementFromPoint==null||c==null)return;var d=document.elementFromPoint(c.clientX,c.clientY);if(!d||!d.getAttribute)return;var u=d.getAttribute($B),f=(l=d.getAttribute(zB))!==null&&l!==void 0?l:void 0,m=Vo(n).find(g=>g.id===f);if(u==null||m==null||f==null)return;var{dataKey:p}=m,x=dJ(n,u,f);t.dispatch(YP({activeDataKey:p,activeIndex:u,activeCoordinate:x,activeGraphicalItemId:f}))}}}});var uJ=Y2({brush:dX,cartesianAxis:QV,chartData:OY,errorBars:sQ,graphicalItems:$V,layout:yB,legend:C7,options:SY,polarAxis:nV,polarOptions:lJ,referenceElements:hX,rootProps:sJ,tooltip:KH,zIndex:mY}),fJ=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Chart";return U8({reducer:uJ,preloadedState:t,middleware:n=>{var a;return n({serializableCheck:!1,immutableCheck:!["commonjs","es6","production"].includes((a="es6")!==null&&a!==void 0?a:"")}).concat([lO.middleware,cO.middleware,zv.middleware,hO.middleware,xO.middleware])},enhancers:n=>{var a=n;return typeof n=="function"&&(a=n()),a.concat(lC({type:"raf"}))},devTools:{serialize:{replacer:nJ},name:"recharts-".concat(r)}})};function mJ(e){var{preloadedState:t,children:r,reduxStoreName:n}=e,a=tn(),i=h.useRef(null);if(a)return r;i.current==null&&(i.current=fJ(t,n));var o=pg;return h.createElement(DQ,{context:o,store:i.current},r)}function hJ(e){var{layout:t,margin:r}=e,n=$t(),a=tn();return h.useEffect(()=>{a||(n(xB(t)),n(pB(r)))},[n,a,t,r]),null}var pJ=h.memo(hJ,Iv);function xJ(e){var t=$t();return h.useEffect(()=>{t(aJ(e))},[t,e]),null}function Tw(e){var{zIndex:t,isPanorama:r}=e,n=h.useRef(null),a=$t();return h.useLayoutEffect(()=>(n.current&&a(uY({zIndex:t,element:n.current,isPanorama:r})),()=>{a(fY({zIndex:t,isPanorama:r}))}),[a,t,r]),h.createElement("g",{tabIndex:-1,ref:n})}function Iw(e){var{children:t,isPanorama:r}=e,n=Ae(tY);if(!n||n.length===0)return t;var a=n.filter(o=>o<0),i=n.filter(o=>o>0);return h.createElement(h.Fragment,null,a.map(o=>h.createElement(Tw,{key:o,zIndex:o,isPanorama:r})),t,i.map(o=>h.createElement(Tw,{key:o,zIndex:o,isPanorama:r})))}var gJ=["children"];function vJ(e,t){if(e==null)return{};var r,n,a=yJ(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function yJ(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function zu(){return zu=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},zu.apply(null,arguments)}var bJ={width:"100%",height:"100%",display:"block"},jJ=h.forwardRef((e,t)=>{var r=DC(),n=TC(),a=UC();if(!ps(r)||!ps(n))return null;var{children:i,otherAttributes:o,title:l,desc:c}=e,d,u;return o!=null&&(typeof o.tabIndex=="number"?d=o.tabIndex:d=a?0:void 0,typeof o.role=="string"?u=o.role:u=a?"application":void 0),h.createElement(QS,zu({},o,{title:l,desc:c,role:u,tabIndex:d,width:r,height:n,style:bJ,ref:t}),i)}),wJ=e=>{var{children:t}=e,r=Ae(Uf);if(!r)return null;var{width:n,height:a,y:i,x:o}=r;return h.createElement(QS,{width:n,height:a,x:o,y:i},t)},Rw=h.forwardRef((e,t)=>{var{children:r}=e,n=vJ(e,gJ),a=tn();return a?h.createElement(wJ,null,h.createElement(Iw,{isPanorama:!0},r)):h.createElement(jJ,zu({ref:t},n),h.createElement(Iw,{isPanorama:!1},r))});function NJ(){var e=$t(),[t,r]=h.useState(null),n=Ae(RB);return h.useEffect(()=>{if(t!=null){var a=t.getBoundingClientRect(),i=a.width/t.offsetWidth;Ye(i)&&i!==n&&e(vB(i))}},[t,e,n]),r}function $w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),r.push.apply(r,n)}return r}function kJ(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?$w(Object(r),!0).forEach(function(n){SJ(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$w(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function SJ(e,t,r){return(t=CJ(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function CJ(e){var t=_J(e,"string");return typeof t=="symbol"?t:t+""}function _J(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Oa(){return Oa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Oa.apply(null,arguments)}var PJ=()=>(LY(),null);function Lu(e){if(typeof e=="number")return e;if(typeof e=="string"){var t=parseFloat(e);if(!Number.isNaN(t))return t}return 0}var MJ=h.forwardRef((e,t)=>{var r,n,a=h.useRef(null),[i,o]=h.useState({containerWidth:Lu((r=e.style)===null||r===void 0?void 0:r.width),containerHeight:Lu((n=e.style)===null||n===void 0?void 0:n.height)}),l=h.useCallback((d,u)=>{o(f=>{var m=Math.round(d),p=Math.round(u);return f.containerWidth===m&&f.containerHeight===p?f:{containerWidth:m,containerHeight:p}})},[]),c=h.useCallback(d=>{if(typeof t=="function"&&t(d),d!=null&&typeof ResizeObserver<"u"){var{width:u,height:f}=d.getBoundingClientRect();l(u,f);var m=x=>{var g=x[0];if(g!=null){var{width:v,height:y}=g.contentRect;l(v,y)}},p=new ResizeObserver(m);p.observe(d),a.current=p}},[t,l]);return h.useEffect(()=>()=>{var d=a.current;d!=null&&d.disconnect()},[l]),h.createElement(h.Fragment,null,h.createElement(Cc,{width:i.containerWidth,height:i.containerHeight}),h.createElement("div",Oa({ref:c},e)))}),OJ=h.forwardRef((e,t)=>{var{width:r,height:n}=e,[a,i]=h.useState({containerWidth:Lu(r),containerHeight:Lu(n)}),o=h.useCallback((c,d)=>{i(u=>{var f=Math.round(c),m=Math.round(d);return u.containerWidth===f&&u.containerHeight===m?u:{containerWidth:f,containerHeight:m}})},[]),l=h.useCallback(c=>{if(typeof t=="function"&&t(c),c!=null){var{width:d,height:u}=c.getBoundingClientRect();o(d,u)}},[t,o]);return h.createElement(h.Fragment,null,h.createElement(Cc,{width:a.containerWidth,height:a.containerHeight}),h.createElement("div",Oa({ref:l},e)))}),EJ=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return h.createElement(h.Fragment,null,h.createElement(Cc,{width:r,height:n}),h.createElement("div",Oa({ref:t},e)))}),AJ=h.forwardRef((e,t)=>{var{width:r,height:n}=e;return typeof r=="string"||typeof n=="string"?h.createElement(OJ,Oa({},e,{ref:t})):typeof r=="number"&&typeof n=="number"?h.createElement(EJ,Oa({},e,{width:r,height:n,ref:t})):h.createElement(h.Fragment,null,h.createElement(Cc,{width:r,height:n}),h.createElement("div",Oa({ref:t},e)))});function DJ(e){return e?MJ:AJ}var TJ=h.forwardRef((e,t)=>{var{children:r,className:n,height:a,onClick:i,onContextMenu:o,onDoubleClick:l,onMouseDown:c,onMouseEnter:d,onMouseLeave:u,onMouseMove:f,onMouseUp:m,onTouchEnd:p,onTouchMove:x,onTouchStart:g,style:v,width:y,responsive:b,dispatchTouchEvents:N=!0}=e,j=h.useRef(null),k=$t(),[w,S]=h.useState(null),[_,C]=h.useState(null),P=NJ(),O=Sg(),E=(O==null?void 0:O.width)>0?O.width:y,D=(O==null?void 0:O.height)>0?O.height:a,I=h.useCallback($=>{P($),typeof t=="function"&&t($),S($),C($),$!=null&&(j.current=$)},[P,t,S,C]),V=h.useCallback($=>{k(oO($)),k(bn({handler:i,reactEvent:$}))},[k,i]),Q=h.useCallback($=>{k(Kp($)),k(bn({handler:d,reactEvent:$}))},[k,d]),q=h.useCallback($=>{k(GP()),k(bn({handler:u,reactEvent:$}))},[k,u]),re=h.useCallback($=>{k(Kp($)),k(bn({handler:f,reactEvent:$}))},[k,f]),se=h.useCallback(()=>{k(mO())},[k]),T=h.useCallback($=>{k(fO($.key))},[k]),M=h.useCallback($=>{k(bn({handler:o,reactEvent:$}))},[k,o]),L=h.useCallback($=>{k(bn({handler:l,reactEvent:$}))},[k,l]),H=h.useCallback($=>{k(bn({handler:c,reactEvent:$}))},[k,c]),R=h.useCallback($=>{k(bn({handler:m,reactEvent:$}))},[k,m]),Y=h.useCallback($=>{k(bn({handler:g,reactEvent:$}))},[k,g]),J=h.useCallback($=>{N&&k(pO($)),k(bn({handler:x,reactEvent:$}))},[k,N,x]),A=h.useCallback($=>{k(bn({handler:p,reactEvent:$}))},[k,p]),U=DJ(b);return h.createElement(pM.Provider,{value:w},h.createElement(rF.Provider,{value:_},h.createElement(U,{width:E??(v==null?void 0:v.width),height:D??(v==null?void 0:v.height),className:lt("recharts-wrapper",n),style:kJ({position:"relative",cursor:"default",width:E,height:D},v),onClick:V,onContextMenu:M,onDoubleClick:L,onFocus:se,onKeyDown:T,onMouseDown:H,onMouseEnter:Q,onMouseLeave:q,onMouseMove:re,onMouseUp:R,onTouchEnd:A,onTouchMove:J,onTouchStart:Y,ref:I},h.createElement(PJ,null),r)))}),IJ=["width","height","responsive","children","className","style","compact","title","desc"];function RJ(e,t){if(e==null)return{};var r,n,a=$J(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}function $J(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}var zJ=h.forwardRef((e,t)=>{var{width:r,height:n,responsive:a,children:i,className:o,style:l,compact:c,title:d,desc:u}=e,f=RJ(e,IJ),m=qs(f);return c?h.createElement(h.Fragment,null,h.createElement(Cc,{width:r,height:n}),h.createElement(Rw,{otherAttributes:m,title:d,desc:u},i)):h.createElement(TJ,{className:o,style:l,width:r,height:n,responsive:a??!1,onClick:e.onClick,onMouseLeave:e.onMouseLeave,onMouseEnter:e.onMouseEnter,onMouseMove:e.onMouseMove,onMouseDown:e.onMouseDown,onMouseUp:e.onMouseUp,onContextMenu:e.onContextMenu,onDoubleClick:e.onDoubleClick,onTouchStart:e.onTouchStart,onTouchMove:e.onTouchMove,onTouchEnd:e.onTouchEnd},h.createElement(Rw,{otherAttributes:m,title:d,desc:u,ref:t},h.createElement(xX,null,i)))});function Yp(){return Yp=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},Yp.apply(null,arguments)}var LJ={top:5,right:5,bottom:5,left:5},FJ={accessibilityLayer:!0,barCategoryGap:"10%",barGap:4,layout:"horizontal",margin:LJ,responsive:!1,reverseStackOrder:!1,stackOffset:"none",syncMethod:"index"},BJ=h.forwardRef(function(t,r){var n,a=xn(t.categoricalChartProps,FJ),{chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,categoricalChartProps:d}=t,u={chartName:i,defaultTooltipEventType:o,validateTooltipEventTypes:l,tooltipPayloadSearcher:c,eventEmitter:void 0};return h.createElement(mJ,{preloadedState:{options:u},reduxStoreName:(n=d.id)!==null&&n!==void 0?n:i},h.createElement(cX,{chartData:d.data}),h.createElement(pJ,{layout:a.layout,margin:a.margin}),h.createElement(xJ,{baseValue:a.baseValue,accessibilityLayer:a.accessibilityLayer,barCategoryGap:a.barCategoryGap,maxBarSize:a.maxBarSize,stackOffset:a.stackOffset,barGap:a.barGap,barSize:a.barSize,syncId:a.syncId,syncMethod:a.syncMethod,className:a.className,reverseStackOrder:a.reverseStackOrder}),h.createElement(zJ,Yp({},a,{ref:r})))}),qJ=["axis","item"],WJ=h.forwardRef((e,t)=>h.createElement(BJ,{chartName:"BarChart",defaultTooltipEventType:"axis",validateTooltipEventTypes:qJ,tooltipPayloadSearcher:NY,categoricalChartProps:e,ref:t}));function fi(e){const t=Math.floor(e/60),r=e%60;return t===0?`${r}m`:r===0?`${t}h`:`${t}h ${r}m`}function UJ({active:e,payload:t,label:r}){var n;return!e||!(t!=null&&t.length)?null:s.jsxs("div",{className:"bg-popover border border-border rounded-lg px-3 py-2 text-xs shadow-lg",children:[s.jsx("p",{className:"font-medium mb-0.5",children:r}),s.jsx("p",{className:"text-muted-foreground",children:fi(((n=t[0])==null?void 0:n.value)??0)})]})}function Fu({data:e,icon:t,title:r,barColor:n="#6366f1",yAxisWidth:a=100,rightMargin:i=40,minRowHeight:o=80}){return e.length===0?null:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl p-4",children:[s.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[t,s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:r})]}),s.jsx(l7,{width:"100%",height:Math.max(o,e.length*36),children:s.jsxs(WJ,{data:e,layout:"vertical",margin:{left:0,right:i,top:0,bottom:0},children:[s.jsx(XM,{strokeDasharray:"3 3",horizontal:!1,stroke:"hsl(var(--border))"}),s.jsx(aO,{type:"number",tickFormatter:l=>fi(l),tick:{fontSize:9,fill:"hsl(var(--muted-foreground))"},axisLine:!1,tickLine:!1}),s.jsx(iO,{type:"category",dataKey:"name",width:a,tick:{fontSize:11,fill:"hsl(var(--foreground))"},axisLine:!1,tickLine:!1}),s.jsx(YY,{content:s.jsx(UJ,{}),cursor:{fill:"hsl(var(--muted))"}}),s.jsx(nO,{dataKey:"minutes",fill:n,radius:[0,4,4,0]})]})})]})}const Hi=20;function gO({workspaceId:e,orgScope:t=!1}){const[r,n]=h.useState(void 0),[a,i]=h.useState(void 0),[o,l]=h.useState([]),[c,d]=h.useState([]),[u,f]=h.useState([]),[m,p]=h.useState(0),{workspace:x}=De(),g=(x==null?void 0:x.slug)??"",{data:v=[],isLoading:y}=oc(e?void 0:t?{allWorkspaces:!0,orgScope:!0}:u.length>0?{workspaceIds:u}:{allWorkspaces:!0}),{data:b=[],isLoading:N}=KL(e?[e]:u,c,{orgScope:t}),{data:j=[],isLoading:k}=Cn(t?{orgScope:!0}:!0),{data:w}=La();h.useEffect(()=>{const U=new Set(v.map($=>$.id));d($=>{const ne=$.filter(B=>U.has(B));return ne.length===$.length?$:ne})},[v]),h.useEffect(()=>{const U=new Set(b.map($=>$.id));l($=>{const ne=$.filter(B=>U.has(B));return ne.length===$.length?$:ne})},[b]),h.useEffect(()=>{p(0)},[r,a,o,c,u]);const S=r?fe(r,"yyyy-MM-dd"):void 0,_=a?fe(a,"yyyy-MM-dd"):void 0,C=h.useMemo(()=>new Map(v.map(U=>[U.id,U])),[v]),P=h.useMemo(()=>new Map(j.map(U=>[U.id,U])),[j]),O=e?[e]:u.length>0?u:void 0,{data:E,isLoading:D}=GS({from:S,to:_,workspace_id:e,workspace_ids:O,org_scope:t||void 0,user_ids:o.length>0?o:void 0,project_ids:c.length>0?c:void 0,limit:Hi,offset:m},{enabled:!0}),I=(E==null?void 0:E.time_logs)??[],V=(E==null?void 0:E.total_minutes)??0,Q=(E==null?void 0:E.total_employees)??0,q=(E==null?void 0:E.total_projects)??0,re=(E==null?void 0:E.count)??0,se=h.useMemo(()=>{const U=new Map;for(const $ of I)U.set($.user_id,(U.get($.user_id)??0)+($.duration_minutes??0));return Array.from(U.entries()).map(([$,ne])=>{var B;return{name:((B=w==null?void 0:w.get($))==null?void 0:B.name)??"Unknown",minutes:ne}}).sort(($,ne)=>ne.minutes-$.minutes).slice(0,8)},[I,w]),T=h.useMemo(()=>{const U=new Map;for(const $ of I){const ne=$.project_id??"__none__";U.set(ne,(U.get(ne)??0)+($.duration_minutes??0))}return Array.from(U.entries()).map(([$,ne])=>{var B;return{name:$==="__none__"?"No project":((B=C.get($))==null?void 0:B.name)??"Unknown",minutes:ne}}).sort(($,ne)=>ne.minutes-$.minutes).slice(0,8)},[I,C]),M=h.useMemo(()=>b.map(U=>({value:U.id,label:[U.first_name,U.last_name].filter(Boolean).join(" ")||U.email})),[b]),L=h.useMemo(()=>j.map(U=>({value:U.id,label:U.name})),[j]),H=h.useMemo(()=>v.map(U=>({value:U.id,label:U.name})),[v]),R=m+Hi<re,Y=m>0,J=Math.floor(m/Hi)+1,A=Math.max(1,Math.ceil(re/Hi));return s.jsxs("div",{className:"p-2 space-y-2",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-6 py-4 flex items-center gap-3",children:[s.jsx("div",{className:"h-9 w-9 rounded-lg bg-muted flex items-center justify-center shrink-0",children:s.jsx(zs,{className:"h-4 w-4 text-muted-foreground"})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-semibold",children:"Time Logs"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Filter by date range, employees, and projects to analyze time across the organization."})]})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-4 py-3 flex flex-col gap-3 md:flex-row md:items-center md:flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[s.jsx(hi,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"font-medium",children:"Date range"})]}),s.jsx(Hd,{value:r,onChange:n,placeholder:"From"}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"→"}),s.jsx(Hd,{value:a,onChange:i,placeholder:"To"})]}),!e&&s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[s.jsx(El,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"font-medium",children:"Workspaces"})]}),k?s.jsx(le,{className:"h-8 w-40"}):s.jsx(Is,{options:L,selected:u,onSelectionChange:f,placeholder:"All workspaces",className:"w-44"})]})]}),s.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[s.jsx(Ps,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"font-medium",children:"Employees"})]}),N?s.jsx(le,{className:"h-8 w-40"}):s.jsx(Is,{options:M,selected:o,onSelectionChange:l,placeholder:"All employees",className:"w-44"})]}),s.jsx("div",{className:"hidden md:block w-px h-5 bg-border mx-1 shrink-0"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[s.jsx(Gr,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"font-medium",children:"Projects"})]}),y?s.jsx(le,{className:"h-8 w-40"}):s.jsx(Is,{options:H,selected:c,onSelectionChange:d,placeholder:"All projects",className:"w-44"})]})]}),D?s.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden divide-y divide-border",children:[1,2,3,4].map(U=>s.jsxs("div",{className:"px-6 py-4 flex items-center gap-4",children:[s.jsx(le,{className:"h-4 w-24"}),s.jsx(le,{className:"h-4 w-32"}),s.jsx(le,{className:"h-4 w-48"})]},U))}):I.length===0&&m===0?s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(Ar,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No time logs found"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:S||_||o.length>0||c.length>0||u.length>0?"Try adjusting your filters.":"No time has been logged yet."})]}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Total time"}),s.jsx("p",{className:"text-2xl font-bold tabular-nums",children:fi(V)})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Employees"}),s.jsx("p",{className:"text-2xl font-bold tabular-nums",children:Q})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-5 py-4",children:[s.jsx("p",{className:"text-[11px] font-medium text-muted-foreground uppercase tracking-wide mb-1",children:"Projects"}),s.jsx("p",{className:"text-2xl font-bold tabular-nums",children:q})]})]}),s.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[s.jsx(Fu,{data:se,icon:s.jsx(Ps,{className:"h-3.5 w-3.5 text-muted-foreground"}),title:"Time by employee"}),s.jsx(Fu,{data:T,icon:s.jsx(Gr,{className:"h-3.5 w-3.5 text-muted-foreground"}),title:"Time by project"})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[s.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Workspace"}),s.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Employee"}),s.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Project"}),s.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issue"}),s.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Date"}),s.jsx("th",{className:"text-left px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Description"}),s.jsx("th",{className:"text-right px-6 py-2.5 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Duration"})]})}),s.jsx("tbody",{className:"divide-y divide-border",children:I.map(U=>{var X,oe,G;const $=U.project_id?C.get(U.project_id):void 0,ne=((X=P.get(U.workspace_id))==null?void 0:X.slug)??g,B=((oe=w==null?void 0:w.get(U.user_id))==null?void 0:oe.name)??U.user_id.slice(0,8)+"…";return s.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[s.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:((G=P.get(U.workspace_id))==null?void 0:G.name)??"—"}),s.jsx("td",{className:"px-6 py-3 text-xs font-medium",children:B}),s.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:($==null?void 0:$.name)??(U.project_id?"Unknown":"—")}),s.jsx("td",{className:"px-6 py-3",children:U.issue_identifier?s.jsx(Rt,{to:`/${ne}/projects/${$==null?void 0:$.identifier}/issues/${U.issue_id}`,className:"font-mono text-xs text-indigo-600 dark:text-indigo-400 hover:underline",children:U.issue_identifier}):s.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[U.issue_id.slice(0,8),"…"]})}),s.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground tabular-nums whitespace-nowrap",children:U.logged_date?fe(new Date(U.logged_date),"MMM d, yyyy"):"—"}),s.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground truncate max-w-xs",children:U.description??s.jsx("span",{className:"italic",children:"—"})}),s.jsx("td",{className:"px-6 py-3 text-xs text-right tabular-nums font-semibold",children:U.duration_minutes!=null?fi(U.duration_minutes):"Running…"})]},U.id)})})]}),A>1&&s.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-t border-border bg-muted/10",children:[s.jsxs("p",{className:"text-xs text-muted-foreground",children:[re," total log",re!==1?"s":""]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("button",{type:"button",disabled:!Y,onClick:()=>p(Math.max(0,m-Hi)),className:"inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-md border border-border hover:bg-accent disabled:opacity-40 disabled:pointer-events-none transition-colors",children:[s.jsx(fs,{className:"h-3.5 w-3.5"}),"Prev"]}),s.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums",children:["Page ",J," of ",A]}),s.jsxs("button",{type:"button",disabled:!R,onClick:()=>p(m+Hi),className:"inline-flex items-center gap-1 text-xs font-medium px-2.5 py-1.5 rounded-md border border-border hover:bg-accent disabled:opacity-40 disabled:pointer-events-none transition-colors",children:["Next",s.jsx(pr,{className:"h-3.5 w-3.5"})]})]})]})]})]})]})}function HJ(){const{projectKey:e,workspace:t}=Et(),[r,n]=h.useState(void 0),[a,i]=h.useState(void 0),[o,l]=h.useState([]),{data:c}=ea(e??""),{data:d}=La(),{data:u=[]}=Dk(),f=r?fe(r,"yyyy-MM-dd"):void 0,m=a?fe(a,"yyyy-MM-dd"):void 0,{data:p,isLoading:x}=GS({project_id:c==null?void 0:c.id,from:f,to:m}),g=(p==null?void 0:p.time_logs)??[],v=h.useMemo(()=>o.length>0?g.filter(_=>o.includes(_.user_id)):g,[g,o]),y=h.useMemo(()=>v.reduce((_,C)=>_+(C.duration_minutes??0),0),[v]),b=h.useMemo(()=>{const _=new Map;for(const C of v){_.has(C.user_id)||_.set(C.user_id,{logs:[],totalMinutes:0});const P=_.get(C.user_id);P.logs.push(C),P.totalMinutes+=C.duration_minutes??0}return _},[v]),N=h.useMemo(()=>{const _=new Map;for(const C of v){_.has(C.issue_id)||_.set(C.issue_id,{logs:[],totalMinutes:0});const P=_.get(C.issue_id);P.logs.push(C),P.totalMinutes+=C.duration_minutes??0}return _},[v]),j=Array.from(b.entries()).sort((_,C)=>C[1].totalMinutes-_[1].totalMinutes).slice(0,8).map(([_,{totalMinutes:C}])=>{var P;return{name:((P=d==null?void 0:d.get(_))==null?void 0:P.name)??"Unknown",minutes:C}}),k=Array.from(N.entries()).sort((_,C)=>C[1].totalMinutes-_[1].totalMinutes).slice(0,8).map(([_,{totalMinutes:C,logs:P}])=>{var O;return{name:((O=P[0])==null?void 0:O.issue_identifier)??_.slice(0,8),minutes:C}}),w=h.useMemo(()=>u.map(_=>({value:_.id,label:[_.first_name,_.last_name].filter(Boolean).join(" ")||_.email})),[u]),S=v.length>0;return s.jsxs("div",{className:"p-2 pb-24 md:pb-2 space-y-2",children:[s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-4 py-3 flex flex-col gap-3 md:flex-row md:items-center md:flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[s.jsx(hi,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"font-medium",children:"Date range"})]}),s.jsx(Hd,{value:r,onChange:n,placeholder:"From"}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"→"}),s.jsx(Hd,{value:a,onChange:i,placeholder:"To"})]}),s.jsx("div",{className:"hidden md:block w-px h-4 bg-border"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground shrink-0",children:[s.jsx(Ps,{className:"h-3.5 w-3.5"}),s.jsx("span",{className:"font-medium",children:"Employee"})]}),s.jsx(Is,{options:w,selected:o,onSelectionChange:l,placeholder:"All employees",className:"w-44"})]})]}),s.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{label:"Total logged",value:y>0?fi(y):"—",icon:Ar},{label:"Contributors",value:b.size>0?String(b.size):"—",icon:Ps},{label:"Issues tracked",value:N.size>0?String(N.size):"—",icon:ds}].map(({label:_,value:C,icon:P})=>s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl px-3 md:px-5 py-3 md:py-4 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[s.jsx(P,{className:"h-3.5 w-3.5 text-muted-foreground hidden md:block shrink-0"}),s.jsx("p",{className:"text-[11px] text-muted-foreground uppercase tracking-wider font-medium break-all",children:_})]}),s.jsx("p",{className:"text-xl md:text-2xl font-bold tabular-nums",children:C})]},_))}),x?s.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:s.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(_=>s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[s.jsx(le,{className:"h-7 w-7 rounded-full"}),s.jsx(le,{className:"h-4 w-40"}),s.jsx("div",{className:"flex-1"}),s.jsx(le,{className:"h-4 w-20"})]},_))})}):c!=null&&c.id?S?s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:[s.jsx(Fu,{data:j,icon:s.jsx(Ps,{className:"h-3.5 w-3.5 text-muted-foreground"}),title:"Time by user",yAxisWidth:88,rightMargin:32,minRowHeight:100}),s.jsx(Fu,{data:k,icon:s.jsx(ds,{className:"h-3.5 w-3.5 text-muted-foreground"}),title:"Time by issue",barColor:"#818cf8",yAxisWidth:64,rightMargin:32,minRowHeight:100})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border",children:[s.jsx(Ps,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by user"})]}),s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[s.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"User"}),s.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issues"}),s.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total"})]})}),s.jsx("tbody",{className:"divide-y divide-border",children:Array.from(b.entries()).sort((_,C)=>C[1].totalMinutes-_[1].totalMinutes).map(([_,{logs:C,totalMinutes:P}])=>{const O=d==null?void 0:d.get(_),E=new Set(C.map(D=>D.issue_id)).size;return s.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[s.jsx("td",{className:"px-6 py-3 text-sm font-medium",children:(O==null?void 0:O.name)??_.slice(0,8)+"…"}),s.jsx("td",{className:"px-6 py-3 text-xs text-right text-muted-foreground tabular-nums",children:E}),s.jsx("td",{className:"px-6 py-3 text-sm text-right tabular-nums font-semibold",children:fi(P)})]},_)})})]})]}),s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-6 py-3 border-b border-border",children:[s.jsx(ds,{className:"h-3.5 w-3.5 text-muted-foreground"}),s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Time by issue"})]}),s.jsxs("table",{className:"w-full text-sm",children:[s.jsx("thead",{children:s.jsxs("tr",{className:"border-b border-border bg-muted/20",children:[s.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Issue"}),s.jsx("th",{className:"text-left px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Last logged"}),s.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Contributors"}),s.jsx("th",{className:"text-right px-6 py-2 text-[11px] font-medium text-muted-foreground uppercase tracking-wide",children:"Total"})]})}),s.jsx("tbody",{className:"divide-y divide-border",children:Array.from(N.entries()).sort((_,C)=>C[1].totalMinutes-_[1].totalMinutes).map(([_,{logs:C,totalMinutes:P}])=>{var V,Q;const O=new Set(C.map(q=>q.user_id)).size,E=C.reduce((q,re)=>re.logged_date&&(!q||new Date(re.logged_date)>new Date(q))?re.logged_date:q,null),D=(V=C[0])==null?void 0:V.issue_identifier,I=(Q=C[0])==null?void 0:Q.issue_title;return s.jsxs("tr",{className:"hover:bg-muted/30 transition-colors",children:[s.jsx("td",{className:"px-6 py-3",children:s.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[D?s.jsx(Rt,{to:`/${t}/projects/${e}/issues/${_}`,className:"font-mono text-xs text-indigo-600 dark:text-indigo-400 hover:underline shrink-0",children:D}):s.jsxs("span",{className:"font-mono text-xs text-muted-foreground",children:[_.slice(0,8),"…"]}),I&&s.jsx("span",{className:"text-xs text-muted-foreground truncate",children:I})]})}),s.jsx("td",{className:"px-6 py-3 text-xs text-muted-foreground",children:E?fe(new Date(E),"MMM d, yyyy"):"—"}),s.jsx("td",{className:"px-6 py-3 text-xs text-right text-muted-foreground tabular-nums",children:O}),s.jsx("td",{className:"px-6 py-3 text-sm text-right tabular-nums font-semibold",children:fi(P)})]},_)})})]})]})]}):s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex flex-col items-center justify-center py-16 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mb-3",children:s.jsx(zs,{className:"h-5 w-5 text-muted-foreground"})}),s.jsx("p",{className:"text-sm font-medium mb-1",children:"No time logged"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:f||m||o.length>0?"No entries match the current filters.":"Start logging time on issues to see reports here."})]}):s.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-xl flex items-center justify-center py-12",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading project…"})})]})}const KJ={share_enabled:{icon:Th,color:"text-green-600",bg:"bg-green-50 dark:bg-green-950/40",label:()=>"Enabled public link"},share_revoked:{icon:lD,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:()=>"Revoked public link"},member_added:{icon:Nn,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40",label:(e,t)=>{var i,o,l;const r=(i=e==null?void 0:e.user_id)==null?void 0:i.to,n=(o=e==null?void 0:e.role)==null?void 0:o.to,a=r?((l=t.get(r))==null?void 0:l.name)??r:"a user";return n?`Added ${a} as ${n}`:`Added ${a}`}},member_removed:{icon:pN,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:(e,t)=>{var a,i;const r=(a=e==null?void 0:e.user_id)==null?void 0:a.from;return`Removed ${r?((i=t.get(r))==null?void 0:i.name)??r:"a user"}`}},team_added:{icon:Ps,color:"text-indigo-500",bg:"bg-indigo-50 dark:bg-indigo-950/40",label:(e,t,r)=>{var i;const n=(i=e==null?void 0:e.team_id)==null?void 0:i.to;return`Added team ${n?r.get(n)??n:"a team"}`}},team_removed:{icon:Rh,color:"text-orange-500",bg:"bg-orange-50 dark:bg-orange-950/40",label:(e,t,r)=>{var i;const n=(i=e==null?void 0:e.team_id)==null?void 0:i.from;return`Removed team ${n?r.get(n)??n:"a team"}`}},status_updated:{icon:yD,color:"text-violet-500",bg:"bg-violet-50 dark:bg-violet-950/40",label:e=>{var n,a;const t=(n=e==null?void 0:e.name)==null?void 0:n.from,r=(a=e==null?void 0:e.name)==null?void 0:a.to;return t&&r?`Renamed status "${t}" to "${r}"`:"Updated status"}},status_deleted:{icon:jr,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:e=>{var r;const t=(r=e==null?void 0:e.name)==null?void 0:r.from;return t?`Deleted status "${t}"`:"Deleted status"}},health_update_updated:{icon:Fs,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40",label:e=>{var r;const t=(r=e==null?void 0:e.title)==null?void 0:r.to;return t?`Edited status update "${t}"`:"Edited a status update"}},health_update_deleted:{icon:jr,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:e=>{var r;const t=(r=e==null?void 0:e.title)==null?void 0:r.from;return t?`Deleted status update "${t}"`:"Deleted a status update"}},updated:{icon:Fs,color:"text-amber-500",bg:"bg-amber-50 dark:bg-amber-950/40",label:()=>"Updated project"},created:{icon:ot,color:"text-emerald-600",bg:"bg-emerald-50 dark:bg-emerald-950/40",label:()=>"Created project"},transferred:{icon:Ad,color:"text-sky-500",bg:"bg-sky-50 dark:bg-sky-950/40",label:e=>{var n,a;const t=(n=e==null?void 0:e.from_workspace_name)==null?void 0:n.from,r=(a=e==null?void 0:e.to_workspace_name)==null?void 0:a.to;return t&&r?`Transferred project from "${t}" to "${r}"`:r?`Transferred project to "${r}"`:"Transferred project"}},access_requested:{icon:Nn,color:"text-blue-500",bg:"bg-blue-50 dark:bg-blue-950/40",label:(e,t)=>{var a;const r=e==null?void 0:e.user_id;return`${r?((a=t.get(r))==null?void 0:a.name)??r:"a user"} requested access`}},access_request_approved:{icon:Nn,color:"text-green-600",bg:"bg-green-50 dark:bg-green-950/40",label:(e,t)=>{var a;const r=e==null?void 0:e.user_id;return`Approved access request from ${r?((a=t.get(r))==null?void 0:a.name)??r:"a user"}`}},access_request_denied:{icon:Rh,color:"text-red-500",bg:"bg-red-50 dark:bg-red-950/40",label:(e,t)=>{var a;const r=e==null?void 0:e.user_id;return`Denied access request from ${r?((a=t.get(r))==null?void 0:a.name)??r:"a user"}`}}},YJ={icon:Ol,color:"text-zinc-500",bg:"bg-zinc-100 dark:bg-zinc-800",label:()=>"Activity"};function GJ({activity:e,userMap:t,teamMap:r}){const n=KJ[e.action]??YJ,a=n.icon,i=t.get(e.actor_id),o=(i==null?void 0:i.name)??"System",l=(i==null?void 0:i.initials)??"S",c=n.label(e.changes,t,r),d=(()=>{var u,f;if(e.action==="share_enabled"){const m=(f=(u=e.changes)==null?void 0:u.share_url)==null?void 0:f.to;return m?s.jsx("span",{className:"text-xs text-muted-foreground/60 font-mono break-all",children:m}):null}return null})();return s.jsxs("div",{className:"flex items-start md:items-center gap-3 md:gap-4 px-4 md:px-6 py-4 hover:bg-muted/30 transition-colors",children:[s.jsx("div",{className:z("h-8 w-8 rounded-full flex items-center justify-center shrink-0",n.bg),children:s.jsx(a,{className:z("h-4 w-4",n.color)})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex flex-wrap md:flex-nowrap items-center gap-x-2 gap-y-0.5",children:[s.jsx(Pt,{className:"h-5 w-5 shrink-0",children:s.jsx(Mt,{className:"text-[10px] font-medium",children:l})}),s.jsx("span",{className:"text-sm font-medium truncate",children:o}),s.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:c})]}),s.jsx("time",{className:"md:hidden text-[11px] text-muted-foreground/70 mt-1 block",children:fe(new Date(e.created_at),"MMM d, yyyy · h:mm a")}),d&&s.jsx("div",{className:"mt-0.5 pl-7",children:d})]}),s.jsx("time",{className:"hidden md:block text-xs text-muted-foreground shrink-0",children:fe(new Date(e.created_at),"MMM d, yyyy · h:mm a")})]})}function VJ(){const{projectKey:e}=Et(),{workspace:t}=De(),{data:r}=ea(e??""),{data:n,isLoading:a}=yT((r==null?void 0:r.id)??""),{data:i=new Map}=La(),{data:o=[]}=Qu((t==null?void 0:t.id)??""),l=new Map(o.map(d=>[d.id,d.name])),c=(n==null?void 0:n.length)??0;return s.jsx("div",{className:"p-2 pb-24 md:pb-2",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border",children:[s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-semibold",children:"Activity"}),s.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"A log of share access changes, member updates, and project edits."})]}),!a&&c>0&&s.jsxs("p",{className:"text-xs text-muted-foreground shrink-0",children:[c," event",c!==1?"s":""]})]}),s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20",children:s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Log"})}),a?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3].map(d=>s.jsxs("div",{className:"flex items-center gap-4 px-6 py-4",children:[s.jsx(le,{className:"h-8 w-8 rounded-full shrink-0"}),s.jsxs("div",{className:"flex-1 space-y-1.5",children:[s.jsx(le,{className:"h-4 w-48"}),s.jsx(le,{className:"h-3 w-64"})]}),s.jsx(le,{className:"h-3 w-32 shrink-0"})]},d))}):!n||n.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[s.jsx(Ol,{className:"h-8 w-8 text-muted-foreground/20 mb-3"}),s.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"No activity yet"}),s.jsx("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Actions like sharing the project or adding members will appear here."})]}):s.jsx("div",{className:"divide-y divide-border",children:n.map(d=>s.jsx(GJ,{activity:d,userMap:i,teamMap:l},d.id))})]})})}function vO(){return Te({queryKey:["me"],queryFn:()=>ie.get("/admin/users/me")})}function XJ(){const e=ye(),{updateLocalUser:t}=De();return ge({mutationFn:r=>ie.patch("/admin/users/me",r),onSuccess:({user:r})=>{t({first_name:r.first_name??"",last_name:r.last_name??"",designation:r.designation,phone_number:r.phone_number}),e.invalidateQueries({queryKey:["me"]})}})}function QJ(){const e=ye(),{updateLocalUser:t}=De();return ge({mutationFn:r=>{const n=new FormData;return n.append("avatar",r),ie.upload("/admin/users/me/avatar",n)},onSuccess:({user:r})=>{t({avatar_url:r.avatar_url}),e.invalidateQueries({queryKey:["me"]})}})}function ZJ(){const e=ye(),{updateLocalUser:t}=De();return ge({mutationFn:()=>ie.delete("/admin/users/me/avatar"),onSuccess:()=>{t({avatar_url:null}),e.invalidateQueries({queryKey:["me"]})}})}function JJ(){return ge({mutationFn:()=>ie.post("/admin/users/me/password/send-otp",{})})}function eee(){const e=ye();return ge({mutationFn:t=>ie.post("/admin/users/me/password",t),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]})}})}function tee(){const e=ye();return ge({mutationFn:()=>ie.delete("/admin/users/me/google"),onSuccess:()=>{e.invalidateQueries({queryKey:["me"]})}})}const ree=[{key:"mon",label:"Monday",short:"Mon"},{key:"tue",label:"Tuesday",short:"Tue"},{key:"wed",label:"Wednesday",short:"Wed"},{key:"thu",label:"Thursday",short:"Thu"},{key:"fri",label:"Friday",short:"Fri"},{key:"sat",label:"Saturday",short:"Sat"},{key:"sun",label:"Sunday",short:"Sun"}],nee={mon:!0,tue:!0,wed:!0,thu:!0,fri:!0,sat:!1,sun:!1};function see({open:e,onClose:t,holiday:r}){const[n,a]=h.useState((r==null?void 0:r.name)??""),[i,o]=h.useState(r!=null&&r.date?r.date.split("T")[0]:""),[l,c]=h.useState((r==null?void 0:r.recurring)??!1);h.useEffect(()=>{e&&(a((r==null?void 0:r.name)??""),o(r!=null&&r.date?r.date.split("T")[0]:""),c((r==null?void 0:r.recurring)??!1))},[e,r==null?void 0:r.id]);const d=YR(),u=GR(),f=d.isPending||u.isPending,m=p=>{if(p.preventDefault(),!n.trim()){F.error("Holiday name is required");return}if(!i){F.error("Date is required");return}r?u.mutate({id:r.id,name:n.trim(),date:i,recurring:l},{onSuccess:()=>{F.success("Holiday updated"),t()},onError:()=>F.error("Failed to update holiday")}):d.mutate({name:n.trim(),date:i,recurring:l},{onSuccess:()=>{F.success("Holiday added"),t()},onError:()=>F.error("Failed to add holiday")})};return s.jsx(mn,{open:e,onOpenChange:p=>!p&&t(),children:s.jsxs(Zr,{className:"sm:max-w-md",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:r?"Edit holiday":"Add holiday"}),s.jsx(Eo,{children:"Holidays are excluded from business day calculations across the app."})]}),s.jsxs("form",{onSubmit:m,className:"space-y-4 pt-1",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Name"}),s.jsx(_e,{value:n,onChange:p=>a(p.target.value),placeholder:"e.g. New Year's Day",className:"h-9",autoFocus:!0,required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Date"}),s.jsx(_e,{type:"date",value:i,onChange:p=>o(p.target.value),className:"h-9",required:!0})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Lo,{checked:l,onCheckedChange:p=>c(p)}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"Recurring annually (applies every year on the same date)"})]}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:t,children:"Cancel"}),s.jsx(ee,{type:"submit",size:"sm",disabled:f,children:f?r?"Saving…":"Adding…":r?"Save changes":"Add holiday"})]})]})]})})}function aee(){const{data:e,isLoading:t}=qx(),r=KR(),n=(e==null?void 0:e.working_days)??nee,a=(i,o)=>{const l={...n,[i]:o};r.mutate({working_days:l},{onSuccess:()=>F.success("Working days updated"),onError:()=>F.error("Failed to update working days")})};return s.jsxs(s.Fragment,{children:[s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 min-h-[45px] flex items-center",children:s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Working days"})}),s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Configure which days count as business days. This affects duration calculations across the app."})}),t?s.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3,4,5,6,7].map(i=>s.jsx(le,{className:"h-8 w-full"},i))}):ree.map(({key:i,label:o})=>{const l=n[i];return s.jsxs("div",{className:"grid grid-cols-[180px_1fr_auto] items-center gap-4 px-6 py-3.5 border-b border-border",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:o}),s.jsx("span",{className:z("text-xs font-medium",l?"text-foreground":"text-muted-foreground/60"),children:l?"Working day":"Not a working day"}),s.jsx(Lo,{checked:l,onCheckedChange:c=>a(i,c),disabled:r.isPending})]},i)})]})}function iee(){const[e,t]=h.useState(new Date().getFullYear()),[r,n]=h.useState(!1),[a,i]=h.useState(null),[o,l]=h.useState(null),{data:c=[],isLoading:d}=Wx(e),u=VR(),f=()=>{o&&u.mutate(o.id,{onSuccess:()=>{F.success("Holiday removed"),l(null)},onError:()=>F.error("Failed to remove holiday")})},m=[...c].sort((p,x)=>{const g=new Date(p.date).getMonth()*100+new Date(p.date).getDate(),v=new Date(x.date).getMonth()*100+new Date(x.date).getDate();return g-v});return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-2 border-b border-border bg-muted/20",children:[s.jsx("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Holidays"}),s.jsxs(ee,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>{i(null),n(!0)},children:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Add holiday"]})]}),s.jsxs("div",{className:"flex items-center gap-1 px-6 py-3 border-b border-border bg-muted/10",children:[s.jsxs("p",{className:"text-xs text-muted-foreground flex-1",children:["Showing holidays for"," ",s.jsx("span",{className:"font-medium text-foreground",children:e}),". Recurring holidays appear every year."]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx("button",{onClick:()=>t(p=>p-1),className:"h-6 w-6 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(fs,{className:"h-3.5 w-3.5"})}),s.jsx("span",{className:"text-xs font-medium tabular-nums w-10 text-center",children:e}),s.jsx("button",{onClick:()=>t(p=>p+1),className:"h-6 w-6 flex items-center justify-center rounded hover:bg-accent text-muted-foreground hover:text-foreground transition-colors",children:s.jsx(pr,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{className:"hidden md:grid grid-cols-[160px_1fr_120px_40px] gap-4 px-6 py-2 border-b border-border bg-muted/20",children:[s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Date"}),s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Name"}),s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Recurrence"}),s.jsx("span",{})]}),d?s.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map(p=>s.jsx(le,{className:"h-8 w-full"},p))}):m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 text-center",children:[s.jsx(tN,{className:"h-8 w-8 text-muted-foreground/40 mb-3"}),s.jsxs("p",{className:"text-sm font-medium mb-1",children:["No holidays for ",e]}),s.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"Add a holiday or use the year navigation to view other years."}),s.jsxs(ee,{size:"sm",variant:"outline",className:"h-7 text-xs gap-1.5",onClick:()=>{i(null),n(!0)},children:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Add holiday"]})]}):m.map(p=>{const x=new Date(p.date),g=s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsx("button",{className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:s.jsx(Ls,{className:"h-3.5 w-3.5"})})}),s.jsxs(Dr,{align:"end",className:"w-36",children:[s.jsxs(Je,{className:"gap-2 cursor-pointer",onClick:()=>{i(p),n(!0)},children:[s.jsx(Fs,{className:"h-3.5 w-3.5"}),"Edit"]}),s.jsxs(Je,{className:"gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>l(p),children:[s.jsx(jr,{className:"h-3.5 w-3.5"}),"Remove"]})]})]});return s.jsxs("div",{children:[s.jsxs("div",{className:"hidden md:grid grid-cols-[160px_1fr_120px_40px] gap-4 items-center px-6 py-3.5 border-b border-border hover:bg-muted/20 transition-colors",children:[s.jsx("span",{className:"text-sm tabular-nums text-muted-foreground",children:fe(x,"MMM d, yyyy")}),s.jsx("span",{className:"text-sm font-medium truncate",children:p.name}),s.jsx("span",{className:"text-sm",children:p.recurring?s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(no,{className:"h-3 w-3"}),"Every year"]}):s.jsx("span",{className:"text-xs text-muted-foreground/60",children:"One-time"})}),s.jsx("div",{className:"flex justify-end",children:g})]}),s.jsxs("div",{className:"md:hidden flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-muted/20 transition-colors",children:[s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:p.name}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:fe(x,"MMM d, yyyy")}),p.recurring&&s.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[s.jsx(no,{className:"h-3 w-3"}),"Recurring"]})]})]}),g]})]},p.id)}),s.jsx(see,{open:r,onClose:()=>{n(!1),i(null)},holiday:a}),s.jsx(li,{open:!!o,onOpenChange:p=>!p&&l(null),children:s.jsxs(wa,{children:[s.jsxs(Na,{children:[s.jsxs(Sa,{children:['Remove "',o==null?void 0:o.name,'"?']}),s.jsx(Ca,{children:"This holiday will no longer be excluded from business day calculations."})]}),s.jsxs(ka,{children:[s.jsx(Pa,{children:"Cancel"}),s.jsx(_a,{onClick:f,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}const zw=["super-admin","admin","member"],kh={"super-admin":"bg-purple-100 text-purple-700 dark:bg-purple-900/40 dark:text-purple-300",admin:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-300",member:"bg-zinc-100 text-zinc-600 dark:bg-zinc-800 dark:text-zinc-300"},vd={pending:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",accepted:"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/40 dark:text-emerald-300",revoked:"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400"};function Lw({value:e}){const[t,r]=h.useState(!1),n=()=>{navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)};return s.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground transition-colors shrink-0",title:"Copy",children:t?s.jsx(Ct,{className:"h-3.5 w-3.5 text-emerald-500"}):s.jsx(fx,{className:"h-3.5 w-3.5"})})}const Sh={"super-admin":3,admin:2,moderator:1,member:0},qr=20;function oee(){const{data:e}=vO(),t=Sh[(e==null?void 0:e.role)??"member"]??0,[r,n]=h.useState(""),[a,i]=h.useState(""),[o,l]=h.useState(0),[c,d]=h.useState(0);h.useEffect(()=>{const R=setTimeout(()=>{i(r.trim()),l(0),d(0)},400);return()=>clearTimeout(R)},[r]);const{data:u,isLoading:f}=Ak({limit:qr,offset:o*qr,q:a}),m=(u==null?void 0:u.users)??[],p=(u==null?void 0:u.count)??0,{data:x,isLoading:g}=SR({limit:qr,offset:c*qr,q:a}),v=(x==null?void 0:x.invitations)??[],y=(x==null?void 0:x.count)??0,{data:b=[]}=wf(),N=KS(),j=MR(),k=OR(),w=ER(),S=CR(),_=_R(),C=PR(),[P,O]=h.useState(null),[E,D]=h.useState(null),[I,V]=h.useState(null),[Q,q]=h.useState(!1),[re,se]=h.useState(""),[T,M]=h.useState("member"),L=R=>{R.preventDefault(),re.trim()&&C.mutate({email:re.trim().toLowerCase(),role:T},{onSuccess:()=>{F.success(`Invitation sent to ${re.trim()}`),q(!1),se(""),M("member")},onError:Y=>F.error((Y==null?void 0:Y.message)??"Failed to send invitation")})},H=()=>{P&&k.mutate(P,{onSuccess:()=>{F.success("User deactivated"),O(null)},onError:()=>F.error("Failed to deactivate user")})};return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-2 border-b border-border bg-muted/20",children:[s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["All users",!f&&s.jsx(Pn,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full",children:p})]}),s.jsxs(ee,{size:"sm",className:"h-7 text-xs gap-1.5",onClick:()=>q(!0),children:[s.jsx(ot,{className:"h-3.5 w-3.5"}),"Invite member"]})]}),s.jsxs("div",{className:"px-6 py-2 border-b border-border bg-muted/10 flex items-center gap-3",children:[s.jsx("p",{className:"text-xs text-muted-foreground flex-1",children:"View and manage all platform users. Change a user's custom role or remove them from the system."}),s.jsx(_e,{value:r,onChange:R=>n(R.target.value),placeholder:"Search by email or name…",className:"h-8 text-xs w-56 shrink-0"})]}),s.jsx(mn,{open:Q,onOpenChange:R=>{R||(q(!1),se(""),M("member"))},children:s.jsxs(Zr,{className:"sm:max-w-md",children:[s.jsx(hn,{children:s.jsx(pn,{children:"Invite member"})}),s.jsxs("form",{onSubmit:L,className:"space-y-4 pt-1",children:[s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Email"}),s.jsx(_e,{type:"email",value:re,onChange:R=>se(R.target.value),placeholder:"name@example.com",className:"h-9",autoFocus:!0,required:!0})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Role"}),s.jsxs(Ue,{value:T,onValueChange:M,children:[s.jsx(Le,{className:"h-9 text-sm",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:zw.map(R=>s.jsx(ke,{value:R,className:"text-sm capitalize",children:R},R))})]})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"The user will receive an invite link to create their account. They won't be added to any workspace automatically — you can add them from workspace settings after they join."}),s.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[s.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!1),children:"Cancel"}),s.jsx(ee,{type:"submit",size:"sm",disabled:C.isPending,children:C.isPending?"Sending…":"Send invite"})]})]})]})}),s.jsxs("div",{className:"hidden md:grid grid-cols-[1fr_160px_200px_100px_40px] gap-4 px-6 py-2 border-b border-border bg-muted/20",children:[s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"User"}),s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Global role"}),s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Custom role"}),s.jsx("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wide",children:"Joined"}),s.jsx("span",{})]}),f?s.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map(R=>s.jsx(le,{className:"h-10 w-full"},R))}):m.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[s.jsx(Ps,{className:"h-8 w-8 text-muted-foreground/40 mb-3"}),s.jsx("p",{className:"text-sm font-medium",children:a?"No users match your search":"No users found"}),a&&s.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Try a different search term."})]}):s.jsxs(s.Fragment,{children:[m.map(R=>{var de;const Y=R.first_name??"",J=R.last_name??"",A=`${Y} ${J}`.trim()||R.email,U=(Y[0]??J[0]??((de=R.email)==null?void 0:de[0])??"U").toUpperCase(),$=Sh[R.role??"member"]??0,ne=R.id===(e==null?void 0:e.id),B=!ne&&$<t,X=B?s.jsxs(Ue,{value:R.role??"member",onValueChange:me=>j.mutate({userId:R.id,role:me},{onSuccess:()=>F.success("Global role updated"),onError:Z=>F.error((Z==null?void 0:Z.message)??"Failed to update global role")}),children:[s.jsx(Le,{className:"h-7 text-xs w-full",children:s.jsx(Ve,{})}),s.jsx(Fe,{children:zw.filter(me=>(Sh[me]??0)<=t).map(me=>s.jsx(ke,{value:me,className:"text-xs",children:s.jsx("span",{className:z("inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",kh[me]),children:me})},me))})]}):s.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-xs font-medium",kh[R.role??"member"]??kh.member),children:R.role??"member"}),oe=s.jsxs(Ue,{value:R.app_role_id??"none",disabled:!B,onValueChange:me=>N.mutate({userId:R.id,appRoleId:me==="none"?null:me},{onSuccess:()=>F.success("Custom role updated"),onError:()=>F.error("Failed to update custom role")}),children:[s.jsx(Le,{className:z("h-7 text-xs w-full",!B&&"opacity-60 cursor-not-allowed"),children:s.jsx(Ve,{placeholder:"No role"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"none",className:"text-xs",children:"No role"}),b.map(me=>s.jsx(ke,{value:me.id,className:"text-xs",children:me.name},me.id))]})]}),G=R.is_active!==!1,te=B?s.jsxs(Vr,{children:[s.jsx(Xr,{asChild:!0,children:s.jsx("button",{className:"h-6 w-6 flex items-center justify-center rounded text-muted-foreground hover:text-foreground hover:bg-accent transition-colors",children:s.jsx(Ls,{className:"h-3.5 w-3.5"})})}),s.jsx(Dr,{align:"end",className:"w-40",children:G?s.jsxs(Je,{className:"gap-2 cursor-pointer text-destructive focus:text-destructive",onClick:()=>O(R.id),children:[s.jsx(Rh,{className:"h-3.5 w-3.5"}),"Deactivate user"]}):s.jsxs(Je,{className:"gap-2 cursor-pointer",onClick:()=>{w.mutate(R.id,{onSuccess:()=>F.success("User reactivated"),onError:()=>F.error("Failed to reactivate user")})},children:[s.jsx(SD,{className:"h-3.5 w-3.5"}),"Reactivate user"]})})]}):null;return s.jsxs("div",{className:"border-b border-border hover:bg-muted/20 transition-colors group",children:[s.jsxs("div",{className:"hidden md:grid grid-cols-[1fr_160px_200px_100px_40px] gap-4 items-center px-6 py-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center text-xs font-semibold text-zinc-600 dark:text-zinc-300 shrink-0",children:U}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-sm font-medium truncate",children:[A,ne&&s.jsx("span",{className:"text-xs text-muted-foreground ml-1.5",children:"(you)"}),!G&&s.jsx("span",{className:"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"Deactivated"})]}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:R.email})]})]}),X,oe,s.jsx("span",{className:"text-xs text-muted-foreground tabular-nums",children:R.created_at?fe(new Date(R.created_at),"MMM d, yyyy"):"—"}),s.jsx("div",{className:"flex justify-end opacity-0 group-hover:opacity-100 transition-opacity",children:te})]}),s.jsxs("div",{className:"md:hidden px-4 py-3",children:[s.jsxs("div",{className:"flex items-center gap-3 min-w-0 mb-2",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-zinc-200 dark:bg-zinc-700 flex items-center justify-center text-xs font-semibold text-zinc-600 dark:text-zinc-300 shrink-0",children:U}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("p",{className:"text-sm font-medium truncate",children:[A,ne&&s.jsx("span",{className:"text-xs text-muted-foreground ml-1.5",children:"(you)"}),!G&&s.jsx("span",{className:"ml-1.5 inline-flex items-center px-1.5 py-0.5 rounded text-[10px] font-medium bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",children:"Deactivated"})]}),s.jsx("p",{className:"text-xs text-muted-foreground truncate",children:R.email})]}),te]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex-1",children:X}),s.jsx("div",{className:"flex-1",children:oe})]})]})]},R.id)}),p>qr&&s.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[o*qr+1,"–",Math.min((o+1)*qr,p)," of ",p]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(R=>R-1),disabled:o===0,children:s.jsx(fs,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[o+1," / ",Math.ceil(p/qr)]}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>l(R=>R+1),disabled:(o+1)*qr>=p,children:s.jsx(pr,{className:"h-3.5 w-3.5"})})]})]})]}),s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/20 mt-2",children:s.jsxs("span",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide flex items-center gap-2",children:["Invitations",!g&&y>0&&s.jsx(Pn,{variant:"secondary",className:"h-5 min-w-[20px] px-1.5 text-[11px] font-medium rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",children:y})]})}),g?s.jsx("div",{className:"px-6 py-4 space-y-3",children:[1,2,3].map(R=>s.jsx(le,{className:"h-8 w-full"},R))}):v.length===0?s.jsx("div",{className:"px-6 py-6 text-center",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:a?"No invitations match your search.":"No pending invitations."})}):v.map(R=>{const Y=`${window.location.origin}/invite/${R.token}`;return s.jsxs("div",{className:"px-6 py-3.5 border-b border-border hover:bg-muted/20 transition-colors group",children:[s.jsxs("div",{className:"hidden md:flex items-center gap-3",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(Ea,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:R.email??"Shareable link"}),s.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium",R.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":R.role==="admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300":"bg-muted text-muted-foreground"),children:R.role==="super-admin"?"Super Admin":R.role==="admin"?"Admin":"Member"}),R.workspace_name&&s.jsxs("span",{className:"text-[11px] text-muted-foreground truncate",children:["· ",R.workspace_name]})]}),s.jsxs("div",{className:"flex items-center gap-2 mt-0.5",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate max-w-[320px]",children:Y}),s.jsx(Lw,{value:Y})]})]}),s.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[s.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium",vd[R.status]??vd.revoked),children:R.status}),s.jsx("span",{className:"text-xs text-muted-foreground",children:fe(new Date(R.created_at),"MMM d")}),R.status==="pending"&&R.email&&s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:()=>V(R),disabled:_.isPending,className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-foreground disabled:opacity-50",children:s.jsx(Td,{className:z("h-3.5 w-3.5",_.isPending&&"animate-spin")})})}),s.jsx(Wn,{children:"Resend invite"})]}),R.status==="pending"&&s.jsx("button",{onClick:()=>D(R),className:"opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground hover:text-destructive",title:"Revoke invitation",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{className:"md:hidden space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("div",{className:"h-7 w-7 rounded-full bg-muted flex items-center justify-center shrink-0",children:s.jsx(Ea,{className:"h-3.5 w-3.5 text-muted-foreground"})}),s.jsxs("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[s.jsx("p",{className:"text-sm font-medium truncate",children:R.email??"Shareable link"}),s.jsx("span",{className:z("inline-flex items-center text-[11px] px-1.5 py-0.5 rounded font-medium shrink-0",R.role==="super-admin"?"bg-purple-50 text-purple-700 dark:bg-purple-950/30 dark:text-purple-300":R.role==="admin"?"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300":"bg-muted text-muted-foreground"),children:R.role==="super-admin"?"Super Admin":R.role==="admin"?"Admin":"Member"})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[s.jsx("span",{className:z("inline-flex items-center px-2 py-0.5 rounded text-[11px] font-medium",vd[R.status]??vd.revoked),children:R.status}),R.status==="pending"&&R.email&&s.jsx("button",{onClick:()=>V(R),disabled:_.isPending,className:"text-muted-foreground hover:text-foreground disabled:opacity-50",children:s.jsx(Td,{className:z("h-3.5 w-3.5",_.isPending&&"animate-spin")})}),R.status==="pending"&&s.jsx("button",{onClick:()=>D(R),className:"text-muted-foreground hover:text-destructive",title:"Revoke invitation",children:s.jsx(Be,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pl-10",children:[s.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate flex-1 min-w-0",children:Y}),s.jsx(Lw,{value:Y}),R.workspace_name&&s.jsx("span",{className:"text-[11px] text-muted-foreground truncate shrink-0 max-w-[80px]",children:R.workspace_name}),s.jsx("span",{className:"text-[11px] text-muted-foreground shrink-0",children:fe(new Date(R.created_at),"MMM d")})]})]})]},R.id)}),y>qr&&s.jsxs("div",{className:"flex items-center justify-between px-4 md:px-6 py-3 border-t border-border",children:[s.jsxs("span",{className:"text-xs text-muted-foreground",children:[c*qr+1,"–",Math.min((c+1)*qr,y)," of ",y]}),s.jsxs("div",{className:"flex items-center gap-1",children:[s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>d(R=>R-1),disabled:c===0,children:s.jsx(fs,{className:"h-3.5 w-3.5"})}),s.jsxs("span",{className:"text-xs text-muted-foreground tabular-nums w-12 text-center",children:[c+1," / ",Math.ceil(y/qr)]}),s.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>d(R=>R+1),disabled:(c+1)*qr>=y,children:s.jsx(pr,{className:"h-3.5 w-3.5"})})]})]}),s.jsx(li,{open:!!P,onOpenChange:R=>!R&&O(null),children:s.jsxs(wa,{children:[s.jsxs(Na,{children:[s.jsx(Sa,{children:"Deactivate this user?"}),s.jsx(Ca,{children:"The user will lose access immediately and be hidden from member lists. You can reactivate them later."})]}),s.jsxs(ka,{children:[s.jsx(Pa,{children:"Cancel"}),s.jsx(_a,{onClick:H,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Deactivate"})]})]})}),s.jsx(li,{open:!!E,onOpenChange:R=>!R&&D(null),children:s.jsxs(wa,{children:[s.jsxs(Na,{children:[s.jsx(Sa,{children:"Revoke this invitation?"}),s.jsxs(Ca,{children:["The invite link sent to ",s.jsx("span",{className:"font-medium",children:E==null?void 0:E.email})," will no longer work."]})]}),s.jsxs(ka,{children:[s.jsx(Pa,{children:"Cancel"}),s.jsx(_a,{onClick:()=>{E&&S.mutate(E.id,{onSuccess:()=>{F.success("Invitation revoked"),D(null)},onError:()=>F.error("Failed to revoke invitation")})},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Revoke"})]})]})}),s.jsx(li,{open:!!I,onOpenChange:R=>!R&&V(null),children:s.jsxs(wa,{children:[s.jsxs(Na,{children:[s.jsx(Sa,{children:"Resend invitation?"}),s.jsxs(Ca,{children:["A new invitation email will be sent to ",s.jsx("span",{className:"font-medium",children:I==null?void 0:I.email}),"."]})]}),s.jsxs(ka,{children:[s.jsx(Pa,{children:"Cancel"}),s.jsx(_a,{onClick:()=>{I&&_.mutate(I.id,{onSuccess:()=>{F.success("Invitation resent"),V(null)},onError:()=>F.error("Failed to resend invitation")})},children:"Resend"})]})]})})]})}const lee=["working-days","holidays","members"];function cee(){const[e,t]=ec(),r=e.get("tab"),n=r&&lee.includes(r)?r:"working-days",a=o=>t({tab:o},{replace:!0}),i=[{id:"working-days",label:"Working Days"},{id:"holidays",label:"Holidays"},{id:"members",label:"Members"}];return s.jsx("div",{className:"p-2 md:pb-2 h-full",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col h-full",children:[s.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(tN,{className:"h-5 w-5 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-base font-semibold",children:"Organization Settings"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Global configuration that applies across the entire Meridian deployment."})]})]})}),s.jsx("div",{className:"flex border-b border-border shrink-0 px-6",children:i.map(o=>s.jsx("button",{onClick:()=>a(o.id),className:z("px-1 py-3 mr-6 text-sm font-medium border-b-2 transition-colors",n===o.id?"border-foreground text-foreground":"border-transparent text-muted-foreground hover:text-foreground"),children:o.label},o.id))}),s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[n==="working-days"&&s.jsx(aee,{}),n==="holidays"&&s.jsx(iee,{}),n==="members"&&s.jsx(oee,{})]})]})})}function dee(){return s.jsx(gO,{orgScope:!0})}const Ch=e=>{let{transform:t}=e;return{...t,y:0}};function Lv(){const[e,t]=h.useState({x:0,y:0,elementX:0,elementY:0,elementPositionX:0,elementPositionY:0}),r=h.useRef(null);return h.useLayoutEffect(()=>{const n=a=>{var o;let i={x:a.pageX,y:a.pageY};if(((o=r.current)==null?void 0:o.nodeType)===Node.ELEMENT_NODE){const{left:l,top:c}=r.current.getBoundingClientRect(),d=l+window.scrollX,u=c+window.scrollY,f=a.pageX-d,m=a.pageY-u;i.elementX=f,i.elementY=m,i.elementPositionX=d,i.elementPositionY=u}t(l=>({...l,...i}))};return document.addEventListener("mousemove",n),()=>{document.removeEventListener("mousemove",n)}},[]),[e,r]}function uee(e,t=500){const[r,n]=h.useState(e),a=h.useRef(null);return h.useEffect(()=>{const i=Date.now();if(a.current&&i>=a.current+t)a.current=i,n(e);else{const o=window.setTimeout(()=>{a.current=i,n(e)},t);return()=>window.clearTimeout(o)}},[e,t]),r}function fee(){const[e,t]=h.useState({x:null,y:null}),r=h.useCallback((...n)=>{if(typeof n[0]=="object")window.scrollTo(n[0]);else if(typeof n[0]=="number"&&typeof n[1]=="number")window.scrollTo(n[0],n[1]);else throw new Error("Invalid arguments passed to scrollTo. See here for more info. https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo")},[]);return h.useLayoutEffect(()=>{const n=()=>{t({x:window.scrollX,y:window.scrollY})};return n(),window.addEventListener("scroll",n),()=>{window.removeEventListener("scroll",n)}},[]),[e,r]}const ss={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};function yO(e){return"init"in e}function Gp(e){return!!e.write}function Fw(e){return"v"in e||"e"in e}function Bu(e){if("e"in e)throw e.e;if((ss?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v}function qu(e){return typeof(e==null?void 0:e.then)=="function"}function bO(e,t,r){if(!r.p.has(e)){r.p.add(e);const n=()=>r.p.delete(e);t.then(n,n)}}function jO(e,t,r){var n;const a=new Set;for(const i of((n=r.get(e))==null?void 0:n.t)||[])a.add(i);for(const i of t.p)a.add(i);return a}const mee=(e,t,...r)=>t.read(...r),hee=(e,t,...r)=>t.write(...r),pee=(e,t)=>{var r;return(r=t.INTERNAL_onInit)==null?void 0:r.call(t,e)},xee=(e,t,r)=>{var n;return(n=t.onMount)==null?void 0:n.call(t,r)},gee=(e,t)=>{var r;const n=Kt(e),a=n[0],i=n[6],o=n[9];if((ss?"production":void 0)!=="production"&&!t)throw new Error("Atom is undefined or null");let l=a.get(t);return l||(l={d:new Map,p:new Set,n:0},a.set(t,l),(r=i.i)==null||r.call(i,t),o==null||o(e,t)),l},vee=e=>{const t=Kt(e),r=t[1],n=t[3],a=t[4],i=t[5],o=t[6],l=t[13],c=[],d=u=>{try{u()}catch(f){c.push(f)}};do{o.f&&d(o.f);const u=new Set,f=u.add.bind(u);n.forEach(m=>{var p;return(p=r.get(m))==null?void 0:p.l.forEach(f)}),n.clear(),i.forEach(f),i.clear(),a.forEach(f),a.clear(),u.forEach(d),n.size&&l(e)}while(n.size||i.size||a.size);if(c.length)throw new AggregateError(c)},yee=e=>{const t=Kt(e),r=t[1],n=t[2],a=t[3],i=t[11],o=t[14],l=t[17],c=[],d=new WeakSet,u=new WeakSet,f=Array.from(a);for(;f.length;){const m=f[f.length-1],p=i(e,m);if(u.has(m)){f.pop();continue}if(d.has(m)){if(n.get(m)===p.n)c.push([m,p]);else if((ss?"production":void 0)!=="production"&&n.has(m))throw new Error("[Bug] invalidated atom exists");u.add(m),f.pop();continue}d.add(m);for(const x of jO(m,p,r))d.has(x)||f.push(x)}for(let m=c.length-1;m>=0;--m){const[p,x]=c[m];let g=!1;for(const v of x.d.keys())if(v!==p&&a.has(v)){g=!0;break}g&&(o(e,p),l(e,p)),n.delete(p)}},Vp=new WeakSet,bee=(e,t)=>{var r,n;const a=Kt(e),i=a[1],o=a[2],l=a[3],c=a[6],d=a[7],u=a[11],f=a[12],m=a[13],p=a[14],x=a[16],g=a[17],v=a[20],y=a[26],b=u(e,t);if(Fw(b)){if(i.has(t)&&o.get(t)!==b.n)return b;let D=!1;for(const[I,V]of b.d)if(p(e,I).n!==V){D=!0;break}if(!D)return b}let N=!0;const j=new Set(b.d.keys()),k=new Map,w=()=>{for(const D of j)k.has(D)||b.d.delete(D)},S=()=>{if(i.has(t)){const D=!l.size;g(e,t),D&&(m(e),f(e))}},_=D=>{var I;if(D===t){const Q=u(e,D);if(!Fw(Q))if(yO(D))v(e,D,D.init);else throw new Error("no atom init");return Bu(Q)}const V=p(e,D);try{return Bu(V)}finally{k.set(D,V.n),b.d.set(D,V.n),qu(b.v)&&bO(t,b.v,V),i.has(t)&&((I=i.get(D))==null||I.t.add(t)),N||S()}};let C,P;const O={get signal(){return C||(C=new AbortController),C.signal},get setSelf(){return(ss?"production":void 0)!=="production"&&console.warn("[DEPRECATED] setSelf is deprecated and will be removed in v3."),(ss?"production":void 0)!=="production"&&!Gp(t)&&console.warn("setSelf function cannot be used with read-only atom"),!P&&Gp(t)&&(P=(...D)=>{if((ss?"production":void 0)!=="production"&&N&&console.warn("setSelf function cannot be called in sync"),!N)try{return x(e,t,...D)}finally{m(e),f(e)}}),P}},E=b.n;try{(ss?"production":void 0)!=="production"&&Vp.delete(e);const D=d(e,t,_,O);if((ss?"production":void 0)!=="production"&&Vp.has(e)&&console.warn("Detected store mutation during atom read. This is not supported."),v(e,t,D),qu(D)){y(e,D,()=>C==null?void 0:C.abort());const I=()=>{w(),S()};D.then(I,I)}else w();return(r=c.r)==null||r.call(c,t),b}catch(D){return delete b.v,b.e=D,++b.n,b}finally{N=!1,E!==b.n&&o.get(t)===E&&(o.set(t,b.n),l.add(t),(n=c.c)==null||n.call(c,t))}},jee=(e,t)=>{const r=Kt(e),n=r[1],a=r[2],i=r[11],o=[t];for(;o.length;){const l=o.pop(),c=i(e,l);for(const d of jO(l,c,n)){const u=i(e,d);a.get(d)!==u.n&&(a.set(d,u.n),o.push(d))}}},wee=(e,t,...r)=>{const n=Kt(e),a=n[3],i=n[6],o=n[8],l=n[11],c=n[12],d=n[13],u=n[14],f=n[15],m=n[16],p=n[17],x=n[20];let g=!0;const v=b=>Bu(u(e,b)),y=(b,...N)=>{var j;const k=l(e,b);try{if(b===t){if(!yO(b))throw new Error("atom not writable");(ss?"production":void 0)!=="production"&&Vp.add(e);const w=k.n,S=N[0];x(e,b,S),p(e,b),w!==k.n&&(a.add(b),f(e,b),(j=i.c)==null||j.call(i,b));return}else return m(e,b,...N)}finally{g||(d(e),c(e))}};try{return o(e,t,v,y,...r)}finally{g=!1}},Nee=(e,t)=>{var r;const n=Kt(e),a=n[1],i=n[3],o=n[6],l=n[11],c=n[15],d=n[18],u=n[19],f=l(e,t),m=a.get(t);if(m){for(const[p,x]of f.d)if(!m.d.has(p)){const g=l(e,p);d(e,p).t.add(t),m.d.add(p),x!==g.n&&(i.add(p),c(e,p),(r=o.c)==null||r.call(o,p))}for(const p of m.d)if(!f.d.has(p)){m.d.delete(p);const x=u(e,p);x==null||x.t.delete(t)}}},kee=(e,t)=>{var r;const n=Kt(e),a=n[1],i=n[4],o=n[6],l=n[10],c=n[11],d=n[12],u=n[13],f=n[14],m=n[16],p=n[18],x=c(e,t);let g=a.get(t);if(!g){f(e,t);for(const v of x.d.keys())p(e,v).t.add(t);if(g={l:new Set,d:new Set(x.d.keys()),t:new Set},a.set(t,g),Gp(t)){const v=()=>{let y=!0;const b=(...N)=>{try{return m(e,t,...N)}finally{y||(u(e),d(e))}};try{const N=l(e,t,b);N&&(g.u=()=>{y=!0;try{N()}finally{y=!1}})}finally{y=!1}};i.add(v)}(r=o.m)==null||r.call(o,t)}return g},See=(e,t)=>{var r,n;const a=Kt(e),i=a[1],o=a[5],l=a[6],c=a[11],d=a[19],u=c(e,t);let f=i.get(t);if(!f||f.l.size)return f;let m=!1;for(const p of f.t)if((r=i.get(p))!=null&&r.d.has(t)){m=!0;break}if(!m){f.u&&o.add(f.u),f=void 0,i.delete(t);for(const p of u.d.keys()){const x=d(e,p);x==null||x.t.delete(t)}(n=l.u)==null||n.call(l,t);return}return f},Cee=(e,t,r)=>{const n=Kt(e),a=n[11],i=n[27],o=a(e,t),l="v"in o,c=o.v;if(qu(r))for(const d of o.d.keys())bO(t,r,a(e,d));o.v=r,delete o.e,(!l||!Object.is(c,o.v))&&(++o.n,qu(c)&&i(e,c))},_ee=(e,t)=>{const r=Kt(e)[14];return Bu(r(e,t))},Pee=(e,t,...r)=>{const n=Kt(e),a=n[12],i=n[13],o=n[16];try{return o(e,t,...r)}finally{i(e),a(e)}},Mee=(e,t,r)=>{const n=Kt(e),a=n[12],i=n[18],o=n[19],c=i(e,t).l;return c.add(r),a(e),()=>{c.delete(r),o(e,t),a(e)}},Oee=(e,t,r)=>{const a=Kt(e)[25];let i=a.get(t);if(!i){i=new Set,a.set(t,i);const o=()=>a.delete(t);t.then(o,o)}i.add(r)},Eee=(e,t)=>{const a=Kt(e)[25].get(t);a==null||a.forEach(i=>i())},wO=new WeakMap,Kt=e=>{const t=wO.get(e);if((ss?"production":void 0)!=="production"&&!t)throw new Error("Store must be created by buildStore to read its building blocks");return t};function Aee(e){const t=Kt(e),r=t[24];return r?r(t):t}function Dee(...e){const t={get(n){const a=Kt(t)[21];return a(t,n)},set(n,...a){const i=Kt(t)[22];return i(t,n,...a)},sub(n,a){const i=Kt(t)[23];return i(t,n,a)}},r=[new WeakMap,new WeakMap,new WeakMap,new Set,new Set,new Set,{},mee,hee,pee,xee,gee,vee,yee,bee,jee,wee,Nee,kee,See,Cee,_ee,Pee,Mee,void 0,new WeakMap,Oee,Eee].map((n,a)=>e[a]||n);return wO.set(t,Object.freeze(r)),t}const NO={};let Tee=0;function kO(e,t){const r=`atom${++Tee}`,n={toString(){return(NO?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof e=="function"?n.read=e:(n.init=e,n.read=Iee,n.write=Ree),n}function Iee(e){return e(this)}function Ree(e,t,r){return t(this,typeof r=="function"?r(e(this)):r)}function $ee(){return Dee()}let jl;function zee(){return jl||(jl=$ee(),(NO?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=jl),globalThis.__JOTAI_DEFAULT_STORE__!==jl&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),jl}const Lee={},Fee=h.createContext(void 0);function SO(e){return h.useContext(Fee)||zee()}const Xp=e=>typeof(e==null?void 0:e.then)=="function",Qp=e=>{e.status||(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}))},Bee=W.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(Qp(e),e)}),_h=new WeakMap,Bw=(e,t,r)=>{const a=Aee(e)[26];let i=_h.get(t);return i||(i=new Promise((o,l)=>{let c=t;const d=m=>p=>{c===m&&o(p)},u=m=>p=>{c===m&&l(p)},f=()=>{try{const m=r();Xp(m)?(_h.set(m,i),c=m,m.then(d(m),u(m)),a(e,m,f)):o(m)}catch(m){l(m)}};t.then(d(t),u(t)),a(e,t,f)}),_h.set(t,i)),i};function qee(e,t){const{delay:r,unstable_promiseStatus:n=!W.use}={},a=SO(),[[i,o,l],c]=h.useReducer(u=>{const f=a.get(e);return Object.is(u[0],f)&&u[1]===a&&u[2]===e?u:[f,a,e]},void 0,()=>[a.get(e),a,e]);let d=i;if((o!==a||l!==e)&&(c(),d=a.get(e)),h.useEffect(()=>{const u=a.sub(e,()=>{if(n)try{const f=a.get(e);Xp(f)&&Qp(Bw(a,f,()=>a.get(e)))}catch{}if(typeof r=="number"){setTimeout(c,r);return}c()});return c(),u},[a,e,r,n]),h.useDebugValue(d),Xp(d)){const u=Bw(a,d,()=>a.get(e));return n&&Qp(u),Bee(u)}return d}function Wee(e,t){const r=SO();return h.useCallback((...a)=>{if((Lee?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return r.set(e,...a)},[r,e])}function CO(e,t){return[qee(e),Wee(e)]}var _O="Expected a function",qw=NaN,Uee="[object Symbol]",Hee=/^\s+|\s+$/g,Kee=/^[-+]0x[0-9a-f]+$/i,Yee=/^0b[01]+$/i,Gee=/^0o[0-7]+$/i,Vee=parseInt,Xee=typeof Bc=="object"&&Bc&&Bc.Object===Object&&Bc,Qee=typeof self=="object"&&self&&self.Object===Object&&self,Zee=Xee||Qee||Function("return this")(),Jee=Object.prototype,ete=Jee.toString,tte=Math.max,rte=Math.min,Ph=function(){return Zee.Date.now()};function nte(e,t,r){var n,a,i,o,l,c,d=0,u=!1,f=!1,m=!0;if(typeof e!="function")throw new TypeError(_O);t=Ww(t)||0,Wu(r)&&(u=!!r.leading,f="maxWait"in r,i=f?tte(Ww(r.maxWait)||0,t):i,m="trailing"in r?!!r.trailing:m);function p(w){var S=n,_=a;return n=a=void 0,d=w,o=e.apply(_,S),o}function x(w){return d=w,l=setTimeout(y,t),u?p(w):o}function g(w){var S=w-c,_=w-d,C=t-S;return f?rte(C,i-_):C}function v(w){var S=w-c,_=w-d;return c===void 0||S>=t||S<0||f&&_>=i}function y(){var w=Ph();if(v(w))return b(w);l=setTimeout(y,g(w))}function b(w){return l=void 0,m&&n?p(w):(n=a=void 0,o)}function N(){l!==void 0&&clearTimeout(l),d=0,n=c=a=l=void 0}function j(){return l===void 0?o:b(Ph())}function k(){var w=Ph(),S=v(w);if(n=arguments,a=this,c=w,S){if(l===void 0)return x(c);if(f)return l=setTimeout(y,t),p(c)}return l===void 0&&(l=setTimeout(y,t)),o}return k.cancel=N,k.flush=j,k}function ste(e,t,r){var n=!0,a=!0;if(typeof e!="function")throw new TypeError(_O);return Wu(r)&&(n="leading"in r?!!r.leading:n,a="trailing"in r?!!r.trailing:a),nte(e,t,{leading:n,maxWait:t,trailing:a})}function Wu(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function ate(e){return!!e&&typeof e=="object"}function ite(e){return typeof e=="symbol"||ate(e)&&ete.call(e)==Uee}function Ww(e){if(typeof e=="number")return e;if(ite(e))return qw;if(Wu(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Wu(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(Hee,"");var r=Yee.test(e);return r||Gee.test(e)?Vee(e.slice(2),r?2:8):Kee.test(e)?qw:+e}var ote=ste;const lte=Qs(ote),PO=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:z("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));PO.displayName="Card";const cte=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:z("flex flex-col space-y-1.5 p-6",e),...t}));cte.displayName="CardHeader";const dte=h.forwardRef(({className:e,...t},r)=>s.jsx("h3",{ref:r,className:z("text-2xl font-semibold leading-none tracking-tight",e),...t}));dte.displayName="CardTitle";const ute=h.forwardRef(({className:e,...t},r)=>s.jsx("p",{ref:r,className:z("text-sm text-muted-foreground",e),...t}));ute.displayName="CardDescription";const fte=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:z("p-6 pt-0",e),...t}));fte.displayName="CardContent";const mte=h.forwardRef(({className:e,...t},r)=>s.jsx("div",{ref:r,className:z("flex items-center p-6 pt-0",e),...t}));mte.displayName="CardFooter";function hte(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 s.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 a=()=>{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 a.scopeName=e,[n,pte(a,...t)]}function pte(...e){const t=e[0];if(e.length===1)return t;const r=()=>{const n=e.map(a=>({useScope:a(),scopeName:a.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 xte(e){const t=gte(e),r=h.forwardRef((n,a)=>{const{children:i,...o}=n,l=h.Children.toArray(i),c=l.find(yte);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 s.jsx(t,{...o,ref:a,children:h.isValidElement(d)?h.cloneElement(d,void 0,u):null})}return s.jsx(t,{...o,ref:a,children:i})});return r.displayName=`${e}.Slot`,r}function gte(e){const t=h.forwardRef((r,n)=>{const{children:a,...i}=r;if(h.isValidElement(a)){const o=jte(a),l=bte(i,a.props);return a.type!==h.Fragment&&(l.ref=n?tx(n,o):o),h.cloneElement(a,l)}return h.Children.count(a)>1?h.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vte=Symbol("radix.slottable");function yte(e){return h.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===vte}function bte(e,t){const r={...t};for(const n in t){const a=e[n],i=t[n];/^on[A-Z]/.test(n)?a&&i?r[n]=(...l)=>{const c=i(...l);return a(...l),c}:a&&(r[n]=a):n==="style"?r[n]={...a,...i}:n==="className"&&(r[n]=[a,i].filter(Boolean).join(" "))}return{...e,...r}}function jte(e){var n,a;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=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,r=t&&"isReactWarning"in t&&t.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var wte=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Nte=wte.reduce((e,t)=>{const r=xte(`Primitive.${t}`),n=h.forwardRef((a,i)=>{const{asChild:o,...l}=a,c=o?r:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),s.jsx(c,{...l,ref:i})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Fv="ContextMenu",[kte]=hte(Fv,[C1]),zr=C1(),[Ste,MO]=kte(Fv),OO=e=>{const{__scopeContextMenu:t,children:r,onOpenChange:n,dir:a,modal:i=!0}=e,[o,l]=h.useState(!1),c=zr(t),d=QE(n),u=h.useCallback(f=>{l(f),d(f)},[d]);return s.jsx(Ste,{scope:t,open:o,onOpenChange:u,modal:i,children:s.jsx(ZE,{...c,dir:a,open:o,onOpenChange:u,modal:i,children:r})})};OO.displayName=Fv;var EO="ContextMenuTrigger",AO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,disabled:n=!1,...a}=e,i=MO(EO,r),o=zr(r),l=h.useRef({x:0,y:0}),c=h.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=h.useRef(0),u=h.useCallback(()=>window.clearTimeout(d.current),[]),f=m=>{l.current={x:m.clientX,y:m.clientY},i.onOpenChange(!0)};return h.useEffect(()=>u,[u]),h.useEffect(()=>void(n&&u()),[n,u]),s.jsxs(s.Fragment,{children:[s.jsx(JE,{...o,virtualRef:c}),s.jsx(Nte.span,{"data-state":i.open?"open":"closed","data-disabled":n?"":void 0,...a,ref:t,style:{WebkitTouchCallout:"none",...e.style},onContextMenu:n?e.onContextMenu:Cs(e.onContextMenu,m=>{u(),f(m),m.preventDefault()}),onPointerDown:n?e.onPointerDown:Cs(e.onPointerDown,yd(m=>{u(),d.current=window.setTimeout(()=>f(m),700)})),onPointerMove:n?e.onPointerMove:Cs(e.onPointerMove,yd(u)),onPointerCancel:n?e.onPointerCancel:Cs(e.onPointerCancel,yd(u)),onPointerUp:n?e.onPointerUp:Cs(e.onPointerUp,yd(u))})]})});AO.displayName=EO;var Cte="ContextMenuPortal",DO=e=>{const{__scopeContextMenu:t,...r}=e,n=zr(t);return s.jsx(WE,{...n,...r})};DO.displayName=Cte;var TO="ContextMenuContent",IO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=MO(TO,r),i=zr(r),o=h.useRef(!1);return s.jsx(UE,{...i,...n,ref:t,side:"right",sideOffset:2,align:"start",onCloseAutoFocus:l=>{var c;(c=e.onCloseAutoFocus)==null||c.call(e,l),!l.defaultPrevented&&o.current&&l.preventDefault(),o.current=!1},onInteractOutside:l=>{var c;(c=e.onInteractOutside)==null||c.call(e,l),!l.defaultPrevented&&!a.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});IO.displayName=TO;var _te="ContextMenuGroup",Pte=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(eA,{...a,...n,ref:t})});Pte.displayName=_te;var Mte="ContextMenuLabel",RO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(VE,{...a,...n,ref:t})});RO.displayName=Mte;var Ote="ContextMenuItem",$O=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(HE,{...a,...n,ref:t})});$O.displayName=Ote;var Ete="ContextMenuCheckboxItem",zO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(KE,{...a,...n,ref:t})});zO.displayName=Ete;var Ate="ContextMenuRadioGroup",Dte=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(tA,{...a,...n,ref:t})});Dte.displayName=Ate;var Tte="ContextMenuRadioItem",LO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(GE,{...a,...n,ref:t})});LO.displayName=Tte;var Ite="ContextMenuItemIndicator",FO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(YE,{...a,...n,ref:t})});FO.displayName=Ite;var Rte="ContextMenuSeparator",BO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(XE,{...a,...n,ref:t})});BO.displayName=Rte;var $te="ContextMenuArrow",zte=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(rA,{...a,...n,ref:t})});zte.displayName=$te;var Lte="ContextMenuSubTrigger",qO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(BE,{...a,...n,ref:t})});qO.displayName=Lte;var Fte="ContextMenuSubContent",WO=h.forwardRef((e,t)=>{const{__scopeContextMenu:r,...n}=e,a=zr(r);return s.jsx(qE,{...a,...n,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-context-menu-content-available-width":"var(--radix-popper-available-width)","--radix-context-menu-content-available-height":"var(--radix-popper-available-height)","--radix-context-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-context-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});WO.displayName=Fte;function yd(e){return t=>t.pointerType!=="mouse"?e(t):void 0}var Bte=OO,qte=AO,Wte=DO,UO=IO,HO=RO,KO=$O,YO=zO,GO=LO,VO=FO,XO=BO,QO=qO,ZO=WO;const Ute=Bte,Hte=qte,Kte=h.forwardRef(({className:e,inset:t,children:r,...n},a)=>s.jsxs(QO,{ref:a,className:z("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",t&&"pl-8",e),...n,children:[r,s.jsx(pr,{className:"ml-auto h-4 w-4"})]}));Kte.displayName=QO.displayName;const Yte=h.forwardRef(({className:e,...t},r)=>s.jsx(ZO,{ref:r,className:z("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}));Yte.displayName=ZO.displayName;const JO=h.forwardRef(({className:e,...t},r)=>s.jsx(Wte,{children:s.jsx(UO,{ref:r,className:z("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 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})}));JO.displayName=UO.displayName;const eE=h.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(KO,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t&&"pl-8",e),...r}));eE.displayName=KO.displayName;const Gte=h.forwardRef(({className:e,children:t,checked:r,...n},a)=>s.jsxs(YO,{ref:a,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),checked:r,...n,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(VO,{children:s.jsx(Ct,{className:"h-4 w-4"})})}),t]}));Gte.displayName=YO.displayName;const Vte=h.forwardRef(({className:e,children:t,...r},n)=>s.jsxs(GO,{ref:n,className:z("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...r,children:[s.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:s.jsx(VO,{children:s.jsx(Er,{className:"h-2 w-2 fill-current"})})}),t]}));Vte.displayName=GO.displayName;const Xte=h.forwardRef(({className:e,inset:t,...r},n)=>s.jsx(HO,{ref:n,className:z("px-2 py-1.5 text-sm font-semibold text-foreground",t&&"pl-8",e),...r}));Xte.displayName=HO.displayName;const Qte=h.forwardRef(({className:e,...t},r)=>s.jsx(XO,{ref:r,className:z("-mx-1 my-1 h-px bg-border",e),...t}));Qte.displayName=XO.displayName;const Zte=kO(!1),Jte=kO(0),Bv=()=>CO(Zte),qv=()=>CO(Jte),ere=e=>{let t=r=>1;return(e==="monthly"||e==="quarterly")&&(t=Ia),t},Fc=e=>{let t=jk;return(e==="monthly"||e==="quarterly")&&(t=kk),t},Wv=e=>{let t=i4;return(e==="monthly"||e==="quarterly")&&(t=jk),t},Zl=e=>{let t=io;return(e==="monthly"||e==="quarterly")&&(t=Ck),t},tre=e=>{let t=Nk;return(e==="monthly"||e==="quarterly")&&(t=zx),t},tE=e=>{let t=Yr;return(e==="monthly"||e==="quarterly")&&(t=Ix),t},Cl=(e,t)=>{const r=new Date(e.timelineData[0].year,0,1),n=e.columnWidth*e.zoom/100,a=Math.floor(t/n),i=ere(e.range),l=tE(e.range)(r,a),c=i(l),d=Math.round(n/c),u=Math.floor(t%n/d);return Yr(l,u)},rre=e=>{const t=[];t.push({year:e.getFullYear()-1,quarters:new Array(4).fill(null)},{year:e.getFullYear(),quarters:new Array(4).fill(null)},{year:e.getFullYear()+1,quarters:new Array(4).fill(null)});for(const r of t)r.quarters=new Array(4).fill(null).map((n,a)=>({months:new Array(3).fill(null).map((i,o)=>{const l=a*3+o;return{days:Ia(new Date(r.year,l,1))}})}));return t},rE=(e,t,r)=>{const n=r.columnWidth*r.zoom/100,a=Fc(r.range),i=Zl(r.range),o=a(i(e),t);if(r.range==="daily")return n*o;const l=e.getDate(),c=Ia(e),d=n/c;return o*n+l*d},nre=(e,t,r)=>{const n=r.columnWidth*r.zoom/100;if(!t)return n*2;const a=Fc(r.range);if(r.range==="daily"){const x=a(t,e);return n*(x||1)}const i=Ia(e),o=n/i;if(oo(e,t))return o;const l=Wv(r.range),c=Zl(r.range);if(oo(c(e),c(t)))return l(t,e)*o;const d=i-Pl(e),u=Pl(t),f=a(c(t),c(e)),m=Ia(t),p=n/m;return(f-1)*n+d*o+u*p},nE=(e,t,r)=>{const n=Zl(t),a=tre(t),i=Wv(t),o=n(e),l=a(e),c=i(l,o);return e.getDate()/c*r},Vn=h.createContext({zoom:100,range:"monthly",columnWidth:50,headerHeight:60,sidebarWidth:300,rowHeight:36,onAddItem:void 0,placeholderLength:2,timelineData:[],ref:null,scrollToFeature:void 0}),Uv=({title:e,columns:t,renderHeaderItem:r})=>{const n=h.useId();return s.jsxs("div",{className:"sticky top-0 z-20 grid w-full shrink-0 bg-backdrop/90 backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[s.jsx("div",{children:s.jsx("div",{className:"sticky inline-flex whitespace-nowrap px-3 py-2 text-muted-foreground text-xs",style:{left:"var(--gantt-sidebar-width)"},children:s.jsx("p",{children:e})})}),s.jsx("div",{className:"grid w-full",style:{gridTemplateColumns:`repeat(${t}, var(--gantt-column-width))`},children:Array.from({length:t}).map((a,i)=>s.jsx("div",{className:"shrink-0 border-border/50 border-b py-1 text-center text-xs",children:r(i)},`${n}-${i}`))})]})},sre=()=>h.useContext(Vn).timelineData.map(t=>t.quarters.flatMap(r=>r.months).map((r,n)=>s.jsxs("div",{className:"relative flex flex-col",children:[s.jsx(Uv,{columns:r.days,renderHeaderItem:a=>s.jsxs("div",{className:"flex items-center justify-center gap-1",children:[s.jsx("p",{children:fe(Yr(new Date(t.year,n,1),a),"d")}),s.jsx("p",{className:"text-muted-foreground",children:fe(Yr(new Date(t.year,n,1),a),"EEEEE")})]}),title:fe(new Date(t.year,n,1),"MMMM yyyy")}),s.jsx(Hv,{columns:r.days,isColumnSecondary:a=>[0,6].includes(Yr(new Date(t.year,n,1),a).getDay())})]},`${t.year}-${n}`))),are=()=>h.useContext(Vn).timelineData.map(t=>s.jsxs("div",{className:"relative flex flex-col",children:[s.jsx(Uv,{columns:t.quarters.flatMap(r=>r.months).length,renderHeaderItem:r=>s.jsx("p",{children:fe(new Date(t.year,r,1),"MMM")}),title:`${t.year}`}),s.jsx(Hv,{columns:t.quarters.flatMap(r=>r.months).length})]},t.year)),ire=()=>h.useContext(Vn).timelineData.map(t=>t.quarters.map((r,n)=>s.jsxs("div",{className:"relative flex flex-col",children:[s.jsx(Uv,{columns:r.months.length,renderHeaderItem:a=>s.jsx("p",{children:fe(new Date(t.year,n*3+a,1),"MMM")}),title:`Q${n+1} ${t.year}`}),s.jsx(Hv,{columns:r.months.length})]},`${t.year}-${n}`))),ore={daily:sre,monthly:are,quarterly:ire},lre=({className:e})=>{const t=h.useContext(Vn),r=ore[t.range];return s.jsx("div",{className:z("-space-x-px flex h-full w-max divide-x divide-border/50",e),children:s.jsx(r,{})})},Mh=({feature:e,onSelectItem:t,className:r,duration:n})=>{const a=h.useContext(Vn),i=e.endAt&&oo(e.startAt,e.endAt)?Yr(e.endAt,1):e.endAt,o=n??(i?Bh(e.startAt,i):`${Bh(e.startAt,new Date)} so far`),l=d=>{var u;d.target===d.currentTarget&&((u=a.scrollToFeature)==null||u.call(a,e),t==null||t(e.id))},c=d=>{var u;d.key==="Enter"&&((u=a.scrollToFeature)==null||u.call(a,e),t==null||t(e.id))};return s.jsxs("div",{className:z("relative flex items-center gap-2.5 p-2.5 text-xs hover:bg-secondary",r),onClick:l,onKeyDown:c,role:"button",style:{height:"var(--gantt-row-height)"},tabIndex:0,children:[s.jsx("div",{className:"pointer-events-none h-2 w-2 shrink-0 rounded-full",style:{backgroundColor:e.status.color}}),s.jsx("p",{className:"pointer-events-none flex-1 truncate text-left font-medium",children:e.name}),s.jsx("p",{className:"pointer-events-none text-muted-foreground",children:o})]},e.id)},cre=()=>s.jsxs("div",{className:"sticky top-0 z-10 flex shrink-0 items-end justify-between gap-2.5 border-border/50 border-b bg-backdrop/90 p-2.5 font-medium text-muted-foreground text-xs backdrop-blur-sm",style:{height:"var(--gantt-header-height)"},children:[s.jsx("p",{className:"flex-1 truncate text-left",children:"Issues"}),s.jsx("p",{className:"shrink-0",children:"Duration"})]}),Oh=({children:e,name:t,className:r})=>s.jsxs("div",{className:r,children:[s.jsx("p",{className:"w-full truncate p-2.5 text-left font-medium text-muted-foreground text-xs",style:{height:"var(--gantt-row-height)"},children:t}),s.jsx("div",{className:"divide-y divide-border/50",children:e})]}),dre=({children:e,className:t})=>s.jsxs("div",{className:z("sticky left-0 z-30 h-max min-h-full overflow-clip border-border/50 border-r bg-white dark:bg-zinc-950 backdrop-blur-md",t),"data-roadmap-ui":"gantt-sidebar",children:[s.jsx(cre,{}),s.jsx("div",{className:"space-y-4",children:e})]}),ure=({top:e,className:t})=>{const[r]=qv(),n=h.useContext(Vn),[a,i]=Lv(),o=()=>{var u,f,m;const l=(f=(u=n.ref)==null?void 0:u.current)==null?void 0:f.getBoundingClientRect(),c=a.x-((l==null?void 0:l.left)??0)+r-n.sidebarWidth,d=Cl(n,c);(m=n.onAddItem)==null||m.call(n,d)};return s.jsx("div",{className:z("absolute top-0 w-full px-0.5",t),ref:i,style:{marginTop:-n.rowHeight/2,transform:`translateY(${e}px)`},children:s.jsx("button",{className:"flex h-full w-full items-center justify-center rounded-md border border-dashed p-2",onClick:o,type:"button",children:s.jsx(ot,{className:"pointer-events-none select-none text-muted-foreground",size:16})})})},fre=({index:e,isColumnSecondary:t})=>{var m;const r=h.useContext(Vn),[n]=Bv(),[a,i]=Lv(),[o,l]=h.useState(!1),[c]=fee(),d=()=>l(!0),u=()=>l(!1),f=uee(a.y-(((m=i.current)==null?void 0:m.getBoundingClientRect().y)??0)-(c.y??0),10);return s.jsx("div",{className:z("group relative h-full overflow-hidden",t!=null&&t(e)?"bg-[#f59e0b]/5 dark:bg-[#f59e0b]/5":""),onMouseEnter:d,onMouseLeave:u,ref:i,children:!n&&o&&r.onAddItem?s.jsx(ure,{top:f}):null})},Hv=({columns:e,isColumnSecondary:t})=>{const r=h.useId();return s.jsx("div",{className:"divide grid h-full w-full divide-x divide-border/50",style:{gridTemplateColumns:`repeat(${e}, var(--gantt-column-width))`},children:Array.from({length:e}).map((n,a)=>s.jsx(fre,{index:a,isColumnSecondary:t},`${r}-${a}`))})},Uw=({direction:e,featureId:t,date:r})=>{const[,n]=Bv(),{attributes:a,listeners:i,setNodeRef:o}=O1({id:`feature-drag-helper-${t}`}),l=!!a["aria-pressed"];return h.useEffect(()=>n(l),[l,n]),s.jsxs("div",{className:z("group -translate-y-1/2 !cursor-col-resize absolute top-1/2 z-[3] h-full w-6 rounded-md outline-none",e==="left"?"-left-2.5":"-right-2.5"),ref:o,...a,...i,children:[s.jsx("div",{className:z("-translate-y-1/2 absolute top-1/2 h-[80%] w-1 rounded-sm bg-muted-foreground opacity-0 transition-all",e==="left"?"left-2.5":"right-2.5",e==="left"?"group-hover:left-0":"group-hover:right-0",l&&(e==="left"?"left-0":"right-0"),"group-hover:opacity-100",l&&"opacity-100")}),r&&s.jsx("div",{className:z("-translate-x-1/2 absolute top-10 hidden whitespace-nowrap rounded-lg border border-border/50 bg-background/90 px-2 py-1 text-foreground text-xs backdrop-blur-lg group-hover:block",l&&"block"),children:fe(r,"MMM dd, yyyy")})]})},mre=({id:e,children:t})=>{const[,r]=Bv(),{attributes:n,listeners:a,setNodeRef:i}=O1({id:e}),o=!!n["aria-pressed"];return h.useEffect(()=>r(o),[o,r]),s.jsx(PO,{className:"h-full w-full rounded-md bg-background p-2 text-xs shadow-sm",children:s.jsx("div",{className:z("flex h-full w-full items-center justify-between gap-2 text-left",o&&"cursor-grabbing"),...n,...a,ref:i,children:t})})},Hw=({onMove:e,children:t,className:r,...n})=>{const[a]=qv(),i=h.useContext(Vn),o=h.useMemo(()=>{var O;return new Date(((O=i.timelineData.at(0))==null?void 0:O.year)??0,0,1)},[i.timelineData]),[l,c]=h.useState(n.startAt),[d,u]=h.useState(n.endAt),f=h.useMemo(()=>nre(l,d,i),[l,d,i]),m=h.useMemo(()=>rE(l,o,i),[l,o,i]),p=h.useMemo(()=>tE(i.range),[i.range]),[x]=Lv(),[g,v]=h.useState(0),[y,b]=h.useState(l),[N,j]=h.useState(d),k=rx(cA,{activationConstraint:{distance:10}}),w=h.useCallback(()=>{v(x.x),b(l),j(d)},[x.x,l,d]),S=h.useCallback(()=>{const O=Cl(i,x.x),E=Cl(i,g),D=i.range==="daily"?Fc(i.range)(O,E):Wv(i.range)(O,E),I=Yr(y,D),V=N?Yr(N,D):null;c(I),u(V)},[i,x.x,g,y,N]),_=h.useCallback(()=>e==null?void 0:e(n.id,l,d),[e,n.id,l,d]),C=h.useCallback(()=>{var V,Q;const O=(Q=(V=i.ref)==null?void 0:V.current)==null?void 0:Q.getBoundingClientRect(),E=x.x-((O==null?void 0:O.left)??0)+a-i.sidebarWidth,I=Zl(i.range)(Cl(i,E));c(I)},[i,x.x,a]),P=h.useCallback(()=>{var V,Q;const O=(Q=(V=i.ref)==null?void 0:V.current)==null?void 0:Q.getBoundingClientRect(),E=x.x-((O==null?void 0:O.left)??0)+a-i.sidebarWidth,I=Zl(i.range)(Cl(i,E));u(I)},[i,x.x,a]);return s.jsx("div",{className:z("relative flex w-max min-w-full py-0.5",r),style:{height:"var(--gantt-row-height)"},children:s.jsxs("div",{className:"pointer-events-auto absolute top-0.5",style:{height:"calc(var(--gantt-row-height) - 4px)",width:Math.round(f),left:Math.round(m)},children:[e&&s.jsx(_l,{modifiers:[Ch],onDragEnd:_,onDragMove:C,sensors:[k],children:s.jsx(Uw,{date:l,direction:"left",featureId:n.id})}),s.jsx(_l,{modifiers:[Ch],onDragEnd:_,onDragMove:S,onDragStart:w,sensors:[k],children:s.jsx(mre,{id:n.id,children:t??s.jsx("p",{className:"flex-1 truncate text-xs",children:n.name})})}),e&&s.jsx(_l,{modifiers:[Ch],onDragEnd:_,onDragMove:P,sensors:[k],children:s.jsx(Uw,{date:d?Ek(d,1):p(l,1),direction:"right",featureId:n.id})})]})})},Eh=({children:e,className:t})=>s.jsx("div",{className:t,style:{paddingTop:"var(--gantt-row-height)"},children:e}),hre=({className:e,children:t})=>s.jsx("div",{className:z("absolute top-0 left-0 h-full w-max space-y-4",e),style:{marginTop:"var(--gantt-header-height)"},children:t}),sE=h.memo(({label:e,date:t,id:r,onRemove:n,className:a})=>{const i=h.useContext(Vn),o=h.useMemo(()=>Fc(i.range),[i.range]),l=h.useMemo(()=>{var f;return new Date(((f=i.timelineData.at(0))==null?void 0:f.year)??0,0,1)},[i.timelineData]),c=h.useMemo(()=>o(t,l),[o,t,l]),d=h.useMemo(()=>nE(t,i.range,i.columnWidth*i.zoom/100),[t,i.range,i.columnWidth,i.zoom]),u=h.useCallback(()=>n==null?void 0:n(r),[n,r]);return s.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${c} + ${d}px))`},children:[s.jsxs(Ute,{children:[s.jsx(Hte,{asChild:!0,children:s.jsxs("div",{className:z("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",a),children:[e,s.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:fe(t,"MMM dd, yyyy")})]})}),s.jsx(JO,{children:n?s.jsxs(eE,{className:"flex items-center gap-2 text-destructive",onClick:u,children:[s.jsx(jD,{size:16}),"Remove marker"]}):null})]}),s.jsx("div",{className:z("h-full w-px bg-card",a)})]})});sE.displayName="GanttMarker";const pre=({zoom:e=100,range:t="monthly",onAddItem:r,children:n,className:a})=>{const i=h.useRef(null),[o,l]=h.useState(rre(new Date)),[,c]=qv(),[d,u]=h.useState(0),f=60,m=36;let p=50;t==="monthly"?p=150:t==="quarterly"&&(p=100);const x=h.useMemo(()=>({"--gantt-zoom":`${e}`,"--gantt-column-width":`${e/100*p}px`,"--gantt-header-height":`${f}px`,"--gantt-row-height":`${m}px`,"--gantt-sidebar-width":`${d}px`}),[e,p,d]);h.useEffect(()=>{i.current&&(i.current.scrollLeft=i.current.scrollWidth/2-i.current.clientWidth/2,c(i.current.scrollLeft))},[c]),h.useEffect(()=>{const y=()=>{var k;const j=((k=i.current)==null?void 0:k.querySelector('[data-roadmap-ui="gantt-sidebar"]'))?300:0;u(j)};y();const b=new MutationObserver(y);return i.current&&b.observe(i.current,{childList:!0,subtree:!0}),()=>{b.disconnect()}},[]);const g=h.useCallback(lte(()=>{var k,w;const y=i.current;if(!y)return;const{scrollLeft:b,scrollWidth:N,clientWidth:j}=y;if(c(b),b===0){const S=(k=o[0])==null?void 0:k.year;if(!S)return;const _=[...o];_.unshift({year:S-1,quarters:new Array(4).fill(null).map((C,P)=>({months:new Array(3).fill(null).map((O,E)=>{const D=P*3+E;return{days:Ia(new Date(S,D,1))}})}))}),l(_),y.scrollLeft=y.clientWidth,c(y.scrollLeft)}else if(b+j>=N){const S=(w=o.at(-1))==null?void 0:w.year;if(!S)return;const _=[...o];_.push({year:S+1,quarters:new Array(4).fill(null).map((C,P)=>({months:new Array(3).fill(null).map((O,E)=>{const D=P*3+E;return{days:Ia(new Date(S,D,1))}})}))}),l(_),y.scrollLeft=y.scrollWidth-y.clientWidth,c(y.scrollLeft)}},100),[]);h.useEffect(()=>{const y=i.current;return y&&y.addEventListener("scroll",g),()=>{y&&y.removeEventListener("scroll",g)}},[g]);const v=h.useCallback(y=>{const b=i.current;if(!b)return;const N=new Date(o[0].year,0,1),j=rE(y.startAt,N,{zoom:e,range:t,columnWidth:p}),k=Math.max(0,j);b.scrollTo({left:k,behavior:"smooth"})},[o,e,t,p,d,r]);return s.jsx(Vn.Provider,{value:{zoom:e,range:t,headerHeight:f,columnWidth:p,sidebarWidth:d,rowHeight:m,onAddItem:r,timelineData:o,placeholderLength:2,ref:i,scrollToFeature:v},children:s.jsx("div",{className:z("gantt relative isolate grid h-full w-full flex-none select-none overflow-auto rounded-sm bg-secondary",t,a),ref:i,style:{...x,gridTemplateColumns:"var(--gantt-sidebar-width) 1fr"},children:n})})},xre=({children:e,className:t})=>s.jsx("div",{className:z("relative flex h-full w-max flex-none overflow-clip",t),children:e}),gre=({className:e})=>{const t="Today",r=h.useMemo(()=>new Date,[]),n=h.useContext(Vn),a=h.useMemo(()=>Fc(n.range),[n.range]),i=h.useMemo(()=>{var c;return new Date(((c=n.timelineData.at(0))==null?void 0:c.year)??0,0,1)},[n.timelineData]),o=h.useMemo(()=>a(r,i),[a,r,i]),l=h.useMemo(()=>nE(r,n.range,n.columnWidth*n.zoom/100),[r,n.range,n.columnWidth,n.zoom]);return s.jsxs("div",{className:"pointer-events-none absolute top-0 left-0 z-20 flex h-full select-none flex-col items-center justify-center overflow-visible",style:{width:0,transform:`translateX(calc(var(--gantt-column-width) * ${o} + ${l}px))`},children:[s.jsxs("div",{className:z("group pointer-events-auto sticky top-0 flex select-auto flex-col flex-nowrap items-center justify-center whitespace-nowrap rounded-b-md bg-card px-2 py-1 text-foreground text-xs",e),children:[t,s.jsx("span",{className:"max-h-[0] overflow-hidden opacity-80 transition-all group-hover:max-h-[2rem]",children:fe(r,"MMM dd, yyyy")})]}),s.jsx("div",{className:z("h-full w-px bg-card",e)})]})};function vre(e){return Te({queryKey:["public","share",e],queryFn:()=>ie.get(`/public/share/${e}`),select:t=>t.project,enabled:!!e,retry:!1})}function Kv(e,t={}){const r=new URLSearchParams;t.status&&r.set("status",t.status),t.priority&&r.set("priority",t.priority),t.search&&r.set("search",t.search);const n=r.toString()?`?${r.toString()}`:"";return Te({queryKey:["public","share",e,"issues",t],queryFn:()=>ie.get(`/public/share/${e}/issues${n}`),select:a=>a.issues,enabled:!!e,retry:!1})}function aE(e){return Te({queryKey:["public","share",e,"sprints"],queryFn:()=>ie.get(`/public/share/${e}/sprints`),select:t=>t.sprints,enabled:!!e,retry:!1})}function yre({priority:e,className:t}){const r=z("h-3.5 w-3.5 shrink-0",gc[e],t);switch(e){case"urgent":return s.jsx(gs,{className:r});case"high":return s.jsx(Pi,{className:r});case"medium":return s.jsx(Js,{className:r});case"low":return s.jsx(_i,{className:r});default:return s.jsx(Er,{className:z("h-3.5 w-3.5 shrink-0 text-zinc-300",t)})}}const Zp="grid-cols-[70px_250px_150px_120px_130px_140px_130px]";function iE({issue:e,statuses:t,statusLabels:r,statusColorMap:n,sprints:a,isChild:i=!1,children:o=[],childrenMap:l}){const[c,d]=h.useState(!1),u=o.length>0,f=n[e.status]??"#94a3b8",m=a.find(p=>p.id===e.sprint_id);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:z(`group grid ${Zp} items-center py-3`,"hover:bg-[#f9fafb] dark:hover:bg-muted/30 transition-colors",i&&"bg-muted/10"),children:[s.jsx("span",{className:z("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",i&&"text-muted-foreground/60"),children:e.identifier}),s.jsxs("div",{className:z("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",i&&"bg-[#f8f9fa] dark:bg-muted/20"),children:[u?s.jsxs(ls,{children:[s.jsx(cs,{asChild:!0,children:s.jsx("button",{onClick:()=>d(!c),className:"shrink-0 text-muted-foreground hover:text-foreground transition-colors p-0.5 rounded",children:c?s.jsx(Zs,{className:"h-3.5 w-3.5"}):s.jsx(pr,{className:"h-3.5 w-3.5"})})}),s.jsx(Wn,{side:"top",children:c?"Collapse":"Expand"})]}):i?s.jsx(Ds,{className:"h-3 w-3 text-muted-foreground/40 shrink-0"}):s.jsx("span",{className:"w-4 shrink-0"}),s.jsx("span",{className:z("text-sm text-foreground truncate",i&&"text-muted-foreground"),children:e.title}),u&&s.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:[s.jsx(Ds,{className:"h-2.5 w-2.5"}),o.length]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1 max-w-full",children:[s.jsx("span",{className:"h-2 w-2 rounded-full shrink-0",style:{backgroundColor:f}}),s.jsx("span",{className:"text-xs text-muted-foreground truncate",children:r[e.status]??e.status})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1",children:[s.jsx(yre,{priority:e.priority}),s.jsx("span",{className:"text-xs text-muted-foreground",children:dn[e.priority]??e.priority})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1 max-w-full",children:[s.jsx(Gr,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),s.jsx("span",{className:z("text-xs truncate",m?"text-foreground":"text-muted-foreground/50"),children:(m==null?void 0:m.name)??"—"})]}),s.jsxs("div",{className:"flex items-center gap-1.5 px-1.5 py-1",children:[s.jsx(Ht,{className:"h-3.5 w-3.5 text-muted-foreground/50 shrink-0"}),s.jsx("span",{className:z("text-xs",e.due_date?"text-foreground":"text-muted-foreground/50"),children:e.due_date?fe(new Date(e.due_date),"MMM d, yyyy"):"—"})]}),s.jsx("div",{className:"flex items-center px-1.5",children:s.jsx("div",{className:"flex -space-x-1.5",children:(e.assignees??[]).slice(0,3).map(p=>s.jsx("div",{title:p.name,className:"h-5 w-5 rounded-full bg-indigo-100 dark:bg-indigo-900 border border-white dark:border-card flex items-center justify-center text-[10px] font-medium text-indigo-700 dark:text-indigo-300",children:p.initials},p.id))})})]}),c&&o.map(p=>s.jsx(iE,{issue:p,statuses:t,statusLabels:r,statusColorMap:n,sprints:a,isChild:!0,children:(l==null?void 0:l[p.id])??[],childrenMap:l},p.id))]})}function bre({issues:e,childrenMap:t,statuses:r,statusLabels:n,statusColorMap:a,sprints:i,totalCount:o}){const[l,c]=h.useState(!1);return s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 px-6 py-2 bg-muted/20 border-b border-border",children:[s.jsx("button",{onClick:()=>c(!l),className:"text-muted-foreground hover:text-foreground transition-colors",children:l?s.jsx(pr,{className:"h-3.5 w-3.5"}):s.jsx(Zs,{className:"h-3.5 w-3.5"})}),s.jsx("span",{className:"text-xs font-semibold text-muted-foreground",children:"Issues"}),s.jsx("span",{className:"text-[11px] text-muted-foreground/60 font-mono",children:o})]}),!l&&s.jsx("div",{className:"divide-y divide-border/60",children:e.length===0?s.jsx("div",{className:"px-14 py-5 text-xs text-muted-foreground/50 italic",children:"No issues match your filters"}):e.map(d=>s.jsx(iE,{issue:d,statuses:r,statusLabels:n,statusColorMap:a,sprints:i,children:t[d.id]??[],childrenMap:t},d.id))})]})}function jre({token:e,statuses:t}){const[r,n]=h.useState("all"),[a,i]=h.useState("all"),[o,l]=h.useState("all"),[c,d]=h.useState(""),{data:u=[],isLoading:f}=Kv(e),{data:m=[]}=aE(e),p=Object.fromEntries(t.map(N=>[N.key,N.name])),x=Object.fromEntries(t.map(N=>[N.key,N.color])),g={};for(const N of u)N.parent_id&&(g[N.parent_id]||(g[N.parent_id]=[]),g[N.parent_id].push(N));const v=u.filter(N=>!N.parent_id).filter(N=>{const j=c.toLowerCase(),k=!c||N.title.toLowerCase().includes(j)||N.identifier.toLowerCase().includes(j),w=r==="all"||N.status===r,S=a==="all"||N.priority===a,_=o==="all"?!0:o==="none"?!N.sprint_id:N.sprint_id===o;return k&&w&&S&&_}).sort((N,j)=>{const k=parseInt(N.identifier.split("-")[1]??"0",10),w=parseInt(j.identifier.split("-")[1]??"0",10);return k-w}),y=v.reduce((N,j)=>{var k;return N+(((k=g[j.id])==null?void 0:k.length)??0)},0),b=v.length+y;return s.jsx("div",{className:"p-2",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-3 border-b border-border gap-3 flex-wrap",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs(Ue,{value:o,onValueChange:l,children:[s.jsx(Le,{className:"h-8 text-xs w-[140px] bg-transparent",children:s.jsx(Ve,{placeholder:"Sprint"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All sprints"}),s.jsx(ke,{value:"none",className:"text-xs text-muted-foreground",children:"No sprint"}),m.map(N=>s.jsx(ke,{value:N.id,className:"text-xs",children:N.name},N.id))]})]}),s.jsxs(Ue,{value:r,onValueChange:n,children:[s.jsx(Le,{className:"h-8 text-xs w-[130px] bg-transparent",children:s.jsx(Ve,{placeholder:"Status"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All statuses"}),t.map(({key:N,name:j})=>s.jsx(ke,{value:N,className:"text-xs",children:j},N))]})]}),s.jsxs(Ue,{value:a,onValueChange:i,children:[s.jsx(Le,{className:"h-8 text-xs w-[130px] bg-transparent",children:s.jsx(Ve,{placeholder:"Priority"})}),s.jsxs(Fe,{children:[s.jsx(ke,{value:"all",className:"text-xs",children:"All priorities"}),Object.entries(dn).map(([N,j])=>s.jsx(ke,{value:N,className:"text-xs",children:j},N))]})]})]}),s.jsxs("div",{className:"relative",children:[s.jsx(za,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground pointer-events-none"}),s.jsx(_e,{placeholder:"Search...",value:c,onChange:N=>d(N.target.value),className:"pl-8 h-8 w-[200px] text-xs bg-transparent"})]})]}),s.jsx("div",{className:"overflow-x-auto",children:s.jsxs("div",{className:"min-w-[900px]",children:[s.jsxs("div",{className:z("grid items-center py-2.5 border-b border-border",Zp),children:[s.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-0 z-10 bg-white dark:bg-card pl-6",children:"ID"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280] sticky left-[70px] z-10 bg-white dark:bg-card",children:"Title"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Status"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Priority"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Sprint"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Due Date"}),s.jsx("span",{className:"text-xs font-medium text-[#6b7280]",children:"Assignees"})]}),f?s.jsx("div",{className:"divide-y divide-border",children:[1,2,3,4].map(N=>s.jsxs("div",{className:z("grid items-center px-6 py-3 gap-4",Zp),children:[s.jsx(le,{className:"h-4 w-14"}),s.jsx(le,{className:"h-4 w-56"}),s.jsx(le,{className:"h-5 w-20"}),s.jsx(le,{className:"h-4 w-16"}),s.jsx(le,{className:"h-4 w-20"}),s.jsx(le,{className:"h-4 w-24"}),s.jsx(le,{className:"h-6 w-16"})]},N))}):u.length===0?s.jsx("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:s.jsx("p",{className:"text-sm font-medium mb-1",children:"No issues yet"})}):s.jsx(Ku,{delayDuration:200,children:s.jsx(bre,{issues:v,childrenMap:g,statuses:t,statusLabels:p,statusColorMap:x,sprints:m,totalCount:b})})]})}),!f&&b>0&&s.jsx("div",{className:"flex items-center px-6 py-3 border-t border-border",children:s.jsxs("span",{className:"text-xs text-muted-foreground",children:[b," issue",b!==1?"s":""]})})]})})}function bd(e,t){const r=e.start_date?new Date(e.start_date):new Date(e.due_date),n=e.due_date?Yr(new Date(e.due_date),1):Yr(r,1);return{id:e.id,name:`${e.identifier} ${e.title}`,startAt:r,endAt:n,status:{id:e.status,name:e.status,color:t}}}function wre({token:e,statuses:t}){const[r,n]=h.useState("monthly"),a=h.useRef(null),{data:i=[]}=Kv(e),{data:o=[]}=aE(e);h.useEffect(()=>{const m=requestAnimationFrame(()=>{var b;const p=(b=a.current)==null?void 0:b.querySelector(".gantt");if(!p)return;const x=new Date,g=x.getFullYear()-1,v=300;let y;if(r==="daily")y=Math.floor((x.getTime()-new Date(g,0,1).getTime())/864e5)*50;else{const N=r==="monthly"?150:100,j=(x.getFullYear()-g)*12+x.getMonth(),k=new Date(x.getFullYear(),x.getMonth()+1,0).getDate();y=j*N+(x.getDate()-1)/k*N}p.scrollLeft=Math.max(0,y-(p.clientWidth-v)/2)});return()=>cancelAnimationFrame(m)},[r]);const l=Object.fromEntries(t.map(m=>[m.key,m.color])),c=i.filter(m=>m.due_date),d=i.filter(m=>!m.due_date),u={},f=[];for(const m of c)m.sprint_id?(u[m.sprint_id]||(u[m.sprint_id]=[]),u[m.sprint_id].push(m)):f.push(m);return s.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[s.jsx("div",{className:"flex items-center px-6 py-3 border-b border-border shrink-0 bg-white dark:bg-zinc-950",children:s.jsx("div",{className:"flex items-center gap-1 bg-muted rounded-md p-0.5",children:["daily","monthly","quarterly"].map(m=>s.jsx("button",{onClick:()=>n(m),className:`px-3 py-1 rounded text-xs font-medium transition-colors capitalize ${r===m?"bg-white dark:bg-zinc-900 text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:m},m))})}),s.jsx("div",{ref:a,className:"flex-1 min-h-0 overflow-hidden",children:s.jsxs(pre,{range:r,zoom:100,className:"h-full bg-white dark:bg-zinc-950",children:[s.jsxs(dre,{children:[o.map(m=>{const p=u[m.id]??[];return s.jsx(Oh,{name:m.name,children:p.map(x=>s.jsx(Mh,{feature:bd(x,l[x.status]??"#94a3b8")},x.id))},m.id)}),f.length>0&&s.jsx(Oh,{name:"No Sprint",children:f.map(m=>s.jsx(Mh,{feature:bd(m,l[m.status]??"#94a3b8")},m.id))}),d.length>0&&s.jsx(Oh,{name:"Unscheduled",children:d.map(m=>s.jsx(Mh,{feature:{id:m.id,name:`${m.identifier} ${m.title}`,startAt:new Date,endAt:new Date,status:{id:m.status,name:m.status,color:l[m.status]??"#94a3b8"}}},m.id))})]}),s.jsxs(xre,{children:[s.jsx(lre,{}),s.jsxs(hre,{children:[o.map(m=>s.jsx(Eh,{children:(u[m.id]??[]).map(p=>s.jsx("div",{className:"flex",children:s.jsx(Hw,{...bd(p,l[p.status]??"#94a3b8")})},p.id))},m.id)),f.length>0&&s.jsx(Eh,{children:f.map(m=>s.jsx("div",{className:"flex",children:s.jsx(Hw,{...bd(m,l[m.status]??"#94a3b8")})},m.id))}),d.length>0&&s.jsx(Eh,{children:d.map(m=>s.jsx("div",{style:{height:"var(--gantt-row-height)"}},m.id))})]}),o.filter(m=>m.end_date).map(m=>s.jsx(sE,{id:m.id,date:new Date(m.end_date),label:`${m.name} end`},m.id)),s.jsx(gre,{})]})]})})]})}function Nre(){const{token:e}=Et(),[t,r]=h.useState("board"),{data:n,isLoading:a,isError:i}=vre(e??""),{data:o}=Kv(e??"");if(!e)return null;if(a)return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("span",{className:"text-sm text-muted-foreground",children:"Loading…"})});if(i||!n)return s.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-3",children:[s.jsx("p",{className:"text-lg font-semibold",children:"Link not found"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This share link is invalid or has been revoked."})]});const l=[{key:"board",label:"Board"},{key:"issues",label:"Issues"},{key:"timeline",label:"Timeline"}];return s.jsxs("div",{className:"h-screen flex flex-col bg-background overflow-hidden",children:[s.jsx("header",{className:"border-b border-border px-6 py-3 bg-white dark:bg-card shrink-0",children:s.jsxs("div",{className:"flex items-center gap-3",children:[n.icon&&s.jsx("span",{className:"text-xl",children:n.icon}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-xs font-mono text-indigo-700 dark:text-indigo-300 bg-indigo-50 dark:bg-indigo-950/50 border border-indigo-200 dark:border-indigo-800 px-2 py-0.5 rounded",children:n.identifier}),s.jsx("h1",{className:"text-sm font-semibold",children:n.name})]}),s.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Read-only view"})]})}),s.jsx("div",{className:"border-b border-border bg-white dark:bg-card px-6 shrink-0",children:s.jsx("div",{className:"flex -mb-px",children:l.map(({key:c,label:d})=>s.jsx("button",{onClick:()=>r(c),className:`px-3 py-2 text-sm border-b-2 transition-colors ${t===c?"border-foreground text-foreground font-medium":"border-transparent text-muted-foreground hover:text-foreground"}`,children:d},c))})}),s.jsxs("div",{className:`flex-1 min-h-0 ${t==="timeline"?"overflow-hidden":"overflow-auto"}`,children:[t==="board"&&s.jsx(Ik,{issues:o??[],projectId:n.id,statuses:n.statuses,readOnly:!0}),t==="issues"&&s.jsx(jre,{token:e,statuses:n.statuses}),t==="timeline"&&s.jsx(wre,{token:e,statuses:n.statuses})]})]})}const kre=new URLSearchParams(window.location.search);function Sre(){const[e,t]=h.useState(null),r=ct(),n=De(),a=h.useRef(!1);if(h.useEffect(()=>{if(a.current)return;a.current=!0;const i=kre;if(history.replaceState(null,"",window.location.pathname),i.get("linked")==="true"){r("/profile?linked=true",{replace:!0});return}const l=i.get("error");if(l){t(decodeURIComponent(l));return}const c=i.get("code");if(!c){t("No authorization code received from Google sign-in");return}(async()=>{const u=await fetch(`${ro}/auth/google/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:c})});if(!u.ok)throw new Error(`Code exchange failed (${u.status}). Please try signing in again.`);const{token:f}=await u.json(),m=await fetch(`${ro}/admin/users/me`,{headers:{Authorization:`Bearer ${f}`}});if(!m.ok)throw new Error(`Failed to load user profile (${m.status})`);const p=await m.json();n.login({id:p.id,email:p.email,first_name:p.first_name??"",last_name:p.last_name??"",avatar_url:p.avatar_url},f),r("/",{replace:!0})})().catch(u=>t(u.message??"Failed to complete sign-in"))},[]),e){const i=e.startsWith("GOOGLE_NOT_LINKED:"),o=i?e.replace("GOOGLE_NOT_LINKED: ",""):e;return s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[400px] bg-white dark:bg-card border border-border rounded-xl p-6 text-center space-y-4",children:[s.jsx("p",{className:"text-sm font-medium",children:i?"Google account not connected":"Sign-in failed"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:o}),i?s.jsxs("div",{className:"flex flex-col gap-2 pt-1",children:[s.jsx(Rt,{to:"/login",children:s.jsx(ee,{className:"w-full",size:"sm",children:"Sign in with email & password"})}),s.jsxs("p",{className:"text-xs text-muted-foreground",children:["After signing in, go to ",s.jsx("strong",{children:"Profile"})," → ",s.jsx("strong",{children:"Connections"})," to link your Google account."]})]}):s.jsx(Rt,{to:"/login",children:s.jsx(ee,{variant:"outline",size:"sm",children:"Back to login"})})]})})}return s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx("span",{className:"text-sm text-muted-foreground",children:"Completing sign-in..."})})}function Kw({className:e}){return s.jsxs("svg",{className:e??"size-4",viewBox:"0 0 24 24","aria-hidden":"true",children:[s.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"}),s.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"}),s.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"}),s.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 Cre(){var $,ne,B,X;const[e,t]=ec(),{user:r}=De(),{data:n,isLoading:a}=vO(),i=XJ(),o=QJ(),l=ZJ(),c=tee(),d=JJ(),u=eee(),f=h.useRef(null),[m,p]=h.useState(""),[x,g]=h.useState(""),[v,y]=h.useState(""),[b,N]=h.useState(""),[j,k]=h.useState(!1),[w,S]=h.useState(!1),[_,C]=h.useState(""),[P,O]=h.useState(""),[E,D]=h.useState(""),[I,V]=h.useState(!1),[Q,q]=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"&&(F.success("Google account connected successfully"),t(oe=>(oe.delete("linked"),oe),{replace:!0}))},[e,t]);const se=r&&(`${(($=r.first_name)==null?void 0:$[0])??""}${((ne=r.last_name)==null?void 0:ne[0])??""}`.toUpperCase()||((X=(B=r.email)==null?void 0:B[0])==null?void 0:X.toUpperCase()))||"?",T=oe=>{var te;const G=(te=oe.target.files)==null?void 0:te[0];G&&(o.mutate(G,{onSuccess:()=>F.success("Avatar updated"),onError:de=>F.error(de.message??"Failed to upload avatar")}),oe.target.value="")},M=()=>{l.mutate(void 0,{onSuccess:()=>F.success("Avatar removed"),onError:oe=>F.error(oe.message??"Failed to remove avatar")})},L=()=>{i.mutate({first_name:m,last_name:x,designation:v||null,phone_number:b||null},{onSuccess:()=>F.success("Profile updated"),onError:oe=>F.error(oe.message??"Failed to update profile")})},H=()=>{const oe=localStorage.getItem("meridian_token");if(!oe){F.error("You must be logged in to connect Google");return}window.location.href=`${ro}/auth/google/link?token=${encodeURIComponent(oe)}`},R=()=>{c.mutate(void 0,{onSuccess:()=>F.success("Google account disconnected"),onError:oe=>F.error(oe.message??"Failed to unlink Google account")})},Y=h.useCallback(()=>{q(30),re.current&&clearInterval(re.current),re.current=setInterval(()=>{q(oe=>oe<=1?(re.current&&clearInterval(re.current),0):oe-1)},1e3)},[]);h.useEffect(()=>()=>{re.current&&clearInterval(re.current)},[]);const J=()=>{d.mutate(void 0,{onSuccess:()=>{S(!0),Y(),F.success("Verification code sent to your email")},onError:oe=>F.error(oe.message??"Failed to send verification code")})},A=()=>{if(P.length<8){F.error("New password must be at least 8 characters");return}if(P!==E){F.error("Passwords do not match");return}u.mutate({otp:_,new_password:P},{onSuccess:()=>{F.success("Password updated"),U()},onError:oe=>F.error(oe.message??"Failed to set password")})},U=()=>{k(!1),S(!1),C(""),O(""),D(""),V(!1),q(0),re.current&&clearInterval(re.current)};return s.jsx("div",{className:"p-2 md:h-full",children:s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-xl overflow-hidden flex flex-col md:h-full",children:[s.jsx("div",{className:"flex items-center justify-between px-6 py-4 border-b border-border shrink-0",children:s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ic,{className:"h-5 w-5 text-muted-foreground"}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-base font-semibold",children:"Profile"}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Manage your personal details and account connections."})]})]})}),s.jsxs("div",{className:"flex-1 overflow-y-auto",children:[s.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:[s.jsx("span",{className:"text-sm text-muted-foreground shrink-0",children:"Profile photo"}),s.jsxs("div",{className:"flex flex-1 items-center gap-4",children:[s.jsxs("div",{className:"relative",children:[s.jsxs(Pt,{className:"h-14 w-14 rounded-xl",children:[n!=null&&n.avatar_url?s.jsx(Dl,{src:n.avatar_url,alt:"Avatar",className:"object-cover"}):null,s.jsx(Mt,{className:"rounded-xl bg-foreground text-background text-base font-medium",children:se})]}),o.isPending&&s.jsx("div",{className:"absolute inset-0 rounded-xl bg-black/40 flex items-center justify-center",children:s.jsx("span",{className:"text-white text-[10px]",children:"…"})})]}),s.jsxs("div",{className:"flex gap-2",children:[s.jsxs(ee,{variant:"outline",size:"sm",className:"h-8 gap-1.5",onClick:()=>{var oe;return(oe=f.current)==null?void 0:oe.click()},disabled:o.isPending,children:[s.jsx(X5,{className:"size-3.5"}),"Change photo"]}),(n==null?void 0:n.avatar_url)&&s.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 gap-1.5 text-muted-foreground hover:text-destructive",onClick:M,disabled:l.isPending,children:[s.jsx(jr,{className:"size-3.5"}),"Remove"]})]}),s.jsx("input",{ref:f,type:"file",accept:"image/*",className:"hidden",onChange:T})]})]}),s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Personal information"})}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"First name"}),a?s.jsx(le,{className:"h-8 w-56"}):s.jsx(_e,{value:m,onChange:oe=>p(oe.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"First name"})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Last name"}),a?s.jsx(le,{className:"h-8 w-56"}):s.jsx(_e,{value:x,onChange:oe=>g(oe.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"Last name"})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Email"}),a?s.jsx(le,{className:"h-4 w-48"}):s.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.email)??"—"})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Designation"}),a?s.jsx(le,{className:"h-8 w-56"}):s.jsx(_e,{value:v,onChange:oe=>y(oe.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"e.g. Software Engineer"})]}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Phone number"}),a?s.jsx(le,{className:"h-8 w-56"}):s.jsx(_e,{value:b,onChange:oe=>N(oe.target.value),className:"h-8 w-full max-w-64 text-sm bg-transparent",placeholder:"+1 555 000 0000"})]}),s.jsx("div",{className:"flex justify-end px-6 py-4 border-b border-border",children:s.jsx(ee,{size:"sm",onClick:L,disabled:i.isPending,children:i.isPending?"Saving…":"Save changes"})}),s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Connections"})}),s.jsx("div",{className:"px-4 md:px-6 py-3.5 border-b border-border",children:a?s.jsx(le,{className:"h-8 w-48"}):n!=null&&n.google_id?s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[s.jsx(Kw,{className:"size-3.5 shrink-0"}),s.jsx("span",{className:"text-foreground font-medium",children:"Google"}),s.jsx(kn,{className:"size-3.5 text-emerald-500 shrink-0"}),s.jsx("span",{className:"text-foreground font-medium",children:"Connected"})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-sm text-muted-foreground truncate flex-1",children:n.email}),s.jsxs(ee,{size:"sm",className:"h-7 gap-1.5 bg-red-600 hover:bg-red-700 text-white shrink-0",onClick:R,disabled:c.isPending,children:[s.jsx(ux,{className:"size-3.5"}),"Disconnect"]})]})]}):s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(Kw,{className:"size-3.5 shrink-0"}),s.jsx("span",{className:"text-sm font-medium",children:"Google"}),s.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"}),s.jsx(ee,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:H,children:"Connect"})]})}),s.jsx("div",{className:"px-6 py-2 border-b border-border bg-muted/10",children:s.jsx("p",{className:"text-xs text-muted-foreground",children:"Security"})}),s.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:[s.jsx("span",{className:"text-sm text-muted-foreground",children:"Password"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx("span",{className:"text-sm text-muted-foreground",children:(n==null?void 0:n.has_password)===!1?"No password set":"••••••••"}),s.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 gap-1.5",onClick:()=>k(!0),children:[s.jsx(oD,{className:"size-3.5"}),(n==null?void 0:n.has_password)===!1?"Create password":"Change password"]})]})]}),s.jsx(mn,{open:j,onOpenChange:oe=>{oe||U()},children:s.jsxs(Zr,{className:"sm:max-w-md",children:[s.jsxs(hn,{children:[s.jsx(pn,{children:(n==null?void 0:n.has_password)===!1?"Create password":"Change password"}),s.jsxs(Eo,{children:["We'll send a 6-digit verification code to ",s.jsx("span",{className:"font-medium text-foreground",children:n==null?void 0:n.email})]})]}),s.jsxs("div",{className:"space-y-4 py-2",children:[s.jsxs("div",{className:"space-y-2",children:[s.jsx(at,{className:"text-sm",children:"Verification code"}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs(Mx,{maxLength:6,value:_,onChange:C,children:[s.jsxs(Fd,{children:[s.jsx(sn,{index:0}),s.jsx(sn,{index:1}),s.jsx(sn,{index:2})]}),s.jsx(VN,{}),s.jsxs(Fd,{children:[s.jsx(sn,{index:3}),s.jsx(sn,{index:4}),s.jsx(sn,{index:5})]})]}),w?Q>0?s.jsxs("span",{className:"text-xs text-muted-foreground shrink-0 tabular-nums w-16 text-center",children:["Resend in ",Q,"s"]}):s.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 shrink-0 text-indigo-500 hover:text-indigo-600",onClick:J,disabled:d.isPending,children:d.isPending?"Sending…":"Resend"}):s.jsx(ee,{variant:"outline",size:"sm",className:"h-8 shrink-0",onClick:J,disabled:d.isPending,children:d.isPending?"Sending…":"Send code"})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(at,{className:"text-sm",children:"New password"}),s.jsxs("div",{className:"relative",children:[s.jsx(_e,{type:I?"text":"password",value:P,onChange:oe=>O(oe.target.value),className:"h-9 text-sm pr-9",placeholder:"At least 8 characters",autoComplete:"new-password"}),s.jsx("button",{type:"button",onClick:()=>V(!I),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",tabIndex:-1,children:I?s.jsx(ac,{className:"size-3.5"}):s.jsx(Mi,{className:"size-3.5"})})]})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsx(at,{className:"text-sm",children:"Confirm password"}),s.jsx(_e,{type:"password",value:E,onChange:oe=>D(oe.target.value),className:"h-9 text-sm",placeholder:"Re-enter new password",autoComplete:"new-password"})]})]}),s.jsxs(Oo,{children:[s.jsx(ee,{variant:"ghost",size:"sm",onClick:U,children:"Cancel"}),s.jsx(ee,{size:"sm",onClick:A,disabled:u.isPending||_.length!==6||!P||!E,children:u.isPending?"Saving…":(n==null?void 0:n.has_password)===!1?"Create password":"Update password"})]})]})})]})]})})}function _re(){const[e,t]=h.useState(""),[r,n]=h.useState(!1),a=VD(),i=o=>{o.preventDefault(),a.mutate({email:e},{onSuccess:()=>n(!0),onError:l=>F.error(l.message??"Something went wrong")})};return s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[360px]",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[s.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:s.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:s.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:s.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:r?"Check your email":"Forgot password?"}),s.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?s.jsxs("div",{className:"space-y-4",children:[s.jsx("p",{className:"text-sm text-center text-muted-foreground",children:"Didn't receive an email? Check your spam folder or try again."}),s.jsx(ee,{variant:"outline",className:"w-full h-10",onClick:()=>{n(!1),t("")},children:"Try again"})]}):s.jsxs("form",{onSubmit:i,className:"space-y-2",children:[s.jsx(_e,{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}),s.jsx("div",{className:"pt-1",children:s.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:a.isPending,children:a.isPending?"Sending...":"Send reset link"})})]}),s.jsx("div",{className:"mt-6 text-center",children:s.jsxs(Rt,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx($a,{className:"size-3.5"}),"Back to login"]})})]})})}function Pre(){const[e]=ec(),t=e.get("token")??"",r=ct(),n=XD(),[a,i]=h.useState(""),[o,l]=h.useState(""),[c,d]=h.useState(!1),u=f=>{if(f.preventDefault(),a.length<8){F.error("Password must be at least 8 characters");return}if(a!==o){F.error("Passwords do not match");return}n.mutate({token:t,password:a},{onSuccess:()=>{F.success("Password has been reset. Please sign in."),r("/login",{replace:!0})},onError:m=>F.error(m.message??"Failed to reset password")})};return t?s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[360px]",children:[s.jsxs("div",{className:"flex flex-col items-center gap-4 mb-8",children:[s.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:s.jsx("div",{className:"h-10 w-10 rounded-full bg-foreground flex items-center justify-center",children:s.jsx("div",{className:"h-5 w-5 rounded-full bg-background/20 flex items-center justify-center",children:s.jsx("div",{className:"h-2 w-2 rounded-full bg-background/60"})})})}),s.jsxs("div",{className:"text-center",children:[s.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Set new password"}),s.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Enter your new password below."})]})]}),s.jsxs("form",{onSubmit:u,className:"space-y-2",children:[s.jsxs("div",{className:"relative",children:[s.jsx(_e,{type:c?"text":"password",placeholder:"New password",value:a,onChange:f=>i(f.target.value),autoComplete:"new-password",required:!0,className:"bg-white dark:bg-card h-10 pr-10",autoFocus:!0}),s.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?s.jsx(ac,{className:"h-4 w-4"}):s.jsx(Mi,{className:"h-4 w-4"})})]}),s.jsx(_e,{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"}),s.jsx("div",{className:"pt-1",children:s.jsx(ee,{type:"submit",className:"w-full h-10 font-medium",disabled:n.isPending,children:n.isPending?"Resetting...":"Reset password"})})]}),s.jsx("div",{className:"mt-6 text-center",children:s.jsxs(Rt,{to:"/login",className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx($a,{className:"size-3.5"}),"Back to login"]})})]})}):s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[360px] text-center space-y-4",children:[s.jsx("p",{className:"text-sm font-medium",children:"Invalid reset link"}),s.jsx("p",{className:"text-sm text-muted-foreground",children:"This link is missing or expired."}),s.jsx(Rt,{to:"/forgot-password",children:s.jsx(ee,{variant:"outline",size:"sm",children:"Request a new link"})})]})})}function Mre(){const{projectKey:e,workspace:t}=Et(),[r,n]=h.useState(""),[a,i]=h.useState(!1),o=GT(),l=VT(),c=()=>{e&&o.mutate({identifier:e,message:r.trim()||void 0},{onSuccess:()=>i(!0),onError:u=>{u instanceof nc&&u.status===409?i(!0):F.error(u instanceof Error?u.message:"Failed to send request")}})},d=()=>{e&&l.mutate(e,{onSuccess:()=>{i(!1),n(""),F.success("Request cancelled")},onError:()=>F.error("Failed to cancel request")})};return s.jsx("div",{className:"flex flex-col items-center justify-center flex-1 px-4 py-12",children:s.jsxs("div",{className:"w-full max-w-[400px] space-y-6",children:[s.jsxs(Rt,{to:`/${t}/projects`,className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[s.jsx($a,{className:"h-3.5 w-3.5"}),"Back to projects"]}),s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[s.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:s.jsx(Sn,{className:"h-6 w-6 text-muted-foreground"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-lg font-semibold",children:e}),s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"You don't have access to this project. Request access from the project managers."})]})]}),a?s.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ar,{className:"h-4 w-4 text-amber-600 shrink-0"}),s.jsx("span",{className:"text-sm font-medium text-amber-800 dark:text-amber-300",children:"Request pending"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Your request has been sent to the project managers. You'll be notified when it's approved."}),s.jsxs(ee,{size:"sm",variant:"outline",className:"w-full text-destructive border-destructive/30 hover:bg-destructive/10",disabled:l.isPending,onClick:d,children:[s.jsx(Be,{className:"h-3.5 w-3.5 mr-1.5"}),l.isPending?"Cancelling...":"Cancel request"]})]}):s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-4 space-y-3",children:[s.jsx(pc,{placeholder:"Optional message to project managers...",value:r,onChange:u=>n(u.target.value),className:"resize-none text-sm h-20"}),s.jsx(ee,{className:"w-full",disabled:o.isPending,onClick:c,children:o.isPending?"Sending...":"Request access"})]})]})})}function Ore(){const{slug:e}=Et(),t=ct(),{token:r,setWorkspace:n}=De(),a=ye(),{data:i=[],isLoading:o}=Zu(e??"",{enabled:!!e}),l=i.find(S=>S.slug===e)??null,c=!o&&l!==null,d=!o&&l===null,{data:u=[]}=gN(),f=l?u.find(S=>S.workspace_id===l.id)??null:null,[m,p]=h.useState(!1),[x,g]=h.useState(null),[v,y]=h.useState("");h.useEffect(()=>{f&&(p(!0),g(f.id))},[f==null?void 0:f.id]);const b=Ju(),N=vN(),{data:j}=Cn({refetchInterval:m?6e4:!1});h.useEffect(()=>{if(!j)return;const S=j.find(_=>_.slug===e);S&&(n({id:S.id,name:S.name,slug:S.slug,logo_url:S.logo_url??null}),t(`/${S.slug}/projects`,{replace:!0}))},[j]),h.useEffect(()=>{l!=null&&l.is_member&&t(`/${l.slug}/projects`,{replace:!0})},[l==null?void 0:l.is_member]),h.useEffect(()=>{if(!r)return;const S=Nx(r);return S.addEventListener("workspace.access_request_resolved",_=>{try{JSON.parse(_.data??"{}").action==="approve"&&(a.invalidateQueries({queryKey:["workspaces"]}),a.invalidateQueries({queryKey:["workspaces","my-access-requests"]}))}catch{}}),S.onerror=()=>{},()=>S.close()},[r,a]);const k=()=>{l&&b.mutate({workspaceId:l.id,message:v.trim()||void 0},{onSuccess:S=>{p(!0),g(S.access_request.id)},onError:S=>{if(S instanceof nc&&S.status===409){const _=u.find(C=>C.workspace_id===l.id);p(!0),g((_==null?void 0:_.id)??null)}else F.error(S instanceof Error?S.message:"Failed to send request")}})},w=()=>{!l||!x||N.mutate({workspaceId:l.id,requestId:x},{onSuccess:()=>{p(!1),g(null),y(""),F.success("Request cancelled")},onError:()=>F.error("Failed to cancel request")})};return s.jsx("div",{className:"min-h-screen bg-[hsl(60_5%_96%)] dark:bg-background flex items-center justify-center p-4",children:s.jsxs("div",{className:"w-full max-w-[420px] space-y-6",children:[s.jsx("div",{className:"flex flex-col items-center gap-4",children:s.jsx(Ao,{})}),o&&s.jsx("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-6 text-center",children:s.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking up workspace..."})}),d&&s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-6 space-y-3 text-center",children:[s.jsx("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center mx-auto",children:s.jsx(Sn,{className:"h-5 w-5 text-muted-foreground"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-sm font-semibold",children:"Workspace not found"}),s.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:['"',e,`" doesn't exist or is private. Check the URL or ask for an invite link.`]})]}),s.jsx(ee,{asChild:!0,variant:"outline",size:"sm",className:"w-full",children:s.jsx(Rt,{to:"/",children:"Go to my workspaces"})})]}),c&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex flex-col items-center gap-3 text-center",children:[s.jsx("div",{className:"h-12 w-12 rounded-full bg-muted flex items-center justify-center",children:s.jsx(El,{className:"h-6 w-6 text-muted-foreground"})}),s.jsxs("div",{children:[s.jsx("h1",{className:"text-lg font-semibold",children:l.name}),!l.is_member&&s.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"You don't have access to this workspace."})]})]}),l.is_member&&s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-4 text-center space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"You're already a member of this workspace."}),s.jsx(ee,{asChild:!0,size:"sm",className:"w-full",children:s.jsx(Rt,{to:`/${l.slug}/projects`,children:"Go to workspace"})})]}),!l.is_member&&m&&s.jsxs("div",{className:"bg-amber-50 dark:bg-amber-950/20 border border-amber-200 dark:border-amber-800 rounded-lg p-4 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(Ar,{className:"h-4 w-4 text-amber-600 shrink-0"}),s.jsx("span",{className:"text-sm font-medium text-amber-800 dark:text-amber-300",children:"Request pending"})]}),s.jsx("p",{className:"text-xs text-muted-foreground",children:"Your request is waiting for admin approval. You'll be redirected automatically once approved."}),x&&s.jsxs(ee,{size:"sm",variant:"outline",className:"w-full text-destructive border-destructive/30 hover:bg-destructive/10",disabled:N.isPending,onClick:w,children:[s.jsx(Be,{className:"h-3.5 w-3.5 mr-1.5"}),N.isPending?"Cancelling...":"Cancel request"]})]}),!l.is_member&&!m&&s.jsxs("div",{className:"bg-white dark:bg-card border border-border rounded-lg p-4 space-y-3",children:[s.jsx("p",{className:"text-sm text-muted-foreground",children:"Send a request to the workspace admins."}),s.jsx(pc,{placeholder:"Optional message to admins...",value:v,onChange:S=>y(S.target.value),className:"resize-none text-sm h-20"}),s.jsx(ee,{className:"w-full",disabled:b.isPending,onClick:k,children:b.isPending?"Sending...":"Request access"})]}),s.jsx(ee,{asChild:!0,variant:"ghost",size:"sm",className:"w-full text-muted-foreground",children:s.jsxs(Rt,{to:"/",children:[s.jsx($a,{className:"h-3.5 w-3.5 mr-1.5"}),"My workspaces"]})})]})]})})}const Ere=h.lazy(()=>Hu(()=>import("./ProjectTimelinePage-TWQPJXGx.js"),__vite__mapDeps([0,1,2,3,4,5])).then(e=>({default:e.ProjectTimelinePage}))),Are=h.lazy(()=>Hu(()=>import("./ProjectHealthPage-3V_xKn6W.js"),__vite__mapDeps([6,1,2,7,3,4,5])).then(e=>({default:e.ProjectHealthPage}))),Dre=h.lazy(()=>Hu(()=>import("./HealthReportDetailPage-DNOCBj2U.js"),__vite__mapDeps([8,1,2,7,3,4,5])).then(e=>({default:e.HealthReportDetailPage}))),Tre=h.lazy(()=>Hu(()=>import("./WorkspaceReportingPage-EtA8B4LZ.js"),__vite__mapDeps([9,1,2,3,4,5])).then(e=>({default:e.WorkspaceReportingPage})));function ha({children:e}){const{isAuthenticated:t}=De();return t?s.jsx(s.Fragment,{children:e}):s.jsx(qn,{to:"/login",replace:!0})}function Yw({children:e}){var r;const{user:t}=De();return(r=t==null?void 0:t.roles)!=null&&r.includes("super-admin")?s.jsx(s.Fragment,{children:e}):s.jsx(qn,{to:"/",replace:!0})}function Gw({children:e}){var a,i,o;const{user:t}=De(),r=((a=t==null?void 0:t.roles)==null?void 0:a.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?s.jsx(s.Fragment,{children:e}):s.jsx(qn,{to:"/",replace:!0})}function jd({children:e}){const{isAuthenticated:t}=De(),{data:r}=ef(),n=wo();return t?s.jsx(qn,{to:"/",replace:!0}):r!=null&&r.needsSetup&&n.pathname==="/login"?s.jsx(qn,{to:"/register",replace:!0}):r&&!r.needsSetup&&!r.registrationEnabled&&n.pathname==="/register"?s.jsx(qn,{to:"/login",replace:!0}):s.jsx(s.Fragment,{children:e})}function Ire(){const{workspace:e,setWorkspace:t,user:r}=De(),n=ct(),{data:a,isLoading:i}=Cn();return h.useEffect(()=>{if(!i&&a!==void 0){if(e){if(a.some(l=>l.id===e.id)){n(`/${e.slug}/projects`,{replace:!0});return}t(null)}if(a.length>0){const o=a[0];t({id:o.id,name:o.name,slug:o.slug,logo_url:o.logo_url}),n(`/${o.slug}/projects`,{replace:!0})}else n("/awaiting-access",{replace:!0})}},[a,i,n,t,r,e]),s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(xN,{width:48,height:48,showText:!1,loading:!0})})}function Rre(){var p,x;const{workspace:e}=Et(),{workspace:t,setWorkspace:r,user:n}=De();JD();const a=ct(),{data:i,isLoading:o,isFetching:l}=Cn(),c=((p=n==null?void 0:n.roles)==null?void 0:p.includes("super-admin"))||((x=n==null?void 0:n.roles)==null?void 0:x.includes("admin")),d=!o&&i&&!i.find(g=>g.slug===e)&&c,{data:u,isLoading:f}=Cn(d?{orgScope:!0}:!1);return h.useEffect(()=>{if(o||!i)return;const g=i.find(v=>v.slug===e);if(g){g.id!==(t==null?void 0:t.id)&&r({id:g.id,name:g.name,slug:g.slug,logo_url:g.logo_url});return}if(c){if(f||!u)return;const v=u.find(y=>y.slug===e);if(v){v.id!==(t==null?void 0:t.id)&&r({id:v.id,name:v.name,slug:v.slug,logo_url:v.logo_url});return}}l||(i.length>0?a(`/request-workspace-access/${e}`,{replace:!0}):(r(null),a(e?`/request-workspace-access/${e}`:"/awaiting-access",{replace:!0})))},[i,u,e,o,l,f,c,t==null?void 0:t.id,a,r,n]),o||d&&f||!t||t.slug!==e?s.jsx("div",{className:"min-h-screen flex items-center justify-center",children:s.jsx(xN,{width:48,height:48,showText:!1,loading:!0})}):s.jsxs(s.Fragment,{children:[s.jsx(KT,{}),s.jsx(T3,{})]})}function $re(){const{isAuthenticated:e}=De(),t=ye(),r=h.useRef(e);h.useEffect(()=>{r.current&&!e&&t.clear(),r.current=e},[e,t])}function zre(){return $re(),s.jsxs(pE,{children:[s.jsx(Re,{path:"/login",element:s.jsx(jd,{children:s.jsx(R3,{})})}),s.jsx(Re,{path:"/register",element:s.jsx(jd,{children:s.jsx(X3,{})})}),s.jsx(Re,{path:"/forgot-password",element:s.jsx(jd,{children:s.jsx(_re,{})})}),s.jsx(Re,{path:"/reset-password",element:s.jsx(jd,{children:s.jsx(Pre,{})})}),s.jsx(Re,{path:"/invite/:token",element:s.jsx(HL,{})}),s.jsx(Re,{path:"/oauth/google/callback",element:s.jsx(Sre,{})}),s.jsx(Re,{path:"/share/:token",element:s.jsx(Nre,{})}),s.jsx(Re,{path:"/reporting",element:s.jsx(ha,{children:s.jsx(Gw,{children:s.jsx(r3,{})})}),children:s.jsx(Re,{index:!0,element:s.jsx(gO,{})})}),s.jsxs(Re,{path:"/org",element:s.jsx(ha,{children:s.jsx(Gw,{children:s.jsx(a3,{})})}),children:[s.jsx(Re,{index:!0,element:s.jsx(qn,{to:"settings",replace:!0})}),s.jsx(Re,{path:"settings",element:s.jsx(cee,{})}),s.jsx(Re,{path:"reports",element:s.jsx(Yw,{children:s.jsx(dee,{})})})]}),s.jsx(Re,{path:"/profile",element:s.jsx(ha,{children:s.jsx(l3,{})}),children:s.jsx(Re,{index:!0,element:s.jsx(Cre,{})})}),s.jsx(Re,{path:"/setup",element:s.jsx(ha,{children:s.jsx(Q3,{})})}),s.jsx(Re,{path:"/awaiting-access",element:s.jsx(ha,{children:s.jsx(Z3,{})})}),s.jsx(Re,{path:"/request-workspace-access/:slug",element:s.jsx(ha,{children:s.jsx(Ore,{})})}),s.jsx(Re,{index:!0,element:s.jsx(ha,{children:s.jsx(Ire,{})})}),s.jsxs(Re,{path:"/:workspace",element:s.jsx(ha,{children:s.jsx(Rre,{})}),children:[s.jsx(Re,{index:!0,element:s.jsx(qn,{to:"projects",replace:!0})}),s.jsx(Re,{path:"projects",element:s.jsx(bR,{})}),s.jsxs(Re,{path:"projects/:projectKey",element:s.jsx(JT,{}),children:[s.jsx(Re,{path:"board",element:s.jsx(tL,{})}),s.jsx(Re,{path:"issues",element:s.jsx(rL,{})}),s.jsx(Re,{path:"issues/new",element:s.jsx(hL,{})}),s.jsx(Re,{path:"issues/:issueId",element:s.jsx(cL,{})}),s.jsx(Re,{path:"sprints",element:s.jsx(PL,{})}),s.jsx(Re,{path:"timeline",element:s.jsx(h.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:s.jsx(Ere,{})})}),s.jsx(Re,{path:"access",element:s.jsx(aL,{})}),s.jsx(Re,{path:"reports",element:s.jsx(HJ,{})}),s.jsx(Re,{path:"activity",element:s.jsx(VJ,{})}),s.jsx(Re,{path:"health",element:s.jsx(h.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:s.jsx(Are,{})})}),s.jsx(Re,{path:"health/:reportId",element:s.jsx(h.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:s.jsx(Dre,{})})})]}),s.jsx(Re,{path:"projects/:projectKey/request-access",element:s.jsx(Mre,{})}),s.jsx(Re,{path:"my-tasks",element:s.jsx(wL,{})}),s.jsx(Re,{path:"notifications",element:s.jsx(kL,{})}),s.jsx(Re,{path:"reporting",element:s.jsx(h.Suspense,{fallback:s.jsx("div",{className:"flex items-center justify-center h-full text-sm text-muted-foreground",children:"Loading…"}),children:s.jsx(Tre,{})})}),s.jsx(Re,{path:"settings",element:s.jsx(FL,{})}),s.jsx(Re,{path:"roles",element:s.jsx(Yw,{children:s.jsx(WL,{})})})]}),s.jsx(Re,{path:"*",element:s.jsx(qn,{to:"/",replace:!0})})]})}window.__React=W;window.__ReactJsxRuntime=dE;const Lre=new uE({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{}$1(document.getElementById("root")).render(s.jsx(h.StrictMode,{children:s.jsx(q5,{widgets:[...PD,...e],children:s.jsx(o5,{children:s.jsxs(fE,{client:Lre,children:[s.jsx(l5,{children:s.jsx(c5,{children:s.jsx(xE,{children:s.jsxs(Ku,{delayDuration:300,children:[s.jsx(zre,{}),s.jsx(XA,{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"}}})]})})})}),s.jsx(NA,{initialIsOpen:!1})]})})})}))})();export{bo as $,ce as A,ee as B,jf as C,mx as D,lt as E,Ce as F,pre as G,VF as H,qS as I,qs as J,Mr as K,cne as L,Zre as M,Ws as N,Ae as O,ot as P,jo as Q,pne as R,Bt as S,tg as T,ae as U,dt as V,Or as W,yU as X,nne as Y,da as Z,Hu as _,Yr as a,aO as a$,Ii as a0,Ri as a1,yo as a2,lv as a3,Fa as a4,ou as a5,dv as a6,Tp as a7,Iv as a8,xn as a9,BJ as aA,NY as aB,Yn as aC,QT as aD,Yre as aE,Gre as aF,Vre as aG,Xre as aH,FS as aI,z as aJ,hx as aK,_e as aL,Ue as aM,Le as aN,Ve as aO,Fe as aP,ke as aQ,yc as aR,Mo as aS,gf as aT,Fs as aU,jr as aV,pD as aW,Gx as aX,uo as aY,l7 as aZ,XM as a_,tn as aa,AV as ab,_V as ac,LV as ad,MB as ae,kC as af,CV as ag,Fo as ah,Bo as ai,HK as aj,ZM as ak,HM as al,uQ as am,Jt as an,ene as ao,Og as ap,IC as aq,Mg as ar,fr as as,ms as at,tV as au,ZG as av,Qr as aw,HC as ax,Ye as ay,Vf as az,ea as b,iO as b0,YY as b1,Kre as b2,le as b3,He as b4,Ot as b5,ZI as b6,Qre as b7,De as b8,gO as b9,qh as c,Yu as d,$o as e,fe as f,zo as g,qx as h,QR as i,Wx as j,La as k,dre as l,Oh as m,Mh as n,xre as o,lre as p,hre as q,Eh as r,Ek as s,Hw as t,IN as u,sE as v,gre as w,F as x,xt as y,ie as z};