@moontra/moonui-pro 2.12.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import { twMerge } from 'tailwind-merge';
3
3
  import * as t from 'react';
4
4
  import t__default, { useState, useRef, useCallback, forwardRef, createContext, useEffect, useMemo, useContext, useLayoutEffect, useDebugValue, Component } from 'react';
5
5
  import * as AccordionPrimitive from '@radix-ui/react-accordion';
6
- import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, Upload, Play, Eye, CheckCircle2, Pause, RotateCcw, Download, Copy, Share, Trash2, CreditCard, Globe, XCircle, Clock, HelpCircle, ChevronLeft, Calendar as Calendar$1, Edit, MapPin, User, Filter, Move, Archive, EyeOff, Settings, Timer, Palette, ArrowUpDown, FileText, Star, Square, CheckSquare, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Highlighter, Link2, Image as Image$1, Table as Table$1, Undo, Redo, RefreshCw, Wand2, Maximize, Briefcase, MessageSquare, Heart, GraduationCap, Zap, Languages, Lightbulb, TrendingUp, TrendingDown, ZoomOut, ZoomIn, FileSpreadsheet, FileJson, Maximize2, Menu, Bell, CheckCheck, CheckCircle, Settings2, LogOut, Edit3, LayoutGrid, Share2, Save, Video, Music, File, FileDown, ArrowUp, ArrowDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, MoreVertical, MessageCircle, Paperclip, ExternalLink, CalendarIcon, DollarSign, Users, Github, GitFork, Activity, Server, RotateCw, Cpu, MemoryStick, HardDrive, Network, BarChart3, Columns, Grip, Unlock, Minimize2, Map as Map$1, Target, BellOff, ArrowDownRight, ArrowUpRight } from 'lucide-react';
6
+ import { ChevronDown, Info, AlertCircle, AlertTriangle, Check, X, MoreHorizontal, Loader2, Minus, Search, ChevronRight, Circle, ChevronUp, Lock, Sparkles, Plus, Upload, Play, Eye, CheckCircle2, Pause, RotateCcw, Download, Copy, Share, Trash2, CreditCard, Globe, XCircle, Clock, HelpCircle, ChevronLeft, Calendar as Calendar$1, Edit, MapPin, User, Filter, Move, Archive, EyeOff, Settings, Timer, Palette, ArrowUpDown, FileText, Star, Square, CheckSquare, Bold as Bold$1, Italic as Italic$1, Underline as Underline$1, Strikethrough, Code as Code$1, Type, Heading1, Heading2, Heading3, AlignLeft, AlignCenter, AlignRight, AlignJustify, List, ListOrdered, Quote, Highlighter, Link2, Image as Image$1, Table as Table$1, Undo, Redo, RefreshCw, Wand2, Maximize, Briefcase, MessageSquare, Heart, GraduationCap, Zap, Languages, Lightbulb, TrendingUp, TrendingDown, ZoomOut, ZoomIn, FileSpreadsheet, FileJson, Maximize2, Menu, Bell, CheckCheck, CheckCircle, Settings2, LogOut, Edit3, LayoutGrid, Share2, Save, Video, Music, File, FileDown, ArrowUp, ArrowDown, ChevronsLeft, ChevronsRight, Pin, Sun, Moon, Monitor, Activity, Send, MessageCircle, Tag, MoreVertical, Paperclip, ExternalLink, CalendarIcon, DollarSign, Users, Github, GitFork, Server, RotateCw, Cpu, MemoryStick, HardDrive, Network, BarChart3, Columns, Flag, Grip, Unlock, Minimize2, Map as Map$1, Target, BellOff, ArrowDownRight, ArrowUpRight } from 'lucide-react';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
8
  import { cva } from 'class-variance-authority';
