PageSourceSearch

https://v0-project-management-dashboard-2.vercel.app/_next/static/chunks/app/page-81a45dcac226c954.js

js v0-project-management-dashboard-2.vercel.app collected 2026-10-03 07:58:18 UTC 103,389 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[931],{3381:function(e,t,s){Promise.resolve().then(s.bind(s,6450))},6450:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return td}});var r=s(9166),a=s(861),l=s(8374),i=s(4350),n=s(3182),o=s(8871);function d(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return(0,o.m6)((0,n.W)(t))}let c=(0,i.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 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"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),m=a.forwardRef((e,t)=>{let{className:s,variant:a,size:i,asChild:n=!1,...o}=e,m=n?l.g7:"button";return(0,r.jsx)(m,{className:d(c({variant:a,size:i,className:s})),ref:t,...o})});m.displayName="Button";let x=a.forwardRef((e,t)=>{let{className:s,type:a,...l}=e;return(0,r.jsx)("input",{type:a,className:d("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t,...l})});x.displayName="Input";var u=s(3471);let p=(0,i.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),h=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(u.f,{ref:t,className:d(p(),s),...a})});h.displayName=u.f.displayName;let f=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("textarea",{className:d("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",s),ref:t,...a})});f.displayName="Textarea";var g=s(2698),j=s(5600),b=s(5845),v=s(3094);let N=g.fC;g.ZA;let y=g.B4,w=a.forwardRef((e,t)=>{let{className:s,children:a,...l}=e;return(0,r.jsxs)(g.xz,{ref:t,className:d("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",s),...l,children:[a,(0,r.jsx)(g.JO,{asChild:!0,children:(0,r.jsx)(j.Z,{className:"h-4 w-4 opacity-50"})})]})});w.displayName=g.xz.displayName;let k=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(g.u_,{ref:t,className:d("flex cursor-default items-center justify-center py-1",s),...a,children:(0,r.jsx)(b.Z,{className:"h-4 w-4"})})});k.displayName=g.u_.displayName;let C=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(g.$G,{ref:t,className:d("flex cursor-default items-center justify-center py-1",s),...a,children:(0,r.jsx)(j.Z,{className:"h-4 w-4"})})});C.displayName=g.$G.displayName;let _=a.forwardRef((e,t)=>{let{className:s,children:a,position:l="popper",...i}=e;return(0,r.jsx)(g.h_,{children:(0,r.jsxs)(g.VY,{ref:t,className:d("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover 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","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",s),position:l,...i,children:[(0,r.jsx)(k,{}),(0,r.jsx)(g.l_,{className:d("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:a}),(0,r.jsx)(C,{})]})})});_.displayName=g.VY.displayName,a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(g.__,{ref:t,className:d("py-1.5 pl-8 pr-2 text-sm font-semibold",s),...a})}).displayName=g.__.displayName;let F=a.forwardRef((e,t)=>{let{className:s,children:a,...l}=e;return(0,r.jsxs)(g.ck,{ref:t,className:d("relative flex w-full 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",s),...l,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(g.wU,{children:(0,r.jsx)(v.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(g.eT,{children:a})]})});F.displayName=g.ck.displayName,a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(g.Z0,{ref:t,className:d("-mx-1 my-1 h-px bg-muted",s),...a})}).displayName=g.Z0.displayName;let P=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:d("rounded-lg border bg-card text-card-foreground shadow-sm",s),...a}
1)});P.displayName="Card";let A=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:d("flex flex-col space-y-1.5 p-6",s),...a})});A.displayName="CardHeader";let S=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:d("text-2xl font-semibold leading-none tracking-tight",s),...a})});S.displayName="CardTitle";let Z=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:d("text-sm text-muted-foreground",s),...a})});Z.displayName="CardDescription";let z=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:d("p-6 pt-0",s),...a})});z.displayName="CardContent",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{ref:t,className:d("flex items-center p-6 pt-0",s),...a})}).displayName="CardFooter";let E=(0,i.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold 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 hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function I(e){let{className:t,variant:s,...a}=e;return(0,r.jsx)("div",{className:d(E({variant:s}),t),...a})}var D=s(8790);let M=a.forwardRef((e,t)=>{let{className:s,value:a,...l}=e;return(0,r.jsx)(D.fC,{ref:t,className:d("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s),...l,children:(0,r.jsx)(D.z$,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:"translateX(-".concat(100-(a||0),"%)")}})})});M.displayName=D.fC.displayName;let O=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("div",{className:"relative w-full overflow-auto",children:(0,r.jsx)("table",{ref:t,className:d("w-full caption-bottom text-sm",s),...a}
1)})});O.displayName="Table";let R=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("thead",{ref:t,className:d("[&_tr]:border-b",s),...a})});R.displayName="TableHeader";let T=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tbody",{ref:t,className:d("[&_tr:last-child]:border-0",s),...a})});T.displayName="TableBody",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tfoot",{ref:t,className:d("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",s),...a})}).displayName="TableFooter";let L=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("tr",{ref:t,className:d("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",s),...a})});L.displayName="TableRow";let V=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("th",{ref:t,className:d("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",s),...a})});V.displayName="TableHead";let W=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("td",{ref:t,className:d("p-4 align-middle [&:has([role=checkbox])]:pr-0",s),...a})});W.displayName="TableCell",a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)("caption",{ref:t,className:d("mt-4 text-sm text-muted-foreground",s),...a})}).displayName="TableCaption";var H=s(5691),q=s(8072);let B=H.fC;H.xz;let Y=H.h_;H.x8;let U=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(H.aV,{ref:t,className:d("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...a})});U.displayName=H.aV.displayName;let G=a.forwardRef((e,t)=>{let{className:s,children:a,...l}=e;return(0,r.jsxs)(Y,{children:[(0,r.jsx)(U,{}),(0,r.jsxs)(H.VY,{ref:t,className:d("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background 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%] sm:rounded-lg",s),...l,children:[a,(0,r.jsxs)(H.x8,{className:"absolute right-4 top-4 roun
1ded-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:[(0,r.jsx)(q.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});G.displayName=H.VY.displayName;let J=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:d("flex flex-col space-y-1.5 text-center sm:text-left",t),...s})};J.displayName="DialogHeader";let $=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(H.Dx,{ref:t,className:d("text-lg font-semibold leading-none tracking-tight",s),...a})});$.displayName=H.Dx.displayName;let X=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(H.dk,{ref:t,className:d("text-sm text-muted-foreground",s),...a})});X.displayName=H.dk.displayName;var K=s(1585),Q=s(7924),ee=s(8014),et=s(126),es=s(9835),er=s(5929),ea=s(6198),el=s(763),ei=s(8522),en=s(5771),eo=s(8902),ed=s(334),ec=s(7850),em=s(8155),ex=s(4309),eu=s(1699),ep=s(5246),eh=s(7834),ef=s(7646),eg=s(5525),ej=s(847),eb=s(4198);let ev=eb.fC,eN=eb.xz,ey=a.forwardRef((e,t)=>{let{className:s,align:a="center",sideOffset:l=4,...i}=e;return(0,r.jsx)(eb.h_,{children:(0,r.jsx)(eb.VY,{ref:t,align:a,sideOffset:l,className:d("z-50 w-72 rounded-md border bg-popover p-4 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",s),...i})})});ey.displayName=eb.VY.displayName;var ew=s(1318),ek=s(281),eC=s(6296);function e_(){let e=(0,ew._)(["rtl:**:[.rdp-button_next>svg]:rotate-180"],["rtl:**:[.rdp-button\\_next>svg]:rotate-180"]);return e_=function(){return e},e}function eF(){let e=(0,ew._)(["rtl:**:[.rdp-button_previous>svg]:rotate-180"],["rtl:**:[.rdp-button\\_previous>svg]:rotate-180"]);return eF=function(){return e},e}function eP(e){let{className:t,classNames:s,showOutsideDays:a=!0,captionLayout:l="label",buttonVariant:i="ghost",formatters:n,components:o,...m}=e,x=(0,ek.U)();return(0,r.jsx)(eC._,{showOutsideDays:a,className:d("bg-background group/calendar p-3 [--cell-size:2rem] [[data-slot=card-content]_&]:bg-transparent [[data-slot=popover-content]_&]:bg-transparent",String.raw(e_()),String.raw(eF()),t),captionLayout:l,formatters:{formatMonthDropdown:e=>e.toLocaleString("default",{month:"short"}),...n},classNames:{root:d("w-fit",x.root),months:d("flex gap-4 flex-col md:flex-row relative",x.months),month:d("flex flex-col w-full gap-4",x.month),nav:d("flex items-center gap-1 w-full absolute top-0 inset-x-0 justify-between",x.nav),button_previous:d(c({variant:i}),"size-[--cell-size] aria-disabled:opacity-50 p-0 select-none",x.button_previous),button_next:d(c({variant:i}),"size-[--cell-size] aria-disabled:opacity-50 p-0 select-none",x.button_next),month_caption:d("flex items-center justify-center h-[--cell-size] w-full px-[--cell-size]",x.month_caption),dropdowns:d("w-full flex items-center text-sm font-medium justify-center h-[--cell-size] gap-1.5",x.dropdowns),dropdown_root:d("relative has-focus:border-ring border border-input shadow-xs has-focus:ring-ring/50 has-focus:ring-[3px] rounded-md",x.dropdown_root),dropdown:d("absolute bg-popover inset-0 opacity-0",x.dropdown),caption_label:d("select-none font-medium","label"===l?"text-sm":"rounded-md pl-2 pr-1 flex items-center gap-1 text-sm h-8 [&>svg]:text-muted-foreground [&>svg]:size-3.5",x.caption_label),table:"w-full border-collapse",weekdays:d("flex",x.weekdays),weekday:d("text-muted-foreground rounded-md flex-1 font-normal text-[0.8rem] select-none",x.weekday),week:d("flex w-full mt-2",x.week),week_number_header:d("select-none w-[--cell-size]",x.week_number_header),week_number:d("text-[0.8rem] select-none text-muted-foreground",x.week_number),day:d("relative w-full h-full p-0 text-center [&:first-child[data-selected=true]_button]:rounded-l-md [&:last-child[data-selected=true]_button]:rounded-r-md group/d
1ay aspect-square select-none",x.day),range_start:d("rounded-l-md bg-accent",x.range_start),range_middle:d("rounded-none",x.range_middle),range_end:d("rounded-r-md bg-accent",x.range_end),today:d("bg-accent text-accent-foreground rounded-md data-[selected=true]:rounded-none",x.today),outside:d("text-muted-foreground aria-selected:text-muted-foreground",x.outside),disabled:d("text-muted-foreground opacity-50",x.disabled),hidden:d("invisible",x.hidden),...s},components:{Root:e=>{let{className:t,rootRef:s,...a}=e;return(0,r.jsx)("div",{"data-slot":"calendar",ref:s,className:d(t),...a})},Chevron:e=>{let{className:t,orientation:s,...a}=e;return"left"===s?(0,r.jsx)(ep.Z,{className:d("size-4",t),...a}):"right"===s?(0,r.jsx)(eh.Z,{className:d("size-4",t),...a}):(0,r.jsx)(j.Z,{className:d("size-4",t),...a})},DayButton:eA,WeekNumber:e=>{let{children:t,...s}=e;return(0,r.jsx)("td",{...s,children:(0,r.jsx)("div",{className:"flex size-[--cell-size] items-center justify-center text-center",children:t})})},...o},...m})}function eA(e){let{className:t,day:s,modifiers:l,...i}=e,n=(0,ek.U)(),o=a.useRef(null);return a.useEffect(()=>{var e;l.focused&&(null===(e=o.current)||void 0===e||e.focus())},[l.focused]),(0,r.jsx)(m,{ref:o,variant:"ghost",size:"icon","data-day":s.date.toLocaleDateString(),"data-selected-single":l.selected&&!l.range_start&&!l.range_end&&!l.range_middle,"data-range-start":l.range_start,"data-range-end":l.range_end,"data-range-middle":l.range_middle,className:d("data-[selected-single=true]:bg-primary data-[selected-single=true]:text-primary-foreground data-[range-middle=true]:bg-accent data-[range-middle=true]:text-accent-foreground data-[range-start=true]:bg-primary data-[range-start=true]:text-primary-foreground data-[range-end=true]:bg-primary data-[range-end=true]:text-primary-foreground group-data-[focused=true]/day:border-ring group-data-[focused=true]/day:ring-ring/50 dark:hover:text-accent-foreground flex aspect-square w-full min-w-[--cell-size] flex-col gap-1 leading-none font-normal group-data-[focused=true]/day:relative group-data-[focused=true]/day:z-10 group-data-[focused=true]/day:ring-[3px] data-[range-end=true]:rounded-md data-[range-end=true]:rounded-r-md data-[range-middle=true]:rounded-none data-[range-start=true]:rounded-md data-[range-start=true]:rounded-l-md [&>span]:text-xs [&>span]:opacity-70",n.day,t),...i})}var eS=s(652);function eZ(e){let{className:t,...s}=e;return(0,r.jsx)("div",{className:d("animate-pulse rounded-md bg-muted",t),...s})}let ez=["Wami Live","Luck On Fourth","The Hideout","What's Good Chicago","Wally's"],eE={"Wami Live":"bg-purple-100 text-purple-800 border-purple-200 dark:bg-purple-950/40 dark:text-purple-300 dark:border-purple-800","Luck On Fourth":"bg-green-100 text-green-800 border-green-200 dark:bg-green-950/40 dark:text-green-300 dark:border-green-800","The Hideout":"bg-orange-100 text-orange-800 border-orange-200 dark:bg-orange-950/40 dark:text-orange-300 dark:border-orange-800","What's Good Chicago":"bg-cyan-100 text-cyan-800 border-cyan-200 dark:bg-cyan-950/40 dark:text-cyan-300 dark:border-cyan-800","Wally's":"bg-amber-100 text-amber-800 border-amber-200 dark:bg-amber-950/40 dark:text-amber-300 dark:border-amber-800"},eI={"Wami Live":"WAMI LIVE INC","Luck On Fourth":"In And Out Gaming LLC","The Hideout":"The Hideout Gaming LLC","What's Good Chicago":"What's Good Chicago","Wally's":"Wally's Tavern"},eD={"Wami Live":"/logos/wami-live.png","Luck On Fourth":"/logos/luck-on-fourth.png","The Hideout":"/logos/the-hideout.png","What's Good Chicago":"/logos/whats-good-chicago.png","Wally's":"/logos/wallys.png"},eM={"Wami Live":"https://drive.google.com/drive/folders/1QYDXz6JxRin5Vi7lHXzHGM9wCMMVjCg_?usp=drive_link","Luck On Fourth":"https://drive.google.com/drive/folders/1Dp-JZ8MekvFGLvgFaj8cPprny2FqSltl?usp=drive_link","The Hideout":"https://drive.google.com/drive/folders/1zhr7z9jp8BHhYO3BP2ZMi5fztwoCmJur?usp=drive_link","What's Good Chicago":"https://drive.google.com/drive/folders/1I0fjR2Yi1XCAa_Lmmr7pmrXKGJOEwGpJ?usp=drive_link"},eO={"Wami Live":{text:"text-purple-700 dark:text-purple-400",button:"bg-purple-600 hover:bg-purple-700"},"Luck On Fourth":{text:"text-green-700 dark:text-green-400",button:"bg-green-600 hover:bg-green-700"},"The Hideout":{text:"text-orange-700 dark:text-orange-400",button:"bg-orange-600 hover:bg-orange-700"},"What's Good Chicago":{text:"text-cyan-700 dark:text-cyan-400",button:"bg-sky-4
100 hover:bg-sky-500 text-white"},"Wally's":{text:"text-amber-700 dark:text-amber-400",button:"bg-amber-600 hover:bg-amber-700"}};var eR=s(5678);function eT(e){var t;let{files:s,initialIndex:l,open:i,onOpenChange:n}=e,[o,d]=(0,a.useState)(l),[c,x]=(0,a.useState)(!1);(0,a.useEffect)(()=>{i&&d(l)},[i,l]);let u=s[o],p=s.length>1,h=()=>d(e=>(e-1+s.length)%s.length),f=()=>d(e=>(e+1)%s.length);if((0,a.useEffect)(()=>{if(!i)return;let e=e=>{"ArrowLeft"===e.key&&p&&h(),"ArrowRight"===e.key&&p&&f()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,p]),!u)return null;let g=u.type.startsWith("image/"),j=async()=>{x(!0);try{let e=await fetch(u.url);if(!e.ok)throw Error("fetch failed");let t=await e.blob(),s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download=u.name,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(s)}catch(e){window.open(u.url,"_blank")}finally{x(!1)}};return(0,r.jsx)(B,{open:i,onOpenChange:n,children:(0,r.jsxs)(G,{className:"max-w-4xl w-[95vw] p-0 gap-0 overflow-hidden bg-black border-none text-white",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-3 px-4 py-3 bg-black/80",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)($,{className:"text-sm font-medium truncate text-white",children:u.name}),(0,r.jsxs)("p",{className:"text-xs text-white/60",children:[(u.size/1024/1024).toFixed(2)," MB • ",(0,eS.Z)(u.uploadedAt,"MMM dd, yyyy"),p&&" • ".concat(o+1," of ").concat(s.length)]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsxs)(m,{size:"sm",variant:"secondary",onClick:j,disabled:c,className:"h-8",children:[c?(0,r.jsx)(er.Z,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(eR.Z,{className:"h-4 w-4 mr-1"}),"Save"]}),(0,r.jsx)(m,{size:"sm",variant:"ghost",onClick:()=>window.open(u.url,"_blank"),className:"h-8 text-white hover:bg-white/10 hover:text-white",children:(0,r.jsx)(eo.Z,{className:"h-4 w-4"})})]})]}),(0,r.jsxs)("div",{className:"relative flex items-center justify-center min-h-[50vh] max-h-[75vh] bg-black",children:[p&&(0,r.jsx)("button",{onClick:h,className:"absolute left-2 z-10 h-9 w-9 rounded-full bg-black/50 hover:bg-black/70 flex items-center justify-center text-white transition-colors","aria-label":"Previous file",children:(0,r.jsx)(ep.Z,{className:"h-5 w-5"})}),g?(0,r.jsx)("img",{src:u.url||"/placeholder.svg",alt:u.name,className:"max-w-full max-h-[75vh] object-contain"}):(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3 text-white/80 py-16",children:[(0,r.jsx)(ej.Z,{className:"h-16 w-16"}),(0,r.jsx)("p",{className:"text-sm",children:"Preview not available for this file type."}),(0,r.jsxs)(m,{size:"sm",variant:"secondary",onClick:()=>window.open(u.url,"_blank"),children:["Open ",null===(t=u.name.split(".").pop())||void 0===t?void 0:t.toUpperCase()]})]}),p&&(0,r.jsx)("button",{onClick:f,className:"absolute right-2 z-10 h-9 w-9 rounded-full bg-black/50 hover:bg-black/70 flex items-center justify-center text-white transition-colors","aria-label":"Next file",children:(0,r.jsx)(eh.Z,{className:"h-5 w-5"})})]}),p&&(0,r.jsx)("div",{className:"flex items-center gap-2 overflow-x-auto px-4 py-3 bg-black/80",children:s.map((e,t)=>(0,r.jsx)("button",{onClick:()=>d(t),className:"shrink-0 h-12 w-12 rounded border-2 overflow-hidden transition-colors ".concat(t===o?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:e.type.startsWith("image/")?(0,r.jsx)("img",{src:e.url||"/placeholder.svg",alt:e.name,className:"h-full w-full object-cover"}):(0,r.jsx)("div",{className:"h-full w-full bg-white/10 flex items-center justify-center",children:(0,r.jsx)(ej.Z,{className:"h-4 w-4 text-white/60"})})},e.id))})]})})}var eL=s(3085),eV=s(7143),eW=s(1203),eH=s(3836);let eq="https://qeexftqswqvkuylznblp.supabase.co",eB="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InFlZXhmdHFzd3F2a3V5bHpuYmxwIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzEwMjYzNjEsImV4cCI6MjA4NjYwMjM2MX0.2ZQfgfpzMJmZh2CAnLniHfHLTMilnswi2H3SfkK6FkY",eY=eq&&eB?(0,eH.eI)(eq,eB):null;var eU=s(1495);let eG=a.forwardRef((e,t)=>
1{let{className:s,orientation:a="horizontal",decorative:l=!0,...i}=e;return(0,r.jsx)(eU.f,{ref:t,decorative:l,orientation:a,className:d("shrink-0 bg-border","horizontal"===a?"h-[1px] w-full":"h-full w-[1px]",s),...i})});eG.displayName=eU.f.displayName;var eJ=s(8437);let e$=eJ.fC;eJ.xz;let eX=eJ.h_,eK=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(eJ.aV,{className:d("fixed inset-0 z-50 bg-black/80  data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),...a,ref:t})});eK.displayName=eJ.aV.displayName;let eQ=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsxs)(eX,{children:[(0,r.jsx)(eK,{}),(0,r.jsx)(eJ.VY,{ref:t,className:d("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background 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%] sm:rounded-lg",s),...a}
1)]})});eQ.displayName=eJ.VY.displayName;let e0=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:d("flex flex-col space-y-2 text-center sm:text-left",t),...s})};e0.displayName="AlertDialogHeader";let e1=e=>{let{className:t,...s}=e;return(0,r.jsx)("div",{className:d("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...s})};e1.displayName="AlertDialogFooter";let e2=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(eJ.Dx,{ref:t,className:d("text-lg font-semibold",s),...a})});e2.displayName=eJ.Dx.displayName;let e4=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(eJ.dk,{ref:t,className:d("text-sm text-muted-foreground",s),...a})});e4.displayName=eJ.dk.displayName;let e5=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(eJ.aU,{ref:t,className:d(c(),s),...a})});e5.displayName=eJ.aU.displayName;let e3=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(eJ.$j,{ref:t,className:d(c({variant:"outline"}),"mt-2 sm:mt-0",s),...a})});e3.displayName=eJ.$j.displayName;var e8=s(467),e6=s(770),e9=s(3077),e7=s(7051),te=s(1870),tt=s(8540);function ts(e){let{invoiceProjects:t,setInvoiceProjects:s,onClearInvoiceHistory:l,exportedInvoices:i,setExportedInvoices:n,onDeleteProject:o}=e,[c,u]=(0,a.useState)(Object.fromEntries(ez.map(e=>[e,1]))),[p,f]=(0,a.useState)(!0),[g,j]=(0,a.useState)({isOpen:!1,type:null,count:0,brand:""}),[b,v]=(0,a.useState)(null),[k,C]=(0,a.useState)(null),[E,D]=(0,a.useState)("manage"),[M,H]=(0,a.useState)(null),[Y,U]=(0,a.useState)(""),Q=Array.from(new Set(Object.values(i).flat().map(e=>new Date(e.exportedAt).getFullYear()))).sort((e,t)=>t-e),[ee,et]=(0,a.useState)(new Date().getFullYear()),er=(e,t)=>{let s=(i[e]||[]).filter(e=>new Date(e.exportedAt).getFullYear()===t),r={},a=0,l=0;return s.forEach(e=>{(e.projects||[]).forEach(e=>{let t=e.invoicePrice||0;r[e.type]=(r[e.type]||0)+t,a+=t,l+=1})}),{invoiceCount:s.length,projectCount:l,total:a,byType:r,invoices:s}},[ea,el]=(0,a.useState)({}),ei=Object.entries(i).flatMap(e=>{let[t,s]=e;return(s||[]).map(e=>({...e,brand:t}))}).filter(e=>{let t=new Date(e.exportedAt);if(ea.from&&t<ea.from||ea.to&&t>new Date(ea.to.getTime()+864e5-1))return!1;if(Y.trim()){let t=Y.trim().toLowerCase();if(!"".concat(e.brand," ").concat(e.invoiceNumber," ").concat(e.fileName," ").concat((0,eS.Z)(new Date(e.exportedAt),"MMM d yyyy")).toLowerCase().includes(t))return!1}return!0}).sort((e,t)=>new Date(t.exportedAt).getTime()-new Date(e.exportedAt).getTime()),en=ei.reduce((e,t)=>e+(t.totalAmount||0),0);if((0,a.useEffect)(()=>{(async()=>{f(!0);try{let{data:e,error:t}=await eY.from("pmp_invoice_projects").select("*").order("added_to_invoice_at",{ascending:!0});if(t){console.error("Error loading invoice data:",t),K.Am.error("Failed to load invoice data"),f(!1);return}let r=Object.fromEntries(ez.map(e=>[e,[]]));null==e||e.forEach(e=>{let t={id:e.project_id,title:e.title,brand:e.brand,type:e.type,description:e.description,deadline:new Date(e.deadline),priority:e.priority,status:e.status,created_at:new Date(e.created_at),files:e.files||[],invoicePrice:Number.parseFloat(e.invoice_price),addedToInvoiceAt:e.added_to_invoice_at?new Date(e.added_to_invoice_at):void 0};r[e.brand]&&r[e.brand].push(t)}),s(r);let{data:a,error:l}=await eY.from("pmp_exported_invoices").select("*").order("exported_at",{ascending:!1});if(l){console.error("Error loading exported invoices:",l),K.Am.error("Failed to load exported invoices"),f(!1);return}let i=Object.fromEntries(ez.map(e=>[e,[]]));null==a||a.forEach(e=>{let t={id:e.id,invoiceNumber:e.invoice_number,fileName:e.file_name,totalAmount:Number.parseFloat(e.total_amount),exportedAt:new Date(e.exported_at),isPaid:e.is_paid,archived:e.archived||!1,projects:e.projects};i[e.brand]&&i[e.brand].push(t)}),n(i);let{data:o,error:d}=await eY.from("pmp_invoice_counters").select("brand, current_number");if(d)console.error("Error loading invoice counters:",d);else if(o){let e=Object.fromEntries(ez.map(e=>[e,1]));o.forEach(t=>{e[t.brand]=t.current_number}),u(e)}K.Am.success("Invoice data loaded from database!")}catch(e){console.error("Error loading invoice data:",e),K.Am.error("Failed to load invoice data")}finally{f(!1)}})()},[]),p)return(0,r.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,r.jsxs)("div",{className:"text-center",children:[(0,r.jsx)("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-foreground mx-auto mb-4"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:"Loading invoice data..."})]})});let eo=e=>{var s;return(null===(s=t[e])||void 0===s?void 0:s.reduce((e,t)=>
1e+(t.invoicePrice||0),0))||0},ed=async(e,t)=>{try{let{error:r}=await eY.from("pmp_invoice_projects").delete().eq("project_id",t).eq("brand",e);if(r){console.error("Error removing from invoice:",r),K.Am.error("Failed to remove from invoice");return}s(s=>({...s,[e]:s[e].filter(e=>e.id!==t)})),K.Am.success("Project removed from invoice and database!")}catch(e){console.error("Error removing from invoice:",e),K.Am.error("Failed to remove from invoice")}},ec=async(e,t)=>{n({...i,[e]:i[e].map(e=>e.id===t?{...e,isPaid:!e.isPaid}:e)});try{var s;let{error:r}=await eY.from("pmp_exported_invoices").update({is_paid:!(null===(s=i[e].find(e=>e.id===t))||void 0===s?void 0:s.isPaid)}).eq("id",t);if(r){console.error("Error updating invoice payment status:",r),K.Am.error("Failed to update payment status");return}K.Am.success("Invoice payment status updated and saved!")}catch(e){console.error("Error updating invoice payment status:",e),K.Am.error("Failed to update payment status")}},ex=async e=>{let t=(i[e]||[]).filter(e=>!e.archived).length;if(0===t){K.Am.error("No invoice history to clear");return}try{let{error:s}=await eY.from("pmp_exported_invoices").update({archived:!0}).eq("brand",e).eq("archived",!1);if(s){console.error("Error archiving invoice history:",s),K.Am.error("Failed to clear invoice history");return}n(t=>({...t,[e]:(t[e]||[]).map(e=>({...e,archived:!0}))})),K.Am.success("Cleared ".concat(t," invoice(s) from ").concat(e,"'s history — still in All Invoices"))}catch(e){console.error("Error clearing invoice history:",e),K.Am.error("Failed to clear invoice history")}},eu=async e=>{try{let{data:t,error:s}=await eY.rpc("pmp_get_next_invoice_number",{brand_name:e});if(!s&&t)return t;console.error("RPC pmp_get_next_invoice_number failed, falling back to manual increment:",s);let{data:r,error:a}=await eY.from("pmp_invoice_counters").select("current_number").eq("brand",e).single();if(a||!r)return await eY.from("pmp_invoice_counters").insert([{brand:e,current_number:2}]),1;let l=r.current_number;return await eY.from("pmp_invoice_counters").update({current_number:l+1,updated_at:new Date().toISOString()}).eq("brand",e),l}catch(t){return console.error("Error getting next invoice number:",t),c[e]||1}},ep=(e,t,s,r)=>{let a=new tt.ZP;a.setFontSize(20),a.setFont("helvetica","bold"),a.text("INVOICE",20,30),a.setFontSize(12),a.setFont("helvetica","normal"),a.text("Invoice #: ".concat(t),20,45),a.text("Date: ".concat((0,eS.Z)(s,"MM/dd/yyyy")),20,55),a.setFont("helvetica","bold"),a.text("FROM:",20,75),a.setFont("helvetica","normal"),a.text("Julio Aleman",20,85),a.text("Graphic Design Services",20,95),a.setFont("helvetica","bold"),a.text("BILL TO:",120,75),a.setFont("helvetica","normal"),a.text(eI[e],120,85);let l=130;a.setFont("helvetica","bold"),a.text("Description",20,l),a.text("Type",100,l),a.text("Amount",150,l),a.line(20,l+5,190,l+5),l+=15,a.setFont("helvetica","normal");let i=0;r.forEach(e=>{let t=e.invoicePrice||0;i+=t;let s=e.title.length>30?e.title.substring(0,30)+"...":e.title;a.text(s,20,l),a.text(e.type,100,l),a.text("$".concat(t.toFixed(2)),150,l),(l+=10)>250&&(a.addPage(),l=30)}),l+=10,a.line(140,l,190,l),l+=10,a.setFont("helvetica","bold"),a.text("TOTAL: $".concat(i.toFixed(2)),140,l),l+=30,a.setFont("helvetica","bold"),a.text("PAYMENT INFORMATION:",20,l),a.setFont("helvetica","normal"),l+=10,a.text("Zelle: ".concat("(630) 270-9307"),20,l),l+=10,a.text("PayPal: ".concat("[email protected]"),20,l);let n=e.replace(/\s+/g,"_").replace("Luck_On_Fourth","LUCK_ON_FOURTH").replace("Wami_Live","WAMI_LIVE").replace("The_Hideout","THE_HIDEOUT").replace("What's_Good_Chicago","WHATS_GOOD_CHICAGO"),o="".concat(n,"_Invoice_").concat((0,eS.Z)(s,"M-dd-yy"),".pdf");return{doc:a,total:i,fileName:o}},eh=e=>{let{doc:t}=ep(e.brand,e.invoiceNumber,new Date(e.exportedAt),e.projects||[]);t.save(e.fileName)},ef=async e=>{let r=t[e];if(!r||0===r.length){K.Am.error("No projects to invoice");return}try{let a=await eu(e),l=a.toString().padStart(3,"0"),o=new Date,{doc:d,total:c,fileName:m}=ep(e,l,o,r),x={id:Date.now().toString(),invoiceNumber:l,fileName:m,totalAmount:c,exportedAt:o,isPaid:!1,projects:[...r]},p={...i,[e]:[...i[e],x]};n(p);let{error:h}=await eY.from("pmp_exported_invoices").insert([{brand:e,invoice_number:x.invoiceNumber,file_name:x.fileName,total_amount:x.totalAmount,exported_at:x.exportedAt.toISOString(),is_paid:x.isPaid,projects:x.projects}]);if(h){console.error("Error saving exported invoice to database:",h),K.Am.error("Failed to save invoice to database");return}d.save(m),u(t=>({...t,[e]:a+1}));let f={...t,[e]:[]};s(f);let{error:g}=await eY.from("pmp_invoice_projects").delete().eq("brand",e);if(g){console.error("Error clearing invoice projects from database:",g),K.Am.error("Failed to clear invoice projects from database");return}K.Am.success("Invoice #".concat(l," exported as ").concat(m," - Data saved to database!"))}catch(e){console.error("Error generating invoice:",e),K.Am.error("Failed to generate invoice")}},eg=(e,t)=>{let s=er(e,t);if(0===s.invoiceCount){K.Am.error("No invoices for ".concat(e," in ").concat(t));return}let r=new tt.ZP,a=30;r.setFontSize(20),r.setFont("helvetica","bold"),r.text("".concat(t," Year in Review"),20,a),a+=15,r.setFontSize(12),r.setFont("helvetica","normal"),r.text(eI[e]||e,20,a),a+=20,r.setFont("helvetica","bold"),r.text("TOTAL SPENT:",20,a),r.text("$".concat(s.total.toFixed(2)),150,a),a+=10,r.setFont("helvetica","normal"),r.text("".concat(s.invoiceCount," invoice(s) • ").concat(s.projectCount," project(s)"),20,a),a+=20,r.setFont("helvetica","bold"),r.text("Breakdown by Type",20,a),a+=10,r.setFont("helvetica","normal"),Object.entries(s.byType).forEach(e
1=>{let[t,s]=e;r.text(t,20,a),r.text("$".concat(s.toFixed(2)),150,a),a+=8}),a+=12,r.setFont("helvetica","bold"),r.text("Invoice History",20,a),a+=10,r.setFont("helvetica","normal"),s.invoices.sort((e,t)=>new Date(e.exportedAt).getTime()-new Date(t.exportedAt).getTime()).forEach(e=>{r.text("#".concat(e.invoiceNumber),20,a),r.text((0,eS.Z)(new Date(e.exportedAt),"MM/dd/yyyy"),70,a),r.text("$".concat(e.totalAmount.toFixed(2)),150,a),(a+=8)>270&&(r.addPage(),a=30)});let l=e.replace(/[^a-zA-Z0-9]+/g,"_");r.save("".concat(l,"_").concat(t,"_Year_In_Review.pdf")),K.Am.success("".concat(t," summary exported for ").concat(e))};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("div",{className:"flex items-center justify-between",children:(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"text-2xl font-bold",children:"Invoice Manager"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:"Manage and export invoices for completed projects"})]})}),(0,r.jsxs)("div",{className:"flex items-center gap-2 border-b",children:[(0,r.jsx)("button",{onClick:()=>D("manage"),className:d("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors","manage"===E?"border-blue-600 text-blue-600":"border-transparent text-muted-foreground hover:text-foreground"),children:"Manage Invoices"}),(0,r.jsx)("button",{onClick:()=>D("all"),className:d("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors","all"===E?"border-blue-600 text-blue-600":"border-transparent text-muted-foreground hover:text-foreground"),children:"All Invoices"}),(0,r.jsx)("button",{onClick:()=>D("year"),className:d("px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors","year"===E?"border-blue-600 text-blue-600":"border-transparent text-muted-foreground hover:text-foreground"),children:"Year in Review"})]}),"year"===E?Q.length>0?(0,r.jsxs)(P,{className:"border-blue-200 dark:border-blue-900 bg-blue-50/50 dark:bg-blue-950/20",children:[(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsxs)(S,{className:"flex items-center gap-2",children:[(0,r.jsx)(e8.Z,{className:"h-5 w-5 text-blue-600"}),"Year in Review"]}),(0,r.jsxs)(N,{value:String(ee),onValueChange:e=>et(Number(e)),children:[(0,r.jsx)(w,{className:"w-28 h-8",children:(0,r.jsx)(y,{})}),(0,r.jsx)(_,{children:(Q.includes(ee)?Q:[ee,...Q]).map(e=>(0,r.jsx)(F,{value:String(e),children:e},e))})]})]}),(0,r.jsx)(Z,{children:"For your clients — a shareable per-brand summary they can use for their own records or taxes"})]}),(0,r.jsx)(z,{children:(0,r.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[Object.entries(eI).map(e=>{let[t]=e,s=er(t,ee);return 0===s.invoiceCount?null:(0,r.jsxs)("div",{className:"rounded-lg border bg-card p-4 space-y-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("img",{src:eD[t]||"/placeholder.svg",alt:"",className:"h-5 w-5 rounded object-contain shrink-0"}),(0,r.jsx)("span",{className:"font-medium text-sm truncate",children:t})]}),(0,r.jsxs)("div",{className:"text-2xl font-bold",children:["$",s.total.toFixed(2)]}),(0,r.jsx)("div",{className:"space-y-1",children:Object.entries(s.byType).map(e=>{let[t,s]=e;return(0,r.jsxs)("div",{className:"flex justify-between text-xs text-muted-foreground",children:[(0,r.jsx)("span",{children:t}),(0,r.jsxs)("span",{children:["$",s.toFixed(2)]})]},t)})}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[s.invoiceCount," invoice(s) • ",s.projectCount," project(s)"]}),(0,r.jsxs)(m,{size:"sm",variant:"outline",className:"w-full",onClick:()=>eg(t,ee),children:[(0,r.jsx)(e6.Z,{className:"h-3.5 w-3.5 mr-1.5"}),"Export Summary"]})]},t)}),Object.entries(eI).every(e=>{let[t]=e;return 0===er(t,ee).invoiceCount})&&(0,r.jsxs)("p",{className:"text-sm text-muted-foreground col-span-full text-center py-4",children:["No invoices exported in ",ee]})]})})]}):(0,r.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No invoices exported yet — export your first invoice from Manage Invoices."}):"all"===E?(0,r.jsxs)(P,{children:[(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[(0,r.jsxs)(S,{className:"flex items-center gap-2",children:[(0,r.jsx)(e9.Z,{className:"h-5 w-5"}),"All Invoices"]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(e7.Z,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),(0,r.jsx)(x,{value:Y,onChange:e=>U(e.target.value),placeholder:"Search date, brand, #...",className:"h-8 pl-8 w-44"})]}),(0,r.jsxs)(ev,{children:[(0,r.jsx)(eN,{asChild:!0,children:(0,r.jsxs)(m,{variant:"outline",size:"sm",className:"h-8 justify-start text-left font-normal",children:[(0,r.jsx)(em.Z,{className:"mr-2 h-3.5 w-3.5"}),ea.from?(0,eS.Z)(ea.from,"MMM d, yyyy"):"From"]})}),(0,r.jsx)(ey,{className:"w-auto p-0",align:"start",children:(0,r.jsx)(eP,{mode:"single",selected:ea.from,onSelect:e=>el(t=>({...t,from:e})),initialFocus:!0})})]}),(0,r.jsx)("span",{className:"text-muted-foreground text-sm",children:"to"}),(0,r.jsxs)(ev,{children:[(0,r.jsx)(eN,{asChild:!0,children:(0,r.jsxs)(m,{variant:"outline",size:"sm",className:"h-8 justify-start text-left font-normal",children:[(0,r.jsx)(em.Z,{className:"mr-2 h-3.5 w-3.5"}),ea.to?(0,eS.Z)(ea.to,"MMM d, yyyy"):"To"]})}),(0,r.jsx)(ey,{className:"w-auto p-0",align:"start",children:(0,r.jsx)(eP,{mode:"single",selected:ea.to,onSelect:e=>el(t=>({...t,to:e})),initialFocus:!0})})]}),(ea.from||ea.to)&&(0,r.jsx)(m,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>el({}),children:(0,r.jsx)(q.Z,{className:"h-3.5 w-3.5"})}),(0,r.jsxs)(m,{size:"sm",className:"h-8",onClick:()=>
1{if(0===ei.length){K.Am.error("No invoices in this range");return}let e=new Blob([[["Date","Brand","Invoice #","File Name","Amount","Paid"],...ei.map(e=>[(0,eS.Z)(new Date(e.exportedAt),"MM/dd/yyyy"),e.brand,e.invoiceNumber,e.fileName,e.totalAmount.toFixed(2),e.isPaid?"Yes":"No"])].map(e=>e.map(e=>'"'.concat(String(e).replace(/"/g,'""'),'"')).join(",")).join("\n")],{type:"text/csv;charset=utf-8;"}),t=URL.createObjectURL(e),s=document.createElement("a"),r=ea.from||ea.to?"_".concat(ea.from?(0,eS.Z)(ea.from,"M-dd-yy"):"start","_to_").concat(ea.to?(0,eS.Z)(ea.to,"M-dd-yy"):"now"):"_all";s.href=t,s.download="Invoices".concat(r,".csv"),document.body.appendChild(s),s.click(),s.remove(),URL.revokeObjectURL(t),K.Am.success("Exported ".concat(ei.length," invoice(s) to CSV"))},children:[(0,r.jsx)(eR.Z,{className:"h-3.5 w-3.5 mr-1.5"}),"Export CSV"]})]})]}),(0,r.jsxs)(Z,{children:["Your records — every invoice across all brands. ",ei.length," invoice(s)",ea.from||ea.to?" in range":" total"," • $",en.toFixed(2)]})]}),(0,r.jsx)(z,{children:0===ei.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No invoices exported yet"}):(0,r.jsx)("div",{className:"overflow-x-auto",children:(0,r.jsxs)(O,{children:[(0,r.jsx)(R,{children:(0,r.jsxs)(L,{children:[(0,r.jsx)(V,{children:"Date"}),(0,r.jsx)(V,{children:"Brand"}),(0,r.jsx)(V,{children:"Invoice #"}),(0,r.jsx)(V,{children:"Amount"}),(0,r.jsx)(V,{children:"Status"})]})}),(0,r.jsx)(T,{children:ei.map(e=>(0,r.jsxs)(L,{onClick:()=>H(e),className:"cursor-pointer hover:bg-muted/50",children:[(0,r.jsx)(W,{className:"text-sm whitespace-nowrap",children:(0,eS.Z)(new Date(e.exportedAt),"MMM d, yyyy")}),(0,r.jsx)(W,{children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("img",{src:eD[e.brand]||"/placeholder.svg",alt:"",className:"h-4 w-4 rounded object-contain shrink-0"}),(0,r.jsx)("span",{className:"text-sm whitespace-nowrap",children:e.brand})]})}),(0,r.jsxs)(W,{className:"text-sm",children:["#",e.invoiceNumber]}),(0,r.jsxs)(W,{className:"text-sm font-medium",children:["$",e.totalAmount.toFixed(2)]}),(0,r.jsx)(W,{children:(0,r.jsx)(I,{variant:"outline",className:e.isPaid?"bg-green-100 text-green-800 dark:bg-green-950/40 dark:text-green-300":"bg-yellow-100 text-yellow-800 dark:bg-yellow-950/40 dark:text-yellow-300",children:e.isPaid?"Paid":"Unpaid"})})]},"".concat(e.brand,"-").concat(e.id)))})]})})})]}):(0,r.jsx)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:Object.entries(eI).map(e=>{let[s,a]=e,l=t[s]||[],n=eo(s),o=n>=200;return(0,r.jsxs)(P,{className:"relative",children:[(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)(S,{className:"flex items-center gap-2",children:[(0,r.jsx)("img",{src:eD[s]||"/placeholder.svg",alt:"",className:"h-6 w-6 rounded object-contain shrink-0"}),s]}),(0,r.jsxs)(I,{variant:"outline",className:eE[s],children:[l.length," projects"]})]}),(0,r.jsx)(Z,{children:a})]}),(0,r.jsxs)(z,{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)(te.Z,{className:"h-4 w-4"}),(0,r.jsx)("span",{className:"font-medium",children:"Total Amount"})]}),(0,r.jsxs)("div",{className:"text-right",children:[(0,r.jsxs)("div",{className:"text-lg font-bold ".concat(o?"text-green-600":"text-foreground"),children:["$",n.toFixed(2)]}),o&&(0,r.jsx)("div",{className:"text-xs text-green-600",children:"Ready to invoice"})]})]}),(0,r.jsx)("div",{className:"space-y-2",children:0===l.length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No completed projects"}):l.map(e=>{var t;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("p",{className:"font-medium text-sm truncate",children:e.title}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e.type})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"font-medium text-sm",children:["$",null===(t=e.invoicePrice)||void 0===t?void 0:t.toFixed(2)]}),(0,r.jsx)(m,{variant:"ghost",size:"sm",onClick:()=>C({type:"remove",brand:s,projectId:e.id,title:e.title}),className:"h-6 w-6 p-0 text-red-600 hover:text-red-700",children:(0,r.jsx)(es.Z,{className:"h-3 w-3"})})]})]},e.id)})}),(0,r.jsx)(eG,{}),(0,r.jsxs)(m,{onClick:()=>ef(s),disabled:0===l.length,className:"w-full",variant:o?"default":"outline",children:[(0,r.jsx)(eR.Z,{className:"h-4 w-4 mr-2"}),"Export Invoice PDF"]}),(i[s]||[]).filter(e=>!e.archived).length>0&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(eG,{}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)(h,{className:"text-sm font-medium text-foreground",children:"Invoice History"}),(0,r.jsxs)(m,{variant:"ghost",size:"sm",onClick:()=>C({type:"clear",brand:s,count:i[s].filter(e=>!e.archived).length}),className:"text-red-600 hover:text-red-700 h-6 px-2",children:[(0,r.jsx)(es.Z,{className:"h-3 w-3 mr-1"}),"Clear"]})]}),i[s].filter(e=>!e.archived).map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"font-medium text-sm",children:e.fileName}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["#",e.invoiceNumber," • $",e.totalAmount.toFixed(2)," •"," ",(0,eS.Z)(e.exportedAt,"MMM dd, yyyy")]})]}),(0,r.jsx)(m,{variant:e.isPaid?"default":"outline",size:"sm",onClick:()=>ec(s,e.id),className:e.isPaid?"bg-green-600 hover:bg-green-700":"",children:e.isPaid?"Paid ✓":"Mark Paid"})]},e.id))]})]}),l.length>0&&(0,r.jsxs)("p",{className:"text-xs text-muted-foreground text-center",children:["Next invoice #: ",c[s].toString().padStart(3,"0")]})]})]},s)})}),(0,r.jsx)(e$,{open:!!k,onOpenChange:e=>!e&&C(null),children:(0,r.jsxs)(eQ,{children:[(0,r.jsxs)(e0,{children:[(0,r.jsx)(e2,{children:(null==k?void 0:k.type)==="remove"?"Remove from invoice?":"Clear invoice history?"}),(0,r.jsx)(e4,{children:(null==k?void 0:k.type)==="remove"?'"'.concat(k.title,'" will be removed from the ').concat(k.brand," invoice. This deletes the record from the database and cannot be undone."):(null==k?void 0:k.type)==="clear"?"This clears ".concat(k.count," invoice(s) from ").concat(k.brand,"'s history here. They aren't deleted — you'll still find them in All Invoices and Year in Review."):""})]}),(0,r.jsxs)(e1,{children:[(0,r.jsx)(e3,{children:"Cancel"}),(0,r.jsx)(e5,{className:"bg-red-600 hover:bg-red-700 focus:ring-red-600",onClick:()=>{(null==k?void 0:k.type)==="remove"?ed(k.brand,k.projectId):(null==k?void 0:k.type)==="clear"&&ex(k.brand),C(null)},children:(null==k?void 0:k.type)==="remove"?"Remove":"Clear History"})]})]})}),(0,r.jsx)(B,{open:!!M,onOpenChange:e=>!e&&H(null),children:(0,r.jsx)(G,{className:"max-w-lg",children:M&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(J,{children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("img",{src:eD[M.brand]||"/placeholder.svg",alt:"",className:"h-6 w-6 rounded object-contain shrink-0"}),(0,r.jsxs)($,{children:[M.brand," — Invoice #",M.invoiceNumber]})]}),(0,r.jsx)(X,{children:(0,eS.Z)(new Date(M.exportedAt),"EEEE, MMMM d, yyyy")})]}),(0,r.jsx)("div",{className:"space-y-2",children:(M.projects||[]).map((e,t)=>(0,r.jsxs)("div",{className:"flex items-center justify-between p-2.5 rounded-lg bg-muted/50 text-sm",children:[(0,r.jsxs)("div",{className:"min-w-0 pr-2",children:[(0,r.jsx)("p",{className:"font-medium truncate",children:e.title}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:e.type})]}),(0,r.jsxs)("span",{className:"font-medium shrink-0",children:["$",(e.invoicePrice||0).toFixed(2)]})]},t))}),(0,r.jsxs)("div",{className:"flex items-center justify-between pt-2 border-t",children:[(0,r.jsx)("span",{className:"font-medium",children:"Total"}),(0,r.jsxs)("span",{className:"text-lg font-bold",children:["$",M.totalAmount.toFixed(2)]})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[(0,r.jsx)(m,{variant:M.isPaid?"default":"outline",className:d("flex-1",M.isPaid&&"bg-green-600 hover:bg-green-700"),onClick:()=>{ec(M.brand,M.id),H(e=>e?{...e,isPaid:!e.isPaid}:e)},children:M.isPaid?"Paid ✓":"Mark Paid"}),(0,r.jsxs)(m,{variant:"outline",className:"flex-1",onClick:()=>eh(M),children:[(0,r.jsx)(eR.Z,{className:"h-4 w-4 mr-2"}),"Download PDF"]})]})]})})})]})}async function tr(){let{count:e,error:t}=await eY.from("pmp_projects").select("id",{count:"exact",head:!0}).eq("status","Pending");return t?0:null!=e?e:0}let ta=e=>e<=3?"bg-red-100 text-red-800 dark:bg-red-950/40 dark:text-red-300":e<=7?"bg-yellow-100 text-yellow-800 dark:bg-yellow-950/40 dark:text-yellow-300":"bg-blue-100 text-blue-800 dark:bg-blue-950/40 dark:text-blue-300",tl={Pending:"bg-muted text-foreground","In Progress":"bg-blue-100 text-blue-800 dark:bg-blue-950/40 dark:text-blue-300",Completed:"bg-green-100 text-green-800 dark:bg-green-950/40 dark:text-green-300"};function ti(e){let{brand:t,className:s}=e;return(0,r.jsxs)(I,{variant:"outline",className:d(eE[t],"gap-1.5 pl-1",s),children:[(0,r.jsx)("img",{src:eD[t]||"/placeholder.svg",alt:"",className:"h-4 w-4 roun
1ded-sm object-contain shrink-0"}),t]})}function tn(e){var t;let{project:s,onStatusChange:a,onDelete:l,onEdit:i,onProjectClick:n,userRole:o}=e,{attributes:d,listeners:c,setNodeRef:x,transform:u,transition:p}=(0,eV.nB)({id:s.id}),h={transform:eW.ux.Transform.toString(u),transition:p};return(0,r.jsx)(P,{ref:x,style:h,className:"mb-4 touch-manipulation",children:(0,r.jsxs)(z,{className:"p-4",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,r.jsx)("button",{className:"cursor-grab active:cursor-grabbing p-2 touch-manipulation flex-shrink-0",...d,...c,children:(0,r.jsx)(Q.Z,{className:"h-5 w-5 text-muted-foreground"})}),(0,r.jsx)("button",{onClick:()=>n(s),className:"font-semibold text-base sm:text-lg truncate text-left hover:text-blue-600 transition-colors flex-1 min-w-0",children:s.title}),(null===(t=s.files)||void 0===t?void 0:t.length)>0&&(0,r.jsxs)("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground shrink-0",children:[(0,r.jsx)(ee.Z,{className:"h-3.5 w-3.5"}),s.files.length]})]}),(0,r.jsxs)("div",{className:"flex gap-1 ml-2 flex-shrink-0",children:[(0,r.jsx)(m,{variant:"ghost",size:"sm",onClick:()=>i(s),className:"h-9 w-9 p-0",children:(0,r.jsx)(et.Z,{className:"h-4 w-4"})}),(0,r.jsx)(m,{variant:"ghost",size:"sm",onClick:()=>l(s.id),className:"h-9 w-9 p-0 text-red-600 hover:text-red-700",children:(0,r.jsx)(es.Z,{className:"h-4 w-4"})})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,r.jsx)(ti,{brand:s.brand}),(0,r.jsx)(I,{variant:"outline",children:s.type}),(0,r.jsxs)(I,{variant:"outline",className:ta(s.priority),children:["#",s.priority]})]}),(0,r.jsx)("button",{onClick:()=>n(s),className:"text-sm text-muted-foreground line-clamp-3 text-left hover:text-foreground transition-colors w-full",children:s.description}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2",children:[(0,r.jsxs)("span",{className:"text-sm text-muted-foreground",children:["Due: ",(0,eS.Z)(s.deadline,"MMM dd, yyyy")]}),"admin"===o?(0,r.jsxs)(N,{value:s.status,onValueChange:e=>a(s.id,e),children:[(0,r.jsx)(w,{className:"w-full sm:w-36 h-9",children:(0,r.jsx)(y,{})}),(0,r.jsxs)(_,{children:[(0,r.jsx)(F,{value:"Pending",children:"Pending"}),(0,r.jsx)(F,{value:"In Progress",children:"In Progress"}),(0,r.jsx)(F,{value:"Completed",children:"Completed"})]})]}):(0,r.jsx)(I,{variant:"outline",className:"".concat(tl[s.status]," text-xs"),children:s.status})]})]})]})})}function to(e){var t;let{project:s,onStatusChange:a,onDelete:l,onEdit:i,onProjectClick:n,userRole:o}=e,{attributes:d,listeners:c,setNodeRef:x,transform:u,transition:p}=(0,eV.nB)({id:s.id}),h={transform:eW.ux.Transform.toString(u),transition:p};return(0,r.jsxs)(L,{ref:x,style:h,className:"group cursor-pointer hover:bg-muted/50",children:[(0,r.jsx)(W,{className:"w-[200px]",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("button",{className:"cursor-grab active:cursor-grabbing opacity-50 group-hover:opacity-100 p-1 shrink-0",...d,...c,children:(0,r.jsx)(Q.Z,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:()=>n(s),className:"font-medium hover:text-blue-600 transition-colors text-left truncate",children:s.title}),(null===(t=s.files)||void 0===t?void 0:t.length)>0&&(0,r.jsxs)("span",{className:"flex items-center gap-0.5 text-xs text-muted-foreground shrink-0",children:[(0,r.jsx)(ee.Z,{className:"h-3.5 w-3.5"}),s.files.length]})]})}),(0,r.jsx)(W,{className:"w-[120px]",children:(0,r.jsx)(ti,{brand:s.brand,className:"text-xs whitespace-nowrap"})}),(0,r.jsx)(W,{className:"w-[100px] text-sm",children:s.type}),(0,r.jsx)(W,{className:"w-[250px]",children:(0,r.jsx)("button",{onClick:()=>n(s),className:"truncate text-sm text-muted-foreground hover:text-foreground transition-colors text-left max-w-[230px] block",children:s.description})}),(0,r.jsx)(W,{className:"w-[120px] text-sm",children:(0,eS.Z)(s.deadline,"MMM dd, yyyy")}),(0,r.jsx)(W,{className:"w-[100px]",children:(0,r.jsxs)(I,{variant:"outline",className:"".concat(ta(s.priority)," text-xs whitespace-nowrap"),children:["#",s.priority]})}),(0,r.jsx)(W,{className:"w-[140px]",children:"admin"===o?(0,r.jsxs)(N,{value:s.status,onValueChange:e=>a(s.id,e),children:[(0,r.jsx)(w,{className:"w-[130px] h-8",children:(0,r.jsx)(y,{})}),(0,r.jsxs)(_,{children:[(0,r.jsx)(F,{value:"Pending",children:"Pending"}),(0,r.jsx)(F,{value:"In Progress",children:"In Progress"}),(0,r.jsx)(F,{value:"Completed",children:"Completed"})]})]}):(0,r.jsx)(I,{variant:"outline",className:"".concat(tl[s.status]," text-xs"),children:s.status})}),(0,r.jsx)(W,{className:"w-[100px]",children:(0,r.jsxs)("div",{className:"flex gap-1",children:[(0,r.jsx)(m,{variant:"ghost",size:"sm",onClick:()=>i(s),className:"h-8 w-8 p-0",children:(0,r.jsx)(et.Z,{className:"h-4 w-4"})}),(0,r.jsx)(m,{variant:"ghost",size:"sm",onClick:()=>l(s.id),className:"h-8 w-8 p-0 text-red-600 hover:text-red-700",children:(0,r.jsx)(es.Z,{className:"h-4 w-4"})})]})})]})}function td(){var e;let[t,s]=(0,a.useState)([]),[l,i]=(0,a.useState)(null),[n,o]=(0,a.useState)(null),[c,u]=(0,a.useState)(null),[p,g]=(0,a.useState)(!0),[j,b]=(0,a.useState)(!1),[k,C]=(0,a.useState)(new Map),[E,D]=(0,a.useState)("client"),[W,H]=(0,a.useState)([]),[q,Y]=(0,a.useState)("projects"),[U,Q]=(0,a.useState)({"Wami Live":[],"Luck On Fourth":[],"The Hideout":[],"What's Good Chicago":[],"Wally's":[]}),[ee,eb]=(0,a.useState)({"Wami Live":[],"Luck On Fourth":[],"The Hideout":[],"What's Good Chicago":[],"Wally's":[]}),[ew,ek]=(0,a.useState)(null),[eC,e_]=(0,a.useState)({title:"",brand:"",type:"",description:"",deadline:void 0,priority:1,files:[],song:""}),[eF,eA]=(0,a.useState)(0),eE=["Brand","Type","Details","Files","Schedule","Review"],eI=()=>{setTimeout(()=>eA(e=>Math.min(e+1,eE.length-1)),200)},eR=e=>{e_(t=>({...t,brand:e})),eI()},eW=e=>{e_(t=>({...t,type:e})),eI()};!function(){let e=(0,a.useCallback)(async()=>{var e;e=await tr(),"undefined"!=typeof navigator&&"setAppBadge"in navigator&&(e>0?navigator.setAppBadge(e).catch(()=>{}):navigator.clearAppBadge().catch(()=>{}))},[]);(0,a.useEffect)(()=>{e();let t=()=>e();window.addEventListener("focus",t);let s=eY.channel("pmp-badge-sync").on("postgres_changes",{event:"*",schema:"public",table:"pmp_projects"},t=>{if(e(),"INSERT"===t.eventType){var s,r;!function(e,t){if("Notification"in window&&"granted"===Notification.permission&&"visible"!==document.visibilityState)try{new Notification(e,{body:t,icon:"/icon-192.png"})}catch(e){}}("New project queued",null!==(r=null===(s=t.new)||void 0===s?void 0:s.title)&&void 0!==r?r:"New project queued")}}).subscribe();return()=>{window.removeEventListener("focus",t),eY.removeChannel(s)}},[e])}();let[eH,eq]=(0,a.useState)("default");(0,a.useEffect)(()=>
1{if(!("Notification"in window)){eq("unsupported");return}eq(Notification.permission)},[]);let eB=(0,eL.Dy)((0,eL.VT)(eL.we,{activationConstraint:{distance:8}}),(0,eL.VT)(eL.LO,{activationConstraint:{delay:200,tolerance:8}}),(0,eL.VT)(eL.Lg,{coordinateGetter:eV.is})),[eU,eG]=(0,a.useState)({isOpen:!1,project:null,price:""}),[eJ,e$]=(0,a.useState)({isOpen:!1,type:"completed",count:0});(0,a.useEffect)(()=>{eX()},[]),(0,a.useEffect)(()=>{if(!l){let e=t.filter(e=>"Completed"!==e.status).length;e_(t=>({...t,priority:e+1}))}},[t,l]);let eX=async()=>{try{g(!0);let{data:e,error:t}=await eY.from("pmp_projects").select("*").order("priority",{ascending:!0});if(t){console.error("Error loading projects:",t),K.Am.error("Failed to load projects: "+t.message);return}let r=(e||[]).map(e=>({...e,deadline:new Date(e.deadline),created_at:new Date(e.created_at),files:(e.files||[]).map(e=>({...e,uploadedAt:new Date(e.uploadedAt)}))}));s(r)}catch(t){console.error("Error loading projects:",t),K.Am.error("Failed to load projects. Please check your database setup.");let e=localStorage.getItem("projects");if(e)try{let t=JSON.parse(e).map(e=>({...e,deadline:new Date(e.deadline),created_at:new Date(e.created_at),files:e.files||[],priority:e.priority||1}));t.sort((e,t)=>e.priority-t.priority),s(t),K.Am.success("Loaded projects from local storage")}catch(e){console.error("Error parsing localStorage:",e)}}finally{g(!1)}},eK=e=>{e2(Array.from(e.target.files||[]))},eQ=e=>{e.preventDefault(),e2(Array.from(e.dataTransfer.files))},e0=e=>{e.preventDefault()},e1=e=>{e.preventDefault()},e2=e=>{let t=eC.files.length;if(t>=8){K.Am.error("Maximum ".concat(8," files allowed per project."));return}let s=8-t,r=e.slice(0,s);e.length>s&&K.Am.error("Only ".concat(s," more file(s) allowed. ").concat(e.length-s," file(s) skipped."));let a=r.filter(e=>!(e.size>10485760)||(K.Am.error("File ".concat(e.name," is too large. Maximum size is 10MB.")),!1)),l=new Map(k),i=a.map(e=>{let t=Date.now().toString()+Math.random().toString(36).substr(2,9);return l.set(t,e),{id:t,name:e.name,size:e.size,type:e.type,url:URL.createObjectURL(e),uploadedAt:new Date}});C(l),e_(e=>({...e,files:[...e.files,...i]}))},e4=e=>{let t=new Map(k);t.delete(e),C(t),e_(t=>({...t,files:t.files.filter(t=>t.id!==e)}))},e5=async e=>{if(e.preventDefault(),!eC.title||!eC.brand||!eC.type||!eC.description||!eC.deadline||!eC.priority){K.Am.error("Please fill in all fields");return}b(!0);try{let e=[];for(let t of eC.files){let s=k.get(t.id);if(s){let r=Date.now(),a=t.name.replace(/[^a-zA-Z0-9._-]/g,"_"),l="pmp/".concat(eC.brand,"/").concat(r,"_").concat(a),{error:i}=await eY.storage.from("pmp-project-files").upload(l,s,{cacheControl:"3600",upsert:!1});if(i){console.error("Error uploading file:",i),K.Am.error("Failed to upload ".concat(t.name));continue}let{data:n}=eY.storage.from("pmp-project-files").getPublicUrl(l);e.push({...t,url:n.publicUrl,storagePath:l})}else e.push(t)}let t={title:eC.title,brand:eC.brand,type:eC.type,description:eC.description,deadline:eC.deadline.toISOString(),priority:eC.priority,status:(null==l?void 0:l.status)||"Pending",files:e,song:"Promo Video"===eC.type&&eC.song||null};if(l){let{error:e}=await eY.from("pmp_projects").update(t).eq("id",l.id);if(e){console.error("Error updating project:",e),K.Am.error("Failed to update project");return}K.Am.success("Project updated successfully!"),i(null)}else{let{error:e}=await eY.from("pmp_projects").insert([t]);if(e){console.error("Error creating project:",e),K.Am.error("Failed to create project");return}K.Am.success("Project created successfully!"),fetch("/api/pmp/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:"New project queued",message:t.title,url:"/"})}).catch(()=>{})}C(new Map),e_({title:"",brand:"",type:"",description:"",deadline:void 0,priority:tm.length+1,files:[],song:""}),eA(0),await eX()}catch(e){console.error("Error submitting project:",e),K.Am.error("Failed to submit project")}finally{b(!1)}},e3=async(e,r)=>{try{if("Completed"===r){let s=t.find(t=>t.id===e);if(s){eG({isOpen:!0,project:s,price:""});return}}let{error:a}=await eY.from("pmp_projects").update({status:r}).eq("id",e);if(a){console.error("Error updating status:",a),K.Am.error("Failed to update status");return}s(t=>t.map(t=>
1t.id===e?{...t,status:r}:t)),"Completed"!==r&&K.Am.success("Status updated successfully!")}catch(e){console.error("Error updating status:",e),K.Am.error("Failed to update status")}},e8=async()=>{if(!eU.project)return;let e=Number.parseFloat(eU.price);if(isNaN(e)||e<0){K.Am.error("Please enter a valid price");return}try{let{error:t}=await eY.from("pmp_projects").update({status:"Completed"}).eq("id",eU.project.id);if(t){console.error("Error updating status:",t),K.Am.error("Failed to update status");return}let{error:r}=await eY.from("pmp_invoice_projects").insert([{project_id:eU.project.id,title:eU.project.title,brand:eU.project.brand,type:eU.project.type,description:eU.project.description,deadline:eU.project.deadline.toISOString(),priority:eU.project.priority,status:"Completed",created_at:eU.project.created_at.toISOString(),files:eU.project.files||[],invoice_price:e,added_to_invoice_at:new Date().toISOString()}]);if(r){console.error("Error saving to invoice_projects:",r),K.Am.error("Failed to save to invoice");return}if(eU.project.files&&eU.project.files.length>0){let e=eU.project.files.filter(e=>e.storagePath).map(e=>e.storagePath);if(e.length>0){let{error:t}=await eY.storage.from("pmp-project-files").remove(e);t&&console.error("Error deleting files from storage:",t)}await eY.from("pmp_projects").update({files:[]}).eq("id",eU.project.id)}let a={...eU.project,status:"Completed",invoicePrice:e,addedToInvoiceAt:new Date};Q(e=>({...e,[eU.project.brand]:[...e[eU.project.brand],a]})),s(e=>e.map(e=>e.id===eU.project.id?{...e,status:"Completed"}:e)),eG({isOpen:!1,project:null,price:""}),K.Am.success("Project completed and added to ".concat(eU.project.brand," invoice ($").concat(e,") - Saved to database!"))}catch(e){console.error("Error updating status:",e),K.Am.error("Failed to update status")}},e6=async e=>{let s=t.find(t=>t.id===e);s&&e$({isOpen:!0,type:"completed",count:1,brand:'Delete "'.concat(s.title,'"'),projectId:e})},e9=async()=>{let e=t.filter(e=>"Completed"===e.status);if(0===e.length){K.Am.error("No completed projects to clear");return}e$({isOpen:!0,type:"completed",count:e.length})},e7=async()=>{if("invoice"===eJ.type&&eJ.brand){eb(e=>({...e,[eJ.brand]:[]})),K.Am.success("Cleared ".concat(eJ.count," invoices from ").concat(eJ.brand," history")),e$({isOpen:!1,type:"completed",count:0});return}if(ew){Q(e=>({...e,[ew.brand]:e[ew.brand].filter(e=>e.id!==ew.projectId)})),K.Am.success("Project removed from invoice"),e$({isOpen:!1,type:"completed",count:0}),ek(null);return}if(eJ.projectId){let e=eJ.projectId;try{let{error:t}=await eY.from("pmp_projects").delete().eq("id",e);if(t){console.error("Error deleting project:",t),K.Am.error("Failed to delete project");return}K.Am.success("Project deleted successfully!"),await eX()}catch(e){console.error("Error deleting project:",e),K.Am.error("Failed to delete project")}finally{e$({isOpen:!1,type:"completed",count:0})}return}try{g(!0);let{error:e}=await eY.from("pmp_projects").delete().eq("status","Completed");if(e){console.error("Error clearing completed projects:",e),K.Am.error("Failed to clear completed projects");return}K.Am.success("Successfully cleared ".concat(eJ.count," completed projects from database. Invoice data preserved.")),await eX()}catch(e){console.error("Error clearing completed projects:",e),K.Am.error("Failed to clear completed projects")}finally{g(!1),e$({isOpen:!1,type:"completed",count:0})}},te=e=>{var t;i(e),e_({title:e.title,brand:e.brand,type:e.type,description:e.description,deadline:e.deadline,priority:e.priority,files:e.files||[],song:e.song||""}),null===(t=document.getElementById("project-submission"))||void 0===t||t.scrollIntoView({behavior:"smooth"})},tt=async e=>{let{active:r,over:a}=e;if(r.id!==(null==a?void 0:a.id)){let e=t.findIndex(e=>e.id===r.id),l=t.findIndex(e=>e.id===(null==a?void 0:a.id)),i=(0,eV.Rp)(t,e,l);s(i);try{for(let e of i.map((e,t)=>({id:e.id,priority:t+1})))await eY.from("pmp_projects").update({priority:e.priority}).eq("id",e.id);K.Am.success("Project order updated!")}catch(e){console.error("Error updating project order:",e),K.Am.error("Failed to update project order"),await eX()}}},td=e=>t.filter(t=>t.status===e),tc=()=>0===t.length?0:Math.round(td("Completed").length/t.length*100);if(p)return(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dar
1k:from-slate-950 dark:to-slate-900",children:[(0,r.jsx)("header",{className:"sticky top-0 z-50 bg-background/95 backdrop-blur-sm border-b shadow-sm",children:(0,r.jsxs)("div",{className:"container mx-auto px-4 py-4 sm:py-6 flex items-center justify-center gap-3",children:[(0,r.jsx)(eZ,{className:"h-10 w-24 sm:h-12 sm:w-28 rounded-lg"}),(0,r.jsx)(eZ,{className:"h-10 w-24 sm:h-12 sm:w-28 rounded-lg"}),(0,r.jsx)(eZ,{className:"h-10 w-10 sm:h-12 sm:w-12 rounded-lg"})]})}),(0,r.jsxs)("div",{className:"container mx-auto px-4 py-4 sm:py-6 md:py-8 space-y-6 sm:space-y-8 md:space-y-12",children:[(0,r.jsxs)(P,{className:"max-w-2xl mx-auto",children:[(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsx)(eZ,{className:"h-6 w-40 mb-2"}),(0,r.jsx)(eZ,{className:"h-4 w-64"})]}),(0,r.jsxs)(z,{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,r.jsx)(er.Z,{className:"h-4 w-4 animate-spin text-muted-foreground"}),(0,r.jsx)("span",{className:"text-sm text-muted-foreground",children:"Loading your projects…"})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsx)(eZ,{className:"h-28 rounded-xl"}),(0,r.jsx)(eZ,{className:"h-28 rounded-xl"}),(0,r.jsx)(eZ,{className:"h-28 rounded-xl"}),(0,r.jsx)(eZ,{className:"h-28 rounded-xl"})]})]})]}),(0,r.jsxs)(P,{children:[(0,r.jsx)(A,{className:"pb-4",children:(0,r.jsx)(eZ,{className:"h-6 w-32"})}),(0,r.jsxs)(z,{className:"space-y-3",children:[(0,r.jsx)(eZ,{className:"h-14 w-full rounded-lg"}),(0,r.jsx)(eZ,{className:"h-14 w-full rounded-lg"}),(0,r.jsx)(eZ,{className:"h-14 w-full rounded-lg"})]})]})]})]});let tm=t.filter(e=>"Completed"!==e.status);return(0,r.jsxs)("div",{className:"min-h-screen bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-950 dark:to-slate-900",children:[(0,r.jsx)("header",{className:"sticky top-0 z-50 bg-background/95 backdrop-blur-sm border-b shadow-sm",children:(0,r.jsx)("div",{className:"container mx-auto px-4 py-4 sm:py-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-center gap-2 sm:gap-3",children:[(0,r.jsx)("img",{src:"/icon-192.png",alt:"",className:"hidden sm:block h-9 w-9 rounded-lg shrink-0"}),(0,r.jsxs)("div",{className:"flex items-center gap-1 bg-muted p-1 rounded-xl",children:[(0,r.jsx)("button",{onClick:()=>Y("projects"),className:d("px-3 sm:px-5 py-2 sm:py-2.5 rounded-lg text-sm sm:text-base font-semibold transition-all duration-200","projects"===q?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Projects"}),(0,r.jsx)("button",{onClick:()=>Y("drive"),className:d("px-3 sm:px-5 py-2 sm:py-2.5 rounded-lg text-sm sm:text-base font-semibold transition-all duration-200","drive"===q?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Drive Links"}),"admin"===E&&(0,r.jsx)("button",{onClick:()=>Y("invoices"),className:d("px-3 sm:px-5 py-2 sm:py-2.5 rounded-lg text-sm sm:text-base font-semibold transition-all duration-200","invoices"===q?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Invoices"})]}),(0,r.jsx)("div",{className:"w-px h-7 bg-border mx-1 hidden sm:block"}),"admin"===E&&(0,r.jsxs)(ev,{children:[(0,r.jsx)(eN,{asChild:!0,children:(0,r.jsxs)(m,{variant:"outline",size:"lg",className:"h-10 w-10 sm:h-12 sm:w-12 p-0 transition-all duration-200 hover:scale-110 border-2 hover:border-blue-500 hover:text-blue-600 relative",title:"Notifications",children:[(0,r.jsx)(ea.Z,{className:"h-5 w-5 sm:h-6 sm:w-6"}),"granted"===eH&&(0,r.jsx)("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-green-500"})]})}),(0,r.jsxs)(ey,{align:"end",className:"w-72 p-4 space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-semibold text-sm",children:"Push Notifications"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Banner + sound when a new project is queued — even with the app closed."})]}),"granted"===eH?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-green-700 dark:text-green-400",children:[(0,r.jsx)(el.Z,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{children:"Enabled — you'll get banners and sounds."})]}):"denied"===eH?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-sm text-red-600",children:[(0,r.jsx)(ei.Z,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{children:"Blocked by browser. Allow in site settings then reload."})]}):"unsupported"===eH?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"Not supported in this browser."}):(0,r.jsxs)(m,{size:"sm",className:"w-full",onClick:async()=>
1{try{if(!("Notification"in window)||!("serviceWorker"in navigator))return;let e=await Notification.requestPermission();if(eq(e),"granted"!==e)return;let t="BLlwIHLH5wR6YasZzFbbcSd8jTh8_FEcrvmg-nIisjq5WswX9RK2RWW2fZCgILys1QqzuJlX2XR-PXxUq_j_Byw";if(!t){new Notification("Notifications active",{body:"You'll be notified when the app is open.",icon:"/icon-192.png"});return}let s=await navigator.serviceWorker.ready,r=await s.pushManager.getSubscription(),a=null!=r?r:await s.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t});await fetch("/api/pmp/push/subscribe",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({subscription:a.toJSON()})}),new Notification("Notifications active",{body:"You'll get banners and sounds for new projects — even with the app closed.",icon:"/icon-192.png"})}catch(e){console.error("[PMP] Push subscribe error:",e)}},children:[(0,r.jsx)(ea.Z,{className:"h-4 w-4 mr-2"}),"Enable Notifications"]})]})]}),(0,r.jsx)(m,{variant:"admin"===E?"default":"outline",size:"lg",onClick:()=>D("admin"===E?"client":"admin"),className:"h-10 w-10 sm:h-12 sm:w-12 p-0 transition-all duration-200 hover:scale-110 ".concat("admin"===E?"bg-green-600 hover:bg-green-700 shadow-lg":"border-2 hover:border-green-600 hover:text-green-600"),title:"admin"===E?"Exit Admin Mode":"Enter Admin Mode",children:(0,r.jsx)(en.Z,{className:"h-5 w-5 sm:h-6 sm:w-6"})})]})})}),"drive"===q?(0,r.jsx)("div",{className:"container mx-auto px-4 py-4 sm:py-6 md:py-8",children:(0,r.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,r.jsxs)("div",{className:"mb-6",children:[(0,r.jsx)("h2",{className:"text-2xl font-bold mb-2",children:"Drive Links"}),(0,r.jsx)("p",{className:"text-muted-foreground",children:"Access completed project files organized by brand"})]}),(0,r.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:ez.map(e=>(0,r.jsxs)(P,{className:"overflow-hidden hover:shadow-lg transition-shadow h-full flex flex-col",children:[(0,r.jsx)("div",{className:"flex items-center justify-center h-28 bg-muted/50 p-5 shrink-0",children:(0,r.jsx)("img",{src:eD[e]||"/placeholder.svg",alt:e,className:"max-h-full max-w-full object-contain"})}),(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsx)(S,{className:d("flex items-center gap-2",eO[e].text),children:e}),(0,r.jsxs)(Z,{children:["Access all completed ",e," project files"]})]}),(0,r.jsx)(z,{className:"mt-auto pt-0",children:eM[e]?(0,r.jsxs)(m,{onClick:()=>window.open(eM[e],"_blank"),className:d("w-full h-11 flex items-center justify-center gap-2",eO[e].button),children:[(0,r.jsx)(eo.Z,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{children:"Open Drive Folder"})]}):(0,r.jsxs)(m,{disabled:!0,variant:"outline",className:"w-full h-11 flex items-center justify-center gap-2",children:[(0,r.jsx)(eo.Z,{className:"h-4 w-4 shrink-0"}),(0,r.jsx)("span",{children:"Drive folder coming soon"})]})})]},e))})]})}):"invoices"===q&&"admin"===E?(0,r.jsx)("div",{className:"container mx-auto px-4 py-4 sm:py-6 md:py-8",children:(0,r.jsx)(ts,{invoiceProjects:U,setInvoiceProjects:Q,onClearInvoiceHistory:(e,t)=>{e$({isOpen:!0,type:"invoice",brand:e,count:t})},exportedInvoices:ee,setExportedInvoices:eb,onDeleteProject:(e,t,s)=>{e$({isOpen:!0,type:"completed",count:1,brand:'Remove "'.concat(s,'" from ').concat(e," invoice")}),ek({brand:e,projectId:t})}})}):(0,r.jsxs)("div",{className:"container mx-auto px-4 py-4 sm:py-6 md:py-8 space-y-6 sm:space-y-8 md:space-y-12",children:[(0,r.jsx)("section",{id:"project-submission",className:"scroll-mt-20",children:(0,r.jsxs)(P,{className:"max-w-2xl mx-auto",children:[(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsxs)(S,{className:"flex items-center gap-2 text-base sm:text-lg md:text-xl",children:[(0,r.jsx)(ed.Z,{className:"h-4 w-4 sm:h-5 sm:w-5"}),l?"Edit Project":"Submit New Project"]}),(0,r.jsx)(Z,{className:"text-sm",children:l?"Update project details":"Fill out the form below to submit a new project request"})]}),(0,r.jsx)(z,{children:l?(0,r.jsxs)("form",{onSubmit:e5,className:"space-y-4 md:space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"brand",children:"Brand"}),(0,r.jsxs)(N,{value:eC.brand,onValueChange:e=>e_(t=>({...t,brand:e})),children:[(0,r.jsx)(w,{className:"h-10",children:(0,r.jsx)(y,{placeholder:"Select brand"})}),(0,r.jsx)(_,{children:ez.map(e=>(0,r.jsx)(F,{value:e,children:e},e))})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"type",children:"Project Type"}),(0,r.jsxs)(N,{value:eC.type,onValueChange:e=>e_(t=>({...t,type:e})),children:[(0,r.jsx)(w,{className:"h-10",children:(0,r.jsx)(y,{placeholder:"Select type"})}),(0,r.jsxs)(_,{children:[(0,r.jsx)(F,{value:"Flyer",children:"Flyer"}),(0,r.jsx)(F,{value:"Promo Video",children:"Promo Video"})]})]})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"title",children:"Project Title"}),(0,r.jsx)(x,{id:"title",value:eC.title,onChange:e=>e_(t=>({...t,title:e.target.value})),placeholder:"Enter project title",className:"h-10"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"description",children:"Description"}),(0,r.jsx)(f,{id:"description",value:eC.description,onChange:e=>e_(t=>({...t,description:e.target.value})),placeholder:"Provide as much detail as possible for this project. Include any specific requirements, goals, and ideas for the design/video.",rows:4,className:"resize-none"})]}),"Promo Video"===eC.type&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)(h,{htmlFor:"song",className:"flex items-center gap-1.5",children:[(0,r.jsx)(ec.Z,{className:"h-3.5 w-3.5"}),"Song (optional)"]}),(0,r.jsx)(x,{id:"song",value:eC.song,onChange:e=>e_(t=>({...t,song:e.target.value})),placeholder:'e.g. "John Summit - Deep End"',className:"h-10"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Artist - Song Title"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"files",children:"Project Files (Optional)"}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:d("border-2 border-dashed rounded-lg p-4 sm:p-6 text-center transition-colors","border-input hover:border-muted-foreground
1/40","bg-muted/50 hover:bg-muted"),onDrop:eQ,onDragOver:e0,onDragLeave:e1,children:[(0,r.jsx)("input",{type:"file",id:"file-upload",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.txt",onChange:eK,className:"hidden"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"mx-auto w-10 h-10 sm:w-12 sm:h-12 bg-muted rounded-full flex items-center justify-center",children:(0,r.jsx)(ed.Z,{className:"h-5 w-5 sm:h-6 sm:w-6 text-muted-foreground"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-foreground",children:["Drop files here or"," ",(0,r.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=document.getElementById("file-upload"))||void 0===e?void 0:e.click()},className:"text-blue-600 hover:text-blue-700 underline",children:"browse"})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Images, PDFs, Word docs, and text files up to 10MB each (max 8 files)"}),eC.files.length>0&&(0,r.jsxs)("p",{className:"text-xs text-blue-600 mt-1 font-medium",children:[eC.files.length,"/8 files attached"]})]})]})]}),eC.files.length>0&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{className:"text-sm font-medium",children:"Attached Files"}),(0,r.jsx)("div",{className:"grid grid-cols-1 gap-2",children:eC.files.map(e=>{var t;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg border",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-blue-100 rounded flex items-center justify-center shrink-0",children:e.type.startsWith("image/")?(0,r.jsx)("img",{src:e.url||"/placeholder.svg",alt:e.name,className:"w-8 h-8 object-cover rounded"}):(0,r.jsx)("div",{className:"text-xs font-medium text-blue-600",children:null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toUpperCase()})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e.name}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(e.size/1024/1024).toFixed(2)," MB"]})]})]}),(0,r.jsx)(m,{type:"button",variant:"ghost",size:"sm",onClick:()=>e4(e.id),className:"text-red-600 hover:text-red-700 shrink-0 h-8 w-8 p-0",children:(0,r.jsx)(es.Z,{className:"h-4 w-4"})})]},e.id)})})]})]})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{children:"Deadline"}),(0,r.jsxs)(ev,{children:[(0,r.jsx)(eN,{asChild:!0,children:(0,r.jsxs)(m,{variant:"outline",className:d("w-full h-10 justify-start text-left font-normal",!eC.deadline&&"text-muted-foreground"),children:[(0,r.jsx)(em.Z,{className:"mr-2 h-4 w-4"}),eC.deadline?(0,eS.Z)(eC.deadline,"PPP"):"Pick a date"]})}),(0,r.jsx)(ey,{className:"w-auto p-0",align:"start",children:(0,r.jsx)(eP,{mode:"single",selected:eC.deadline,onSelect:e=>e_(t=>({...t,deadline:e})),initialFocus:!0})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"priority",children:"Priority (1 = Highest)"}),(0,r.jsx)(x,{id:"priority",type:"number",min:"1",max:"99",value:eC.priority,onChange:e=>e_(t=>({...t,priority:Number.parseInt(e.target.value)||1})),placeholder:"Enter priority number",className:"h-10"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Lower numbers = higher priority"})]})]}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 md:gap-4 pt-2",children:[(0,r.jsx)(m,{type:"submit",className:"flex-1 h-10",disabled:j,children:j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(er.Z,{className:"mr-2 h-4 w-4 animate-spin"}),l?"Updating...":"Submitting..."]}):l?"Update Project":"Submit Project"}),l&&(0,r.jsx)(m,{type:"button",variant:"outline",className:"h-10 bg-transparent",onClick:()=>{i(null),e_({title:"",brand:"",type:"",description:"",deadline:void 0,priority:tm.length+1,files:[],song:""}),eA(0)},children:"Cancel"})]})]}):(0,r.jsxs)("form",{onSubmit:e5,className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("div",{className:"flex items-center",children:eE.map((e,t)=>(0,r.jsxs)("div",{className:"flex-1 flex items-center last:flex-none",children:[(0,r.jsx)("div",{className:d("h-8 w-8 shrink-0 rounded-full flex items-center justify-center text-xs font-semibold transition-colors",t<eF?"bg-blue-600 text-white":t===eF?"bg-blue-600 text-white ring-4 ring-blue-100 dar
1k:ring-blue-950/50":"bg-muted text-muted-foreground"),children:t<eF?(0,r.jsx)(v.Z,{className:"h-4 w-4"}):t+1}),t<eE.length-1&&(0,r.jsx)("div",{className:d("flex-1 h-0.5 mx-1",t<eF?"bg-blue-600":"bg-muted")})]},e))}),(0,r.jsxs)("p",{className:"text-center text-sm font-medium text-muted-foreground mt-2",children:["Step ",eF+1," of ",eE.length," — ",eE[eF]]})]}),0===eF&&(0,r.jsx)("div",{className:"grid grid-cols-2 gap-4",children:ez.map(e=>(0,r.jsx)("button",{type:"button",onClick:()=>eR(e),className:d("flex flex-col items-center justify-center gap-4 p-4 sm:p-6 rounded-xl border-2 transition-all hover:scale-[1.02] min-h-[9rem] sm:min-h-[11rem]",eC.brand===e?"border-blue-600 bg-blue-50 dark:bg-blue-950/30":"border-input hover:border-muted-foreground/40"),children:(0,r.jsx)("img",{src:eD[e]||"/placeholder.svg",alt:e,className:"h-28 sm:h-36 w-full object-contain"})},e))}),1===eF&&(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,r.jsxs)("button",{type:"button",onClick:()=>eW("Flyer"),className:d("flex flex-col items-center gap-3 p-8 rounded-xl border-2 transition-all hover:scale-[1.02]","Flyer"===eC.type?"border-blue-600 bg-blue-50 dark:bg-blue-950/30":"border-input hover:border-muted-foreground/40"),children:[(0,r.jsx)(ex.Z,{className:"h-12 w-12 text-blue-600"}),(0,r.jsx)("span",{className:"font-medium",children:"Flyer"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Static design"})]}),(0,r.jsxs)("button",{type:"button",onClick:()=>eW("Promo Video"),className:d("flex flex-col items-center gap-3 p-8 rounded-xl border-2 transition-all hover:scale-[1.02]","Promo Video"===eC.type?"border-blue-600 bg-blue-50 dark:bg-blue-950/30":"border-input hover:border-muted-foreground/40"),children:[(0,r.jsx)(eu.Z,{className:"h-12 w-12 text-purple-600"}),(0,r.jsx)("span",{className:"font-medium",children:"Promo Video"}),(0,r.jsx)("span",{className:"text-xs text-muted-foreground",children:"Motion content"})]})]}),2===eF&&(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"wizard-title",children:"Project Title"}),(0,r.jsx)(x,{id:"wizard-title",value:eC.title,onChange:e=>e_(t=>({...t,title:e.target.value})),placeholder:"Enter project title",className:"h-11 text-base",autoFocus:!0})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"wizard-description",children:"Description"}),(0,r.jsx)(f,{id:"wizard-description",value:eC.description,onChange:e=>e_(t=>({...t,description:e.target.value})),placeholder:"Provide as much detail as possible for this project. Include any specific requirements, goals, and ideas for the design/video.",rows:5,className:"resize-none"})]}),"Promo Video"===eC.type&&(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)(h,{htmlFor:"wizard-song",className:"flex items-center gap-1.5",children:[(0,r.jsx)(ec.Z,{className:"h-3.5 w-3.5"}),"Song (optional)"]}),(0,r.jsx)(x,{id:"wizard-song",value:eC.song,onChange:e=>e_(t=>({...t,song:e.target.value})),placeholder:'e.g. "John Summit - Deep End"',className:"h-11"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Artist - Song Title"})]})]}),3===eF&&(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:d("border-2 border-dashed rounded-lg p-6 sm:p-8 text-center transition-colors","border-input hover:border-muted-foreground/40","bg-muted/50 hover:bg-muted"),onDrop:eQ,onDragOver:e0,onDragLeave:e1,children:[(0,r.jsx)("input",{type:"file",id:"wizard-file-upload",multiple:!0,accept:"image/*,.pdf,.doc,.docx,.txt",onCh
1ange:eK,className:"hidden"}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)("div",{className:"mx-auto w-12 h-12 bg-muted rounded-full flex items-center justify-center",children:(0,r.jsx)(ed.Z,{className:"h-6 w-6 text-muted-foreground"})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"text-sm font-medium text-foreground",children:["Drop files here or"," ",(0,r.jsx)("button",{type:"button",onClick:()=>{var e;return null===(e=document.getElementById("wizard-file-upload"))||void 0===e?void 0:e.click()},className:"text-blue-600 hover:text-blue-700 underline",children:"browse"})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Images, PDFs, Word docs, and text files up to 10MB each (max 8 files) — optional"})]})]})]}),eC.files.length>0&&(0,r.jsx)("div",{className:"space-y-2",children:eC.files.map(e=>{var t;return(0,r.jsxs)("div",{className:"flex items-center justify-between p-3 bg-muted/50 rounded-lg border",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 min-w-0 flex-1",children:[(0,r.jsx)("div",{className:"w-8 h-8 bg-blue-100 rounded flex items-center justify-center shrink-0",children:e.type.startsWith("image/")?(0,r.jsx)("img",{src:e.url||"/placeholder.svg",alt:e.name,className:"w-8 h-8 object-cover rounded"}):(0,r.jsx)("div",{className:"text-xs font-medium text-blue-600",children:null===(t=e.name.split(".").pop())||void 0===t?void 0:t.toUpperCase()})}),(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium truncate",children:e.name}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[(e.size/1024/1024).toFixed(2)," MB"]})]})]}),(0,r.jsx)(m,{type:"button",variant:"ghost",size:"sm",onClick:()=>e4(e.id),className:"text-red-600 hover:text-red-700 shrink-0 h-8 w-8 p-0",children:(0,r.jsx)(es.Z,{className:"h-4 w-4"})})]},e.id)})})]}),4===eF&&(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{children:"Deadline"}),(0,r.jsxs)(ev,{children:[(0,r.jsx)(eN,{asChild:!0,children:(0,r.jsxs)(m,{type:"button",variant:"outline",className:d("w-full h-11 justify-start text-left font-normal",!eC.deadline&&"text-muted-foreground"),children:[(0,r.jsx)(em.Z,{className:"mr-2 h-4 w-4"}),eC.deadline?(0,eS.Z)(eC.deadline,"PPP"):"Pick a date"]})}),(0,r.jsx)(ey,{className:"w-auto p-0",align:"start",children:(0,r.jsx)(eP,{mode:"single",selected:eC.deadline,onSelect:e=>e_(t=>({...t,deadline:e})),initialFocus:!0})})]})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"wizard-priority",children:"Priority (1 = Highest)"}),(0,r.jsx)(x,{id:"wizard-priority",type:"number",min:"1",max:"99",value:eC.priority,onChange:e=>e_(t=>({...t,priority:Number.parseInt(e.target.value)||1})),placeholder:"Enter priority number",className:"h-11"}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Lower numbers = higher priority"})]})]}),5===eF&&(0,r.jsxs)("div",{className:"space-y-4 rounded-lg border p-4 bg-muted/30",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[eC.brand&&(0,r.jsx)("img",{src:eD[eC.brand]||"/placeholder.svg",alt:"",className:"h-8 w-8 object-contain shrink-0"}),(0,r.jsx)("span",{className:"font-medium",children:eC.brand||"—"}),(0,r.jsxs)(I,{variant:"outline",className:"ml-auto flex items-center gap-1",children:["Promo Video"===eC.type?(0,r.jsx)(eu.Z,{className:"h-3 w-3"}):(0,r.jsx)(ex.Z,{className:"h-3 w-3"}),eC.type||"—"]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"font-semibold",children:eC.title||"Untitled project"}),(0,r.jsx)("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap mt-1",children:eC.description||"No description"})]}),"Promo Video"===eC.type&&eC.song&&(0,r.jsxs)("div",{className:"flex items-center gap-1.5 text-sm",children:[(0,r.jsx)(ec.Z,{className:"h-3.5 w-3.5 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{children:eC.song})]}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2 text-sm pt-2 border-t",children:[(0,r.jsx)("span",{className:"text-muted-foreground",children:"Deadline"}),(0,r.jsx)("span",{className:"text-right",children:eC.deadline?(0,eS.Z)(eC.deadline,"PPP"):"—"}),(0,r.jsx)("span",{className:"text-muted-foreground",children:"Priority"}),(0,r.jsxs)("span",{className:"text-right",children:["#",eC.priority]}),(0,r.jsx)("span",{className:"text-muted-foreground",children:"Files"}),(0,r.jsxs)("span",{className:"text-right",children:[eC.files.length," attached"]})]})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-2",children:[eF>0&&(0,r.jsxs)(m,{type:"button",variant:"outline",className:"h-11",onClick:()=>eA(e=>e-1),children:[(0,r.jsx)(ep.Z,{className:"h-4 w-4 mr-1"}),"Back"]}),eF<eE.length-1?(0,r.jsxs)(m,{type:"button",className:"flex-1 h-11",disabled:0===eF&&!eC.brand||1===eF&&!eC.type||2===eF&&(!eC.title||!eC.description)||4===eF&&!eC.deadline,onClick:()=>eA(e=>e+1),children:["Next",(0,r.jsx)(eh.Z,{className:"h-4 w-4 ml-1"})]}):(0,r.jsx)(m,{type:"submit",className:"flex-1 h-11",disabled:j,children:j?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(er.Z,{className:"mr-2 h-4 w-4 animate-spin"}),"Submitting..."]}):"Submit Project"})]})]})})]})}),(0,r.jsx)("section",{id:"project-list",className:"scroll-mt-20",children:(0,r.jsxs)(P,{children:[(0,r.jsxs)(A,{className:"pb-4",children:[(0,r.jsxs)(S,{className:"flex items-center gap-2 text-base sm:text-lg md:text-xl",children:[(0,r.jsx)(ef.Z,{className:"h-4 w-4 sm:h-5 sm:w-5"}),"Project List"]}),(0,r.jsx)(Z,{className:"text-sm",children:"Drag and drop projects to reorder by priority. Higher priority items should be at the top."})]}),(0,r.jsx)(z,{children:0===tm.length?(0,r.jsx)("div",{className:"text-center py-8 sm:py-12",children:(0,r.jsx)("p",{className:"text-muted-foreground",children:"No projects yet. Submit your first project above!"})}):(0,r.jsxs)(eL.LB,{sensors:eB,collisionDetection:eL.pE,onDragEnd:tt,children:[(0,r.jsx)("div",{className:"md:hidden",children:(0,r.jsx)(eV.Fo,{items:tm.map(e=>e.id),strategy:eV.qw,children:tm.map(e=>(0,r.jsx)(tn,{project:e,onStatusChange:e3,onDelete:e6,onEdit:te,onProjectClick:o,userRole:E},e.id))})}),(0,r.jsx)("div",{className:"hidden md:block overflow-x-auto",children:(0,r.jsxs)(O,{children:[(0,r.jsx)(R,{children:(0,r.jsxs)(L,{children:[(0,r.jsx)(V,{className:"w-[200px]",children:"Project Title"}),(0,r.jsx)(V,{className:"w-[120px]",children:"Brand"}),(0,r.jsx)(V,{className:"w-[100px]",children:"Type"}),(0,r.jsx)(V,{className:"w-[250px]",children:"Description"}),(0,r.jsx)(V,{className:"w-[120px]",children:"Deadline"}),(0,r.jsx)(V,{className:"w-[100px]",children:"Priority"}),(0,r.jsx)(V,{className:"w-[140px]",children:"Status"}),(0,r.jsx)(V,{className:"w-[100px]",children:"Actions"})]})}),(0,r.jsx)(T,{children:(0,r.jsx)(eV.Fo,{items:tm.map(e=>e.id),strategy:eV.qw,children:tm.map(e=>(0,r.jsx)(to,{project:e,onStatusChange:e3,onDelete:e6,onEdit:te,onProjectClick:o,userRole:E},e.id))})})]})})]})})]})}),(0,r.jsx)("section",{id:"project-status",className:"scroll-mt-20",children:(0,r.jsxs)("div",{className:"space-y-4 sm:sp
1ace-y-6",children:[(0,r.jsxs)(P,{children:[(0,r.jsx)(A,{className:"pb-4",children:(0,r.jsxs)(S,{className:"flex items-center gap-2 text-base sm:text-lg md:text-xl",children:[(0,r.jsx)(ef.Z,{className:"h-4 w-4 sm:h-5 sm:w-5"}),"Overall Progress"]})}),(0,r.jsx)(z,{children:(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"flex justify-between text-sm",children:[(0,r.jsx)("span",{children:"Completion Rate"}),(0,r.jsxs)("span",{className:"font-medium",children:[tc(),"%"]})]}),(0,r.jsx)(M,{value:tc(),className:"h-3"}),(0,r.jsxs)("p",{className:"text-sm text-muted-foreground",children:[td("Completed").length," of ",t.length," projects completed"]})]})})]}),(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-6",children:[(0,r.jsxs)(P,{children:[(0,r.jsx)(A,{className:"pb-3",children:(0,r.jsxs)(S,{className:"flex items-center gap-2 text-foreground text-sm sm:text-base md:text-lg",children:[(0,r.jsx)(ei.Z,{className:"h-4 w-4 md:h-5 md:w-5"}),"Pending (",td("Pending").length,")"]})}),(0,r.jsx)(z,{children:(0,r.jsx)("div",{className:"space-y-3",children:0===td("Pending").length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No pending projects"}):td("Pending").map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>o(e),className:"w-full text-left p-3 bg-muted/50 rounded-lg hover:bg-muted hover:shadow-sm transition-all cursor-pointer",children:[(0,r.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,r.jsx)("h4",{className:"font-medium text-sm truncate pr-2",children:e.title}),(0,r.jsx)(ti,{brand:e.brand,className:"text-xs shrink-0"})]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground mb-2",children:["Due: ",(0,eS.Z)(e.deadline,"MMM dd")]}),(0,r.jsxs)(I,{variant:"outline",className:"".concat(ta(e.priority)," text-xs"),children:["#",e.priority]})]},e.id))})})]}),(0,r.jsxs)(P,{children:[(0,r.jsx)(A,{className:"pb-3",children:(0,r.jsxs)(S,{className:"flex items-center gap-2 text-blue-700 dark:text-blue-400 text-sm sm:text-base md:text-lg",children:[(0,r.jsx)(eg.Z,{className:"h-4 w-4 md:h-5 md:w-5"}),"In Progress (",td("In Progress").length,")"]})}),(0,r.jsx)(z,{children:(0,r.jsx)("div",{className:"space-y-3",children:0===td("In Progress").length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No projects in progress"}):td("In Progress").map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>o(e),className:"w-full text-left p-3 bg-blue-50 dark:bg-blue-950/30 rounded-lg hover:bg-blue-100 dark:hover:bg-blue-950/50 hover:shadow-sm transition-all cursor-pointer",children:[(0,r.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,r.jsx)("h4",{className:"font-medium text-sm truncate pr-2",children:e.title}),(0,r.jsx)(ti,{brand:e.brand,className:"text-xs shrink-0"})]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground mb-2",children:["Due: ",(0,eS.Z)(e.deadline,"MMM dd")]}),(0,r.jsxs)(I,{variant:"outline",className:"".concat(ta(e.priority)," text-xs"),children:["#",e.priority]})]},e.id))})})]}),(0,r.jsxs)(P,{children:[(0,r.jsx)(A,{className:"pb-3",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)(S,{className:"flex items-center gap-2 text-green-700 dark:text-green-400 text-sm sm:text-base md:text-lg",children:[(0,r.jsx)(el.Z,{className:"h-4 w-4 md:h-5 md:w-5"}),"Completed (",td("Completed").length,")"]}),td("Completed").length>0&&"admin"===E&&(0,r.jsxs)(m,{variant:"outline",size:"sm",onClick:e9,className:"text-red-600 hover:text-red-700 border-red-200 hover:border-red-300 bg-transparent h-8",children:[(0,r.jsx)(es.Z,{className:"h-3 w-3 mr-1"}),(0,r.jsx)("span",{className:"hidden sm:inline",children:"Clear All"}),(0,r.jsx)("span",{className:"sm:hidden",children:"Clear"})]})]})}),(0,r.jsx)(z,{children:(0,r.jsx)("div",{className:"space-y-3",children:0===td("Completed").length?(0,r.jsx)("p",{className:"text-sm text-muted-foreground",children:"No completed projects"}):td("Completed").map(e=>(0,r.jsxs)("button",{type:"button",onClick:()=>o(e),className:"w-full text-left p-3 bg-green-50 dark:bg-green-950/30 rounded-lg opacity-75 hover:opacity-100 hover:shadow-sm transition-all cursor-pointer",children:[(0,r.jsxs)("div",{className:"flex justify-between items-start mb-2",children:[(0,r.jsx)("h4",{className:"font-medium text-sm truncate pr-2",children:e.title}),(0,r.jsx)(ti,{brand:e.brand,className:"text-xs shrink-0"})]}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground mb-2",children:["Due: ",(0,eS.Z)(e.deadline,"MMM dd")]}),(0,r.jsxs)(I,{variant:"outline",className:"".concat(ta(e.priority)," text-xs"),children:["#",e.priority]})]},e.id))})})]})]})]})})]}),(0,r.jsx)(B,{open:!!n,onOpenChange:e=>{e||(o(null),u(null))},children:(0,r.jsx)(G,{className:"max-w-2xl w-[calc(100%-2rem)] max-h-[90vh] overflow-y-auto",children:n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(J,{children:[(0,r.jsx)($,{className:"text-lg sm:text-xl md:text-2xl pr-8",children:n.title}),(0,r.jsx)(X,{className:"text-sm sm:text-base",children:"Project details and specifications"})]}
1),(0,r.jsxs)("div",{className:"space-y-4 sm:space-y-6 mt-4 sm:mt-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Brand"}),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsx)(ti,{brand:n.brand,className:"text-sm"})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Project Type"}),(0,r.jsx)("p",{className:"mt-1 text-sm font-medium",children:n.type})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Priority"}),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsxs)(I,{variant:"outline",className:"".concat(ta(n.priority)," text-sm"),children:["#",n.priority]})})]})]}),(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Status"}),(0,r.jsx)("div",{className:"mt-1",children:(0,r.jsx)(I,{variant:"outline",className:"".concat(tl[n.status]," text-sm"),children:n.status})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Deadline"}),(0,r.jsx)("p",{className:"mt-1 text-sm font-medium",children:(0,eS.Z)(n.deadline,"EEEE, MMMM dd, yyyy")})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Created"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:(0,eS.Z)(n.created_at,"MMM dd, yyyy 'at' h:mm a")})]})]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Project Description"}),(0,r.jsx)("div",{className:"mt-2 p-3 sm:p-4 bg-muted/50 rounded-lg",children:(0,r.jsx)("p",{className:"text-sm leading-relaxed whitespace-pre-wrap",children:n.description})})]}),"Promo Video"===n.type&&n.song&&(0,r.jsxs)("div",{children:[(0,r.jsx)(h,{className:"text-sm font-medium text-muted-foreground",children:"Song"}),(0,r.jsxs)("div",{className:"mt-2 p-3 bg-muted/50 rounded-lg flex items-center gap-2",children:[(0,r.jsx)(ec.Z,{className:"h-4 w-4 text-muted-foreground shrink-0"}),(0,r.jsx)("span",{className:"text-sm font-medium",children:n.song})]})]}),n.files&&n.files.length>0&&(0,r.jsxs)("div",{children:[(0,r.jsxs)(h,{className:"text-sm font-medium text-muted-foreground",children:["Project Files (",n.files.length,")"]}),(0,r.jsx)("div",{className:"mt-2 grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:n.files.map((e,t)=>(0,r.jsxs)("button",{type:"button",onClick:()=>u(t),className:"group relative aspect-square rounded-lg border bg-muted/50 overflow-hidden hover:ring-2 hover:ring-blue-500 transition-all",children:[e.type.startsWith("image/")?(0,r.jsx)("img",{src:e.url||"/placeholder.svg",alt:e.name,className:"h-full w-full object-cover transition-transform group-hover:scale-105"}):(0,r.jsxs)("div",{className:"h-full w-full flex flex-col items-center justify-center gap-1 p-2",children:[(0,r.jsx)(ej.Z,{className:"h-8 w-8 text-muted-foreground"}),(0,r.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground text-center line-clamp-2",children:e.name})]}),(0,r.jsx)("div",{className:"absolute inset-x-0 bottom-0 bg-black/60 text-white text-[10px] px-1.5 py-1 truncate opacity-0 group-hover:opacity-100 transition-opacity",children:e.name})]},e.id))})]}),(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-3 pt-4 border-t",children:[(0,r.jsxs)(m,{onClick:()=>{te(n),o(null)},className:"flex-1",children:[(0,r.jsx)(et.Z,{className:"h-4 w-4 mr-2"}),"Edit Project"]}),"admin"===E&&(0,r.jsx)(m,{variant:"outline",onClick:()=>{e3(n.id,"Completed"===n.status?"In Progress":"Completed")},className:"flex-1",children:"Completed"===n.status?"Mark In Progress":"Mark Complete"}),(0,r.jsxs)(m,{variant:"destructive",onClick:()=>{e6(n.id),o(null)},className:"flex-1",children:[(0,r.jsx)(es.Z,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})}),(0,r.jsx)(B,{open:eU.isOpen,onOpenChange:e=>!e&&eG({isOpen:!1,project:null,price:""}),children:(0,r.jsxs)(G,{className:"max-w-md w-[calc(100%-2rem)]",children:[(0,r.jsxs)(J,{children:[(0,r.jsx)($,{children:"Set Invoice Price"}),(0,r.jsxs)(X,{children:['Enter the invoice price for "',null===(e=eU.project)||void 0===e?void 0:e.title,'"']})]}
1),(0,r.jsxs)("div",{className:"space-y-4 mt-6",children:[(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(h,{htmlFor:"invoice-price",children:"Invoice Price ($)"}),(0,r.jsx)(x,{id:"invoice-price",type:"number",step:"0.01",min:"0",value:eU.price,onChange:e=>eG(t=>({...t,price:e.target.value})),placeholder:"0.00",className:"text-lg",autoFocus:!0})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)(m,{onClick:e8,disabled:""===eU.price||isNaN(Number.parseFloat(eU.price))||0>Number.parseFloat(eU.price),className:"flex-1",children:"Complete Project"}),(0,r.jsx)(m,{variant:"outline",onClick:()=>eG({isOpen:!1,project:null,price:""}),className:"flex-1",children:"Cancel"})]})]})]})}),(0,r.jsx)(B,{open:eJ.isOpen,onOpenChange:e=>{e||(e$({isOpen:!1,type:"completed",count:0}),ek(null))},children:(0,r.jsxs)(G,{className:"max-w-md w-[calc(100%-2rem)]",children:[(0,r.jsxs)(J,{children:[(0,r.jsxs)($,{className:"flex items-center gap-2 text-red-600",children:[(0,r.jsx)(ei.Z,{className:"h-5 w-5"}),"Confirm Action"]}),(0,r.jsx)(X,{children:eJ.brand?"Are you sure you want to delete this project? This action cannot be undone.":"completed"===eJ.type?"Are you sure you want to permanently delete ".concat(eJ.count," completed projects from the database? This will free up database space but will NOT affect your invoice data."):"Are you sure you want to clear ".concat(eJ.count," invoices from invoice history? This cannot be undone.")})]}),(0,r.jsxs)("div",{className:"flex gap-3 pt-4",children:[(0,r.jsx)(m,{variant:"destructive",onClick:()=>{e7()},className:"flex-1",children:eJ.brand&&eJ.brand.includes('Remove "')?"Remove from Invoice":eJ.brand&&eJ.brand.includes('Delete "')?"Delete Project":"Clear ".concat(eJ.count," Items")}),(0,r.jsx)(m,{variant:"outline",onClick:()=>e$({isOpen:!1,type:"completed",count:0}),className:"flex-1",children:"Cancel"})]})]})}),n&&(0,r.jsx)(eT,{files:n.files,initialIndex:null!=c?c:0,open:null!==c,onOpenChange:e=>!e&&u(null)})]})}}},function(e){e.O(0,[695,521,960,970,744],function(){return e(e.s=3381)}),_N_E=e.O()}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.