PageSourceSearch

https://kolaportid-markadur.manus.space/assets/Admin-rGM2PCLg.js

js kolaportid-markadur.manus.space collected 2026-10-03 05:02:57 UTC 145,888 bytes, 156 lines download raw bytes

1import{c as L,t as E,r as l,T as hr,s as qt,a as vr,j as e,b as he,P as W,u as He,d as it,e as B,R as xe,f as re,g as ot,h as lt,i as A,k as pt,l as Wt,m as br,A as jr,n as Ae,o as yr,p as kr,q as wr,v as Nr,w as Cr,F as Sr,D as Mr,C as Ir,x as Er,y as Yt,z as Dr,S as Tr,B as Rr,E as Pr,G as _r,H as Ar,I as Lr,J as Fr,K as Or,L as zr,M as Vr,N as M,O as Z,Q as Xt,U as Te,V as Ne,W as dt,X as Qt,Y as Ur,Z as N,_ as Br}from"./index-CJ5oTC-6.js";import{I as P,D as ue,a as me,b as pe,c as ge,d as Ge}from"./input-BscdNIHx.js";import{L as $r}from"./label-Cm1-hG3U.js";import{T as se}from"./textarea-VFPvwIMR.js";import{I as Jt,v as Zt,r as ea,a as Kr,s as gt}from"./mediaUpload-DJMFexBL.js";import{L as Hr}from"./loader-circle-Em5CcT6O.js";import{I as ta}from"./IcelandicDateInput-C9P2fkRv.js";import{M as Gr}from"./map-pinned-CE7OH-Ya.js";import{C as aa}from"./calendar-clock-vF4BI_Qn.js";import{C as qr}from"./ContentText-DTkEOrYp.js";import{L as Wr}from"./list--rdx6hwo.js";import{F as ra}from"./file-text-BhtkdDHq.js";/**
2 * @license lucide-react v0.453.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const Yr=L("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
7 * @license lucide-react v0.453.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Xr=L("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
12 * @license lucide-react v0.453.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const sa=L("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/**
17 * @license lucide-react v0.453.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const Qr=L("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
22 * @license lucide-react v0.453.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const Jr=L("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/**
27 * @license lucide-react v0.453.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Zr=L("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/**
32 * @license lucide-react v0.453.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const xt=L("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
37 * @license lucide-react v0.453.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const es=L("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/**
42 * @license lucide-react v0.453.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const na=L("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/**
47 * @license lucide-react v0.453.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const ts=L("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
52 * @license lucide-react v0.453.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const as=L("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/**
57 * @license lucide-react v0.453.0 - ISC
58 *
59 * This source code is licensed under the ISC license.
60 * See the LICENSE file in the root directory of this source tree.
61 */const rs=L("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
62 * @license lucide-react v0.453.0 - ISC
63 *
64 * This source code is licensed under the ISC license.
65 * See the LICENSE file in the root directory of this source tree.
66 */const ct=L("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/**
67 * @license lucide-react v0.453.0 - ISC
68 *
69 * This source code is licensed under the ISC license.
70 * See the LICENSE file in the root directory of this source tree.
71 */const ia=L("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/**
72 * @license lucide-react v0.453.0 - ISC
73 *
74 * This source code is licensed under the ISC license.
75 * See the LICENSE file in the root directory of this source tree.
76 */const oa=L("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
77 * @license lucide-react v0.453.0 - ISC
78 *
79 * This source code is licensed under the ISC license.
80 * See the LICENSE file in the root directory of this source tree.
81 */const ss=L("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
82 * @license lucide-react v0.453.0 - ISC
83 *
84 * This source code is licensed under the ISC license.
85 * See the LICENSE file in the root directory of this source tree.
86 */const ns=L("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
87 * @license lucide-react v0.453.0 - ISC
88 *
89 * This source code is licensed under the ISC license.
90 * See the LICENSE file in the root directory of this source tree.
91 */const is=L("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
92 * @license lucide-react v0.453.0 - ISC
93 *
94 * This source code is licensed under the ISC license.
95 * See the LICENSE file in the root directory of this source tree.
96 */const la=L("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/**
97 * @license lucide-react v0.453.0 - ISC
98 *
99 * This source code is licensed under the ISC license.
100 * See the LICENSE file in the root directory of this source tree.
101 */const Se=L("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
102 * @license lucide-react v0.453.0 - ISC
103 *
104 * This source code is licensed under the ISC license.
105 * See the LICENSE file in the root directory of this source tree.
106 */const fe=L("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
107 * @license lucide-react v0.453.0 - ISC
108 *
109 * This source code is licensed under the ISC license.
110 * See the LICENSE file in the root directory of this source tree.
111 */const os=L("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
112 * @license lucide-react v0.453.0 - ISC
113 *
114 * This source code is licensed under the ISC license.
115 * See the LICENSE file in the root directory of this source tree.
116 */const ls=L("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
117 * @license lucide-react v0.453.0 - ISC
118 *
119 * This source code is licensed under the ISC license.
120 * See the LICENSE file in the root directory of this source tree.
121 */const ds=L("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
122 * @license lucide-react v0.453.0 - ISC
123 *
124 * This source code is licensed under the ISC license.
125 * See the LICENSE file in the root directory of this source tree.
126 */const cs=L("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
126y:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
127 * @license lucide-react v0.453.0 - ISC
128 *
129 * This source code is licensed under the ISC license.
130 * See the LICENSE file in the root directory of this source tree.
131 */const us=L("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
132 * @license lucide-react v0.453.0 - ISC
133 *
134 * This source code is licensed under the ISC license.
135 * See the LICENSE file in the root directory of this source tree.
136 */const ve=L("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
137 * @license lucide-react v0.453.0 - ISC
138 *
139 * This source code is licensed under the ISC license.
140 * See the LICENSE file in the root directory of this source tree.
141 */const ms=L("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/**
142 * @license lucide-react v0.453.0 - ISC
143 *
144 * This source code is licensed under the ISC license.
145 * See the LICENSE file in the root directory of this source tree.
146 */const ps=L("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/**
147 * @license lucide-react v0.453.0 - ISC
148 *
149 * This source code is licensed under the ISC license.
150 * See the LICENSE file in the root directory of this source tree.
151 */const da=L("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);function ca(t){const{redirectOnUnauthenticated:s=!1,redirectPath:n}={},r=E.useUtils(),a=E.auth.me.useQuery(void 0,{retry:!1,refetchOnWindowFocus:!1}),i=E.auth.logout.useMutation({onSuccess:()=>{r.auth.me.setData(void 0,null)}}),u=l.useCallback(async()=>{try{await i.mutateAsync()}catch(x){if(x instanceof hr&&x.data?.code==="UNAUTHORIZED")return;throw x}finally{try{sessionStorage.removeItem("manus-cookie")}catch{}r.auth.me.setData(void 0,null),await r.auth.me.invalidate()}},[i,r]);l.useEffect(()=>{try{localStorage.setItem("manus-runtime-user-info",JSON.stringify(a.data))}catch{}},[a.data]);const p=l.useMemo(()=>({user:a.data??null,loading:a.isLoading||i.isPending,error:a.error??i.error??null,isAuthenticated:!!a.data}),[a.data,a.error,a.isLoading,i.error,i.isPending]);return l.useEffect(()=>{s&&(a.isLoading||i.isPending||p.user||typeof window>"u"||n&&window.location.pathname===n||(n?window.location.href=n:qt()))},[s,n,i.isPending,a.isLoading,p.user]),{...p,refresh:()=>a.refetch(),logout:u}}function gs(){return vr.useSyncExternalStore(xs,()=>!0,()=>!1)}function xs(){return()=>{}}var ft="Avatar",[fs]=he(ft),[hs,ua]=fs(ft),ma=l.forwardRef((t,s)=>{const{__scopeAvatar:n,...r}=t,[a,i]=l.useState("idle");return e.jsx(hs,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:i,children:e.jsx(W.span,{...r,ref:s})})});ma.displayName=ft;var pa="AvatarImage",vs=l.forwardRef((t,s)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:a=()=>{},...i}=t,u=ua(pa,n),p=bs(r,i),x=He(f=>{a(f),u.onImageLoadingStatusChange(f)});return it(()=>{p!=="idle"&&x(p)},[p,x]),p==="loaded"?e.jsx(W.img,{...i,ref:s,src:r}):null});vs.displayName=pa;var ga="AvatarFallback",xa=l.forwardRef((t,s)=>{const{__scopeAvatar:n,delayMs:r,...a}=t,i=ua(ga,n),[u,p]=l.useState(r===void 0);return l.useEffect(()=>{if(r!==void 0){const x=window.setTimeout(()=>p(!0),r);return()=>window.clearTimeout(x)}},[r]),u&&i.imageLoadingStatus!=="loaded"?e.jsx(W.span,{...a,ref:s}):null});xa.displayName=ga;function Pt(t,s){return t?s?(t.src!==s&&(t.src=s),t.complete&&t.naturalWi
vendor: 5,026 bytes, line 151
151dth>0?"loaded":"loading"):"error":"idle"}function bs(t,{referrerPolicy:s,crossOrigin:n}){const r=gs(),a=l.useRef(null),i=r?(a.current||(a.current=new window.Image),a.current):null,[u,p]=l.useState(()=>Pt(i,t));return it(()=>{p(Pt(i,t))},[i,t]),it(()=>{const x=h=>()=>{p(h)};if(!i)return;const f=x("loaded"),b=x("error");return i.addEventListener("load",f),i.addEventListener("error",b),s&&(i.referrerPolicy=s),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",f),i.removeEventListener("error",b)}},[i,n,s]),u}var js=ma,ys=xa;function ks({className:t,...s}){return e.jsx(js,{"data-slot":"avatar",className:B("relative flex size-8 shrink-0 overflow-hidden rounded-full",t),...s})}function ws({className:t,...s}){return e.jsx(ys,{"data-slot":"avatar-fallback",className:B("bg-muted flex size-full items-center justify-center rounded-full",t),...s})}function fa(t){const s=t+"CollectionProvider",[n,r]=he(s),[a,i]=n(s,{collectionRef:{current:null},itemMap:new Map}),u=g=>{const{scope:v,children:y}=g,j=xe.useRef(null),D=xe.useRef(new Map).current;return e.jsx(a,{scope:v,itemMap:D,collectionRef:j,children:y})};u.displayName=s;const p=t+"CollectionSlot",x=ot(p),f=xe.forwardRef((g,v)=>{const{scope:y,children:j}=g,D=i(p,y),T=re(v,D.collectionRef);return e.jsx(x,{ref:T,children:j})});f.displayName=p;const b=t+"CollectionItemSlot",h="data-radix-collection-item",k=ot(b),d=xe.forwardRef((g,v)=>{const{scope:y,children:j,...D}=g,T=xe.useRef(null),V=re(v,T),U=i(b,y);return xe.useEffect(()=>(U.itemMap.set(T,{ref:T,...D}),()=>void U.itemMap.delete(T))),e.jsx(k,{[h]:"",ref:V,children:j})});d.displayName=b;function o(g){const v=i(t+"CollectionConsumer",g);return xe.useCallback(()=>{const j=v.collectionRef.current;if(!j)return[];const D=Array.from(j.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((U,$)=>D.indexOf(U.ref.current)-D.indexOf($.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:u,Slot:f,ItemSlot:d},o,r]}var Ns=l.createContext(void 0);function ha(t){const s=l.useContext(Ns);return t||s||"ltr"}var Ze="rovingFocusGroup.onEntryFocus",Cs={bubbles:!1,cancelable:!0},Le="RovingFocusGroup",[ut,va,Ss]=fa(Le),[Ms,ba]=he(Le,[Ss]),[Is,Es]=Ms(Le),ja=l.forwardRef((t,s)=>e.jsx(ut.Provider,{scope:t.__scopeRovingFocusGroup,children:e.jsx(ut.Slot,{scope:t.__scopeRovingFocusGroup,children:e.jsx(Ds,{...t,ref:s})})}));ja.displayName=Le;var Ds=l.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:a=!1,dir:i,currentTabStopId:u,defaultCurrentTabStopId:p,onCurrentTabStopIdChange:x,onEntryFocus:f,preventScrollOnEntryFocus:b=!1,...h}=t,k=l.useRef(null),d=re(s,k),o=ha(i),[g,v]=pt({prop:u,defaultProp:p??null,onChange:x,caller:Le}),[y,j]=l.useState(!1),D=He(f),T=va(n),V=l.useRef(!1),[U,$]=l.useState(0);return l.useEffect(()=>{const F=k.current;if(F)return F.addEventListener(Ze,D),()=>F.removeEventListener(Ze,D)},[D]),e.jsx(Is,{scope:n,orientation:r,dir:o,loop:a,currentTabStopId:g,onItemFocus:l.useCallback(F=>v(F),[v]),onItemShiftTab:l.useCallback(()=>j(!0),[]),onFocusableItemAdd:l.useCallback(()=>$(F=>F+1),[]),onFocusableItemRemove:l.useCallback(()=>$(F=>F-1),[]),children:e.jsx(W.div,{tabIndex:y||U===0?-1:0,"data-orientation":r,...h,ref:d,style:{outline:"none",...t.style},onMouseDown:A(t.onMouseDown,()=>{V.current=!0}),onFocus:A(t.onFocus,F=>{const q=!V.current;if(F.target===F.currentTarget&&q&&!y){const C=new CustomEvent(Ze,Cs);if(F.currentTarget.dispatchEvent(C),!C.defaultPrevented){const O=T().filter(G=>G.focusable),m=O.find(G=>G.active),c=O.find(G=>G.id===g),z=[m,c,...O].filter(Boolean).map(G=>G.ref.current);wa(z,b)}}V.current=!1}),onBlur:A(t.onBlur,()=>j(!1))})})}),ya="RovingFocusGroupItem",ka=l.forwardRef((t,s)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:a=!1,tabStopId:i,children:u,...p}=t,x=lt(),f=i||x,b=Es(ya,n),h=b.currentTabStopId===f,k=va(n),{onFocusableItemAdd:d,onFocusableItemRemove:o,currentTabStopId:g}=b;return l.useEffect(()=>{if(r)return d(),()=>o()},[r,d,o]),e.jsx(ut.ItemSlot,{scope:n,id:f,focusable:r,active:a,children:e.jsx(W.span,{tabIndex:h?0:-1,"data-orientation":b.orientation,...p,ref:s,onMouseDown:A(t.onMouseDown,v=>{r?b.onItemFocus(f):v.preventDefault()}),onFocus:A(t.onFocus,()=>b.onItemFocus(f)),onKeyDown:A(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){b.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=Ps(v,b.orientation,b.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let D=k().filter(T=>T.focusable).map(T=>T.ref.current);if(y==="last")D.reverse();else if(y==="prev"||y==="next"){y==="prev"&&D.reverse();const T=D.indexOf(v.currentTarget);D=b.loop?_s(D,T+1):D.slice(T+1)}setTimeout(()=>wa(D))}}),children:typeof u=="function"?u({isCurrentTabStop:h,hasTabStop:g!=null}):u})})});ka.displayName=ya;var Ts={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Rs(t,s){return s!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}
vendor: 25,610 bytes, line 151
151function Ps(t,s,n){const r=Rs(t.key,n);if(!(s==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(s==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return Ts[r]}function wa(t,s=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:s}),document.activeElement!==n))return}function _s(t,s){return t.map((n,r)=>t[(s+r)%t.length])}var As=ja,Ls=ka,mt=["Enter"," "],Fs=["ArrowDown","PageUp","Home"],Na=["ArrowUp","PageDown","End"],Os=[...Fs,...Na],zs={ltr:[...mt,"ArrowRight"],rtl:[...mt,"ArrowLeft"]},Vs={ltr:["ArrowLeft"],rtl:["ArrowRight"]},Fe="Menu",[Re,Us,Bs]=fa(Fe),[be,Ca]=he(Fe,[Bs,Wt,ba]),qe=Wt(),Sa=ba(),[$s,je]=be(Fe),[Ks,Oe]=be(Fe),Ma=t=>{const{__scopeMenu:s,open:n=!1,children:r,dir:a,onOpenChange:i,modal:u=!0}=t,p=qe(s),[x,f]=l.useState(null),b=l.useRef(!1),h=He(i),k=ha(a);return l.useEffect(()=>{const d=()=>{b.current=!0,document.addEventListener("pointerdown",o,{capture:!0,once:!0}),document.addEventListener("pointermove",o,{capture:!0,once:!0})},o=()=>b.current=!1;return document.addEventListener("keydown",d,{capture:!0}),()=>{document.removeEventListener("keydown",d,{capture:!0}),document.removeEventListener("pointerdown",o,{capture:!0}),document.removeEventListener("pointermove",o,{capture:!0})}},[]),e.jsx(br,{...p,children:e.jsx($s,{scope:s,open:n,onOpenChange:h,content:x,onContentChange:f,children:e.jsx(Ks,{scope:s,onClose:l.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:b,dir:k,modal:u,children:r})})})};Ma.displayName=Fe;var Hs="MenuAnchor",ht=l.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t,a=qe(n);return e.jsx(jr,{...a,...r,ref:s})});ht.displayName=Hs;var vt="MenuPortal",[Gs,Ia]=be(vt,{forceMount:void 0}),Ea=t=>{const{__scopeMenu:s,forceMount:n,children:r,container:a}=t,i=je(vt,s);return e.jsx(Gs,{scope:s,forceMount:n,children:e.jsx(Ae,{present:n||i.open,children:e.jsx(yr,{asChild:!0,container:a,children:r})})})};Ea.displayName=vt;var ee="MenuContent",[qs,bt]=be(ee),Da=l.forwardRef((t,s)=>{const n=Ia(ee,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,i=je(ee,t.__scopeMenu),u=Oe(ee,t.__scopeMenu);return e.jsx(Re.Provider,{scope:t.__scopeMenu,children:e.jsx(Ae,{present:r||i.open,children:e.jsx(Re.Slot,{scope:t.__scopeMenu,children:u.modal?e.jsx(Ws,{...a,ref:s}):e.jsx(Ys,{...a,ref:s})})})})}),Ws=l.forwardRef((t,s)=>{const n=je(ee,t.__scopeMenu),r=l.useRef(null),a=re(s,r);return l.useEffect(()=>{const i=r.current;if(i)return kr(i)},[]),e.jsx(jt,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:A(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),Ys=l.forwardRef((t,s)=>{const n=je(ee,t.__scopeMenu);return e.jsx(jt,{...t,ref:s,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),Xs=ot("MenuContent.ScrollLock"),jt=l.forwardRef((t,s)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:a,onOpenAutoFocus:i,onCloseAutoFocus:u,disableOutsidePointerEvents:p,onEntryFocus:x,onEscapeKeyDown:f,onPointerDownOutside:b,onFocusOutside:h,onInteractOutside:k,onDismiss:d,disableOutsideScroll:o,...g}=t,v=je(ee,n),y=Oe(ee,n),j=qe(n),D=Sa(n),T=Us(n),[V,U]=l.useState(null),$=l.useRef(null),F=re(s,$,v.onContentChange),q=l.useRef(0),C=l.useRef(""),O=l.useRef(0),m=l.useRef(null),c=l.useRef("right"),w=l.useRef(0),z=o?Cr:l.Fragment,G=o?{as:Xs,allowPinchZoom:!0}:void 0,Me=R=>{const S=C.current+R,_=T().filter(J=>!J.disabled),K=document.activeElement,Y=_.find(J=>J.ref.current===K)?.textValue,te=_.map(J=>J.textValue),Tt=dn(te,S,Y),Ie=_.find(J=>J.textValue===Tt)?.ref.current;(function J(Rt){C.current=Rt,window.clearTimeout(q.current),Rt!==""&&(q.current=window.setTimeout(()=>J(""),1e3))})(S),Ie&&setTimeout(()=>Ie.focus())};l.useEffect(()=>()=>window.clearTimeout(q.current),[]),Nr();const le=l.useCallback(R=>c.current===m.current?.side&&un(R,m.current?.area),[]);return e.jsx(qs,{scope:n,searchRef:C,onItemEnter:l.useCallback(R=>{le(R)&&R.preventDefault()},[le]),onItemLeave:l.useCallback(R=>{le(R)||($.current?.focus(),U(null))},[le]),onTriggerLeave:l.useCallback(R=>{le(R)&&R.preventDefault()},[le]),pointerGraceTimerRef:O,onPointerGraceIntentChange:l.useCallback(R=>{m.current=R},[]),children:e.jsx(z,{...G,children:e.jsx(Sr,{asChild:!0,trapped:a,onMountAutoFocus:A(i,R=>{R.preventDefault(),$.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:u,children:e.jsx(Mr,{asChild:!0,disableOutsidePointerEvents:p,onEscapeKeyDown:f,onPointerDownOutside:b,onFocusOutside:h,onInteractOutside:k,onDismiss:d,children:e.jsx(As,{asChild:!0,...D,dir:y.dir,orientation:"vertical",loop:r,currentTabStopId:V,onCurrentTabStopIdChange:U,onEntryFocus:A(x,R=>{y.isUsingKeyboardRef.current||R.preventDefault()}),preventScrollOnEntryFocus:!0,children:e.jsx(Ir,{role:"menu","aria-orientation":"vertical","data-state":Ga(v.open),"data-radix-menu-content":"",dir:y.dir,...j,...g,ref:F,style:{outline:"none",...g.style},onKeyDown:A(g.onKeyDown,R=>{const _=R.target.closest("[data-radix-menu-content]")===R.currentTarget,K=R.ctrlKey||R.altKey||R.metaKey,Y=R.key.length===1;_&&(R.key==="Tab"&&R.preventDefault(),!K&&Y&&Me(R.key));const te=$.current;if(R.target!==te||!Os.includes(R.key))return;R.preventDefault();const Ie=T().filter(J=>!J.disabled).map(J=>J.ref.current);Na.includes(R.key)&&Ie.reverse(),on(Ie)}),onBlur:A(t.onBlur,R=>{R.currentTarget.contains(R.target)||(window.clearTimeout(q.current),C.current="")}),onPointerMove:A(t.onPointerMove,Pe(R=>{const S=R.target,_=w.current!==R.clientX;if(R.currentTarget.contains(S)&&_){const K=R.clientX>w.current?"right":"left";c.current=K,w.current=R.clientX}}))})})})})})})});Da.displayName=ee;var Qs="MenuGroup",yt=l.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(W.div,{role:"group",...r,ref:s})});yt.displayName=Qs;var Js="MenuLabel",Ta=l.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(W.div,{...r,ref:s})});Ta.displayName=Js;var Ve="MenuItem",_t="menu.itemSelect",We=l.forwardRef((t,s)=>{const{disabled:n=!1,onSelect:r,...a}=t,i=l.useRef(null),u=Oe(Ve,t.__scopeMenu),p=bt(Ve,t.__scopeMenu),x=re(s,i),f=l.useRef(!1),b=()=>{const h=i.current;if(!n&&h){const k=new CustomEvent(_t,{bubbles:!0,cancelable:!0});h.addEventListener(_t,d=>r?.(d),{once:!0}),wr(h,k),k.defaultPrevented?f.current=!1:u.onClose()}};return e.jsx(Ra,{...a,ref:x,disabled:n,onClick:A(t.onClick,b),onPointerDown:h=>{t.onPointerDown?.(h),f.current=!0},onPointerUp:A(t.onPointerUp,h=>{f.current||h.currentTarget?.click()}),onKeyDown:A(t.onKeyDown,h=>{const k=p.searchRef.current!=="";n||k&&h.key===" "||mt.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});We.displayName=Ve;var Ra=l.forwardRef((t,s)=>{const{__scopeMenu:n,disabled:r=!1,textValue:a,...i}=t,u=bt(Ve,n),p=Sa(n),x=l.useRef(null),f=re(s,x),[b,h]=l.useState(!1),[k,d]=l.useState("");return l.useEffect(()=>{const o=x.current;o&&d((o.textContent??"").trim())},[i.children]),e.jsx(Re.ItemSlot,{scope:n,disabled:r,textValue:a??k,children:e.jsx(Ls,{asChild:!0,...p,focusable:!r,children:e.jsx(W.div,{role:"menuitem","data-highlighted":b?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:f,onPointerMove:A(t.onPointerMove,Pe(o=>{r?u.onItemLeave(o):(u.onItemEnter(o),o.defaultPrevented||o.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:A(t.onPointerLeave,Pe(o=>u.onItemLeave(o))),onFocus:A(t.onFocus,()=>h(!0)),onBlur:A(t.onBlur,()=>h(!1))})})})}),Zs="MenuCheckboxItem",Pa=l.forwardRef((t,s)=>{const{checked:n=!1,onCheckedChange:r,...a}=t;return e.jsx(Oa,{scope:t.__scopeMenu,checked:n,children:e.jsx(We,{role:"menuitemcheckbox","aria-checked":Ue(n)?"mixed":n,...a,ref:s,"data-state":wt(n),onSelect:A(a.onSelect,()=>r?.(Ue(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Pa.displayName=Zs;var _a="MenuRadioGroup",[en,tn]=be(_a,{value:void 0,onValueChange:()=>{}}),Aa=l.forwardRef((t,s)=>{const{value:n,onValueChange:r,...a}=t,i=He(r);return e.jsx(en,{scope:t.__scopeMenu,value:n,onValueChange:i,children:e.jsx(yt,{...a,ref:s})})});Aa.displayName=_a;var La="MenuRadioItem",Fa=l.forwardRef((t,s)=>{const{value:n,...r}=t,a=tn(La,t.__scopeMenu),i=n===a.value;return e.jsx(Oa,{scope:t.__scopeMenu,checked:i,children:e.jsx(We,{role:"menuitemradio","aria-checked":i,...r,ref:s,"data-state":wt(i),onSelect:A(r.onSelect,()=>a.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Fa.displayName=La;var kt="MenuItemIndicator",[Oa,an]=be(kt,{checked:!1}),za=l.forwardRef((t,s)=>{const{__scopeMenu:n,forceMount:r,...a}=t,i=an(kt,n);return e.jsx(Ae,{present:r||Ue(i.checked)||i.checked===!0,children:e.jsx(W.span,{...a,ref:s,"data-state":wt(i.checked)})})});za.displayName=kt;var rn="MenuSeparator",Va=l.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t;return e.jsx(W.div,{role:"separator","aria-orientation":"horizontal",...r,ref:s})});Va.displayName=rn;var sn="MenuArrow",Ua=l.forwardRef((t,s)=>{const{__scopeMenu:n,...r}=t,a=qe(n);return e.jsx(Er,{...a,...r,ref:s})});Ua.displayName=sn;var nn="MenuSub",[vo,Ba]=be(nn),De="MenuSubTrigger",$a=l.forwardRef((t,s)=>{const n=je(De,t.__scopeMenu),r=Oe(De,t.__scopeMenu),a=Ba(De,t.__scopeMenu),i=bt(De,t.__scopeMenu),u=l.useRef(null),{pointerGraceTimerRef:p,onPointerGraceIntentChange:x}=i,f={__scopeMenu:t.__scopeMenu},b=l.useCallback(()=>{u.current&&window.clearTimeout(u.current),u.current=null},[]);return l.useEffect(()=>b,[b]),l.useEffect(()=>{const h=p.current;return()=>{window.clearTimeout(h),x(null)}},[p,x]),e.jsx(ht,{asChild:!0,...f,children:e.jsx(Ra,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":Ga(n.open),...t,ref:Yt(s,a.onTriggerChange),onClick:h=>{t.onClick?.(h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:A(t.onPointerMove,Pe(h=>{i.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!u.current&&(i.onPointerGraceIntentChange(null),u.current=window.setTimeout(()=>{n.onOpenChange(!0),b()},100))})),onPointerLeave:A(t.onPointerLeave,Pe(h=>{b();const k=n.content?.getBoundingClientRect();if(k){const d=n.content?.dataset.side,o=d==="right",g=o?-5:5,v=k[o?"left":"right"],y=k[o?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+g,y:h.clientY},{x:v,y:k.top},{x:y,y:k.top},{x:y,y:k.bottom},{x:v,y:k.bottom}],side:d}),window.clearTimeout(p.current),p.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:A(t.onKeyDown,h=>{const k=i.searchRef.current!=="";t.disabled||k&&h.key===" "||zs[r.dir].includes(h.key)&&(n.onOpenChange(!0),n.content?.focus(),h.preventDefault())})})})});$a.displayName=De;var Ka="MenuSubContent",Ha=l.forwardRef((t,s)=>{const n=Ia(ee,t.__scopeMenu),{forceMount:r=n.forceMount,...a}=t,i=je(ee,t.__scopeMenu),u=Oe(ee,t.__scopeMenu),p=Ba(Ka,t.__scopeMenu),x=l.useRef(null),f=re(s,x);return e.jsx(Re.Provider,{scope:t.__scopeMenu,children:e.jsx(Ae,{present:r||i.open,children:e.jsx(Re.Slot,{scope:t.__scopeMenu,children:e.jsx(jt,{id:p.contentId,"aria-labelledby":p.triggerId,...a,ref:f,align:"start",side:u.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:b=>{u.isUsingKeyboardRef.current&&x.current?.focus(),b.preventDefault()},onCloseAutoFocus:b=>b.preventDefault(),onFocusOutside:A(t.onFocusOutside,b=>{b.target!==p.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:A(t.onEscapeKeyDown,b=>{u.onClose(),b.preventDefault()}),onKeyDown:A(t.onKeyDown,b=>{const h=b.currentTarget.contains(b.target),k=Vs[u.dir].includes(b.key);h&&k&&(i.onOpenChange(!1),p.trigger?.focus(),b.preventDefault())})})})})})});Ha.displayName=Ka;function Ga(t){return t?"open":"closed"}function Ue(t){return t==="indeterminate"}function wt(t){return Ue(t)?"indeterminate":t?"checked":"unchecked"}function on(t){const s=document.activeElement;for(const n of t)if(n===s||(n.focus(),document.activeElement!==s))return}function ln(t,s){return t.map((n,r)=>t[(s+r)%t.length])}function dn(t,s,n){const a=s.length>1&&Array.from(s).every(f=>f===s[0])?s[0]:s,i=n?t.indexOf(n):-1;let u=ln(t,Math.max(i,0));a.length===1&&(u=u.filter(f=>f!==n));const x=u.find(f=>f.toLowerCase().startsWith(a.toLowerCase()));return x!==n?x:void 0}function cn(t,s){const{x:n,y:r}=t;let a=!1;for(let i=0,u=s.length-1;i<s.length;u=i++){const p=s[i],x=s[u],f=p.x,b=p.y,h=x.x,k=x.y;b>r!=k>r&&n<(h-f)*(r-b)/(k-b)+f&&(a=!a)}return a}function un(t,s){if(!s)return!1;const n={x:t.clientX,y:t.clientY};return cn(n,s)}function Pe(t){return s=>s.pointerType==="mouse"?t(s):void 0}var mn=Ma,pn=ht,gn=Ea,xn=Da,fn=yt,hn=Ta,vn=We,bn=Pa,jn=Aa,yn=Fa,kn=za,wn=Va,Nn=Ua,Cn=$a,Sn=Ha,Ye="DropdownMenu",[Mn]=he(Ye,[Ca]),Q=Ca(),[In,qa]=Mn(Ye),Wa=t=>{const{__scopeDropdownMenu:s,children:n,dir:r,open:a,defaultOpen:i,onOpenChange:u,modal:p=!0}=t,x=Q(s),f=l.useRef(null),[b,h]=pt({prop:a,defaultProp:i??!1,onChange:u,caller:Ye});return e.jsx(In,{scope:s,triggerId:lt(),triggerRef:f,contentId:lt(),open:b,onOpenChange:h,onOpenToggle:l.useCallback(()=>h(k=>!k),[h]),modal:p,children:e.jsx(mn,{...x,open:b,onOpenChange:h,dir:r,modal:p,children:n})})};Wa.displayName=Ye;var Ya="DropdownMenuTrigger",Xa=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...a}=t,i=qa(Ya,n),u=Q(n);return e.jsx(pn,{asChild:!0,...u,children:e.jsx(W.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...a,ref:Yt(s,i.triggerRef),onPointerDown:A(t.onPointerDown,p=>{!r&&p.button===0&&p.ctrlKey===!1&&(i.onOpenToggle(),i.open||p.preventDefault())}),onKeyDown:A(t.onKeyDown,p=>{r||(["Enter"," "].includes(p.key)&&i.onOpenToggle(),p.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(p.key)&&p.preventDefault())})})})});Xa.displayName=Ya;var En="DropdownMenuPortal",Qa=t=>{const{__scopeDropdownMenu:s,...n}=t,r=Q(s);return e.jsx(gn,{...r,...n})};Qa.displayName=En;var Ja="DropdownMenuContent",Za=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=qa(Ja,n),i=Q(n),u=l.useRef(!1);return e.jsx(xn,{id:a.contentId,"aria-labelledby":a.triggerId,...i,...r,ref:s,onCloseAutoFocus:A(t.onCloseAutoFocus,p=>{u.current||a.triggerRef.current?.focus(),u.current=!1,p.preventDefault()}),onInteractOutside:A(t.onInteractOutside,p=>{const x=p.detail.originalEvent,f=x.button===0&&x.ctrlKey===!0,b=x.button===2||f;(!a.modal||b)&&(u.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Za.displayName=Ja;var Dn="DropdownMenuGroup",Tn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(fn,{...a,...r,ref:s})});Tn.displayName=Dn;var Rn="DropdownMenuLabel",Pn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(hn,{...a,...r,ref:s})});Pn.displayName=Rn;var _n="DropdownMenuItem",er=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(vn,{...a,...r,ref:s})});er.displayName=_n;var An="DropdownMenuCheckboxItem",Ln=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(bn,{...a,...r,ref:s})});Ln.displayName=An;var Fn="DropdownMenuRadioGroup",On=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(jn,{...a,...r,ref:s})});On.displayName=Fn;var zn="DropdownMenuRadioItem",Vn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(yn,{...a,...r,ref:s})});Vn.displayName=zn;var Un="DropdownMenuItemIndicator",Bn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(kn,{...a,...r,ref:s})});Bn.displayName=Un;var $n="DropdownMenuSeparator",Kn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(wn,{...a,...r,ref:s})});Kn.displayName=$n;var Hn="DropdownMenuArrow",Gn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(Nn,{...a,...r,ref:s})});Gn.displayName=Hn;var qn="DropdownMenuSubTrigger",Wn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(Cn,{...a,...r,ref:s})});Wn.displayName=qn;var Yn="DropdownMenuSubContent",Xn=l.forwardRef((t,s)=>{const{__scopeDropdownMenu:n,...r}=t,a=Q(n);return e.jsx(Sn,{...a,...r,ref:s,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});Xn.displayName=Yn;var Qn=Wa,Jn=Xa,Zn=Qa,ei=Za,ti=er;function ai({...t}){return e.jsx(Qn,{"data-slot":"dropdown-menu",...t})}function ri({...t}){return e.jsx(Jn,{"data-slot":"dropdown-menu-trigger",...t})}function si({className:t,sideOffset:s=4,...n}){return e.jsx(Zn,{children:e.jsx(ei,{"data-slot":"dropdown-menu-content",sideOffset:s,className:B("bg-popover text-popover-foreground 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 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md",t),...n})})}function ni({className:t,inset:s,variant:n="default",...r}){return e.jsx(ti,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":n,className:B("focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",t),...r})}const et=768;function tr(){const[t,s]=l.useState(void 0);return l.useEffect(()=>{const n=window.matchMedia(`(max-width: ${et-1}px)`),r=()=>{s(window.innerWidth<et)};return n.addEventListener("change",r),s(window.innerWidth<et),()=>n.removeEventListener("change",r)},[]),!!t}const ii="sidebar_state",oi=3600*24*7,li="16rem",di="18rem",ci="3rem",ui="b",ar=l.createContext(null);function Xe(){const t=l.useContext(ar);if(!t)throw new Error("useSidebar must be used within a SidebarProvider.");return t}function mi({defaultOpen:t=!0,open:s,onOpenChange:n,className:r,style:a,children:i,...u}){const p=tr(),[x,f]=l.useState(!1),[b,h]=l.useState(t),k=s??b,d=l.useCallback(y=>{const j=typeof y=="function"?y(k):y;n?n(j):h(j),document.cookie=`${ii}=${j}; path=/; max-age=${oi}`},[n,k]),o=l.useCallback(()=>p?f(y=>!y):d(y=>!y),[p,d,f]);l.useEffect(()=>{const y=j=>{j.key===ui&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),o())};return window.addEventListener("keydown",y),()=>window.removeEventListener("keydown",y)},[o]);const g=k?"expanded":"collapsed",v=l.useMemo(()=>({state:g,open:k,setOpen:d,isMobile:p,openMobile:x,setOpenMobile:f,toggleSidebar:o}),[g,k,d,p,x,f,o]);return e.jsx(ar.Provider,{value:v,children:e.jsx(Dr,{delayDuration:0,children:e.jsx("div",{"data-slot":"sidebar-wrapper",style:{"--sidebar-width":li,"--sidebar-width-icon":ci,...a},className:B("group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",r),...u,children:i})})})}function pi({side:t="left",variant:s="sidebar",collapsible:n="offcanvas",disableTransition:r=!1,className:a,children:i,...u}){const{isMobile:p,state:x,openMobile:f,setOpenMobile:b}=Xe();return n==="none"?e.jsx("div",{"data-slot":"sidebar",className:B("bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",a),...u,children:i}):p?e.jsx(Tr,{open:f,onOpenChange:b,...u,children:e.jsxs(Rr,{"data-sidebar":"sidebar","data-slot":"sidebar","data-mobile":"true",className:"bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",style:{"--sidebar-width":di},side:t,children:[e.jsxs(Pr,{className:"sr-only",children:[e.jsx(_r,{children:"Sidebar"}),e.jsx(Ar,{children:"Displays the mobile sidebar."})]}),e.jsx("div",{className:"flex h-full w-full flex-col",children:i})]})}):e.jsxs("div",{className:"group peer text-sidebar-foreground hidden md:block","data-state":x,"data-collapsible":x==="collapsed"?n:"","data-variant":s,"data-side":t,"data-slot":"sidebar",children:[e.jsx("div",{"data-slot":"sidebar-gap",className:B("relative w-(--sidebar-width) bg-transparent",r?"transition-none":"transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[side=right]:rotate-180",s==="floating"||s==="inset"?"group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon)")}),e.jsx("div",{"data-slot":"sidebar-container",className:B("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) md:flex",r?"transition-none":"transition-[left,right,width] duration-200 ease-linear",t==="left"?"left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]":"right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",s==="floating"||s==="inset"?"p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]":"group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",a),...u,children:e.jsx("div",{"data-sidebar":"sidebar","data-slot":"sidebar-inner",className:"bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm",children:i})})]})}function gi({className:t,onClick:s,...n}){const{toggleSidebar:r}=Xe();return e.jsxs(M,{"data-sidebar":"trigger","data-slot":"sidebar-trigger",variant:"ghost",size:"icon",className:B("size-7",t),onClick:a=>{s?.(a),r()},...n,children:[e.jsx(la,{}),e.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})}function xi({className:t,...s}){return e.jsx("main",{"data-slot":"sidebar-inset",className:B("bg-background relative flex w-full flex-1 flex-col","md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2",t),...s})}function fi({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-header","data-sidebar":"header",className:B("flex flex-col gap-2 p-2",t),...s})}function hi({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-footer","data-sidebar":"footer",className:B("flex flex-col gap-2 p-2",t),...s})}function vi({className:t,...s}){return e.jsx("div",{"data-slot":"sidebar-content","data-sidebar":"content",className:B("flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",t),...s})}function bi({className:t,...s}){return e.jsx("ul",{"data-slot":"sidebar-menu","data-sidebar":"menu",className:B("flex w-full min-w-0 flex-col gap-1",t),...s})}function ji({className:t,...s}){return e.jsx("li",{"data-slot":"sidebar-menu-item","data-sidebar":"menu-item",className:B("group/menu-item relative",t),...s})}const yi=Fr("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",{variants:{variant:{default:"hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",outline:"bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"},size:{default:"h-8 text-sm",sm:"h-7 text-xs",lg:"h-12 text-sm group-data-[collapsible=icon]:p-0!"}},defaultVariants:{variant:"default",size:"default"}});function ki({asChild:t=!1,isActive:s=!1,variant:n="default",size:r="default",tooltip:a,className:i,...u}){const p=t?Lr:"button",{isMobile:x,state:f}=Xe(),b=e.jsx(p,{"data-slot":"sidebar-menu-button","data-sidebar":"menu-button","data-size":r,"data-active":s,className:B(yi({variant:n,size:r}),i),...u});
151return a?(typeof a=="string"&&(a={children:a}),e.jsxs(Or,{children:[e.jsx(zr,{asChild:!0,children:b}),e.jsx(Vr,{side:"right",align:"center",hidden:f!=="collapsed"||x,...a})]})):b}function wi(){return e.jsxs("div",{className:"flex min-h-screen bg-background",children:[e.jsxs("div",{className:"w-[280px] border-r border-border bg-background p-4 space-y-6",children:[e.jsxs("div",{className:"flex items-center gap-3 px-2",children:[e.jsx(Z,{className:"h-8 w-8 rounded-md"}),e.jsx(Z,{className:"h-4 w-24"})]}),e.jsxs("div",{className:"space-y-2 px-2",children:[e.jsx(Z,{className:"h-10 w-full rounded-lg"}),e.jsx(Z,{className:"h-10 w-full rounded-lg"}),e.jsx(Z,{className:"h-10 w-full rounded-lg"})]}),e.jsx("div",{className:"absolute bottom-4 left-4 right-4",children:e.jsxs("div",{className:"flex items-center gap-3 px-1",children:[e.jsx(Z,{className:"h-9 w-9 rounded-full"}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsx(Z,{className:"h-3 w-20"}),e.jsx(Z,{className:"h-2 w-32"})]})]})})]}),e.jsxs("div",{className:"flex-1 p-4 space-y-4",children:[e.jsx(Z,{className:"h-12 w-48 rounded-lg"}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[e.jsx(Z,{className:"h-32 rounded-xl"}),e.jsx(Z,{className:"h-32 rounded-xl"}),e.jsx(Z,{className:"h-32 rounded-xl"})]}),e.jsx(Z,{className:"h-64 rounded-xl"})]})]})}const Ni=[{icon:oa,label:"Page 1",path:"/"},{icon:da,label:"Page 2",path:"/some-path"}],At="sidebar-width",Ci=280,Si=200,Mi=480;function Ii({children:t,menuItems:s=Ni,title:n="Stjórnborð",requireAdmin:r=!1}){const[a,i]=l.useState(Ci),{loading:u,user:p}=ca();return l.useEffect(()=>{try{const x=localStorage.getItem(At);x&&i(parseInt(x,10))}catch{}},[]),l.useEffect(()=>{try{localStorage.setItem(At,a.toString())}catch{}},[a]),u?e.jsx(wi,{}):p?r&&p.role!=="admin"?e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted/50 p-6",children:e.jsxs("div",{className:"max-w-md rounded-[var(--radius)] border border-border bg-card p-8 text-center shadow-sm",children:[e.jsx(cs,{className:"mx-auto size-10 text-destructive","aria-hidden":"true"}),e.jsx("h1",{className:"mt-5 text-2xl font-semibold",children:"Aðgangur ekki heimill"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:"Aðeins stjórnendur Kolaportsins hafa aðgang að þessu svæði."}),e.jsx(M,{asChild:!0,variant:"outline",className:"mt-6 rounded-full",children:e.jsx("a",{href:"/",children:"Fara á vefinn"})})]})}):e.jsx(mi,{style:{"--sidebar-width":`${a}px`},children:e.jsx(Ei,{setSidebarWidth:i,menuItems:s,title:n,children:t})}):e.jsx("div",{className:"flex items-center justify-center min-h-screen",children:e.jsxs("div",{className:"flex flex-col items-center gap-8 p-8 max-w-md w-full",children:[e.jsxs("div",{className:"flex flex-col items-center gap-6",children:[e.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-center",children:"Skráðu þig inn til að halda áfram"}),e.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-sm",children:"Aðgangur að stjórnborðinu krefst innskráningar."})]}),e.jsx(M,{onClick:()=>qt(),size:"lg",className:"w-full shadow-lg hover:shadow-xl transition-all",children:"Skrá inn"})]})})}function Ei({children:t,setSidebarWidth:s,menuItems:n,title:r}){const{user:a,logout:i}=ca(),[u,p]=Xt(),{state:x,toggleSidebar:f}=Xe(),b=x==="collapsed",[h,k]=l.useState(!1),d=l.useRef(null),o=y=>u===y.path||!y.external&&y.path!=="/"&&y.path!=="/admin"&&u.startsWith(`${y.path}/`),g=n.find(o),v=tr();return l.useEffect(()=>{b&&k(!1)},[b]),l.useEffect(()=>{const y=D=>{if(!h)return;const T=d.current?.getBoundingClientRect().left??0,V=D.clientX-T;V>=Si&&V<=Mi&&s(V)},j=()=>{k(!1)};return h&&(document.addEventListener("mousemove",y),document.addEventListener("mouseup",j),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",j),document.body.style.cursor="",document.body.style.userSelect=""}},[h,s]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"relative",ref:d,children:[e.jsxs(pi,{collapsible:"icon",className:"border-r-0",disableTransition:h,children:[e.jsx(fi,{className:"h-16 justify-center",children:e.jsxs("div",{className:"flex items-center gap-3 px-2 transition-all w-full",children:[e.jsx("button",{onClick:f,className:"h-8 w-8 flex items-center justify-center hover:bg-accent rounded-lg transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0","aria-label":"Opna eða loka leiðsögn",children:e.jsx(la,{className:"h-4 w-4 text-muted-foreground"})}),b?null:e.jsx("div",{className:"flex items-center gap-2 min-w-0",children:e.jsx("span",{className:"font-semibold tracking-tight truncate",children:r})})]})}),e.jsx(vi,{className:"gap-0",children:e.jsx(bi,{className:"px-2 py-1",children:n.map(y=>{const j=o(y);return e.jsx(ji,{children:e.jsxs(ki,{isActive:j,onClick:()=>y.external?window.location.assign(y.path):p(y.path),tooltip:y.label,className:"h-10 transition-all font-normal",children:[e.jsx(y.icon,{className:`h-4 w-4 ${j?"text-primary":""}`}),e.jsx("span",{children:y.label})]})},y.path)})})}),e.jsx(hi,{className:"p-3",children:e.jsxs(ai,{children:[e.jsx(ri,{asChild:!0,children:e.jsxs("button",{className:"flex items-center gap-3 rounded-lg px-1 py-1 hover:bg-accent/50 transition-colors w-full text-left group-data-[collapsible=icon]:justify-center focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(ks,{className:"h-9 w-9 border shrink-0",children:e.jsx(ws,{className:"text-xs font-medium",children:a?.name?.charAt(0).toUpperCase()})}),e.jsxs("div",{className:"flex-1 min-w-0 group-data-[collapsible=icon]:hidden",children:[e.jsx("p",{className:"text-sm font-medium truncate leading-none",children:a?.name||"-"}),e.jsx("p",{className:"text-xs text-muted-foreground truncate mt-1.5",children:a?.email||"-"})]})]})}),e.jsx(si,{align:"end",className:"w-48",children:e.jsxs(ni,{onClick:i,className:"cursor-pointer text-destructive focus:text-destructive",children:[e.jsx(ns,{className:"mr-2 h-4 w-4"}),e.jsx("span",{children:"Skrá út"})]})})]})})]}),e.jsx("div",{className:`absolute top-0 right-0 w-1 h-full cursor-col-resize hover:bg-primary/20 transition-colors ${b?"hidden":""}`,onMouseDown:()=>{b||k(!0)},style:{zIndex:50}})]}),e.jsxs(xi,{children:[v&&e.jsx("div",{className:"flex border-b h-14 items-center justify-between bg-background/95 px-2 backdrop-blur supports-[backdrop-filter]:backdrop-blur sticky top-0 z-40",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(gi,{className:"h-9 w-9 rounded-lg bg-background"}),e.jsx("div",{className:"flex items-center gap-3",children:e.jsx("div",{className:"flex flex-col gap-1",children:e.jsx("span",{className:"tracking-tight text-foreground",children:g?.label??r})})})]})}),e.jsx("main",{className:"flex-1 p-4",children:t})]})]})}const Nt="max-h-[94svh] w-[calc(100vw-1rem)] max-w-[1180px] gap-0 overflow-hidden p-0 sm:w-[calc(100vw-2rem)] sm:max-w-[1180px]",H="min-h-12 text-base",Be="min-h-12 w-full rounded-md border border-input bg-background px-3 text-base outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",_e="min-h-32 text-base leading-7";function oe({title:t,description:s,action:n,children:r}){return e.jsxs("div",{className:"mx-auto w-full max-w-[1500px] space-y-6 p-1 sm:p-3",children:[e.jsxs("header",{className:"flex flex-col gap-4 border-b border-border pb-5 sm:flex-row sm:items-end sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow brand-eyebrow",children:"Stjórnborð Kolaportsins"}),e.jsx("h1",{className:"display-type mt-2 text-4xl uppercase sm:text-5xl",children:t}),e.jsx("p",{className:"mt-2 max-w-3xl text-sm leading-6 text-muted-foreground",children:s})]}),n]}),r]})}function I({label:t,hint:s,error:n,className:r,htmlFor:a,required:i,children:u}){const p=a&&s?`${a}-hint`:void 0,x=a&&n?`${a}
151-error`:void 0,f=[p,x].filter(Boolean).join(" ")||void 0,b=a&&l.isValidElement(u)?l.cloneElement(u,{id:u.props.id??a,"aria-describedby":f,"aria-invalid":n?!0:void 0}):u;return e.jsxs("div",{className:B("space-y-2",r),children:[e.jsxs($r,{htmlFor:a,className:"text-sm font-semibold",children:[t,i&&e.jsx("span",{className:"ml-1 text-destructive","aria-hidden":"true",children:"*"})]}),b,s&&e.jsx("p",{id:p,className:"text-xs leading-5 text-muted-foreground",children:s}),n&&e.jsx("p",{id:x,className:"text-sm font-medium text-destructive",role:"alert",children:n})]})}function X({title:t,description:s,children:n,className:r}){return e.jsxs("section",{className:B("rounded-[var(--radius)] border border-border bg-card p-4 shadow-sm sm:p-6",r),children:[e.jsxs("div",{className:"border-b border-border pb-4",children:[e.jsx("h3",{className:"text-lg font-bold",children:t}),s&&e.jsx("p",{className:"mt-1 max-w-3xl text-sm leading-6 text-muted-foreground",children:s})]}),e.jsx("div",{className:"mt-5 grid gap-5 sm:grid-cols-2",children:n})]})}function Ct({title:t="Forskoðun",open:s,onOpenChange:n,children:r}){return e.jsxs("aside",{className:"min-w-0 border-t border-border bg-muted/25 p-4 sm:p-6 lg:border-l lg:border-t-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow brand-eyebrow",children:"Live forskoðun"}),e.jsx("h3",{className:"mt-1 font-bold",children:t})]}),e.jsxs(M,{type:"button",size:"sm",variant:"outline",onClick:()=>n(!s),"aria-expanded":s,children:[e.jsx(ts,{"aria-hidden":"true"})," ",s?"Fela":"Sýna"]})]}),s?e.jsx("div",{className:"mt-4",children:r}):e.jsx("div",{className:"mt-4 rounded-[var(--radius)] border border-dashed border-border bg-background p-6 text-center text-sm leading-6 text-muted-foreground",children:"Forskoðunin er falin. Hún þrengir ekki að forminu og má opna þegar þörf er á."})]})}function St({dirty:t,pending:s,primaryLabel:n,pendingLabel:r="Vista…",onCancel:a,onSave:i,destructive:u}){return e.jsxs("footer",{className:"sticky bottom-0 z-20 flex flex-col gap-3 border-t border-border bg-background/95 px-4 py-4 backdrop-blur sm:flex-row sm:items-center sm:px-6",children:[e.jsxs("div",{className:"mr-auto flex items-center gap-2 text-sm","aria-live":"polite",children:[e.jsx("span",{className:B("size-2.5 rounded-full",t?"bg-amber-500":"bg-primary"),"aria-hidden":"true"}),e.jsx("span",{className:t?"font-semibold text-foreground":"text-muted-foreground",children:t?"Óvistaðar breytingar":"Allar breytingar vistaðar"})]}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[u,e.jsx(M,{type:"button",variant:"outline",onClick:a,disabled:s,children:"Hætta við"}),e.jsx(M,{type:"button",onClick:i,disabled:s||!t,children:s?r:n})]})]})}function ye({title:t,description:s,action:n}){return e.jsxs("div",{className:"rounded-[var(--radius)] border border-dashed border-border bg-muted/45 p-10 text-center",children:[e.jsx(ia,{className:"mx-auto size-9 text-primary","aria-hidden":"true"}),e.jsx("h2",{className:"mt-4 text-lg font-semibold",children:t}),e.jsx("p",{className:"mx-auto mt-2 max-w-md text-sm leading-6 text-muted-foreground",children:s}),n&&e.jsx("div",{className:"mt-5",children:n})]})}function ne({rows:t=4}){return e.jsx("div",{className:"space-y-3","aria-label":"Hleður gögnum",children:Array.from({length:t},(s,n)=>e.jsx("div",{className:"h-20 animate-pulse rounded-[var(--radius)] bg-muted"},n))})}function ie({children:t,tone:s="neutral"}){const n={neutral:"bg-muted text-muted-foreground",success:"bg-primary/15 text-brand-ink dark:text-primary",warning:"bg-amber-500/15 text-amber-800 dark:text-amber-300",danger:"bg-red-500/15 text-red-800 dark:text-red-300",info:"bg-blue-500/15 text-blue-800 dark:text-blue-300"};return e.jsx("span",{className:B("inline-flex rounded-full px-2.5 py-1 text-xs font-bold",n[s]),children:t})}function Qe({label:t="Eyða",onConfirm:s,disabled:n}){return e.jsx(M,{type:"button",variant:"destructive",disabled:n,onClick:()=>window.confirm("Ertu viss? Þessa aðgerð er ekki hægt að afturkalla.")&&s(),children:t})}function ce(t){if(t==null)return"";const s=t instanceof Date?t:new Date(t);return new Date(s.getTime()-s.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function rr(t){if(t==null)return"";const s=t instanceof Date?t:new Date(t);return new Date(s.getTime()-s.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Ce(t){return t.toLocaleLowerCase("is").normalize("NFD").replace(/[\u0300-\u036f]/g,"").replace(/ð/g,"d").replace(/þ/g,"th").replace(/æ/g,"ae").replace(/ö/g,"o").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function Di(){const{data:t,isLoading:s}=E.dashboard.stats.useQuery();return e.jsx(oe,{title:"Yfirlit",description:"Helstu tölur úr efnisstjórnun, viðburðum og innsendum erindum á einum stað.",children:s||!t?e.jsx(ne,{rows:3}):e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:[e.jsx(ke,{icon:Te,label:"Komandi viðburðir",value:t.upcomingEvents}),e.jsx(ke,{icon:Ne,label:"Virkir söluaðilar",value:t.activeVendors}),e.jsx(ke,{icon:as,label:"Nýjar rýmisfyrirspurnir",value:t.newInquiries}),e.jsx(ke,{icon:dt,label:"Ný tengiliðaskilaboð",value:t.newMessages}),e.jsx(ke,{icon:ps,label:"Nýjar söluaðilaumsóknir",value:t.newApplications}),e.jsx(ke,{icon:Zr,label:"Vefheimsóknir",value:"—",note:"Tiltækar í greiningarkerfi vefsins",actionHref:"https://manus-analytics.com"})]})})}function ke({icon:t,label:s,value:n,note:r,actionHref:a}){return e.jsxs("div",{className:"rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("span",{className:"flex size-10 items-center justify-center rounded-2xl bg-primary/15 text-primary",children:e.jsx(t,{className:"size-5","aria-hidden":"true"})}),e.jsx("span",{className:"display-type text-5xl leading-none",children:n})]}),e.jsx("p",{className:"mt-5 font-semibold",children:s}),r&&e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r}),a&&e.jsxs("a",{href:a,target:"_blank",rel:"noreferrer",className:"mt-3 inline-flex items-center gap-1.5 text-xs font-bold text-primary hover:underline",children:["Opna mælingar ",e.jsx(Qt,{className:"size-3.5","aria-hidden":"true"})]})]})}function Ti(t){const s=l.useRef({value:t,previous:t});return l.useMemo(()=>(s.current.value!==t&&(s.current.previous=s.current.value,s.current.value=t),s.current.previous),[t])}var Je="Checkbox",[Ri]=he(Je),[Pi,Mt]=Ri(Je);function _i(t){const{__scopeCheckbox:s,checked:n,children:r,defaultChecked:a,disabled:i,form:u,name:p,onCheckedChange:x,required:f,value:b="on",internal_do_not_use_render:h}=t,[k,d]=pt({prop:n,defaultProp:a??!1,onChange:x,caller:Je}),[o,g]=l.useState(null),[v,y]=l.useState(null),j=l.useRef(!1),D=o?!!u||!!o.closest("form"):!0,T={checked:k,disabled:i,setChecked:d,control:o,setControl:g,name:p,form:u,value:b,hasConsumerStoppedPropagationRef:j,required:f,defaultChecked:de(a)?!1:a,isFormControl:D,bubbleInput:v,setBubbleInput:y};return e.jsx(Pi,{scope:s,...T,children:Ai(h)?h(T):r})}var sr="CheckboxTrigger",nr=l.forwardRef(({__scopeCheckbox:t,onKeyDown:s,onClick:n,...r},a)=>{const{control:i,value:u,disabled:p,checked:x,required:f,setControl:b,setChecked:h,hasConsumerStoppedPropagationRef:k,isFormControl:d,bubbleInput:o}=Mt(sr,t),g=re(a,b),v=l.useRef(x);return l.useEffect(()=>{const y=i?.form;if(y){const j=()=>h(v.current);return y.addEventListener("reset",j),()=>y.removeEventListener("reset",j)}},[i,h]),e.jsx(W.button,{type:"button",role:"checkbox","aria-checked":de(x)?"mixed":x,"aria-required":f,"data-state":ur(x),"data-disabled":p?"":void 0,disabled:p,value:u,...r,ref:g,onKeyDown:A(s,y=>{y.key==="Enter"&&y.preventDefault()}),onClick:A(n,y=>{h(j=>de(j)?!0:!j),o&&d&&(k.current=y.isPropagationStopped(),k.current||y.stopPropagation())})})});nr.displayName=sr;var ir=l.forwardRef((t,s)=>{const{__scopeCheckbox:n,name:r,checked:a,defaultChecked:i,required:u,disabled:p,value:x,onCheckedChange:f,form:b,...h}=t;return e.jsx(_i,{__scopeCheckbox:n,checked:a,defaultChecked:i,disabled:p,required:u,onCheckedChange:f,name:r,form:b,value:x,internal_do_not_use_render:({isFormControl:k})=>e.jsxs(e.Fragment,{children:[e.jsx(nr,{...h,ref:s,__scopeCheckbox:n}),k&&e.jsx(cr,{__scopeCheckbox:n})]})})});ir.displayName=Je;var or="CheckboxIndicator",lr=l.forwardRef((t,s)=>{const{__scopeCheckbox:n,forceMount:r,...a}=t,i=Mt(or,n);return e.jsx(Ae,{present:r||de(i.checked)||i.checked===!0,children:e.jsx(W.span,{"data-state":ur(i.checked),"data-disabled":i.disabled?"":void 0,...a,ref:s,style:{pointerEvents:"none",...t.style}})})});lr.displayName=or;var dr="CheckboxBubbleInput",cr=l.forwardRef(({__scopeCheckbox:t,...s},n)=>{const{control:r,hasConsumerStoppedPropagationRef:a,checked:i,defaultChecked:u,required:p,disabled:x,name:f,value:b,form:h,bubbleInput:k,setBubbleInput:d}=Mt(dr,t),o=re(n,d),g=Ti(i),v=Ur(r);l.useEffect(()=>{const j=k;if(!j)return;const D=window.HTMLInputElement.prototype,V=Object.getOwnPropertyDescriptor(D,"checked").set,U=!a.current;if(g!==i&&V){const $=new Event("click",{bubbles:U});j.indeterminate=de(i),V.call(j,de(i)?!1:i),j.dispatchEvent($)}},[k,g,i,a]);const y=l.useRef(de(i)?!1:i);return e.jsx(W.input,{type:"checkbox","aria-hidden":!0,defaultChecked:u??y.current,required:p,disabled:x,name:f,value:b,form:h,...s,tabIndex:-1,ref:o,style:{...s.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});cr.displayName=dr;function Ai(t){return typeof t=="function"}function de(t){return t==="indeterminate"}function ur(t){return de(t)?"indeterminate":t?"checked":"unchecked"}function ae({className:t,...s}){return e.jsx(ir,{"data-slot":"checkbox",className:B("peer border-input dark:bg-input/30 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:data-[state=checked]:bg-primary data-[state=checked]:border-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive size-4 shrink-0 rounded-[4px] border shadow-xs transition-shadow outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",t),...s,children:e.jsx(lr,{"data-slot":"checkbox-indicator",className:"flex items-center justify-center text-current transition-none",children:e.jsx(xt,{className:"size-3.5"})})})}const Li="kolaportid:admin:event-draft:v1";function It(t){return`${Li}:${t??"new"}`}function Fi(t){if(!t||typeof t!="object")return!1;const s=t;return typeof s.storageKey=="string"&&typeof s.url=="string"&&typeof s.altText=="string"}function Oi(t){if(!t||typeof t!="object")return!1;const s=t;return["title","slug","excerpt","description","dateStart","dateEnd","locationInVenue","ticketUrl","priceIsk","recurrenceRule"].every(r=>
151typeof s[r]=="string")&&["free","paid","varies"].includes(String(s.priceType))&&["draft","published","archived"].includes(String(s.status))&&typeof s.isRecurring=="boolean"&&typeof s.featured=="boolean"&&Array.isArray(s.categoryIds)&&s.categoryIds.every(r=>Number.isInteger(r))&&(s.image===null||Fi(s.image))&&(s.id===void 0||Number.isInteger(s.id))}function Lt(t,s){try{const n=t.getItem(It(s));if(!n)return null;const r=JSON.parse(n);return r.version!==1||!Number.isFinite(r.savedAtMs)||!Oi(r.form)?null:r}catch{return null}}function Ft(t,s,n=Date.now()){const r={version:1,savedAtMs:n,form:s};return t.setItem(It(s.id),JSON.stringify(r)),r}function Ot(t,s){t.removeItem(It(s))}var Et="Progress",Dt=100,[zi]=he(Et),[Vi,Ui]=zi(Et),mr=l.forwardRef((t,s)=>{const{__scopeProgress:n,value:r=null,max:a,getValueLabel:i=Bi,...u}=t;(a||a===0)&&!zt(a)&&console.error($i(`${a}`,"Progress"));const p=zt(a)?a:Dt;r!==null&&!Vt(r,p)&&console.error(Ki(`${r}`,"Progress"));const x=Vt(r,p)?r:null,f=$e(x)?i(x,p):void 0;return e.jsx(Vi,{scope:n,value:x,max:p,children:e.jsx(W.div,{"aria-valuemax":p,"aria-valuemin":0,"aria-valuenow":$e(x)?x:void 0,"aria-valuetext":f,role:"progressbar","data-state":xr(x,p),"data-value":x??void 0,"data-max":p,...u,ref:s})})});mr.displayName=Et;var pr="ProgressIndicator",gr=l.forwardRef((t,s)=>{const{__scopeProgress:n,...r}=t,a=Ui(pr,n);return e.jsx(W.div,{"data-state":xr(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...r,ref:s})});gr.displayName=pr;function Bi(t,s){return`${Math.round(t/s*100)}%`}function xr(t,s){return t==null?"indeterminate":t===s?"complete":"loading"}function $e(t){return typeof t=="number"}function zt(t){return $e(t)&&!isNaN(t)&&t>0}function Vt(t,s){return $e(t)&&!isNaN(t)&&t<=s&&t>=0}function $i(t,s){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${s}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Dt}\`.`}function Ki(t,s){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${s}\`. The \`value\` prop must be:
152  - a positive number
153  - less than the value passed to \`max\` (or ${Dt} if no \`max\` prop is set)
154  - \`null\` or \`undefined\` if the progress is indeterminate.
155
156Defaulting to \`null\`.`}var Hi=mr,Gi=gr;function qi({className:t,value:s,...n}){return e.jsx(Hi,{"data-slot":"progress",className:B("bg-primary/20 relative h-2 w-full overflow-hidden rounded-full",t),...n,children:e.jsx(Gi,{"data-slot":"progress-indicator",className:"bg-primary h-full w-full flex-1 transition-all",style:{transform:`translateX(-${100-(s||0)}%)`}})})}function Ke({label:t,description:s,value:n,onChange:r,multiple:a=!1,maxItems:i=a?12:1,disabled:u=!1,defaultAltText:p="",onPendingChange:x}){const f=l.useId(),b=E.useUtils(),{data:h=[],isLoading:k}=E.media.list.useQuery(),[d,o]=l.useState(!1),[g,v]=l.useState(null),[y,j]=l.useState(""),[D,T]=l.useState(!1),[V,U]=l.useState(""),[$,F]=l.useState(0),q=l.useRef(null),C=l.useRef(null),O=l.useMemo(()=>g?URL.createObjectURL(g):null,[g]);l.useEffect(()=>()=>{O&&URL.revokeObjectURL(O)},[O]);const m=E.media.upload.useMutation(),c=n.length>=i;l.useEffect(()=>(x?.(!!g||m.isPending),()=>x?.(!1)),[g,x,m.isPending]),l.useEffect(()=>{if(!g)return;const S=window.requestAnimationFrame(()=>{q.current?.scrollIntoView({block:"nearest"}),C.current?.focus()});return()=>window.cancelAnimationFrame(S)},[g]);const w=()=>{v(null),j(""),U(""),F(0)},z=S=>{if(!S||u)return;const _=Zt(S);if(_){U(_),N.error(_);return}U(""),v(S),j(K=>K.trim()||p.trim()),F(15)},G=S=>{if(a){const _=n.filter(K=>K.storageKey!==S.storageKey||!S.storageKey);r([..._,S].slice(0,i))}else r([S]),o(!1)},Me=async()=>{if(!(!g||u)){if(y.trim().length<3){const S="Skrifaðu lýsandi íslenskan alt-texta áður en myndinni er hlaðið upp";U(S),N.error(S);return}try{U(""),F(35);const{base64:S,width:_,height:K}=await ea(g),Y=Kr(g);if(!Y)throw new Error("Ekki tókst að staðfesta skráargerð myndarinnar");F(68);const te=await m.mutateAsync({filename:g.name,mimeType:Y,base64:S,altText:y.trim(),width:_,height:K});F(100),G({mediaId:te.id,storageKey:te.storageKey,url:te.url,altText:te.altText,filename:te.filename}),w(),N.success("Mynd hlaðin upp og tengd við formið"),b.media.list.invali
156date().catch(()=>{N.warning("Myndin tengdist forminu en miðlasafnið uppfærðist ekki strax")})}catch(S){const _=S instanceof Error?S.message:"Ekki tókst að hlaða myndinni upp";U(_),F(0),N.error(_)}}},le=S=>r(n.filter((_,K)=>K!==S)),R=(S,_)=>{const K=S+_;if(K<0||K>=n.length)return;const Y=[...n];[Y[S],Y[K]]=[Y[K],Y[S]],r(Y)};return e.jsxs("section",{className:"space-y-4","aria-labelledby":`${f}-label`,children:[e.jsxs("div",{children:[e.jsx("h4",{id:`${f}-label`,className:"text-sm font-semibold",children:t}),s&&e.jsx("p",{className:"mt-1 text-xs leading-5 text-muted-foreground",children:s})]}),n.length>0&&e.jsx("div",{className:B("grid gap-3",a?"sm:grid-cols-2":"grid-cols-1"),children:n.map((S,_)=>e.jsxs("article",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:[e.jsx("img",{src:S.url,alt:S.altText||"Forskoðun valinnar myndar",className:"aspect-[16/9] w-full object-cover"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsx("label",{htmlFor:`${f}-alt-${_}`,className:"text-sm font-semibold",children:"Íslenskur alt-texti"}),e.jsx(P,{id:`${f}-alt-${_}`,value:S.altText,required:!0,"aria-required":"true",placeholder:"Lýstu myndinni á íslensku",onChange:K=>r(n.map((Y,te)=>te===_?{...Y,altText:K.target.value}:Y))}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(M,{type:"button",size:"icon",variant:"outline",onClick:()=>R(_,-1),disabled:_===0||u,"aria-label":"Færa mynd framar",children:e.jsx(Xr,{"aria-hidden":"true"})}),a&&e.jsx(M,{type:"button",size:"icon",variant:"outline",onClick:()=>R(_,1),disabled:_===n.length-1||u,"aria-label":"Færa mynd aftar",children:e.jsx(Yr,{"aria-hidden":"true"})}),e.jsxs(M,{type:"button",size:"sm",variant:"outline",onClick:()=>o(!0),disabled:u,children:[e.jsx(ct,{"aria-hidden":"true"})," ",a?"Bæta við":"Skipta út"]}),e.jsxs(M,{type:"button",size:"sm",variant:"ghost",className:"ml-auto text-destructive",onClick:()=>le(_),disabled:u,children:[e.jsx(ve,{"aria-hidden":"true"})," Fjarlægja"]})]})]})]},`${S.storageKey||S.url}-${_}`))}),!c&&e.jsxs("div",{onDragEnter:S=>{S.preventDefault(),T(!0)},onDragOver:S=>S.preventDefault(),onDragLeave:S=>{S.preventDefault(),T(!1)},onDrop:S=>{S.preventDefault(),T(!1),z(S.dataTransfer.files[0])},className:B("rounded-[var(--radius)] border-2 border-dashed p-5 text-center transition-colors",D?"border-primary bg-primary/10":"border-border bg-muted/35"),children:[O?e.jsx("img",{src:O,alt:"Forskoðun myndar fyrir upphleðslu",className:"mx-auto max-h-48 rounded-2xl object-contain"}):e.jsx(na,{className:"mx-auto size-9 text-primary","aria-hidden":"true"}),e.jsx("p",{className:"mt-3 text-sm font-semibold",children:n.length>0&&!a?"Dragðu nýja mynd hingað til að skipta út":"Dragðu mynd hingað eða veldu skrá"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"WebP, JPEG eða PNG · hámark 7 MB · vistast sem responsive WebP"}),g&&e.jsx("p",{className:"mt-2 text-sm font-semibold text-brand-ink",role:"status",children:"Mynd valin — ljúktu alt-texta og upphleðslu í skrefinu hér fyrir neðan."}),e.jsxs("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:[e.jsxs("label",{className:"inline-flex min-h-11 cursor-pointer items-center gap-2 rounded-full border border-border bg-background px-4 py-2 text-sm font-semibold hover:border-primary focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[e.jsx(Jt,{className:"size-4","aria-hidden":"true"})," Velja skrá",e.jsx("input",{id:`${f}-file`,type:"file",accept:".webp,.jpg,.jpeg,.png,image/webp,image/jpeg,image/png",className:"sr-only",disabled:u,onChange:S=>{z(S.target.files?.[0]),S.currentTarget.value=""}})]}),e.jsxs(M,{type:"button",variant:"outline",onClick:()=>o(!0),disabled:u,children:[e.jsx(ct,{"aria-hidden":"true"})," Velja úr miðlasafni"]})]})]}),g&&e.jsxs("div",{ref:q,className:"space-y-3 rounded-[var(--radius)] border border-primary/60 bg-primary/5 p-4","aria-busy":m.isPending,children:[e.jsx("p",{className:"text-sm font-bold text-brand-ink",children:"Skref 2 af 2 — ljúktu upphleðslunni"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:[g.name," · ",(g.size/1e6).toFixed(2)," MB"]}),e.jsx("label",{htmlFor:`${f}-upload-alt`,className:"text-sm font-semibold",children:"Íslenskur alt-texti fyrir nýju myndina"}),e.jsx(P,{ref:C,id:`${f}
156-upload-alt`,value:y,required:!0,"aria-required":"true",onChange:S=>j(S.target.value),placeholder:"Til dæmis söluaðili við bás sinn í Kolaportinu"}),($>0||m.isPending)&&e.jsxs("div",{className:"space-y-2","aria-live":"polite",children:[e.jsx(qi,{value:$}),e.jsx("p",{className:"text-xs text-muted-foreground",children:$<60?"Les mynd…":$<100?"Hleð upp og fínstilli WebP-afbrigði…":"Upphleðslu lokið"})]}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(M,{type:"button",onClick:Me,disabled:m.isPending||u,children:m.isPending?e.jsxs(e.Fragment,{children:[e.jsx(Hr,{className:"animate-spin","aria-hidden":"true"})," Hleð upp…"]}):"Hlaða upp og tengja við form"}),e.jsx(M,{type:"button",variant:"ghost",onClick:w,disabled:m.isPending,children:"Hætta við"})]})]}),V&&e.jsx("p",{className:"text-sm font-medium text-destructive",role:"alert",children:V}),e.jsx(ue,{open:d,onOpenChange:o,children:e.jsxs(me,{className:"max-h-[88vh] max-w-4xl overflow-y-auto",children:[e.jsxs(pe,{children:[e.jsx(ge,{children:"Velja úr miðlasafni"}),e.jsx(Ge,{children:"Veldu mynd sem þegar hefur verið fínstillt og vistuð í S3-geymslu Kolaportsins."})]}),k?e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6},(S,_)=>e.jsx("div",{className:"aspect-[4/3] animate-pulse rounded-[var(--radius)] bg-muted"},_))}):h.length===0?e.jsx("p",{className:"rounded-[var(--radius)] border border-dashed border-border p-8 text-center text-sm text-muted-foreground",children:"Miðlasafnið er tómt. Hladdu upp mynd hér fyrir ofan."}):e.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:h.map(S=>{const _=n.some(K=>K.storageKey===S.storageKey);return e.jsxs("button",{type:"button",onClick:()=>G({mediaId:S.id,storageKey:S.storageKey,url:S.url,altText:S.altText,filename:S.filename}),disabled:u||a&&_,className:B("overflow-hidden rounded-[var(--radius)] border bg-card text-left shadow-sm transition hover:border-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",_?"border-primary ring-2 ring-primary/30":"border-border"),children:[e.jsx("img",{src:S.url,alt:S.altText,loading:"lazy",className:"aspect-[4/3] w-full object-cover"}),e.jsxs("span",{className:"block p-3",children:[e.jsxs("span",{className:"flex items-center gap-2 text-sm font-semibold",children:[_&&e.jsx(xt,{className:"size-4 text-primary","aria-hidden":"true"}),S.filename]}),e.jsx("span",{className:"mt-1 line-clamp-2 block text-xs leading-5 text-muted-foreground",children:S.altText})]})]},S.id)})})]})})]})}function tt(){const t=new Date(Date.now()+6048e5);t.setHours(11,0,0,0);const s=new Date(t);return s.setHours(17,0,0,0),{title:"",slug:"",excerpt:"",description:"",dateStart:ce(t),dateEnd:ce(s),locationInVenue:"Kolaportið, Tryggvagata 19",ticketUrl:"",priceType:"free",priceIsk:"",isRecurring:!1,recurrenceRule:"FREQ=WEEKLY;BYDAY=SA,SU",image:null,status:"draft",featured:!1,categoryIds:[]}}const we=t=>JSON.stringify(t);function Wi(){const t=E.useUtils(),{data:s=[],isLoading:n}=E.events.adminList.useQuery(),{data:r=[]}=E.categories.adminList.useQuery({scope:"event"}),[a,i]=l.useState(tt),[u,p]=l.useState(()=>we(tt())),[x,f]=l.useState(!1),[b,h]=l.useState(!0),[k,d]=l.useState(!1),[o,g]=l.useState(null),v=we(a)!==u,y=v||k;l.useEffect(()=>{!x||!v||Ft(window.localStorage,a)},[v,a,x]),l.useEffect(()=>{if(!x||!y)return;const c=w=>{w.preventDefault(),w.returnValue=""};return window.addEventListener("beforeunload",c),()=>window.removeEventListener("beforeunload",c)},[y,x]);const j=async()=>{await Promise.all([t.events.adminList.invalidate(),t.events.list.invalidate(),t.events.featured.invalidate()])},D=async c=>{await j(),Ot(window.localStorage,a.id),p(we(a)),g(null),N.success(c),f(!1)},T=E.events.create.useMutation({onSuccess:()=>D("Viðburður stofnaður"),onError:c=>N.error(c.message||"Ekki tókst að stofna viðburð")}),V=E.events.update.useMutation({onSuccess:()=>D("Viðburður uppfærður"),onError:c=>N.error(c.message||"Ekki tókst að uppfæra viðburð")}),U=E.events.delete.useMutation({onSuccess:async()=>{await j(),N.success("Viðburði eytt")},onError:c=>N.error(c.message||"Ekki tókst að eyða viðburði")}),$=()=>{const c=tt(),w=Lt(window.localStorage),z=w?.form??c;i(z),p(we(c)),g(w?.savedAtMs??null),d(!1),h(!0),f(!0),w&&N.success("Óvistuð viðburðadrög endurheimt")},F=c=>{const w={id:c.id,title:c.title,slug:c.slug,excerpt:c.excerpt??"",description:c.description,dateStart:ce(c.dateStartMs),dateEnd:ce(c.dateEndMs),locationInVenue:c.locationInVenue??"",ticketUrl:c.ticketUrl??"",priceType:c.priceType,priceIsk:c.priceIsk==null?"":String(c.priceIsk),isRecurring:c.isRecurring,recurrenceRule:c.recurrenceRule??"",image:gt(c.imageUrl,c.imageKey,c.imageAlt),status:c.status,featured:c.featured,categoryIds:c.categories.map(Me=>Me.id)},z=Lt(window.localStorage,c.id),G=z?.form??w;i(G),p(we(w)),g(z?.savedAtMs??null),d(!1),h(!0),f(!0),z&&N.success("Óvistaðar breytingar á viðburðinum endurheimtar")},q=()=>{if(y){v&&Ft(window.localStorage,a);const c=k?"Mynd bíður enn upphleðslu. Loka formi? Textabreytingar verða varðveittar sem drög, en þú þarft að velja myndina aftur.":"Loka formi? Óvistaðar breytingar verða varðveittar og endurheimtar næst þegar þú opnar viðburðinn.";if(!window.confirm(c))return}f(!1)},C=()=>
156{if(!window.confirm("Henda óvistuðum breytingum og endurhlaða síðustu vistuðu útgáfu?"))return;Ot(window.localStorage,a.id);const c=JSON.parse(u);i(c),p(we(c)),g(null),d(!1),N.success("Óvistuðum breytingum hent")},O=()=>{if(k){N.error("Ljúktu myndaupphleðslunni eða veldu Hætta við áður en viðburðurinn er vistaður");return}const c=new Date(a.dateStart).getTime(),w=new Date(a.dateEnd).getTime();if(!a.title.trim()||a.description.trim().length<10||!a.slug.trim()){N.error("Titill, slóð og lýsing þurfa að vera útfyllt");return}if(!Number.isFinite(c)||!Number.isFinite(w)){N.error("Upphafs- og lokadagsetning þurfa að vera gild");return}if(a.status==="published"&&a.image&&!a.image.altText.trim()){N.error("Íslenskan alt-texta vantar áður en viðburðurinn er birtur");return}const z={slug:a.slug,title:a.title,excerpt:a.excerpt||null,description:a.description,dateStartMs:c,dateEndMs:w,locationInVenue:a.locationInVenue||null,ticketUrl:a.ticketUrl||null,priceType:a.priceType,priceIsk:a.priceType==="paid"&&a.priceIsk?Number(a.priceIsk):null,isRecurring:a.isRecurring,recurrenceRule:a.isRecurring&&a.recurrenceRule||null,imageUrl:a.image?.url??null,imageKey:a.image?.storageKey||null,imageAlt:a.image?.altText||null,status:a.status,featured:a.featured,categoryIds:a.categoryIds};a.id?V.mutate({id:a.id,...z}):T.mutate(z)},m=T.isPending||V.isPending;return e.jsxs(oe,{title:"Viðburðir",description:"Stofnaðu viðburði, vistaðu drög, stilltu endurtekningu og birtu þegar allt er tilbúið.",action:e.jsxs(M,{onClick:$,className:"rounded-full",children:[e.jsx(fe,{"aria-hidden":"true"})," Nýr viðburður"]}),children:[n?e.jsx(ne,{}):s.length===0?e.jsx(ye,{title:"Engir viðburðir",description:"Stofnaðu fyrsta viðburðinn og vistaðu hann sem drög eða birtan.",action:e.jsx(M,{onClick:$,children:"Nýr viðburður"})}):e.jsx("div",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[760px] text-left text-sm",children:[e.jsx("thead",{className:"bg-muted/65 text-xs uppercase tracking-wider text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-3",children:"Viðburður"}),e.jsx("th",{className:"px-4 py-3",children:"Dagsetning"}),e.jsx("th",{className:"px-4 py-3",children:"Staða"}),e.jsx("th",{className:"px-4 py-3",children:"Flokkar"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Aðgerðir"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:s.map(c=>e.jsxs("tr",{className:"hover:bg-muted/35",children:[e.jsxs("td",{className:"px-4 py-4",children:[e.jsx("p",{className:"font-semibold",children:c.title}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["/",c.slug,c.featured?" · Aðalviðburður":""]})]}),e.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:c.isRecurring?"Endurtekinn":new Intl.DateTimeFormat("is-IS",{day:"numeric",month:"short",year:"numeric"}).format(new Date(c.dateStartMs))}),e.jsx("td",{className:"px-4 py-4",children:e.jsx(ie,{tone:c.status==="published"?"success":c.status==="draft"?"warning":"neutral",children:c.status==="published"?"Birt":c.status==="draft"?"Drög":"Safnað"})}),e.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:c.categories.map(w=>w.name).join(", ")||"—"}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>F(c),children:[e.jsx(Se,{"aria-hidden":"true"})," Breyta"]}),e.jsx(M,{size:"icon",variant:"ghost",className:"text-destructive",onClick:()=>window.confirm("Eyða viðburðinum?")&&U.mutate({id:c.id}),"aria-label":`Eyða ${c.title}`,children:e.jsx(ve,{"aria-hidden":"true"})})]})})]},c.id))})]})})}),e.jsx(ue,{open:x,onOpenChange:c=>c?f(!0):q(),children:e.jsx(me,{className:Nt,children:e.jsxs("div",{className:"flex max-h-[94svh] min-w-0 flex-col",children:[e.jsxs(pe,{className:"border-b border-border px-4 py-4 pr-12 sm:px-6 sm:py-5",children:[e.jsx(ge,{children:a.id?"Breyta viðburði":"Nýr viðburður"}),e.jsx(Ge,{children:"Fylltu út efnið í köflum. Skyldir reitir eru merktir með stjörnu."})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"grid min-w-0 lg:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsxs("div",{className:"min-w-0 space-y-5 p-4 sm:p-6",children:[o&&e.jsxs("div",{className:"flex flex-col gap-3 rounded-[var(--radius)] border border-primary/50 bg-primary/10 p-4 sm:flex-row sm:items-center sm:justify-between",role:"status",children:[e.jsxs("div",{children:[e.jsx("p",{className:"font-bold text-brand-ink",children:"Óvistuð drög endurheimt"}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Breytingarnar þínar varðveittust þegar þú fórst úr forminu."})]}
156),e.jsx(M,{type:"button",variant:"outline",onClick:C,children:"Henda drögum"})]}),e.jsxs(X,{title:"Grunnupplýsingar",description:"Titill og lýsing sem gestir sjá á viðburðasíðu.",children:[e.jsx(I,{label:"Titill",htmlFor:"event-title",required:!0,className:"sm:col-span-2",children:e.jsx(P,{id:"event-title",className:H,value:a.title,onChange:c=>i(w=>({...w,title:c.target.value,slug:w.id?w.slug:Ce(c.target.value)}))})}),e.jsx(I,{label:"Stutt lýsing",htmlFor:"event-excerpt",hint:"Stutt samantekt fyrir viðburðaspjöld.",className:"sm:col-span-2",children:e.jsx(se,{id:"event-excerpt",className:_e,rows:3,value:a.excerpt,onChange:c=>i(w=>({...w,excerpt:c.target.value}))})}),e.jsx(I,{label:"Lýsing",htmlFor:"event-description",required:!0,className:"sm:col-span-2",children:e.jsx(se,{id:"event-description",className:_e,rows:8,value:a.description,onChange:c=>i(w=>({...w,description:c.target.value}))})}),e.jsx(I,{label:"Flokkar",className:"sm:col-span-2",children:e.jsx("div",{className:"flex flex-wrap gap-2 rounded-[var(--radius)] border border-border p-3",children:r.map(c=>e.jsxs("label",{className:"flex min-h-11 items-center gap-2 rounded-full bg-muted px-3 py-2 text-sm",children:[e.jsx(ae,{checked:a.categoryIds.includes(c.id),onCheckedChange:w=>i(z=>({...z,categoryIds:w===!0?[...z.categoryIds,c.id]:z.categoryIds.filter(G=>G!==c.id)}))})," ",c.name]},c.id))})})]}),e.jsxs(X,{title:"Tímasetning",description:"Dagsetningar eru vistaðar í UTC en birtar á íslenskum staðartíma.",children:[e.jsx(I,{label:"Upphaf",htmlFor:"event-start",required:!0,children:e.jsx(P,{id:"event-start",className:H,type:"datetime-local",value:a.dateStart,onChange:c=>i(w=>({...w,dateStart:c.target.value}))})}),e.jsx(I,{label:"Lok",htmlFor:"event-end",required:!0,children:e.jsx(P,{id:"event-end",className:H,type:"datetime-local",value:a.dateEnd,onChange:c=>i(w=>({...w,dateEnd:c.target.value}))})}),e.jsxs("label",{className:"flex min-h-12 items-center gap-3 text-sm font-semibold",children:[e.jsx(ae,{checked:a.isRecurring,onCheckedChange:c=>i(w=>({...w,isRecurring:c===!0}))})," Endurtekinn viðburður"]}),a.isRecurring&&e.jsx(I,{label:"Endurtekningarregla (RRULE)",htmlFor:"event-recurrence",hint:"Dæmi: FREQ=WEEKLY;BYDAY=SA,SU",className:"sm:col-span-2",children:e.jsx(P,{id:"event-recurrence",className:H,value:a.recurrenceRule,onChange:c=>i(w=>({...w,recurrenceRule:c.target.value.toUpperCase()}))})})]}),e.jsxs(X,{title:"Staðsetning og verð",description:"Skráðu staðsetningu í húsinu og miðaupplýsingar ef við á.",children:[e.jsx(I,{label:"Staðsetning",htmlFor:"event-location",children:e.jsx(P,{id:"event-location",className:H,value:a.locationInVenue,onChange:c=>i(w=>({...w,locationInVenue:c.target.value}))})}),e.jsx(I,{label:"Miðaslóð",htmlFor:"event-ticket",children:e.jsx(P,{id:"event-ticket",className:H,type:"url",value:a.ticketUrl,onChange:c=>i(w=>({...w,ticketUrl:c.target.value}))})}),e.jsx(I,{label:"Verðgerð",htmlFor:"event-price-type",children:e.jsxs("select",{id:"event-price-type",className:Be,value:a.priceType,onChange:c=>i(w=>({...w,priceType:c.target.value})),children:[e.jsx("option",{value:"free",children:"Ókeypis"}),e.jsx("option",{value:"paid",children:"Gjaldskylt"}),e.jsx("option",{value:"varies",children:"Breytilegt"})]})}),e.jsx(I,{label:"Verð í kr.",htmlFor:"event-price",hint:"Aðeins fyrir gjaldskyldan viðburð",children:e.jsx(P,{id:"event-price",className:H,type:"number",min:"0",value:a.priceIsk,onChange:c=>i(w=>({...w,priceIsk:c.target.value}))})})]}),e.jsx(X,{title:"Myndir",description:"Veldu úr miðlasafni eða hladdu upp fínstilltri responsive WebP-mynd.",className:"[&>div:last-child]:block",children:e.jsx(Ke,{label:"Aðalmynd viðburðar",description:"Alt-texti er skyldur áður en viðburður er birtur.",value:a.image?[a.image]:[],onChange:c=>i(w=>({...w,image:c[0]??null})),defaultAltText:a.title.trim()?`${a.title.trim()} í Kolaportinu`:"",onPendingChange:d,disabled:m})}),e.jsx(X,{title:"SEO",description:"Slóðin er sýnileg í vafra og leitarvélum.",children:e.jsx(I,{label:"Slóð",htmlFor:"event-slug",required:!0,hint:"Nota lágstafi og bandstrik.",children:e.jsx(P,{id:"event-slug",className:H,value:a.slug,onChange:c=>i(w=>({...w,slug:Ce(c.target.value)}))})})}),e.jsxs(X,{title:"Birting",description:"Vistaðu drög eða birtu þegar efni, mynd og alt-texti eru tilbúin.",children:[e.jsx(I,{label:"Staða",htmlFor:"event-status",children:e.jsxs("select",{id:"event-status",className:Be,value:a.status,onChange:c=>i(w=>({...w,status:c.target.value})),children:[e.jsx("option",{value:"draft",children:"Drög"}),e.jsx("option",{value:"published",children:"Birt"}),e.jsx("option",{value:"archived",children:"Safnað"})]})}),e.jsxs("label",{className:"flex min-h-12 items-center gap-3 text-sm font-semibold",children:[e.jsx(ae,{checked:a.featured,onCheckedChange:c=>i(w=>({...w,featured:c===!0}))})," Aðalviðburður á forsíðu"]})]})]}),e.jsx(Ct,{open:b,onOpenChange:h,title:"Viðburðaspjald",children:e.jsxs("div",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:[a.image?e.jsx("img",{src:a.image.url,alt:a.image.altText,className:"aspect-[16/9] w-full rounded-b-none object-cover"}):e.jsx("div",{className:"brand-grid-surface brand-grid-surface--contained flex aspect-[16/9] items-center justify-center bg-muted",children:e.jsx(Te,{className:"size-10 text-primary","aria-hidden":"true"})}),e.jsxs("div",{className:"p-5",children:[e.jsx(ie,{tone:a.status==="published"?"success":"warning",children:a.status==="published"?"Birt":"Ekki birt"}),e.jsx("h3",{className:"display-type mt-4 text-3xl uppercase",children:a.title||"Titill viðburðar"}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:a.excerpt||a.description||"Lýsing birtist hér."})]})]})})]})}),e.jsx(St,{dirty:y,pending:m,primaryLabel:a.status==="published"?"Vista og birta":"Vista drög",onCancel:q,onSave:O,de
156structive:a.id?e.jsx(Qe,{label:"Eyða",disabled:U.isPending,onConfirm:()=>{U.mutate({id:a.id}),f(!1)}}):void 0})]})})})]})}function at(){return{name:"",slug:"",description:"",stallNumber:"",floor:"",zone:"",mapX:"",mapY:"",contactEmail:"",contactPhone:"",website:"",logo:null,photos:[],status:"inactive",featured:!1,joinedDate:"",sortOrder:"0",categoryIds:[]}}const Ee=t=>JSON.stringify(t);function Yi(){const t=E.useUtils(),{data:s=[],isLoading:n}=E.vendors.adminList.useQuery(),{data:r=[]}=E.categories.adminList.useQuery({scope:"vendor"}),[a,i]=l.useState(at),[u,p]=l.useState(()=>Ee(at())),[x,f]=l.useState(!1),[b,h]=l.useState(!0),[k,d]=l.useState([]),o=Ee(a)!==u,g=async()=>{await Promise.all([t.vendors.adminList.invalidate(),t.vendors.list.invalidate(),t.vendors.featured.invalidate(),t.vendors.map.invalidate()])},v=async m=>{await g(),p(Ee(a)),N.success(m),f(!1)},y=E.vendors.create.useMutation({onSuccess:()=>v("Söluaðili stofnaður"),onError:m=>N.error(m.message)}),j=E.vendors.update.useMutation({onSuccess:()=>v("Söluaðili uppfærður"),onError:m=>N.error(m.message)}),D=E.vendors.delete.useMutation({onSuccess:async()=>{await g(),N.success("Söluaðila eytt")},onError:m=>N.error(m.message)}),T=E.vendors.bulkStatus.useMutation({onSuccess:async()=>{await g(),d([]),N.success("Staða söluaðila uppfærð")},onError:m=>N.error(m.message)}),V=()=>{const m=at();i(m),p(Ee(m)),h(!0),f(!0)},U=m=>{const c={id:m.id,name:m.name,slug:m.slug,description:m.description??"",stallNumber:m.stallNumber??"",floor:m.floor??"",zone:m.zone??"",mapX:m.mapX==null?"":String(m.mapX),mapY:m.mapY==null?"":String(m.mapY),contactEmail:m.contactEmail??"",contactPhone:m.contactPhone??"",website:m.website??"",logo:gt(m.logoUrl,m.logoKey,m.logoAlt),photos:m.photos.map(w=>({storageKey:w.storageKey,url:w.url,altText:w.altText})),status:m.status,featured:m.featured,joinedDate:rr(m.joinedDateMs),sortOrder:String(m.sortOrder),categoryIds:m.categories.map(w=>w.id)};i(c),p(Ee(c)),h(!0),f(!0)},$=()=>{o&&!window.confirm("Þú ert með óvistaðar breytingar. Loka án þess að vista?")||f(!1)},F=()=>{if(!a.name.trim()||!a.slug.trim()){N.error("Nafn og slóð þurfa að vera útfyllt");return}if(a.status==="active"&&a.logo&&!a.logo.altText.trim()){N.error("Íslenskan alt-texta vantar fyrir aðalmyndina áður en söluaðili er virkjaður");return}if(a.photos.some(z=>!z.altText.trim())){N.error("Íslenskan alt-texta vantar fyrir eina eða fleiri viðbótarmyndir");return}const m=a.mapX===""?null:Number(a.mapX),c=a.mapY===""?null:Number(a.mapY);if(m==null!=(c==null)){N.error("Bæði X- og Y-hnit þarf til að birta staðsetningu");return}const w={slug:a.slug,name:a.name,description:a.description||null,stallNumber:a.stallNumber||null,floor:a.floor||null,zone:a.zone||null,mapX:m,mapY:c,contactEmail:a.contactEmail||null,contactPhone:a.contactPhone||null,website:a.website||null,logoUrl:a.logo?.url??null,logoKey:a.logo?.storageKey||null,logoAlt:a.logo?.altText||null,status:a.status,featured:a.featured,joinedDateMs:a.joinedDate?new Date(`${a.joinedDate}T12:00:00Z`).getTime():null,sortOrder:Number(a.sortOrder)||0,categoryIds:a.categoryIds,photos:a.photos.map((z,G)=>({storageKey:z.storageKey,url:z.url,altText:z.altText,sortOrder:G}))};a.id?j.mutate({id:a.id,...w}):y.mutate(w)},q=(m,c)=>d(w=>c?Array.from(new Set([...w,m])):w.filter(z=>z!==m)),C=s.length>0&&k.length===s.length,O=y.isPending||j.isPending;return e.jsxs(oe,{title:"Söluaðilar",description:"Haltu prófílum, flokkum og staðsetningum uppfærðum. Óvirkir söluaðilar birtast ekki á opinbera vefnum.",action:e.jsxs(M,{onClick:V,className:"rounded-full",children:[e.jsx(fe,{"aria-hidden":"true"})," Nýr söluaðili"]}),children:[k.length>0&&e.jsxs("div",{className:"flex flex-wrap items-center gap-3 rounded-[var(--radius)] border border-primary/30 bg-primary/10 p-3",children:[e.jsxs("p",{className:"mr-auto text-sm font-semibold",children:[k.length," valdir"]}),e.jsx(M,{size:"sm",variant:"outline",onClick:()=>T.mutate({ids:k,status:"active"}),disabled:T.isPending,children:"Virkja"}),e.jsx(M,{size:"sm",variant:"outline",onClick:()=>T.mutate({ids:k,status:"inactive"}),disabled:T.isPending,children:"Óvirkja"}),e.jsx(M,{size:"sm",variant:"ghost",onClick:()=>d([]),children:"Hreinsa val"})]}),n?e.jsx(ne,{}):s.length===0?e.jsx(ye,{title:"Engir söluaðilar",description:"Bættu við fyrsta söluaðilanum og vir
156kjaðu prófílinn þegar efnið er tilbúið.",action:e.jsx(M,{onClick:V,children:"Nýr söluaðili"})}):e.jsx("div",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:e.jsx("div",{className:"overflow-x-auto",children:e.jsxs("table",{className:"w-full min-w-[820px] text-left text-sm",children:[e.jsx("thead",{className:"bg-muted/65 text-xs uppercase tracking-wider text-muted-foreground",children:e.jsxs("tr",{children:[e.jsx("th",{className:"w-12 px-4 py-3",children:e.jsx(ae,{checked:C,onCheckedChange:m=>d(m===!0?s.map(c=>c.id):[]),"aria-label":"Velja alla"})}),e.jsx("th",{className:"px-4 py-3",children:"Söluaðili"}),e.jsx("th",{className:"px-4 py-3",children:"Staðsetning"}),e.jsx("th",{className:"px-4 py-3",children:"Staða"}),e.jsx("th",{className:"px-4 py-3",children:"Flokkar"}),e.jsx("th",{className:"px-4 py-3 text-right",children:"Aðgerðir"})]})}),e.jsx("tbody",{className:"divide-y divide-border",children:s.map(m=>e.jsxs("tr",{className:"hover:bg-muted/35",children:[e.jsx("td",{className:"px-4 py-4",children:e.jsx(ae,{checked:k.includes(m.id),onCheckedChange:c=>q(m.id,c===!0),"aria-label":`Velja ${m.name}`})}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs("div",{className:"flex items-center gap-3",children:[m.logoUrl?e.jsx("img",{src:m.logoUrl,alt:"",className:"size-11 rounded-xl object-cover"}):e.jsx("span",{className:"flex size-11 items-center justify-center rounded-xl bg-muted text-primary",children:e.jsx(Ne,{className:"size-5","aria-hidden":"true"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold",children:m.name}),e.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["/",m.slug,m.featured?" · Á forsíðu":""]})]})]})}),e.jsxs("td",{className:"px-4 py-4 text-muted-foreground",children:[[m.floor,m.zone,m.stallNumber&&`bás ${m.stallNumber}`].filter(Boolean).join(" · ")||"Óskráð",m.mapX!=null&&m.mapY!=null&&e.jsx("span",{className:"ml-2 text-primary",title:"Hnit skráð",children:"●"})]}),e.jsx("td",{className:"px-4 py-4",children:e.jsx(ie,{tone:m.status==="active"?"success":"neutral",children:m.status==="active"?"Virkur":"Óvirkur"})}),e.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:m.categories.map(c=>c.name).join(", ")||"—"}),e.jsx("td",{className:"px-4 py-4",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>U(m),children:[e.jsx(Se,{"aria-hidden":"true"})," Breyta"]}),e.jsx(M,{size:"icon",variant:"ghost",className:"text-destructive",onClick:()=>window.confirm("Eyða söluaðilanum?")&&D.mutate({id:m.id}),"aria-label":`Eyða ${m.name}`,children:e.jsx(ve,{"aria-hidden":"true"})})]})})]},m.id))})]})})}),e.jsx(ue,{open:x,onOpenChange:m=>m?f(!0):$(),children:e.jsx(me,{className:Nt,children:e.jsxs("div",{className:"flex max-h-[94svh] min-w-0 flex-col",children:[e.jsxs(pe,{className:"border-b border-border px-4 py-4 pr-12 sm:px-6 sm:py-5",children:[e.jsx(ge,{children:a.id?"Breyta söluaðila":"Nýr söluaðili"}),e.jsx(Ge,{children:"Virkjaðu aðeins söluaðila þegar upplýsingar, myndir og alt-textar eru staðfest."})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"grid min-w-0 lg:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsxs("div",{className:"min-w-0 space-y-5 p-4 sm:p-6",children:[e.jsxs(X,{title:"Grunnupplýsingar",description:"Nafn, lýsing, samskipti og flokkar söluaðilans.",children:[e.jsx(I,{label:"Nafn",htmlFor:"vendor-name",required:!0,className:"sm:col-span-2",children:e.jsx(P,{id:"vendor-name",className:H,value:a.name,onChange:m=>i(c=>({...c,name:m.target.value,slug:c.id?c.slug:Ce(m.target.value)}))})}),e.jsx(I,{label:"Lýsing",htmlFor:"vendor-description",className:"sm:col-span-2",children:e.jsx(se,{id:"vendor-description",className:_e,rows:7,value:a.description,onChange:m=>i(c=>({...c,description:m.target.value}))})}),e.jsx(I,{label:"Netfang",htmlFor:"vendor-email",children:e.jsx(P,{id:"vendor-email",className:H,type:"email",value:a.contactEmail,onChange:m=>i(c=>({...c,contactEmail:m.target.value}))})}),e.jsx(I,{label:"Símanúmer",htmlFor:"vendor-phone",children:e.jsx(P,{id:"vendor-phone",className:H,type:"tel",value:a.contactPhone,onChange:m=>i(c=>({...c,contactPhone:m.target.value}))})}),e.jsx(I,{label:"Vefsíða",htmlFor:"vendor-website",className:"sm:col-span-2",children:e.jsx(P,{id:"vendor-website",className:H,type:"url",value:a.website,onChange:m=>i(c=>({...c,website:m.target.value}))})}),e.jsx(I,{label:"Flokkar",className:"sm:col-span-2",children:e.jsx("div",{className:"flex flex-wrap gap-2 rounded-[var(--radius)] border border-border p-3",children:r.map(m=>e.jsxs("label",{className:"flex min-h-11 items-center gap-2 rounded-full bg-muted px-3 py-2 text-sm",children:[e.jsx(ae,{checked:a.categoryIds.includes(m.id),onCheckedChange:c=>i(w=>
156({...w,categoryIds:c===!0?[...w.categoryIds,m.id]:w.categoryIds.filter(z=>z!==m.id)}))})," ",m.name]},m.id))})})]}),e.jsxs(X,{title:"Staðsetning",description:"Bás, hæð og staðfest hnit á innra korti.",children:[e.jsx(I,{label:"Básnúmer",htmlFor:"vendor-stall",children:e.jsx(P,{id:"vendor-stall",className:H,value:a.stallNumber,onChange:m=>i(c=>({...c,stallNumber:m.target.value}))})}),e.jsx(I,{label:"Hæð",htmlFor:"vendor-floor",children:e.jsx(P,{id:"vendor-floor",className:H,value:a.floor,onChange:m=>i(c=>({...c,floor:m.target.value}))})}),e.jsx(I,{label:"Svæði",htmlFor:"vendor-zone",children:e.jsx(P,{id:"vendor-zone",className:H,value:a.zone,onChange:m=>i(c=>({...c,zone:m.target.value}))})}),e.jsx(I,{label:"Röðun",htmlFor:"vendor-sort",children:e.jsx(P,{id:"vendor-sort",className:H,type:"number",min:"0",value:a.sortOrder,onChange:m=>i(c=>({...c,sortOrder:m.target.value}))})}),e.jsx(I,{label:"X-hnit korts",htmlFor:"vendor-map-x",hint:"0–1000; aðeins staðfest gögn",children:e.jsx(P,{id:"vendor-map-x",className:H,type:"number",min:"0",max:"1000",value:a.mapX,onChange:m=>i(c=>({...c,mapX:m.target.value}))})}),e.jsx(I,{label:"Y-hnit korts",htmlFor:"vendor-map-y",hint:"0–1000; aðeins staðfest gögn",children:e.jsx(P,{id:"vendor-map-y",className:H,type:"number",min:"0",max:"1000",value:a.mapY,onChange:m=>i(c=>({...c,mapY:m.target.value}))})})]}),e.jsx(X,{title:"Myndir",description:"Aðalmynd birtist í listum. Viðbótarmyndir birtast í myndasafni söluaðilasíðunnar.",className:"[&>div:last-child]:block",children:e.jsxs("div",{className:"space-y-6",children:[e.jsx(Ke,{label:"Aðalmynd",description:"Ein mynd með lýsandi íslenskum alt-texta.",value:a.logo?[a.logo]:[],onChange:m=>i(c=>({...c,logo:m[0]??null})),disabled:O}),e.jsx(Ke,{label:"Fleiri myndir",description:"Allt að 12 myndir. Notaðu örvarnar til að stilla röð.",value:a.photos,onChange:m=>i(c=>({...c,photos:m})),multiple:!0,maxItems:12,disabled:O})]})}),e.jsxs(X,{title:"SEO",description:"Stýrðu vefslóð og upphafsdegi án þess að breyta opinberum staðreyndum.",children:[e.jsx(I,{label:"Slóð",htmlFor:"vendor-slug",required:!0,hint:"Nota lágstafi og bandstrik.",children:e.jsx(P,{id:"vendor-slug",className:H,value:a.slug,onChange:m=>i(c=>({...c,slug:Ce(m.target.value)}))})}),e.jsx(I,{label:"Upphafsdagur — valfrjálst",htmlFor:"vendor-joined",children:e.jsx(ta,{id:"vendor-joined",value:a.joinedDate,onChange:m=>i(c=>({...c,joinedDate:m})),ariaLabel:"Upphafsdagur söluaðila"})})]}),e.jsxs(X,{title:"Birting",description:"Nýir söluaðilar byrja óvirkir og birtast ekki fyrr en þeir eru sérstaklega virkjaðir.",children:[e.jsx(I,{label:"Staða",htmlFor:"vendor-status",children:e.jsxs("select",{id:"vendor-status",className:Be,value:a.status,onChange:m=>i(c=>({...c,status:m.target.value})),children:[e.jsx("option",{value:"inactive",children:"Óvirkur"}),e.jsx("option",{value:"active",children:"Virkur"})]})}),e.jsxs("label",{className:"flex min-h-12 items-center gap-3 text-sm font-semibold",children:[e.jsx(ae,{checked:a.featured,onCheckedChange:m=>i(c=>({...c,featured:m===!0}))})," Birta á forsíðu"]})]})]}),e.jsxs(Ct,{open:b,onOpenChange:h,title:"Söluaðilaspjald",children:[e.jsxs("div",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:[a.logo?e.jsx("img",{src:a.logo.url,alt:a.logo.altText,className:"aspect-[4/3] w-full rounded-b-none object-cover"}):e.jsx("div",{className:"brand-grid-surface brand-grid-surface--contained flex aspect-[4/3] items-center justify-center bg-muted",children:e.jsx(Ne,{className:"size-10 text-primary","aria-hidden":"true"})}),e.jsxs("div",{className:"p-5",children:[e.jsx("div",{className:"flex flex-wrap gap-2",children:r.filter(m=>a.categoryIds.includes(m.id)).map(m=>e.jsx(ie,{tone:"success",children:m.name},m.id))}),e.jsx("h3",{className:"display-type mt-4 text-3xl uppercase",children:a.name||"Nafn söluaðila"}),e.jsx("p",{className:"mt-3 text-sm leading-6 text-muted-foreground",children:a.description||"Lýsing birtist hér."})]})]}),a.photos.length>0&&e.jsx("div",{className:"mt-4 grid grid-cols-2 gap-2",children:a.photos.slice(0,4).map((m,c)=>e.jsx("img",{src:m.url,alt:m.altText,className:"aspect-square w-full rounded-xl object-cover"},`${m.storageKey}-${c}`))}),e.jsxs("div",{className:"mt-4 rounded-[var(--radius)] border border-border bg-background p-5",children:[e.jsx(Gr,{className:"size-6 text-primary","aria-hidden":"true"}),e.jsx("h3",{className:"mt-3 font-semibold",children:"Kortahnit"}),e.jsx("p",{className:"mt-2 text-sm leading-6 text-muted-foreground",children:"Skráðu aðeins hnit af staðfestu innra korti. Opinberi vefurinn felur óskráða punkta sjálfkrafa."})]})]})]})}),e.jsx(St,{dirty:o,pending:O,primaryLabel:a.status==="active"?"Vista og birta":"Vista drög",onCancel:$,onSave:F,destructive:a.id?e.jsx(Qe,{label:"Eyða",disabled:D.isPending,onConfirm:()=>{D.mutate({id:a.id}),f(!1)}}):void 0})]})})})]})}const fr=["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"];function Ut(t="regular"){return{id:void 0,kind:t,dayOfWeek:"6",specialDate:"",openTime:"11:00",closeTime:"17:00",closed:t==="closure",note:"",active:!0,sortOrder:"0"}}function Xi(){const t=E.useUtils(),{data:s=[],isLoading:n}=E.schedule.adminList.useQuery(),[r,a]=l.useState(Ut),[i,u]=l.useState(!1),p=async()=>
156{await Promise.all([t.schedule.adminList.invalidate(),t.schedule.publicList.invalidate()])},x=E.schedule.upsert.useMutation({onSuccess:async()=>{await p(),N.success("Dagskrá vistuð"),u(!1)},onError:d=>N.error(d.message)}),f=E.schedule.delete.useMutation({onSuccess:async()=>{await p(),N.success("Dagskrárfærslu eytt")},onError:d=>N.error(d.message)}),b=(d="regular")=>{a(Ut(d)),u(!0)},h=d=>{a({id:d.id,kind:d.kind,dayOfWeek:d.dayOfWeek==null?"6":String(d.dayOfWeek),specialDate:rr(d.specialDateMs),openTime:d.openTime??"11:00",closeTime:d.closeTime??"17:00",closed:d.closed,note:d.note??"",active:d.active,sortOrder:String(d.sortOrder)}),u(!0)},k=()=>{const d=r.kind==="regular"?null:r.specialDate?new Date(`${r.specialDate}T12:00:00Z`).getTime():null;if(r.kind!=="regular"&&d==null){N.error("Veldu dagsetningu fyrir sérstakan dag eða lokun");return}x.mutate({id:r.id,kind:r.kind,dayOfWeek:r.kind==="regular"?Number(r.dayOfWeek):null,specialDateMs:d,openTime:r.closed?null:r.openTime,closeTime:r.closed?null:r.closeTime,closed:r.closed,note:r.note||null,active:r.active,sortOrder:Number(r.sortOrder)||0})};return e.jsxs(oe,{title:"Dagskrá",description:"Stýrðu reglulegum opnunartímum og skráðu undantekningar. Sérstakir dagar gilda fram yfir reglulega dagskrá.",action:e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(M,{variant:"outline",onClick:()=>b("special"),children:[e.jsx(fe,{"aria-hidden":"true"})," Sérstakur dagur"]}),e.jsxs(M,{onClick:()=>b("regular"),className:"rounded-full",children:[e.jsx(fe,{"aria-hidden":"true"})," Reglulegur tími"]})]}),children:[n?e.jsx(ne,{}):s.length===0?e.jsx(ye,{title:"Engin dagskrá",description:"Skráðu reglulegan opnunartíma áður en vefurinn er birtur.",action:e.jsx(M,{onClick:()=>b("regular"),children:"Bæta við tíma"})}):e.jsxs("div",{className:"grid gap-5 lg:grid-cols-2",children:[e.jsx(Bt,{title:"Reglulegur opnunartími",items:s.filter(d=>d.kind==="regular"),onEdit:h,onDelete:d=>f.mutate({id:d})}),e.jsx(Bt,{title:"Sérstakir dagar og lokanir",items:s.filter(d=>d.kind!=="regular"),onEdit:h,onDelete:d=>f.mutate({id:d})})]}),e.jsx(ue,{open:i,onOpenChange:u,children:e.jsxs(me,{className:"max-w-xl",children:[e.jsx(pe,{children:e.jsx(ge,{children:r.id?"Breyta dagskrárfærslu":"Ný dagskrárfærsla"})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(I,{label:"Tegund",className:"sm:col-span-2",children:e.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:r.kind,onChange:d=>a(o=>({...o,kind:d.target.value,closed:d.target.value==="closure"})),children:[e.jsx("option",{value:"regular",children:"Reglulegur opnunartími"}),e.jsx("option",{value:"special",children:"Sérstakur opnunartími"}),e.jsx("option",{value:"closure",children:"Lokað"})]})}),r.kind==="regular"?e.jsx(I,{label:"Vikudagur",className:"sm:col-span-2",children:e.jsx("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:r.dayOfWeek,onChange:d=>a(o=>({...o,dayOfWeek:d.target.value})),children:fr.map((d,o)=>e.jsx("option",{value:o,children:d},d))})}):e.jsx(I,{label:"Dagsetning",className:"sm:col-span-2",children:e.jsx(ta,{value:r.specialDate,onChange:d=>a(o=>({...o,specialDate:d})),ariaLabel:"Dagsetning dagskrárfærslu"})}),!r.closed&&e.jsxs(e.Fragment,{children:[e.jsx(I,{label:"Opnar",children:e.jsx(P,{type:"time",value:r.openTime,onChange:d=>a(o=>({...o,openTime:d.target.value}))})}),e.jsx(I,{label:"Lokar",children:e.jsx(P,{type:"time",value:r.closeTime,onChange:d=>a(o=>({...o,closeTime:d.target.value}))})})]}),e.jsx(I,{label:"Skýring",className:"sm:col-span-2",children:e.jsx(se,{rows:3,value:r.note,onChange:d=>a(o=>({...o,note:d.target.value})),placeholder:"Til dæmis lokað vegna hátíðardags"})}),e.jsx(I,{label:"Röðun",children:e.jsx(P,{type:"number",min:"0",value:r.sortOrder,onChange:d=>a(o=>({...o,sortOrder:d.target.value}))})}),e.jsxs("div",{className:"space-y-3 pt-1",children:[e.jsxs("label",{className:"flex items-center gap-3 text-sm font-medium",children:[e.jsx(ae,{checked:r.closed,onCheckedChange:d=>
156a(o=>({...o,closed:d===!0,kind:d===!0&&o.kind!=="regular"?"closure":o.kind}))})," Lokað"]}),e.jsxs("label",{className:"flex items-center gap-3 text-sm font-medium",children:[e.jsx(ae,{checked:r.active,onCheckedChange:d=>a(o=>({...o,active:d===!0}))})," Virk birting"]})]})]}),e.jsxs("div",{className:"flex justify-end gap-3 border-t border-border pt-5",children:[r.id&&e.jsx(Qe,{label:"Eyða",disabled:f.isPending,onConfirm:()=>{f.mutate({id:r.id}),u(!1)}}),e.jsx(M,{variant:"outline",onClick:()=>u(!1),children:"Hætta við"}),e.jsx(M,{onClick:k,disabled:x.isPending,children:x.isPending?"Vista…":"Vista"})]})]})})]})}function Bt({title:t,items:s,onEdit:n,onDelete:r}){return e.jsxs("div",{className:"rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm",children:[e.jsxs("h2",{className:"display-type flex items-center gap-2 text-2xl uppercase",children:[e.jsx(aa,{className:"size-5 text-primary","aria-hidden":"true"})," ",t]}),s.length===0?e.jsx("p",{className:"mt-5 text-sm text-muted-foreground",children:"Engar færslur."}):e.jsx("div",{className:"mt-5 divide-y divide-border",children:s.map(a=>e.jsxs("div",{className:"flex items-center gap-3 py-4",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"font-semibold",children:a.kind==="regular"&&a.dayOfWeek!=null?fr[a.dayOfWeek]:a.specialDateMs?new Intl.DateTimeFormat("is-IS",{day:"numeric",month:"long",year:"numeric"}).format(new Date(a.specialDateMs)):"Sérstakur dagur"}),e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[a.closed?"Lokað":`${a.openTime}–${a.closeTime}`,a.note?` · ${a.note}`:""]})]}),e.jsx(ie,{tone:a.active?"success":"neutral",children:a.active?"Virk":"Óvirk"}),e.jsx(M,{size:"icon",variant:"ghost",onClick:()=>n(a),"aria-label":"Breyta",children:e.jsx(Se,{"aria-hidden":"true"})}),e.jsx(M,{size:"icon",variant:"ghost",className:"text-destructive",onClick:()=>window.confirm("Eyða færslunni?")&&r(a.id),"aria-label":"Eyða",children:e.jsx(ve,{"aria-hidden":"true"})})]},a.id))})]})}function Qi({value:t,onChange:s,rows:n=12,id:r,ariaLabel:a,className:i,"aria-describedby":u,"aria-invalid":p,required:x,disabled:f,name:b}){const h=l.useRef(null),k=(d,o="",g="Texti")=>{const v=h.current;if(!v)return;const y=v.selectionStart,j=v.selectionEnd,D=t.slice(y,j)||g,T=`${t.slice(0,y)}${d}${D}${o}${t.slice(j)}`;s(T),requestAnimationFrame(()=>{v.focus(),v.setSelectionRange(y+d.length,y+d.length+D.length)})};return e.jsxs("div",{className:B("overflow-hidden rounded-md border border-input bg-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",i),children:[e.jsxs("div",{className:"flex flex-wrap gap-1 border-b border-border bg-muted/55 p-2","aria-label":"Sniðmöguleikar",children:[e.jsxs(M,{type:"button",size:"sm",variant:"ghost",onClick:()=>k("## ","","Fyrirsögn"),title:"Fyrirsögn",children:[e.jsx(rs,{"aria-hidden":"true"})," Fyrirsögn"]}),e.jsxs(M,{type:"button",size:"sm",variant:"ghost",onClick:()=>k("**","**","feitletraður texti"),title:"Feitletra",children:[e.jsx(Qr,{"aria-hidden":"true"})," Feitletra"]}),e.jsxs(M,{type:"button",size:"sm",variant:"ghost",onClick:()=>k("- ","","Atriði"),title:"Listi",children:[e.jsx(Wr,{"aria-hidden":"true"})," Listi"]}),e.jsxs(M,{type:"button",size:"sm",variant:"ghost",onClick:()=>k("> ","","Tilvitnun"),title:"Tilvitnun",children:[e.jsx(os,{"aria-hidden":"true"})," Tilvitnun"]}),e.jsxs(M,{type:"button",size:"sm",variant:"ghost",onClick:()=>k("[","](https://)","tenglatexti"),title:"Tengill",children:[e.jsx(ss,{"aria-hidden":"true"})," Tengill"]})]}),e.jsx(se,{id:r,name:b,"aria-label":a,"aria-describedby":u,"aria-invalid":p,required:x,disabled:f,ref:h,rows:n,value:t,onChange:d=>s(d.target.value),className:"min-h-72 resize-y rounded-none border-0 font-mono text-base leading-7 focus-visible:ring-0"})]})}const ze=t=>JSON.stringify(t);function Ji(){const t=E.useUtils(),{data:s=[],isLoading:n}=E.pages.adminList.useQuery(),[r,a]=l.useState(null),[i,u]=l.useState(()=>ze(null)),[p,x]=l.useState(!0),f=ze(r)!==i,b=E.pages.upsert.useMutation({onSuccess:async()=>
156{await Promise.all([t.pages.adminList.invalidate(),t.pages.bySlug.invalidate()]),u(ze(r)),N.success("Efnisíða vistuð"),a(null)},onError:o=>N.error(o.message)}),h=o=>{const g={slug:o.slug,title:o.title,eyebrow:o.eyebrow??"",excerpt:o.excerpt??"",body:o.body,heroImage:gt(o.heroImageUrl,o.heroImageKey,o.heroImageAlt),status:o.status,seoTitle:o.seoTitle??"",seoDescription:o.seoDescription??""};a(g),u(ze(g)),x(!0)},k=()=>{f&&!window.confirm("Þú ert með óvistaðar breytingar. Loka án þess að vista?")||a(null)},d=()=>{if(r){if(!r.title.trim()||r.body.trim().length<10){N.error("Titill og efni þurfa að vera útfyllt");return}if(r.status==="published"&&r.heroImage&&!r.heroImage.altText.trim()){N.error("Íslenskan alt-texta vantar fyrir myndina áður en síðan er birt");return}b.mutate({slug:r.slug,title:r.title,eyebrow:r.eyebrow||null,excerpt:r.excerpt||null,body:r.body,heroImageUrl:r.heroImage?.url??null,heroImageKey:r.heroImage?.storageKey||null,heroImageAlt:r.heroImage?.altText||null,status:r.status,seoTitle:r.seoTitle||null,seoDescription:r.seoDescription||null})}};return e.jsxs(oe,{title:"Efnisíður",description:"Breyttu forsíðu, upplýsingum, hafa-samband-síðu og leigusíðu án þess að breyta kóða.",children:[n?e.jsx(ne,{}):s.length===0?e.jsx(ye,{title:"Engar efnisíður",description:"Efnisíður verða stofnaðar þegar grunnuppsetning er keyrð."}):e.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(o=>e.jsxs("article",{className:"rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3",children:[e.jsx("span",{className:"flex size-10 items-center justify-center rounded-2xl bg-primary/15 text-primary",children:e.jsx(ra,{className:"size-5","aria-hidden":"true"})}),e.jsx(ie,{tone:o.status==="published"?"success":"warning",children:o.status==="published"?"Birt":"Drög"})]}),e.jsx("h2",{className:"display-type mt-5 text-3xl uppercase",children:o.title}),e.jsx("p",{className:"mt-2 line-clamp-2 text-sm leading-6 text-muted-foreground",children:o.excerpt??o.body}),e.jsxs("div",{className:"mt-5 flex flex-wrap gap-2",children:[e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>h(o),children:[e.jsx(Se,{"aria-hidden":"true"})," Breyta"]}),o.status==="published"&&e.jsx(M,{asChild:!0,size:"sm",variant:"ghost",children:e.jsxs("a",{href:o.slug==="forsida"?"/":`/${o.slug}`,target:"_blank",rel:"noreferrer",children:["Opna ",e.jsx(Qt,{"aria-hidden":"true"})]})})]})]},o.slug))}),e.jsx(ue,{open:!!r,onOpenChange:o=>{o||k()},children:e.jsx(me,{className:Nt,children:r&&e.jsxs("div",{className:"flex max-h-[94svh] min-w-0 flex-col",children:[e.jsxs(pe,{className:"border-b border-border px-4 py-4 pr-12 sm:px-6 sm:py-5",children:[e.jsx(ge,{children:"Breyta efnisíðu"}),e.jsx(Ge,{children:"Breyttu efni í skýrum köflum og skoðaðu niðurstöðuna áður en þú birtir."})]}),e.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overflow-x-hidden",children:e.jsxs("div",{className:"grid min-w-0 lg:grid-cols-[minmax(0,1fr)_360px]",children:[e.jsxs("div",{className:"min-w-0 space-y-5 p-4 sm:p-6",children:[e.jsxs(X,{title:"Grunnupplýsingar",description:"Fyrirsögn, inngangur og meginmál síðunnar.",children:[e.jsx(I,{label:"Titill",htmlFor:"page-title",required:!0,className:"sm:col-span-2",children:e.jsx(P,{id:"page-title",className:H,value:r.title,onChange:o=>a(g=>g&&{...g,title:o.target.value})})}),e.jsx(I,{label:"Yfirtexti",htmlFor:"page-eyebrow",children:e.jsx(P,{id:"page-eyebrow",className:H,value:r.eyebrow,onChange:o=>a(g=>g&&{...g,eyebrow:o.target.value})})}),e.jsx(I,{label:"Inngangur",htmlFor:"page-excerpt",className:"sm:col-span-2",children:e.jsx(se,{id:"page-excerpt",className:_e,rows:4,value:r.excerpt,onChange:o=>a(g=>g&&{...g,excerpt:o.target.value})})}),e.jsx(I,{label:"Meginmál",htmlFor:"page-body",required:!0,className:"sm:col-span-2",hint:"Notaðu tóma línu á milli málsgreina. Ritillinn styður fyrirsagnir, feitletrun, lista, tilvitnanir og örugga ytri tengla.",children:e.jsx(Qi,{id:"page-body",value:r.body,onChange:o=>a(g=>g&&{...g,body:o})})})]}),e.jsx(X,{title:"Myndir",description:"Veldu úr miðlasafni eða hladdu upp fínstilltri responsive WebP-mynd.",className:"[&>div:last-child]:block",children:e.jsx(Ke,{label:"Aðalmynd síðu",description:"Alt-texti er skyldur áður en síðan er birt.",value:r.heroImage?[r.heroImage]:[],onChange:o=>a(g=>g&&{...g,heroImage:o[0]??null}),disabled:b.isPending})}),e.jsxs(X,{title:"SEO",description:"Leitarniðurstöður og deilingar á samfélagsmiðlum.",children:[e.jsx(I,{label:"SEO-titill",htmlFor:"page-seo-title",children:e.jsx(P,{id:"page-seo-title",className:H,value:r.seoTitle,onChange:o=>a(g=>g&&{...g,seoTitle:o.target.value})})}),e.jsx(I,{label:"SEO-lýsing",htmlFor:"page-seo-description",className:"sm:col-span-2",children:e.jsx(se,{id:"page-seo-description",className:_e,rows:4,value:r.seoDescription,onChange:o=>a(g=>g&&{...g,seoDescription:o.target.value})})})]}),e.jsx(X,{title:"Birting",description:"Vistaðu drög eða birtu þegar texti, mynd og alt-texti eru tilbúin.",children:e.jsx(I,{label:"Staða",htmlFor:"page-status",children:e.jsxs("select",{id:"page-status",className:Be,value:r.status,onChange:o=>a(g=>g&&{...g,status:o.target.value}),children:[e.jsx("option",{value:"draft",children:"Drög"}),e.jsx("option",{value:"published",children:"Birt"})]})})})]}),e.jsx(Ct,{open:p,onOpenChange:x,title:"Efnisíða",children:e.jsxs("div",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:[r.heroImage&&e.jsx("img",{src:r.heroImage.url,alt:r.heroImage.altText,className:"aspect-[16/9] w-full rounded-b-none object-cover"}),e.jsxs("div",{className:"p-6",children:[e.jsx("p",{className:"eyebrow brand-eyebrow",children:r.eyebrow}),e.jsx("h2",{className:"display-type mt-2 text-4xl uppercase",children:r.title}),r.excerpt&&e.jsx("p",{className:"mt-3 leading-7 text-muted-foreground",children:r.excerpt}),e.jsx(qr,{body:r.body,className:"mt-6 text-sm sm:text-base"})]})]})})]})}),e.jsx(St,{dirty:f,pending:b.isPending,primaryLabel:r.status==="published"?"Vista og birta":"Vista drög",onCancel:k,onSave:d})]})})})]})}function rt(){const t=new Date,s=new Date(Date.now()+7*864e5);return{title:"",message:"",type:"info",startDate:ce(t),endDate:ce(s),active:!0,linkLabel:"",linkUrl:""}}function Zi(){const t=E.useUtils(),{data:s=[],isLoading:n}=E.announcements.adminList.useQuery(),[r,a]=l.useState(rt),[i,u]=l.useState(!1),p=async()=>
156{await Promise.all([t.announcements.adminList.invalidate(),t.announcements.active.invalidate()])},x=E.announcements.create.useMutation({onSuccess:async()=>{await p(),N.success("Tilkynning stofnuð"),u(!1)},onError:d=>N.error(d.message)}),f=E.announcements.update.useMutation({onSuccess:async()=>{await p(),N.success("Tilkynning uppfærð"),u(!1)},onError:d=>N.error(d.message)}),b=E.announcements.delete.useMutation({onSuccess:async()=>{await p(),N.success("Tilkynningu eytt")},onError:d=>N.error(d.message)}),h=d=>{a({id:d.id,title:d.title,message:d.message,type:d.type,startDate:ce(d.startDateMs),endDate:ce(d.endDateMs),active:d.active,linkLabel:d.linkLabel??"",linkUrl:d.linkUrl??""}),u(!0)},k=()=>{const d=new Date(r.startDate).getTime(),o=new Date(r.endDate).getTime();if(!r.title.trim()||!r.message.trim()){N.error("Titill og skilaboð þurfa að vera útfyllt");return}const g={title:r.title,message:r.message,type:r.type,startDateMs:d,endDateMs:o,active:r.active,linkLabel:r.linkLabel||null,linkUrl:r.linkUrl||null};r.id?f.mutate({id:r.id,...g}):x.mutate(g)};return e.jsxs(oe,{title:"Tilkynningar",description:"Birta stutt skilaboð efst á öllum opinberum síðum, til dæmis vegna lokunar eða breytinga á opnun.",action:e.jsxs(M,{className:"rounded-full",onClick:()=>{a(rt()),u(!0)},children:[e.jsx(fe,{"aria-hidden":"true"})," Ný tilkynning"]}),children:[n?e.jsx(ne,{}):s.length===0?e.jsx(ye,{title:"Engar tilkynningar",description:"Birtu tilkynningu þegar þarf að koma áríðandi upplýsingum fljótt á framfæri.",action:e.jsx(M,{onClick:()=>{a(rt()),u(!0)},children:"Ný tilkynning"})}):e.jsx("div",{className:"space-y-3",children:s.map(d=>{const o=Date.now(),g=d.active&&d.startDateMs<=o&&d.endDateMs>=o;
156return e.jsxs("article",{className:"flex flex-col gap-4 rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm sm:flex-row sm:items-center",children:[e.jsx("span",{className:`flex size-11 shrink-0 items-center justify-center rounded-2xl ${d.type==="urgent"?"bg-red-500/15 text-red-700 dark:text-red-300":d.type==="warning"?"bg-amber-500/15 text-amber-700 dark:text-amber-300":"bg-blue-500/15 text-blue-700 dark:text-blue-300"}`,children:e.jsx(sa,{className:"size-5","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("h2",{className:"font-semibold",children:d.title}),e.jsx(ie,{tone:g?"success":d.active?"warning":"neutral",children:g?"Í birtingu":d.active?"Tímasett":"Óvirk"})]}),e.jsx("p",{className:"mt-1 text-sm leading-6 text-muted-foreground",children:d.message}),e.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[new Intl.DateTimeFormat("is-IS",{dateStyle:"medium",timeStyle:"short"}).format(new Date(d.startDateMs))," – ",new Intl.DateTimeFormat("is-IS",{dateStyle:"medium",timeStyle:"short"}).format(new Date(d.endDateMs))]})]}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>h(d),children:[e.jsx(Se,{"aria-hidden":"true"})," Breyta"]}),e.jsx(M,{size:"icon",variant:"ghost",className:"text-destructive",onClick:()=>window.confirm("Eyða tilkynningunni?")&&b.mutate({id:d.id}),"aria-label":"Eyða",children:e.jsx(ve,{"aria-hidden":"true"})})]})]},d.id)})}),e.jsx(ue,{open:i,onOpenChange:u,children:e.jsxs(me,{className:"max-w-xl",children:[e.jsx(pe,{children:e.jsx(ge,{children:r.id?"Breyta tilkynningu":"Ný tilkynning"})}),e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(I,{label:"Titill",className:"sm:col-span-2",children:e.jsx(P,{value:r.title,onChange:d=>a(o=>({...o,title:d.target.value}))})}),e.jsx(I,{label:"Skilaboð",className:"sm:col-span-2",children:e.jsx(se,{rows:4,value:r.message,onChange:d=>a(o=>({...o,message:d.target.value}))})}),e.jsx(I,{label:"Tegund",children:e.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:r.type,onCh
156ange:d=>a(o=>({...o,type:d.target.value})),children:[e.jsx("option",{value:"info",children:"Upplýsingar"}),e.jsx("option",{value:"warning",children:"Viðvörun"}),e.jsx("option",{value:"urgent",children:"Áríðandi"})]})}),e.jsxs("label",{className:"flex items-end gap-3 pb-2 text-sm font-medium",children:[e.jsx(ae,{checked:r.active,onCheckedChange:d=>a(o=>({...o,active:d===!0}))})," Virk tilkynning"]}),e.jsx(I,{label:"Hefst",children:e.jsx(P,{type:"datetime-local",value:r.startDate,onChange:d=>a(o=>({...o,startDate:d.target.value}))})}),e.jsx(I,{label:"Lýkur",children:e.jsx(P,{type:"datetime-local",value:r.endDate,onChange:d=>a(o=>({...o,endDate:d.target.value}))})}),e.jsx(I,{label:"Texti tengils — valfrjálst",children:e.jsx(P,{value:r.linkLabel,onChange:d=>a(o=>({...o,linkLabel:d.target.value}))})}),e.jsx(I,{label:"Slóð tengils — valfrjálst",children:e.jsx(P,{type:"url",value:r.linkUrl,onChange:d=>a(o=>({...o,linkUrl:d.target.value}))})})]}),e.jsxs("div",{className:"flex justify-end gap-3 border-t border-border pt-5",children:[r.id&&e.jsx(Qe,{label:"Eyða",disabled:b.isPending,onConfirm:()=>{b.mutate({id:r.id}),u(!1)}}),e.jsx(M,{variant:"outline",onClick:()=>u(!1),children:"Hætta við"}),e.jsx(M,{onClick:k,disabled:x.isPending||f.isPending,children:x.isPending||f.isPending?"Vista…":"Vista tilkynningu"})]})]})})]})}const $t={new:"Nýtt",in_review:"Í vinnslu",resolved:"Lokið",spam:"Ruslpóstur"},Kt={new:"Ný",in_review:"Í vinnslu",approved:"Samþykkt",declined:"Hafnað"},Ht={new:"Ný",in_review:"Í vinnslu",confirmed:"Staðfest",declined:"Hafnað"};function eo(){const t=E.useUtils(),[s,n]=l.useState("contact"),[r,a]=l.useState(null),[i,u]=l.useState(""),[p,x]=l.useState(""),[f,b]=l.useState(""),[h,k]=l.useState(""),d=E.contact.adminList.useQuery(),o=E.vendorApplications.adminList.useQuery(),g=E.admin.listInquiries.useQuery(),v=l.useMemo(()=>r?r.kind==="contact"?d.data?.find(C=>C.id===r.id)??null:r.kind==="application"?o.data?.find(C=>C.id===r.id)??null:g.data?.find(C=>C.id===r.id)??null:null,[o.data,d.data,g.data,r]),y=async()=>{await Promise.all([t.contact.adminList.invalidate(),t.vendorApplications.adminList.invalidate(),t.admin.listInquiries.invalidate(),t.dashboard.stats.invalidate()])},j=E.contact.update.useMutation({onSuccess:async()=>{await y(),N.success("Skilaboð uppfærð"),a(null)},onError:C=>N.error(C.message)}),D=E.vendorApplications.update.useMutation({onSuccess:async()=>{await y(),N.success("Umsókn uppfærð"),a(null)},onError:C=>N.error(C.message)}),T=E.admin.updateFull.useMutation({onSuccess:async()=>{await y(),N.success("Fyrirspurn uppfærð"),a(null)},onError:C=>N.error(C.message)}),V=E.admin.deleteInquiry.useMutation({onSuccess:async()=>{await y(),N.success("Fyrirspurn eytt"),a(null)},onError:C=>N.error(C.message)}),U=(C,O)=>{a({kind:C,id:O.id}),u(O.status),x(O.adminNotes??""),b(O.agreedPrice==null?"":String(O.agreedPrice)),k(O.workingPrice==null?"":String(O.workingPrice))},$=()=>{r&&(r.kind==="contact"?j.mutate({id:r.id,status:i,adminNotes:p||null}):r.kind==="application"?D.mutate({id:r.id,status:i,adminNotes:p||null}):T.mutate({id:r.id,status:i,adminNotes:p||void 0,agreedPrice:f?Number(f):null,workingPrice:h?Number(h):null}))},F=s==="contact"?d.data??[]:s==="application"?o.data??[]:g.data??[],q=s==="contact"?d.isLoading:s==="application"?o.isLoading:g.isLoading;return e.jsxs(oe,{title:"Innhólf",description:"Vinna úr öllum innsendum erindum, söluaðilaumsóknum og viðburðarýmispöntunum á einum stað.",children:[e.jsxs("div",{className:"flex flex-wrap gap-2 rounded-[var(--radius)] border border-border bg-card p-2 shadow-sm",children:[e.jsx(st,{active:s==="contact",onClick:()=>n("contact"),icon:dt,label:"Skilaboð",count:d.data?.filter(C=>C.status==="new").length??0}),e.jsx(st,{active:s==="application",onClick:()=>n("application"),icon:Ne,label:"Söluaðilaumsóknir",count:o.data?.filter(C=>C.status==="new").length??0}),e.jsx(st,{active:s==="inquiry",onClick:()=>n("inquiry"),icon:Te,label:"Viðburðarými",count:g.data?.filter(C=>C.status==="new").length??0})]}),q?e.jsx(ne,{}):F.length===0?e.jsx(ye,{title:"Innhólfið er tómt",description:"Ný erindi birtast hér sjálfkrafa."}):e.jsx("div",{className:"space-y-3",children:F.map(C=>{const O=s==="contact"?$t:s==="application"?Kt:Ht,m=C.status==="new"?"info":C.status==="in_review"?"warning":C.status==="spam"||C.status==="declined"?"danger":"success";return e.jsxs("button",{type:"button",onClick:()=>
156U(s,C),className:"flex w-full flex-col gap-4 rounded-[var(--radius)] border border-border bg-card p-5 text-left shadow-sm hover:border-primary/50 sm:flex-row sm:items-center",children:[e.jsx("span",{className:"flex size-11 shrink-0 items-center justify-center rounded-2xl bg-primary/15 text-primary",children:s==="contact"?e.jsx(is,{"aria-hidden":"true"}):s==="application"?e.jsx(Ne,{"aria-hidden":"true"}):e.jsx(Te,{"aria-hidden":"true"})}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"font-semibold",children:C.name}),"company"in C&&C.company&&e.jsxs("span",{className:"ml-2 text-sm text-muted-foreground",children:["— ",C.company]}),e.jsx("span",{className:"mt-1 block truncate text-sm text-muted-foreground",children:"subject"in C?C.subject:"productCategories"in C?C.productCategories:C.eventType}),e.jsx("span",{className:"mt-2 block text-xs text-muted-foreground",children:new Intl.DateTimeFormat("is-IS",{dateStyle:"medium",timeStyle:"short"}).format(new Date(C.createdAt))})]}),e.jsx(ie,{tone:m,children:O[C.status]??C.status})]},C.id)})}),e.jsx(ue,{open:!!r,onOpenChange:C=>!C&&a(null),children:e.jsxs(me,{className:"max-h-[92vh] max-w-2xl overflow-y-auto",children:[e.jsx(pe,{children:e.jsx(ge,{children:r?.kind==="contact"?"Tengiliðaskilaboð":r?.kind==="application"?"Söluaðilaumsókn":"Viðburðafyrirspurn"})}),r&&v&&e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{className:"grid gap-3 rounded-[var(--radius)] border border-border bg-muted/45 p-4 sm:grid-cols-2",children:[e.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[e.jsx(da,{className:"size-4 text-primary","aria-hidden":"true"})," ",e.jsx("strong",{children:v.name})]}),e.jsxs("a",{href:`mailto:${v.email}`,className:"flex items-center gap-2 text-sm hover:text-primary",children:[e.jsx(dt,{className:"size-4 text-primary","aria-hidden":"true"})," ",v.email]}),"phone"in v&&v.phone&&e.jsxs("a",{href:`tel:${v.phone.replace(/\s/g,"")}`,className:"flex items-center gap-2 text-sm hover:text-primary",children:[e.jsx(Br,{className:"size-4 text-primary","aria-hidden":"true"})," ",v.phone]}),"company"in v&&v.company&&e.jsxs("p",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Jr,{className:"size-4 text-primary","aria-hidden":"true"})," ",v.company]}),"nationalId"in v&&v.nationalId&&e.jsxs("p",{className:"text-sm",children:[e.jsx("span",{className:"font-semibold",children:"Kennitala:"})," ",v.nationalId]})]}),e.jsxs("div",{className:"rounded-[var(--radius)] border border-border p-5",children:[r.kind==="contact"&&"subject"in v&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-semibold",children:v.subject}),e.jsx("p",{className:"mt-3 whitespace-pre-wrap text-sm leading-7 text-muted-foreground",children:v.message})]}),r.kind==="application"&&"productCategories"in v&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-semibold",children:v.productCategories}),v.category&&e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Flokkur: ",v.category]}),v.rentalType&&e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Leigutegund: ",v.rentalType]}),v.preferredDateMs&&e.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[v.preferredEndDateMs?"Óskatímabil":"Óskadagur",": ",new Intl.DateTimeFormat("is-IS",{dateStyle:"long"}).format(new Date(v.preferredDateMs)),v.preferredEndDateMs&&e.jsxs(e.Fragment,{children:[" – ",new Intl.DateTimeFormat("is-IS",{dateStyle:"long"}).format(new Date(v.preferredEndDateMs))]})]}),v.description&&e.jsx("p",{className:"mt-4 whitespace-pre-wrap text-sm leading-7 text-muted-foreground",children:v.description}),v.productImageUrl&&e.jsxs("a",{href:v.productImageUrl,target:"_blank",rel:"noopener noreferrer",className:"mt-5 block w-fit rounded-[var(--radius)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx("img",{src:v.productImageUrl,alt:"Vörumynd með sölubásaumsókn",className:"max-h-72 max-w-full rounded-[var(--radius)] border border-border object-contain"}),e.jsx("span",{className:"mt-2 block text-sm font-semibold text-primary",children:"Opna vörumynd"})]})]}),r.kind==="inquiry"&&"eventType"in v&&e.jsxs(e.Fragment,{children:[e.jsx("h3",{className:"font-semibold",children:v.eventType}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:[v.eventDate," kl. ",v.eventTime," · ",v.guestCount," gestir"]}),v.message&&e.jsx("p",{className:"mt-4 whitespace-pre-wrap text-sm leading-7 text-muted-foreground",children:v.message})]})]}),e.jsx(I,{label:"Staða",children:e.jsx("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:i,onChange:C=>u(C.target.value),children:Object.entries(r.kind==="contact"?$t:r.kind==="application"?Kt:Ht).map(([C,O])=>e.jsx("option",{value:C,children:O},C))})}),r.kind==="inquiry"&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(I,{label:"Verð í vinnslu",children:e.jsx(P,{type:"number",value:h,onChange:C=>k(C.target.value)})}),e.jsx(I,{label:"Samþykkt verð",children:e.jsx(P,{type:"number",value:f,onChange:C=>b(C.target.value)})})]}),e.jsx(I,{label:"Innri athugasemdir",children:e.jsx(se,{rows:4,value:p,onChange:C=>x(C.target.value)})}),e.jsxs("div",{className:"flex flex-wrap justify-end gap-3 border-t border-border pt-5",children:[r.kind==="inquiry"&&e.jsx(M,{variant:"destructive",onClick:()=>window.confirm("Eyða fyrirspurninni varanlega?")&&V.mutate({id:r.id}),children:"Eyða"}),e.jsx(M,{variant:"outline",onClick:()=>a(null),children:"Loka"}),e.jsx(M,{onClick:$,disabled:j.isPending||D.isPending||T.isPending,children:"Vista breytingar"})]})]})]})})]})}function st({active:t,onClick:s,icon:n,label:r,count:a}){return e.jsxs("button",{type:"button",onClick:s,className:`flex items-center gap-2 rounded-full px-4 py-2 text-sm font-semibold ${t?"bg-primary text-primary-foreground":"hover:bg-muted"}`,children:[e.jsx(n,{className:"size-4","aria-hidden":"true"})," ",r,a>0&&e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs ${t?"bg-primary-foreground
156/20":"bg-primary/15 text-primary"}`,children:a})]})}function to(){const t=E.useUtils(),{data:s=[],isLoading:n}=E.media.list.useQuery(),[r,a]=l.useState(null),[i,u]=l.useState(""),[p,x]=l.useState(!1),[f,b]=l.useState({}),h=l.useMemo(()=>r?URL.createObjectURL(r):null,[r]);l.useEffect(()=>()=>{h&&URL.revokeObjectURL(h)},[h]);const k=()=>t.media.list.invalidate(),d=E.media.upload.useMutation({onSuccess:async()=>{await k(),a(null),u(""),N.success("Mynd hlaðin upp")},onError:j=>N.error(j.message||"Ekki tókst að hlaða myndinni upp")}),o=E.media.updateAlt.useMutation({onSuccess:async()=>{await k(),N.success("Alt-texti uppfærður")},onError:j=>N.error(j.message)}),g=E.media.deleteMetadata.useMutation({onSuccess:async()=>{await k(),N.success("Mynd fjarlægð úr safni")},onError:j=>N.error(j.message)}),v=j=>{if(!j)return;const D=Zt(j);if(D){N.error(D);return}a(j)},y=async()=>{if(!r)return;if(i.trim().length<3){N.error("Skrifaðu íslenskan alt-texta fyrir myndina");return}const{base64:j,width:D,height:T}=await ea(r);d.mutate({filename:r.name,mimeType:r.type,base64:j,altText:i.trim(),width:D,height:T})};return e.jsx(oe,{title:"Miðlasafn",description:"Hlaða upp og halda utan um myndir í varanlegri S3-geymslu. Myndir eru sjálfkrafa snúnar rétt, minnkaðar og vistaðar sem fínstillt WebP. Allar myndir þurfa lýsandi íslenskan alt-texta.",children:e.jsxs("div",{className:"grid gap-5 lg:grid-cols-[0.8fr_1.2fr]",children:[e.jsxs("div",{className:"h-fit rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm",children:[e.jsx("h2",{className:"font-semibold",children:"Hlaða upp mynd"}),e.jsxs("div",{onDragEnter:j=>{j.preventDefault(),x(!0)},onDragOver:j=>j.preventDefault(),onDragLeave:j=>{j.preventDefault(),x(!1)},onDrop:j=>{j.preventDefault(),x(!1),v(j.dataTransfer.files[0])},className:`mt-4 rounded-[var(--radius)] border-2 border-dashed p-6 text-center transition-colors ${p?"border-primary bg-primary/10":"border-border bg-muted/45"}`,children:[h?e.jsx("img",{src:h,alt:"Forskoðun valinnar myndar",className:"mx-auto max-h-56 rounded-2xl object-contain"}):e.jsx(na,{className:"mx-auto size-10 text-primary","aria-hidden":"true"}),e.jsx("p",{className:"mt-4 text-sm font-semibold",children:"Dragðu mynd hingað eða veldu skrá"}),e.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"WebP, JPEG eða PNG · hámark 7 MB"}),e.jsxs("label",{className:"mt-4 inline-flex cursor-pointer items-center gap-2 rounded-full border border-border bg-background px-4 py-2 text-sm font-semibold hover:border-primary hover:text-primary",children:[e.jsx(Jt,{className:"size-4","aria-hidden":"true"})," Velja mynd",e.jsx("input",{type:"file",accept:"image/webp,image/jpeg,image/png",className:"sr-only",onChange:j=>v(j.target.files?.[0])})]})]}),r&&e.jsxs("div",{className:"mt-4 space-y-4",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:[r.name," · ",(r.size/1e6).toFixed(2)," MB"]}),e.jsx(I,{label:"Íslenskur alt-texti",hint:"Lýstu því sem skiptir máli á myndinni fyrir skjálesara.",children:e.jsx(P,{value:i,onChange:j=>u(j.target.value),placeholder:"Til dæmis söluaðili við bás sinn í Kolaportinu"})}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(M,{onClick:y,disabled:d.isPending,children:d.isPending?"Hleð upp…":"Hlaða upp"}),e.jsx(M,{variant:"ghost",onClick:()=>{a(null),u("")},children:"Hætta við"})]})]})]}),e.jsx("div",{children:n?e.jsx(ne,{}):s.length===0?e.jsx(ye,{title:"Miðlasafnið er tómt",description:"Fyrsta myndin sem þú hleður upp birtist hér."}):e.jsx("div",{className:"grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:s.map(j=>{const D=f[j.id]??j.altText;return e.jsxs("article",{className:"overflow-hidden rounded-[var(--radius)] border border-border bg-card shadow-sm",children:[e.jsx("img",{src:j.url,alt:j.altText,loading:"lazy",className:"aspect-[4/3] w-full object-cover"}),e.jsxs("div",{className:"space-y-3 p-4",children:[e.jsx("p",{className:"truncate text-xs font-semibold",title:j.filename,children:j.filename}),e.jsx(P,{value:D,onChange:T=>b(V=>({...V,[j.id]:T.target.value}
156)),"aria-label":`Alt-texti fyrir ${j.filename}`}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsxs(M,{size:"sm",variant:"outline",onClick:()=>o.mutate({id:j.id,altText:D}),disabled:o.isPending,children:[e.jsx(xt,{"aria-hidden":"true"})," Vista"]}),e.jsxs(M,{size:"sm",variant:"ghost",onClick:async()=>{await navigator.clipboard.writeText(j.url),N.success("Slóð afrituð")},children:[e.jsx(es,{"aria-hidden":"true"})," Slóð"]}),e.jsx(M,{size:"icon",variant:"ghost",className:"ml-auto text-destructive",onClick:()=>window.confirm("Fjarlægja myndina úr miðlasafninu? Skráin sjálf er ekki eydd úr geymslu.")&&g.mutate({id:j.id}),"aria-label":"Fjarlægja úr safni",children:e.jsx(ve,{"aria-hidden":"true"})})]})]})]},j.id)})})})]})})}const ao=[["siteTitle","Heiti vefs"],["siteDescription","Lýsing vefs"],["address","Heimilisfang"],["cityLine","Póstnúmer og borg"],["email","Netfang"],["phone","Símanúmer"],["instagramUrl","Instagram-slóð"],["facebookUrl","Facebook-slóð"],["openingSummary","Stutt opnunaryfirlit"]],nt=(t="vendor")=>({scope:t,name:"",slug:"",sortOrder:"0",active:!0});function ro(){const t=E.useUtils(),s=E.site.adminSettings.useQuery(),n=E.categories.adminList.useQuery({scope:"event"}),r=E.categories.adminList.useQuery({scope:"vendor"}),[a,i]=l.useState({}),[u,p]=l.useState(null);l.useEffect(()=>{s.data&&i(s.data)},[s.data]);const x=E.site.updateSettings.useMutation({onSuccess:async()=>{await Promise.all([t.site.adminSettings.invalidate(),t.site.publicSettings.invalidate()]),N.success("Vefstillingar vistaðar")},onError:o=>N.error(o.message)}),f=E.categories.create.useMutation({onSuccess:async()=>{await k(),N.success("Flokkur stofnaður"),p(null)},onError:o=>N.error(o.message)}),b=E.categories.update.useMutation({onSuccess:async()=>{await k(),N.success("Flokkur uppfærður"),p(null)},onError:o=>N.error(o.message)}),h=E.categories.delete.useMutation({onSuccess:async()=>{await k(),N.success("Flokki eytt")},onError:o=>N.error(o.message)}),k=async()=>{await Promise.all([t.categories.adminList.invalidate(),t.categories.list.invalidate(),t.events.adminList.invalidate(),t.vendors.adminList.invalidate()])},d=()=>{if(!u||!u.name.trim()||!u.slug.trim()){N.error("Nafn og slóð flokks þurfa að vera útfyllt");return}const o={scope:u.scope,name:u.name,slug:u.slug,sortOrder:Number(u.sortOrder)||0,active:u.active};u.id?b.mutate({id:u.id,...o}):f.mutate(o)};return e.jsxs(oe,{title:"Stillingar",description:"Grunnupplýsingar sem birtast í haus, fæti og lýsigögnum ásamt flokkum fyrir viðburði og söluaðila.",children:[e.jsxs("div",{className:"grid gap-6 xl:grid-cols-[0.9fr_1.1fr]",children:[e.jsxs("section",{className:"rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm sm:p-6",children:[e.jsxs("h2",{className:"display-type flex items-center gap-2 text-2xl uppercase",children:[e.jsx(ls,{className:"size-5 text-primary","aria-hidden":"true"})," Vefstillingar"]}),s.isLoading?e.jsx("div",{className:"mt-5",children:e.jsx(ne,{rows:4})}):e.jsx("div",{className:"mt-5 grid gap-4 sm:grid-cols-2",children:ao.map(([o,g])=>e.jsx(I,{label:g,className:o==="siteDescription"||o==="openingSummary"?"sm:col-span-2":void 0,children:o==="siteDescription"||o==="openingSummary"?e.jsx(se,{rows:3,value:a[o]??"",onChange:v=>i(y=>({...y,[o]:v.target.value}))}):e.jsx(P,{value:a[o]??"",onChange:v=>i(y=>({...y,[o]:v.target.value}))})},o))}),e.jsx(M,{className:"mt-5",onClick:()=>x.mutate({values:a}),disabled:x.isPending,children:x.isPending?"Vista…":"Vista vefstillingar"})]}),e.jsxs("section",{className:"rounded-[var(--radius)] border border-border bg-card p-5 shadow-sm sm:p-6",children:[e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsxs("h2",{className:"display-type flex items-center gap-2 text-2xl uppercase",children:[e.jsx(us,{className:"size-5 text-primary","aria-hidden":"true"})," Flokkar"]}),e.jsxs(M,{size:"sm",onClick:()=>p(nt()),children:[e.jsx(fe,{"aria-hidden":"true"})," Nýr flokkur"]})]}),e.jsxs("div",{className:"mt-5 grid gap-5 md:grid-cols-2",children:[e.jsx(Gt,{title:"Viðburðaflokkar",items:n.data??[],loading:n.isLoading,onAdd:()=>p(nt("event")),onEdit:o=>p({id:o.id,scope:o.scope,name:o.name,slug:o.slug,sortOrder:String(o.sortOrder),active:o.active}),onDelete:o=>window.confirm("Eyða flokknum? Tengingum við efni verður einnig eytt.")&&h.mutate({id:o})}),e.jsx(Gt,{title:"Söluaðilaflokkar",items:r.data??[],loading:r.isLoading,onAdd:()=>p(nt("vendor")),onEdit:o=>p({id:o.id,scope:o.scope,name:o.name,slug:o.slug,sortOrder:String(o.sortOrder),active:o.active}),onDelete:o=>window.confirm("Eyða flokknum? Tengingum við efni verður einnig eytt.")&&h.mutate({id:o})})]})]})]}),e.jsx(ue,{open:!!u,onOpenChange:o=>!o&&p(null),children:e.jsxs(me,{className:"max-w-lg",children:[e.jsx(pe,{children:e.jsx(ge,{children:u?.id?"Breyta flokki":"Nýr flokkur"})}),u&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsx(I,{label:"Heiti",className:"sm:col-span-2",children:e.jsx(P,{value:u.name,onChange:o=>p(g=>g&&{...g,name:o.target.value,slug:g.id?g.slug:Ce(o.target.value)})})}),e.jsx(I,{label:"Slóð",children:e.jsx(P,{value:u.slug,onChange:o=>p(g=>g&&{...g,slug:Ce(o.target.value)})})}),e.jsx(I,{label:"Tegund",children:e.jsxs("select",{className:"h-9 w-full rounded-md border border-input bg-background px-3 text-sm",value:u.scope,onCh
156ange:o=>p(g=>g&&{...g,scope:o.target.value}),children:[e.jsx("option",{value:"event",children:"Viðburður"}),e.jsx("option",{value:"vendor",children:"Söluaðili"})]})}),e.jsx(I,{label:"Röðun",children:e.jsx(P,{type:"number",min:"0",value:u.sortOrder,onChange:o=>p(g=>g&&{...g,sortOrder:o.target.value})})}),e.jsxs("label",{className:"flex items-end gap-3 pb-2 text-sm font-medium",children:[e.jsx(ae,{checked:u.active,onCheckedChange:o=>p(g=>g&&{...g,active:o===!0})})," Virkur flokkur"]}),e.jsxs("div",{className:"flex justify-end gap-3 border-t border-border pt-5 sm:col-span-2",children:[e.jsx(M,{variant:"outline",onClick:()=>p(null),children:"Hætta við"}),e.jsx(M,{onClick:d,disabled:f.isPending||b.isPending,children:"Vista flokk"})]})]})]})})]})}function Gt({title:t,items:s,loading:n,onAdd:r,onEdit:a,onDelete:i}){return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("h3",{className:"font-semibold",children:t}),e.jsx(M,{size:"icon",variant:"ghost",onClick:r,"aria-label":"Bæta við flokki",children:e.jsx(fe,{"aria-hidden":"true"})})]}),n?e.jsx("div",{className:"mt-3",children:e.jsx(ne,{rows:2})}):e.jsx("div",{className:"mt-3 divide-y divide-border rounded-md border border-border",children:s.map(u=>e.jsxs("div",{className:"p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"font-medium leading-tight",children:u.name}),e.jsxs("p",{className:"mt-1 break-all text-xs text-muted-foreground",children:["/",u.slug]})]}),e.jsxs("div",{className:"mt-2 flex items-center gap-1",children:[e.jsx(ie,{tone:u.active?"success":"neutral",children:u.active?"Virkur":"Óvirkur"}),e.jsx("span",{className:"flex-1"}),e.jsx(M,{size:"icon",variant:"ghost",onClick:()=>a(u),"aria-label":"Breyta",children:e.jsx(Se,{"aria-hidden":"true"})}),e.jsx(M,{size:"icon",variant:"ghost",className:"text-destructive",onClick:()=>i(u.id),"aria-label":"Eyða",children:e.jsx(ve,{"aria-hidden":"true"})})]})]},u.id))})]})}const so=[{icon:oa,label:"Yfirlit",path:"/admin"},{icon:Te,label:"Viðburðir",path:"/admin/vidburdir"},{icon:Ne,label:"Söluaðilar",path:"/admin/soluadilar"},{icon:aa,label:"Dagskrá",path:"/admin/dagskra"},{icon:ra,label:"Efnisíður",path:"/admin/sidur"},{icon:sa,label:"Tilkynningar",path:"/admin/tilkynningar"},{icon:ia,label:"Innhólf",path:"/admin/innholf"},{icon:ct,label:"Miðlasafn",path:"/admin/midlar"},{icon:ds,label:"Stillingar",path:"/admin/stillingar"},{icon:ms,label:"Til baka á vef",path:"/",external:!0}];function bo(){const[t]=Xt(),s=t.replace(/^\/admin\/?/,"").split("/")[0]||"yfirlit";return e.jsxs(Ii,{menuItems:so,title:"Kolaportið",requireAdmin:!0,children:[s==="yfirlit"&&e.jsx(Di,{}),s==="vidburdir"&&e.jsx(Wi,{}),s==="soluadilar"&&e.jsx(Yi,{}),s==="dagskra"&&e.jsx(Xi,{}),s==="sidur"&&e.jsx(Ji,{}),s==="tilkynningar"&&e.jsx(Zi,{}),s==="innholf"&&e.jsx(eo,{}),s==="midlar"&&e.jsx(to,{}),s==="stillingar"&&e.jsx(ro,{})]})}export{bo as default};

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.