9
9
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
@@ -4054,7 +4054,7 @@ var me = t.forwardRef((r2, o) => {
4054
4054
  var e;
4055
4055
  return Array.from(((e = I.current) == null ? void 0 : e.querySelectorAll(ce)) || []);
4056
4056
  }
4057
- function X21(e) {
4057
+ function X22(e) {
4058
4058
  let s = V()[e];
4059
4059
  s && E.setState("value", s.getAttribute(T));
4060
4060
  }
@@ -4069,10 +4069,10 @@ var me = t.forwardRef((r2, o) => {
4069
4069
  s = e > 0 ? we(s, N) : De(s, N), i = s == null ? void 0 : s.querySelector(ce);
4070
4070
  i ? E.setState("value", i.getAttribute(T)) : Q(e);
4071
4071
  }
4072
- let oe = () => X21(V().length - 1), ie3 = (e) => {
4072
+ let oe = () => X22(V().length - 1), ie3 = (e) => {
4073
4073
  e.preventDefault(), e.metaKey ? oe() : e.altKey ? re(1) : Q(1);
4074
4074
  }, se = (e) => {
4075
- e.preventDefault(), e.metaKey ? X21(0) : e.altKey ? re(-1) : Q(-1);
4075
+ e.preventDefault(), e.metaKey ? X22(0) : e.altKey ? re(-1) : Q(-1);
4076
4076
  };
4077
4077
  return t.createElement(Primitive2.div, { ref: o, tabIndex: -1, ...O, "cmdk-root": "", onKeyDown: (e) => {
4078
4078
  var s;
@@ -4099,7 +4099,7 @@ var me = t.forwardRef((r2, o) => {
4099
4099
  break;
4100
4100
  }
4101
4101
  case "Home": {
4102
- e.preventDefault(), X21(0);
4102
+ e.preventDefault(), X22(0);
4103
4103
  break;
4104
4104
  }
4105
4105
  case "End": {
@@ -11121,6 +11121,1002 @@ function Calendar3({
11121
11121
  )
11122
11122
  ] });
11123
11123
  }
11124
+ var PRIORITY_OPTIONS = [
11125
+ { value: "low", label: "Low", icon: Flag, color: "text-green-600" },
11126
+ { value: "medium", label: "Medium", icon: Flag, color: "text-yellow-600" },
11127
+ { value: "high", label: "High", icon: Flag, color: "text-orange-600" },
11128
+ { value: "urgent", label: "Urgent", icon: AlertCircle, color: "text-red-600" }
11129
+ ];
11130
+ var formatFileSize = (bytes) => {
11131
+ if (bytes === 0)
11132
+ return "0 Bytes";
11133
+ const k3 = 1024;
11134
+ const sizes = ["Bytes", "KB", "MB", "GB"];
11135
+ const i = Math.floor(Math.log(bytes) / Math.log(k3));
11136
+ return parseFloat((bytes / Math.pow(k3, i)).toFixed(2)) + " " + sizes[i];
11137
+ };
11138
+ var getInitials = (name) => {
11139
+ return name.split(" ").map((n) => n[0]).join("").toUpperCase();
11140
+ };
11141
+ function CardDetailModal({
11142
+ card: initialCard,
11143
+ isOpen,
11144
+ onClose,
11145
+ onUpdate,
11146
+ onDelete,
11147
+ availableAssignees = [],
11148
+ availableLabels = [],
11149
+ currentColumn,
11150
+ availableColumns = []
11151
+ }) {
11152
+ const [card, setCard] = useState(initialCard);
11153
+ const [isEditingTitle, setIsEditingTitle] = useState(false);
11154
+ const [isEditingDescription, setIsEditingDescription] = useState(false);
11155
+ const [newComment, setNewComment] = useState("");
11156
+ const [newChecklistItem, setNewChecklistItem] = useState("");
11157
+ const [selectedTab, setSelectedTab] = useState("overview");
11158
+ useEffect(() => {
11159
+ setCard(initialCard);
11160
+ }, [initialCard]);
11161
+ const updateCard = (updates) => {
11162
+ const updatedCard = { ...card, ...updates };
11163
+ setCard(updatedCard);
11164
+ onUpdate(updatedCard);
11165
+ };
11166
+ const addComment = () => {
11167
+ if (!newComment.trim())
11168
+ return;
11169
+ const newActivity = {
11170
+ id: Date.now().toString(),
11171
+ user: {
11172
+ id: "current-user",
11173
+ name: "Current User",
11174
+ email: "user@example.com"
11175
+ },
11176
+ action: "commented",
11177
+ timestamp: /* @__PURE__ */ new Date(),
11178
+ details: newComment
11179
+ };
11180
+ updateCard({
11181
+ activities: [newActivity, ...card.activities || []],
11182
+ comments: (card.comments || 0) + 1
11183
+ });
11184
+ setNewComment("");
11185
+ };
11186
+ const addChecklistItem = () => {
11187
+ if (!newChecklistItem.trim())
11188
+ return;
11189
+ const checklist = card.checklist || {
11190
+ id: Date.now().toString(),
11191
+ title: "Checklist",
11192
+ items: []
11193
+ };
11194
+ checklist.items.push({
11195
+ id: Date.now().toString(),
11196
+ text: newChecklistItem,
11197
+ completed: false
11198
+ });
11199
+ updateCard({ checklist });
11200
+ setNewChecklistItem("");
11201
+ };
11202
+ const toggleChecklistItem = (itemId) => {
11203
+ if (!card.checklist)
11204
+ return;
11205
+ const updatedChecklist = {
11206
+ ...card.checklist,
11207
+ items: card.checklist.items.map(
11208
+ (item) => item.id === itemId ? { ...item, completed: !item.completed } : item
11209
+ )
11210
+ };
11211
+ updateCard({ checklist: updatedChecklist });
11212
+ };
11213
+ const deleteChecklistItem = (itemId) => {
11214
+ if (!card.checklist)
11215
+ return;
11216
+ const updatedChecklist = {
11217
+ ...card.checklist,
11218
+ items: card.checklist.items.filter((item) => item.id !== itemId)
11219
+ };
11220
+ updateCard({ checklist: updatedChecklist });
11221
+ };
11222
+ const completedChecklistItems = card.checklist?.items.filter((item) => item.completed).length || 0;
11223
+ const totalChecklistItems = card.checklist?.items.length || 0;
11224
+ const checklistProgress = totalChecklistItems > 0 ? completedChecklistItems / totalChecklistItems * 100 : 0;
11225
+ const handleFileUpload = (e) => {
11226
+ const files = e.target.files;
11227
+ if (!files)
11228
+ return;
11229
+ const newAttachments = Array.from(files).map((file) => ({
11230
+ id: Date.now().toString() + Math.random(),
11231
+ name: file.name,
11232
+ type: file.type,
11233
+ url: URL.createObjectURL(file),
11234
+ size: file.size
11235
+ }));
11236
+ updateCard({
11237
+ attachments: [...card.attachments || [], ...newAttachments]
11238
+ });
11239
+ };
11240
+ const removeAttachment = (attachmentId) => {
11241
+ updateCard({
11242
+ attachments: card.attachments?.filter((a) => a.id !== attachmentId)
11243
+ });
11244
+ };
11245
+ return /* @__PURE__ */ jsx(MoonUIDialogPro, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(MoonUIDialogContentPro, { className: "max-w-4xl max-h-[90vh] overflow-hidden p-0", children: [
11246
+ /* @__PURE__ */ jsx("div", { className: "p-6 pb-0", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
11247
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
11248
+ isEditingTitle ? /* @__PURE__ */ jsx(
11249
+ MoonUIInputPro,
11250
+ {
11251
+ value: card.title,
11252
+ onChange: (e) => updateCard({ title: e.target.value }),
11253
+ onBlur: () => setIsEditingTitle(false),
11254
+ onKeyDown: (e) => {
11255
+ if (e.key === "Enter")
11256
+ setIsEditingTitle(false);
11257
+ if (e.key === "Escape") {
11258
+ setCard(initialCard);
11259
+ setIsEditingTitle(false);
11260
+ }
11261
+ },
11262
+ className: "text-xl font-semibold",
11263
+ autoFocus: true
11264
+ }
11265
+ ) : /* @__PURE__ */ jsx(
11266
+ "h2",
11267
+ {
11268
+ className: "text-xl font-semibold cursor-pointer hover:bg-muted rounded px-2 -mx-2 py-1",
11269
+ onClick: () => setIsEditingTitle(true),
11270
+ children: card.title
11271
+ }
11272
+ ),
11273
+ currentColumn && /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground mt-1", children: [
11274
+ "in ",
11275
+ currentColumn
11276
+ ] })
11277
+ ] }),
11278
+ /* @__PURE__ */ jsx(
11279
+ MoonUIButtonPro,
11280
+ {
11281
+ variant: "ghost",
11282
+ size: "icon",
11283
+ onClick: onClose,
11284
+ className: "h-8 w-8",
11285
+ children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
11286
+ }
11287
+ )
11288
+ ] }) }),
11289
+ /* @__PURE__ */ jsxs(MoonUITabsPro, { value: selectedTab, onValueChange: setSelectedTab, className: "flex-1", children: [
11290
+ /* @__PURE__ */ jsx("div", { className: "px-6 pt-4", children: /* @__PURE__ */ jsxs(MoonUITabsListPro, { children: [
11291
+ /* @__PURE__ */ jsx(MoonUITabsTriggerPro, { value: "overview", children: "Overview" }),
11292
+ /* @__PURE__ */ jsxs(MoonUITabsTriggerPro, { value: "activity", children: [
11293
+ "Activity",
11294
+ card.activities && card.activities.length > 0 && /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "ml-2", children: card.activities.length })
11295
+ ] }),
11296
+ /* @__PURE__ */ jsxs(MoonUITabsTriggerPro, { value: "comments", children: [
11297
+ "Comments",
11298
+ card.comments && card.comments > 0 && /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "ml-2", children: card.comments })
11299
+ ] })
11300
+ ] }) }),
11301
+ /* @__PURE__ */ jsx(ScrollArea, { className: "flex-1 max-h-[calc(90vh-200px)]", children: /* @__PURE__ */ jsxs("div", { className: "p-6", children: [
11302
+ /* @__PURE__ */ jsx(MoonUITabsContentPro, { value: "overview", className: "mt-0", children: /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
11303
+ /* @__PURE__ */ jsxs("div", { children: [
11304
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-base font-semibold mb-2 block", children: "Description" }),
11305
+ isEditingDescription ? /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11306
+ /* @__PURE__ */ jsx(
11307
+ MoonUITextareaPro,
11308
+ {
11309
+ value: card.description || "",
11310
+ onChange: (e) => updateCard({ description: e.target.value }),
11311
+ placeholder: "Add a description...",
11312
+ className: "min-h-[100px]",
11313
+ autoFocus: true
11314
+ }
11315
+ ),
11316
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
11317
+ /* @__PURE__ */ jsx(
11318
+ MoonUIButtonPro,
11319
+ {
11320
+ size: "sm",
11321
+ onClick: () => setIsEditingDescription(false),
11322
+ children: "Save"
11323
+ }
11324
+ ),
11325
+ /* @__PURE__ */ jsx(
11326
+ MoonUIButtonPro,
11327
+ {
11328
+ size: "sm",
11329
+ variant: "ghost",
11330
+ onClick: () => {
11331
+ setCard(initialCard);
11332
+ setIsEditingDescription(false);
11333
+ },
11334
+ children: "Cancel"
11335
+ }
11336
+ )
11337
+ ] })
11338
+ ] }) : /* @__PURE__ */ jsx(
11339
+ "div",
11340
+ {
11341
+ className: "min-h-[50px] p-3 rounded-md border cursor-pointer hover:bg-muted/50",
11342
+ onClick: () => setIsEditingDescription(true),
11343
+ children: card.description || /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Add a description..." })
11344
+ }
11345
+ )
11346
+ ] }),
11347
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11348
+ /* @__PURE__ */ jsxs("div", { children: [
11349
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-sm font-medium mb-2 block", children: "Assignees" }),
11350
+ /* @__PURE__ */ jsxs(MoonUIPopoverPro, { children: [
11351
+ /* @__PURE__ */ jsx(MoonUIPopoverTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", className: "w-full justify-start", children: card.assignees && card.assignees.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11352
+ /* @__PURE__ */ jsx(MoonUIAvatarGroupPro, { max: 3, size: "xs", children: card.assignees.map((assignee) => /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-5 w-5", children: [
11353
+ /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: assignee.avatar }),
11354
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials(assignee.name) })
11355
+ ] }, assignee.id)) }),
11356
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: card.assignees.map((a) => a.name).join(", ") })
11357
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Add assignee" }) }) }),
11358
+ /* @__PURE__ */ jsx(MoonUIPopoverContentPro, { className: "p-0", align: "start", children: /* @__PURE__ */ jsxs(MoonUICommandPro, { children: [
11359
+ /* @__PURE__ */ jsx(MoonUICommandInputPro, { placeholder: "Search assignees..." }),
11360
+ /* @__PURE__ */ jsx(MoonUICommandEmptyPro, { children: "No assignees found." }),
11361
+ /* @__PURE__ */ jsx(MoonUICommandGroupPro, { children: availableAssignees.map((assignee) => {
11362
+ const isSelected = card.assignees?.some((a) => a.id === assignee.id);
11363
+ return /* @__PURE__ */ jsxs(
11364
+ MoonUICommandItemPro,
11365
+ {
11366
+ onSelect: () => {
11367
+ if (isSelected) {
11368
+ updateCard({
11369
+ assignees: card.assignees?.filter((a) => a.id !== assignee.id)
11370
+ });
11371
+ } else {
11372
+ updateCard({
11373
+ assignees: [...card.assignees || [], assignee]
11374
+ });
11375
+ }
11376
+ },
11377
+ children: [
11378
+ /* @__PURE__ */ jsx(
11379
+ Check,
11380
+ {
11381
+ className: cn(
11382
+ "mr-2 h-4 w-4",
11383
+ isSelected ? "opacity-100" : "opacity-0"
11384
+ )
11385
+ }
11386
+ ),
11387
+ /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-6 w-6 mr-2", children: [
11388
+ /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: assignee.avatar }),
11389
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials(assignee.name) })
11390
+ ] }),
11391
+ /* @__PURE__ */ jsx("span", { children: assignee.name })
11392
+ ]
11393
+ },
11394
+ assignee.id
11395
+ );
11396
+ }) })
11397
+ ] }) })
11398
+ ] })
11399
+ ] }),
11400
+ /* @__PURE__ */ jsxs("div", { children: [
11401
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-sm font-medium mb-2 block", children: "Priority" }),
11402
+ /* @__PURE__ */ jsxs(MoonUISelectPro, { value: card.priority || "medium", onValueChange: (value) => updateCard({ priority: value }), children: [
11403
+ /* @__PURE__ */ jsx(MoonUISelectTriggerPro, { children: /* @__PURE__ */ jsx(MoonUISelectValuePro, {}) }),
11404
+ /* @__PURE__ */ jsx(MoonUISelectContentPro, { children: PRIORITY_OPTIONS.map((option) => /* @__PURE__ */ jsx(MoonUISelectItemPro, { value: option.value, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11405
+ /* @__PURE__ */ jsx(option.icon, { className: cn("h-4 w-4", option.color) }),
11406
+ /* @__PURE__ */ jsx("span", { children: option.label })
11407
+ ] }) }, option.value)) })
11408
+ ] })
11409
+ ] }),
11410
+ /* @__PURE__ */ jsxs("div", { children: [
11411
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-sm font-medium mb-2 block", children: "Due Date" }),
11412
+ /* @__PURE__ */ jsxs(MoonUIPopoverPro, { children: [
11413
+ /* @__PURE__ */ jsx(MoonUIPopoverTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", className: "w-full justify-start", children: card.dueDate ? /* @__PURE__ */ jsxs(Fragment, { children: [
11414
+ /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
11415
+ format(card.dueDate, "PPP")
11416
+ ] }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Set due date" }) }) }),
11417
+ /* @__PURE__ */ jsx(MoonUIPopoverContentPro, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
11418
+ Calendar,
11419
+ {
11420
+ mode: "single",
11421
+ selected: card.dueDate,
11422
+ onSelect: (date) => {
11423
+ if (date instanceof Date) {
11424
+ updateCard({ dueDate: date });
11425
+ } else {
11426
+ updateCard({ dueDate: void 0 });
11427
+ }
11428
+ },
11429
+ initialFocus: true
11430
+ }
11431
+ ) })
11432
+ ] })
11433
+ ] }),
11434
+ /* @__PURE__ */ jsxs("div", { children: [
11435
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-sm font-medium mb-2 block", children: "Labels" }),
11436
+ /* @__PURE__ */ jsxs(MoonUIPopoverPro, { children: [
11437
+ /* @__PURE__ */ jsx(MoonUIPopoverTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", className: "w-full justify-start", children: card.labels && card.labels.length > 0 ? /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1", children: card.labels.map((label) => /* @__PURE__ */ jsx(
11438
+ "div",
11439
+ {
11440
+ className: "px-2 py-0.5 rounded text-xs text-white",
11441
+ style: { backgroundColor: label.color },
11442
+ children: label.name
11443
+ },
11444
+ label.id
11445
+ )) }) : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Add labels" }) }) }),
11446
+ /* @__PURE__ */ jsx(MoonUIPopoverContentPro, { className: "p-3", align: "start", children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: availableLabels.map((label) => {
11447
+ const isSelected = card.labels?.some((l) => l.id === label.id);
11448
+ return /* @__PURE__ */ jsxs(
11449
+ "div",
11450
+ {
11451
+ className: cn(
11452
+ "flex items-center gap-2 p-2 rounded cursor-pointer hover:bg-muted",
11453
+ isSelected && "bg-muted"
11454
+ ),
11455
+ onClick: () => {
11456
+ if (isSelected) {
11457
+ updateCard({
11458
+ labels: card.labels?.filter((l) => l.id !== label.id)
11459
+ });
11460
+ } else {
11461
+ updateCard({
11462
+ labels: [...card.labels || [], label]
11463
+ });
11464
+ }
11465
+ },
11466
+ children: [
11467
+ /* @__PURE__ */ jsx(
11468
+ "div",
11469
+ {
11470
+ className: "w-6 h-6 rounded",
11471
+ style: { backgroundColor: label.color }
11472
+ }
11473
+ ),
11474
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: label.name }),
11475
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 ml-auto" })
11476
+ ]
11477
+ },
11478
+ label.id
11479
+ );
11480
+ }) }) })
11481
+ ] })
11482
+ ] })
11483
+ ] }),
11484
+ /* @__PURE__ */ jsxs("div", { children: [
11485
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
11486
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-base font-semibold", children: "Checklist" }),
11487
+ totalChecklistItems > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11488
+ /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
11489
+ completedChecklistItems,
11490
+ "/",
11491
+ totalChecklistItems
11492
+ ] }),
11493
+ /* @__PURE__ */ jsx(MoonUIProgressPro, { value: checklistProgress, className: "w-20 h-2" })
11494
+ ] })
11495
+ ] }),
11496
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11497
+ card.checklist?.items.map((item) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 group", children: [
11498
+ /* @__PURE__ */ jsx(
11499
+ MoonUICheckboxPro,
11500
+ {
11501
+ checked: item.completed,
11502
+ onCheckedChange: () => toggleChecklistItem(item.id)
11503
+ }
11504
+ ),
11505
+ /* @__PURE__ */ jsx("span", { className: cn(
11506
+ "flex-1",
11507
+ item.completed && "line-through text-muted-foreground"
11508
+ ), children: item.text }),
11509
+ /* @__PURE__ */ jsx(
11510
+ MoonUIButtonPro,
11511
+ {
11512
+ variant: "ghost",
11513
+ size: "icon",
11514
+ className: "h-6 w-6 opacity-0 group-hover:opacity-100",
11515
+ onClick: () => deleteChecklistItem(item.id),
11516
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-3 w-3" })
11517
+ }
11518
+ )
11519
+ ] }, item.id)),
11520
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11521
+ /* @__PURE__ */ jsx(MoonUICheckboxPro, { disabled: true, className: "invisible" }),
11522
+ /* @__PURE__ */ jsx(
11523
+ MoonUIInputPro,
11524
+ {
11525
+ placeholder: "Add an item...",
11526
+ value: newChecklistItem,
11527
+ onChange: (e) => setNewChecklistItem(e.target.value),
11528
+ onKeyDown: (e) => {
11529
+ if (e.key === "Enter") {
11530
+ e.preventDefault();
11531
+ addChecklistItem();
11532
+ }
11533
+ }
11534
+ }
11535
+ ),
11536
+ /* @__PURE__ */ jsx(
11537
+ MoonUIButtonPro,
11538
+ {
11539
+ size: "sm",
11540
+ onClick: addChecklistItem,
11541
+ disabled: !newChecklistItem.trim(),
11542
+ children: "Add"
11543
+ }
11544
+ )
11545
+ ] })
11546
+ ] })
11547
+ ] }),
11548
+ /* @__PURE__ */ jsxs("div", { children: [
11549
+ /* @__PURE__ */ jsx(MoonUILabelPro, { className: "text-base font-semibold mb-3 block", children: "Attachments" }),
11550
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
11551
+ card.attachments?.map((attachment) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 p-3 border rounded-lg group", children: [
11552
+ /* @__PURE__ */ jsx("div", { className: "flex-shrink-0", children: attachment.type.startsWith("image/") ? /* @__PURE__ */ jsx(Image$1, { className: "h-8 w-8 text-muted-foreground" }) : /* @__PURE__ */ jsx(FileText, { className: "h-8 w-8 text-muted-foreground" }) }),
11553
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
11554
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium truncate", children: attachment.name }),
11555
+ /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: formatFileSize(attachment.size) })
11556
+ ] }),
11557
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100", children: [
11558
+ /* @__PURE__ */ jsx(
11559
+ MoonUIButtonPro,
11560
+ {
11561
+ variant: "ghost",
11562
+ size: "icon",
11563
+ className: "h-8 w-8",
11564
+ onClick: () => window.open(attachment.url, "_blank"),
11565
+ children: /* @__PURE__ */ jsx(Download, { className: "h-4 w-4" })
11566
+ }
11567
+ ),
11568
+ /* @__PURE__ */ jsx(
11569
+ MoonUIButtonPro,
11570
+ {
11571
+ variant: "ghost",
11572
+ size: "icon",
11573
+ className: "h-8 w-8",
11574
+ onClick: () => removeAttachment(attachment.id),
11575
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-4 w-4" })
11576
+ }
11577
+ )
11578
+ ] })
11579
+ ] }, attachment.id)),
11580
+ /* @__PURE__ */ jsxs("div", { children: [
11581
+ /* @__PURE__ */ jsx(
11582
+ "input",
11583
+ {
11584
+ type: "file",
11585
+ id: "file-upload",
11586
+ className: "hidden",
11587
+ multiple: true,
11588
+ onChange: handleFileUpload
11589
+ }
11590
+ ),
11591
+ /* @__PURE__ */ jsxs(
11592
+ MoonUIButtonPro,
11593
+ {
11594
+ variant: "outline",
11595
+ className: "w-full",
11596
+ onClick: () => document.getElementById("file-upload")?.click(),
11597
+ children: [
11598
+ /* @__PURE__ */ jsx(Upload, { className: "mr-2 h-4 w-4" }),
11599
+ "Add attachment"
11600
+ ]
11601
+ }
11602
+ )
11603
+ ] })
11604
+ ] })
11605
+ ] })
11606
+ ] }) }),
11607
+ /* @__PURE__ */ jsx(MoonUITabsContentPro, { value: "activity", className: "mt-0", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
11608
+ card.activities?.map((activity) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
11609
+ /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-8 w-8", children: [
11610
+ /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: activity.user.avatar }),
11611
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials(activity.user.name) })
11612
+ ] }),
11613
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
11614
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
11615
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: activity.user.name }),
11616
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: activity.action }),
11617
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: format(activity.timestamp, "PPp") })
11618
+ ] }),
11619
+ activity.details && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: activity.details })
11620
+ ] })
11621
+ ] }, activity.id)),
11622
+ (!card.activities || card.activities.length === 0) && /* @__PURE__ */ jsxs("div", { className: "text-center py-8 text-muted-foreground", children: [
11623
+ /* @__PURE__ */ jsx(Activity, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
11624
+ /* @__PURE__ */ jsx("p", { children: "No activity yet" })
11625
+ ] })
11626
+ ] }) }),
11627
+ /* @__PURE__ */ jsx(MoonUITabsContentPro, { value: "comments", className: "mt-0", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
11628
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
11629
+ /* @__PURE__ */ jsx(MoonUIAvatarPro, { className: "h-8 w-8", children: /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { children: "U" }) }),
11630
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2", children: [
11631
+ /* @__PURE__ */ jsx(
11632
+ MoonUITextareaPro,
11633
+ {
11634
+ placeholder: "Add a comment...",
11635
+ value: newComment,
11636
+ onChange: (e) => setNewComment(e.target.value),
11637
+ className: "min-h-[80px]"
11638
+ }
11639
+ ),
11640
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
11641
+ MoonUIButtonPro,
11642
+ {
11643
+ size: "sm",
11644
+ onClick: addComment,
11645
+ disabled: !newComment.trim(),
11646
+ children: [
11647
+ /* @__PURE__ */ jsx(Send, { className: "mr-2 h-4 w-4" }),
11648
+ "Comment"
11649
+ ]
11650
+ }
11651
+ ) })
11652
+ ] })
11653
+ ] }),
11654
+ /* @__PURE__ */ jsx(MoonUISeparatorPro, {}),
11655
+ card.activities?.filter((a) => a.action === "commented").map((comment) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
11656
+ /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-8 w-8", children: [
11657
+ /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: comment.user.avatar }),
11658
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials(comment.user.name) })
11659
+ ] }),
11660
+ /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
11661
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-1", children: [
11662
+ /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: comment.user.name }),
11663
+ /* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: format(comment.timestamp, "PPp") })
11664
+ ] }),
11665
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: comment.details })
11666
+ ] })
11667
+ ] }, comment.id)),
11668
+ !card.activities?.some((a) => a.action === "commented") && /* @__PURE__ */ jsxs("div", { className: "text-center py-8 text-muted-foreground", children: [
11669
+ /* @__PURE__ */ jsx(MessageCircle, { className: "h-8 w-8 mx-auto mb-2 opacity-50" }),
11670
+ /* @__PURE__ */ jsx("p", { children: "No comments yet" }),
11671
+ /* @__PURE__ */ jsx("p", { className: "text-sm", children: "Be the first to comment" })
11672
+ ] })
11673
+ ] }) })
11674
+ ] }) })
11675
+ ] }),
11676
+ /* @__PURE__ */ jsxs("div", { className: "border-t p-4 flex items-center justify-between", children: [
11677
+ /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
11678
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsxs(MoonUIButtonPro, { variant: "outline", size: "sm", children: [
11679
+ /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4 mr-2" }),
11680
+ "Actions"
11681
+ ] }) }),
11682
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { align: "start", children: [
11683
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { children: [
11684
+ /* @__PURE__ */ jsx(Copy, { className: "mr-2 h-4 w-4" }),
11685
+ "Duplicate card"
11686
+ ] }),
11687
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { children: [
11688
+ /* @__PURE__ */ jsx(Archive, { className: "mr-2 h-4 w-4" }),
11689
+ "Archive card"
11690
+ ] }),
11691
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { children: [
11692
+ /* @__PURE__ */ jsx(Link2, { className: "mr-2 h-4 w-4" }),
11693
+ "Copy link"
11694
+ ] }),
11695
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {}),
11696
+ /* @__PURE__ */ jsxs(
11697
+ MoonUIDropdownMenuItemPro,
11698
+ {
11699
+ onClick: () => {
11700
+ onDelete(card);
11701
+ onClose();
11702
+ },
11703
+ className: "text-destructive",
11704
+ children: [
11705
+ /* @__PURE__ */ jsx(Trash2, { className: "mr-2 h-4 w-4" }),
11706
+ "Delete card"
11707
+ ]
11708
+ }
11709
+ )
11710
+ ] })
11711
+ ] }) }),
11712
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { onClick: onClose, children: "Close" })
11713
+ ] })
11714
+ ] }) });
11715
+ }
11716
+ var PRIORITY_OPTIONS2 = [
11717
+ { value: "low", label: "Low Priority", icon: Flag, color: "text-green-600" },
11718
+ { value: "medium", label: "Medium Priority", icon: Flag, color: "text-yellow-600" },
11719
+ { value: "high", label: "High Priority", icon: Flag, color: "text-orange-600" },
11720
+ { value: "urgent", label: "Urgent", icon: Zap, color: "text-red-600" }
11721
+ ];
11722
+ var CARD_TEMPLATES = [
11723
+ {
11724
+ name: "Bug Report",
11725
+ icon: Flag,
11726
+ template: {
11727
+ title: "Bug: ",
11728
+ description: "**Steps to Reproduce:**\n1. \n2. \n3. \n\n**Expected Behavior:**\n\n**Actual Behavior:**",
11729
+ priority: "high",
11730
+ tags: ["bug"]
11731
+ }
11732
+ },
11733
+ {
11734
+ name: "Feature Request",
11735
+ icon: Star,
11736
+ template: {
11737
+ title: "Feature: ",
11738
+ description: "**User Story:**\nAs a [user type], I want [feature] so that [benefit].\n\n**Acceptance Criteria:**\n- [ ] ",
11739
+ priority: "medium",
11740
+ tags: ["feature"]
11741
+ }
11742
+ },
11743
+ {
11744
+ name: "Task",
11745
+ icon: CheckSquare,
11746
+ template: {
11747
+ title: "Task: ",
11748
+ description: "**Objective:**\n\n**Tasks:**\n- [ ] ",
11749
+ priority: "medium",
11750
+ tags: ["task"]
11751
+ }
11752
+ },
11753
+ {
11754
+ name: "User Story",
11755
+ icon: User,
11756
+ template: {
11757
+ title: "As a ",
11758
+ description: "**Story:**\nAs a [user type]\nI want [functionality]\nSo that [benefit]\n\n**Acceptance Criteria:**\n- [ ] ",
11759
+ priority: "medium",
11760
+ tags: ["story"]
11761
+ }
11762
+ }
11763
+ ];
11764
+ var getInitials2 = (name) => {
11765
+ return name.split(" ").map((n) => n[0]).join("").toUpperCase();
11766
+ };
11767
+ function AddCardModal({
11768
+ isOpen,
11769
+ onClose,
11770
+ onAdd,
11771
+ columnId,
11772
+ columnTitle,
11773
+ availableAssignees = [],
11774
+ availableLabels = [],
11775
+ templates = []
11776
+ }) {
11777
+ const [selectedTab, setSelectedTab] = useState("blank");
11778
+ const [title, setTitle] = useState("");
11779
+ const [description, setDescription] = useState("");
11780
+ const [priority, setPriority] = useState("medium");
11781
+ const [assignees, setAssignees] = useState([]);
11782
+ const [labels, setLabels] = useState([]);
11783
+ const [dueDate, setDueDate] = useState();
11784
+ const [tags, setTags] = useState([]);
11785
+ const [tagInput, setTagInput] = useState("");
11786
+ const handleTemplateSelect = (template) => {
11787
+ setTitle(template.title || "");
11788
+ setDescription(template.description || "");
11789
+ setPriority(template.priority || "medium");
11790
+ setTags(template.tags || []);
11791
+ if (template.assignees)
11792
+ setAssignees(template.assignees);
11793
+ if (template.labels)
11794
+ setLabels(template.labels);
11795
+ if (template.dueDate)
11796
+ setDueDate(template.dueDate);
11797
+ };
11798
+ const handleSubmit = () => {
11799
+ if (!title.trim())
11800
+ return;
11801
+ const newCard = {
11802
+ title: title.trim(),
11803
+ description: description.trim() || void 0,
11804
+ priority,
11805
+ assignees: assignees.length > 0 ? assignees : void 0,
11806
+ labels: labels.length > 0 ? labels : void 0,
11807
+ dueDate,
11808
+ tags: tags.length > 0 ? tags : void 0,
11809
+ position: Date.now()
11810
+ };
11811
+ onAdd(newCard);
11812
+ resetForm();
11813
+ onClose();
11814
+ };
11815
+ const resetForm = () => {
11816
+ setTitle("");
11817
+ setDescription("");
11818
+ setPriority("medium");
11819
+ setAssignees([]);
11820
+ setLabels([]);
11821
+ setDueDate(void 0);
11822
+ setTags([]);
11823
+ setTagInput("");
11824
+ setSelectedTab("blank");
11825
+ };
11826
+ const handleAddTag = () => {
11827
+ if (tagInput.trim() && !tags.includes(tagInput.trim())) {
11828
+ setTags([...tags, tagInput.trim()]);
11829
+ setTagInput("");
11830
+ }
11831
+ };
11832
+ [...CARD_TEMPLATES.map((t2) => ({ ...t2.template, name: t2.name, icon: t2.icon })), ...templates];
11833
+ return /* @__PURE__ */ jsx(MoonUIDialogPro, { open: isOpen, onOpenChange: onClose, children: /* @__PURE__ */ jsxs(MoonUIDialogContentPro, { className: "max-w-2xl", children: [
11834
+ /* @__PURE__ */ jsx(MoonUIDialogHeaderPro, { children: /* @__PURE__ */ jsxs(MoonUIDialogTitlePro, { children: [
11835
+ "Add Card to ",
11836
+ columnTitle
11837
+ ] }) }),
11838
+ /* @__PURE__ */ jsxs(MoonUITabsPro, { value: selectedTab, onValueChange: setSelectedTab, children: [
11839
+ /* @__PURE__ */ jsxs(MoonUITabsListPro, { className: "grid w-full grid-cols-2", children: [
11840
+ /* @__PURE__ */ jsx(MoonUITabsTriggerPro, { value: "blank", children: "Blank Card" }),
11841
+ /* @__PURE__ */ jsx(MoonUITabsTriggerPro, { value: "template", children: "From Template" })
11842
+ ] }),
11843
+ /* @__PURE__ */ jsx(MoonUITabsContentPro, { value: "blank", className: "space-y-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
11844
+ /* @__PURE__ */ jsxs("div", { children: [
11845
+ /* @__PURE__ */ jsx(MoonUILabelPro, { htmlFor: "title", children: "Title *" }),
11846
+ /* @__PURE__ */ jsx(
11847
+ MoonUIInputPro,
11848
+ {
11849
+ id: "title",
11850
+ placeholder: "Enter card title...",
11851
+ value: title,
11852
+ onChange: (e) => setTitle(e.target.value),
11853
+ autoFocus: true
11854
+ }
11855
+ )
11856
+ ] }),
11857
+ /* @__PURE__ */ jsxs("div", { children: [
11858
+ /* @__PURE__ */ jsx(MoonUILabelPro, { htmlFor: "description", children: "Description" }),
11859
+ /* @__PURE__ */ jsx(
11860
+ MoonUITextareaPro,
11861
+ {
11862
+ id: "description",
11863
+ placeholder: "Add a more detailed description...",
11864
+ value: description,
11865
+ onChange: (e) => setDescription(e.target.value),
11866
+ className: "min-h-[100px]"
11867
+ }
11868
+ )
11869
+ ] }),
11870
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11871
+ /* @__PURE__ */ jsxs("div", { children: [
11872
+ /* @__PURE__ */ jsx(MoonUILabelPro, { children: "Priority" }),
11873
+ /* @__PURE__ */ jsxs(MoonUISelectPro, { value: priority, onValueChange: (value) => setPriority(value), children: [
11874
+ /* @__PURE__ */ jsx(MoonUISelectTriggerPro, { children: /* @__PURE__ */ jsx(MoonUISelectValuePro, {}) }),
11875
+ /* @__PURE__ */ jsx(MoonUISelectContentPro, { children: PRIORITY_OPTIONS2.map((option) => /* @__PURE__ */ jsx(MoonUISelectItemPro, { value: option.value, children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11876
+ /* @__PURE__ */ jsx(option.icon, { className: cn("h-4 w-4", option.color) }),
11877
+ /* @__PURE__ */ jsx("span", { children: option.label })
11878
+ ] }) }, option.value)) })
11879
+ ] })
11880
+ ] }),
11881
+ /* @__PURE__ */ jsxs("div", { children: [
11882
+ /* @__PURE__ */ jsx(MoonUILabelPro, { children: "Due Date" }),
11883
+ /* @__PURE__ */ jsxs(MoonUIPopoverPro, { children: [
11884
+ /* @__PURE__ */ jsx(MoonUIPopoverTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", className: "w-full justify-start", children: dueDate ? /* @__PURE__ */ jsxs(Fragment, { children: [
11885
+ /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
11886
+ format(dueDate, "PPP")
11887
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11888
+ /* @__PURE__ */ jsx(Calendar$1, { className: "mr-2 h-4 w-4" }),
11889
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Pick a date" })
11890
+ ] }) }) }),
11891
+ /* @__PURE__ */ jsx(MoonUIPopoverContentPro, { className: "w-auto p-0", align: "start", children: /* @__PURE__ */ jsx(
11892
+ Calendar,
11893
+ {
11894
+ mode: "single",
11895
+ selected: dueDate,
11896
+ onSelect: (date) => {
11897
+ if (date instanceof Date) {
11898
+ setDueDate(date);
11899
+ } else {
11900
+ setDueDate(void 0);
11901
+ }
11902
+ },
11903
+ initialFocus: true
11904
+ }
11905
+ ) })
11906
+ ] })
11907
+ ] })
11908
+ ] }),
11909
+ /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
11910
+ /* @__PURE__ */ jsxs("div", { children: [
11911
+ /* @__PURE__ */ jsx(MoonUILabelPro, { children: "Assignees" }),
11912
+ /* @__PURE__ */ jsxs(MoonUIPopoverPro, { children: [
11913
+ /* @__PURE__ */ jsx(MoonUIPopoverTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", className: "w-full justify-start", children: assignees.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11914
+ /* @__PURE__ */ jsx(MoonUIAvatarGroupPro, { max: 2, size: "xs", children: assignees.map((assignee) => /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-5 w-5", children: [
11915
+ /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: assignee.avatar }),
11916
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials2(assignee.name) })
11917
+ ] }, assignee.id)) }),
11918
+ /* @__PURE__ */ jsx("span", { className: "text-sm truncate", children: assignees.map((a) => a.name).join(", ") })
11919
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11920
+ /* @__PURE__ */ jsx(User, { className: "mr-2 h-4 w-4" }),
11921
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Select assignees" })
11922
+ ] }) }) }),
11923
+ /* @__PURE__ */ jsx(MoonUIPopoverContentPro, { className: "p-0", align: "start", children: /* @__PURE__ */ jsxs(MoonUICommandPro, { children: [
11924
+ /* @__PURE__ */ jsx(MoonUICommandInputPro, { placeholder: "Search people..." }),
11925
+ /* @__PURE__ */ jsx(MoonUICommandEmptyPro, { children: "No assignees found." }),
11926
+ /* @__PURE__ */ jsx(MoonUICommandGroupPro, { children: availableAssignees.map((assignee) => {
11927
+ const isSelected = assignees.some((a) => a.id === assignee.id);
11928
+ return /* @__PURE__ */ jsxs(
11929
+ MoonUICommandItemPro,
11930
+ {
11931
+ onSelect: () => {
11932
+ if (isSelected) {
11933
+ setAssignees(assignees.filter((a) => a.id !== assignee.id));
11934
+ } else {
11935
+ setAssignees([...assignees, assignee]);
11936
+ }
11937
+ },
11938
+ children: [
11939
+ /* @__PURE__ */ jsx(
11940
+ Check,
11941
+ {
11942
+ className: cn(
11943
+ "mr-2 h-4 w-4",
11944
+ isSelected ? "opacity-100" : "opacity-0"
11945
+ )
11946
+ }
11947
+ ),
11948
+ /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-6 w-6 mr-2", children: [
11949
+ /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: assignee.avatar }),
11950
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials2(assignee.name) })
11951
+ ] }),
11952
+ /* @__PURE__ */ jsx("span", { children: assignee.name })
11953
+ ]
11954
+ },
11955
+ assignee.id
11956
+ );
11957
+ }) })
11958
+ ] }) })
11959
+ ] })
11960
+ ] }),
11961
+ /* @__PURE__ */ jsxs("div", { children: [
11962
+ /* @__PURE__ */ jsx(MoonUILabelPro, { children: "Labels" }),
11963
+ /* @__PURE__ */ jsxs(MoonUIPopoverPro, { children: [
11964
+ /* @__PURE__ */ jsx(MoonUIPopoverTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", className: "w-full justify-start", children: labels.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 truncate", children: [
11965
+ labels.slice(0, 2).map((label) => /* @__PURE__ */ jsx(
11966
+ "div",
11967
+ {
11968
+ className: "px-2 py-0.5 rounded text-xs text-white",
11969
+ style: { backgroundColor: label.color },
11970
+ children: label.name
11971
+ },
11972
+ label.id
11973
+ )),
11974
+ labels.length > 2 && /* @__PURE__ */ jsxs("span", { className: "text-sm text-muted-foreground", children: [
11975
+ "+",
11976
+ labels.length - 2,
11977
+ " more"
11978
+ ] })
11979
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11980
+ /* @__PURE__ */ jsx(Tag, { className: "mr-2 h-4 w-4" }),
11981
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Select labels" })
11982
+ ] }) }) }),
11983
+ /* @__PURE__ */ jsx(MoonUIPopoverContentPro, { className: "p-3", align: "start", children: /* @__PURE__ */ jsx("div", { className: "space-y-2", children: availableLabels.map((label) => {
11984
+ const isSelected = labels.some((l) => l.id === label.id);
11985
+ return /* @__PURE__ */ jsxs(
11986
+ "div",
11987
+ {
11988
+ className: cn(
11989
+ "flex items-center gap-2 p-2 rounded cursor-pointer hover:bg-muted",
11990
+ isSelected && "bg-muted"
11991
+ ),
11992
+ onClick: () => {
11993
+ if (isSelected) {
11994
+ setLabels(labels.filter((l) => l.id !== label.id));
11995
+ } else {
11996
+ setLabels([...labels, label]);
11997
+ }
11998
+ },
11999
+ children: [
12000
+ /* @__PURE__ */ jsx(
12001
+ "div",
12002
+ {
12003
+ className: "w-6 h-6 rounded",
12004
+ style: { backgroundColor: label.color }
12005
+ }
12006
+ ),
12007
+ /* @__PURE__ */ jsx("span", { className: "text-sm", children: label.name }),
12008
+ isSelected && /* @__PURE__ */ jsx(Check, { className: "h-4 w-4 ml-auto" })
12009
+ ]
12010
+ },
12011
+ label.id
12012
+ );
12013
+ }) }) })
12014
+ ] })
12015
+ ] })
12016
+ ] }),
12017
+ /* @__PURE__ */ jsxs("div", { children: [
12018
+ /* @__PURE__ */ jsx(MoonUILabelPro, { children: "Tags" }),
12019
+ /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
12020
+ /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
12021
+ /* @__PURE__ */ jsx(
12022
+ MoonUIInputPro,
12023
+ {
12024
+ placeholder: "Add a tag...",
12025
+ value: tagInput,
12026
+ onChange: (e) => setTagInput(e.target.value),
12027
+ onKeyDown: (e) => {
12028
+ if (e.key === "Enter") {
12029
+ e.preventDefault();
12030
+ handleAddTag();
12031
+ }
12032
+ }
12033
+ }
12034
+ ),
12035
+ /* @__PURE__ */ jsx(
12036
+ MoonUIButtonPro,
12037
+ {
12038
+ type: "button",
12039
+ variant: "outline",
12040
+ onClick: handleAddTag,
12041
+ disabled: !tagInput.trim(),
12042
+ children: "Add"
12043
+ }
12044
+ )
12045
+ ] }),
12046
+ tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: tags.map((tag) => /* @__PURE__ */ jsxs(
12047
+ MoonUIBadgePro,
12048
+ {
12049
+ variant: "secondary",
12050
+ className: "cursor-pointer",
12051
+ onClick: () => setTags(tags.filter((t2) => t2 !== tag)),
12052
+ children: [
12053
+ tag,
12054
+ /* @__PURE__ */ jsx("span", { className: "ml-1 hover:text-destructive", children: "\xD7" })
12055
+ ]
12056
+ },
12057
+ tag
12058
+ )) })
12059
+ ] })
12060
+ ] })
12061
+ ] }) }),
12062
+ /* @__PURE__ */ jsx(MoonUITabsContentPro, { value: "template", className: "space-y-4", children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
12063
+ CARD_TEMPLATES.map((template) => /* @__PURE__ */ jsxs(
12064
+ "div",
12065
+ {
12066
+ className: "p-4 border rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",
12067
+ onClick: () => {
12068
+ handleTemplateSelect(template.template);
12069
+ setSelectedTab("blank");
12070
+ },
12071
+ children: [
12072
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
12073
+ /* @__PURE__ */ jsx(template.icon, { className: "h-5 w-5 text-muted-foreground" }),
12074
+ /* @__PURE__ */ jsx("h4", { className: "font-medium", children: template.name })
12075
+ ] }),
12076
+ /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
12077
+ template.name === "Bug Report" && "Track and fix bugs with detailed information",
12078
+ template.name === "Feature Request" && "Plan new features with user stories",
12079
+ template.name === "Task" && "Create actionable tasks with clear objectives",
12080
+ template.name === "User Story" && "Define user needs and acceptance criteria"
12081
+ ] })
12082
+ ]
12083
+ },
12084
+ template.name
12085
+ )),
12086
+ templates.map((template, index2) => /* @__PURE__ */ jsxs(
12087
+ "div",
12088
+ {
12089
+ className: "p-4 border rounded-lg cursor-pointer hover:bg-muted/50 transition-colors",
12090
+ onClick: () => {
12091
+ handleTemplateSelect(template);
12092
+ setSelectedTab("blank");
12093
+ },
12094
+ children: [
12095
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-2", children: [
12096
+ /* @__PURE__ */ jsx(Star, { className: "h-5 w-5 text-muted-foreground" }),
12097
+ /* @__PURE__ */ jsx("h4", { className: "font-medium", children: template.title || `Template ${index2 + 1}` })
12098
+ ] }),
12099
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground line-clamp-2", children: template.description || "Custom template" })
12100
+ ]
12101
+ },
12102
+ `custom-${index2}`
12103
+ ))
12104
+ ] }) })
12105
+ ] }),
12106
+ /* @__PURE__ */ jsxs(MoonUIDialogFooterPro, { children: [
12107
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", onClick: onClose, children: "Cancel" }),
12108
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { onClick: handleSubmit, disabled: !title.trim(), children: "Add Card" })
12109
+ ] })
12110
+ ] }) });
12111
+ }
12112
+
12113
+ // src/hooks/use-toast.ts
12114
+ function useToast() {
12115
+ const toast3 = (options) => {
12116
+ console.log(`[Toast] ${options.title}${options.description ? ": " + options.description : ""}`);
12117
+ };
12118
+ return { toast: toast3 };
12119
+ }
11124
12120
  var PRIORITY_CONFIG = {
11125
12121
  low: {
11126
12122
  color: "bg-green-100 text-green-800 border-green-200",
@@ -11158,7 +12154,7 @@ var formatDate = (date) => {
11158
12154
  var isOverdue = (dueDate) => {
11159
12155
  return dueDate < /* @__PURE__ */ new Date();
11160
12156
  };
11161
- var getInitials = (name) => {
12157
+ var getInitials3 = (name) => {
11162
12158
  return name.split(" ").map((n) => n[0]).join("").toUpperCase();
11163
12159
  };
11164
12160
  var useAutoScroll = () => {
@@ -11187,29 +12183,51 @@ var useAutoScroll = () => {
11187
12183
  };
11188
12184
  var KanbanCardComponent = ({
11189
12185
  card,
12186
+ column,
11190
12187
  isDragging,
11191
12188
  onEdit,
11192
12189
  onDelete,
11193
12190
  onClick,
11194
12191
  showDetails,
11195
- disabled
12192
+ disabled,
12193
+ renderCard,
12194
+ renderCardPreview,
12195
+ renderCardBadge,
12196
+ renderCardActions,
12197
+ cardCompactMode,
12198
+ cardShowCoverImage,
12199
+ cardShowAssignees,
12200
+ cardShowLabels,
12201
+ cardShowProgress,
12202
+ cardDateFormat,
12203
+ cardMaxAssigneesToShow,
12204
+ provided,
12205
+ enableAnimations,
12206
+ animationDuration,
12207
+ cardVariant
11196
12208
  }) => {
11197
12209
  const [isEditingTitle, setIsEditingTitle] = useState(false);
11198
12210
  const [title, setTitle] = useState(card.title);
11199
12211
  const dragControls = useDragControls();
12212
+ const animationsEnabled = enableAnimations ?? true;
12213
+ const animDuration = animationDuration ?? 0.2;
12214
+ const variant = cardVariant ?? "default";
11200
12215
  const completedChecklistItems = card.checklist?.items.filter((item) => item.completed).length || 0;
11201
12216
  const totalChecklistItems = card.checklist?.items.length || 0;
11202
12217
  const checklistProgress = totalChecklistItems > 0 ? completedChecklistItems / totalChecklistItems * 100 : 0;
12218
+ if (renderCard) {
12219
+ return renderCard(card, column, provided || {});
12220
+ }
11203
12221
  return /* @__PURE__ */ jsx(
11204
12222
  motion.div,
11205
12223
  {
11206
12224
  layout: true,
11207
- initial: { opacity: 0, y: 20 },
12225
+ initial: { opacity: animationsEnabled ? 0 : 1, y: animationsEnabled ? 20 : 0 },
11208
12226
  animate: { opacity: 1, y: 0 },
11209
- exit: { opacity: 0, y: -20 },
11210
- whileHover: { scale: 1.02 },
11211
- whileDrag: { scale: 1.05, rotate: 3 },
11212
- transition: { duration: 0.2 },
12227
+ exit: { opacity: animationsEnabled ? 0 : 1, y: animationsEnabled ? -20 : 0 },
12228
+ whileHover: animationsEnabled ? { scale: 1.02 } : {},
12229
+ whileDrag: animationsEnabled ? { scale: 1.05, rotate: 3 } : {},
12230
+ transition: { duration: animationsEnabled ? animDuration : 0 },
11213
12231
  className: cn(
11214
12232
  "relative group cursor-pointer select-none",
11215
12233
  isDragging && "z-50"
@@ -11218,7 +12236,11 @@ var KanbanCardComponent = ({
11218
12236
  MoonUICardPro,
11219
12237
  {
11220
12238
  className: cn(
11221
- "border hover:shadow-md transition-all duration-200",
12239
+ "border transition-all duration-200",
12240
+ variant === "bordered" && "border-2",
12241
+ variant === "elevated" && "shadow-lg hover:shadow-xl",
12242
+ variant === "flat" && "border-0 bg-muted/30",
12243
+ variant === "default" && "hover:shadow-md",
11222
12244
  isDragging && "shadow-2xl ring-2 ring-primary ring-offset-2",
11223
12245
  disabled && "cursor-not-allowed opacity-50"
11224
12246
  ),
@@ -11231,7 +12253,7 @@ var KanbanCardComponent = ({
11231
12253
  onPointerDown: (e) => dragControls.start(e)
11232
12254
  }
11233
12255
  ),
11234
- card.coverImage && /* @__PURE__ */ jsxs("div", { className: "relative h-32 -mx-px -mt-px rounded-t-lg overflow-hidden", children: [
12256
+ cardShowCoverImage && card.coverImage && /* @__PURE__ */ jsxs("div", { className: "relative h-32 -mx-px -mt-px rounded-t-lg overflow-hidden", children: [
11235
12257
  /* @__PURE__ */ jsx(
11236
12258
  "img",
11237
12259
  {
@@ -11243,7 +12265,7 @@ var KanbanCardComponent = ({
11243
12265
  /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/50 to-transparent" })
11244
12266
  ] }),
11245
12267
  /* @__PURE__ */ jsxs(MoonUICardContentPro, { className: "p-3", children: [
11246
- card.labels && card.labels.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: card.labels.map((label) => /* @__PURE__ */ jsx(
12268
+ cardShowLabels && card.labels && card.labels.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-2", children: card.labels.map((label) => /* @__PURE__ */ jsx(
11247
12269
  "div",
11248
12270
  {
11249
12271
  className: "h-2 w-12 rounded-full",
@@ -11273,7 +12295,7 @@ var KanbanCardComponent = ({
11273
12295
  onClick: (e) => e.stopPropagation()
11274
12296
  }
11275
12297
  ) : /* @__PURE__ */ jsx("h4", { className: "font-medium text-sm line-clamp-2", children: card.title }) }),
11276
- /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
12298
+ renderCardActions ? /* @__PURE__ */ jsx("div", { className: "opacity-0 group-hover:opacity-100 transition-opacity", children: renderCardActions(card) }) : /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
11277
12299
  /* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(
11278
12300
  MoonUIButtonPro,
11279
12301
  {
@@ -11316,8 +12338,8 @@ var KanbanCardComponent = ({
11316
12338
  ] })
11317
12339
  ] }) })
11318
12340
  ] }),
11319
- card.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-3 line-clamp-2", children: card.description }),
11320
- (card.progress !== void 0 || card.checklist) && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
12341
+ !cardCompactMode && card.description && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mb-3 line-clamp-2", children: card.description }),
12342
+ cardShowProgress && (card.progress !== void 0 || card.checklist) && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
11321
12343
  /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs text-muted-foreground mb-1", children: [
11322
12344
  /* @__PURE__ */ jsx("span", { children: "Progress" }),
11323
12345
  /* @__PURE__ */ jsxs("span", { children: [
@@ -11327,7 +12349,7 @@ var KanbanCardComponent = ({
11327
12349
  ] }),
11328
12350
  /* @__PURE__ */ jsx(MoonUIProgressPro, { value: card.progress || checklistProgress, className: "h-1" })
11329
12351
  ] }),
11330
- card.tags && card.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-3", children: card.tags.map((tag, index2) => /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "text-xs px-1.5 py-0", children: tag }, index2)) }),
12352
+ !cardCompactMode && card.tags && card.tags.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 mb-3", children: card.tags.map((tag, index2) => /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "text-xs px-1.5 py-0", children: tag }, index2)) }),
11331
12353
  showDetails && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-xs", children: [
11332
12354
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11333
12355
  card.priority && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
@@ -11339,7 +12361,7 @@ var KanbanCardComponent = ({
11339
12361
  isOverdue(card.dueDate) && "text-destructive"
11340
12362
  ), children: [
11341
12363
  /* @__PURE__ */ jsx(Calendar$1, { className: "h-3 w-3" }),
11342
- /* @__PURE__ */ jsx("span", { children: formatDate(card.dueDate) })
12364
+ /* @__PURE__ */ jsx("span", { children: cardDateFormat ? format(card.dueDate, cardDateFormat) : formatDate(card.dueDate) })
11343
12365
  ] }),
11344
12366
  card.checklist && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
11345
12367
  /* @__PURE__ */ jsx(CheckSquare, { className: "h-3 w-3" }),
@@ -11359,9 +12381,9 @@ var KanbanCardComponent = ({
11359
12381
  /* @__PURE__ */ jsx(Paperclip, { className: "h-3 w-3" }),
11360
12382
  /* @__PURE__ */ jsx("span", { children: card.attachments.length })
11361
12383
  ] }),
11362
- card.assignees && card.assignees.length > 0 && /* @__PURE__ */ jsx(MoonUIAvatarGroupPro, { max: 3, size: "xs", children: card.assignees.map((assignee) => /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-5 w-5", children: [
12384
+ cardShowAssignees && card.assignees && card.assignees.length > 0 && /* @__PURE__ */ jsx(MoonUIAvatarGroupPro, { max: cardMaxAssigneesToShow, size: "xs", children: card.assignees.map((assignee) => /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-5 w-5", children: [
11363
12385
  /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: assignee.avatar }),
11364
- /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials(assignee.name) })
12386
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials3(assignee.name) })
11365
12387
  ] }, assignee.id)) })
11366
12388
  ] })
11367
12389
  ] })
@@ -11398,7 +12420,54 @@ function Kanban({
11398
12420
  loading = false,
11399
12421
  disabled = false,
11400
12422
  labels = [],
11401
- users = []
12423
+ users = [],
12424
+ // Card Render Customization
12425
+ renderCard,
12426
+ renderCardPreview,
12427
+ renderCardBadge,
12428
+ renderCardActions,
12429
+ cardCompactMode = false,
12430
+ cardShowCoverImage = true,
12431
+ cardShowAssignees = true,
12432
+ cardShowLabels = true,
12433
+ cardShowProgress = true,
12434
+ cardDateFormat,
12435
+ cardMaxAssigneesToShow = 3,
12436
+ // Add Card Customization
12437
+ renderAddCardButton,
12438
+ renderAddCardForm,
12439
+ addCardButtonText,
12440
+ addCardPosition = "bottom",
12441
+ allowQuickAdd = true,
12442
+ quickAddFields = ["title"],
12443
+ validateCard,
12444
+ onBeforeCardAdd,
12445
+ // Column Customization
12446
+ renderColumnHeader,
12447
+ renderColumnFooter,
12448
+ renderEmptyColumn,
12449
+ columnMenuActions,
12450
+ allowColumnReorder = true,
12451
+ columnColorOptions,
12452
+ columnDefaultColor = "#6B7280",
12453
+ // Drag & Drop Enhancement
12454
+ dragDisabled = false,
12455
+ dropDisabled = false,
12456
+ dragPreview = "card",
12457
+ renderDragPreview,
12458
+ canDrop,
12459
+ onDragStart,
12460
+ onDragEnd,
12461
+ // UI/UX Customization
12462
+ theme = "default",
12463
+ cardVariant = "default",
12464
+ enableAnimations = true,
12465
+ animationDuration = 0.2,
12466
+ columnWidth,
12467
+ columnGap = 24,
12468
+ cardGap = 12,
12469
+ showTooltips = true,
12470
+ tooltipDelay = 500
11402
12471
  }) {
11403
12472
  const { hasProAccess, isLoading } = useSubscription();
11404
12473
  if (!isLoading && !hasProAccess) {
@@ -11422,7 +12491,18 @@ function Kanban({
11422
12491
  const [draggedOverColumn, setDraggedOverColumn] = useState(null);
11423
12492
  const [isCreatingColumn, setIsCreatingColumn] = useState(false);
11424
12493
  const [newColumnTitle, setNewColumnTitle] = useState("");
12494
+ const [selectedCard, setSelectedCard] = useState(null);
12495
+ const [addCardColumnId, setAddCardColumnId] = useState(null);
12496
+ const [editingColumnId, setEditingColumnId] = useState(null);
12497
+ const [editingColumnTitle, setEditingColumnTitle] = useState("");
12498
+ const [wipLimitModalOpen, setWipLimitModalOpen] = useState(false);
12499
+ const [wipLimitColumnId, setWipLimitColumnId] = useState(null);
12500
+ const [wipLimit, setWipLimit] = useState();
12501
+ const [colorPickerOpen, setColorPickerOpen] = useState(false);
12502
+ const [colorPickerColumnId, setColorPickerColumnId] = useState(null);
12503
+ const [selectedColor, setSelectedColor] = useState("#6B7280");
11425
12504
  const { scrollRef, startAutoScroll, stopAutoScroll } = useAutoScroll();
12505
+ const { toast: toast3 } = useToast();
11426
12506
  const filteredColumns = useMemo(() => {
11427
12507
  if (!searchQuery && !activeFilter)
11428
12508
  return columns;
@@ -11478,11 +12558,24 @@ function Kanban({
11478
12558
  const handleDragStart = (card, columnId) => {
11479
12559
  if (disabled)
11480
12560
  return;
12561
+ if (typeof dragDisabled === "function" && dragDisabled(card))
12562
+ return;
12563
+ if (dragDisabled === true)
12564
+ return;
11481
12565
  setDraggedCard(card.id);
12566
+ const column = columns.find((col) => col.id === columnId);
12567
+ if (column && onDragStart) {
12568
+ onDragStart(card, column);
12569
+ }
11482
12570
  };
11483
12571
  const handleDragOver = (e, columnId) => {
11484
12572
  if (disabled)
11485
12573
  return;
12574
+ const column = columns.find((col) => col.id === columnId);
12575
+ if (column && typeof dropDisabled === "function" && dropDisabled(column))
12576
+ return;
12577
+ if (dropDisabled === true)
12578
+ return;
11486
12579
  e.preventDefault();
11487
12580
  setDraggedOverColumn(columnId);
11488
12581
  const container = scrollRef.current;
@@ -11499,6 +12592,13 @@ function Kanban({
11499
12592
  }
11500
12593
  };
11501
12594
  const handleDragEnd = () => {
12595
+ if (draggedCard) {
12596
+ const card = columns.flatMap((col) => col.cards).find((c2) => c2.id === draggedCard);
12597
+ const column = columns.find((col) => col.cards.some((c2) => c2.id === draggedCard));
12598
+ if (card && column && onDragEnd) {
12599
+ onDragEnd(card, column);
12600
+ }
12601
+ }
11502
12602
  setDraggedCard(null);
11503
12603
  setDraggedOverColumn(null);
11504
12604
  stopAutoScroll();
@@ -11507,6 +12607,11 @@ function Kanban({
11507
12607
  if (disabled || !draggedCard || !onCardMove)
11508
12608
  return;
11509
12609
  e.preventDefault();
12610
+ const targetColumn = columns.find((col) => col.id === targetColumnId);
12611
+ const draggedCardObj = columns.flatMap((col) => col.cards).find((card) => card.id === draggedCard);
12612
+ if (targetColumn && draggedCardObj && canDrop && !canDrop(draggedCardObj, targetColumn, targetIndex)) {
12613
+ return;
12614
+ }
11510
12615
  let sourceColumnId = null;
11511
12616
  let sourceCard = null;
11512
12617
  for (const column of columns) {
@@ -11531,15 +12636,208 @@ function Kanban({
11531
12636
  const handleColumnAction = (column, action) => {
11532
12637
  switch (action) {
11533
12638
  case "rename":
12639
+ setEditingColumnId(column.id);
12640
+ setEditingColumnTitle(column.title);
11534
12641
  break;
11535
12642
  case "delete":
11536
12643
  onColumnDelete?.(column.id);
12644
+ toast3({
12645
+ title: "Column deleted",
12646
+ description: `"${column.title}" has been deleted`
12647
+ });
11537
12648
  break;
11538
12649
  case "collapse":
11539
- onColumnUpdate?.({ ...column, collapsed: !column.collapsed });
12650
+ const updatedColumn = { ...column, collapsed: !column.collapsed };
12651
+ onColumnUpdate?.(updatedColumn);
12652
+ setColumns(columns.map((col) => col.id === column.id ? updatedColumn : col));
12653
+ break;
12654
+ case "setLimit":
12655
+ setWipLimitColumnId(column.id);
12656
+ setWipLimit(column.limit);
12657
+ setWipLimitModalOpen(true);
12658
+ break;
12659
+ case "changeColor":
12660
+ setColorPickerColumnId(column.id);
12661
+ setSelectedColor(column.color || "#6B7280");
12662
+ setColorPickerOpen(true);
12663
+ break;
12664
+ case "sortByPriority":
12665
+ const sortedCards = [...column.cards].sort((a, b) => {
12666
+ const priorityOrder = { urgent: 4, high: 3, medium: 2, low: 1 };
12667
+ return (priorityOrder[b.priority || "medium"] || 2) - (priorityOrder[a.priority || "medium"] || 2);
12668
+ });
12669
+ const sortedColumn = { ...column, cards: sortedCards };
12670
+ onColumnUpdate?.(sortedColumn);
12671
+ setColumns(columns.map((col) => col.id === column.id ? sortedColumn : col));
12672
+ toast3({
12673
+ title: "Cards sorted",
12674
+ description: "Cards sorted by priority"
12675
+ });
12676
+ break;
12677
+ case "sortByDueDate":
12678
+ const dateCards = [...column.cards].sort((a, b) => {
12679
+ if (!a.dueDate && !b.dueDate)
12680
+ return 0;
12681
+ if (!a.dueDate)
12682
+ return 1;
12683
+ if (!b.dueDate)
12684
+ return -1;
12685
+ return new Date(a.dueDate).getTime() - new Date(b.dueDate).getTime();
12686
+ });
12687
+ const dateColumn = { ...column, cards: dateCards };
12688
+ onColumnUpdate?.(dateColumn);
12689
+ setColumns(columns.map((col) => col.id === column.id ? dateColumn : col));
12690
+ toast3({
12691
+ title: "Cards sorted",
12692
+ description: "Cards sorted by due date"
12693
+ });
12694
+ break;
12695
+ case "sortAlphabetically":
12696
+ const alphaCards = [...column.cards].sort((a, b) => a.title.localeCompare(b.title));
12697
+ const alphaColumn = { ...column, cards: alphaCards };
12698
+ onColumnUpdate?.(alphaColumn);
12699
+ setColumns(columns.map((col) => col.id === column.id ? alphaColumn : col));
12700
+ toast3({
12701
+ title: "Cards sorted",
12702
+ description: "Cards sorted alphabetically"
12703
+ });
11540
12704
  break;
11541
12705
  }
11542
12706
  };
12707
+ const handleCardClick = (card) => {
12708
+ if (onCardClick) {
12709
+ onCardClick(card);
12710
+ } else {
12711
+ setSelectedCard(card);
12712
+ }
12713
+ };
12714
+ const handleCardUpdate = (updatedCard) => {
12715
+ onCardUpdate?.(updatedCard);
12716
+ setColumns(columns.map((col) => ({
12717
+ ...col,
12718
+ cards: col.cards.map((card) => card.id === updatedCard.id ? updatedCard : card)
12719
+ })));
12720
+ };
12721
+ const handleAddCard = (columnId, newCard) => {
12722
+ if (onAddCard) {
12723
+ onAddCard(columnId, newCard);
12724
+ } else {
12725
+ setAddCardColumnId(columnId);
12726
+ }
12727
+ };
12728
+ const handleAddNewCard = (card) => {
12729
+ if (!addCardColumnId)
12730
+ return;
12731
+ const newCard = {
12732
+ id: Date.now().toString(),
12733
+ title: card.title || "New Card",
12734
+ position: Date.now(),
12735
+ ...card
12736
+ };
12737
+ setColumns(columns.map((col) => {
12738
+ if (col.id === addCardColumnId) {
12739
+ return {
12740
+ ...col,
12741
+ cards: [...col.cards, newCard]
12742
+ };
12743
+ }
12744
+ return col;
12745
+ }));
12746
+ onAddCard?.(addCardColumnId, newCard);
12747
+ toast3({
12748
+ title: "Card added",
12749
+ description: `"${newCard.title}" has been added`
12750
+ });
12751
+ };
12752
+ const handleColumnRename = (columnId) => {
12753
+ const column = columns.find((col) => col.id === columnId);
12754
+ if (!column || !editingColumnTitle.trim())
12755
+ return;
12756
+ const updatedColumn = { ...column, title: editingColumnTitle.trim() };
12757
+ onColumnUpdate?.(updatedColumn);
12758
+ setColumns(columns.map((col) => col.id === columnId ? updatedColumn : col));
12759
+ setEditingColumnId(null);
12760
+ setEditingColumnTitle("");
12761
+ toast3({
12762
+ title: "Column renamed",
12763
+ description: `Column renamed to "${editingColumnTitle.trim()}"`
12764
+ });
12765
+ };
12766
+ const handleWipLimitUpdate = () => {
12767
+ const column = columns.find((col) => col.id === wipLimitColumnId);
12768
+ if (!column)
12769
+ return;
12770
+ const updatedColumn = { ...column, limit: wipLimit };
12771
+ onColumnUpdate?.(updatedColumn);
12772
+ setColumns(columns.map((col) => col.id === wipLimitColumnId ? updatedColumn : col));
12773
+ setWipLimitModalOpen(false);
12774
+ toast3({
12775
+ title: "WIP limit updated",
12776
+ description: wipLimit ? `WIP limit set to ${wipLimit}` : "WIP limit removed"
12777
+ });
12778
+ };
12779
+ const handleColorUpdate = () => {
12780
+ const column = columns.find((col) => col.id === colorPickerColumnId);
12781
+ if (!column)
12782
+ return;
12783
+ const updatedColumn = { ...column, color: selectedColor };
12784
+ onColumnUpdate?.(updatedColumn);
12785
+ setColumns(columns.map((col) => col.id === colorPickerColumnId ? updatedColumn : col));
12786
+ setColorPickerOpen(false);
12787
+ toast3({
12788
+ title: "Column color updated",
12789
+ description: "Column color has been changed"
12790
+ });
12791
+ };
12792
+ const handleExport = (format6) => {
12793
+ if (onExport) {
12794
+ onExport(format6);
12795
+ } else {
12796
+ if (format6 === "json") {
12797
+ const data = JSON.stringify(columns, null, 2);
12798
+ const blob = new Blob([data], { type: "application/json" });
12799
+ const url = URL.createObjectURL(blob);
12800
+ const a = document.createElement("a");
12801
+ a.href = url;
12802
+ a.download = "kanban-board.json";
12803
+ document.body.appendChild(a);
12804
+ a.click();
12805
+ document.body.removeChild(a);
12806
+ URL.revokeObjectURL(url);
12807
+ toast3({
12808
+ title: "Board exported",
12809
+ description: "Board exported as JSON file"
12810
+ });
12811
+ } else if (format6 === "csv") {
12812
+ let csv = "Column,Card Title,Description,Priority,Assignees,Due Date,Tags\n";
12813
+ columns.forEach((column) => {
12814
+ column.cards.forEach((card) => {
12815
+ csv += `"${column.title}",`;
12816
+ csv += `"${card.title}",`;
12817
+ csv += `"${card.description || ""}",`;
12818
+ csv += `"${card.priority || ""}",`;
12819
+ csv += `"${card.assignees?.map((a2) => a2.name).join(", ") || ""}",`;
12820
+ csv += `"${card.dueDate ? new Date(card.dueDate).toLocaleDateString() : ""}",`;
12821
+ csv += `"${card.tags?.join(", ") || ""}"
12822
+ `;
12823
+ });
12824
+ });
12825
+ const blob = new Blob([csv], { type: "text/csv" });
12826
+ const url = URL.createObjectURL(blob);
12827
+ const a = document.createElement("a");
12828
+ a.href = url;
12829
+ a.download = "kanban-board.csv";
12830
+ document.body.appendChild(a);
12831
+ a.click();
12832
+ document.body.removeChild(a);
12833
+ URL.revokeObjectURL(url);
12834
+ toast3({
12835
+ title: "Board exported",
12836
+ description: "Board exported as CSV file"
12837
+ });
12838
+ }
12839
+ }
12840
+ };
11543
12841
  if (loading) {
11544
12842
  return /* @__PURE__ */ jsx("div", { className: cn("w-full", className), children: /* @__PURE__ */ jsx("div", { className: "flex gap-6 overflow-x-auto pb-4", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx("div", { className: "flex-shrink-0 w-80", children: /* @__PURE__ */ jsxs(MoonUICardPro, { children: [
11545
12843
  /* @__PURE__ */ jsx(MoonUICardHeaderPro, { children: /* @__PURE__ */ jsx(MoonUISkeletonPro, { className: "h-4 w-24" }) }),
@@ -11620,14 +12918,14 @@ function Kanban({
11620
12918
  ] })
11621
12919
  ] })
11622
12920
  ] }),
11623
- onExport && /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
12921
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
11624
12922
  /* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsxs(MoonUIButtonPro, { variant: "outline", size: "sm", children: [
11625
12923
  /* @__PURE__ */ jsx(Download, { className: "mr-2 h-4 w-4" }),
11626
12924
  "Export"
11627
12925
  ] }) }),
11628
12926
  /* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { align: "end", children: [
11629
- /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => onExport("json"), children: "Export as JSON" }),
11630
- /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => onExport("csv"), children: "Export as CSV" })
12927
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => handleExport("json"), children: "Export as JSON" }),
12928
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => handleExport("csv"), children: "Export as CSV" })
11631
12929
  ] })
11632
12930
  ] })
11633
12931
  ] })
@@ -11653,7 +12951,8 @@ function Kanban({
11653
12951
  "div",
11654
12952
  {
11655
12953
  ref: scrollRef,
11656
- className: "flex gap-6 overflow-x-auto pb-4",
12954
+ className: "flex overflow-x-auto pb-4",
12955
+ style: { gap: `${columnGap}px` },
11657
12956
  onDragOver: (e) => e.preventDefault(),
11658
12957
  children: [
11659
12958
  /* @__PURE__ */ jsx(AnimatePresence, { mode: "sync", children: filteredColumns.map((column) => {
@@ -11662,14 +12961,19 @@ function Kanban({
11662
12961
  return /* @__PURE__ */ jsx(
11663
12962
  motion.div,
11664
12963
  {
11665
- layout: true,
11666
- initial: { opacity: 0, x: -20 },
12964
+ layout: enableAnimations,
12965
+ initial: { opacity: enableAnimations ? 0 : 1, x: enableAnimations ? -20 : 0 },
11667
12966
  animate: { opacity: 1, x: 0 },
11668
- exit: { opacity: 0, x: 20 },
12967
+ exit: { opacity: enableAnimations ? 0 : 1, x: enableAnimations ? 20 : 0 },
11669
12968
  className: cn(
11670
- "flex-shrink-0 w-80 transition-all duration-200",
12969
+ "flex-shrink-0 transition-all",
11671
12970
  isDraggedOver && "scale-105"
11672
12971
  ),
12972
+ style: {
12973
+ width: columnWidth === "auto" ? "auto" : (columnWidth || 320) + "px",
12974
+ minWidth: columnWidth === "auto" ? "300px" : void 0,
12975
+ transitionDuration: enableAnimations ? `${animationDuration}s` : "0s"
12976
+ },
11673
12977
  onDragOver: (e) => handleDragOver(e, column.id),
11674
12978
  onDragLeave: () => setDraggedOverColumn(null),
11675
12979
  onDrop: (e) => handleDrop(e, column.id, column.cards.length),
@@ -11678,7 +12982,7 @@ function Kanban({
11678
12982
  isDraggedOver && "ring-2 ring-primary ring-offset-2 bg-primary/5",
11679
12983
  column.collapsed && "opacity-60"
11680
12984
  ), children: [
11681
- /* @__PURE__ */ jsxs(MoonUICardHeaderPro, { className: "pb-3", children: [
12985
+ /* @__PURE__ */ jsx(MoonUICardHeaderPro, { className: "pb-3", children: renderColumnHeader ? renderColumnHeader(column) : /* @__PURE__ */ jsxs(Fragment, { children: [
11682
12986
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
11683
12987
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
11684
12988
  column.color && /* @__PURE__ */ jsx(
@@ -11688,15 +12992,48 @@ function Kanban({
11688
12992
  style: { backgroundColor: column.color }
11689
12993
  }
11690
12994
  ),
11691
- /* @__PURE__ */ jsxs(MoonUICardTitlePro, { className: "text-sm font-medium flex items-center gap-2", children: [
12995
+ /* @__PURE__ */ jsx(MoonUICardTitlePro, { className: "text-sm font-medium flex items-center gap-2", children: editingColumnId === column.id ? /* @__PURE__ */ jsx(
12996
+ MoonUIInputPro,
12997
+ {
12998
+ value: editingColumnTitle,
12999
+ onChange: (e) => setEditingColumnTitle(e.target.value),
13000
+ onBlur: () => handleColumnRename(column.id),
13001
+ onKeyDown: (e) => {
13002
+ if (e.key === "Enter") {
13003
+ handleColumnRename(column.id);
13004
+ }
13005
+ if (e.key === "Escape") {
13006
+ setEditingColumnId(null);
13007
+ setEditingColumnTitle("");
13008
+ }
13009
+ },
13010
+ className: "h-6 w-32 text-sm",
13011
+ autoFocus: true,
13012
+ onClick: (e) => e.stopPropagation()
13013
+ }
13014
+ ) : /* @__PURE__ */ jsxs(Fragment, { children: [
11692
13015
  column.title,
11693
13016
  column.locked && /* @__PURE__ */ jsx(Lock, { className: "h-3 w-3" })
11694
- ] }),
13017
+ ] }) }),
11695
13018
  /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", className: "text-xs", children: column.cards.length })
11696
13019
  ] }),
11697
13020
  /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
11698
13021
  /* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "ghost", size: "sm", className: "h-6 w-6 p-0", children: /* @__PURE__ */ jsx(MoreHorizontal, { className: "h-4 w-4" }) }) }),
11699
- /* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { align: "end", children: [
13022
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuContentPro, { align: "end", children: columnMenuActions ? columnMenuActions.map((action, index2) => {
13023
+ if (action.visible && !action.visible(column))
13024
+ return null;
13025
+ return /* @__PURE__ */ jsxs(
13026
+ MoonUIDropdownMenuItemPro,
13027
+ {
13028
+ onClick: () => action.action(column),
13029
+ children: [
13030
+ action.icon || null,
13031
+ action.label
13032
+ ]
13033
+ },
13034
+ index2
13035
+ );
13036
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
11700
13037
  /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleColumnAction(column, "rename"), children: [
11701
13038
  /* @__PURE__ */ jsx(Edit, { className: "mr-2 h-4 w-4" }),
11702
13039
  "Rename"
@@ -11719,13 +13056,20 @@ function Kanban({
11719
13056
  /* @__PURE__ */ jsx(Timer, { className: "mr-2 h-4 w-4" }),
11720
13057
  "Set WIP limit"
11721
13058
  ] }),
11722
- /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { children: [
13059
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleColumnAction(column, "changeColor"), children: [
11723
13060
  /* @__PURE__ */ jsx(Palette, { className: "mr-2 h-4 w-4" }),
11724
13061
  "Change color"
11725
13062
  ] }),
11726
- /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { children: [
11727
- /* @__PURE__ */ jsx(ArrowUpDown, { className: "mr-2 h-4 w-4" }),
11728
- "Sort cards"
13063
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuSubPro, { children: [
13064
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuSubTriggerPro, { children: [
13065
+ /* @__PURE__ */ jsx(ArrowUpDown, { className: "mr-2 h-4 w-4" }),
13066
+ "Sort cards"
13067
+ ] }),
13068
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuSubContentPro, { children: [
13069
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => handleColumnAction(column, "sortByPriority"), children: "By Priority" }),
13070
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => handleColumnAction(column, "sortByDueDate"), children: "By Due Date" }),
13071
+ /* @__PURE__ */ jsx(MoonUIDropdownMenuItemPro, { onClick: () => handleColumnAction(column, "sortAlphabetically"), children: "Alphabetically" })
13072
+ ] })
11729
13073
  ] })
11730
13074
  ] })
11731
13075
  ] }),
@@ -11741,7 +13085,7 @@ function Kanban({
11741
13085
  ]
11742
13086
  }
11743
13087
  )
11744
- ] })
13088
+ ] }) })
11745
13089
  ] })
11746
13090
  ] }),
11747
13091
  column.limit && /* @__PURE__ */ jsx(MoonUICardDescriptionPro, { className: cn(
@@ -11755,12 +13099,12 @@ function Kanban({
11755
13099
  column.limit,
11756
13100
  ")"
11757
13101
  ] }) : `WIP limit: ${column.cards.length}/${column.limit}` })
11758
- ] }),
11759
- !column.collapsed && /* @__PURE__ */ jsxs(MoonUICardContentPro, { className: "space-y-3", children: [
11760
- /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-300px)]", children: /* @__PURE__ */ jsx(AnimatePresence, { mode: "popLayout", children: column.cards.sort((a, b) => a.position - b.position).map((card, index2) => /* @__PURE__ */ jsx(
13102
+ ] }) }),
13103
+ !column.collapsed && /* @__PURE__ */ jsxs(MoonUICardContentPro, { className: "space-y-3", style: { gap: `${cardGap}px` }, children: [
13104
+ /* @__PURE__ */ jsx(ScrollArea, { className: "h-[calc(100vh-300px)]", children: column.cards.length === 0 && renderEmptyColumn ? renderEmptyColumn(column) : /* @__PURE__ */ jsx(AnimatePresence, { mode: enableAnimations ? "popLayout" : void 0, children: column.cards.sort((a, b) => a.position - b.position).map((card, index2) => /* @__PURE__ */ jsx(
11761
13105
  "div",
11762
13106
  {
11763
- draggable: !disabled,
13107
+ draggable: !disabled && (typeof dragDisabled === "function" ? !dragDisabled(card) : !dragDisabled),
11764
13108
  onDragStart: () => handleDragStart(card, column.id),
11765
13109
  onDragEnd: handleDragEnd,
11766
13110
  onDrop: (e) => {
@@ -11773,6 +13117,7 @@ function Kanban({
11773
13117
  KanbanCardComponent,
11774
13118
  {
11775
13119
  card,
13120
+ column,
11776
13121
  isDragging: draggedCard === card.id,
11777
13122
  onEdit: (e) => {
11778
13123
  e.stopPropagation();
@@ -11782,15 +13127,29 @@ function Kanban({
11782
13127
  e.stopPropagation();
11783
13128
  onCardDelete?.(card);
11784
13129
  },
11785
- onClick: () => onCardClick?.(card),
13130
+ onClick: () => handleCardClick(card),
11786
13131
  showDetails: showCardDetails,
11787
- disabled
13132
+ disabled,
13133
+ renderCard,
13134
+ renderCardPreview,
13135
+ renderCardBadge,
13136
+ renderCardActions,
13137
+ cardCompactMode,
13138
+ cardShowCoverImage,
13139
+ cardShowAssignees,
13140
+ cardShowLabels,
13141
+ cardShowProgress,
13142
+ cardDateFormat,
13143
+ cardMaxAssigneesToShow,
13144
+ enableAnimations,
13145
+ animationDuration,
13146
+ cardVariant
11788
13147
  }
11789
13148
  )
11790
13149
  },
11791
13150
  card.id
11792
13151
  )) }) }),
11793
- onAddCard && !column.locked && !isOverLimit && /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
13152
+ onAddCard && !column.locked && !isOverLimit && (renderAddCardButton ? renderAddCardButton(column.id) : /* @__PURE__ */ jsxs(MoonUIDropdownMenuPro, { children: [
11794
13153
  /* @__PURE__ */ jsx(MoonUIDropdownMenuTriggerPro, { asChild: true, children: /* @__PURE__ */ jsxs(
11795
13154
  MoonUIButtonPro,
11796
13155
  {
@@ -11800,21 +13159,21 @@ function Kanban({
11800
13159
  disabled,
11801
13160
  children: [
11802
13161
  /* @__PURE__ */ jsx(Plus, { className: "h-4 w-4 mr-2" }),
11803
- "Add card"
13162
+ typeof addCardButtonText === "function" ? addCardButtonText(column.id) : addCardButtonText || "Add card"
11804
13163
  ]
11805
13164
  }
11806
13165
  ) }),
11807
13166
  /* @__PURE__ */ jsxs(MoonUIDropdownMenuContentPro, { align: "start", className: "w-48", children: [
11808
13167
  /* @__PURE__ */ jsx(MoonUIDropdownMenuLabelPro, { children: "Card Templates" }),
11809
13168
  /* @__PURE__ */ jsx(MoonUIDropdownMenuSeparatorPro, {}),
11810
- /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => onAddCard(column.id), children: [
13169
+ /* @__PURE__ */ jsxs(MoonUIDropdownMenuItemPro, { onClick: () => handleAddCard(column.id), children: [
11811
13170
  /* @__PURE__ */ jsx(FileText, { className: "mr-2 h-4 w-4" }),
11812
13171
  "Blank card"
11813
13172
  ] }),
11814
13173
  cardTemplates.map((template, index2) => /* @__PURE__ */ jsxs(
11815
13174
  MoonUIDropdownMenuItemPro,
11816
13175
  {
11817
- onClick: () => onAddCard(column.id, template),
13176
+ onClick: () => handleAddCard(column.id, template),
11818
13177
  children: [
11819
13178
  /* @__PURE__ */ jsx(Star, { className: "mr-2 h-4 w-4" }),
11820
13179
  template.title || `Template ${index2 + 1}`
@@ -11823,7 +13182,8 @@ function Kanban({
11823
13182
  index2
11824
13183
  ))
11825
13184
  ] })
11826
- ] })
13185
+ ] })),
13186
+ renderColumnFooter && renderColumnFooter(column)
11827
13187
  ] })
11828
13188
  ] })
11829
13189
  },
@@ -11934,7 +13294,101 @@ function Kanban({
11934
13294
  )
11935
13295
  ]
11936
13296
  }
11937
- )
13297
+ ),
13298
+ selectedCard && /* @__PURE__ */ jsx(
13299
+ CardDetailModal,
13300
+ {
13301
+ card: selectedCard,
13302
+ isOpen: !!selectedCard,
13303
+ onClose: () => setSelectedCard(null),
13304
+ onUpdate: handleCardUpdate,
13305
+ onDelete: (card) => {
13306
+ onCardDelete?.(card);
13307
+ toast3({
13308
+ title: "Card deleted",
13309
+ description: `"${card.title}" has been deleted`
13310
+ });
13311
+ },
13312
+ availableAssignees: users,
13313
+ availableLabels: labels,
13314
+ currentColumn: columns.find((col) => col.cards.some((c2) => c2.id === selectedCard.id))?.title,
13315
+ availableColumns: columns.map((col) => ({ id: col.id, title: col.title }))
13316
+ }
13317
+ ),
13318
+ addCardColumnId && /* @__PURE__ */ jsx(
13319
+ AddCardModal,
13320
+ {
13321
+ isOpen: !!addCardColumnId,
13322
+ onClose: () => setAddCardColumnId(null),
13323
+ onAdd: handleAddNewCard,
13324
+ columnId: addCardColumnId,
13325
+ columnTitle: columns.find((col) => col.id === addCardColumnId)?.title || "",
13326
+ availableAssignees: users,
13327
+ availableLabels: labels,
13328
+ templates: cardTemplates
13329
+ }
13330
+ ),
13331
+ /* @__PURE__ */ jsx(MoonUIDialogPro, { open: wipLimitModalOpen, onOpenChange: setWipLimitModalOpen, children: /* @__PURE__ */ jsxs(MoonUIDialogContentPro, { className: "sm:max-w-md", children: [
13332
+ /* @__PURE__ */ jsx(MoonUIDialogHeaderPro, { children: /* @__PURE__ */ jsx(MoonUIDialogTitlePro, { children: "Set WIP Limit" }) }),
13333
+ /* @__PURE__ */ jsx("div", { className: "space-y-4 py-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
13334
+ /* @__PURE__ */ jsx(MoonUILabelPro, { htmlFor: "wip-limit", children: "Work In Progress Limit" }),
13335
+ /* @__PURE__ */ jsx(
13336
+ MoonUIInputPro,
13337
+ {
13338
+ id: "wip-limit",
13339
+ type: "number",
13340
+ min: "0",
13341
+ value: wipLimit || "",
13342
+ onChange: (e) => setWipLimit(e.target.value ? parseInt(e.target.value) : void 0),
13343
+ placeholder: "Enter a number (leave empty to remove limit)"
13344
+ }
13345
+ ),
13346
+ /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "Set a maximum number of cards allowed in this column. Leave empty to remove the limit." })
13347
+ ] }) }),
13348
+ /* @__PURE__ */ jsxs(MoonUIDialogFooterPro, { children: [
13349
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", onClick: () => setWipLimitModalOpen(false), children: "Cancel" }),
13350
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { onClick: handleWipLimitUpdate, children: "Save" })
13351
+ ] })
13352
+ ] }) }),
13353
+ /* @__PURE__ */ jsx(MoonUIDialogPro, { open: colorPickerOpen, onOpenChange: setColorPickerOpen, children: /* @__PURE__ */ jsxs(MoonUIDialogContentPro, { className: "sm:max-w-md", children: [
13354
+ /* @__PURE__ */ jsx(MoonUIDialogHeaderPro, { children: /* @__PURE__ */ jsx(MoonUIDialogTitlePro, { children: "Change Column Color" }) }),
13355
+ /* @__PURE__ */ jsx("div", { className: "space-y-4 py-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
13356
+ /* @__PURE__ */ jsx(MoonUILabelPro, { children: "Select a color" }),
13357
+ /* @__PURE__ */ jsx("div", { className: "grid grid-cols-8 gap-2", children: [
13358
+ "#6B7280",
13359
+ "#EF4444",
13360
+ "#F59E0B",
13361
+ "#10B981",
13362
+ "#3B82F6",
13363
+ "#8B5CF6",
13364
+ "#EC4899",
13365
+ "#06B6D4",
13366
+ "#F43F5E",
13367
+ "#84CC16",
13368
+ "#14B8A6",
13369
+ "#6366F1",
13370
+ "#A855F7",
13371
+ "#F472B6",
13372
+ "#0EA5E9",
13373
+ "#22D3EE"
13374
+ ].map((color) => /* @__PURE__ */ jsx(
13375
+ "button",
13376
+ {
13377
+ className: cn(
13378
+ "w-10 h-10 rounded-md border-2 transition-all",
13379
+ selectedColor === color ? "border-primary scale-110" : "border-transparent"
13380
+ ),
13381
+ style: { backgroundColor: color },
13382
+ onClick: () => setSelectedColor(color)
13383
+ },
13384
+ color
13385
+ )) })
13386
+ ] }) }),
13387
+ /* @__PURE__ */ jsxs(MoonUIDialogFooterPro, { children: [
13388
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { variant: "outline", onClick: () => setColorPickerOpen(false), children: "Cancel" }),
13389
+ /* @__PURE__ */ jsx(MoonUIButtonPro, { onClick: handleColorUpdate, children: "Save" })
13390
+ ] })
13391
+ ] }) })
11938
13392
  ] });
11939
13393
  }
11940
13394
 
@@ -12120,7 +13574,7 @@ function findDiffEnd(a, b, posA, posB) {
12120
13574
  posB -= size4;
12121
13575
  }
12122
13576
  }
12123
- var Fragment5 = class {
13577
+ var Fragment7 = class {
12124
13578
  /**
12125
13579
  @internal
12126
13580
  */
@@ -12188,7 +13642,7 @@ var Fragment5 = class {
12188
13642
  }
12189
13643
  for (; i < other.content.length; i++)
12190
13644
  content.push(other.content[i]);
12191
- return new Fragment5(content, this.size + other.size);
13645
+ return new Fragment7(content, this.size + other.size);
12192
13646
  }
12193
13647
  /**
12194
13648
  Cut out the sub-fragment between the two given positions.
@@ -12212,17 +13666,17 @@ var Fragment5 = class {
12212
13666
  }
12213
13667
  pos = end;
12214
13668
  }
12215
- return new Fragment5(result, size4);
13669
+ return new Fragment7(result, size4);
12216
13670
  }
12217
13671
  /**
12218
13672
  @internal
12219
13673
  */
12220
13674
  cutByIndex(from2, to) {
12221
13675
  if (from2 == to)
12222
- return Fragment5.empty;
13676
+ return Fragment7.empty;
12223
13677
  if (from2 == 0 && to == this.content.length)
12224
13678
  return this;
12225
- return new Fragment5(this.content.slice(from2, to));
13679
+ return new Fragment7(this.content.slice(from2, to));
12226
13680
  }
12227
13681
  /**
12228
13682
  Create a new fragment in which the node at the given index is
@@ -12235,21 +13689,21 @@ var Fragment5 = class {
12235
13689
  let copy2 = this.content.slice();
12236
13690
  let size4 = this.size + node.nodeSize - current.nodeSize;
12237
13691
  copy2[index2] = node;
12238
- return new Fragment5(copy2, size4);
13692
+ return new Fragment7(copy2, size4);
12239
13693
  }
12240
13694
  /**
12241
13695
  Create a new fragment by prepending the given node to this
12242
13696
  fragment.
12243
13697
  */
12244
13698
  addToStart(node) {
12245
- return new Fragment5([node].concat(this.content), this.size + node.nodeSize);
13699
+ return new Fragment7([node].concat(this.content), this.size + node.nodeSize);
12246
13700
  }
12247
13701
  /**
12248
13702
  Create a new fragment by appending the given node to this
12249
13703
  fragment.
12250
13704
  */
12251
13705
  addToEnd(node) {
12252
- return new Fragment5(this.content.concat(node), this.size + node.nodeSize);
13706
+ return new Fragment7(this.content.concat(node), this.size + node.nodeSize);
12253
13707
  }
12254
13708
  /**
12255
13709
  Compare this fragment to another one.
@@ -12368,10 +13822,10 @@ var Fragment5 = class {
12368
13822
  */
12369
13823
  static fromJSON(schema, value) {
12370
13824
  if (!value)
12371
- return Fragment5.empty;
13825
+ return Fragment7.empty;
12372
13826
  if (!Array.isArray(value))
12373
13827
  throw new RangeError("Invalid input for Fragment.fromJSON");
12374
- return new Fragment5(value.map(schema.nodeFromJSON));
13828
+ return new Fragment7(value.map(schema.nodeFromJSON));
12375
13829
  }
12376
13830
  /**
12377
13831
  Build a fragment from an array of nodes. Ensures that adjacent
@@ -12379,7 +13833,7 @@ var Fragment5 = class {
12379
13833
  */
12380
13834
  static fromArray(array) {
12381
13835
  if (!array.length)
12382
- return Fragment5.empty;
13836
+ return Fragment7.empty;
12383
13837
  let joined, size4 = 0;
12384
13838
  for (let i = 0; i < array.length; i++) {
12385
13839
  let node = array[i];
@@ -12392,7 +13846,7 @@ var Fragment5 = class {
12392
13846
  joined.push(node);
12393
13847
  }
12394
13848
  }
12395
- return new Fragment5(joined || array, size4);
13849
+ return new Fragment7(joined || array, size4);
12396
13850
  }
12397
13851
  /**
12398
13852
  Create a fragment from something that can be interpreted as a
@@ -12402,17 +13856,17 @@ var Fragment5 = class {
12402
13856
  */
12403
13857
  static from(nodes) {
12404
13858
  if (!nodes)
12405
- return Fragment5.empty;
12406
- if (nodes instanceof Fragment5)
13859
+ return Fragment7.empty;
13860
+ if (nodes instanceof Fragment7)
12407
13861
  return nodes;
12408
13862
  if (Array.isArray(nodes))
12409
13863
  return this.fromArray(nodes);
12410
13864
  if (nodes.attrs)
12411
- return new Fragment5([nodes], nodes.nodeSize);
13865
+ return new Fragment7([nodes], nodes.nodeSize);
12412
13866
  throw new RangeError("Can not convert " + nodes + " to a Fragment" + (nodes.nodesBetween ? " (looks like multiple versions of prosemirror-model were loaded)" : ""));
12413
13867
  }
12414
13868
  };
12415
- Fragment5.empty = new Fragment5([], 0);
13869
+ Fragment7.empty = new Fragment7([], 0);
12416
13870
  var found = { index: 0, offset: 0 };
12417
13871
  function retIndex(index2, offset4) {
12418
13872
  found.index = index2;
@@ -12637,7 +14091,7 @@ var Slice = class {
12637
14091
  let openStart = json2.openStart || 0, openEnd = json2.openEnd || 0;
12638
14092
  if (typeof openStart != "number" || typeof openEnd != "number")
12639
14093
  throw new RangeError("Invalid input for Slice.fromJSON");
12640
- return new Slice(Fragment5.fromJSON(schema, json2.content), openStart, openEnd);
14094
+ return new Slice(Fragment7.fromJSON(schema, json2.content), openStart, openEnd);
12641
14095
  }
12642
14096
  /**
12643
14097
  Create a slice from a fragment by taking the maximum possible
@@ -12652,7 +14106,7 @@ var Slice = class {
12652
14106
  return new Slice(fragment, openStart, openEnd);
12653
14107
  }
12654
14108
  };
12655
- Slice.empty = new Slice(Fragment5.empty, 0, 0);
14109
+ Slice.empty = new Slice(Fragment7.empty, 0, 0);
12656
14110
  function removeRange(content, from2, to) {
12657
14111
  let { index: index2, offset: offset4 } = content.findIndex(from2), child = content.maybeChild(index2);
12658
14112
  let { index: indexTo, offset: offsetTo } = content.findIndex(to);
@@ -12750,7 +14204,7 @@ function replaceThreeWay($from, $start, $end, $to, depth) {
12750
14204
  addNode(close(openEnd, replaceTwoWay($end, $to, depth + 1)), content);
12751
14205
  }
12752
14206
  addRange($to, null, depth, content);
12753
- return new Fragment5(content);
14207
+ return new Fragment7(content);
12754
14208
  }
12755
14209
  function replaceTwoWay($from, $to, depth) {
12756
14210
  let content = [];
@@ -12760,13 +14214,13 @@ function replaceTwoWay($from, $to, depth) {
12760
14214
  addNode(close(type, replaceTwoWay($from, $to, depth + 1)), content);
12761
14215
  }
12762
14216
  addRange($to, null, depth, content);
12763
- return new Fragment5(content);
14217
+ return new Fragment7(content);
12764
14218
  }
12765
14219
  function prepareSliceForReplace(slice2, $along) {
12766
14220
  let extra = $along.depth - slice2.openStart, parent = $along.node(extra);
12767
14221
  let node = parent.copy(slice2.content);
12768
14222
  for (let i = extra - 1; i >= 0; i--)
12769
- node = $along.node(i).copy(Fragment5.from(node));
14223
+ node = $along.node(i).copy(Fragment7.from(node));
12770
14224
  return {
12771
14225
  start: node.resolveNoCache(slice2.openStart + extra),
12772
14226
  end: node.resolveNoCache(node.content.size - slice2.openEnd - extra)
@@ -13105,7 +14559,7 @@ var Node2 = class {
13105
14559
  this.type = type;
13106
14560
  this.attrs = attrs;
13107
14561
  this.marks = marks;
13108
- this.content = content || Fragment5.empty;
14562
+ this.content = content || Fragment7.empty;
13109
14563
  }
13110
14564
  /**
13111
14565
  The array of this node's child nodes.
@@ -13410,7 +14864,7 @@ var Node2 = class {
13410
14864
  can optionally pass `start` and `end` indices into the
13411
14865
  replacement fragment.
13412
14866
  */
13413
- canReplace(from2, to, replacement = Fragment5.empty, start = 0, end = replacement.childCount) {
14867
+ canReplace(from2, to, replacement = Fragment7.empty, start = 0, end = replacement.childCount) {
13414
14868
  let one = this.contentMatchAt(from2).matchFragment(replacement, start, end);
13415
14869
  let two = one && one.matchFragment(this.content, to);
13416
14870
  if (!two || !two.validEnd)
@@ -13492,7 +14946,7 @@ var Node2 = class {
13492
14946
  throw new RangeError("Invalid text node in JSON");
13493
14947
  return schema.text(json2.text, marks);
13494
14948
  }
13495
- let content = Fragment5.fromJSON(schema, json2.content);
14949
+ let content = Fragment7.fromJSON(schema, json2.content);
13496
14950
  let node = schema.nodeType(json2.type).create(json2.attrs, content, marks);
13497
14951
  node.type.checkAttrs(node.attrs);
13498
14952
  return node;
@@ -13634,7 +15088,7 @@ var ContentMatch = class {
13634
15088
  function search(match, types) {
13635
15089
  let finished = match.matchFragment(after, startIndex);
13636
15090
  if (finished && (!toEnd || finished.validEnd))
13637
- return Fragment5.from(types.map((tp) => tp.createAndFill()));
15091
+ return Fragment7.from(types.map((tp) => tp.createAndFill()));
13638
15092
  for (let i = 0; i < match.next.length; i++) {
13639
15093
  let { type, next } = match.next[i];
13640
15094
  if (!(type.isText || type.hasRequiredAttrs()) && seen.indexOf(next) == -1) {
@@ -14086,7 +15540,7 @@ var NodeType = class {
14086
15540
  create(attrs = null, content, marks) {
14087
15541
  if (this.isText)
14088
15542
  throw new Error("NodeType.create can't construct text nodes");
14089
- return new Node2(this, this.computeAttrs(attrs), Fragment5.from(content), Mark.setFrom(marks));
15543
+ return new Node2(this, this.computeAttrs(attrs), Fragment7.from(content), Mark.setFrom(marks));
14090
15544
  }
14091
15545
  /**
14092
15546
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
@@ -14094,7 +15548,7 @@ var NodeType = class {
14094
15548
  if it doesn't match.
14095
15549
  */
14096
15550
  createChecked(attrs = null, content, marks) {
14097
- content = Fragment5.from(content);
15551
+ content = Fragment7.from(content);
14098
15552
  this.checkContent(content);
14099
15553
  return new Node2(this, this.computeAttrs(attrs), content, Mark.setFrom(marks));
14100
15554
  }
@@ -14108,7 +15562,7 @@ var NodeType = class {
14108
15562
  */
14109
15563
  createAndFill(attrs = null, content, marks) {
14110
15564
  attrs = this.computeAttrs(attrs);
14111
- content = Fragment5.from(content);
15565
+ content = Fragment7.from(content);
14112
15566
  if (content.size) {
14113
15567
  let before = this.contentMatch.fillBefore(content);
14114
15568
  if (!before)
@@ -14116,7 +15570,7 @@ var NodeType = class {
14116
15570
  content = before.append(content);
14117
15571
  }
14118
15572
  let matched = this.contentMatch.matchFragment(content);
14119
- let after = matched && matched.fillBefore(Fragment5.empty, true);
15573
+ let after = matched && matched.fillBefore(Fragment7.empty, true);
14120
15574
  if (!after)
14121
15575
  return null;
14122
15576
  return new Node2(this, attrs, content.append(after), Mark.setFrom(marks));
@@ -14580,7 +16034,7 @@ var NodeContext = class {
14580
16034
  if (!this.match) {
14581
16035
  if (!this.type)
14582
16036
  return [];
14583
- let fill = this.type.contentMatch.fillBefore(Fragment5.from(node));
16037
+ let fill = this.type.contentMatch.fillBefore(Fragment7.from(node));
14584
16038
  if (fill) {
14585
16039
  this.match = this.type.contentMatch.matchFragment(fill);
14586
16040
  } else {
@@ -14606,9 +16060,9 @@ var NodeContext = class {
14606
16060
  this.content[this.content.length - 1] = text.withText(text.text.slice(0, text.text.length - m2[0].length));
14607
16061
  }
14608
16062
  }
14609
- let content = Fragment5.from(this.content);
16063
+ let content = Fragment7.from(this.content);
14610
16064
  if (!openEnd && this.match)
14611
- content = content.append(this.match.fillBefore(Fragment5.empty, true));
16065
+ content = content.append(this.match.fillBefore(Fragment7.empty, true));
14612
16066
  return this.type ? this.type.create(this.attrs, content, this.marks) : content;
14613
16067
  }
14614
16068
  inlineContext(node) {
@@ -15625,7 +17079,7 @@ function mapFragment(fragment, f, parent) {
15625
17079
  child = f(child, parent, i);
15626
17080
  mapped.push(child);
15627
17081
  }
15628
- return Fragment5.fromArray(mapped);
17082
+ return Fragment7.fromArray(mapped);
15629
17083
  }
15630
17084
  var AddMarkStep = class extends Step {
15631
17085
  /**
@@ -15742,7 +17196,7 @@ var AddNodeMarkStep = class extends Step {
15742
17196
  if (!node)
15743
17197
  return StepResult.fail("No node at mark step's position");
15744
17198
  let updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
15745
- return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment5.from(updated), 0, node.isLeaf ? 0 : 1));
17199
+ return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment7.from(updated), 0, node.isLeaf ? 0 : 1));
15746
17200
  }
15747
17201
  invert(doc3) {
15748
17202
  let node = doc3.nodeAt(this.pos);
@@ -15788,7 +17242,7 @@ var RemoveNodeMarkStep = class extends Step {
15788
17242
  if (!node)
15789
17243
  return StepResult.fail("No node at mark step's position");
15790
17244
  let updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
15791
- return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment5.from(updated), 0, node.isLeaf ? 0 : 1));
17245
+ return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment7.from(updated), 0, node.isLeaf ? 0 : 1));
15792
17246
  }
15793
17247
  invert(doc3) {
15794
17248
  let node = doc3.nodeAt(this.pos);
@@ -16053,7 +17507,7 @@ function clearIncompatible(tr2, pos, parentType, match = parentType.contentMatch
16053
17507
  let m2, newline = /\r?\n|\r/g, slice2;
16054
17508
  while (m2 = newline.exec(child.text)) {
16055
17509
  if (!slice2)
16056
- slice2 = new Slice(Fragment5.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
17510
+ slice2 = new Slice(Fragment7.from(parentType.schema.text(" ", parentType.allowedMarks(child.marks))), 0, 0);
16057
17511
  replSteps.push(new ReplaceStep(cur + m2.index, cur + m2.index + m2[0].length, slice2));
16058
17512
  }
16059
17513
  }
@@ -16061,7 +17515,7 @@ function clearIncompatible(tr2, pos, parentType, match = parentType.contentMatch
16061
17515
  cur = end;
16062
17516
  }
16063
17517
  if (!match.validEnd) {
16064
- let fill = match.fillBefore(Fragment5.empty, true);
17518
+ let fill = match.fillBefore(Fragment7.empty, true);
16065
17519
  tr2.replace(cur, cur, new Slice(fill, 0, 0));
16066
17520
  }
16067
17521
  for (let i = replSteps.length - 1; i >= 0; i--)
@@ -16087,20 +17541,20 @@ function lift(tr2, range, target) {
16087
17541
  let { $from, $to, depth } = range;
16088
17542
  let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
16089
17543
  let start = gapStart, end = gapEnd;
16090
- let before = Fragment5.empty, openStart = 0;
17544
+ let before = Fragment7.empty, openStart = 0;
16091
17545
  for (let d = depth, splitting = false; d > target; d--)
16092
17546
  if (splitting || $from.index(d) > 0) {
16093
17547
  splitting = true;
16094
- before = Fragment5.from($from.node(d).copy(before));
17548
+ before = Fragment7.from($from.node(d).copy(before));
16095
17549
  openStart++;
16096
17550
  } else {
16097
17551
  start--;
16098
17552
  }
16099
- let after = Fragment5.empty, openEnd = 0;
17553
+ let after = Fragment7.empty, openEnd = 0;
16100
17554
  for (let d = depth, splitting = false; d > target; d--)
16101
17555
  if (splitting || $to.after(d + 1) < $to.end(d)) {
16102
17556
  splitting = true;
16103
- after = Fragment5.from($to.node(d).copy(after));
17557
+ after = Fragment7.from($to.node(d).copy(after));
16104
17558
  openEnd++;
16105
17559
  } else {
16106
17560
  end++;
@@ -16140,14 +17594,14 @@ function findWrappingInside(range, type) {
16140
17594
  return inside;
16141
17595
  }
16142
17596
  function wrap(tr2, range, wrappers) {
16143
- let content = Fragment5.empty;
17597
+ let content = Fragment7.empty;
16144
17598
  for (let i = wrappers.length - 1; i >= 0; i--) {
16145
17599
  if (content.size) {
16146
17600
  let match = wrappers[i].type.contentMatch.matchFragment(content);
16147
17601
  if (!match || !match.validEnd)
16148
17602
  throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper");
16149
17603
  }
16150
- content = Fragment5.from(wrappers[i].type.create(wrappers[i].attrs, content));
17604
+ content = Fragment7.from(wrappers[i].type.create(wrappers[i].attrs, content));
16151
17605
  }
16152
17606
  let start = range.start, end = range.end;
16153
17607
  tr2.step(new ReplaceAroundStep(start, end, start, end, new Slice(content, 0, 0), wrappers.length, true));
@@ -16172,7 +17626,7 @@ function setBlockType(tr2, from2, to, type, attrs) {
16172
17626
  clearIncompatible(tr2, tr2.mapping.slice(mapFrom).map(pos, 1), type, void 0, convertNewlines === null);
16173
17627
  let mapping = tr2.mapping.slice(mapFrom);
16174
17628
  let startM = mapping.map(pos, 1), endM = mapping.map(pos + node.nodeSize, 1);
16175
- tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment5.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
17629
+ tr2.step(new ReplaceAroundStep(startM, endM, startM + 1, endM - 1, new Slice(Fragment7.from(type.create(attrsHere, null, node.marks)), 0, 0), 1, true));
16176
17630
  if (convertNewlines === true)
16177
17631
  replaceNewlines(tr2, node, pos, mapFrom);
16178
17632
  return false;
@@ -16213,7 +17667,7 @@ function setNodeMarkup(tr2, pos, type, attrs, marks) {
16213
17667
  return tr2.replaceWith(pos, pos + node.nodeSize, newNode);
16214
17668
  if (!type.validContent(node.content))
16215
17669
  throw new RangeError("Invalid content for node type " + type.name);
16216
- tr2.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment5.from(newNode), 0, 0), 1, true));
17670
+ tr2.step(new ReplaceAroundStep(pos, pos + node.nodeSize, pos + 1, pos + node.nodeSize - 1, new Slice(Fragment7.from(newNode), 0, 0), 1, true));
16217
17671
  }
16218
17672
  function canSplit(doc3, pos, depth = 1, typesAfter) {
16219
17673
  let $pos = doc3.resolve(pos), base2 = $pos.depth - depth;
@@ -16237,11 +17691,11 @@ function canSplit(doc3, pos, depth = 1, typesAfter) {
16237
17691
  return $pos.node(base2).canReplaceWith(index2, index2, baseType ? baseType.type : $pos.node(base2 + 1).type);
16238
17692
  }
16239
17693
  function split(tr2, pos, depth = 1, typesAfter) {
16240
- let $pos = tr2.doc.resolve(pos), before = Fragment5.empty, after = Fragment5.empty;
17694
+ let $pos = tr2.doc.resolve(pos), before = Fragment7.empty, after = Fragment7.empty;
16241
17695
  for (let d = $pos.depth, e = $pos.depth - depth, i = depth - 1; d > e; d--, i--) {
16242
- before = Fragment5.from($pos.node(d).copy(before));
17696
+ before = Fragment7.from($pos.node(d).copy(before));
16243
17697
  let typeAfter = typesAfter && typesAfter[i];
16244
- after = Fragment5.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
17698
+ after = Fragment7.from(typeAfter ? typeAfter.type.create(typeAfter.attrs, after) : $pos.node(d).copy(after));
16245
17699
  }
16246
17700
  tr2.step(new ReplaceStep(pos, pos, new Slice(before.append(after), depth, depth), true));
16247
17701
  }
@@ -16380,7 +17834,7 @@ var Fitter = class {
16380
17834
  this.$to = $to;
16381
17835
  this.unplaced = unplaced;
16382
17836
  this.frontier = [];
16383
- this.placed = Fragment5.empty;
17837
+ this.placed = Fragment7.empty;
16384
17838
  for (let i = 0; i <= $from.depth; i++) {
16385
17839
  let node = $from.node(i);
16386
17840
  this.frontier.push({
@@ -16389,7 +17843,7 @@ var Fitter = class {
16389
17843
  });
16390
17844
  }
16391
17845
  for (let i = $from.depth; i > 0; i--)
16392
- this.placed = Fragment5.from($from.node(i).copy(this.placed));
17846
+ this.placed = Fragment7.from($from.node(i).copy(this.placed));
16393
17847
  }
16394
17848
  get depth() {
16395
17849
  return this.frontier.length - 1;
@@ -16446,7 +17900,7 @@ var Fitter = class {
16446
17900
  let first2 = fragment.firstChild;
16447
17901
  for (let frontierDepth = this.depth; frontierDepth >= 0; frontierDepth--) {
16448
17902
  let { type, match } = this.frontier[frontierDepth], wrap2, inject = null;
16449
- if (pass == 1 && (first2 ? match.matchType(first2.type) || (inject = match.fillBefore(Fragment5.from(first2), false)) : parent && type.compatibleContent(parent.type)))
17903
+ if (pass == 1 && (first2 ? match.matchType(first2.type) || (inject = match.fillBefore(Fragment7.from(first2), false)) : parent && type.compatibleContent(parent.type)))
16450
17904
  return { sliceDepth, frontierDepth, parent, inject };
16451
17905
  else if (pass == 2 && first2 && (wrap2 = match.findWrapping(first2.type)))
16452
17906
  return { sliceDepth, frontierDepth, parent, wrap: wrap2 };
@@ -16506,7 +17960,7 @@ var Fitter = class {
16506
17960
  let toEnd = taken == fragment.childCount;
16507
17961
  if (!toEnd)
16508
17962
  openEndCount = -1;
16509
- this.placed = addToFragment(this.placed, frontierDepth, Fragment5.from(add));
17963
+ this.placed = addToFragment(this.placed, frontierDepth, Fragment7.from(add));
16510
17964
  this.frontier[frontierDepth].match = match;
16511
17965
  if (toEnd && openEndCount < 0 && parent && parent.type == this.frontier[this.depth].type && this.frontier.length > 1)
16512
17966
  this.closeFrontierNode();
@@ -16563,12 +18017,12 @@ var Fitter = class {
16563
18017
  openFrontierNode(type, attrs = null, content) {
16564
18018
  let top = this.frontier[this.depth];
16565
18019
  top.match = top.match.matchType(type);
16566
- this.placed = addToFragment(this.placed, this.depth, Fragment5.from(type.create(attrs, content)));
18020
+ this.placed = addToFragment(this.placed, this.depth, Fragment7.from(type.create(attrs, content)));
16567
18021
  this.frontier.push({ type, match: type.contentMatch });
16568
18022
  }
16569
18023
  closeFrontierNode() {
16570
18024
  let open = this.frontier.pop();
16571
- let add = open.match.fillBefore(Fragment5.empty, true);
18025
+ let add = open.match.fillBefore(Fragment7.empty, true);
16572
18026
  if (add.childCount)
16573
18027
  this.placed = addToFragment(this.placed, this.frontier.length, add);
16574
18028
  }
@@ -16597,7 +18051,7 @@ function closeNodeStart(node, openStart, openEnd) {
16597
18051
  if (openStart > 0) {
16598
18052
  frag = node.type.contentMatch.fillBefore(frag).append(frag);
16599
18053
  if (openEnd <= 0)
16600
- frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment5.empty, true));
18054
+ frag = frag.append(node.type.contentMatch.matchFragment(frag).fillBefore(Fragment7.empty, true));
16601
18055
  }
16602
18056
  return node.copy(frag);
16603
18057
  }
@@ -16689,7 +18143,7 @@ function closeFragment(fragment, depth, oldOpen, newOpen, parent) {
16689
18143
  if (depth > newOpen) {
16690
18144
  let match = parent.contentMatchAt(0);
16691
18145
  let start = match.fillBefore(fragment).append(fragment);
16692
- fragment = start.append(match.matchFragment(start).fillBefore(Fragment5.empty, true));
18146
+ fragment = start.append(match.matchFragment(start).fillBefore(Fragment7.empty, true));
16693
18147
  }
16694
18148
  return fragment;
16695
18149
  }
@@ -16699,7 +18153,7 @@ function replaceRangeWith(tr2, from2, to, node) {
16699
18153
  if (point != null)
16700
18154
  from2 = to = point;
16701
18155
  }
16702
- tr2.replaceRange(from2, to, new Slice(Fragment5.from(node), 0, 0));
18156
+ tr2.replaceRange(from2, to, new Slice(Fragment7.from(node), 0, 0));
16703
18157
  }
16704
18158
  function deleteRange(tr2, from2, to) {
16705
18159
  let $from = tr2.doc.resolve(from2), $to = tr2.doc.resolve(to);
@@ -16747,7 +18201,7 @@ var AttrStep = class extends Step {
16747
18201
  attrs[name] = node.attrs[name];
16748
18202
  attrs[this.attr] = this.value;
16749
18203
  let updated = node.type.create(attrs, null, node.marks);
16750
- return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment5.from(updated), 0, node.isLeaf ? 0 : 1));
18204
+ return StepResult.fromReplace(doc3, this.pos, this.pos + 1, new Slice(Fragment7.from(updated), 0, node.isLeaf ? 0 : 1));
16751
18205
  }
16752
18206
  getMap() {
16753
18207
  return StepMap.empty;
@@ -16882,7 +18336,7 @@ var Transform = class {
16882
18336
  fragment, node, or array of nodes.
16883
18337
  */
16884
18338
  replaceWith(from2, to, content) {
16885
- return this.replace(from2, to, new Slice(Fragment5.from(content), 0, 0));
18339
+ return this.replace(from2, to, new Slice(Fragment7.from(content), 0, 0));
16886
18340
  }
16887
18341
  /**
16888
18342
  Delete the content between the given positions.
@@ -17384,7 +18838,7 @@ var NodeSelection = class extends Selection {
17384
18838
  return new NodeSelection($pos);
17385
18839
  }
17386
18840
  content() {
17387
- return new Slice(Fragment5.from(this.node), 0, 0);
18841
+ return new Slice(Fragment7.from(this.node), 0, 0);
17388
18842
  }
17389
18843
  eq(other) {
17390
18844
  return other instanceof NodeSelection && other.anchor == this.anchor;
@@ -19206,7 +20660,7 @@ var NodeViewDesc = class extends ViewDesc {
19206
20660
  }
19207
20661
  }
19208
20662
  if (!rule.contentElement)
19209
- rule.getContent = () => Fragment5.empty;
20663
+ rule.getContent = () => Fragment7.empty;
19210
20664
  }
19211
20665
  return rule;
19212
20666
  }
@@ -20525,7 +21979,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
20525
21979
  text = f(text, inCode || plainText, view);
20526
21980
  });
20527
21981
  if (inCode)
20528
- return text ? new Slice(Fragment5.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty;
21982
+ return text ? new Slice(Fragment7.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0) : Slice.empty;
20529
21983
  let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
20530
21984
  if (parsed) {
20531
21985
  slice2 = parsed;
@@ -20614,13 +22068,13 @@ function normalizeSiblings(fragment, $context) {
20614
22068
  }
20615
22069
  });
20616
22070
  if (result)
20617
- return Fragment5.from(result);
22071
+ return Fragment7.from(result);
20618
22072
  }
20619
22073
  return fragment;
20620
22074
  }
20621
22075
  function withWrappers(node, wrap2, from2 = 0) {
20622
22076
  for (let i = wrap2.length - 1; i >= from2; i--)
20623
- node = wrap2[i].create(null, Fragment5.from(node));
22077
+ node = wrap2[i].create(null, Fragment7.from(node));
20624
22078
  return node;
20625
22079
  }
20626
22080
  function addToSibling(wrap2, lastWrap, node, sibling, depth) {
@@ -20630,14 +22084,14 @@ function addToSibling(wrap2, lastWrap, node, sibling, depth) {
20630
22084
  return sibling.copy(sibling.content.replaceChild(sibling.childCount - 1, inner));
20631
22085
  let match = sibling.contentMatchAt(sibling.childCount);
20632
22086
  if (match.matchType(depth == wrap2.length - 1 ? node.type : wrap2[depth + 1]))
20633
- return sibling.copy(sibling.content.append(Fragment5.from(withWrappers(node, wrap2, depth + 1))));
22087
+ return sibling.copy(sibling.content.append(Fragment7.from(withWrappers(node, wrap2, depth + 1))));
20634
22088
  }
20635
22089
  }
20636
22090
  function closeRight(node, depth) {
20637
22091
  if (depth == 0)
20638
22092
  return node;
20639
22093
  let fragment = node.content.replaceChild(node.childCount - 1, closeRight(node.lastChild, depth - 1));
20640
- let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment5.empty, true);
22094
+ let fill = node.contentMatchAt(node.childCount).fillBefore(Fragment7.empty, true);
20641
22095
  return node.copy(fragment.append(fill));
20642
22096
  }
20643
22097
  function closeRange(fragment, side, from2, to, depth, openEnd) {
@@ -20647,7 +22101,7 @@ function closeRange(fragment, side, from2, to, depth, openEnd) {
20647
22101
  if (depth < to - 1)
20648
22102
  inner = closeRange(inner, side, from2, to, depth + 1, openEnd);
20649
22103
  if (depth >= from2)
20650
- inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment5.empty, true));
22104
+ inner = side < 0 ? node.contentMatchAt(0).fillBefore(inner, openEnd <= depth).append(inner) : inner.append(node.contentMatchAt(node.childCount).fillBefore(Fragment7.empty, true));
20651
22105
  return fragment.replaceChild(side < 0 ? 0 : fragment.childCount - 1, node.copy(inner));
20652
22106
  }
20653
22107
  function closeSlice(slice2, openStart, openEnd) {
@@ -20717,7 +22171,7 @@ function addContext(slice2, context) {
20717
22171
  let type = schema.nodes[array[i]];
20718
22172
  if (!type || type.hasRequiredAttrs())
20719
22173
  break;
20720
- content = Fragment5.from(type.create(array[i + 1], content));
22174
+ content = Fragment7.from(type.create(array[i + 1], content));
20721
22175
  openStart++;
20722
22176
  openEnd++;
20723
22177
  }
@@ -22578,7 +24032,7 @@ function isMarkChange(cur, prev) {
22578
24032
  let updated = [];
22579
24033
  for (let i = 0; i < prev.childCount; i++)
22580
24034
  updated.push(update(prev.child(i)));
22581
- if (Fragment5.from(updated).eq(cur))
24035
+ if (Fragment7.from(updated).eq(cur))
22582
24036
  return { mark, type };
22583
24037
  }
22584
24038
  function looksLikeBackspace(old, start, end, $newStart, $newEnd) {
@@ -23688,10 +25142,10 @@ function deleteBarrier(state, $cut, dispatch2, dir) {
23688
25142
  let canDelAfter = !isolated && $cut.parent.canReplace($cut.index(), $cut.index() + 1);
23689
25143
  if (canDelAfter && (conn = (match = before.contentMatchAt(before.childCount)).findWrapping(after.type)) && match.matchType(conn[0] || after.type).validEnd) {
23690
25144
  if (dispatch2) {
23691
- let end = $cut.pos + after.nodeSize, wrap2 = Fragment5.empty;
25145
+ let end = $cut.pos + after.nodeSize, wrap2 = Fragment7.empty;
23692
25146
  for (let i = conn.length - 1; i >= 0; i--)
23693
- wrap2 = Fragment5.from(conn[i].create(null, wrap2));
23694
- wrap2 = Fragment5.from(before.copy(wrap2));
25147
+ wrap2 = Fragment7.from(conn[i].create(null, wrap2));
25148
+ wrap2 = Fragment7.from(before.copy(wrap2));
23695
25149
  let tr2 = state.tr.step(new ReplaceAroundStep($cut.pos - 1, end, $cut.pos, end, new Slice(wrap2, 1, 0), conn.length, true));
23696
25150
  let $joinAt = tr2.doc.resolve(end + 2 * conn.length);
23697
25151
  if ($joinAt.nodeAfter && $joinAt.nodeAfter.type == before.type && canJoin(tr2.doc, $joinAt.pos))
@@ -23720,9 +25174,9 @@ function deleteBarrier(state, $cut, dispatch2, dir) {
23720
25174
  afterDepth++;
23721
25175
  if (at.canReplace(at.childCount, at.childCount, afterText.content)) {
23722
25176
  if (dispatch2) {
23723
- let end = Fragment5.empty;
25177
+ let end = Fragment7.empty;
23724
25178
  for (let i = wrap2.length - 1; i >= 0; i--)
23725
- end = Fragment5.from(wrap2[i].copy(end));
25179
+ end = Fragment7.from(wrap2[i].copy(end));
23726
25180
  let tr2 = state.tr.step(new ReplaceAroundStep($cut.pos - wrap2.length, $cut.pos + after.nodeSize, $cut.pos + afterDepth, $cut.pos + after.nodeSize - afterDepth, new Slice(end, wrap2.length, 0), 0, true));
23727
25181
  dispatch2(tr2.scrollIntoView());
23728
25182
  }
@@ -23827,9 +25281,9 @@ function wrapRangeInList(tr2, range, listType, attrs = null) {
23827
25281
  return true;
23828
25282
  }
23829
25283
  function doWrapInList(tr2, range, wrappers, joinBefore, listType) {
23830
- let content = Fragment5.empty;
25284
+ let content = Fragment7.empty;
23831
25285
  for (let i = wrappers.length - 1; i >= 0; i--)
23832
- content = Fragment5.from(wrappers[i].type.create(wrappers[i].attrs, content));
25286
+ content = Fragment7.from(wrappers[i].type.create(wrappers[i].attrs, content));
23833
25287
  tr2.step(new ReplaceAroundStep(range.start - (joinBefore ? 2 : 0), range.end, range.start, range.end, new Slice(content, 0, 0), wrappers.length, true));
23834
25288
  let found2 = 0;
23835
25289
  for (let i = 0; i < wrappers.length; i++)
@@ -23863,7 +25317,7 @@ function liftListItem(itemType) {
23863
25317
  function liftToOuterList(state, dispatch2, itemType, range) {
23864
25318
  let tr2 = state.tr, end = range.end, endOfList = range.$to.end(range.depth);
23865
25319
  if (end < endOfList) {
23866
- tr2.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment5.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
25320
+ tr2.step(new ReplaceAroundStep(end - 1, endOfList, end, endOfList, new Slice(Fragment7.from(itemType.create(null, range.parent.copy())), 1, 0), 1, true));
23867
25321
  range = new NodeRange(tr2.doc.resolve(range.$from.pos), tr2.doc.resolve(endOfList), range.depth);
23868
25322
  }
23869
25323
  const target = liftTarget(range);
@@ -23887,10 +25341,10 @@ function liftOutOfList(state, dispatch2, range) {
23887
25341
  return false;
23888
25342
  let atStart = range.startIndex == 0, atEnd = range.endIndex == list.childCount;
23889
25343
  let parent = $start.node(-1), indexBefore = $start.index(-1);
23890
- if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment5.empty : Fragment5.from(list))))
25344
+ if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexBefore + 1, item.content.append(atEnd ? Fragment7.empty : Fragment7.from(list))))
23891
25345
  return false;
23892
25346
  let start = $start.pos, end = start + item.nodeSize;
23893
- tr2.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment5.empty : Fragment5.from(list.copy(Fragment5.empty))).append(atEnd ? Fragment5.empty : Fragment5.from(list.copy(Fragment5.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
25347
+ tr2.step(new ReplaceAroundStep(start - (atStart ? 1 : 0), end + (atEnd ? 1 : 0), start + 1, end - 1, new Slice((atStart ? Fragment7.empty : Fragment7.from(list.copy(Fragment7.empty))).append(atEnd ? Fragment7.empty : Fragment7.from(list.copy(Fragment7.empty))), atStart ? 0 : 1, atEnd ? 0 : 1), atStart ? 0 : 1));
23894
25348
  dispatch2(tr2.scrollIntoView());
23895
25349
  return true;
23896
25350
  }
@@ -23908,8 +25362,8 @@ function sinkListItem(itemType) {
23908
25362
  return false;
23909
25363
  if (dispatch2) {
23910
25364
  let nestedBefore = nodeBefore.lastChild && nodeBefore.lastChild.type == parent.type;
23911
- let inner = Fragment5.from(nestedBefore ? itemType.create() : null);
23912
- let slice2 = new Slice(Fragment5.from(itemType.create(null, Fragment5.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
25365
+ let inner = Fragment7.from(nestedBefore ? itemType.create() : null);
25366
+ let slice2 = new Slice(Fragment7.from(itemType.create(null, Fragment7.from(parent.type.create(null, inner)))), nestedBefore ? 3 : 1, 0);
23913
25367
  let before = range.start, after = range.end;
23914
25368
  dispatch2(state.tr.step(new ReplaceAroundStep(before - (nestedBefore ? 3 : 1), after, before, after, slice2, 1, true)).scrollIntoView());
23915
25369
  }
@@ -24127,7 +25581,7 @@ function elementFromString(value) {
24127
25581
  return removeWhitespaces(html);
24128
25582
  }
24129
25583
  function createNodeFromContent(content, schema, options) {
24130
- if (content instanceof Node2 || content instanceof Fragment5) {
25584
+ if (content instanceof Node2 || content instanceof Fragment7) {
24131
25585
  return content;
24132
25586
  }
24133
25587
  options = {
@@ -24141,7 +25595,7 @@ function createNodeFromContent(content, schema, options) {
24141
25595
  try {
24142
25596
  const isArrayContent = Array.isArray(content) && content.length > 0;
24143
25597
  if (isArrayContent) {
24144
- return Fragment5.fromArray(content.map((item) => schema.nodeFromJSON(item)));
25598
+ return Fragment7.fromArray(content.map((item) => schema.nodeFromJSON(item)));
24145
25599
  }
24146
25600
  const node = schema.nodeFromJSON(content);
24147
25601
  if (options.errorOnInvalidContent) {
@@ -25275,7 +26729,7 @@ function inputRulesPlugin(props) {
25275
26729
  if (typeof text === "string") {
25276
26730
  text = text;
25277
26731
  } else {
25278
- text = getHTMLFromFragment(Fragment5.from(text), state.schema);
26732
+ text = getHTMLFromFragment(Fragment7.from(text), state.schema);
25279
26733
  }
25280
26734
  const { from: from2 } = simulatedInputMeta;
25281
26735
  const to = from2 + text.length;
@@ -25653,7 +27107,7 @@ function pasteRulesPlugin(props) {
25653
27107
  if (typeof text === "string") {
25654
27108
  text = text;
25655
27109
  } else {
25656
- text = getHTMLFromFragment(Fragment5.from(text), state.schema);
27110
+ text = getHTMLFromFragment(Fragment7.from(text), state.schema);
25657
27111
  }
25658
27112
  const { from: from22 } = simulatedPasteMeta;
25659
27113
  const to2 = from22 + text.length;
@@ -26311,7 +27765,7 @@ var insertContentAt = (position, value, options) => ({ tr: tr2, dispatch: dispat
26311
27765
  if (isOnlyTextContent) {
26312
27766
  if (Array.isArray(value)) {
26313
27767
  newContent = value.map((v) => v.text || "").join("");
26314
- } else if (value instanceof Fragment5) {
27768
+ } else if (value instanceof Fragment7) {
26315
27769
  let text = "";
26316
27770
  value.forEach((node) => {
26317
27771
  if (node.text) {
@@ -26778,10 +28232,10 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr: tr2, state, dispa
26778
28232
  return false;
26779
28233
  }
26780
28234
  if (dispatch2) {
26781
- let wrap2 = Fragment5.empty;
28235
+ let wrap2 = Fragment7.empty;
26782
28236
  const depthBefore = $from.index(-1) ? 1 : $from.index(-2) ? 2 : 3;
26783
28237
  for (let d = $from.depth - depthBefore; d >= $from.depth - 3; d -= 1) {
26784
- wrap2 = Fragment5.from($from.node(d).copy(wrap2));
28238
+ wrap2 = Fragment7.from($from.node(d).copy(wrap2));
26785
28239
  }
26786
28240
  const depthAfter = (
26787
28241
  // eslint-disable-next-line no-nested-ternary
@@ -26792,7 +28246,7 @@ var splitListItem = (typeOrName, overrideAttrs = {}) => ({ tr: tr2, state, dispa
26792
28246
  ...overrideAttrs
26793
28247
  };
26794
28248
  const nextType2 = ((_a = type.contentMatch.defaultType) == null ? void 0 : _a.createAndFill(newNextTypeAttributes2)) || void 0;
26795
- wrap2 = wrap2.append(Fragment5.from(type.createAndFill(null, nextType2) || void 0));
28249
+ wrap2 = wrap2.append(Fragment7.from(type.createAndFill(null, nextType2) || void 0));
26796
28250
  const start = $from.before($from.depth - (depthBefore - 1));
26797
28251
  tr2.replace(start, $from.after(-depthAfter), new Slice(wrap2, 4 - depthBefore, 0));
26798
28252
  let sel = -1;
@@ -28423,7 +29877,7 @@ function markPasteRule(config) {
28423
29877
  }
28424
29878
 
28425
29879
  // ../../node_modules/@tiptap/react/dist/index.js
28426
- var import_react17 = __toESM(require_react(), 1);
29880
+ var import_react19 = __toESM(require_react(), 1);
28427
29881
  var mergeRefs = (...refs) => {
28428
29882
  return (node) => {
28429
29883
  refs.forEach((ref) => {
@@ -28642,7 +30096,7 @@ function useEditorState(options) {
28642
30096
  editorStateManager.getSnapshot,
28643
30097
  editorStateManager.getServerSnapshot,
28644
30098
  options.selector,
28645
- (_a = options.equalityFn) != null ? _a : import_react17.default
30099
+ (_a = options.equalityFn) != null ? _a : import_react19.default
28646
30100
  );
28647
30101
  useIsomorphicLayoutEffect(() => {
28648
30102
  return editorStateManager.watch(options.editor);
@@ -28921,11 +30375,11 @@ var ReactNodeViewContext = createContext({
28921
30375
  var useReactNodeView = () => useContext(ReactNodeViewContext);
28922
30376
  t__default.forwardRef((props, ref) => {
28923
30377
  const { onDragStart } = useReactNodeView();
28924
- const Tag2 = props.as || "div";
30378
+ const Tag4 = props.as || "div";
28925
30379
  return (
28926
30380
  // @ts-ignore
28927
30381
  /* @__PURE__ */ jsx(
28928
- Tag2,
30382
+ Tag4,
28929
30383
  {
28930
30384
  ...props,
28931
30385
  ref,
@@ -32238,9 +33692,9 @@ function beforeinput(view, event) {
32238
33692
  let insert = $from.parent.contentMatchAt($from.index()).findWrapping(view.state.schema.nodes.text);
32239
33693
  if (!insert)
32240
33694
  return false;
32241
- let frag = Fragment5.empty;
33695
+ let frag = Fragment7.empty;
32242
33696
  for (let i = insert.length - 1; i >= 0; i--)
32243
- frag = Fragment5.from(insert[i].createAndFill(null, frag));
33697
+ frag = Fragment7.from(insert[i].createAndFill(null, frag));
32244
33698
  let tr2 = view.state.tr.replace($from.pos, $from.pos, new Slice(frag, 0, 0));
32245
33699
  tr2.setSelection(TextSelection.near(tr2.doc.resolve($from.pos + 1)));
32246
33700
  view.dispatch(tr2);
@@ -33365,7 +34819,7 @@ var index_default7 = Highlight;
33365
34819
 
33366
34820
  // ../../node_modules/@tiptap/extension-image/dist/index.js
33367
34821
  var inputRegex6 = /(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/;
33368
- var Image4 = Node3.create({
34822
+ var Image5 = Node3.create({
33369
34823
  name: "image",
33370
34824
  addOptions() {
33371
34825
  return {
@@ -33433,7 +34887,7 @@ var Image4 = Node3.create({
33433
34887
  ];
33434
34888
  }
33435
34889
  });
33436
- var index_default8 = Image4;
34890
+ var index_default8 = Image5;
33437
34891
 
33438
34892
  // ../../node_modules/prosemirror-tables/dist/index.js
33439
34893
  var readFromCache;
@@ -33920,10 +35374,10 @@ var CellSelection = class _CellSelection extends Selection {
33920
35374
  }
33921
35375
  rowContent.push(cell);
33922
35376
  }
33923
- rows.push(table.child(row).copy(Fragment5.from(rowContent)));
35377
+ rows.push(table.child(row).copy(Fragment7.from(rowContent)));
33924
35378
  }
33925
35379
  const fragment = this.isColSelection() && this.isRowSelection() ? table : rows;
33926
- return new Slice(Fragment5.from(fragment), 1, 1);
35380
+ return new Slice(Fragment7.from(fragment), 1, 1);
33927
35381
  }
33928
35382
  replace(tr2, content = Slice.empty) {
33929
35383
  const mapFrom = tr2.steps.length, ranges = this.ranges;
@@ -33943,7 +35397,7 @@ var CellSelection = class _CellSelection extends Selection {
33943
35397
  tr2.setSelection(sel);
33944
35398
  }
33945
35399
  replaceWith(tr2, node) {
33946
- this.replace(tr2, new Slice(Fragment5.from(node), 0, 0));
35400
+ this.replace(tr2, new Slice(Fragment7.from(node), 0, 0));
33947
35401
  }
33948
35402
  forEachCell(f) {
33949
35403
  const table = this.$anchorCell.node(-1);
@@ -34491,7 +35945,7 @@ function mergeCells(state, dispatch2) {
34491
35945
  if (dispatch2) {
34492
35946
  const tr2 = state.tr;
34493
35947
  const seen = {};
34494
- let content = Fragment5.empty;
35948
+ let content = Fragment7.empty;
34495
35949
  let mergedPos;
34496
35950
  let mergedCell;
34497
35951
  for (let row = rect.top; row < rect.bottom; row++) {
@@ -34872,14 +36326,14 @@ function ensureRectangular(schema, rows) {
34872
36326
  width = Math.max(width, widths[r2]);
34873
36327
  for (let r2 = 0; r2 < widths.length; r2++) {
34874
36328
  if (r2 >= rows.length)
34875
- rows.push(Fragment5.empty);
36329
+ rows.push(Fragment7.empty);
34876
36330
  if (widths[r2] < width) {
34877
36331
  const empty2 = tableNodeTypes(schema).cell.createAndFill();
34878
36332
  const cells = [];
34879
36333
  for (let i = widths[r2]; i < width; i++) {
34880
36334
  cells.push(empty2);
34881
36335
  }
34882
- rows[r2] = rows[r2].append(Fragment5.from(cells));
36336
+ rows[r2] = rows[r2].append(Fragment7.from(cells));
34883
36337
  }
34884
36338
  }
34885
36339
  return { height: rows.length, width, rows };
@@ -34911,7 +36365,7 @@ function clipCells({ width, height, rows }, newWidth, newHeight) {
34911
36365
  for (let j = 1; j < cell.attrs.rowspan; j++)
34912
36366
  added[row + j] = (added[row + j] || 0) + cell.attrs.colspan;
34913
36367
  }
34914
- newRows.push(Fragment5.from(cells));
36368
+ newRows.push(Fragment7.from(cells));
34915
36369
  }
34916
36370
  rows = newRows;
34917
36371
  width = newWidth;
@@ -34932,7 +36386,7 @@ function clipCells({ width, height, rows }, newWidth, newHeight) {
34932
36386
  );
34933
36387
  cells.push(cell);
34934
36388
  }
34935
- newRows.push(Fragment5.from(cells));
36389
+ newRows.push(Fragment7.from(cells));
34936
36390
  }
34937
36391
  rows = newRows;
34938
36392
  height = newHeight;
@@ -34967,7 +36421,7 @@ function growTable(tr2, map2, table, start, width, height, mapFrom) {
34967
36421
  header ? emptyHead || (emptyHead = types.header_cell.createAndFill()) : empty2 || (empty2 = types.cell.createAndFill())
34968
36422
  );
34969
36423
  }
34970
- const emptyRow = types.row.create(null, Fragment5.from(cells)), rows = [];
36424
+ const emptyRow = types.row.create(null, Fragment7.from(cells)), rows = [];
34971
36425
  for (let i = map2.height; i < height; i++)
34972
36426
  rows.push(emptyRow);
34973
36427
  tr2.insert(tr2.mapping.slice(mapFrom).map(start + table.nodeSize - 2), rows);
@@ -35176,7 +36630,7 @@ function handlePaste(view, _, slice2) {
35176
36630
  width: 1,
35177
36631
  height: 1,
35178
36632
  rows: [
35179
- Fragment5.from(
36633
+ Fragment7.from(
35180
36634
  fitSlice(tableNodeTypes(view.state.schema).cell, slice2)
35181
36635
  )
35182
36636
  ]
@@ -53370,7 +54824,7 @@ function Timeline({
53370
54824
  return formatDate2(date);
53371
54825
  }
53372
54826
  };
53373
- const getInitials2 = (name) => {
54827
+ const getInitials4 = (name) => {
53374
54828
  return name.split(" ").map((n) => n[0]).join("").toUpperCase();
53375
54829
  };
53376
54830
  const groupEventsByDate = (events2) => {
@@ -53430,7 +54884,7 @@ function Timeline({
53430
54884
  showUserInfo && event.user && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
53431
54885
  /* @__PURE__ */ jsxs(MoonUIAvatarPro, { className: "h-6 w-6", children: [
53432
54886
  /* @__PURE__ */ jsx(MoonUIAvatarImagePro, { src: event.user.avatar }),
53433
- /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials2(event.user.name) })
54887
+ /* @__PURE__ */ jsx(MoonUIAvatarFallbackPro, { className: "text-xs", children: getInitials4(event.user.name) })
53434
54888
  ] }),
53435
54889
  /* @__PURE__ */ jsx("span", { className: "text-sm text-muted-foreground", children: event.user.name })
53436
54890
  ] }),
@@ -53736,9 +55190,9 @@ function AdvancedChart({
53736
55190
  toggleSeriesVisibility(entry.dataKey);
53737
55191
  }
53738
55192
  };
53739
- const handleExport = (format3) => {
55193
+ const handleExport = (format6) => {
53740
55194
  if (onExport) {
53741
- onExport(format3);
55195
+ onExport(format6);
53742
55196
  }
53743
55197
  };
53744
55198
  const handleZoom = (direction) => {
@@ -57934,7 +59388,7 @@ var OptimizedImageInternal = ({
57934
59388
  width,
57935
59389
  height,
57936
59390
  quality = 75,
57937
- format: format3 = "auto",
59391
+ format: format6 = "auto",
57938
59392
  lazy = true,
57939
59393
  blur: blur2 = true,
57940
59394
  priority = false,
@@ -57973,7 +59427,7 @@ var OptimizedImageInternal = ({
57973
59427
  params.set("f", options.format);
57974
59428
  return optimizedUrl;
57975
59429
  };
57976
- const optimizedSrc = getOptimizedSrc(src, { width, height, quality, format: format3 });
59430
+ const optimizedSrc = getOptimizedSrc(src, { width, height, quality, format: format6 });
57977
59431
  const handleImageLoad = () => {
57978
59432
  setIsLoaded(true);
57979
59433
  setIsLoading(false);
@@ -58137,7 +59591,7 @@ var OptimizedImageInternal = ({
58137
59591
  ] }),
58138
59592
  /* @__PURE__ */ jsxs("div", { children: [
58139
59593
  "Format: ",
58140
- format3
59594
+ format6
58141
59595
  ] })
58142
59596
  ]
58143
59597
  }
@@ -59282,7 +60736,7 @@ ${options.description}` : options.title;
59282
60736
  }
59283
60737
  }
59284
60738
  }
59285
- var useToast = () => {
60739
+ var useToast2 = () => {
59286
60740
  return { toast: toast2 };
59287
60741
  };
59288
60742
  var fileUploadVariants = cva(
@@ -59306,7 +60760,7 @@ var fileUploadVariants = cva(
59306
60760
  }
59307
60761
  }
59308
60762
  );
59309
- var formatFileSize = (bytes) => {
60763
+ var formatFileSize2 = (bytes) => {
59310
60764
  if (bytes === 0)
59311
60765
  return "0 B";
59312
60766
  const k3 = 1024;
@@ -59471,7 +60925,7 @@ var FilePreviewModal = ({
59471
60925
  /* @__PURE__ */ jsx(MoonUIDialogHeaderPro, { children: /* @__PURE__ */ jsxs(MoonUIDialogTitlePro, { className: "flex items-center gap-2", children: [
59472
60926
  getFileIcon(file.file.type),
59473
60927
  file.file.name,
59474
- /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", children: formatFileSize(file.file.size) })
60928
+ /* @__PURE__ */ jsx(MoonUIBadgePro, { variant: "secondary", children: formatFileSize2(file.file.size) })
59475
60929
  ] }) }),
59476
60930
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center p-4 bg-muted/20 rounded-lg", children: [
59477
60931
  file.preview.type === "image" && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
@@ -59579,7 +61033,7 @@ var MoonUIFileUploadPro = t__default.forwardRef(
59579
61033
  }
59580
61034
  const validateFile = useCallback(async (file) => {
59581
61035
  if (file.size > maxSize) {
59582
- return `File size exceeds ${formatFileSize(maxSize)} limit`;
61036
+ return `File size exceeds ${formatFileSize2(maxSize)} limit`;
59583
61037
  }
59584
61038
  if (allowedMimeTypes.length > 0 && !allowedMimeTypes.includes(file.type)) {
59585
61039
  return `File type ${file.type} is not supported`;
@@ -59932,7 +61386,7 @@ var MoonUIFileUploadPro = t__default.forwardRef(
59932
61386
  const currentSize = files.reduce((sum, f) => sum + f.file.size, 0);
59933
61387
  const newSize = fileArray.reduce((sum, f) => sum + f.size, 0);
59934
61388
  if (currentSize + newSize > maxTotalSize) {
59935
- setError(`Total file size exceeds ${formatFileSize(maxTotalSize)} limit`);
61389
+ setError(`Total file size exceeds ${formatFileSize2(maxTotalSize)} limit`);
59936
61390
  return;
59937
61391
  }
59938
61392
  }
@@ -60145,7 +61599,7 @@ var MoonUIFileUploadPro = t__default.forwardRef(
60145
61599
  ] }),
60146
61600
  /* @__PURE__ */ jsx("span", { children: "\u2022" }),
60147
61601
  /* @__PURE__ */ jsxs("span", { children: [
60148
- formatFileSize(maxSize),
61602
+ formatFileSize2(maxSize),
60149
61603
  " per file"
60150
61604
  ] }),
60151
61605
  resumable && /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -60258,7 +61712,7 @@ var FileUploadItem = ({
60258
61712
  onPauseResume,
60259
61713
  onPreview
60260
61714
  }) => {
60261
- const { toast: toast3 } = useToast();
61715
+ const { toast: toast3 } = useToast2();
60262
61716
  const canPauseResume = resumable && ["uploading", "paused"].includes(file.status);
60263
61717
  const canPreview = showPreview && file.preview && ["image", "video", "audio"].includes(file.preview.type);
60264
61718
  return /* @__PURE__ */ jsxs(
@@ -60344,7 +61798,7 @@ var FileUploadItem = ({
60344
61798
  variant === "compact" ? "text-xs" : "text-sm",
60345
61799
  variant === "grid" && "justify-center"
60346
61800
  ), children: [
60347
- /* @__PURE__ */ jsx("span", { children: formatFileSize(file.file.size) }),
61801
+ /* @__PURE__ */ jsx("span", { children: formatFileSize2(file.file.size) }),
60348
61802
  file.preview?.dimensions && /* @__PURE__ */ jsxs(Fragment, { children: [
60349
61803
  /* @__PURE__ */ jsx("span", { children: "\u2022" }),
60350
61804
  /* @__PURE__ */ jsxs("span", { children: [
@@ -60385,7 +61839,7 @@ var FileUploadItem = ({
60385
61839
  "%"
60386
61840
  ] }),
60387
61841
  file.speed && /* @__PURE__ */ jsxs("span", { children: [
60388
- formatFileSize(file.speed),
61842
+ formatFileSize2(file.speed),
60389
61843
  "/s"
60390
61844
  ] }),
60391
61845
  file.estimatedTime && file.estimatedTime > 0 && /* @__PURE__ */ jsxs("span", { children: [
@@ -61017,11 +62471,11 @@ function downloadFile(content, filename, mimeType) {
61017
62471
  URL.revokeObjectURL(url);
61018
62472
  }
61019
62473
  async function exportData(data, options) {
61020
- const { format: format3, filename = "data-export", columns, includeHeaders = true } = options;
62474
+ const { format: format6, filename = "data-export", columns, includeHeaders = true } = options;
61021
62475
  let content;
61022
62476
  let mimeType;
61023
62477
  let extension;
61024
- switch (format3) {
62478
+ switch (format6) {
61025
62479
  case "csv":
61026
62480
  content = dataToCSV(data, columns, includeHeaders);
61027
62481
  mimeType = "text/csv;charset=utf-8;";
@@ -61035,7 +62489,7 @@ async function exportData(data, options) {
61035
62489
  case "xlsx":
61036
62490
  throw new Error("XLSX export requires additional dependencies. Use CSV format instead.");
61037
62491
  default:
61038
- throw new Error(`Unsupported export format: ${format3}`);
62492
+ throw new Error(`Unsupported export format: ${format6}`);
61039
62493
  }
61040
62494
  const finalFilename = `${filename}-${( new Date()).toISOString().split("T")[0]}.${extension}`;
61041
62495
  downloadFile(content, finalFilename, mimeType);
@@ -61518,11 +62972,11 @@ function DataTable({
61518
62972
  rowSelection: features.rowSelection !== false || selectable,
61519
62973
  export: features.export !== false || exportable
61520
62974
  });
61521
- const handleExport = async (format3) => {
62975
+ const handleExport = async (format6) => {
61522
62976
  const selectedRows = table.getFilteredSelectedRowModel().rows;
61523
62977
  const dataToExport = selectedRows.length > 0 ? selectedRows.map((row) => row.original) : table.getFilteredRowModel().rows.map((row) => row.original);
61524
62978
  if (typeof exportable === "object" && exportable.onExport) {
61525
- exportable.onExport(dataToExport, format3);
62979
+ exportable.onExport(dataToExport, format6);
61526
62980
  return;
61527
62981
  }
61528
62982
  if (onExport) {
@@ -61532,7 +62986,7 @@ function DataTable({
61532
62986
  const filename = typeof exportable === "object" && exportable.filename ? exportable.filename : "data-export";
61533
62987
  const visibleColumns = getVisibleColumns(columns, columnVisibility);
61534
62988
  await exportData(dataToExport, {
61535
- format: format3,
62989
+ format: format6,
61536
62990
  filename,
61537
62991
  columns: visibleColumns,
61538
62992
  includeHeaders: true
@@ -63464,18 +64918,18 @@ var countries = [
63464
64918
  { code: "NO", name: "Norway", dialCode: "+47", flag: "\u{1F1F3}\u{1F1F4}", format: "xxx xx xxx" },
63465
64919
  { code: "FI", name: "Finland", dialCode: "+358", flag: "\u{1F1EB}\u{1F1EE}", format: "xx xxxxxxx" }
63466
64920
  ];
63467
- function formatPhoneNumber(number, format3) {
63468
- if (!number || !format3)
64921
+ function formatPhoneNumber(number, format6) {
64922
+ if (!number || !format6)
63469
64923
  return "";
63470
64924
  const cleaned = number.replace(/\D/g, "");
63471
64925
  let formatted = "";
63472
64926
  let digitIndex = 0;
63473
- for (let i = 0; i < format3.length && digitIndex < cleaned.length; i++) {
63474
- if (format3[i] === "x") {
64927
+ for (let i = 0; i < format6.length && digitIndex < cleaned.length; i++) {
64928
+ if (format6[i] === "x") {
63475
64929
  formatted += cleaned[digitIndex];
63476
64930
  digitIndex++;
63477
64931
  } else {
63478
- formatted += format3[i];
64932
+ formatted += format6[i];
63479
64933
  }
63480
64934
  }
63481
64935
  return formatted;